mirror of
https://github.com/pxdg-afk/paxad.git
synced 2026-08-23 04:21:07 -04:00
1297 lines
1.0 MiB
1297 lines
1.0 MiB
/*
|
||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
if you want to view the source, please visit the github repository of this plugin
|
||
*/
|
||
|
||
"use strict";var GL=Object.create;var ud=Object.defineProperty;var QL=Object.getOwnPropertyDescriptor;var KL=Object.getOwnPropertyNames;var ZL=Object.getPrototypeOf,YL=Object.prototype.hasOwnProperty;var se=(t,e)=>()=>(t&&(e=t(t=0)),e);var W=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fu=(t,e)=>{for(var n in e)ud(t,n,{get:e[n],enumerable:!0})},sx=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of KL(e))!YL.call(t,i)&&i!==n&&ud(t,i,{get:()=>e[i],enumerable:!(r=QL(e,i))||r.enumerable});return t};var it=(t,e,n)=>(n=t!=null?GL(ZL(t)):{},sx(e||!t||!t.__esModule?ud(n,"default",{value:t,enumerable:!0}):n,t)),JL=t=>sx(ud({},"__esModule",{value:!0}),t);var lx=W(fd=>{"use strict";m();fd.byteLength=eB;fd.toByteArray=nB;fd.fromByteArray=sB;var yi=[],Sr=[],XL=typeof Uint8Array<"u"?Uint8Array:Array,xy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ro=0,ox=xy.length;Ro<ox;++Ro)yi[Ro]=xy[Ro],Sr[xy.charCodeAt(Ro)]=Ro;var Ro,ox;Sr[45]=62;Sr[95]=63;function ax(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function eB(t){var e=ax(t),n=e[0],r=e[1];return(n+r)*3/4-r}function tB(t,e,n){return(e+n)*3/4-n}function nB(t){var e,n=ax(t),r=n[0],i=n[1],s=new XL(tB(t,r,i)),o=0,a=i>0?r-4:r,l;for(l=0;l<a;l+=4)e=Sr[t.charCodeAt(l)]<<18|Sr[t.charCodeAt(l+1)]<<12|Sr[t.charCodeAt(l+2)]<<6|Sr[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Sr[t.charCodeAt(l)]<<2|Sr[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Sr[t.charCodeAt(l)]<<10|Sr[t.charCodeAt(l+1)]<<4|Sr[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function rB(t){return yi[t>>18&63]+yi[t>>12&63]+yi[t>>6&63]+yi[t&63]}function iB(t,e,n){for(var r,i=[],s=e;s<n;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(rB(r));return i.join("")}function sB(t){for(var e,n=t.length,r=n%3,i=[],s=16383,o=0,a=n-r;o<a;o+=s)i.push(iB(t,o,o+s>a?a:o+s));return r===1?(e=t[n-1],i.push(yi[e>>2]+yi[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(yi[e>>10]+yi[e>>4&63]+yi[e<<2&63]+"=")),i.join("")}});var cx=W(Sy=>{m();Sy.read=function(t,e,n,r,i){var s,o,a=i*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,s=d&(1<<-u)-1,d>>=-u,u+=a;u>0;s=s*256+t[e+f],f+=h,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=r;u>0;o=o*256+t[e+f],f+=h,u-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-c}return(d?-1:1)*o*Math.pow(2,s-r)};Sy.write=function(t,e,n,r,i,s){var o,a,l,c=s*8-i-1,u=(1<<c)-1,f=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(e*l-1)*Math.pow(2,i),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[n+d]=a&255,d+=p,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;t[n+d]=o&255,d+=p,o/=256,c-=8);t[n+d-p]|=g*128}});var md=W(el=>{"use strict";m();var Dy=lx(),Ja=cx(),ux=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;el.Buffer=$;el.SlowBuffer=fB;el.INSPECT_MAX_BYTES=50;var hd=2147483647;el.kMaxLength=hd;$.TYPED_ARRAY_SUPPORT=oB();!$.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function oB(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function Qi(t){if(t>hd)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(t,e,n){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ty(t)}return mx(t,e,n)}$.poolSize=8192;function mx(t,e,n){if(typeof t=="string")return lB(t,e);if(ArrayBuffer.isView(t))return cB(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(wi(t,ArrayBuffer)||t&&wi(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wi(t,SharedArrayBuffer)||t&&wi(t.buffer,SharedArrayBuffer)))return _y(t,e,n);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return $.from(r,e,n);let i=uB(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}$.from=function(t,e,n){return mx(t,e,n)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function px(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function aB(t,e,n){return px(t),t<=0?Qi(t):e!==void 0?typeof n=="string"?Qi(t).fill(e,n):Qi(t).fill(e):Qi(t)}$.alloc=function(t,e,n){return aB(t,e,n)};function Ty(t){return px(t),Qi(t<0?0:Fy(t)|0)}$.allocUnsafe=function(t){return Ty(t)};$.allocUnsafeSlow=function(t){return Ty(t)};function lB(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=gx(t,e)|0,r=Qi(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function Ey(t){let e=t.length<0?0:Fy(t.length)|0,n=Qi(e);for(let r=0;r<e;r+=1)n[r]=t[r]&255;return n}function cB(t){if(wi(t,Uint8Array)){let e=new Uint8Array(t);return _y(e.buffer,e.byteOffset,e.byteLength)}return Ey(t)}function _y(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return e===void 0&&n===void 0?r=new Uint8Array(t):n===void 0?r=new Uint8Array(t,e):r=new Uint8Array(t,e,n),Object.setPrototypeOf(r,$.prototype),r}function uB(t){if($.isBuffer(t)){let e=Fy(t.length)|0,n=Qi(e);return n.length===0||t.copy(n,0,0,e),n}if(t.length!==void 0)return typeof t.length!="number"||Ay(t.length)?Qi(0):Ey(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ey(t.data)}function Fy(t){if(t>=hd)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hd.toString(16)+" bytes");return t|0}function fB(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,n){if(wi(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),wi(n,Uint8Array)&&(n=$.from(n,n.offset,n.byteLength)),!$.isBuffer(e)||!$.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===n)return 0;let r=e.length,i=n.length;for(let s=0,o=Math.min(r,i);s<o;++s)if(e[s]!==n[s]){r=e[s],i=n[s];break}return r<i?-1:i<r?1:0};$.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};$.concat=function(e,n){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return $.alloc(0);let r;if(n===void 0)for(n=0,r=0;r<e.length;++r)n+=e[r].length;let i=$.allocUnsafe(n),s=0;for(r=0;r<e.length;++r){let o=e[r];if(wi(o,Uint8Array))s+o.length>i.length?($.isBuffer(o)||(o=$.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function gx(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||wi(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let n=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Cy(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Ex(t).length;default:if(i)return r?-1:Cy(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=gx;function hB(t,e,n){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return xB(this,e,n);case"utf8":case"utf-8":return wx(this,e,n);case"ascii":return vB(this,e,n);case"latin1":case"binary":return kB(this,e,n);case"base64":return wB(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return SB(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}$.prototype._isBuffer=!0;function zo(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}$.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<e;n+=2)zo(this,n,n+1);return this};$.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<e;n+=4)zo(this,n,n+3),zo(this,n+1,n+2);return this};$.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<e;n+=8)zo(this,n,n+7),zo(this,n+1,n+6),zo(this,n+2,n+5),zo(this,n+3,n+4);return this};$.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?wx(this,0,e):hB.apply(this,arguments)};$.prototype.toLocaleString=$.prototype.toString;$.prototype.equals=function(e){if(!$.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:$.compare(this,e)===0};$.prototype.inspect=function(){let e="",n=el.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"};ux&&($.prototype[ux]=$.prototype.inspect);$.prototype.compare=function(e,n,r,i,s){if(wi(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(n===void 0&&(n=0),r===void 0&&(r=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),n<0||r>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&n>=r)return 0;if(i>=s)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=r-n,l=Math.min(o,a),c=this.slice(i,s),u=e.slice(n,r);for(let f=0;f<l;++f)if(c[f]!==u[f]){o=c[f],a=u[f];break}return o<a?-1:a<o?1:0};function yx(t,e,n,r,i){if(t.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ay(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof e=="string"&&(e=$.from(e,r)),$.isBuffer(e))return e.length===0?-1:fx(t,e,n,r,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):fx(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function fx(t,e,n,r,i){let s=1,o=t.length,a=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,n/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(i){let u=-1;for(c=n;c<o;c++)if(l(t,c)===l(e,u===-1?0:c-u)){if(u===-1&&(u=c),c-u+1===a)return u*s}else u!==-1&&(c-=c-u),u=-1}else for(n+a>o&&(n=o-a),c=n;c>=0;c--){let u=!0;for(let f=0;f<a;f++)if(l(t,c+f)!==l(e,f)){u=!1;break}if(u)return c}return-1}$.prototype.includes=function(e,n,r){return this.indexOf(e,n,r)!==-1};$.prototype.indexOf=function(e,n,r){return yx(this,e,n,r,!0)};$.prototype.lastIndexOf=function(e,n,r){return yx(this,e,n,r,!1)};function dB(t,e,n,r){n=Number(n)||0;let i=t.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let s=e.length;r>s/2&&(r=s/2);let o;for(o=0;o<r;++o){let a=parseInt(e.substr(o*2,2),16);if(Ay(a))return o;t[n+o]=a}return o}function mB(t,e,n,r){return dd(Cy(e,t.length-n),t,n,r)}function pB(t,e,n,r){return dd(CB(e),t,n,r)}function gB(t,e,n,r){return dd(Ex(e),t,n,r)}function yB(t,e,n,r){return dd(TB(e,t.length-n),t,n,r)}$.prototype.write=function(e,n,r,i){if(n===void 0)i="utf8",r=this.length,n=0;else if(r===void 0&&typeof n=="string")i=n,r=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-n;if((r===void 0||r>s)&&(r=s),e.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return dB(this,e,n,r);case"utf8":case"utf-8":return mB(this,e,n,r);case"ascii":case"latin1":case"binary":return pB(this,e,n,r);case"base64":return gB(this,e,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yB(this,e,n,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wB(t,e,n){return e===0&&n===t.length?Dy.fromByteArray(t):Dy.fromByteArray(t.slice(e,n))}function wx(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i<n;){let s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=n){let l,c,u,f;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[i+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(o=f));break;case 3:l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=a}return bB(r)}var hx=4096;function bB(t){let e=t.length;if(e<=hx)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=hx));return n}function vB(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]&127);return r}function kB(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function xB(t,e,n){let r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let s=e;s<n;++s)i+=FB[t[s]];return i}function SB(t,e,n){let r=t.slice(e,n),i="";for(let s=0;s<r.length-1;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}$.prototype.slice=function(e,n){let r=this.length;e=~~e,n=n===void 0?r:~~n,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n<e&&(n=e);let i=this.subarray(e,n);return Object.setPrototypeOf(i,$.prototype),i};function jt(t,e,n){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,n,r){e=e>>>0,n=n>>>0,r||jt(e,n,this.length);let i=this[e],s=1,o=0;for(;++o<n&&(s*=256);)i+=this[e+o]*s;return i};$.prototype.readUintBE=$.prototype.readUIntBE=function(e,n,r){e=e>>>0,n=n>>>0,r||jt(e,n,this.length);let i=this[e+--n],s=1;for(;n>0&&(s*=256);)i+=this[e+--n]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,n){return e=e>>>0,n||jt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||jt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||jt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||jt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||jt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readBigUInt64LE=Ss(function(e){e=e>>>0,Xa(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&hu(e,this.length-8);let i=n+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});$.prototype.readBigUInt64BE=Ss(function(e){e=e>>>0,Xa(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&hu(e,this.length-8);let i=n*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(i)<<BigInt(32))+BigInt(s)});$.prototype.readIntLE=function(e,n,r){e=e>>>0,n=n>>>0,r||jt(e,n,this.length);let i=this[e],s=1,o=0;for(;++o<n&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*n)),i};$.prototype.readIntBE=function(e,n,r){e=e>>>0,n=n>>>0,r||jt(e,n,this.length);let i=n,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*n)),o};$.prototype.readInt8=function(e,n){return e=e>>>0,n||jt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,n){e=e>>>0,n||jt(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};$.prototype.readInt16BE=function(e,n){e=e>>>0,n||jt(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};$.prototype.readInt32LE=function(e,n){return e=e>>>0,n||jt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,n){return e=e>>>0,n||jt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readBigInt64LE=Ss(function(e){e=e>>>0,Xa(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&hu(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(n+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});$.prototype.readBigInt64BE=Ss(function(e){e=e>>>0,Xa(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&hu(e,this.length-8);let i=(n<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r)});$.prototype.readFloatLE=function(e,n){return e=e>>>0,n||jt(e,4,this.length),Ja.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,n){return e=e>>>0,n||jt(e,4,this.length),Ja.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||jt(e,8,this.length),Ja.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||jt(e,8,this.length),Ja.read(this,e,!1,52,8)};function On(t,e,n,r,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.prototype.writeUIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;On(this,e,n,r,a,0)}let s=1,o=0;for(this[n]=e&255;++o<r&&(s*=256);)this[n+o]=e/s&255;return n+r};$.prototype.writeUintBE=$.prototype.writeUIntBE=function(e,n,r,i){if(e=+e,n=n>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;On(this,e,n,r,a,0)}let s=r-1,o=1;for(this[n+s]=e&255;--s>=0&&(o*=256);)this[n+s]=e/o&255;return n+r};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,1,255,0),this[n]=e&255,n+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function bx(t,e,n,r,i){Dx(e,r,i,t,n,7);let s=Number(e&BigInt(4294967295));t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=o,o=o>>8,t[n++]=o,o=o>>8,t[n++]=o,o=o>>8,t[n++]=o,n}function vx(t,e,n,r,i){Dx(e,r,i,t,n,7);let s=Number(e&BigInt(4294967295));t[n+7]=s,s=s>>8,t[n+6]=s,s=s>>8,t[n+5]=s,s=s>>8,t[n+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=o,o=o>>8,t[n+2]=o,o=o>>8,t[n+1]=o,o=o>>8,t[n]=o,n+8}$.prototype.writeBigUInt64LE=Ss(function(e,n=0){return bx(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeBigUInt64BE=Ss(function(e,n=0){return vx(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);On(this,e,n,r,l-1,-l)}let s=0,o=1,a=0;for(this[n]=e&255;++s<r&&(o*=256);)e<0&&a===0&&this[n+s-1]!==0&&(a=1),this[n+s]=(e/o>>0)-a&255;return n+r};$.prototype.writeIntBE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);On(this,e,n,r,l-1,-l)}let s=r-1,o=1,a=0;for(this[n+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[n+s+1]!==0&&(a=1),this[n+s]=(e/o>>0)-a&255;return n+r};$.prototype.writeInt8=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1};$.prototype.writeInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2};$.prototype.writeInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2};$.prototype.writeInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4};$.prototype.writeInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||On(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};$.prototype.writeBigInt64LE=Ss(function(e,n=0){return bx(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$.prototype.writeBigInt64BE=Ss(function(e,n=0){return vx(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function kx(t,e,n,r,i,s){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function xx(t,e,n,r,i){return e=+e,n=n>>>0,i||kx(t,e,n,4,34028234663852886e22,-34028234663852886e22),Ja.write(t,e,n,r,23,4),n+4}$.prototype.writeFloatLE=function(e,n,r){return xx(this,e,n,!0,r)};$.prototype.writeFloatBE=function(e,n,r){return xx(this,e,n,!1,r)};function Sx(t,e,n,r,i){return e=+e,n=n>>>0,i||kx(t,e,n,8,17976931348623157e292,-17976931348623157e292),Ja.write(t,e,n,r,52,8),n+8}$.prototype.writeDoubleLE=function(e,n,r){return Sx(this,e,n,!0,r)};$.prototype.writeDoubleBE=function(e,n,r){return Sx(this,e,n,!1,r)};$.prototype.copy=function(e,n,r,i){if(!$.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),n>=e.length&&(n=e.length),n||(n=0),i>0&&i<r&&(i=r),i===r||e.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-n<i-r&&(i=e.length-n+r);let s=i-r;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),n),s};$.prototype.fill=function(e,n,r,i){if(typeof e=="string"){if(typeof n=="string"?(i=n,n=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!$.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;n=n>>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let s;if(typeof e=="number")for(s=n;s<r;++s)this[s]=e;else{let o=$.isBuffer(e)?e:$.from(e,i),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-n;++s)this[s+n]=o[s%a]}return this};var Ya={};function Iy(t,e,n){Ya[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Iy("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Iy("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Iy("ERR_OUT_OF_RANGE",function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=dx(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=dx(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);function dx(t){let e="",n=t.length,r=t[0]==="-"?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function DB(t,e,n){Xa(e,"offset"),(t[e]===void 0||t[e+n]===void 0)&&hu(e,t.length-(n+1))}function Dx(t,e,n,r,i,s){if(t>n||t<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${n}${o}`,new Ya.ERR_OUT_OF_RANGE("value",a,t)}DB(r,i,s)}function Xa(t,e){if(typeof t!="number")throw new Ya.ERR_INVALID_ARG_TYPE(e,"number",t)}function hu(t,e,n){throw Math.floor(t)!==t?(Xa(t,n),new Ya.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new Ya.ERR_BUFFER_OUT_OF_BOUNDS:new Ya.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}var EB=/[^+/0-9A-Za-z-_]/g;function _B(t){if(t=t.split("=")[0],t=t.trim().replace(EB,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Cy(t,e){e=e||1/0;let n,r=t.length,i=null,s=[];for(let o=0;o<r;++o){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===r){(e-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,n&63|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return s}function CB(t){let e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n)&255);return e}function TB(t,e){let n,r,i,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)n=t.charCodeAt(o),r=n>>8,i=n%256,s.push(i),s.push(r);return s}function Ex(t){return Dy.toByteArray(_B(t))}function dd(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function wi(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ay(t){return t!==t}var FB=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Ss(t){return typeof BigInt>"u"?IB:t}function IB(){throw new Error("BigInt not supported")}});var _x,Oy,x,m=se(()=>{"use strict";_x=require("obsidian");_x.Platform.isMobileApp?Oy=md().Buffer:Oy=globalThis.Buffer;x=Oy});var Ix=W((UY,Fx)=>{"use strict";m();Fx.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}});var Mx=W((qY,Nx)=>{m();var AB=1/0,OB="[object Symbol]",PB=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,NB="\\u0300-\\u036f\\ufe20-\\ufe23",MB="\\u20d0-\\u20f0",RB="["+NB+MB+"]",zB=RegExp(RB,"g"),LB={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},BB=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,$B=typeof self=="object"&&self&&self.Object===Object&&self,UB=BB||$B||Function("return this")();function jB(t){return function(e){return t?.[e]}}var qB=jB(LB),VB=Object.prototype,HB=VB.toString,Ax=UB.Symbol,Ox=Ax?Ax.prototype:void 0,Px=Ox?Ox.toString:void 0;function WB(t){if(typeof t=="string")return t;if(QB(t))return Px?Px.call(t):"";var e=t+"";return e=="0"&&1/t==-AB?"-0":e}function GB(t){return!!t&&typeof t=="object"}function QB(t){return typeof t=="symbol"||GB(t)&&HB.call(t)==OB}function KB(t){return t==null?"":WB(t)}function ZB(t){return t=KB(t),t&&t.replace(PB,qB).replace(zB,"")}Nx.exports=ZB});var zx=W((HY,Rx)=>{"use strict";m();var YB=/[|\\{}()[\]^$+*?.-]/g;Rx.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(YB,"\\$&")}});var Bx=W((GY,Lx)=>{"use strict";m();Lx.exports=[["\xDF","ss"],["\xE4","ae"],["\xC4","Ae"],["\xF6","oe"],["\xD6","Oe"],["\xFC","ue"],["\xDC","Ue"],["\xC0","A"],["\xC1","A"],["\xC2","A"],["\xC3","A"],["\xC4","Ae"],["\xC5","A"],["\xC6","AE"],["\xC7","C"],["\xC8","E"],["\xC9","E"],["\xCA","E"],["\xCB","E"],["\xCC","I"],["\xCD","I"],["\xCE","I"],["\xCF","I"],["\xD0","D"],["\xD1","N"],["\xD2","O"],["\xD3","O"],["\xD4","O"],["\xD5","O"],["\xD6","Oe"],["\u0150","O"],["\xD8","O"],["\xD9","U"],["\xDA","U"],["\xDB","U"],["\xDC","Ue"],["\u0170","U"],["\xDD","Y"],["\xDE","TH"],["\xDF","ss"],["\xE0","a"],["\xE1","a"],["\xE2","a"],["\xE3","a"],["\xE4","ae"],["\xE5","a"],["\xE6","ae"],["\xE7","c"],["\xE8","e"],["\xE9","e"],["\xEA","e"],["\xEB","e"],["\xEC","i"],["\xED","i"],["\xEE","i"],["\xEF","i"],["\xF0","d"],["\xF1","n"],["\xF2","o"],["\xF3","o"],["\xF4","o"],["\xF5","o"],["\xF6","oe"],["\u0151","o"],["\xF8","o"],["\xF9","u"],["\xFA","u"],["\xFB","u"],["\xFC","ue"],["\u0171","u"],["\xFD","y"],["\xFE","th"],["\xFF","y"],["\u1E9E","SS"],["\xE0","a"],["\xC0","A"],["\xE1","a"],["\xC1","A"],["\xE2","a"],["\xC2","A"],["\xE3","a"],["\xC3","A"],["\xE8","e"],["\xC8","E"],["\xE9","e"],["\xC9","E"],["\xEA","e"],["\xCA","E"],["\xEC","i"],["\xCC","I"],["\xED","i"],["\xCD","I"],["\xF2","o"],["\xD2","O"],["\xF3","o"],["\xD3","O"],["\xF4","o"],["\xD4","O"],["\xF5","o"],["\xD5","O"],["\xF9","u"],["\xD9","U"],["\xFA","u"],["\xDA","U"],["\xFD","y"],["\xDD","Y"],["\u0103","a"],["\u0102","A"],["\u0110","D"],["\u0111","d"],["\u0129","i"],["\u0128","I"],["\u0169","u"],["\u0168","U"],["\u01A1","o"],["\u01A0","O"],["\u01B0","u"],["\u01AF","U"],["\u1EA1","a"],["\u1EA0","A"],["\u1EA3","a"],["\u1EA2","A"],["\u1EA5","a"],["\u1EA4","A"],["\u1EA7","a"],["\u1EA6","A"],["\u1EA9","a"],["\u1EA8","A"],["\u1EAB","a"],["\u1EAA","A"],["\u1EAD","a"],["\u1EAC","A"],["\u1EAF","a"],["\u1EAE","A"],["\u1EB1","a"],["\u1EB0","A"],["\u1EB3","a"],["\u1EB2","A"],["\u1EB5","a"],["\u1EB4","A"],["\u1EB7","a"],["\u1EB6","A"],["\u1EB9","e"],["\u1EB8","E"],["\u1EBB","e"],["\u1EBA","E"],["\u1EBD","e"],["\u1EBC","E"],["\u1EBF","e"],["\u1EBE","E"],["\u1EC1","e"],["\u1EC0","E"],["\u1EC3","e"],["\u1EC2","E"],["\u1EC5","e"],["\u1EC4","E"],["\u1EC7","e"],["\u1EC6","E"],["\u1EC9","i"],["\u1EC8","I"],["\u1ECB","i"],["\u1ECA","I"],["\u1ECD","o"],["\u1ECC","O"],["\u1ECF","o"],["\u1ECE","O"],["\u1ED1","o"],["\u1ED0","O"],["\u1ED3","o"],["\u1ED2","O"],["\u1ED5","o"],["\u1ED4","O"],["\u1ED7","o"],["\u1ED6","O"],["\u1ED9","o"],["\u1ED8","O"],["\u1EDB","o"],["\u1EDA","O"],["\u1EDD","o"],["\u1EDC","O"],["\u1EDF","o"],["\u1EDE","O"],["\u1EE1","o"],["\u1EE0","O"],["\u1EE3","o"],["\u1EE2","O"],["\u1EE5","u"],["\u1EE4","U"],["\u1EE7","u"],["\u1EE6","U"],["\u1EE9","u"],["\u1EE8","U"],["\u1EEB","u"],["\u1EEA","U"],["\u1EED","u"],["\u1EEC","U"],["\u1EEF","u"],["\u1EEE","U"],["\u1EF1","u"],["\u1EF0","U"],["\u1EF3","y"],["\u1EF2","Y"],["\u1EF5","y"],["\u1EF4","Y"],["\u1EF7","y"],["\u1EF6","Y"],["\u1EF9","y"],["\u1EF8","Y"],["\u0621","e"],["\u0622","a"],["\u0623","a"],["\u0624","w"],["\u0625","i"],["\u0626","y"],["\u0627","a"],["\u0628","b"],["\u0629","t"],["\u062A","t"],["\u062B","th"],["\u062C","j"],["\u062D","h"],["\u062E","kh"],["\u062F","d"],["\u0630","dh"],["\u0631","r"],["\u0632","z"],["\u0633","s"],["\u0634","sh"],["\u0635","s"],["\u0636","d"],["\u0637","t"],["\u0638","z"],["\u0639","e"],["\u063A","gh"],["\u0640","_"],["\u0641","f"],["\u0642","q"],["\u0643","k"],["\u0644","l"],["\u0645","m"],["\u0646","n"],["\u0647","h"],["\u0648","w"],["\u0649","a"],["\u064A","y"],["\u064E\u200E","a"],["\u064F","u"],["\u0650\u200E","i"],["\u0660","0"],["\u0661","1"],["\u0662","2"],["\u0663","3"],["\u0664","4"],["\u0665","5"],["\u0666","6"],["\u0667","7"],["\u0668","8"],["\u0669","9"],["\u0686","ch"],["\u06A9","k"],["\u06AF","g"],["\u067E","p"],["\u0698","zh"],["\u06CC","y"],["\u06F0","0"],["\u06F1","1"],["\u06F2","2"],["\u06F3","3"],["\u06F4","4"],["\u06F5","5"],["\u06F6","6"],["\u06F7","7"],["\u06F8","8"],["\u06F9","9"],["\u067C","p"],["\u0681","z"],["\u0685","c"],["\u0689","d"],["\uFEAB","d"],["\uFEAD","r"],["\u0693","r"],["\uFEAF","z"],["\u0696","g"],["\u069A","x"],["\u06AB","g"],["\u06BC","n"],["\u06C0","e"],["\u06D0","e"],["\u06CD","ai"],["\u0679","t"],["\u0688","d"],["\u0691","r"],["\u06BA","n"],["\u06C1","h"],["\u06BE","h"],["\u06D2","e"],["\u0410","A"],["\u0430","a"],["\u0411","B"],["\u0431","b"],["\u0412","V"],["\u0432","v"],["\u0413","G"],["\u0433","g"],["\u0414","D"],["\u0434","d"],["\u0415","E"],["\u0435","e"],["\u0416","Zh"],["\u0436","zh"],["\u0417","Z"],["\u0437","z"],["\u0418","I"],["\u0438","i"],["\u0419","J"],["\u0439","j"],["\u041A","K"],["\u043A","k"],["\u041B","L"],["\u043B","l"],["\u041C","M"],["\u043C","m"],["\u041D","N"],["\u043D","n"],["\u041E","O"],["\u043E","o"],["\u041F","P"],["\u043F","p"],["\u0420","R"],["\u0440","r"],["\u0421","S"],["\u0441","s"],["\u0422","T"],["\u0442","t"],["\u0423","U"],["\u0443","u"],["\u0424","F"],["\u0444","f"],["\u0425","H"],["\u0445","h"],["\u0426","Cz"],["\u0446","cz"],["\u0427","Ch"],["\u0447","ch"],["\u0428","Sh"],["\u0448","sh"],["\u0429","Shh"],["\u0449","shh"],["\u042A",""],["\u044A",""],["\u042B","Y"],["\u044B","y"],["\u042C",""],["\u044C",""],["\u042D","E"],["\u044D","e"],["\u042E","Yu"],["\u044E","yu"],["\u042F","Ya"],["\u044F","ya"],["\u0401","Yo"],["\u0451","yo"],["\u0103","a"],["\u0102","A"],["\u0219","s"],["\u0218","S"],["\u021B","t"],["\u021A","T"],["\u0163","t"],["\u0162","T"],["\u015F","s"],["\u015E","S"],["\xE7","c"],["\xC7","C"],["\u011F","g"],["\u011E","G"],["\u0131","i"],["\u0130","I"],["\u0561","a"],["\u0531","A"],["\u0562","b"],["\u0532","B"],["\u0563","g"],["\u0533","G"],["\u0564","d"],["\u0534","D"],["\u0565","ye"],["\u0535","Ye"],["\u0566","z"],["\u0536","Z"],["\u0567","e"],["\u0537","E"],["\u0568","y"],["\u0538","Y"],["\u0569","t"],["\u0539","T"],["\u056A","zh"],["\u053A","Zh"],["\u056B","i"],["\u053B","I"],["\u056C","l"],["\u053C","L"],["\u056D","kh"],["\u053D","Kh"],["\u056E","ts"],["\u053E","Ts"],["\u056F","k"],["\u053F","K"],["\u0570","h"],["\u0540","H"],["\u0571","dz"],["\u0541","Dz"],["\u0572","gh"],["\u0542","Gh"],["\u0573","tch"],["\u0543","Tch"],["\u0574","m"],["\u0544","M"],["\u0575","y"],["\u0545","Y"],["\u0576","n"],["\u0546","N"],["\u0577","sh"],["\u0547","Sh"],["\u0578","vo"],["\u0548","Vo"],["\u0579","ch"],["\u0549","Ch"],["\u057A","p"],["\u054A","P"],["\u057B","j"],["\u054B","J"],["\u057C","r"],["\u054C","R"],["\u057D","s"],["\u054D","S"],["\u057E","v"],["\u054E","V"],["\u057F","t"],["\u054F","T"],["\u0580","r"],["\u0550","R"],["\u0581","c"],["\u0551","C"],["\u0578\u0582","u"],["\u0548\u0552","U"],["\u0548\u0582","U"],["\u0583","p"],["\u0553","P"],["\u0584","q"],["\u0554","Q"],["\u0585","o"],["\u0555","O"],["\u0586","f"],["\u0556","F"],["\u0587","yev"],["\u10D0","a"],["\u10D1","b"],["\u10D2","g"],["\u10D3","d"],["\u10D4","e"],["\u10D5","v"],["\u10D6","z"],["\u10D7","t"],["\u10D8","i"],["\u10D9","k"],["\u10DA","l"],["\u10DB","m"],["\u10DC","n"],["\u10DD","o"],["\u10DE","p"],["\u10DF","zh"],["\u10E0","r"],["\u10E1","s"],["\u10E2","t"],["\u10E3","u"],["\u10E4","ph"],["\u10E5","q"],["\u10E6","gh"],["\u10E7","k"],["\u10E8","sh"],["\u10E9","ch"],["\u10EA","ts"],["\u10EB","dz"],["\u10EC","ts"],["\u10ED","tch"],["\u10EE","kh"],["\u10EF","j"],["\u10F0","h"],["\u010D","c"],["\u010F","d"],["\u011B","e"],["\u0148","n"],["\u0159","r"],["\u0161","s"],["\u0165","t"],["\u016F","u"],["\u017E","z"],["\u010C","C"],["\u010E","D"],["\u011A","E"],["\u0147","N"],["\u0158","R"],["\u0160","S"],["\u0164","T"],["\u016E","U"],["\u017D","Z"],["\u0780","h"],["\u0781","sh"],["\u0782","n"],["\u0783","r"],["\u0784","b"],["\u0785","lh"],["\u0786","k"],["\u0787","a"],["\u0788","v"],["\u0789","m"],["\u078A","f"],["\u078B","dh"],["\u078C","th"],["\u078D","l"],["\u078E","g"],["\u078F","gn"],["\u0790","s"],["\u0791","d"],["\u0792","z"],["\u0793","t"],["\u0794","y"],["\u0795","p"],["\u0796","j"],["\u0797","ch"],["\u0798","tt"],["\u0799","hh"],["\u079A","kh"],["\u079B","th"],["\u079C","z"],["\u079D","sh"],["\u079E","s"],["\u079F","d"],["\u07A0","t"],["\u07A1","z"],["\u07A2","a"],["\u07A3","gh"],["\u07A4","q"],["\u07A5","w"],["\u07A6","a"],["\u07A7","aa"],["\u07A8","i"],["\u07A9","ee"],["\u07AA","u"],["\u07AB","oo"],["\u07AC","e"],["\u07AD","ey"],["\u07AE","o"],["\u07AF","oa"],["\u07B0",""],["\u03B1","a"],["\u03B2","v"],["\u03B3","g"],["\u03B4","d"],["\u03B5","e"],["\u03B6","z"],["\u03B7","i"],["\u03B8","th"],["\u03B9","i"],["\u03BA","k"],["\u03BB","l"],["\u03BC","m"],["\u03BD","n"],["\u03BE","ks"],["\u03BF","o"],["\u03C0","p"],["\u03C1","r"],["\u03C3","s"],["\u03C4","t"],["\u03C5","y"],["\u03C6","f"],["\u03C7","x"],["\u03C8","ps"],["\u03C9","o"],["\u03AC","a"],["\u03AD","e"],["\u03AF","i"],["\u03CC","o"],["\u03CD","y"],["\u03AE","i"],["\u03CE","o"],["\u03C2","s"],["\u03CA","i"],["\u03B0","y"],["\u03CB","y"],["\u0390","i"],["\u0391","A"],["\u0392","B"],["\u0393","G"],["\u0394","D"],["\u0395","E"],["\u0396","Z"],["\u0397","I"],["\u0398","TH"],["\u0399","I"],["\u039A","K"],["\u039B","L"],["\u039C","M"],["\u039D","N"],["\u039E","KS"],["\u039F","O"],["\u03A0","P"],["\u03A1","R"],["\u03A3","S"],["\u03A4","T"],["\u03A5","Y"],["\u03A6","F"],["\u03A7","X"],["\u03A8","PS"],["\u03A9","O"],["\u0386","A"],["\u0388","E"],["\u038A","I"],["\u038C","O"],["\u038E","Y"],["\u0389","I"],["\u038F","O"],["\u03AA","I"],["\u03AB","Y"],["\u0101","a"],["\u0113","e"],["\u0123","g"],["\u012B","i"],["\u0137","k"],["\u013C","l"],["\u0146","n"],["\u016B","u"],["\u0100","A"],["\u0112","E"],["\u0122","G"],["\u012A","I"],["\u0136","K"],["\u013B","L"],["\u0145","N"],["\u016A","U"],["\u010D","c"],["\u0161","s"],["\u017E","z"],["\u010C","C"],["\u0160","S"],["\u017D","Z"],["\u0105","a"],["\u010D","c"],["\u0119","e"],["\u0117","e"],["\u012F","i"],["\u0161","s"],["\u0173","u"],["\u016B","u"],["\u017E","z"],["\u0104","A"],["\u010C","C"],["\u0118","E"],["\u0116","E"],["\u012E","I"],["\u0160","S"],["\u0172","U"],["\u016A","U"],["\u040C","Kj"],["\u045C","kj"],["\u0409","Lj"],["\u0459","lj"],["\u040A","Nj"],["\u045A","nj"],["\u0422\u0441","Ts"],["\u0442\u0441","ts"],["\u0105","a"],["\u0107","c"],["\u0119","e"],["\u0142","l"],["\u0144","n"],["\u015B","s"],["\u017A","z"],["\u017C","z"],["\u0104","A"],["\u0106","C"],["\u0118","E"],["\u0141","L"],["\u0143","N"],["\u015A","S"],["\u0179","Z"],["\u017B","Z"],["\u0404","Ye"],["\u0406","I"],["\u0407","Yi"],["\u0490","G"],["\u0454","ye"],["\u0456","i"],["\u0457","yi"],["\u0491","g"]]});var Ux=W((KY,$x)=>{"use strict";m();var JB=Mx(),XB=zx(),e$=Bx(),t$=(t,e)=>{for(let[n,r]of e)t=t.replace(new RegExp(XB(n),"g"),r);return t};$x.exports=(t,e)=>{if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={customReplacements:[],...e};let n=new Map([...e$,...e.customReplacements]);return t=t.normalize(),t=t$(t,n),t=JB(t),t}});var qx=W((YY,jx)=>{"use strict";m();jx.exports=[["&"," and "],["\u{1F984}"," unicorn "],["\u2665"," love "]]});var Hx=W((XY,Py)=>{"use strict";m();var n$=Ix(),r$=Ux(),i$=qx(),s$=t=>t.replace(/([A-Z]{2,})(\d+)/g,"$1 $2").replace(/([a-z\d]+)([A-Z]{2,})/g,"$1 $2").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1 $2"),o$=(t,e)=>{let n=n$(e);return t.replace(new RegExp(`${n}{2,}`,"g"),e).replace(new RegExp(`^${n}|${n}$`,"g"),"")},Vx=(t,e)=>{if(typeof t!="string")throw new TypeError(`Expected a string, got \`${typeof t}\``);e={separator:"-",lowercase:!0,decamelize:!0,customReplacements:[],preserveLeadingUnderscore:!1,...e};let n=e.preserveLeadingUnderscore&&t.startsWith("_"),r=new Map([...i$,...e.customReplacements]);t=r$(t,{customReplacements:r}),e.decamelize&&(t=s$(t));let i=/[^a-zA-Z\d]+/g;return e.lowercase&&(t=t.toLowerCase(),i=/[^a-z\d]+/g),t=t.replace(i,e.separator),t=t.replace(/\\/g,""),e.separator&&(t=o$(t,e.separator)),n&&(t=`_${t}`),t},a$=()=>{let t=new Map,e=(n,r)=>{if(n=Vx(n,r),!n)return"";let i=n.toLowerCase(),s=t.get(i.replace(/(?:-\d+?)+?$/,""))||0,o=t.get(i);t.set(i,typeof o=="number"?o+1:1);let a=t.get(i)||2;return(a>=2||s>2)&&(n=`${n}-${a}`),n};return e.reset=()=>{t.clear()},e};Py.exports=Vx;Py.exports.counter=a$});var vt=W((Yx,wd)=>{m();(function(t){"use strict";var e={};e.VERSION="1.6.1";var n,r={},i=function(c,u){return function(){return u.apply(c,arguments)}},s=function(){var c=arguments,u=c[0],f,h;for(h=1;h<c.length;h++)for(f in c[h])!(f in u)&&c[h].hasOwnProperty(f)&&(u[f]=c[h][f]);return u},o=function(c,u){return{value:c,name:u}};e.TRACE=o(1,"TRACE"),e.DEBUG=o(2,"DEBUG"),e.INFO=o(3,"INFO"),e.TIME=o(4,"TIME"),e.WARN=o(5,"WARN"),e.ERROR=o(8,"ERROR"),e.OFF=o(99,"OFF");var a=function(c){this.context=c,this.setLevel(c.filterLevel),this.log=this.info};a.prototype={setLevel:function(c){c&&"value"in c&&(this.context.filterLevel=c)},getLevel:function(){return this.context.filterLevel},enabledFor:function(c){var u=this.context.filterLevel;return c.value>=u.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(c){typeof c=="string"&&c.length>0&&this.invoke(e.TIME,[c,"start"])},timeEnd:function(c){typeof c=="string"&&c.length>0&&this.invoke(e.TIME,[c,"end"])},invoke:function(c,u){n&&this.enabledFor(c)&&n(u,s({level:c},this.context))}};var l=new a({filterLevel:e.OFF});(function(){var c=e;c.enabledFor=i(l,l.enabledFor),c.trace=i(l,l.trace),c.debug=i(l,l.debug),c.time=i(l,l.time),c.timeEnd=i(l,l.timeEnd),c.info=i(l,l.info),c.warn=i(l,l.warn),c.error=i(l,l.error),c.log=c.info})(),e.setHandler=function(c){n=c},e.setLevel=function(c){l.setLevel(c);for(var u in r)r.hasOwnProperty(u)&&r[u].setLevel(c)},e.getLevel=function(){return l.getLevel()},e.get=function(c){return r[c]||(r[c]=new a(s({name:c},l.context)))},e.createDefaultHandler=function(c){c=c||{},c.formatter=c.formatter||function(d,p){p.name&&d.unshift("["+p.name+"]")};var u={},f=function(h,d){Function.prototype.apply.call(h,console,d)};return typeof console>"u"?function(){}:function(h,d){h=Array.prototype.slice.call(h);var p=console.log,g;d.level===e.TIME?(g=(d.name?"["+d.name+"] ":"")+h[0],h[1]==="start"?console.time?console.time(g):u[g]=new Date().getTime():console.timeEnd?console.timeEnd(g):f(p,[g+": "+(new Date().getTime()-u[g])+"ms"])):(d.level===e.WARN&&console.warn?p=console.warn:d.level===e.ERROR&&console.error?p=console.error:d.level===e.INFO&&console.info?p=console.info:d.level===e.DEBUG&&console.debug?p=console.debug:d.level===e.TRACE&&console.trace&&(p=console.trace),c.formatter(h,d),f(p,h))}},e.useDefaults=function(c){e.setLevel(c&&c.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(c))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof wd<"u"&&wd.exports?wd.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(Yx)});var oS=W((lJ,sS)=>{"use strict";m();var bd=Object.prototype.hasOwnProperty,iS=Object.prototype.toString,Jx=Object.defineProperty,Xx=Object.getOwnPropertyDescriptor,eS=function(e){return typeof Array.isArray=="function"?Array.isArray(e):iS.call(e)==="[object Array]"},tS=function(e){if(!e||iS.call(e)!=="[object Object]")return!1;var n=bd.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&bd.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||bd.call(e,i)},nS=function(e,n){Jx&&n.name==="__proto__"?Jx(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},rS=function(e,n){if(n==="__proto__")if(bd.call(e,n)){if(Xx)return Xx(e,n).value}else return;return e[n]};sS.exports=function t(){var e,n,r,i,s,o,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(e=arguments[l],e!=null)for(n in e)r=rS(a,n),i=rS(e,n),a!==i&&(u&&i&&(tS(i)||(s=eS(i)))?(s?(s=!1,o=r&&eS(r)?r:[]):o=r&&tS(r)?r:{},nS(a,{name:n,newValue:t(u,o,i)})):typeof i<"u"&&nS(a,{name:n,newValue:i}));return a}});var SD=W((oae,Sw)=>{m();(function(){var t;typeof Sw<"u"?t=Sw.exports=r:t=function(){return this||(0,eval)("this")}(),t.format=r,t.vsprintf=n,typeof console<"u"&&typeof console.log=="function"&&(t.printf=e);function e(){console.log(r.apply(null,arguments))}function n(i,s){return r.apply(null,[i].concat(s))}function r(i){for(var s=1,o=[].slice.call(arguments),a=0,l=i.length,c="",u,f=!1,h,d,p=!1,g,y=function(){return o[s++]},w=function(){for(var b="";/\d/.test(i[a]);)b+=i[a++],u=i[a];return b.length>0?parseInt(b):null};a<l;++a)if(u=i[a],f)switch(f=!1,u=="."?(p=!1,u=i[++a]):u=="0"&&i[a+1]=="."?(p=!0,a+=2,u=i[a]):p=!0,g=w(),u){case"b":c+=parseInt(y(),10).toString(2);break;case"c":h=y(),typeof h=="string"||h instanceof String?c+=h:c+=String.fromCharCode(parseInt(h,10));break;case"d":c+=parseInt(y(),10);break;case"f":d=String(parseFloat(y()).toFixed(g||6)),c+=p?d:d.replace(/^0/,"");break;case"j":c+=JSON.stringify(y());break;case"o":c+="0"+parseInt(y(),10).toString(8);break;case"s":c+=y();break;case"x":c+="0x"+parseInt(y(),10).toString(16);break;case"X":c+="0x"+parseInt(y(),10).toString(16).toUpperCase();break;default:c+=u;break}else u==="%"?f=!0:c+=u;return c}})()});var w0=W(xi=>{"use strict";m();Object.defineProperty(xi,"__esModule",{value:!0});require("obsidian");var Xi=class extends Error{},Vw=class extends Xi{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Hw=class extends Xi{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Ww=class extends Xi{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Zo=class extends Xi{},im=class extends Xi{constructor(e){super(`Invalid unit ${e}`)}},Pn=class extends Xi{},vi=class extends Xi{constructor(){super("Zone is an abstract class")}},re="numeric",Gr="short",nr="long",sm={year:re,month:re,day:re},yE={year:re,month:Gr,day:re},IU={year:re,month:Gr,day:re,weekday:Gr},wE={year:re,month:nr,day:re},bE={year:re,month:nr,day:re,weekday:nr},vE={hour:re,minute:re},kE={hour:re,minute:re,second:re},xE={hour:re,minute:re,second:re,timeZoneName:Gr},SE={hour:re,minute:re,second:re,timeZoneName:nr},DE={hour:re,minute:re,hourCycle:"h23"},EE={hour:re,minute:re,second:re,hourCycle:"h23"},_E={hour:re,minute:re,second:re,hourCycle:"h23",timeZoneName:Gr},CE={hour:re,minute:re,second:re,hourCycle:"h23",timeZoneName:nr},TE={year:re,month:re,day:re,hour:re,minute:re},FE={year:re,month:re,day:re,hour:re,minute:re,second:re},IE={year:re,month:Gr,day:re,hour:re,minute:re},AE={year:re,month:Gr,day:re,hour:re,minute:re,second:re},AU={year:re,month:Gr,day:re,weekday:Gr,hour:re,minute:re},OE={year:re,month:nr,day:re,hour:re,minute:re,timeZoneName:Gr},PE={year:re,month:nr,day:re,hour:re,minute:re,second:re,timeZoneName:Gr},NE={year:re,month:nr,day:re,weekday:nr,hour:re,minute:re,timeZoneName:nr},ME={year:re,month:nr,day:re,weekday:nr,hour:re,minute:re,second:re,timeZoneName:nr},Xo=class{get type(){throw new vi}get name(){throw new vi}get ianaName(){return this.name}get isUniversal(){throw new vi}offsetName(e,n){throw new vi}formatOffset(e,n){throw new vi}offset(e){throw new vi}equals(e){throw new vi}get isValid(){throw new vi}},Rw=null,om=class t extends Xo{static get instance(){return Rw===null&&(Rw=new t),Rw}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return zE(e,n,r)}formatOffset(e,n){return Au(this.offset(e),n)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},nm={};function OU(t){return nm[t]||(nm[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),nm[t]}var PU={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function NU(t,e){let n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,s,o,a,l,c,u]=r;return[o,i,s,a,l,c,u]}function MU(t,e){let n=t.formatToParts(e),r=[];for(let i=0;i<n.length;i++){let{type:s,value:o}=n[i],a=PU[s];s==="era"?r[a]=o:Be(a)||(r[a]=parseInt(o,10))}return r}var Zd={},Ms=class t extends Xo{static create(e){return Zd[e]||(Zd[e]=new t(e)),Zd[e]}static resetCache(){Zd={},nm={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return zE(e,n,r,this.name)}formatOffset(e,n){return Au(this.offset(e),n)}offset(e){let n=new Date(e);if(isNaN(n))return NaN;let r=OU(this.name),[i,s,o,a,l,c,u]=r.formatToParts?MU(r,n):NU(r,n);a==="BC"&&(i=-Math.abs(i)+1);let h=pm({year:i,month:s,day:o,hour:l===24?0:l,minute:c,second:u,millisecond:0}),d=+n,p=d%1e3;return d-=p>=0?p:1e3+p,(h-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}},$D={};function RU(t,e={}){let n=JSON.stringify([t,e]),r=$D[n];return r||(r=new Intl.ListFormat(t,e),$D[n]=r),r}var Gw={};function Qw(t,e={}){let n=JSON.stringify([t,e]),r=Gw[n];return r||(r=new Intl.DateTimeFormat(t,e),Gw[n]=r),r}var Kw={};function zU(t,e={}){let n=JSON.stringify([t,e]),r=Kw[n];return r||(r=new Intl.NumberFormat(t,e),Kw[n]=r),r}var Zw={};function LU(t,e={}){let{base:n,...r}=e,i=JSON.stringify([t,r]),s=Zw[i];return s||(s=new Intl.RelativeTimeFormat(t,e),Zw[i]=s),s}var Fu=null;function BU(){return Fu||(Fu=new Intl.DateTimeFormat().resolvedOptions().locale,Fu)}function $U(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let n=t.indexOf("-u-");if(n===-1)return[t];{let r,i;try{r=Qw(t).resolvedOptions(),i=t}catch{let l=t.substring(0,n);r=Qw(l).resolvedOptions(),i=l}let{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function UU(t,e,n){return(n||e)&&(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`)),t}function jU(t){let e=[];for(let n=1;n<=12;n++){let r=Ae.utc(2009,n,1);e.push(t(r))}return e}function qU(t){let e=[];for(let n=1;n<=7;n++){let r=Ae.utc(2016,11,13+n);e.push(t(r))}return e}function Yd(t,e,n,r){let i=t.listingMode();return i==="error"?null:i==="en"?n(e):r(e)}function VU(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var Yw=class{constructor(e,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:i,floor:s,...o}=r;if(!n||Object.keys(o).length>0){let a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=zU(e,a)}}format(e){if(this.inf){let n=this.floor?Math.floor(e):e;return this.inf.format(n)}else{let n=this.floor?Math.floor(e):f0(e,3);return Ot(n,this.padTo)}}},Jw=class{constructor(e,n,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Ms.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=Qw(n,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(n=>{if(n.type==="timeZoneName"){let r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...n,value:r}}else return n}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Xw=class{constructor(e,n,r){this.opts={style:"long",...r},!n&&RE()&&(this.rtf=LU(e,r))}format(e,n){return this.rtf?this.rtf.format(e,n):o8(n,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,n){return this.rtf?this.rtf.formatToParts(e,n):[]}},St=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,n,r,i=!1){let s=e||xt.defaultLocale,o=s||(i?"en-US":BU()),a=n||xt.defaultNumberingSystem,l=r||xt.defaultOutputCalendar;return new t(o,a,l,s)}static resetCache(){Fu=null,Gw={},Kw={},Zw={}}static fromObject({locale:e,numberingSystem:n,outputCalendar:r}={}){return t.create(e,n,r)}constructor(e,n,r,i){let[s,o,a]=$U(e);this.locale=s,this.numberingSystem=n||o||null,this.outputCalendar=r||a||null,this.intl=UU(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=VU(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&n?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,n=!1){return Yd(this,e,$E,()=>{let r=n?{month:e,day:"numeric"}:{month:e},i=n?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=jU(s=>this.extract(s,r,"month"))),this.monthsCache[i][e]})}weekdays(e,n=!1){return Yd(this,e,qE,()=>{let r=n?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=n?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=qU(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Yd(this,void 0,()=>VE,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ae.utc(2016,11,13,9),Ae.utc(2016,11,13,19)].map(n=>this.extract(n,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Yd(this,e,HE,()=>{let n={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ae.utc(-40,1,1),Ae.utc(2017,1,1)].map(r=>this.extract(r,n,"era"))),this.eraCache[e]})}extract(e,n,r){let i=this.dtFormatter(e,n),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new Yw(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,n={}){return new Jw(e,this.intl,n)}relFormatter(e={}){return new Xw(this.intl,this.isEnglish(),e)}listFormatter(e={}){return RU(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}},zw=null,_r=class t extends Xo{static get utcInstance(){return zw===null&&(zw=new t(0)),zw}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let n=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new t(gm(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Au(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Au(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,n){return Au(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}},e0=class extends Xo{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Ns(t,e){if(Be(t)||t===null)return e;if(t instanceof Xo)return t;if(HU(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?om.instance:n==="utc"||n==="gmt"?_r.utcInstance:_r.parseSpecifier(n)||Ms.create(t)}else return Jo(t)?_r.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new e0(t)}var UD=()=>Date.now(),jD="system",qD=null,VD=null,HD=null,WD=60,GD,xt=class{static get now(){return UD}static set now(e){UD=e}static set defaultZone(e){jD=e}static get defaultZone(){return Ns(jD,om.instance)}static get defaultLocale(){return qD}static set defaultLocale(e){qD=e}static get defaultNumberingSystem(){return VD}static set defaultNumberingSystem(e){VD=e}static get defaultOutputCalendar(){return HD}static set defaultOutputCalendar(e){HD=e}static get twoDigitCutoffYear(){return WD}static set twoDigitCutoffYear(e){WD=e%100}static get throwOnInvalid(){return GD}static set throwOnInvalid(e){GD=e}static resetCaches(){St.resetCache(),Ms.resetCache()}};function Be(t){return typeof t>"u"}function Jo(t){return typeof t=="number"}function mm(t){return typeof t=="number"&&t%1===0}function HU(t){return typeof t=="string"}function WU(t){return Object.prototype.toString.call(t)==="[object Date]"}function RE(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function GU(t){return Array.isArray(t)?t:[t]}function QD(t,e,n){if(t.length!==0)return t.reduce((r,i)=>{let s=[e(i),i];return r&&n(r[0],s[0])===r[0]?r:s},null)[1]}function QU(t,e){return e.reduce((n,r)=>(n[r]=t[r],n),{})}function bl(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Ji(t,e,n){return mm(t)&&t>=e&&t<=n}function KU(t,e){return t-e*Math.floor(t/e)}function Ot(t,e=2){let n=t<0,r;return n?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function Ps(t){if(!(Be(t)||t===null||t===""))return parseInt(t,10)}function Qo(t){if(!(Be(t)||t===null||t===""))return parseFloat(t)}function u0(t){if(!(Be(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function f0(t,e,n=!1){let r=10**e;return(n?Math.trunc:Math.round)(t*r)/r}function Nu(t){return t%4===0&&(t%100!==0||t%400===0)}function Iu(t){return Nu(t)?366:365}function am(t,e){let n=KU(e-1,12)+1,r=t+(e-n)/12;return n===2?Nu(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function pm(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function lm(t){let e=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7,n=t-1,r=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7;return e===4||r===3?53:52}function t0(t){return t>99?t:t>xt.twoDigitCutoffYear?1900+t:2e3+t}function zE(t,e,n,r=null){let i=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);let o={timeZoneName:e,...s},a=new Intl.DateTimeFormat(n,o).formatToParts(i).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function gm(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);let r=parseInt(e,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function LE(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Pn(`Invalid unit value ${t}`);return e}function cm(t,e){let n={};for(let r in t)if(bl(t,r)){let i=t[r];if(i==null)continue;n[e(r)]=LE(i)}return n}function Au(t,e){let n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${Ot(n,2)}:${Ot(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${Ot(n,2)}${Ot(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function ym(t){return QU(t,["hour","minute","second","millisecond"])}var ZU=["January","February","March","April","May","June","July","August","September","October","November","December"],BE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],YU=["J","F","M","A","M","J","J","A","S","O","N","D"];function $E(t){switch(t){case"narrow":return[...YU];case"short":return[...BE];case"long":return[...ZU];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var UE=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],jE=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],JU=["M","T","W","T","F","S","S"];function qE(t){switch(t){case"narrow":return[...JU];case"short":return[...jE];case"long":return[...UE];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var VE=["AM","PM"],XU=["Before Christ","Anno Domini"],e8=["BC","AD"],t8=["B","A"];function HE(t){switch(t){case"narrow":return[...t8];case"short":return[...e8];case"long":return[...XU];default:return null}}function n8(t){return VE[t.hour<12?0:1]}function r8(t,e){return qE(e)[t.weekday-1]}function i8(t,e){return $E(e)[t.month-1]}function s8(t,e){return HE(e)[t.year<0?0:1]}function o8(t,e,n="always",r=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(t)===-1;if(n==="auto"&&s){let f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`}}let o=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=i[t],u=r?l?c[1]:c[2]||c[1]:l?i[t][0]:t;return o?`${a} ${u} ago`:`in ${a} ${u}`}function KD(t,e){let n="";for(let r of t)r.literal?n+=r.val:n+=e(r.val);return n}var a8={D:sm,DD:yE,DDD:wE,DDDD:bE,t:vE,tt:kE,ttt:xE,tttt:SE,T:DE,TT:EE,TTT:_E,TTTT:CE,f:TE,ff:IE,fff:OE,ffff:NE,F:FE,FF:AE,FFF:PE,FFFF:ME},er=class t{static create(e,n={}){return new t(e,n)}static parseFormat(e){let n=null,r="",i=!1,s=[];for(let o=0;o<e.length;o++){let a=e.charAt(o);a==="'"?(r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),n=null,r="",i=!i):i||a===n?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,n=a)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return a8[e]}constructor(e,n){this.opts=n,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...n}).format()}dtFormatter(e,n={}){return this.loc.dtFormatter(e,{...this.opts,...n})}formatDateTime(e,n){return this.dtFormatter(e,n).format()}formatDateTimeParts(e,n){return this.dtFormatter(e,n).formatToParts()}formatInterval(e,n){return this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,n){return this.dtFormatter(e,n).resolvedOptions()}num(e,n=0){if(this.opts.forceSimple)return Ot(e,n);let r={...this.opts};return n>0&&(r.padTo=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,n){let r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(d,p)=>this.loc.extract(e,d,p),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",a=()=>r?n8(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(d,p)=>r?i8(e,d):s(p?{month:d}:{month:d,day:"numeric"},"month"),c=(d,p)=>r?r8(e,d):s(p?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),u=d=>{let p=t.macroTokenToFormatOpts(d);return p?this.formatWithSystemDefault(e,p):d},f=d=>r?s8(e,d):s({era:d},"era"),h=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(d)}};return KD(t.parseFormat(n),h)}formatDurationFromString(e,n){let r=l=>{switch(l[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=l=>c=>{let u=r(c);return u?this.num(l.get(u),c.length):c},s=t.parseFormat(n),o=s.reduce((l,{literal:c,val:u})=>c?l:l.concat(u),[]),a=e.shiftTo(...o.map(r).filter(l=>l));return KD(s,i(a))}},tr=class{constructor(e,n){this.reason=e,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},WE=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function vl(...t){let e=t.reduce((n,r)=>n+r.source,"");return RegExp(`^${e}$`)}function kl(...t){return e=>t.reduce(([n,r,i],s)=>{let[o,a,l]=s(e,i);return[{...n,...o},a||r,l]},[{},null,1]).slice(0,2)}function xl(t,...e){if(t==null)return[null,null];for(let[n,r]of e){let i=n.exec(t);if(i)return r(i)}return[null,null]}function GE(...t){return(e,n)=>{let r={},i;for(i=0;i<t.length;i++)r[t[i]]=Ps(e[n+i]);return[r,null,n+i]}}var QE=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,l8=`(?:${QE.source}?(?:\\[(${WE.source})\\])?)?`,h0=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,KE=RegExp(`${h0.source}${l8}`),d0=RegExp(`(?:T${KE.source})?`),c8=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,u8=/(\d{4})-?W(\d\d)(?:-?(\d))?/,f8=/(\d{4})-?(\d{3})/,h8=GE("weekYear","weekNumber","weekDay"),d8=GE("year","ordinal"),m8=/(\d{4})-(\d\d)-(\d\d)/,ZE=RegExp(`${h0.source} ?(?:${QE.source}|(${WE.source}))?`),p8=RegExp(`(?: ${ZE.source})?`);function yl(t,e,n){let r=t[e];return Be(r)?n:Ps(r)}function g8(t,e){return[{year:yl(t,e),month:yl(t,e+1,1),day:yl(t,e+2,1)},null,e+3]}function Sl(t,e){return[{hours:yl(t,e,0),minutes:yl(t,e+1,0),seconds:yl(t,e+2,0),milliseconds:u0(t[e+3])},null,e+4]}function Mu(t,e){let n=!t[e]&&!t[e+1],r=gm(t[e+1],t[e+2]),i=n?null:_r.instance(r);return[{},i,e+3]}function Ru(t,e){let n=t[e]?Ms.create(t[e]):null;return[{},n,e+1]}var y8=RegExp(`^T?${h0.source}$`),w8=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function b8(t){let[e,n,r,i,s,o,a,l,c]=t,u=e[0]==="-",f=l&&l[0]==="-",h=(d,p=!1)=>d!==void 0&&(p||d&&u)?-d:d;return[{years:h(Qo(n)),months:h(Qo(r)),weeks:h(Qo(i)),days:h(Qo(s)),hours:h(Qo(o)),minutes:h(Qo(a)),seconds:h(Qo(l),l==="-0"),milliseconds:h(u0(c),f)}]}var v8={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function m0(t,e,n,r,i,s,o){let a={year:e.length===2?t0(Ps(e)):Ps(e),month:BE.indexOf(n)+1,day:Ps(r),hour:Ps(i),minute:Ps(s)};return o&&(a.second=Ps(o)),t&&(a.weekday=t.length>3?UE.indexOf(t)+1:jE.indexOf(t)+1),a}var k8=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function x8(t){let[,e,n,r,i,s,o,a,l,c,u,f]=t,h=m0(e,i,r,n,s,o,a),d;return l?d=v8[l]:c?d=0:d=gm(u,f),[h,new _r(d)]}function S8(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var D8=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,E8=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,_8=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function ZD(t){let[,e,n,r,i,s,o,a]=t;return[m0(e,i,r,n,s,o,a),_r.utcInstance]}function C8(t){let[,e,n,r,i,s,o,a]=t;return[m0(e,a,n,r,i,s,o),_r.utcInstance]}var T8=vl(c8,d0),F8=vl(u8,d0),I8=vl(f8,d0),A8=vl(KE),YE=kl(g8,Sl,Mu,Ru),O8=kl(h8,Sl,Mu,Ru),P8=kl(d8,Sl,Mu,Ru),N8=kl(Sl,Mu,Ru);function M8(t){return xl(t,[T8,YE],[F8,O8],[I8,P8],[A8,N8])}function R8(t){return xl(S8(t),[k8,x8])}function z8(t){return xl(t,[D8,ZD],[E8,ZD],[_8,C8])}function L8(t){return xl(t,[w8,b8])}var B8=kl(Sl);function $8(t){return xl(t,[y8,B8])}var U8=vl(m8,p8),j8=vl(ZE),q8=kl(Sl,Mu,Ru);function V8(t){return xl(t,[U8,YE],[j8,q8])}var YD="Invalid Duration",JE={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},H8={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...JE},Dr=146097/400,ml=146097/4800,W8={years:{quarters:4,months:12,weeks:Dr/7,days:Dr,hours:Dr*24,minutes:Dr*24*60,seconds:Dr*24*60*60,milliseconds:Dr*24*60*60*1e3},quarters:{months:3,weeks:Dr/28,days:Dr/4,hours:Dr*24/4,minutes:Dr*24*60/4,seconds:Dr*24*60*60/4,milliseconds:Dr*24*60*60*1e3/4},months:{weeks:ml/7,days:ml,hours:ml*24,minutes:ml*24*60,seconds:ml*24*60*60,milliseconds:ml*24*60*60*1e3},...JE},Yo=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],G8=Yo.slice(0).reverse();function Os(t,e,n=!1){let r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new ge(r)}function XE(t,e){let n=e.milliseconds??0;for(let r of G8.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function JD(t,e){let n=XE(t,e)<0?-1:1;Yo.reduceRight((r,i)=>{if(Be(e[i]))return r;if(r){let s=e[r]*n,o=t[i][r],a=Math.floor(s/o);e[i]+=a*n,e[r]-=a*o*n}return i},null),Yo.reduce((r,i)=>{if(Be(e[i]))return r;if(r){let s=e[r]%1;e[r]-=s,e[i]+=s*t[r][i]}return i},null)}function Q8(t){let e={};for(let[n,r]of Object.entries(t))r!==0&&(e[n]=r);return e}var ge=class t{constructor(e){let n=e.conversionAccuracy==="longterm"||!1,r=n?W8:H8;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||St.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,n){return t.fromObject({milliseconds:e},n)}static fromObject(e,n={}){if(e==null||typeof e!="object")throw new Pn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:cm(e,t.normalizeUnit),loc:St.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(e){if(Jo(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Pn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,n){let[r]=L8(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,n){let[r]=$8(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,n=null){if(!e)throw new Pn("need to specify a reason the Duration is invalid");let r=e instanceof tr?e:new tr(e,n);if(xt.throwOnInvalid)throw new Ww(r);return new t({invalid:r})}static normalizeUnit(e){let n={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!n)throw new im(e);return n}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,n={}){let r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?er.create(this.loc,r).formatDurationFromString(this,e):YD}toHuman(e={}){if(!this.isValid)return YD;let n=Yo.map(r=>{let i=this.values[r];return Be(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(i)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=f0(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let n=this.toMillis();return n<0||n>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},Ae.fromMillis(n,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.isValid?XE(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e),r={};for(let i of Yo)(bl(n.values,i)||bl(this.values,i))&&(r[i]=n.get(i)+this.get(i));return Os(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let n={};for(let r of Object.keys(this.values))n[r]=LE(e(this.values[r],r));return Os(this,{values:n},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let n={...this.values,...cm(e,t.normalizeUnit)};return Os(this,{values:n})}reconfigure({locale:e,numberingSystem:n,conversionAccuracy:r,matrix:i}={}){let o={loc:this.loc.clone({locale:e,numberingSystem:n}),matrix:i,conversionAccuracy:r};return Os(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return JD(this.matrix,e),Os(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Q8(this.normalize().shiftToAll().toObject());return Os(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>t.normalizeUnit(o));let n={},r={},i=this.toObject(),s;for(let o of Yo)if(e.indexOf(o)>=0){s=o;let a=0;for(let c in r)a+=this.matrix[c][o]*r[c],r[c]=0;Jo(i[o])&&(a+=i[o]);let l=Math.trunc(a);n[o]=l,r[o]=(a*1e3-l*1e3)/1e3}else Jo(i[o])&&(r[o]=i[o]);for(let o in r)r[o]!==0&&(n[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return JD(this.matrix,n),Os(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let n of Object.keys(this.values))e[n]=this.values[n]===0?0:-this.values[n];return Os(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function n(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(let r of Yo)if(!n(this.values[r],e.values[r]))return!1;return!0}},pl="Invalid Interval";function K8(t,e){return!t||!t.isValid?wl.invalid("missing or invalid start"):!e||!e.isValid?wl.invalid("missing or invalid end"):e<t?wl.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var wl=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,n=null){if(!e)throw new Pn("need to specify a reason the Interval is invalid");let r=e instanceof tr?e:new tr(e,n);if(xt.throwOnInvalid)throw new Hw(r);return new t({invalid:r})}static fromDateTimes(e,n){let r=Cu(e),i=Cu(n),s=K8(r,i);return s??new t({start:r,end:i})}static after(e,n){let r=ge.fromDurationLike(n),i=Cu(e);return t.fromDateTimes(i,i.plus(r))}static before(e,n){let r=ge.fromDurationLike(n),i=Cu(e);return t.fromDateTimes(i.minus(r),i)}static fromISO(e,n){let[r,i]=(e||"").split("/",2);if(r&&i){let s,o;try{s=Ae.fromISO(r,n),o=s.isValid}catch{o=!1}let a,l;try{a=Ae.fromISO(i,n),l=a.isValid}catch{l=!1}if(o&&l)return t.fromDateTimes(s,a);if(o){let c=ge.fromISO(i,n);if(c.isValid)return t.after(s,c)}else if(l){let c=ge.fromISO(r,n);if(c.isValid)return t.before(a,c)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds"){if(!this.isValid)return NaN;let n=this.start.startOf(e),r=this.end.startOf(e);return Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:n}={}){return this.isValid?t.fromDateTimes(e||this.s,n||this.e):this}splitAt(...e){if(!this.isValid)return[];let n=e.map(Cu).filter(o=>this.contains(o)).sort(),r=[],{s:i}=this,s=0;for(;i<this.e;){let o=n[s]||this.e,a=+o>+this.e?this.e:o;r.push(t.fromDateTimes(i,a)),i=a,s+=1}return r}splitBy(e){let n=ge.fromDurationLike(e);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,i=1,s,o=[];for(;r<this.e;){let a=this.start.plus(n.mapUnits(l=>l*i));s=+a>+this.e?this.e:a,o.push(t.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let n=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return n>=r?null:t.fromDateTimes(n,r)}union(e){if(!this.isValid)return this;let n=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return t.fromDateTimes(n,r)}static merge(e){let[n,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&n.push(r),n}static xor(e){let n=null,r=0,i=[],s=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((l,c)=>l.time-c.time);for(let l of a)r+=l.type==="s"?1:-1,r===1?n=l.time:(n&&+n!=+l.time&&i.push(t.fromDateTimes(n,l.time)),n=null);return t.merge(i)}difference(...e){return t.xor([this].concat(e)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:pl}toLocaleString(e=sm,n={}){return this.isValid?er.create(this.s.loc.clone(n),e).formatInterval(this):pl}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:pl}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:pl}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:pl}toFormat(e,{separator:n=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${n}${this.e.toFormat(e)}`:pl}toDuration(e,n){return this.isValid?this.e.diff(this.s,e,n):ge.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}},gl=class{static hasDST(e=xt.defaultZone){let n=Ae.now().setZone(e).set({month:12});return!e.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(e){return Ms.isValidZone(e)}static normalizeZone(e){return Ns(e,xt.defaultZone)}static months(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||St.create(n,r,s)).months(e)}static monthsFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||St.create(n,r,s)).months(e,!0)}static weekdays(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||St.create(n,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||St.create(n,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return St.create(e).meridiems()}static eras(e="short",{locale:n=null}={}){return St.create(n,null,"gregory").eras(e)}static features(){return{relative:RE()}}};function XD(t,e){let n=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(ge.fromMillis(r).as("days"))}function Z8(t,e,n){let r=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{let u=XD(l,c);return(u-u%7)/7}],["days",XD]],i={},s=t,o,a;for(let[l,c]of r)n.indexOf(l)>=0&&(o=l,i[l]=c(t,e),a=s.plus(i),a>e?(i[l]--,t=s.plus(i),t>e&&(a=t,i[l]--,t=s.plus(i))):t=a);return[t,i,a,o]}function Y8(t,e,n,r){let[i,s,o,a]=Z8(t,e,n),l=e-i,c=n.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);c.length===0&&(o<e&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+l/(o-i)));let u=ge.fromObject(s,r);return c.length>0?ge.fromMillis(l,r).shiftTo(...c).plus(u):u}var p0={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},eE={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},J8=p0.hanidec.replace(/[\[|\]]/g,"").split("");function X8(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(t[n].search(p0.hanidec)!==-1)e+=J8.indexOf(t[n]);else for(let i in eE){let[s,o]=eE[i];r>=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}function Vr({numberingSystem:t},e=""){return new RegExp(`${p0[t||"latn"]}${e}`)}var e4="missing Intl.DateTimeFormat.formatToParts support";function Ze(t,e=n=>n){return{regex:t,deser:([n])=>e(X8(n))}}var t4="\xA0",e_=`[ ${t4}]`,t_=new RegExp(e_,"g");function n4(t){return t.replace(/\./g,"\\.?").replace(t_,e_)}function tE(t){return t.replace(/\./g,"").replace(t_," ").toLowerCase()}function Hr(t,e){return t===null?null:{regex:RegExp(t.map(n4).join("|")),deser:([n])=>t.findIndex(r=>tE(n)===tE(r))+e}}function nE(t,e){return{regex:t,deser:([,n,r])=>gm(n,r),groups:e}}function Jd(t){return{regex:t,deser:([e])=>e}}function r4(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i4(t,e){let n=Vr(e),r=Vr(e,"{2}"),i=Vr(e,"{3}"),s=Vr(e,"{4}"),o=Vr(e,"{6}"),a=Vr(e,"{1,2}"),l=Vr(e,"{1,3}"),c=Vr(e,"{1,6}"),u=Vr(e,"{1,9}"),f=Vr(e,"{2,4}"),h=Vr(e,"{4,6}"),d=y=>({regex:RegExp(r4(y.val)),deser:([w])=>w,literal:!0}),g=(y=>{if(t.literal)return d(y);switch(y.val){case"G":return Hr(e.eras("short"),0);case"GG":return Hr(e.eras("long"),0);case"y":return Ze(c);case"yy":return Ze(f,t0);case"yyyy":return Ze(s);case"yyyyy":return Ze(h);case"yyyyyy":return Ze(o);case"M":return Ze(a);case"MM":return Ze(r);case"MMM":return Hr(e.months("short",!0),1);case"MMMM":return Hr(e.months("long",!0),1);case"L":return Ze(a);case"LL":return Ze(r);case"LLL":return Hr(e.months("short",!1),1);case"LLLL":return Hr(e.months("long",!1),1);case"d":return Ze(a);case"dd":return Ze(r);case"o":return Ze(l);case"ooo":return Ze(i);case"HH":return Ze(r);case"H":return Ze(a);case"hh":return Ze(r);case"h":return Ze(a);case"mm":return Ze(r);case"m":return Ze(a);case"q":return Ze(a);case"qq":return Ze(r);case"s":return Ze(a);case"ss":return Ze(r);case"S":return Ze(l);case"SSS":return Ze(i);case"u":return Jd(u);case"uu":return Jd(a);case"uuu":return Ze(n);case"a":return Hr(e.meridiems(),0);case"kkkk":return Ze(s);case"kk":return Ze(f,t0);case"W":return Ze(a);case"WW":return Ze(r);case"E":case"c":return Ze(n);case"EEE":return Hr(e.weekdays("short",!1),1);case"EEEE":return Hr(e.weekdays("long",!1),1);case"ccc":return Hr(e.weekdays("short",!0),1);case"cccc":return Hr(e.weekdays("long",!0),1);case"Z":case"ZZ":return nE(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return nE(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return Jd(/[a-z_+-/]{1,256}?/i);case" ":return Jd(/[^\S\n\r]/);default:return d(y)}})(t)||{invalidReason:e4};return g.token=t,g}var s4={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function o4(t,e,n){let{type:r,value:i}=t;if(r==="literal"){let l=/^\s+$/.test(i);return{literal:!l,val:l?" ":i}}let s=e[r],o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=n.hour12?"hour12":"hour24");let a=s4[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function a4(t){return[`^${t.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,t]}function l4(t,e,n){let r=t.match(e);if(r){let i={},s=1;for(let o in n)if(bl(n,o)){let a=n[o],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(s,s+l))),s+=l}return[r,i]}else return[r,{}]}function c4(t){let e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},n=null,r;return Be(t.z)||(n=Ms.create(t.z)),Be(t.Z)||(n||(n=new _r(t.Z)),r=t.Z),Be(t.q)||(t.M=(t.q-1)*3+1),Be(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),Be(t.u)||(t.S=u0(t.u)),[Object.keys(t).reduce((s,o)=>{let a=e(o);return a&&(s[a]=t[o]),s},{}),n,r]}var Lw=null;function u4(){return Lw||(Lw=Ae.fromMillis(1555555555555)),Lw}function f4(t,e){if(t.literal)return t;let n=er.macroTokenToFormatOpts(t.val),r=i_(n,e);return r==null||r.includes(void 0)?t:r}function n_(t,e){return Array.prototype.concat(...t.map(n=>f4(n,e)))}function r_(t,e,n){let r=n_(er.parseFormat(n),t),i=r.map(o=>i4(o,t)),s=i.find(o=>o.invalidReason);if(s)return{input:e,tokens:r,invalidReason:s.invalidReason};{let[o,a]=a4(i),l=RegExp(o,"i"),[c,u]=l4(e,l,a),[f,h,d]=u?c4(u):[null,null,void 0];if(bl(u,"a")&&bl(u,"H"))throw new Zo("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:l,rawMatches:c,matches:u,result:f,zone:h,specificOffset:d}}}function h4(t,e,n){let{result:r,zone:i,specificOffset:s,invalidReason:o}=r_(t,e,n);return[r,i,s,o]}function i_(t,e){if(!t)return null;let r=er.create(e,t).dtFormatter(u4()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>o4(o,t,s))}var s_=[0,31,59,90,120,151,181,212,243,273,304,334],o_=[0,31,60,91,121,152,182,213,244,274,305,335];function Er(t,e){return new tr("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function a_(t,e,n){let r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function l_(t,e,n){return n+(Nu(t)?o_:s_)[e-1]}function c_(t,e){let n=Nu(t)?o_:s_,r=n.findIndex(s=>s<e),i=e-n[r];return{month:r+1,day:i}}function n0(t){let{year:e,month:n,day:r}=t,i=l_(e,n,r),s=a_(e,n,r),o=Math.floor((i-s+10)/7),a;return o<1?(a=e-1,o=lm(a)):o>lm(e)?(a=e+1,o=1):a=e,{weekYear:a,weekNumber:o,weekday:s,...ym(t)}}function rE(t){let{weekYear:e,weekNumber:n,weekday:r}=t,i=a_(e,1,4),s=Iu(e),o=n*7+r-i-3,a;o<1?(a=e-1,o+=Iu(a)):o>s?(a=e+1,o-=Iu(e)):a=e;let{month:l,day:c}=c_(a,o);return{year:a,month:l,day:c,...ym(t)}}function Bw(t){let{year:e,month:n,day:r}=t,i=l_(e,n,r);return{year:e,ordinal:i,...ym(t)}}function iE(t){let{year:e,ordinal:n}=t,{month:r,day:i}=c_(e,n);return{year:e,month:r,day:i,...ym(t)}}function d4(t){let e=mm(t.weekYear),n=Ji(t.weekNumber,1,lm(t.weekYear)),r=Ji(t.weekday,1,7);return e?n?r?!1:Er("weekday",t.weekday):Er("week",t.week):Er("weekYear",t.weekYear)}function m4(t){let e=mm(t.year),n=Ji(t.ordinal,1,Iu(t.year));return e?n?!1:Er("ordinal",t.ordinal):Er("year",t.year)}function u_(t){let e=mm(t.year),n=Ji(t.month,1,12),r=Ji(t.day,1,am(t.year,t.month));return e?n?r?!1:Er("day",t.day):Er("month",t.month):Er("year",t.year)}function f_(t){let{hour:e,minute:n,second:r,millisecond:i}=t,s=Ji(e,0,23)||e===24&&n===0&&r===0&&i===0,o=Ji(n,0,59),a=Ji(r,0,59),l=Ji(i,0,999);return s?o?a?l?!1:Er("millisecond",i):Er("second",r):Er("minute",n):Er("hour",e)}var $w="Invalid DateTime",sE=864e13;function Xd(t){return new tr("unsupported zone",`the zone "${t.name}" is not supported`)}function Uw(t){return t.weekData===null&&(t.weekData=n0(t.c)),t.weekData}function Ko(t,e){let n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Ae({...n,...e,old:n})}function h_(t,e,n){let r=t-e*60*1e3,i=n.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;let s=n.offset(r);return i===s?[r,i]:[t-Math.min(i,s)*60*1e3,Math.max(i,s)]}function em(t,e){t+=e*60*1e3;let n=new Date(t);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function rm(t,e,n){return h_(pm(t),e,n)}function oE(t,e){let n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...t.c,year:r,month:i,day:Math.min(t.c.day,am(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ge.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=pm(s),[l,c]=h_(a,n,t.zone);return o!==0&&(l+=o,c=t.zone.offset(l)),{ts:l,o:c}}function _u(t,e,n,r,i,s){let{setZone:o,zone:a}=n;if(t&&Object.keys(t).length!==0||e){let l=e||a,c=Ae.fromObject(t,{...n,zone:l,specificOffset:s});return o?c:c.setZone(a)}else return Ae.invalid(new tr("unparsable",`the input "${i}" can't be parsed as ${r}`))}function tm(t,e,n=!0){return t.isValid?er.create(St.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function jw(t,e){let n=t.c.year>9999||t.c.year<0,r="";return n&&t.c.year>=0&&(r+="+"),r+=Ot(t.c.year,n?6:4),e?(r+="-",r+=Ot(t.c.month),r+="-",r+=Ot(t.c.day)):(r+=Ot(t.c.month),r+=Ot(t.c.day)),r}function aE(t,e,n,r,i,s){let o=Ot(t.c.hour);return e?(o+=":",o+=Ot(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=":")):o+=Ot(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=Ot(t.c.second),(t.c.millisecond!==0||!r)&&(o+=".",o+=Ot(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!s?o+="Z":t.o<0?(o+="-",o+=Ot(Math.trunc(-t.o/60)),o+=":",o+=Ot(Math.trunc(-t.o%60))):(o+="+",o+=Ot(Math.trunc(t.o/60)),o+=":",o+=Ot(Math.trunc(t.o%60)))),s&&(o+="["+t.zone.ianaName+"]"),o}var d_={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},p4={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},g4={ordinal:1,hour:0,minute:0,second:0,millisecond:0},m_=["year","month","day","hour","minute","second","millisecond"],y4=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],w4=["year","ordinal","hour","minute","second","millisecond"];function lE(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new im(t);return e}function cE(t,e){let n=Ns(e.zone,xt.defaultZone),r=St.fromObject(e),i=xt.now(),s,o;if(Be(t.year))s=i;else{for(let c of m_)Be(t[c])&&(t[c]=d_[c]);let a=u_(t)||f_(t);if(a)return Ae.invalid(a);let l=n.offset(i);[s,o]=rm(t,l,n)}return new Ae({ts:s,zone:n,loc:r,o})}function uE(t,e,n){let r=Be(n.round)?!0:n.round,i=(o,a)=>(o=f0(o,r||n.calendary?0:2,!0),e.loc.clone(n).relFormatter(n).format(o,a)),s=o=>n.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(n.unit)return i(s(n.unit),n.unit);for(let o of n.units){let a=s(o);if(Math.abs(a)>=1)return i(a,o)}return i(t>e?-0:0,n.units[n.units.length-1])}function fE(t){let e={},n;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],n=Array.from(t).slice(0,t.length-1)):n=Array.from(t),[e,n]}var Ae=class t{constructor(e){let n=e.zone||xt.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new tr("invalid input"):null)||(n.isValid?null:Xd(n));this.ts=Be(e.ts)?xt.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(n))[i,s]=[e.old.c,e.old.o];else{let a=n.offset(this.ts);i=em(this.ts,a),r=Number.isNaN(i.year)?new tr("invalid input"):null,i=r?null:i,s=r?null:a}this._zone=n,this.loc=e.loc||St.create(),this.invalid=r,this.weekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,n]=fE(arguments),[r,i,s,o,a,l,c]=n;return cE({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:c},e)}static utc(){let[e,n]=fE(arguments),[r,i,s,o,a,l,c]=n;return e.zone=_r.utcInstance,cE({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,n={}){let r=WU(e)?e.valueOf():NaN;if(Number.isNaN(r))return t.invalid("invalid input");let i=Ns(n.zone,xt.defaultZone);return i.isValid?new t({ts:r,zone:i,loc:St.fromObject(n)}):t.invalid(Xd(i))}static fromMillis(e,n={}){if(Jo(e))return e<-sE||e>sE?t.invalid("Timestamp out of range"):new t({ts:e,zone:Ns(n.zone,xt.defaultZone),loc:St.fromObject(n)});throw new Pn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,n={}){if(Jo(e))return new t({ts:e*1e3,zone:Ns(n.zone,xt.defaultZone),loc:St.fromObject(n)});throw new Pn("fromSeconds requires a numerical input")}static fromObject(e,n={}){e=e||{};let r=Ns(n.zone,xt.defaultZone);if(!r.isValid)return t.invalid(Xd(r));let i=xt.now(),s=Be(n.specificOffset)?r.offset(i):n.specificOffset,o=cm(e,lE),a=!Be(o.ordinal),l=!Be(o.year),c=!Be(o.month)||!Be(o.day),u=l||c,f=o.weekYear||o.weekNumber,h=St.fromObject(n);if((u||a)&&f)throw new Zo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&a)throw new Zo("Can't mix ordinal dates with month/day");let d=f||o.weekday&&!u,p,g,y=em(i,s);d?(p=y4,g=p4,y=n0(y)):a?(p=w4,g=g4,y=Bw(y)):(p=m_,g=d_);let w=!1;for(let _ of p){let C=o[_];Be(C)?w?o[_]=g[_]:o[_]=y[_]:w=!0}let b=d?d4(o):a?m4(o):u_(o),S=b||f_(o);if(S)return t.invalid(S);let D=d?rE(o):a?iE(o):o,[k,E]=rm(D,s,r),v=new t({ts:k,zone:r,o:E,loc:h});return o.weekday&&u&&e.weekday!==v.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${v.toISO()}`):v}static fromISO(e,n={}){let[r,i]=M8(e);return _u(r,i,n,"ISO 8601",e)}static fromRFC2822(e,n={}){let[r,i]=R8(e);return _u(r,i,n,"RFC 2822",e)}static fromHTTP(e,n={}){let[r,i]=z8(e);return _u(r,i,n,"HTTP",n)}static fromFormat(e,n,r={}){if(Be(e)||Be(n))throw new Pn("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:s=null}=r,o=St.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,l,c,u]=h4(o,e,n);return u?t.invalid(u):_u(a,l,r,`format ${n}`,e,c)}static fromString(e,n,r={}){return t.fromFormat(e,n,r)}static fromSQL(e,n={}){let[r,i]=V8(e);return _u(r,i,n,"SQL",e)}static invalid(e,n=null){if(!e)throw new Pn("need to specify a reason the DateTime is invalid");let r=e instanceof tr?e:new tr(e,n);if(xt.throwOnInvalid)throw new Vw(r);return new t({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,n={}){let r=i_(e,St.fromObject(n));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,n={}){return n_(er.parseFormat(e),St.fromObject(n)).map(i=>i.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Uw(this).weekYear:NaN}get weekNumber(){return this.isValid?Uw(this).weekNumber:NaN}get weekday(){return this.isValid?Uw(this).weekday:NaN}get ordinal(){return this.isValid?Bw(this.c).ordinal:NaN}get monthShort(){return this.isValid?gl.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?gl.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?gl.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?gl.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,n=6e4,r=pm(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*n),a=this.zone.offset(r-s*n);if(o===a)return[this];let l=r-o*n,c=r-a*n,u=em(l,o),f=em(c,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[Ko(this,{ts:l}),Ko(this,{ts:c})]:[this]}get isInLeapYear(){return Nu(this.year)}get daysInMonth(){return am(this.year,this.month)}get daysInYear(){return this.isValid?Iu(this.year):NaN}get weeksInWeekYear(){return this.isValid?lm(this.weekYear):NaN}resolvedLocaleOptions(e={}){let{locale:n,numberingSystem:r,calendar:i}=er.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:i}}toUTC(e=0,n={}){return this.setZone(_r.instance(e),n)}toLocal(){return this.setZone(xt.defaultZone)}setZone(e,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(e=Ns(e,xt.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(n||r){let s=e.offset(this.ts),o=this.toObject();[i]=rm(o,s,e)}return Ko(this,{ts:i,zone:e})}else return t.invalid(Xd(e))}reconfigure({locale:e,numberingSystem:n,outputCalendar:r}={}){let i=this.loc.clone({locale:e,numberingSystem:n,outputCalendar:r});return Ko(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let n=cm(e,lE),r=!Be(n.weekYear)||!Be(n.weekNumber)||!Be(n.weekday),i=!Be(n.ordinal),s=!Be(n.year),o=!Be(n.month)||!Be(n.day),a=s||o,l=n.weekYear||n.weekNumber;if((a||i)&&l)throw new Zo("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(o&&i)throw new Zo("Can't mix ordinal dates with month/day");let c;r?c=rE({...n0(this.c),...n}):Be(n.ordinal)?(c={...this.toObject(),...n},Be(n.day)&&(c.day=Math.min(am(c.year,c.month),c.day))):c=iE({...Bw(this.c),...n});let[u,f]=rm(c,this.o,this.zone);return Ko(this,{ts:u,o:f})}plus(e){if(!this.isValid)return this;let n=ge.fromDurationLike(e);return Ko(this,oE(this,n))}minus(e){if(!this.isValid)return this;let n=ge.fromDurationLike(e).negate();return Ko(this,oE(this,n))}startOf(e){if(!this.isValid)return this;let n={},r=ge.normalizeUnit(e);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(r==="weeks"&&(n.weekday=1),r==="quarters"){let i=Math.ceil(this.month/3);n.month=(i-1)*3+1}return this.set(n)}endOf(e){return this.isValid?this.plus({[e]:1}).startOf(e).minus(1):this}toFormat(e,n={}){return this.isValid?er.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this,e):$w}toLocaleString(e=sm,n={}){return this.isValid?er.create(this.loc.clone(n),e).formatDateTime(this):$w}toLocaleParts(e={}){return this.isValid?er.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:n=!1,suppressMilliseconds:r=!1,includeOffset:i=!0,extendedZone:s=!1}={}){if(!this.isValid)return null;let o=e==="extended",a=jw(this,o);return a+="T",a+=aE(this,o,n,r,i,s),a}toISODate({format:e="extended"}={}){return this.isValid?jw(this,e==="extended"):null}toISOWeekDate(){return tm(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:n=!1,includeOffset:r=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended"}={}){return this.isValid?(i?"T":"")+aE(this,o==="extended",n,e,r,s):null}toRFC2822(){return tm(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return tm(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?jw(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:n=!1,includeOffsetSpace:r=!0}={}){let i="HH:mm:ss.SSS";return(n||e)&&(r&&(i+=" "),n?i+="z":e&&(i+="ZZ")),tm(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():$w}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let n={...this.c};return e.includeConfig&&(n.outputCalendar=this.outputCalendar,n.numberingSystem=this.loc.numberingSystem,n.locale=this.loc.locale),n}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,n="milliseconds",r={}){if(!this.isValid||!e.isValid)return ge.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=GU(n).map(ge.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,l=o?e:this,c=Y8(a,l,s,i);return o?c.negate():c}diffNow(e="milliseconds",n={}){return this.diff(t.now(),e,n)}until(e){return this.isValid?wl.fromDateTimes(this,e):this}hasSame(e,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(n)<=r&&r<=i.endOf(n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let n=e.base||t.fromObject({},{zone:this.zone}),r=e.padding?this<n?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),uE(n,this.plus(r),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?uE(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Pn("min requires all arguments be DateTimes");return QD(e,n=>n.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Pn("max requires all arguments be DateTimes");return QD(e,n=>n.valueOf(),Math.max)}static fromFormatExplain(e,n,r={}){let{locale:i=null,numberingSystem:s=null}=r,o=St.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return r_(o,e,n)}static fromStringExplain(e,n,r={}){return t.fromFormatExplain(e,n,r)}static get DATE_SHORT(){return sm}static get DATE_MED(){return yE}static get DATE_MED_WITH_WEEKDAY(){return IU}static get DATE_FULL(){return wE}static get DATE_HUGE(){return bE}static get TIME_SIMPLE(){return vE}static get TIME_WITH_SECONDS(){return kE}static get TIME_WITH_SHORT_OFFSET(){return xE}static get TIME_WITH_LONG_OFFSET(){return SE}static get TIME_24_SIMPLE(){return DE}static get TIME_24_WITH_SECONDS(){return EE}static get TIME_24_WITH_SHORT_OFFSET(){return _E}static get TIME_24_WITH_LONG_OFFSET(){return CE}static get DATETIME_SHORT(){return TE}static get DATETIME_SHORT_WITH_SECONDS(){return FE}static get DATETIME_MED(){return IE}static get DATETIME_MED_WITH_SECONDS(){return AE}static get DATETIME_MED_WITH_WEEKDAY(){return AU}static get DATETIME_FULL(){return OE}static get DATETIME_FULL_WITH_SECONDS(){return PE}static get DATETIME_HUGE(){return NE}static get DATETIME_HUGE_WITH_SECONDS(){return ME}};function Cu(t){if(Ae.isDateTime(t))return t;if(t&&t.valueOf&&Jo(t.valueOf()))return Ae.fromJSDate(t);if(t&&typeof t=="object")return Ae.fromObject(t);throw new Pn(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var g0={renderNullAs:"\\-",taskCompletionTracking:!1,taskCompletionUseEmojiShorthand:!1,taskCompletionText:"completion",taskCompletionDateFormat:"yyyy-MM-dd",recursiveSubTaskCompletion:!1,warnOnEmptyResult:!0,refreshEnabled:!0,refreshInterval:2500,defaultDateFormat:"MMMM dd, yyyy",defaultDateTimeFormat:"h:mm a - MMMM dd, yyyy",maxRecursiveRenderDepth:4,tableIdColumnName:"File",tableGroupColumnName:"Group",showResultCount:!0},b4={allowHtml:!0};({...g0,...b4});var r0=class t{value;successful;constructor(e){this.value=e,this.successful=!0}map(e){return new t(e(this.value))}flatMap(e){return e(this.value)}mapErr(e){return this}bimap(e,n){return this.map(e)}orElse(e){return this.value}cast(){return this}orElseThrow(e){return this.value}},i0=class t{error;successful;constructor(e){this.error=e,this.successful=!1}map(e){return this}flatMap(e){return this}mapErr(e){return new t(e(this.error))}bimap(e,n){return this.mapErr(n)}orElse(e){return e}cast(){return this}orElseThrow(e){throw e?new Error(e(this.error)):new Error(""+this.error)}},um;(function(t){function e(s){return new r0(s)}t.success=e;function n(s){return new i0(s)}t.failure=n;function r(s,o,a){return s.successful?o.successful?a(s.value,o.value):n(o.error):n(s.error)}t.flatMap2=r;function i(s,o,a){return r(s,o,(l,c)=>e(a(l,c)))}t.map2=i})(um||(um={}));var v4=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},fm={exports:{}};fm.exports;(function(t,e){(function(n,r){t.exports=r()})(typeof self<"u"?self:v4,function(){return function(n){var r={};function i(s){if(r[s])return r[s].exports;var o=r[s]={i:s,l:!1,exports:{}};return n[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=n,i.c=r,i.d=function(s,o,a){i.o(s,o)||Object.defineProperty(s,o,{configurable:!1,enumerable:!0,get:a})},i.r=function(s){Object.defineProperty(s,"__esModule",{value:!0})},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},i.p="",i(i.s=0)}([function(n,r,i){function s(T){if(!(this instanceof s))return new s(T);this._=T}var o=s.prototype;function a(T,M){for(var z=0;z<T;z++)M(z)}function l(T,M,z){return function(q,K){a(K.length,function(Y){q(K[Y],Y,K)})}(function(q,K,Y){M=T(M,q,K,Y)},z),M}function c(T,M){return l(function(z,q,K,Y){return z.concat([T(q,K,Y)])},[],M)}function u(T,M){var z={v:0,buf:M};return a(T,function(){var q;z={v:z.v<<1|(q=z.buf,q[0]>>7),buf:function(K){var Y=l(function(J,_e,at,mn){return J.concat(at===mn.length-1?x.from([_e,0]).readUInt16BE(0):mn.readUInt16BE(at))},[],K);return x.from(c(function(J){return(J<<1&65535)>>8},Y))}(z.buf)}}),z}function f(){return typeof x<"u"}function h(){if(!f())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function d(T){h();var M=l(function(Y,J){return Y+J},0,T);if(M%8!=0)throw new Error("The bits ["+T.join(", ")+"] add up to "+M+" which is not an even number of bytes; the total should be divisible by 8");var z,q=M/8,K=(z=function(Y){return Y>48},l(function(Y,J){return Y||(z(J)?J:Y)},null,T));if(K)throw new Error(K+" bit range requested exceeds 48 bit (6 byte) Number max.");return new s(function(Y,J){var _e=q+J;return _e>Y.length?_(J,q.toString()+" bytes"):v(_e,l(function(at,mn){var Jt=u(mn,at.buf);return{coll:at.coll.concat(Jt.v),buf:Jt.buf}},{coll:[],buf:Y.slice(J,_e)},T).coll)})}function p(T,M){return new s(function(z,q){return h(),q+M>z.length?_(q,M+" bytes for "+T):v(q+M,z.slice(q,q+M))})}function g(T,M){if(typeof(z=M)!="number"||Math.floor(z)!==z||M<0||M>6)throw new Error(T+" requires integer length in range [0, 6].");var z}function y(T){return g("uintBE",T),p("uintBE("+T+")",T).map(function(M){return M.readUIntBE(0,T)})}function w(T){return g("uintLE",T),p("uintLE("+T+")",T).map(function(M){return M.readUIntLE(0,T)})}function b(T){return g("intBE",T),p("intBE("+T+")",T).map(function(M){return M.readIntBE(0,T)})}function S(T){return g("intLE",T),p("intLE("+T+")",T).map(function(M){return M.readIntLE(0,T)})}function D(T){return T instanceof s}function k(T){return{}.toString.call(T)==="[object Array]"}function E(T){return f()&&x.isBuffer(T)}function v(T,M){return{status:!0,index:T,value:M,furthest:-1,expected:[]}}function _(T,M){return k(M)||(M=[M]),{status:!1,index:-1,value:null,furthest:T,expected:M}}function C(T,M){if(!M||T.furthest>M.furthest)return T;var z=T.furthest===M.furthest?function(q,K){if(function(){if(s._supportsSet!==void 0)return s._supportsSet;var Gi=typeof Set<"u";return s._supportsSet=Gi,Gi}()&&Array.from){for(var Y=new Set(q),J=0;J<K.length;J++)Y.add(K[J]);var _e=Array.from(Y);return _e.sort(),_e}for(var at={},mn=0;mn<q.length;mn++)at[q[mn]]=!0;for(var Jt=0;Jt<K.length;Jt++)at[K[Jt]]=!0;var Wi=[];for(var Zn in at)({}).hasOwnProperty.call(at,Zn)&&Wi.push(Zn);return Wi.sort(),Wi}(T.expected,M.expected):M.expected;return{status:T.status,index:T.index,value:T.value,furthest:M.furthest,expected:z}}var A={};function P(T,M){if(E(T))return{offset:M,line:-1,column:-1};T in A||(A[T]={});for(var z=A[T],q=0,K=0,Y=0,J=M;J>=0;){if(J in z){q=z[J].line,Y===0&&(Y=z[J].lineStart);break}(T.charAt(J)===`
|
||
`||T.charAt(J)==="\r"&&T.charAt(J+1)!==`
|
||
`)&&(K++,Y===0&&(Y=J+1)),J--}var _e=q+K,at=M-Y;return z[M]={line:_e,lineStart:Y},{offset:M,line:_e+1,column:at+1}}function N(T){if(!D(T))throw new Error("not a parser: "+T)}function B(T,M){return typeof T=="string"?T.charAt(M):T[M]}function L(T){if(typeof T!="number")throw new Error("not a number: "+T)}function G(T){if(typeof T!="function")throw new Error("not a function: "+T)}function U(T){if(typeof T!="string")throw new Error("not a string: "+T)}var he=2,Te=3,Xe=8,O=5*Xe,De=4*Xe,ve=" ";function I(T,M){return new Array(M+1).join(T)}function Pe(T,M,z){var q=M-T.length;return q<=0?T:I(z,q)+T}function Nt(T,M,z,q){return{from:T-M>0?T-M:0,to:T+z>q?q:T+z}}function tt(T,M){var z,q,K,Y,J,_e=M.index,at=_e.offset,mn=1;if(at===T.length)return"Got the end of the input";if(E(T)){var Jt=at-at%Xe,Wi=at-Jt,Zn=Nt(Jt,O,De+Xe,T.length),Gi=c(function(Mt){return c(function(Ga){return Pe(Ga.toString(16),2,"0")},Mt)},function(Mt,Ga){var Qa=Mt.length,Mo=[],Ka=0;if(Qa<=Ga)return[Mt.slice()];for(var Za=0;Za<Qa;Za++)Mo[Ka]||Mo.push([]),Mo[Ka].push(Mt[Za]),(Za+1)%Ga==0&&Ka++;return Mo}(T.slice(Zn.from,Zn.to).toJSON().data,Xe));Y=function(Mt){return Mt.from===0&&Mt.to===1?{from:Mt.from,to:Mt.to}:{from:Mt.from/Xe,to:Math.floor(Mt.to/Xe)}}(Zn),q=Jt/Xe,z=3*Wi,Wi>=4&&(z+=1),mn=2,K=c(function(Mt){return Mt.length<=4?Mt.join(" "):Mt.slice(0,4).join(" ")+" "+Mt.slice(4).join(" ")},Gi),(J=(8*(Y.to>0?Y.to-1:Y.to)).toString(16).length)<2&&(J=2)}else{var Wa=T.split(/\r\n|[\n\r\u2028\u2029]/);z=_e.column-1,q=_e.line-1,Y=Nt(q,he,Te,Wa.length),K=Wa.slice(Y.from,Y.to),J=Y.to.toString().length}var WL=q-Y.from;return E(T)&&(J=(8*(Y.to>0?Y.to-1:Y.to)).toString(16).length)<2&&(J=2),l(function(Mt,Ga,Qa){var Mo,Ka=Qa===WL,Za=Ka?"> ":ve;return Mo=E(T)?Pe((8*(Y.from+Qa)).toString(16),J,"0"):Pe((Y.from+Qa+1).toString(),J," "),[].concat(Mt,[Za+Mo+" | "+Ga],Ka?[ve+I(" ",J)+" | "+Pe("",z," ")+I("^",mn)]:[])},[],K).join(`
|
||
`)}function Ve(T,M){return[`
|
||
`,"-- PARSING FAILED "+I("-",50),`
|
||
|
||
`,tt(T,M),`
|
||
|
||
`,(z=M.expected,z.length===1?`Expected:
|
||
|
||
`+z[0]:`Expected one of the following:
|
||
|
||
`+z.join(", ")),`
|
||
`].join("");var z}function bt(T){return T.flags!==void 0?T.flags:[T.global?"g":"",T.ignoreCase?"i":"",T.multiline?"m":"",T.unicode?"u":"",T.sticky?"y":""].join("")}function dn(){for(var T=[].slice.call(arguments),M=T.length,z=0;z<M;z+=1)N(T[z]);return s(function(q,K){for(var Y,J=new Array(M),_e=0;_e<M;_e+=1){if(!(Y=C(T[_e]._(q,K),Y)).status)return Y;J[_e]=Y.value,K=Y.index}return C(v(K,J),Y)})}function It(){var T=[].slice.call(arguments);if(T.length===0)throw new Error("seqMap needs at least one argument");var M=T.pop();return G(M),dn.apply(null,T).map(function(z){return M.apply(null,z)})}function Ut(){var T=[].slice.call(arguments),M=T.length;if(M===0)return Qn("zero alternates");for(var z=0;z<M;z+=1)N(T[z]);return s(function(q,K){for(var Y,J=0;J<T.length;J+=1)if((Y=C(T[J]._(q,K),Y)).status)return Y;return Y})}function Ne(T,M){return lt(T,M).or(An([]))}function lt(T,M){return N(T),N(M),It(T,M.then(T).many(),function(z,q){return[z].concat(q)})}function At(T){U(T);var M="'"+T+"'";return s(function(z,q){var K=q+T.length,Y=z.slice(q,K);return Y===T?v(K,Y):_(q,M)})}function dt(T,M){(function(K){if(!(K instanceof RegExp))throw new Error("not a regexp: "+K);for(var Y=bt(K),J=0;J<Y.length;J++){var _e=Y.charAt(J);if(_e!=="i"&&_e!=="m"&&_e!=="u"&&_e!=="s")throw new Error('unsupported regexp flag "'+_e+'": '+K)}})(T),arguments.length>=2?L(M):M=0;var z=function(K){return RegExp("^(?:"+K.source+")",bt(K))}(T),q=""+T;return s(function(K,Y){var J=z.exec(K.slice(Y));if(J){if(0<=M&&M<=J.length){var _e=J[0],at=J[M];return v(Y+_e.length,at)}return _(Y,"valid match group (0 to "+J.length+") in "+q)}return _(Y,q)})}function An(T){return s(function(M,z){return v(z,T)})}function Qn(T){return s(function(M,z){return _(z,T)})}function gi(T){if(D(T))return s(function(M,z){var q=T._(M,z);return q.index=z,q.value="",q});if(typeof T=="string")return gi(At(T));if(T instanceof RegExp)return gi(dt(T));throw new Error("not a string, regexp, or parser: "+T)}function cu(T){return N(T),s(function(M,z){var q=T._(M,z),K=M.slice(z,q.index);return q.status?_(z,'not "'+K+'"'):v(z,null)})}function Po(T){return G(T),s(function(M,z){var q=B(M,z);return z<M.length&&T(q)?v(z+1,q):_(z,"a character/byte matching "+T)})}function cd(T,M){arguments.length<2&&(M=T,T=void 0);var z=s(function(q,K){return z._=M()._,z._(q,K)});return T?z.desc(T):z}function uu(){return Qn("fantasy-land/empty")}o.parse=function(T){if(typeof T!="string"&&!E(T))throw new Error(".parse must be called with a string or Buffer as its argument");var M,z=this.skip(j)._(T,0);return M=z.status?{status:!0,value:z.value}:{status:!1,index:P(T,z.furthest),expected:z.expected},delete A[T],M},o.tryParse=function(T){var M=this.parse(T);if(M.status)return M.value;var z=Ve(T,M),q=new Error(z);throw q.type="ParsimmonError",q.result=M,q},o.assert=function(T,M){return this.chain(function(z){return T(z)?An(z):Qn(M)})},o.or=function(T){return Ut(this,T)},o.trim=function(T){return this.wrap(T,T)},o.wrap=function(T,M){return It(T,this,M,function(z,q){return q})},o.thru=function(T){return T(this)},o.then=function(T){return N(T),dn(this,T).map(function(M){return M[1]})},o.many=function(){var T=this;return s(function(M,z){for(var q=[],K=void 0;;){if(!(K=C(T._(M,z),K)).status)return C(v(z,q),K);if(z===K.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");z=K.index,q.push(K.value)}})},o.tieWith=function(T){return U(T),this.map(function(M){if(function(K){if(!k(K))throw new Error("not an array: "+K)}(M),M.length){U(M[0]);for(var z=M[0],q=1;q<M.length;q++)U(M[q]),z+=T+M[q];return z}return""})},o.tie=function(){return this.tieWith("")},o.times=function(T,M){var z=this;return arguments.length<2&&(M=T),L(T),L(M),s(function(q,K){for(var Y=[],J=void 0,_e=void 0,at=0;at<T;at+=1){if(_e=C(J=z._(q,K),_e),!J.status)return _e;K=J.index,Y.push(J.value)}for(;at<M&&(_e=C(J=z._(q,K),_e),J.status);at+=1)K=J.index,Y.push(J.value);return C(v(K,Y),_e)})},o.result=function(T){return this.map(function(){return T})},o.atMost=function(T){return this.times(0,T)},o.atLeast=function(T){return It(this.times(T),this.many(),function(M,z){return M.concat(z)})},o.map=function(T){G(T);var M=this;return s(function(z,q){var K=M._(z,q);return K.status?C(v(K.index,T(K.value)),K):K})},o.contramap=function(T){G(T);var M=this;return s(function(z,q){var K=M.parse(T(z.slice(q)));return K.status?v(q+z.length,K.value):K})},o.promap=function(T,M){return G(T),G(M),this.contramap(T).map(M)},o.skip=function(T){return dn(this,T).map(function(M){return M[0]})},o.mark=function(){return It(No,this,No,function(T,M,z){return{start:T,value:M,end:z}})},o.node=function(T){return It(No,this,No,function(M,z,q){return{name:T,value:z,start:M,end:q}})},o.sepBy=function(T){return Ne(this,T)},o.sepBy1=function(T){return lt(this,T)},o.lookahead=function(T){return this.skip(gi(T))},o.notFollowedBy=function(T){return this.skip(cu(T))},o.desc=function(T){k(T)||(T=[T]);var M=this;return s(function(z,q){var K=M._(z,q);return K.status||(K.expected=T),K})},o.fallback=function(T){return this.or(An(T))},o.ap=function(T){return It(T,this,function(M,z){return M(z)})},o.chain=function(T){var M=this;return s(function(z,q){var K=M._(z,q);return K.status?C(T(K.value)._(z,K.index),K):K})},o.concat=o.or,o.empty=uu,o.of=An,o["fantasy-land/ap"]=o.ap,o["fantasy-land/chain"]=o.chain,o["fantasy-land/concat"]=o.concat,o["fantasy-land/empty"]=o.empty,o["fantasy-land/of"]=o.of,o["fantasy-land/map"]=o.map;var No=s(function(T,M){return v(M,P(T,M))}),vy=s(function(T,M){return M>=T.length?_(M,"any character/byte"):v(M+1,B(T,M))}),ky=s(function(T,M){return v(T.length,T.slice(M))}),j=s(function(T,M){return M<T.length?_(M,"EOF"):v(M,null)}),ee=dt(/[0-9]/).desc("a digit"),Ee=dt(/[0-9]*/).desc("optional digits"),Re=dt(/[a-z]/i).desc("a letter"),nt=dt(/[a-z]*/i).desc("optional letters"),Kn=dt(/\s*/).desc("optional whitespace"),Hi=dt(/\s+/).desc("whitespace"),xr=At("\r"),vs=At(`
|
||
`),ks=At(`\r
|
||
`),sn=Ut(ks,vs,xr).desc("newline"),xs=Ut(sn,j);s.all=ky,s.alt=Ut,s.any=vy,s.cr=xr,s.createLanguage=function(T){var M={};for(var z in T)({}).hasOwnProperty.call(T,z)&&function(q){M[q]=cd(function(){return T[q](M)})}(z);return M},s.crlf=ks,s.custom=function(T){return s(T(v,_))},s.digit=ee,s.digits=Ee,s.empty=uu,s.end=xs,s.eof=j,s.fail=Qn,s.formatError=Ve,s.index=No,s.isParser=D,s.lazy=cd,s.letter=Re,s.letters=nt,s.lf=vs,s.lookahead=gi,s.makeFailure=_,s.makeSuccess=v,s.newline=sn,s.noneOf=function(T){return Po(function(M){return T.indexOf(M)<0}).desc("none of '"+T+"'")},s.notFollowedBy=cu,s.of=An,s.oneOf=function(T){for(var M=T.split(""),z=0;z<M.length;z++)M[z]="'"+M[z]+"'";return Po(function(q){return T.indexOf(q)>=0}).desc(M)},s.optWhitespace=Kn,s.Parser=s,s.range=function(T,M){return Po(function(z){return T<=z&&z<=M}).desc(T+"-"+M)},s.regex=dt,s.regexp=dt,s.sepBy=Ne,s.sepBy1=lt,s.seq=dn,s.seqMap=It,s.seqObj=function(){for(var T,M={},z=0,q=(T=arguments,Array.prototype.slice.call(T)),K=q.length,Y=0;Y<K;Y+=1){var J=q[Y];if(!D(J)){if(k(J)&&J.length===2&&typeof J[0]=="string"&&D(J[1])){var _e=J[0];if(Object.prototype.hasOwnProperty.call(M,_e))throw new Error("seqObj: duplicate key "+_e);M[_e]=!0,z++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(z===0)throw new Error("seqObj expects at least one named parser, found zero");return s(function(at,mn){for(var Jt,Wi={},Zn=0;Zn<K;Zn+=1){var Gi,Wa;if(k(q[Zn])?(Gi=q[Zn][0],Wa=q[Zn][1]):(Gi=null,Wa=q[Zn]),!(Jt=C(Wa._(at,mn),Jt)).status)return Jt;Gi&&(Wi[Gi]=Jt.value),mn=Jt.index}return C(v(mn,Wi),Jt)})},s.string=At,s.succeed=An,s.takeWhile=function(T){return G(T),s(function(M,z){for(var q=z;q<M.length&&T(B(M,q));)q++;return v(q,M.slice(z,q))})},s.test=Po,s.whitespace=Hi,s["fantasy-land/empty"]=uu,s["fantasy-land/of"]=An,s.Binary={bitSeq:d,bitSeqObj:function(T){h();var M={},z=0,q=c(function(Y){if(k(Y)){var J=Y;if(J.length!==2)throw new Error("["+J.join(", ")+"] should be length 2, got length "+J.length);if(U(J[0]),L(J[1]),Object.prototype.hasOwnProperty.call(M,J[0]))throw new Error("duplicate key in bitSeqObj: "+J[0]);return M[J[0]]=!0,z++,J}return L(Y),[null,Y]},T);if(z<1)throw new Error("bitSeqObj expects at least one named pair, got ["+T.join(", ")+"]");var K=c(function(Y){return Y[0]},q);return d(c(function(Y){return Y[1]},q)).map(function(Y){return l(function(J,_e){return _e[0]!==null&&(J[_e[0]]=_e[1]),J},{},c(function(J,_e){return[J,Y[_e]]},K))})},byte:function(T){if(h(),L(T),T>255)throw new Error("Value specified to byte constructor ("+T+"=0x"+T.toString(16)+") is larger in value than a single byte.");var M=(T>15?"0x":"0x0")+T.toString(16);return s(function(z,q){var K=B(z,q);return K===T?v(q+1,K):_(q,M)})},buffer:function(T){return p("buffer",T).map(function(M){return x.from(M)})},encodedString:function(T,M){return p("string",M).map(function(z){return z.toString(T)})},uintBE:y,uint8BE:y(1),uint16BE:y(2),uint32BE:y(4),uintLE:w,uint8LE:w(1),uint16LE:w(2),uint32LE:w(4),intBE:b,int8BE:b(1),int16BE:b(2),int32BE:b(4),intLE:S,int8LE:S(1),int16LE:S(2),int32LE:S(4),floatBE:p("floatBE",4).map(function(T){return T.readFloatBE(0)}),floatLE:p("floatLE",4).map(function(T){return T.readFloatLE(0)}),doubleBE:p("doubleBE",8).map(function(T){return T.readDoubleBE(0)}),doubleLE:p("doubleLE",8).map(function(T){return T.readDoubleLE(0)})},n.exports=s}])})})(fm,fm.exports);var F=fm.exports,y0=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function p_(t){return t==null?t:t.shiftToAll().normalize()}function hE(t){return t.includes("/")&&(t=t.substring(t.lastIndexOf("/")+1)),t.endsWith(".md")&&(t=t.substring(0,t.length-3)),t}F.alt(F.regex(new RegExp(y0(),"")),F.regex(/[0-9\p{Letter}_-]+/u).map(t=>t.toLocaleLowerCase()),F.whitespace.map(t=>"-"),F.any.map(t=>"")).many().map(t=>t.join(""));var k4=F.alt(F.regex(new RegExp(y0(),"")),F.regex(/[0-9\p{Letter}_-]+/u),F.whitespace.map(t=>" "),F.any.map(t=>" ")).many().map(t=>t.join("").split(/\s+/).join(" ").trim());function x4(t){return k4.tryParse(t)}function S4(t){return t=p_(t),t=ge.fromObject(Object.fromEntries(Object.entries(t.toObject()).filter(([,e])=>e!=0))),t.toHuman()}var Ou;(function(t){function e(D,k=g0,E=!1){let v=n(D);if(!v)return k.renderNullAs;switch(v.type){case"null":return k.renderNullAs;case"string":return v.value;case"number":case"boolean":return""+v.value;case"html":return v.value.outerHTML;case"widget":return v.value.markdown();case"link":return v.value.markdown();case"function":return"<function>";case"array":let _="";return E&&(_+="["),_+=v.value.map(C=>e(C,k,!0)).join(", "),E&&(_+="]"),_;case"object":return"{ "+Object.entries(v.value).map(C=>C[0]+": "+e(C[1],k,!0)).join(", ")+" }";case"date":return v.value.second==0&&v.value.hour==0&&v.value.minute==0?v.value.toFormat(k.defaultDateFormat):v.value.toFormat(k.defaultDateTimeFormat);case"duration":return S4(v.value)}}t.toString=e;function n(D){return h(D)?{type:"null",value:D}:c(D)?{type:"number",value:D}:l(D)?{type:"string",value:D}:p(D)?{type:"boolean",value:D}:f(D)?{type:"duration",value:D}:u(D)?{type:"date",value:D}:y(D)?{type:"widget",value:D}:d(D)?{type:"array",value:D}:g(D)?{type:"link",value:D}:S(D)?{type:"function",value:D}:w(D)?{type:"html",value:D}:b(D)?{type:"object",value:D}:void 0}t.wrapValue=n;function r(D,k){if(b(D)){let E={};for(let[v,_]of Object.entries(D))E[v]=r(_,k);return E}else if(d(D)){let E=[];for(let v of D)E.push(r(v,k));return E}else return k(D)}t.mapLeaves=r;function i(D,k,E){if(D===void 0&&(D=null),k===void 0&&(k=null),D===null&&k===null)return 0;if(D===null)return-1;if(k===null)return 1;let v=n(D),_=n(k);if(v===void 0&&_===void 0)return 0;if(v===void 0)return-1;if(_===void 0)return 1;if(v.type!=_.type)return v.type.localeCompare(_.type);if(v.value===_.value)return 0;switch(v.type){case"string":return v.value.localeCompare(_.value);case"number":return v.value<_.value?-1:v.value==_.value?0:1;case"null":return 0;case"boolean":return v.value==_.value?0:v.value?1:-1;case"link":let C=v.value,A=_.value,P=E??(De=>De),N=P(C.path).localeCompare(P(A.path));if(N!=0)return N;let B=C.type.localeCompare(A.type);return B!=0?B:C.subpath&&!A.subpath?1:!C.subpath&&A.subpath?-1:!C.subpath&&!A.subpath?0:(C.subpath??"").localeCompare(A.subpath??"");case"date":return v.value<_.value?-1:v.value.equals(_.value)?0:1;case"duration":return v.value<_.value?-1:v.value.equals(_.value)?0:1;case"array":let L=v.value,G=_.value;for(let De=0;De<Math.min(L.length,G.length);De++){let ve=i(L[De],G[De]);if(ve!=0)return ve}return L.length-G.length;case"object":let U=v.value,he=_.value,Te=Array.from(Object.keys(U)),Xe=Array.from(Object.keys(he));Te.sort(),Xe.sort();let O=i(Te,Xe);if(O!=0)return O;for(let De of Te){let ve=i(U[De],he[De]);if(ve!=0)return ve}return 0;case"widget":case"html":case"function":return 0}}t.compareValue=i;function s(D){return n(D)?.type}t.typeOf=s;function o(D){let k=n(D);if(!k)return!1;switch(k.type){case"number":return k.value!=0;case"string":return k.value.length>0;case"boolean":return k.value;case"link":return!!k.value.path;case"date":return k.value.toMillis()!=0;case"duration":return k.value.as("seconds")!=0;case"object":return Object.keys(k.value).length>0;case"array":return k.value.length>0;case"null":return!1;case"html":case"widget":case"function":return!0}}t.isTruthy=o;function a(D){if(D==null)return D;if(t.isArray(D))return[].concat(D.map(k=>a(k)));if(t.isObject(D)){let k={};for(let[E,v]of Object.entries(D))k[E]=a(v);return k}else return D}t.deepCopy=a;function l(D){return typeof D=="string"}t.isString=l;function c(D){return typeof D=="number"}t.isNumber=c;function u(D){return D instanceof Ae}t.isDate=u;function f(D){return D instanceof ge}t.isDuration=f;function h(D){return D==null}t.isNull=h;function d(D){return Array.isArray(D)}t.isArray=d;function p(D){return typeof D=="boolean"}t.isBoolean=p;function g(D){return D instanceof hm}t.isLink=g;function y(D){return D instanceof Pu}t.isWidget=y;function w(D){return typeof HTMLElement<"u"?D instanceof HTMLElement:!1}t.isHtml=w;function b(D){return typeof D=="object"&&!w(D)&&!y(D)&&!d(D)&&!f(D)&&!u(D)&&!g(D)&&D!==void 0&&!h(D)}t.isObject=b;function S(D){return typeof D=="function"}t.isFunction=S})(Ou||(Ou={}));var dE;(function(t){function e(i){return Ou.isObject(i)&&Object.keys(i).length==2&&"key"in i&&"rows"in i}t.isElementGroup=e;function n(i){for(let s of i)if(!e(s))return!1;return!0}t.isGrouping=n;function r(i){if(n(i)){let s=0;for(let o of i)s+=r(o.rows);return s}else return i.length}t.count=r})(dE||(dE={}));var hm=class t{path;display;subpath;embed;type;static file(e,n=!1,r){return new t({path:e,embed:n,display:r,subpath:void 0,type:"file"})}static infer(e,n=!1,r){if(e.includes("#^")){let i=e.split("#^");return t.block(i[0],i[1],n,r)}else if(e.includes("#")){let i=e.split("#");return t.header(i[0],i[1],n,r)}else return t.file(e,n,r)}static header(e,n,r,i){return new t({path:e,embed:r,display:i,subpath:x4(n),type:"header"})}static block(e,n,r,i){return new t({path:e,embed:r,display:i,subpath:n,type:"block"})}static fromObject(e){return new t(e)}constructor(e){Object.assign(this,e)}equals(e){return e==null||e==null?!1:this.path==e.path&&this.type==e.type&&this.subpath==e.subpath}toString(){return this.markdown()}toObject(){return{path:this.path,type:this.type,subpath:this.subpath,display:this.display,embed:this.embed}}withPath(e){return new t(Object.assign({},this,{path:e}))}withDisplay(e){return new t(Object.assign({},this,{display:e}))}withHeader(e){return t.header(this.path,e,this.embed,this.display)}toFile(){return t.file(this.path,this.embed,this.display)}toEmbed(){if(this.embed)return this;{let e=new t(this);return e.embed=!0,e}}fromEmbed(){if(this.embed){let e=new t(this);return e.embed=!1,e}else return this}markdown(){let e=(this.embed?"!":"")+"[["+this.obsidianLink();return this.display?e+="|"+this.display:(e+="|"+hE(this.path),(this.type=="header"||this.type=="block")&&(e+=" > "+this.subpath)),e+="]]",e}obsidianLink(){let e=this.path.replaceAll("|","\\|");return this.type=="header"?e+"#"+this.subpath?.replaceAll("|","\\|"):this.type=="block"?e+"#^"+this.subpath?.replaceAll("|","\\|"):e}fileName(){return hE(this.path).replace(".md","")}},Pu=class{$widget;constructor(e){this.$widget=e}},s0=class extends Pu{key;value;constructor(e,n){super("dataview:list-pair"),this.key=e,this.value=n}markdown(){return`${Ou.toString(this.key)}: ${Ou.toString(this.value)}`}},o0=class extends Pu{url;display;constructor(e,n){super("dataview:external-link"),this.url=e,this.display=n}markdown(){return`[${this.display??this.url}](${this.url})`}},mE;(function(t){function e(o,a){return new s0(o,a)}t.listPair=e;function n(o,a){return new o0(o,a)}t.externalLink=n;function r(o){return o.$widget==="dataview:list-pair"}t.isListPair=r;function i(o){return o.$widget==="dataview:external-link"}t.isExternalLink=i;function s(o){return r(o)||i(o)}t.isBuiltin=s})(mE||(mE={}));var kt;(function(t){function e(h){return{type:"variable",name:h}}t.variable=e;function n(h){return{type:"literal",value:h}}t.literal=n;function r(h,d,p){return{type:"binaryop",left:h,op:d,right:p}}t.binaryOp=r;function i(h,d){return{type:"index",object:h,index:d}}t.index=i;function s(h){let d=h.split("."),p=t.variable(d[0]);for(let g=1;g<d.length;g++)p=t.index(p,t.literal(d[g]));return p}t.indexVariable=s;function o(h,d){return{type:"lambda",arguments:h,value:d}}t.lambda=o;function a(h,d){return{type:"function",func:h,arguments:d}}t.func=a;function l(h){return{type:"list",values:h}}t.list=l;function c(h){return{type:"object",values:h}}t.object=c;function u(h){return{type:"negated",child:h}}t.negate=u;function f(h){return h=="<="||h=="<"||h==">"||h==">="||h=="!="||h=="="}t.isCompareOp=f,t.NULL=t.literal(null)})(kt||(kt={}));var ki;(function(t){function e(u){return{type:"tag",tag:u}}t.tag=e;function n(u){return{type:"csv",path:u}}t.csv=n;function r(u){return{type:"folder",folder:u}}t.folder=r;function i(u,f){return{type:"link",file:u,direction:f?"incoming":"outgoing"}}t.link=i;function s(u,f,h){return{type:"binaryop",left:u,op:f,right:h}}t.binaryOp=s;function o(u,f){return{type:"binaryop",left:u,op:"&",right:f}}t.and=o;function a(u,f){return{type:"binaryop",left:u,op:"|",right:f}}t.or=a;function l(u){return{type:"negate",child:u}}t.negate=l;function c(){return{type:"empty"}}t.empty=c})(ki||(ki={}));var pE=new RegExp(y0(),""),a0={year:ge.fromObject({years:1}),years:ge.fromObject({years:1}),yr:ge.fromObject({years:1}),yrs:ge.fromObject({years:1}),month:ge.fromObject({months:1}),months:ge.fromObject({months:1}),mo:ge.fromObject({months:1}),mos:ge.fromObject({months:1}),week:ge.fromObject({weeks:1}),weeks:ge.fromObject({weeks:1}),wk:ge.fromObject({weeks:1}),wks:ge.fromObject({weeks:1}),w:ge.fromObject({weeks:1}),day:ge.fromObject({days:1}),days:ge.fromObject({days:1}),d:ge.fromObject({days:1}),hour:ge.fromObject({hours:1}),hours:ge.fromObject({hours:1}),hr:ge.fromObject({hours:1}),hrs:ge.fromObject({hours:1}),h:ge.fromObject({hours:1}),minute:ge.fromObject({minutes:1}),minutes:ge.fromObject({minutes:1}),min:ge.fromObject({minutes:1}),mins:ge.fromObject({minutes:1}),m:ge.fromObject({minutes:1}),second:ge.fromObject({seconds:1}),seconds:ge.fromObject({seconds:1}),sec:ge.fromObject({seconds:1}),secs:ge.fromObject({seconds:1}),s:ge.fromObject({seconds:1})},l0={now:()=>Ae.local(),today:()=>Ae.local().startOf("day"),yesterday:()=>Ae.local().startOf("day").minus(ge.fromObject({days:1})),tomorrow:()=>Ae.local().startOf("day").plus(ge.fromObject({days:1})),sow:()=>Ae.local().startOf("week"),"start-of-week":()=>Ae.local().startOf("week"),eow:()=>Ae.local().endOf("week"),"end-of-week":()=>Ae.local().endOf("week"),soy:()=>Ae.local().startOf("year"),"start-of-year":()=>Ae.local().startOf("year"),eoy:()=>Ae.local().endOf("year"),"end-of-year":()=>Ae.local().endOf("year"),som:()=>Ae.local().startOf("month"),"start-of-month":()=>Ae.local().startOf("month"),eom:()=>Ae.local().endOf("month"),"end-of-month":()=>Ae.local().endOf("month")},c0=["FROM","WHERE","LIMIT","GROUP","FLATTEN"];function D4(t){let e=-1;for(;(e=t.indexOf("|",e+1))>=0;)if(!(e>0&&t[e-1]=="\\"))return[t.substring(0,e).replace(/\\\|/g,"|"),t.substring(e+1)];return[t.replace(/\\\|/g,"|"),void 0]}function E4(t){let[e,n]=D4(t);return hm.infer(e,!1,n)}function Tu(t,e,n){return F.seqMap(t,F.seq(F.optWhitespace,e,F.optWhitespace,t).many(),(r,i)=>{if(i.length==0)return r;let s=n(r,i[0][1],i[0][3]);for(let o=1;o<i.length;o++)s=n(s,i[o][1],i[o][3]);return s})}function _4(t,...e){return F.custom((n,r)=>(i,s)=>{let o=t._(i,s);if(!o.status)return o;for(let a of e){let l=a(o.value)._(i,o.index);if(!l.status)return o;o=l}return o})}var Wr=F.createLanguage({number:t=>F.regexp(/-?[0-9]+(\.[0-9]+)?/).map(e=>Number.parseFloat(e)).desc("number"),string:t=>F.string('"').then(F.alt(t.escapeCharacter,F.noneOf('"\\')).atLeast(0).map(e=>e.join(""))).skip(F.string('"')).desc("string"),escapeCharacter:t=>F.string("\\").then(F.any).map(e=>e==='"'?'"':e==="\\"?"\\":"\\"+e),bool:t=>F.regexp(/true|false|True|False/).map(e=>e.toLowerCase()=="true").desc("boolean ('true' or 'false')"),tag:t=>F.seqMap(F.string("#"),F.alt(F.regexp(/[^\u2000-\u206F\u2E00-\u2E7F'!"#$%&()*+,.:;<=>?@^`{|}~\[\]\\\s]/).desc("text")).many(),(e,n)=>e+n.join("")).desc("tag ('#hello/stuff')"),identifier:t=>F.seqMap(F.alt(F.regexp(/\p{Letter}/u),F.regexp(pE).desc("text")),F.alt(F.regexp(/[0-9\p{Letter}_-]/u),F.regexp(pE).desc("text")).many(),(e,n)=>e+n.join("")).desc("variable identifier"),link:t=>F.regexp(/\[\[([^\[\]]*?)\]\]/u,1).map(e=>E4(e)).desc("file link"),embedLink:t=>F.seqMap(F.string("!").atMost(1),t.link,(e,n)=>(e.length>0&&(n.embed=!0),n)).desc("file link"),binaryPlusMinus:t=>F.regexp(/\+|-/).map(e=>e).desc("'+' or '-'"),binaryMulDiv:t=>F.regexp(/\*|\/|%/).map(e=>e).desc("'*' or '/' or '%'"),binaryCompareOp:t=>F.regexp(/>=|<=|!=|>|<|=/).map(e=>e).desc("'>=' or '<=' or '!=' or '=' or '>' or '<'"),binaryBooleanOp:t=>F.regexp(/and|or|&|\|/i).map(e=>e.toLowerCase()=="and"?"&":e.toLowerCase()=="or"?"|":e).desc("'and' or 'or'"),rootDate:t=>F.seqMap(F.regexp(/\d{4}/),F.string("-"),F.regexp(/\d{2}/),(e,n,r)=>Ae.fromObject({year:Number.parseInt(e),month:Number.parseInt(r)})).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),dateShorthand:t=>F.alt(...Object.keys(l0).sort((e,n)=>n.length-e.length).map(F.string)),date:t=>_4(t.rootDate,e=>F.seqMap(F.string("-"),F.regexp(/\d{2}/),(n,r)=>e.set({day:Number.parseInt(r)})),e=>F.seqMap(F.string("T"),F.regexp(/\d{2}/),(n,r)=>e.set({hour:Number.parseInt(r)})),e=>F.seqMap(F.string(":"),F.regexp(/\d{2}/),(n,r)=>e.set({minute:Number.parseInt(r)})),e=>F.seqMap(F.string(":"),F.regexp(/\d{2}/),(n,r)=>e.set({second:Number.parseInt(r)})),e=>F.alt(F.seqMap(F.string("."),F.regexp(/\d{3}/),(n,r)=>e.set({millisecond:Number.parseInt(r)})),F.succeed(e)),e=>F.alt(F.seqMap(F.string("+").or(F.string("-")),F.regexp(/\d{1,2}(:\d{2})?/),(n,r)=>e.setZone("UTC"+n+r,{keepLocalTime:!0})),F.seqMap(F.string("Z"),()=>e.setZone("utc",{keepLocalTime:!0})),F.seqMap(F.string("["),F.regexp(/[0-9A-Za-z+-\/]+/u),F.string("]"),(n,r,i)=>e.setZone(r,{keepLocalTime:!0})))).assert(e=>e.isValid,"valid date").desc("date in format YYYY-MM[-DDTHH-MM-SS.MS]"),datePlus:t=>F.alt(t.dateShorthand.map(e=>l0[e]()),t.date).desc("date in format YYYY-MM[-DDTHH-MM-SS.MS] or in shorthand"),durationType:t=>F.alt(...Object.keys(a0).sort((e,n)=>n.length-e.length).map(F.string)),duration:t=>F.seqMap(t.number,F.optWhitespace,t.durationType,(e,n,r)=>a0[r].mapUnits(i=>i*e)).sepBy1(F.string(",").trim(F.optWhitespace).or(F.optWhitespace)).map(e=>e.reduce((n,r)=>n.plus(r))).desc("duration like 4hr2min"),rawNull:t=>F.string("null"),tagSource:t=>t.tag.map(e=>ki.tag(e)),csvSource:t=>F.seqMap(F.string("csv(").skip(F.optWhitespace),t.string,F.string(")"),(e,n,r)=>ki.csv(n)),linkIncomingSource:t=>t.link.map(e=>ki.link(e.path,!0)),linkOutgoingSource:t=>F.seqMap(F.string("outgoing(").skip(F.optWhitespace),t.link,F.string(")"),(e,n,r)=>ki.link(n.path,!1)),folderSource:t=>t.string.map(e=>ki.folder(e)),parensSource:t=>F.seqMap(F.string("("),F.optWhitespace,t.source,F.optWhitespace,F.string(")"),(e,n,r,i,s)=>r),negateSource:t=>F.seqMap(F.alt(F.string("-"),F.string("!")),t.atomSource,(e,n)=>ki.negate(n)),atomSource:t=>F.alt(t.parensSource,t.negateSource,t.linkOutgoingSource,t.linkIncomingSource,t.folderSource,t.tagSource,t.csvSource),binaryOpSource:t=>Tu(t.atomSource,t.binaryBooleanOp.map(e=>e),ki.binaryOp),source:t=>t.binaryOpSource,variableField:t=>t.identifier.chain(e=>c0.includes(e.toUpperCase())?F.fail("Variable fields cannot be a keyword ("+c0.join(" or ")+")"):F.succeed(kt.variable(e))).desc("variable"),numberField:t=>t.number.map(e=>kt.literal(e)).desc("number"),stringField:t=>t.string.map(e=>kt.literal(e)).desc("string"),boolField:t=>t.bool.map(e=>kt.literal(e)).desc("boolean"),dateField:t=>F.seqMap(F.string("date("),F.optWhitespace,t.datePlus,F.optWhitespace,F.string(")"),(e,n,r,i,s)=>kt.literal(r)).desc("date"),durationField:t=>F.seqMap(F.string("dur("),F.optWhitespace,t.duration,F.optWhitespace,F.string(")"),(e,n,r,i,s)=>kt.literal(r)).desc("duration"),nullField:t=>t.rawNull.map(e=>kt.NULL),linkField:t=>t.link.map(e=>kt.literal(e)),listField:t=>t.field.sepBy(F.string(",").trim(F.optWhitespace)).wrap(F.string("[").skip(F.optWhitespace),F.optWhitespace.then(F.string("]"))).map(e=>kt.list(e)).desc("list ('[1, 2, 3]')"),objectField:t=>F.seqMap(t.identifier.or(t.string),F.string(":").trim(F.optWhitespace),t.field,(e,n,r)=>({name:e,value:r})).sepBy(F.string(",").trim(F.optWhitespace)).wrap(F.string("{").skip(F.optWhitespace),F.optWhitespace.then(F.string("}"))).map(e=>{let n={};for(let r of e)n[r.name]=r.value;return kt.object(n)}).desc("object ('{ a: 1, b: 2 }')"),atomInlineField:t=>F.alt(t.date,t.duration.map(e=>p_(e)),t.string,t.tag,t.embedLink,t.bool,t.number,t.rawNull),inlineFieldList:t=>t.atomInlineField.sepBy(F.string(",").trim(F.optWhitespace).lookahead(t.atomInlineField)),inlineField:t=>F.alt(F.seqMap(t.atomInlineField,F.string(",").trim(F.optWhitespace),t.inlineFieldList,(e,n,r)=>[e].concat(r)),t.atomInlineField),atomField:t=>F.alt(t.embedLink.map(e=>kt.literal(e)),t.negatedField,t.linkField,t.listField,t.objectField,t.lambdaField,t.parensField,t.boolField,t.numberField,t.stringField,t.dateField,t.durationField,t.nullField,t.variableField),indexField:t=>F.seqMap(t.atomField,F.alt(t.dotPostfix,t.indexPostfix,t.functionPostfix).many(),(e,n)=>{let r=e;for(let i of n)switch(i.type){case"dot":r=kt.index(r,kt.literal(i.field));break;case"index":r=kt.index(r,i.field);break;case"function":r=kt.func(r,i.fields);break}return r}),negatedField:t=>F.seqMap(F.string("!"),t.indexField,(e,n)=>kt.negate(n)).desc("negated field"),parensField:t=>F.seqMap(F.string("("),F.optWhitespace,t.field,F.optWhitespace,F.string(")"),(e,n,r,i,s)=>r),lambdaField:t=>F.seqMap(t.identifier.sepBy(F.string(",").trim(F.optWhitespace)).wrap(F.string("(").trim(F.optWhitespace),F.string(")").trim(F.optWhitespace)),F.string("=>").trim(F.optWhitespace),t.field,(e,n,r)=>({type:"lambda",arguments:e,value:r})),dotPostfix:t=>F.seqMap(F.string("."),t.identifier,(e,n)=>({type:"dot",field:n})),indexPostfix:t=>F.seqMap(F.string("["),F.optWhitespace,t.field,F.optWhitespace,F.string("]"),(e,n,r,i,s)=>({type:"index",field:r})),functionPostfix:t=>F.seqMap(F.string("("),F.optWhitespace,t.field.sepBy(F.string(",").trim(F.optWhitespace)),F.optWhitespace,F.string(")"),(e,n,r,i,s)=>({type:"function",fields:r})),binaryMulDivField:t=>Tu(t.indexField,t.binaryMulDiv,kt.binaryOp),binaryPlusMinusField:t=>Tu(t.binaryMulDivField,t.binaryPlusMinus,kt.binaryOp),binaryCompareField:t=>Tu(t.binaryPlusMinusField,t.binaryCompareOp,kt.binaryOp),binaryBooleanField:t=>Tu(t.binaryCompareField,t.binaryBooleanOp,kt.binaryOp),binaryOpField:t=>t.binaryBooleanField,field:t=>t.binaryOpField});function C4(t){try{return um.success(Wr.field.tryParse(t))}catch(e){return um.failure(""+e)}}var dm;(function(t){function e(r,i){return{name:r,field:i}}t.named=e;function n(r,i){return{field:r,direction:i}}t.sortBy=n})(dm||(dm={}));function T4(t){return F.custom((e,n)=>(r,i)=>{let s=t._(r,i);return s.status?Object.assign({},s,{value:[s.value,r.substring(i,s.index)]}):s})}function F4(t){return t.split(/[\r\n]+/).map(e=>e.trim()).join("")}function gE(t,e){return F.eof.map(t).or(F.whitespace.then(e))}var g_=F.createLanguage({queryType:t=>F.alt(F.regexp(/TABLE|LIST|TASK|CALENDAR/i)).map(e=>e.toLowerCase()).desc("query type ('TABLE', 'LIST', 'TASK', or 'CALENDAR')"),explicitNamedField:t=>F.seqMap(Wr.field.skip(F.whitespace),F.regexp(/AS/i).skip(F.whitespace),Wr.identifier.or(Wr.string),(e,n,r)=>dm.named(r,e)),comment:()=>F.Parser((t,e)=>{let n=t.substring(e);if(!n.startsWith("//"))return F.makeFailure(e,"Not a comment");n=n.split(`
|
||
`)[0];let r=n.substring(2).trim();return F.makeSuccess(e+n.length,r)}),namedField:t=>F.alt(t.explicitNamedField,T4(Wr.field).map(([e,n])=>dm.named(F4(n),e))),sortField:t=>F.seqMap(Wr.field.skip(F.optWhitespace),F.regexp(/ASCENDING|DESCENDING|ASC|DESC/i).atMost(1),(e,n)=>{let r=n.length==0?"ascending":n[0].toLowerCase();return r=="desc"&&(r="descending"),r=="asc"&&(r="ascending"),{field:e,direction:r}}),headerClause:t=>t.queryType.chain(e=>{switch(e){case"table":return gE(()=>({type:e,fields:[],showId:!0}),F.seqMap(F.regexp(/WITHOUT\s+ID/i).skip(F.optWhitespace).atMost(1),F.sepBy(t.namedField,F.string(",").trim(F.optWhitespace)),(n,r)=>({type:e,fields:r,showId:n.length==0})));case"list":return gE(()=>({type:e,format:void 0,showId:!0}),F.seqMap(F.regexp(/WITHOUT\s+ID/i).skip(F.optWhitespace).atMost(1),Wr.field.atMost(1),(n,r)=>({type:e,format:r.length==1?r[0]:void 0,showId:n.length==0})));case"task":return F.succeed({type:e});case"calendar":return F.whitespace.then(F.seqMap(t.namedField,n=>({type:e,showId:!0,field:n})));default:return F.fail(`Unrecognized query type '${e}'`)}}).desc("TABLE or LIST or TASK or CALENDAR"),fromClause:t=>F.seqMap(F.regexp(/FROM/i),F.whitespace,Wr.source,(e,n,r)=>r),whereClause:t=>F.seqMap(F.regexp(/WHERE/i),F.whitespace,Wr.field,(e,n,r)=>({type:"where",clause:r})).desc("WHERE <expression>"),sortByClause:t=>F.seqMap(F.regexp(/SORT/i),F.whitespace,t.sortField.sepBy1(F.string(",").trim(F.optWhitespace)),(e,n,r)=>({type:"sort",fields:r})).desc("SORT field [ASC/DESC]"),limitClause:t=>F.seqMap(F.regexp(/LIMIT/i),F.whitespace,Wr.field,(e,n,r)=>({type:"limit",amount:r})).desc("LIMIT <value>"),flattenClause:t=>F.seqMap(F.regexp(/FLATTEN/i).skip(F.whitespace),t.namedField,(e,n)=>({type:"flatten",field:n})).desc("FLATTEN <value> [AS <name>]"),groupByClause:t=>F.seqMap(F.regexp(/GROUP BY/i).skip(F.whitespace),t.namedField,(e,n)=>({type:"group",field:n})).desc("GROUP BY <value> [AS <name>]"),clause:t=>F.alt(t.fromClause,t.whereClause,t.sortByClause,t.limitClause,t.groupByClause,t.flattenClause),query:t=>F.seqMap(t.headerClause.trim(qw),t.fromClause.trim(qw).atMost(1),t.clause.trim(qw).many(),(e,n,r)=>({header:e,source:n.length==0?ki.folder(""):n[0],operations:r,settings:g0}))}),qw=F.alt(F.whitespace,g_.comment).many().map(t=>t.join("")),I4=t=>t?t.plugins.plugins.dataview?.api:window.DataviewAPI,A4=t=>t.plugins.enabledPlugins.has("dataview");xi.DATE_SHORTHANDS=l0;xi.DURATION_TYPES=a0;xi.EXPRESSION=Wr;xi.KEYWORDS=c0;xi.QUERY_LANGUAGE=g_;xi.getAPI=I4;xi.isPluginEnabled=A4;xi.parseField=C4});var ZC=W((ehe,KC)=>{"use strict";m();var sr=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||sr.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||sr.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||sr.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=sr.DEFAULT_MAX_PENDING};sr.DEFAULT_TIMEOUT=0;sr.DEFAULT_MAX_OCCUPATION_TIME=0;sr.DEFAULT_MAX_EXECUTION_TIME=0;sr.DEFAULT_MAX_PENDING=1e3;sr.prototype.acquire=function(t,e,n,r){if(Array.isArray(t))return this._acquireBatch(t,e,n,r);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,s=null,o=null;typeof n!="function"&&(r=n,n=null,o=new this.Promise(function(b,S){i=b,s=S})),r=r||{};var a=!1,l=null,c=null,u=null,f=this,h=function(b,S,D){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),a||(o?S?s(S):i(D):typeof n=="function"&&n(S,D),a=!0),b&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},d=function(b){if(a)return h(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[t]=process.domain);var S=r.maxExecutionTime||f.maxExecutionTime;if(S&&(u=setTimeout(function(){f.queues[t]&&h(b,new Error("Maximum execution time is exceeded "+t))},S)),e.length===1){var D=!1;try{e(function(k,E){D||(D=!0,h(b,k,E))})}catch(k){D||(D=!0,h(b,k))}}else f._promiseTry(function(){return e()}).then(function(k){h(b,void 0,k)},function(k){h(b,k)})};f.domainReentrant&&process.domain&&(d=process.domain.bind(d));var p=r.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],d(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])d(!1);else if(f.queues[t].length>=p)h(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){d(!0)};r.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var y=r.timeout||f.timeout;y&&(l=setTimeout(function(){l=null,h(!1,new Error("async-lock timed out in queue "+t))},y))}var w=r.maxOccupationTime||f.maxOccupationTime;if(w&&(c=setTimeout(function(){f.queues[t]&&h(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),o)return o};sr.prototype._acquireBatch=function(t,e,n,r){typeof n!="function"&&(r=n,n=null);var i=this,s=function(a,l){return function(c){i.acquire(a,l,c,r)}},o=t.reduceRight(function(a,l){return s(l,a)},e);if(typeof n=="function")o(n);else return new this.Promise(function(a,l){o.length===1?o(function(c,u){c?l(c):a(u)}):a(o())})};sr.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};sr.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};KC.exports=sr});var JC=W((nhe,YC)=>{"use strict";m();YC.exports=ZC()});var XC=W((ihe,pb)=>{m();typeof Object.create=="function"?pb.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:pb.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}});var yb=W((gb,tT)=>{m();var $m=md(),Si=$m.Buffer;function eT(t,e){for(var n in t)e[n]=t[n]}Si.from&&Si.alloc&&Si.allocUnsafe&&Si.allocUnsafeSlow?tT.exports=$m:(eT($m,gb),gb.Buffer=aa);function aa(t,e,n){return Si(t,e,n)}aa.prototype=Object.create(Si.prototype);eT(Si,aa);aa.from=function(t,e,n){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Si(t,e,n)};aa.alloc=function(t,e,n){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=Si(t);return e!==void 0?typeof n=="string"?r.fill(e,n):r.fill(e):r.fill(0),r};aa.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Si(t)};aa.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return $m.SlowBuffer(t)}});var iT=W((wb,rT)=>{m();var Um=md(),Di=Um.Buffer;function nT(t,e){for(var n in t)e[n]=t[n]}Di.from&&Di.alloc&&Di.allocUnsafe&&Di.allocUnsafeSlow?rT.exports=Um:(nT(Um,wb),wb.Buffer=la);function la(t,e,n){return Di(t,e,n)}la.prototype=Object.create(Di.prototype);nT(Di,la);la.from=function(t,e,n){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Di(t,e,n)};la.alloc=function(t,e,n){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=Di(t);return e!==void 0?typeof n=="string"?r.fill(e,n):r.fill(e):r.fill(0),r};la.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Di(t)};la.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Um.SlowBuffer(t)}});var oT=W((lhe,sT)=>{m();var mq={}.toString;sT.exports=Array.isArray||function(t){return mq.call(t)=="[object Array]"}});var jl=W((uhe,aT)=>{"use strict";m();aT.exports=TypeError});var bb=W((hhe,lT)=>{"use strict";m();lT.exports=Object});var uT=W((mhe,cT)=>{"use strict";m();cT.exports=Error});var hT=W((ghe,fT)=>{"use strict";m();fT.exports=EvalError});var mT=W((whe,dT)=>{"use strict";m();dT.exports=RangeError});var gT=W((vhe,pT)=>{"use strict";m();pT.exports=ReferenceError});var vb=W((xhe,yT)=>{"use strict";m();yT.exports=SyntaxError});var bT=W((Dhe,wT)=>{"use strict";m();wT.exports=URIError});var kT=W((_he,vT)=>{"use strict";m();vT.exports=Math.abs});var ST=W((The,xT)=>{"use strict";m();xT.exports=Math.floor});var ET=W((Ihe,DT)=>{"use strict";m();DT.exports=Math.max});var CT=W((Ohe,_T)=>{"use strict";m();_T.exports=Math.min});var FT=W((Nhe,TT)=>{"use strict";m();TT.exports=Math.pow});var AT=W((Rhe,IT)=>{"use strict";m();IT.exports=Math.round});var PT=W((Lhe,OT)=>{"use strict";m();OT.exports=Number.isNaN||function(e){return e!==e}});var MT=W(($he,NT)=>{"use strict";m();var pq=PT();NT.exports=function(e){return pq(e)||e===0?e:e<0?-1:1}});var zT=W((jhe,RT)=>{"use strict";m();RT.exports=Object.getOwnPropertyDescriptor});var ql=W((Vhe,LT)=>{"use strict";m();var jm=zT();if(jm)try{jm([],"length")}catch{jm=null}LT.exports=jm});var gf=W((Whe,BT)=>{"use strict";m();var qm=Object.defineProperty||!1;if(qm)try{qm({},"a",{value:1})}catch{qm=!1}BT.exports=qm});var kb=W((Qhe,$T)=>{"use strict";m();$T.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[n]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,n);if(a.value!==i||a.enumerable!==!0)return!1}return!0}});var qT=W((Zhe,jT)=>{"use strict";m();var UT=typeof Symbol<"u"&&Symbol,gq=kb();jT.exports=function(){return typeof UT!="function"||typeof Symbol!="function"||typeof UT("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:gq()}});var xb=W((Jhe,VT)=>{"use strict";m();VT.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Sb=W((ede,HT)=>{"use strict";m();var yq=bb();HT.exports=yq.getPrototypeOf||null});var QT=W((nde,GT)=>{"use strict";m();var wq="Function.prototype.bind called on incompatible ",bq=Object.prototype.toString,vq=Math.max,kq="[object Function]",WT=function(e,n){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<n.length;s+=1)r[s+e.length]=n[s];return r},xq=function(e,n){for(var r=[],i=n||0,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},Sq=function(t,e){for(var n="",r=0;r<t.length;r+=1)n+=t[r],r+1<t.length&&(n+=e);return n};GT.exports=function(e){var n=this;if(typeof n!="function"||bq.apply(n)!==kq)throw new TypeError(wq+n);for(var r=xq(arguments,1),i,s=function(){if(this instanceof i){var u=n.apply(this,WT(r,arguments));return Object(u)===u?u:this}return n.apply(e,WT(r,arguments))},o=vq(0,n.length-r.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(i=Function("binder","return function ("+Sq(a,",")+"){ return binder.apply(this,arguments); }")(s),n.prototype){var c=function(){};c.prototype=n.prototype,i.prototype=new c,c.prototype=null}return i}});var Vl=W((ide,KT)=>{"use strict";m();var Dq=QT();KT.exports=Function.prototype.bind||Dq});var Vm=W((ode,ZT)=>{"use strict";m();ZT.exports=Function.prototype.call});var Hm=W((lde,YT)=>{"use strict";m();YT.exports=Function.prototype.apply});var XT=W((ude,JT)=>{"use strict";m();JT.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Db=W((hde,eF)=>{"use strict";m();var Eq=Vl(),_q=Hm(),Cq=Vm(),Tq=XT();eF.exports=Tq||Eq.call(Cq,_q)});var Wm=W((mde,tF)=>{"use strict";m();var Fq=Vl(),Iq=jl(),Aq=Vm(),Oq=Db();tF.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new Iq("a function is required");return Oq(Fq,Aq,e)}});var aF=W((gde,oF)=>{"use strict";m();var Pq=Wm(),nF=ql(),iF;try{iF=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var Eb=!!iF&&nF&&nF(Object.prototype,"__proto__"),sF=Object,rF=sF.getPrototypeOf;oF.exports=Eb&&typeof Eb.get=="function"?Pq([Eb.get]):typeof rF=="function"?function(e){return rF(e==null?e:sF(e))}:!1});var _b=W((wde,fF)=>{"use strict";m();var lF=xb(),cF=Sb(),uF=aF();fF.exports=lF?function(e){return lF(e)}:cF?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return cF(e)}:uF?function(e){return uF(e)}:null});var dF=W((vde,hF)=>{"use strict";m();var Nq=Function.prototype.call,Mq=Object.prototype.hasOwnProperty,Rq=Vl();hF.exports=Rq.call(Nq,Mq)});var Fb=W((xde,bF)=>{"use strict";m();var ze,zq=bb(),Lq=uT(),Bq=hT(),$q=mT(),Uq=gT(),Ql=vb(),Gl=jl(),jq=bT(),qq=kT(),Vq=ST(),Hq=ET(),Wq=CT(),Gq=FT(),Qq=AT(),Kq=MT(),yF=Function,Cb=function(t){try{return yF('"use strict"; return ('+t+").constructor;")()}catch{}},yf=ql(),Zq=gf(),Tb=function(){throw new Gl},Yq=yf?function(){try{return arguments.callee,Tb}catch{try{return yf(arguments,"callee").get}catch{return Tb}}}():Tb,Hl=qT()(),Qt=_b(),Jq=Sb(),Xq=xb(),wF=Hm(),wf=Vm(),Wl={},eV=typeof Uint8Array>"u"||!Qt?ze:Qt(Uint8Array),ca={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ze:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ze:ArrayBuffer,"%ArrayIteratorPrototype%":Hl&&Qt?Qt([][Symbol.iterator]()):ze,"%AsyncFromSyncIteratorPrototype%":ze,"%AsyncFunction%":Wl,"%AsyncGenerator%":Wl,"%AsyncGeneratorFunction%":Wl,"%AsyncIteratorPrototype%":Wl,"%Atomics%":typeof Atomics>"u"?ze:Atomics,"%BigInt%":typeof BigInt>"u"?ze:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ze:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ze:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ze:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Lq,"%eval%":eval,"%EvalError%":Bq,"%Float16Array%":typeof Float16Array>"u"?ze:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ze:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ze:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ze:FinalizationRegistry,"%Function%":yF,"%GeneratorFunction%":Wl,"%Int8Array%":typeof Int8Array>"u"?ze:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ze:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ze:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Hl&&Qt?Qt(Qt([][Symbol.iterator]())):ze,"%JSON%":typeof JSON=="object"?JSON:ze,"%Map%":typeof Map>"u"?ze:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Hl||!Qt?ze:Qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":zq,"%Object.getOwnPropertyDescriptor%":yf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ze:Promise,"%Proxy%":typeof Proxy>"u"?ze:Proxy,"%RangeError%":$q,"%ReferenceError%":Uq,"%Reflect%":typeof Reflect>"u"?ze:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ze:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Hl||!Qt?ze:Qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ze:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Hl&&Qt?Qt(""[Symbol.iterator]()):ze,"%Symbol%":Hl?Symbol:ze,"%SyntaxError%":Ql,"%ThrowTypeError%":Yq,"%TypedArray%":eV,"%TypeError%":Gl,"%Uint8Array%":typeof Uint8Array>"u"?ze:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ze:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ze:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ze:Uint32Array,"%URIError%":jq,"%WeakMap%":typeof WeakMap>"u"?ze:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ze:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ze:WeakSet,"%Function.prototype.call%":wf,"%Function.prototype.apply%":wF,"%Object.defineProperty%":Zq,"%Object.getPrototypeOf%":Jq,"%Math.abs%":qq,"%Math.floor%":Vq,"%Math.max%":Hq,"%Math.min%":Wq,"%Math.pow%":Gq,"%Math.round%":Qq,"%Math.sign%":Kq,"%Reflect.getPrototypeOf%":Xq};if(Qt)try{null.error}catch(t){mF=Qt(Qt(t)),ca["%Error.prototype%"]=mF}var mF,tV=function t(e){var n;if(e==="%AsyncFunction%")n=Cb("async function () {}");else if(e==="%GeneratorFunction%")n=Cb("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=Cb("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Qt&&(n=Qt(i.prototype))}return ca[e]=n,n},pF={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bf=Vl(),Gm=dF(),nV=bf.call(wf,Array.prototype.concat),rV=bf.call(wF,Array.prototype.splice),gF=bf.call(wf,String.prototype.replace),Qm=bf.call(wf,String.prototype.slice),iV=bf.call(wf,RegExp.prototype.exec),sV=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,oV=/\\(\\)?/g,aV=function(e){var n=Qm(e,0,1),r=Qm(e,-1);if(n==="%"&&r!=="%")throw new Ql("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Ql("invalid intrinsic syntax, expected opening `%`");var i=[];return gF(e,sV,function(s,o,a,l){i[i.length]=a?gF(l,oV,"$1"):o||s}),i},lV=function(e,n){var r=e,i;if(Gm(pF,r)&&(i=pF[r],r="%"+i[0]+"%"),Gm(ca,r)){var s=ca[r];if(s===Wl&&(s=tV(r)),typeof s>"u"&&!n)throw new Gl("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new Ql("intrinsic "+e+" does not exist!")};bF.exports=function(e,n){if(typeof e!="string"||e.length===0)throw new Gl("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Gl('"allowMissing" argument must be a boolean');if(iV(/^%?[^%]*%?$/,e)===null)throw new Ql("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=aV(e),i=r.length>0?r[0]:"",s=lV("%"+i+"%",n),o=s.name,a=s.value,l=!1,c=s.alias;c&&(i=c[0],rV(r,nV([0,1],c)));for(var u=1,f=!0;u<r.length;u+=1){var h=r[u],d=Qm(h,0,1),p=Qm(h,-1);if((d==='"'||d==="'"||d==="`"||p==='"'||p==="'"||p==="`")&&d!==p)throw new Ql("property names with quotes must have matching quotes");if((h==="constructor"||!f)&&(l=!0),i+="."+h,o="%"+i+"%",Gm(ca,o))a=ca[o];else if(a!=null){if(!(h in a)){if(!n)throw new Gl("base intrinsic for "+e+" exists, but the property is not available.");return}if(yf&&u+1>=r.length){var g=yf(a,h);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[h]}else f=Gm(a,h),a=a[h];f&&!l&&(ca[o]=a)}}return a}});var Ib=W((Dde,xF)=>{"use strict";m();var vF=Fb(),kF=Wm(),cV=kF([vF("%String.prototype.indexOf%")]);xF.exports=function(e,n){var r=vF(e,!!n);return typeof r=="function"&&cV(e,".prototype.")>-1?kF([r]):r}});var _F=W((_de,EF)=>{"use strict";m();var DF=Function.prototype.toString,Kl=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ob,Km;if(typeof Kl=="function"&&typeof Object.defineProperty=="function")try{Ob=Object.defineProperty({},"length",{get:function(){throw Km}}),Km={},Kl(function(){throw 42},null,Ob)}catch(t){t!==Km&&(Kl=null)}else Kl=null;var uV=/^\s*class\b/,Pb=function(e){try{var n=DF.call(e);return uV.test(n)}catch{return!1}},Ab=function(e){try{return Pb(e)?!1:(DF.call(e),!0)}catch{return!1}},Zm=Object.prototype.toString,fV="[object Object]",hV="[object Function]",dV="[object GeneratorFunction]",mV="[object HTMLAllCollection]",pV="[object HTML document.all class]",gV="[object HTMLCollection]",yV=typeof Symbol=="function"&&!!Symbol.toStringTag,wV=!(0 in[,]),Nb=function(){return!1};typeof document=="object"&&(SF=document.all,Zm.call(SF)===Zm.call(document.all)&&(Nb=function(e){if((wV||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Zm.call(e);return(n===mV||n===pV||n===gV||n===fV)&&e("")==null}catch{}return!1}));var SF;EF.exports=Kl?function(e){if(Nb(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Kl(e,null,Ob)}catch(n){if(n!==Km)return!1}return!Pb(e)&&Ab(e)}:function(e){if(Nb(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(yV)return Ab(e);if(Pb(e))return!1;var n=Zm.call(e);return n!==hV&&n!==dV&&!/^\[object HTML/.test(n)?!1:Ab(e)}});var FF=W((Tde,TF)=>{"use strict";m();var bV=_F(),vV=Object.prototype.toString,CF=Object.prototype.hasOwnProperty,kV=function(e,n,r){for(var i=0,s=e.length;i<s;i++)CF.call(e,i)&&(r==null?n(e[i],i,e):n.call(r,e[i],i,e))},xV=function(e,n,r){for(var i=0,s=e.length;i<s;i++)r==null?n(e.charAt(i),i,e):n.call(r,e.charAt(i),i,e)},SV=function(e,n,r){for(var i in e)CF.call(e,i)&&(r==null?n(e[i],i,e):n.call(r,e[i],i,e))};function DV(t){return vV.call(t)==="[object Array]"}TF.exports=function(e,n,r){if(!bV(n))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=r),DV(e)?kV(e,n,i):typeof e=="string"?xV(e,n,i):SV(e,n,i)}});var AF=W((Ide,IF)=>{"use strict";m();IF.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var PF=W((Ode,OF)=>{"use strict";m();var Mb=AF(),EV=globalThis;OF.exports=function(){for(var e=[],n=0;n<Mb.length;n++)typeof EV[Mb[n]]=="function"&&(e[e.length]=Mb[n]);return e}});var zF=W((Nde,RF)=>{"use strict";m();var NF=gf(),_V=vb(),Zl=jl(),MF=ql();RF.exports=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Zl("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Zl("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Zl("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Zl("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Zl("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Zl("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!MF&&MF(e,n);if(NF)NF(e,n,{configurable:o===null&&l?l.configurable:!o,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:s===null&&l?l.writable:!s});else if(a||!i&&!s&&!o)e[n]=r;else throw new _V("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var $F=W((Rde,BF)=>{"use strict";m();var Rb=gf(),LF=function(){return!!Rb};LF.hasArrayLengthDefineBug=function(){if(!Rb)return null;try{return Rb([],"length",{value:1}).length!==1}catch{return!0}};BF.exports=LF});var HF=W((Lde,VF)=>{"use strict";m();var CV=Fb(),UF=zF(),TV=$F()(),jF=ql(),qF=jl(),FV=CV("%Math.floor%");VF.exports=function(e,n){if(typeof e!="function")throw new qF("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||FV(n)!==n)throw new qF("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&jF){var o=jF(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(TV?UF(e,"length",n,!0,!0):UF(e,"length",n)),e}});var GF=W(($de,WF)=>{"use strict";m();var IV=Vl(),AV=Hm(),OV=Db();WF.exports=function(){return OV(IV,AV,arguments)}});var ZF=W((jde,Ym)=>{"use strict";m();var PV=HF(),QF=gf(),NV=Wm(),KF=GF();Ym.exports=function(e){var n=NV(arguments),r=1+e.length-(arguments.length-1);return PV(n,r>0?r:0,!0)};QF?QF(Ym.exports,"apply",{value:KF}):Ym.exports.apply=KF});var JF=W((Vde,YF)=>{"use strict";m();var MV=kb();YF.exports=function(){return MV()&&!!Symbol.toStringTag}});var rI=W((Wde,nI)=>{"use strict";m();var ep=FF(),RV=PF(),XF=ZF(),Lb=Ib(),Xm=ql(),Jm=_b(),zV=Lb("Object.prototype.toString"),tI=JF()(),eI=globalThis,zb=RV(),Bb=Lb("String.prototype.slice"),LV=Lb("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r<e.length;r+=1)if(e[r]===n)return r;return-1},tp={__proto__:null};tI&&Xm&&Jm?ep(zb,function(t){var e=new eI[t];if(Symbol.toStringTag in e&&Jm){var n=Jm(e),r=Xm(n,Symbol.toStringTag);if(!r&&n){var i=Jm(n);r=Xm(i,Symbol.toStringTag)}tp["$"+t]=XF(r.get)}}):ep(zb,function(t){var e=new eI[t],n=e.slice||e.set;n&&(tp["$"+t]=XF(n))});var BV=function(e){var n=!1;return ep(tp,function(r,i){if(!n)try{"$"+r(e)===i&&(n=Bb(i,1))}catch{}}),n},$V=function(e){var n=!1;return ep(tp,function(r,i){if(!n)try{r(e),n=Bb(i,1)}catch{}}),n};nI.exports=function(e){if(!e||typeof e!="object")return!1;if(!tI){var n=Bb(zV(e),8,-1);return LV(zb,n)>-1?n:n!=="Object"?!1:$V(e)}return Xm?BV(e):null}});var sI=W((Qde,iI)=>{"use strict";m();var UV=rI();iI.exports=function(e){return!!UV(e)}});var aI=W((Zde,oI)=>{"use strict";m();var jV=jl(),qV=Ib(),VV=qV("TypedArray.prototype.buffer",!0),HV=sI();oI.exports=VV||function(e){if(!HV(e))throw new jV("Not a Typed Array");return e.buffer}});var uI=W((Jde,cI)=>{"use strict";m();var ti=iT().Buffer,WV=oT(),GV=aI(),QV=ArrayBuffer.isView||function(e){try{return GV(e),!0}catch{return!1}},KV=typeof Uint8Array<"u",lI=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",ZV=lI&&(ti.prototype instanceof Uint8Array||ti.TYPED_ARRAY_SUPPORT);cI.exports=function(e,n){if(ti.isBuffer(e))return e.constructor&&!("isBuffer"in e)?ti.from(e):e;if(typeof e=="string")return ti.from(e,n);if(lI&&QV(e)){if(e.byteLength===0)return ti.alloc(0);if(ZV){var r=ti.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}var i=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=ti.from(i);if(s.length===e.byteLength)return s}if(KV&&e instanceof Uint8Array)return ti.from(e);var o=WV(e);if(o)for(var a=0;a<e.length;a+=1){var l=e[a];if(typeof l!="number"||l<0||l>255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(o||ti.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return ti.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var hI=W((eme,fI)=>{"use strict";m();var YV=yb().Buffer,JV=uI();function np(t,e){this._block=YV.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}np.prototype.update=function(t,e){t=JV(t,e||"utf8");for(var n=this._block,r=this._blockSize,i=t.length,s=this._len,o=0;o<i;){for(var a=s%r,l=Math.min(i-o,r-a),c=0;c<l;c++)n[a+c]=t[o+c];s+=l,o+=l,s%r===0&&this._update(n)}return this._len+=i,this};np.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=this._len*8;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(n&4294967295)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};np.prototype._update=function(){throw new Error("_update must be implemented by subclass")};fI.exports=np});var pI=W((nme,mI)=>{"use strict";m();var XV=XC(),dI=hI(),e5=yb().Buffer,t5=[1518500249,1859775393,-1894007588,-899497514],n5=new Array(80);function vf(){this.init(),this._w=n5,dI.call(this,64,56)}XV(vf,dI);vf.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function r5(t){return t<<1|t>>>31}function i5(t){return t<<5|t>>>27}function s5(t){return t<<30|t>>>2}function o5(t,e,n,r){return t===0?e&n|~e&r:t===2?e&n|e&r|n&r:e^n^r}vf.prototype._update=function(t){for(var e=this._w,n=this._a|0,r=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=t.readInt32BE(a*4);for(;a<80;++a)e[a]=r5(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=i5(n)+o5(c,r,i,s)+o+e[l]+t5[c]|0;o=s,s=i,i=s5(r),r=n,n=u}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};vf.prototype._hash=function(){var t=e5.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};mI.exports=vf});var yI=W($b=>{m();var gI;(function(t){typeof DO_NOT_EXPORT_CRC>"u"?typeof $b=="object"?t($b):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(gI={}):t(gI={})})(function(t){t.version="1.2.2";function e(){for(var v=0,_=new Array(256),C=0;C!=256;++C)v=C,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,v=v&1?-306674912^v>>>1:v>>>1,_[C]=v;return typeof Int32Array<"u"?new Int32Array(_):_}var n=e();function r(v){var _=0,C=0,A=0,P=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(A=0;A!=256;++A)P[A]=v[A];for(A=0;A!=256;++A)for(C=v[A],_=256+A;_<4096;_+=256)C=P[_]=C>>>8^v[C&255];var N=[];for(A=1;A!=16;++A)N[A-1]=typeof Int32Array<"u"?P.subarray(A*256,A*256+256):P.slice(A*256,A*256+256);return N}var i=r(n),s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],f=i[6],h=i[7],d=i[8],p=i[9],g=i[10],y=i[11],w=i[12],b=i[13],S=i[14];function D(v,_){for(var C=_^-1,A=0,P=v.length;A<P;)C=C>>>8^n[(C^v.charCodeAt(A++))&255];return~C}function k(v,_){for(var C=_^-1,A=v.length-15,P=0;P<A;)C=S[v[P++]^C&255]^b[v[P++]^C>>8&255]^w[v[P++]^C>>16&255]^y[v[P++]^C>>>24]^g[v[P++]]^p[v[P++]]^d[v[P++]]^h[v[P++]]^f[v[P++]]^u[v[P++]]^c[v[P++]]^l[v[P++]]^a[v[P++]]^o[v[P++]]^s[v[P++]]^n[v[P++]];for(A+=15;P<A;)C=C>>>8^n[(C^v[P++])&255];return~C}function E(v,_){for(var C=_^-1,A=0,P=v.length,N=0,B=0;A<P;)N=v.charCodeAt(A++),N<128?C=C>>>8^n[(C^N)&255]:N<2048?(C=C>>>8^n[(C^(192|N>>6&31))&255],C=C>>>8^n[(C^(128|N&63))&255]):N>=55296&&N<57344?(N=(N&1023)+64,B=v.charCodeAt(A++)&1023,C=C>>>8^n[(C^(240|N>>8&7))&255],C=C>>>8^n[(C^(128|N>>2&63))&255],C=C>>>8^n[(C^(128|B>>6&15|(N&3)<<4))&255],C=C>>>8^n[(C^(128|B&63))&255]):(C=C>>>8^n[(C^(224|N>>12&15))&255],C=C>>>8^n[(C^(128|N>>6&63))&255],C=C>>>8^n[(C^(128|N&63))&255]);return~C}t.table=n,t.bstr=D,t.buf=k,t.str=E})});var is=W(yn=>{"use strict";m();var a5=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function l5(t,e){return Object.prototype.hasOwnProperty.call(t,e)}yn.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)l5(n,r)&&(t[r]=n[r])}}return t};yn.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var c5={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray){t.set(e.subarray(n,n+r),i);return}for(var s=0;s<r;s++)t[i+s]=e[n+s]},flattenChunks:function(t){var e,n,r,i,s,o;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(o=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)s=t[e],o.set(s,i),i+=s.length;return o}},u5={arraySet:function(t,e,n,r,i){for(var s=0;s<r;s++)t[i+s]=e[n+s]},flattenChunks:function(t){return[].concat.apply([],t)}};yn.setTyped=function(t){t?(yn.Buf8=Uint8Array,yn.Buf16=Uint16Array,yn.Buf32=Int32Array,yn.assign(yn,c5)):(yn.Buf8=Array,yn.Buf16=Array,yn.Buf32=Array,yn.assign(yn,u5))};yn.setTyped(a5)});var $I=W(Xl=>{"use strict";m();var f5=is(),h5=4,wI=0,bI=1,d5=2;function Jl(t){for(var e=t.length;--e>=0;)t[e]=0}var m5=0,EI=1,p5=2,g5=3,y5=258,Gb=29,_f=256,xf=_f+1+Gb,Yl=30,Qb=19,_I=2*xf+1,ua=15,Ub=16,w5=7,Kb=256,CI=16,TI=17,FI=18,Hb=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],rp=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],b5=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],II=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v5=512,ss=new Array((xf+2)*2);Jl(ss);var kf=new Array(Yl*2);Jl(kf);var Sf=new Array(v5);Jl(Sf);var Df=new Array(y5-g5+1);Jl(Df);var Zb=new Array(Gb);Jl(Zb);var ip=new Array(Yl);Jl(ip);function jb(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}var AI,OI,PI;function qb(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function NI(t){return t<256?Sf[t]:Sf[256+(t>>>7)]}function Ef(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Mn(t,e,n){t.bi_valid>Ub-n?(t.bi_buf|=e<<t.bi_valid&65535,Ef(t,t.bi_buf),t.bi_buf=e>>Ub-t.bi_valid,t.bi_valid+=n-Ub):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function Ei(t,e,n){Mn(t,n[e*2],n[e*2+1])}function MI(t,e){var n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1}function k5(t){t.bi_valid===16?(Ef(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}function x5(t,e){var n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,h,d,p,g=0;for(h=0;h<=ua;h++)t.bl_count[h]=0;for(n[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<_I;c++)u=t.heap[c],h=n[n[u*2+1]*2+1]+1,h>l&&(h=l,g++),n[u*2+1]=h,!(u>r)&&(t.bl_count[h]++,d=0,u>=a&&(d=o[u-a]),p=n[u*2],t.opt_len+=p*(h+d),s&&(t.static_len+=p*(i[u*2+1]+d)));if(g!==0){do{for(h=l-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(h=l;h!==0;h--)for(u=t.bl_count[h];u!==0;)f=t.heap[--c],!(f>r)&&(n[f*2+1]!==h&&(t.opt_len+=(h-n[f*2+1])*n[f*2],n[f*2+1]=h),u--)}}function RI(t,e,n){var r=new Array(ua+1),i=0,s,o;for(s=1;s<=ua;s++)r[s]=i=i+n[s-1]<<1;for(o=0;o<=e;o++){var a=t[o*2+1];a!==0&&(t[o*2]=MI(r[a]++,a))}}function S5(){var t,e,n,r,i,s=new Array(ua+1);for(n=0,r=0;r<Gb-1;r++)for(Zb[r]=n,t=0;t<1<<Hb[r];t++)Df[n++]=r;for(Df[n-1]=r,i=0,r=0;r<16;r++)for(ip[r]=i,t=0;t<1<<rp[r];t++)Sf[i++]=r;for(i>>=7;r<Yl;r++)for(ip[r]=i<<7,t=0;t<1<<rp[r]-7;t++)Sf[256+i++]=r;for(e=0;e<=ua;e++)s[e]=0;for(t=0;t<=143;)ss[t*2+1]=8,t++,s[8]++;for(;t<=255;)ss[t*2+1]=9,t++,s[9]++;for(;t<=279;)ss[t*2+1]=7,t++,s[7]++;for(;t<=287;)ss[t*2+1]=8,t++,s[8]++;for(RI(ss,xf+1,s),t=0;t<Yl;t++)kf[t*2+1]=5,kf[t*2]=MI(t,5);AI=new jb(ss,Hb,_f+1,xf,ua),OI=new jb(kf,rp,0,Yl,ua),PI=new jb(new Array(0),b5,0,Qb,w5)}function zI(t){var e;for(e=0;e<xf;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Yl;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Qb;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Kb*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function LI(t){t.bi_valid>8?Ef(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function D5(t,e,n,r){LI(t),r&&(Ef(t,n),Ef(t,~n)),f5.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function vI(t,e,n,r){var i=e*2,s=n*2;return t[i]<t[s]||t[i]===t[s]&&r[e]<=r[n]}function Vb(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&vI(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!vI(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function kI(t,e,n){var r,i,s=0,o,a;if(t.last_lit!==0)do r=t.pending_buf[t.d_buf+s*2]<<8|t.pending_buf[t.d_buf+s*2+1],i=t.pending_buf[t.l_buf+s],s++,r===0?Ei(t,i,e):(o=Df[i],Ei(t,o+_f+1,e),a=Hb[o],a!==0&&(i-=Zb[o],Mn(t,i,a)),r--,o=NI(r),Ei(t,o,n),a=rp[o],a!==0&&(r-=ip[o],Mn(t,r,a)));while(s<t.last_lit);Ei(t,Kb,e)}function Wb(t,e){var n=e.dyn_tree,r=e.stat_desc.static_tree,i=e.stat_desc.has_stree,s=e.stat_desc.elems,o,a,l=-1,c;for(t.heap_len=0,t.heap_max=_I,o=0;o<s;o++)n[o*2]!==0?(t.heap[++t.heap_len]=l=o,t.depth[o]=0):n[o*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=l<2?++l:0,n[c*2]=1,t.depth[c]=0,t.opt_len--,i&&(t.static_len-=r[c*2+1]);for(e.max_code=l,o=t.heap_len>>1;o>=1;o--)Vb(t,n,o);c=s;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Vb(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,n[c*2]=n[o*2]+n[a*2],t.depth[c]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,n[o*2+1]=n[a*2+1]=c,t.heap[1]=c++,Vb(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],x5(t,e),RI(n,l,t.bl_count)}function xI(t,e,n){var r,i=-1,s,o=e[0*2+1],a=0,l=7,c=4;for(o===0&&(l=138,c=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)s=o,o=e[(r+1)*2+1],!(++a<l&&s===o)&&(a<c?t.bl_tree[s*2]+=a:s!==0?(s!==i&&t.bl_tree[s*2]++,t.bl_tree[CI*2]++):a<=10?t.bl_tree[TI*2]++:t.bl_tree[FI*2]++,a=0,i=s,o===0?(l=138,c=3):s===o?(l=6,c=3):(l=7,c=4))}function SI(t,e,n){var r,i=-1,s,o=e[0*2+1],a=0,l=7,c=4;for(o===0&&(l=138,c=3),r=0;r<=n;r++)if(s=o,o=e[(r+1)*2+1],!(++a<l&&s===o)){if(a<c)do Ei(t,s,t.bl_tree);while(--a!==0);else s!==0?(s!==i&&(Ei(t,s,t.bl_tree),a--),Ei(t,CI,t.bl_tree),Mn(t,a-3,2)):a<=10?(Ei(t,TI,t.bl_tree),Mn(t,a-3,3)):(Ei(t,FI,t.bl_tree),Mn(t,a-11,7));a=0,i=s,o===0?(l=138,c=3):s===o?(l=6,c=3):(l=7,c=4)}}function E5(t){var e;for(xI(t,t.dyn_ltree,t.l_desc.max_code),xI(t,t.dyn_dtree,t.d_desc.max_code),Wb(t,t.bl_desc),e=Qb-1;e>=3&&t.bl_tree[II[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function _5(t,e,n,r){var i;for(Mn(t,e-257,5),Mn(t,n-1,5),Mn(t,r-4,4),i=0;i<r;i++)Mn(t,t.bl_tree[II[i]*2+1],3);SI(t,t.dyn_ltree,e-1),SI(t,t.dyn_dtree,n-1)}function C5(t){var e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return wI;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return bI;for(n=32;n<_f;n++)if(t.dyn_ltree[n*2]!==0)return bI;return wI}var DI=!1;function T5(t){DI||(S5(),DI=!0),t.l_desc=new qb(t.dyn_ltree,AI),t.d_desc=new qb(t.dyn_dtree,OI),t.bl_desc=new qb(t.bl_tree,PI),t.bi_buf=0,t.bi_valid=0,zI(t)}function BI(t,e,n,r){Mn(t,(m5<<1)+(r?1:0),3),D5(t,e,n,!0)}function F5(t){Mn(t,EI<<1,3),Ei(t,Kb,ss),k5(t)}function I5(t,e,n,r){var i,s,o=0;t.level>0?(t.strm.data_type===d5&&(t.strm.data_type=C5(t)),Wb(t,t.l_desc),Wb(t,t.d_desc),o=E5(t),i=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&e!==-1?BI(t,e,n,r):t.strategy===h5||s===i?(Mn(t,(EI<<1)+(r?1:0),3),kI(t,ss,kf)):(Mn(t,(p5<<1)+(r?1:0),3),_5(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),kI(t,t.dyn_ltree,t.dyn_dtree)),zI(t),r&&LI(t)}function A5(t,e,n){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=n&255,t.last_lit++,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(Df[n]+_f+1)*2]++,t.dyn_dtree[NI(e)*2]++),t.last_lit===t.lit_bufsize-1}Xl._tr_init=T5;Xl._tr_stored_block=BI;Xl._tr_flush_block=I5;Xl._tr_tally=A5;Xl._tr_align=F5});var Yb=W((ume,UI)=>{"use strict";m();function O5(t,e,n,r){for(var i=t&65535|0,s=t>>>16&65535|0,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+e[r++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0}UI.exports=O5});var Jb=W((hme,jI)=>{"use strict";m();function P5(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e}var N5=P5();function M5(t,e,n,r){var i=N5,s=r+n;t^=-1;for(var o=r;o<s;o++)t=t>>>8^i[(t^e[o])&255];return t^-1}jI.exports=M5});var sp=W((mme,qI)=>{"use strict";m();qI.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var JI=W(Ti=>{"use strict";m();var wn=is(),Ir=$I(),GI=Yb(),qs=Jb(),R5=sp(),ma=0,z5=1,L5=3,Qs=4,VI=5,Ci=0,HI=1,Ar=-2,B5=-3,Xb=-5,$5=-1,U5=1,op=2,j5=3,q5=4,V5=0,H5=2,up=8,W5=9,G5=15,Q5=8,K5=29,Z5=256,tv=Z5+1+K5,Y5=30,J5=19,X5=2*tv+1,eH=15,Ue=3,Ws=258,ni=Ws+Ue+1,tH=32,fp=42,nv=69,ap=73,lp=91,cp=103,fa=113,Tf=666,Rt=1,Ff=2,ha=3,nc=4,nH=3;function Gs(t,e){return t.msg=R5[e],e}function WI(t){return(t<<1)-(t>4?9:0)}function Hs(t){for(var e=t.length;--e>=0;)t[e]=0}function Vs(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(wn.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))}function en(t,e){Ir._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Vs(t.strm)}function Ke(t,e){t.pending_buf[t.pending++]=e}function Cf(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function rH(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,wn.arraySet(e,t.input,t.next_in,i,n),t.state.wrap===1?t.adler=GI(t.adler,e,i,n):t.state.wrap===2&&(t.adler=qs(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function QI(t,e){var n=t.max_chain_length,r=t.strstart,i,s,o=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-ni?t.strstart-(t.w_size-ni):0,c=t.window,u=t.w_mask,f=t.prev,h=t.strstart+Ws,d=c[r+o-1],p=c[r+o];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do if(i=e,!(c[i+o]!==p||c[i+o-1]!==d||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<h);if(s=Ws-(h-r),r=h-Ws,s>o){if(t.match_start=e,o=s,s>=a)break;d=c[r+o-1],p=c[r+o]}}while((e=f[e&u])>l&&--n!==0);return o<=t.lookahead?o:t.lookahead}function da(t){var e=t.w_size,n,r,i,s,o;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ni)){wn.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,r=t.hash_size,n=r;do i=t.head[--n],t.head[n]=i>=e?i-e:0;while(--r);r=e,n=r;do i=t.prev[--n],t.prev[n]=i>=e?i-e:0;while(--r);s+=e}if(t.strm.avail_in===0)break;if(r=rH(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=r,t.lookahead+t.insert>=Ue)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+Ue-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<Ue)););}while(t.lookahead<ni&&t.strm.avail_in!==0)}function iH(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(da(t),t.lookahead===0&&e===ma)return Rt;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((t.strstart===0||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,en(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-ni&&(en(t,!1),t.strm.avail_out===0))return Rt}return t.insert=0,e===Qs?(en(t,!0),t.strm.avail_out===0?ha:nc):(t.strstart>t.block_start&&(en(t,!1),t.strm.avail_out===0),Rt)}function ev(t,e){for(var n,r;;){if(t.lookahead<ni){if(da(t),t.lookahead<ni&&e===ma)return Rt;if(t.lookahead===0)break}if(n=0,t.lookahead>=Ue&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Ue-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),n!==0&&t.strstart-n<=t.w_size-ni&&(t.match_length=QI(t,n)),t.match_length>=Ue)if(r=Ir._tr_tally(t,t.strstart-t.match_start,t.match_length-Ue),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Ue){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Ue-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=Ir._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(en(t,!1),t.strm.avail_out===0))return Rt}return t.insert=t.strstart<Ue-1?t.strstart:Ue-1,e===Qs?(en(t,!0),t.strm.avail_out===0?ha:nc):t.last_lit&&(en(t,!1),t.strm.avail_out===0)?Rt:Ff}function ec(t,e){for(var n,r,i;;){if(t.lookahead<ni){if(da(t),t.lookahead<ni&&e===ma)return Rt;if(t.lookahead===0)break}if(n=0,t.lookahead>=Ue&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Ue-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Ue-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-ni&&(t.match_length=QI(t,n),t.match_length<=5&&(t.strategy===U5||t.match_length===Ue&&t.strstart-t.match_start>4096)&&(t.match_length=Ue-1)),t.prev_length>=Ue&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-Ue,r=Ir._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Ue),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Ue-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=Ue-1,t.strstart++,r&&(en(t,!1),t.strm.avail_out===0))return Rt}else if(t.match_available){if(r=Ir._tr_tally(t,0,t.window[t.strstart-1]),r&&en(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Rt}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=Ir._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Ue-1?t.strstart:Ue-1,e===Qs?(en(t,!0),t.strm.avail_out===0?ha:nc):t.last_lit&&(en(t,!1),t.strm.avail_out===0)?Rt:Ff}function sH(t,e){for(var n,r,i,s,o=t.window;;){if(t.lookahead<=Ws){if(da(t),t.lookahead<=Ws&&e===ma)return Rt;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Ue&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){s=t.strstart+Ws;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<s);t.match_length=Ws-(s-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Ue?(n=Ir._tr_tally(t,1,t.match_length-Ue),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Ir._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(en(t,!1),t.strm.avail_out===0))return Rt}return t.insert=0,e===Qs?(en(t,!0),t.strm.avail_out===0?ha:nc):t.last_lit&&(en(t,!1),t.strm.avail_out===0)?Rt:Ff}function oH(t,e){for(var n;;){if(t.lookahead===0&&(da(t),t.lookahead===0)){if(e===ma)return Rt;break}if(t.match_length=0,n=Ir._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(en(t,!1),t.strm.avail_out===0))return Rt}return t.insert=0,e===Qs?(en(t,!0),t.strm.avail_out===0?ha:nc):t.last_lit&&(en(t,!1),t.strm.avail_out===0)?Rt:Ff}function _i(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}var tc;tc=[new _i(0,0,0,0,iH),new _i(4,4,8,4,ev),new _i(4,5,16,8,ev),new _i(4,6,32,32,ev),new _i(4,4,16,16,ec),new _i(8,16,32,32,ec),new _i(8,16,128,128,ec),new _i(8,32,128,256,ec),new _i(32,128,258,1024,ec),new _i(32,258,258,4096,ec)];function aH(t){t.window_size=2*t.w_size,Hs(t.head),t.max_lazy_match=tc[t.level].max_lazy,t.good_match=tc[t.level].good_length,t.nice_match=tc[t.level].nice_length,t.max_chain_length=tc[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Ue-1,t.match_available=0,t.ins_h=0}function lH(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=up,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new wn.Buf16(X5*2),this.dyn_dtree=new wn.Buf16((2*Y5+1)*2),this.bl_tree=new wn.Buf16((2*J5+1)*2),Hs(this.dyn_ltree),Hs(this.dyn_dtree),Hs(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new wn.Buf16(eH+1),this.heap=new wn.Buf16(2*tv+1),Hs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new wn.Buf16(2*tv+1),Hs(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function KI(t){var e;return!t||!t.state?Gs(t,Ar):(t.total_in=t.total_out=0,t.data_type=H5,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?fp:fa,t.adler=e.wrap===2?0:1,e.last_flush=ma,Ir._tr_init(e),Ci)}function ZI(t){var e=KI(t);return e===Ci&&aH(t.state),e}function cH(t,e){return!t||!t.state||t.state.wrap!==2?Ar:(t.state.gzhead=e,Ci)}function YI(t,e,n,r,i,s){if(!t)return Ar;var o=1;if(e===$5&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>W5||n!==up||r<8||r>15||e<0||e>9||s<0||s>q5)return Gs(t,Ar);r===8&&(r=9);var a=new lH;return t.state=a,a.strm=t,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+Ue-1)/Ue),a.window=new wn.Buf8(a.w_size*2),a.head=new wn.Buf16(a.hash_size),a.prev=new wn.Buf16(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new wn.Buf8(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=e,a.strategy=s,a.method=n,ZI(t)}function uH(t,e){return YI(t,e,up,G5,Q5,V5)}function fH(t,e){var n,r,i,s;if(!t||!t.state||e>VI||e<0)return t?Gs(t,Ar):Ar;if(r=t.state,!t.output||!t.input&&t.avail_in!==0||r.status===Tf&&e!==Qs)return Gs(t,t.avail_out===0?Xb:Ar);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===fp)if(r.wrap===2)t.adler=0,Ke(r,31),Ke(r,139),Ke(r,8),r.gzhead?(Ke(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Ke(r,r.gzhead.time&255),Ke(r,r.gzhead.time>>8&255),Ke(r,r.gzhead.time>>16&255),Ke(r,r.gzhead.time>>24&255),Ke(r,r.level===9?2:r.strategy>=op||r.level<2?4:0),Ke(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(Ke(r,r.gzhead.extra.length&255),Ke(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=qs(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=nv):(Ke(r,0),Ke(r,0),Ke(r,0),Ke(r,0),Ke(r,0),Ke(r,r.level===9?2:r.strategy>=op||r.level<2?4:0),Ke(r,nH),r.status=fa);else{var o=up+(r.w_bits-8<<4)<<8,a=-1;r.strategy>=op||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,o|=a<<6,r.strstart!==0&&(o|=tH),o+=31-o%31,r.status=fa,Cf(r,o),r.strstart!==0&&(Cf(r,t.adler>>>16),Cf(r,t.adler&65535)),t.adler=1}if(r.status===nv)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=qs(t.adler,r.pending_buf,r.pending-i,i)),Vs(t),i=r.pending,r.pending===r.pending_buf_size));)Ke(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=qs(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=ap)}else r.status=ap;if(r.status===ap)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=qs(t.adler,r.pending_buf,r.pending-i,i)),Vs(t),i=r.pending,r.pending===r.pending_buf_size)){s=1;break}r.gzindex<r.gzhead.name.length?s=r.gzhead.name.charCodeAt(r.gzindex++)&255:s=0,Ke(r,s)}while(s!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=qs(t.adler,r.pending_buf,r.pending-i,i)),s===0&&(r.gzindex=0,r.status=lp)}else r.status=lp;if(r.status===lp)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=qs(t.adler,r.pending_buf,r.pending-i,i)),Vs(t),i=r.pending,r.pending===r.pending_buf_size)){s=1;break}r.gzindex<r.gzhead.comment.length?s=r.gzhead.comment.charCodeAt(r.gzindex++)&255:s=0,Ke(r,s)}while(s!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=qs(t.adler,r.pending_buf,r.pending-i,i)),s===0&&(r.status=cp)}else r.status=cp;if(r.status===cp&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Vs(t),r.pending+2<=r.pending_buf_size&&(Ke(r,t.adler&255),Ke(r,t.adler>>8&255),t.adler=0,r.status=fa)):r.status=fa),r.pending!==0){if(Vs(t),t.avail_out===0)return r.last_flush=-1,Ci}else if(t.avail_in===0&&WI(e)<=WI(n)&&e!==Qs)return Gs(t,Xb);if(r.status===Tf&&t.avail_in!==0)return Gs(t,Xb);if(t.avail_in!==0||r.lookahead!==0||e!==ma&&r.status!==Tf){var l=r.strategy===op?oH(r,e):r.strategy===j5?sH(r,e):tc[r.level].func(r,e);if((l===ha||l===nc)&&(r.status=Tf),l===Rt||l===ha)return t.avail_out===0&&(r.last_flush=-1),Ci;if(l===Ff&&(e===z5?Ir._tr_align(r):e!==VI&&(Ir._tr_stored_block(r,0,0,!1),e===L5&&(Hs(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Vs(t),t.avail_out===0))return r.last_flush=-1,Ci}return e!==Qs?Ci:r.wrap<=0?HI:(r.wrap===2?(Ke(r,t.adler&255),Ke(r,t.adler>>8&255),Ke(r,t.adler>>16&255),Ke(r,t.adler>>24&255),Ke(r,t.total_in&255),Ke(r,t.total_in>>8&255),Ke(r,t.total_in>>16&255),Ke(r,t.total_in>>24&255)):(Cf(r,t.adler>>>16),Cf(r,t.adler&65535)),Vs(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Ci:HI)}function hH(t){var e;return!t||!t.state?Ar:(e=t.state.status,e!==fp&&e!==nv&&e!==ap&&e!==lp&&e!==cp&&e!==fa&&e!==Tf?Gs(t,Ar):(t.state=null,e===fa?Gs(t,B5):Ci))}function dH(t,e){var n=e.length,r,i,s,o,a,l,c,u;if(!t||!t.state||(r=t.state,o=r.wrap,o===2||o===1&&r.status!==fp||r.lookahead))return Ar;for(o===1&&(t.adler=GI(t.adler,e,n,0)),r.wrap=0,n>=r.w_size&&(o===0&&(Hs(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new wn.Buf8(r.w_size),wn.arraySet(u,e,n-r.w_size,r.w_size,0),e=u,n=r.w_size),a=t.avail_in,l=t.next_in,c=t.input,t.avail_in=n,t.next_in=0,t.input=e,da(r);r.lookahead>=Ue;){i=r.strstart,s=r.lookahead-(Ue-1);do r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+Ue-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++;while(--s);r.strstart=i,r.lookahead=Ue-1,da(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Ue-1,r.match_available=0,t.next_in=l,t.input=c,t.avail_in=a,r.wrap=o,Ci}Ti.deflateInit=uH;Ti.deflateInit2=YI;Ti.deflateReset=ZI;Ti.deflateResetKeep=KI;Ti.deflateSetHeader=cH;Ti.deflate=fH;Ti.deflateEnd=hH;Ti.deflateSetDictionary=dH;Ti.deflateInfo="pako deflate (from Nodeca project)"});var rv=W(rc=>{"use strict";m();var hp=is(),XI=!0,e2=!0;try{String.fromCharCode.apply(null,[0])}catch{XI=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{e2=!1}var If=new hp.Buf8(256);for(os=0;os<256;os++)If[os]=os>=252?6:os>=248?5:os>=240?4:os>=224?3:os>=192?2:1;var os;If[254]=If[254]=1;rc.string2buf=function(t){var e,n,r,i,s,o=t.length,a=0;for(i=0;i<o;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(e=new hp.Buf8(a),s=0,i=0;s<a;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|n&63):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|n&63):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|n&63);return e};function t2(t,e){if(e<65534&&(t.subarray&&e2||!t.subarray&&XI))return String.fromCharCode.apply(null,hp.shrinkBuf(t,e));for(var n="",r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n}rc.buf2binstring=function(t){return t2(t,t.length)};rc.binstring2buf=function(t){for(var e=new hp.Buf8(t.length),n=0,r=e.length;n<r;n++)e[n]=t.charCodeAt(n);return e};rc.buf2string=function(t,e){var n,r,i,s,o=e||t.length,a=new Array(o*2);for(r=0,n=0;n<o;){if(i=t[n++],i<128){a[r++]=i;continue}if(s=If[i],s>4){a[r++]=65533,n+=s-1;continue}for(i&=s===2?31:s===3?15:7;s>1&&n<o;)i=i<<6|t[n++]&63,s--;if(s>1){a[r++]=65533;continue}i<65536?a[r++]=i:(i-=65536,a[r++]=55296|i>>10&1023,a[r++]=56320|i&1023)}return t2(a,r)};rc.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+If[t[n]]>e?n:e}});var iv=W((vme,n2)=>{"use strict";m();function mH(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}n2.exports=mH});var o2=W(Pf=>{"use strict";m();var Af=JI(),Of=is(),ov=rv(),av=sp(),pH=iv(),s2=Object.prototype.toString,gH=0,sv=4,ic=0,r2=1,i2=2,yH=-1,wH=0,bH=8;function pa(t){if(!(this instanceof pa))return new pa(t);this.options=Of.assign({level:yH,method:bH,chunkSize:16384,windowBits:15,memLevel:8,strategy:wH,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new pH,this.strm.avail_out=0;var n=Af.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==ic)throw new Error(av[n]);if(e.header&&Af.deflateSetHeader(this.strm,e.header),e.dictionary){var r;if(typeof e.dictionary=="string"?r=ov.string2buf(e.dictionary):s2.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=Af.deflateSetDictionary(this.strm,r),n!==ic)throw new Error(av[n]);this._dict_set=!0}}pa.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i,s;if(this.ended)return!1;s=e===~~e?e:e===!0?sv:gH,typeof t=="string"?n.input=ov.string2buf(t):s2.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Of.Buf8(r),n.next_out=0,n.avail_out=r),i=Af.deflate(n,s),i!==r2&&i!==ic)return this.onEnd(i),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(s===sv||s===i2))&&(this.options.to==="string"?this.onData(ov.buf2binstring(Of.shrinkBuf(n.output,n.next_out))):this.onData(Of.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&i!==r2);return s===sv?(i=Af.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ic):(s===i2&&(this.onEnd(ic),n.avail_out=0),!0)};pa.prototype.onData=function(t){this.chunks.push(t)};pa.prototype.onEnd=function(t){t===ic&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Of.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function lv(t,e){var n=new pa(e);if(n.push(t,!0),n.err)throw n.msg||av[n.err];return n.result}function vH(t,e){return e=e||{},e.raw=!0,lv(t,e)}function kH(t,e){return e=e||{},e.gzip=!0,lv(t,e)}Pf.Deflate=pa;Pf.deflate=lv;Pf.deflateRaw=vH;Pf.gzip=kH});var l2=W((Dme,a2)=>{"use strict";m();var dp=30,xH=12;a2.exports=function(e,n){var r,i,s,o,a,l,c,u,f,h,d,p,g,y,w,b,S,D,k,E,v,_,C,A,P;r=e.state,i=e.next_in,A=e.input,s=i+(e.avail_in-5),o=e.next_out,P=e.output,a=o-(n-e.avail_out),l=o+(e.avail_out-257),c=r.dmax,u=r.wsize,f=r.whave,h=r.wnext,d=r.window,p=r.hold,g=r.bits,y=r.lencode,w=r.distcode,b=(1<<r.lenbits)-1,S=(1<<r.distbits)-1;e:do{g<15&&(p+=A[i++]<<g,g+=8,p+=A[i++]<<g,g+=8),D=y[p&b];t:for(;;){if(k=D>>>24,p>>>=k,g-=k,k=D>>>16&255,k===0)P[o++]=D&65535;else if(k&16){E=D&65535,k&=15,k&&(g<k&&(p+=A[i++]<<g,g+=8),E+=p&(1<<k)-1,p>>>=k,g-=k),g<15&&(p+=A[i++]<<g,g+=8,p+=A[i++]<<g,g+=8),D=w[p&S];n:for(;;){if(k=D>>>24,p>>>=k,g-=k,k=D>>>16&255,k&16){if(v=D&65535,k&=15,g<k&&(p+=A[i++]<<g,g+=8,g<k&&(p+=A[i++]<<g,g+=8)),v+=p&(1<<k)-1,v>c){e.msg="invalid distance too far back",r.mode=dp;break e}if(p>>>=k,g-=k,k=o-a,v>k){if(k=v-k,k>f&&r.sane){e.msg="invalid distance too far back",r.mode=dp;break e}if(_=0,C=d,h===0){if(_+=u-k,k<E){E-=k;do P[o++]=d[_++];while(--k);_=o-v,C=P}}else if(h<k){if(_+=u+h-k,k-=h,k<E){E-=k;do P[o++]=d[_++];while(--k);if(_=0,h<E){k=h,E-=k;do P[o++]=d[_++];while(--k);_=o-v,C=P}}}else if(_+=h-k,k<E){E-=k;do P[o++]=d[_++];while(--k);_=o-v,C=P}for(;E>2;)P[o++]=C[_++],P[o++]=C[_++],P[o++]=C[_++],E-=3;E&&(P[o++]=C[_++],E>1&&(P[o++]=C[_++]))}else{_=o-v;do P[o++]=P[_++],P[o++]=P[_++],P[o++]=P[_++],E-=3;while(E>2);E&&(P[o++]=P[_++],E>1&&(P[o++]=P[_++]))}}else if((k&64)===0){D=w[(D&65535)+(p&(1<<k)-1)];continue n}else{e.msg="invalid distance code",r.mode=dp;break e}break}}else if((k&64)===0){D=y[(D&65535)+(p&(1<<k)-1)];continue t}else if(k&32){r.mode=xH;break e}else{e.msg="invalid literal/length code",r.mode=dp;break e}break}}while(i<s&&o<l);E=g>>3,i-=E,g-=E<<3,p&=(1<<g)-1,e.next_in=i,e.next_out=o,e.avail_in=i<s?5+(s-i):5-(i-s),e.avail_out=o<l?257+(l-o):257-(o-l),r.hold=p,r.bits=g}});var p2=W((_me,m2)=>{"use strict";m();var c2=is(),sc=15,u2=852,f2=592,h2=0,cv=1,d2=2,SH=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],DH=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],EH=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],_H=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];m2.exports=function(e,n,r,i,s,o,a,l){var c=l.bits,u=0,f=0,h=0,d=0,p=0,g=0,y=0,w=0,b=0,S=0,D,k,E,v,_,C=null,A=0,P,N=new c2.Buf16(sc+1),B=new c2.Buf16(sc+1),L=null,G=0,U,he,Te;for(u=0;u<=sc;u++)N[u]=0;for(f=0;f<i;f++)N[n[r+f]]++;for(p=c,d=sc;d>=1&&N[d]===0;d--);if(p>d&&(p=d),d===0)return s[o++]=1<<24|64<<16|0,s[o++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h<d&&N[h]===0;h++);for(p<h&&(p=h),w=1,u=1;u<=sc;u++)if(w<<=1,w-=N[u],w<0)return-1;if(w>0&&(e===h2||d!==1))return-1;for(B[1]=0,u=1;u<sc;u++)B[u+1]=B[u]+N[u];for(f=0;f<i;f++)n[r+f]!==0&&(a[B[n[r+f]]++]=f);if(e===h2?(C=L=a,P=19):e===cv?(C=SH,A-=257,L=DH,G-=257,P=256):(C=EH,L=_H,P=-1),S=0,f=0,u=h,_=o,g=p,y=0,E=-1,b=1<<p,v=b-1,e===cv&&b>u2||e===d2&&b>f2)return 1;for(;;){U=u-y,a[f]<P?(he=0,Te=a[f]):a[f]>P?(he=L[G+a[f]],Te=C[A+a[f]]):(he=96,Te=0),D=1<<u-y,k=1<<g,h=k;do k-=D,s[_+(S>>y)+k]=U<<24|he<<16|Te|0;while(k!==0);for(D=1<<u-1;S&D;)D>>=1;if(D!==0?(S&=D-1,S+=D):S=0,f++,--N[u]===0){if(u===d)break;u=n[r+a[f]]}if(u>p&&(S&v)!==E){for(y===0&&(y=p),_+=h,g=u-y,w=1<<g;g+y<d&&(w-=N[g+y],!(w<=0));)g++,w<<=1;if(b+=1<<g,e===cv&&b>u2||e===d2&&b>f2)return 1;E=S&v,s[E]=p<<24|g<<16|_-o|0}}return S!==0&&(s[_+S]=u-y<<24|64<<16|0),l.bits=p,0}});var Z2=W(ri=>{"use strict";m();var or=is(),pv=Yb(),Fi=Jb(),CH=l2(),Nf=p2(),TH=0,U2=1,j2=2,g2=4,FH=5,mp=6,ga=0,IH=1,AH=2,Or=-2,q2=-3,gv=-4,OH=-5,y2=8,V2=1,w2=2,b2=3,v2=4,k2=5,x2=6,S2=7,D2=8,E2=9,_2=10,yp=11,as=12,uv=13,C2=14,fv=15,T2=16,F2=17,I2=18,A2=19,pp=20,gp=21,O2=22,P2=23,N2=24,M2=25,R2=26,hv=27,z2=28,L2=29,ut=30,yv=31,PH=32,NH=852,MH=592,RH=15,zH=RH;function B2(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function LH(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new or.Buf16(320),this.work=new or.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function H2(t){var e;return!t||!t.state?Or:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=V2,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new or.Buf32(NH),e.distcode=e.distdyn=new or.Buf32(MH),e.sane=1,e.back=-1,ga)}function W2(t){var e;return!t||!t.state?Or:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,H2(t))}function G2(t,e){var n,r;return!t||!t.state||(r=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Or:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,W2(t))}function Q2(t,e){var n,r;return t?(r=new LH,t.state=r,r.window=null,n=G2(t,e),n!==ga&&(t.state=null),n):Or}function BH(t){return Q2(t,zH)}var $2=!0,dv,mv;function $H(t){if($2){var e;for(dv=new or.Buf32(512),mv=new or.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Nf(U2,t.lens,0,288,dv,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Nf(j2,t.lens,0,32,mv,0,t.work,{bits:5}),$2=!1}t.lencode=dv,t.lenbits=9,t.distcode=mv,t.distbits=5}function K2(t,e,n,r){var i,s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new or.Buf8(s.wsize)),r>=s.wsize?(or.arraySet(s.window,e,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),or.arraySet(s.window,e,n-r,i,s.wnext),r-=i,r?(or.arraySet(s.window,e,n-r,r,0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}function UH(t,e){var n,r,i,s,o,a,l,c,u,f,h,d,p,g,y=0,w,b,S,D,k,E,v,_,C=new or.Buf8(4),A,P,N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&t.avail_in!==0)return Or;n=t.state,n.mode===as&&(n.mode=uv),o=t.next_out,i=t.output,l=t.avail_out,s=t.next_in,r=t.input,a=t.avail_in,c=n.hold,u=n.bits,f=a,h=l,_=ga;e:for(;;)switch(n.mode){case V2:if(n.wrap===0){n.mode=uv;break}for(;u<16;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(n.wrap&2&&c===35615){n.check=0,C[0]=c&255,C[1]=c>>>8&255,n.check=Fi(n.check,C,2,0),c=0,u=0,n.mode=w2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=ut;break}if((c&15)!==y2){t.msg="unknown compression method",n.mode=ut;break}if(c>>>=4,u-=4,v=(c&15)+8,n.wbits===0)n.wbits=v;else if(v>n.wbits){t.msg="invalid window size",n.mode=ut;break}n.dmax=1<<v,t.adler=n.check=1,n.mode=c&512?_2:as,c=0,u=0;break;case w2:for(;u<16;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(n.flags=c,(n.flags&255)!==y2){t.msg="unknown compression method",n.mode=ut;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=ut;break}n.head&&(n.head.text=c>>8&1),n.flags&512&&(C[0]=c&255,C[1]=c>>>8&255,n.check=Fi(n.check,C,2,0)),c=0,u=0,n.mode=b2;case b2:for(;u<32;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}n.head&&(n.head.time=c),n.flags&512&&(C[0]=c&255,C[1]=c>>>8&255,C[2]=c>>>16&255,C[3]=c>>>24&255,n.check=Fi(n.check,C,4,0)),c=0,u=0,n.mode=v2;case v2:for(;u<16;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}n.head&&(n.head.xflags=c&255,n.head.os=c>>8),n.flags&512&&(C[0]=c&255,C[1]=c>>>8&255,n.check=Fi(n.check,C,2,0)),c=0,u=0,n.mode=k2;case k2:if(n.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}n.length=c,n.head&&(n.head.extra_len=c),n.flags&512&&(C[0]=c&255,C[1]=c>>>8&255,n.check=Fi(n.check,C,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=x2;case x2:if(n.flags&1024&&(d=n.length,d>a&&(d=a),d&&(n.head&&(v=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),or.arraySet(n.head.extra,r,s,d,v)),n.flags&512&&(n.check=Fi(n.check,r,d,s)),a-=d,s+=d,n.length-=d),n.length))break e;n.length=0,n.mode=S2;case S2:if(n.flags&2048){if(a===0)break e;d=0;do v=r[s+d++],n.head&&v&&n.length<65536&&(n.head.name+=String.fromCharCode(v));while(v&&d<a);if(n.flags&512&&(n.check=Fi(n.check,r,d,s)),a-=d,s+=d,v)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=D2;case D2:if(n.flags&4096){if(a===0)break e;d=0;do v=r[s+d++],n.head&&v&&n.length<65536&&(n.head.comment+=String.fromCharCode(v));while(v&&d<a);if(n.flags&512&&(n.check=Fi(n.check,r,d,s)),a-=d,s+=d,v)break e}else n.head&&(n.head.comment=null);n.mode=E2;case E2:if(n.flags&512){for(;u<16;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(c!==(n.check&65535)){t.msg="header crc mismatch",n.mode=ut;break}c=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=as;break;case _2:for(;u<32;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}t.adler=n.check=B2(c),c=0,u=0,n.mode=yp;case yp:if(n.havedict===0)return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,n.hold=c,n.bits=u,AH;t.adler=n.check=1,n.mode=as;case as:if(e===FH||e===mp)break e;case uv:if(n.last){c>>>=u&7,u-=u&7,n.mode=hv;break}for(;u<3;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}switch(n.last=c&1,c>>>=1,u-=1,c&3){case 0:n.mode=C2;break;case 1:if($H(n),n.mode=pp,e===mp){c>>>=2,u-=2;break e}break;case 2:n.mode=F2;break;case 3:t.msg="invalid block type",n.mode=ut}c>>>=2,u-=2;break;case C2:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",n.mode=ut;break}if(n.length=c&65535,c=0,u=0,n.mode=fv,e===mp)break e;case fv:n.mode=T2;case T2:if(d=n.length,d){if(d>a&&(d=a),d>l&&(d=l),d===0)break e;or.arraySet(i,r,s,d,o),a-=d,s+=d,l-=d,o+=d,n.length-=d;break}n.mode=as;break;case F2:for(;u<14;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(n.nlen=(c&31)+257,c>>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=ut;break}n.have=0,n.mode=I2;case I2:for(;n.have<n.ncode;){for(;u<3;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}n.lens[N[n.have++]]=c&7,c>>>=3,u-=3}for(;n.have<19;)n.lens[N[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},_=Nf(TH,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,_){t.msg="invalid code lengths set",n.mode=ut;break}n.have=0,n.mode=A2;case A2:for(;n.have<n.nlen+n.ndist;){for(;y=n.lencode[c&(1<<n.lenbits)-1],w=y>>>24,b=y>>>16&255,S=y&65535,!(w<=u);){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(S<16)c>>>=w,u-=w,n.lens[n.have++]=S;else{if(S===16){for(P=w+2;u<P;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(c>>>=w,u-=w,n.have===0){t.msg="invalid bit length repeat",n.mode=ut;break}v=n.lens[n.have-1],d=3+(c&3),c>>>=2,u-=2}else if(S===17){for(P=w+3;u<P;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}c>>>=w,u-=w,v=0,d=3+(c&7),c>>>=3,u-=3}else{for(P=w+7;u<P;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}c>>>=w,u-=w,v=0,d=11+(c&127),c>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=ut;break}for(;d--;)n.lens[n.have++]=v}}if(n.mode===ut)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=ut;break}if(n.lenbits=9,A={bits:n.lenbits},_=Nf(U2,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,_){t.msg="invalid literal/lengths set",n.mode=ut;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},_=Nf(j2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,_){t.msg="invalid distances set",n.mode=ut;break}if(n.mode=pp,e===mp)break e;case pp:n.mode=gp;case gp:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,n.hold=c,n.bits=u,CH(t,h),o=t.next_out,i=t.output,l=t.avail_out,s=t.next_in,r=t.input,a=t.avail_in,c=n.hold,u=n.bits,n.mode===as&&(n.back=-1);break}for(n.back=0;y=n.lencode[c&(1<<n.lenbits)-1],w=y>>>24,b=y>>>16&255,S=y&65535,!(w<=u);){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(b&&(b&240)===0){for(D=w,k=b,E=S;y=n.lencode[E+((c&(1<<D+k)-1)>>D)],w=y>>>24,b=y>>>16&255,S=y&65535,!(D+w<=u);){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}c>>>=D,u-=D,n.back+=D}if(c>>>=w,u-=w,n.back+=w,n.length=S,b===0){n.mode=R2;break}if(b&32){n.back=-1,n.mode=as;break}if(b&64){t.msg="invalid literal/length code",n.mode=ut;break}n.extra=b&15,n.mode=O2;case O2:if(n.extra){for(P=n.extra;u<P;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=P2;case P2:for(;y=n.distcode[c&(1<<n.distbits)-1],w=y>>>24,b=y>>>16&255,S=y&65535,!(w<=u);){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if((b&240)===0){for(D=w,k=b,E=S;y=n.distcode[E+((c&(1<<D+k)-1)>>D)],w=y>>>24,b=y>>>16&255,S=y&65535,!(D+w<=u);){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}c>>>=D,u-=D,n.back+=D}if(c>>>=w,u-=w,n.back+=w,b&64){t.msg="invalid distance code",n.mode=ut;break}n.offset=S,n.extra=b&15,n.mode=N2;case N2:if(n.extra){for(P=n.extra;u<P;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=ut;break}n.mode=M2;case M2:if(l===0)break e;if(d=h-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=ut;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=o-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[o++]=g[p++];while(--d);n.length===0&&(n.mode=gp);break;case R2:if(l===0)break e;i[o++]=n.length,l--,n.mode=gp;break;case hv:if(n.wrap){for(;u<32;){if(a===0)break e;a--,c|=r[s++]<<u,u+=8}if(h-=l,t.total_out+=h,n.total+=h,h&&(t.adler=n.check=n.flags?Fi(n.check,i,h,o-h):pv(n.check,i,h,o-h)),h=l,(n.flags?c:B2(c))!==n.check){t.msg="incorrect data check",n.mode=ut;break}c=0,u=0}n.mode=z2;case z2:if(n.wrap&&n.flags){for(;u<32;){if(a===0)break e;a--,c+=r[s++]<<u,u+=8}if(c!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=ut;break}c=0,u=0}n.mode=L2;case L2:_=IH;break e;case ut:_=q2;break e;case yv:return gv;case PH:default:return Or}return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,n.hold=c,n.bits=u,(n.wsize||h!==t.avail_out&&n.mode<ut&&(n.mode<hv||e!==g2))&&K2(t,t.output,t.next_out,h-t.avail_out)?(n.mode=yv,gv):(f-=t.avail_in,h-=t.avail_out,t.total_in+=f,t.total_out+=h,n.total+=h,n.wrap&&h&&(t.adler=n.check=n.flags?Fi(n.check,i,h,t.next_out-h):pv(n.check,i,h,t.next_out-h)),t.data_type=n.bits+(n.last?64:0)+(n.mode===as?128:0)+(n.mode===pp||n.mode===fv?256:0),(f===0&&h===0||e===g2)&&_===ga&&(_=OH),_)}function jH(t){if(!t||!t.state)return Or;var e=t.state;return e.window&&(e.window=null),t.state=null,ga}function qH(t,e){var n;return!t||!t.state||(n=t.state,(n.wrap&2)===0)?Or:(n.head=e,e.done=!1,ga)}function VH(t,e){var n=e.length,r,i,s;return!t||!t.state||(r=t.state,r.wrap!==0&&r.mode!==yp)?Or:r.mode===yp&&(i=1,i=pv(i,e,n,0),i!==r.check)?q2:(s=K2(t,e,n,n),s?(r.mode=yv,gv):(r.havedict=1,ga))}ri.inflateReset=W2;ri.inflateReset2=G2;ri.inflateResetKeep=H2;ri.inflateInit=BH;ri.inflateInit2=Q2;ri.inflate=UH;ri.inflateEnd=jH;ri.inflateGetHeader=qH;ri.inflateSetDictionary=VH;ri.inflateInfo="pako inflate (from Nodeca project)"});var wv=W((Ime,Y2)=>{"use strict";m();Y2.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var X2=W((Ome,J2)=>{"use strict";m();function HH(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}J2.exports=HH});var tA=W(Rf=>{"use strict";m();var oc=Z2(),Mf=is(),wp=rv(),Ct=wv(),bv=sp(),WH=iv(),GH=X2(),eA=Object.prototype.toString;function ya(t){if(!(this instanceof ya))return new ya(t);this.options=Mf.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new WH,this.strm.avail_out=0;var n=oc.inflateInit2(this.strm,e.windowBits);if(n!==Ct.Z_OK)throw new Error(bv[n]);if(this.header=new GH,oc.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=wp.string2buf(e.dictionary):eA.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=oc.inflateSetDictionary(this.strm,e.dictionary),n!==Ct.Z_OK)))throw new Error(bv[n])}ya.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,s,o,a,l,c,u=!1;if(this.ended)return!1;o=e===~~e?e:e===!0?Ct.Z_FINISH:Ct.Z_NO_FLUSH,typeof t=="string"?n.input=wp.binstring2buf(t):eA.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Mf.Buf8(r),n.next_out=0,n.avail_out=r),s=oc.inflate(n,Ct.Z_NO_FLUSH),s===Ct.Z_NEED_DICT&&i&&(s=oc.inflateSetDictionary(this.strm,i)),s===Ct.Z_BUF_ERROR&&u===!0&&(s=Ct.Z_OK,u=!1),s!==Ct.Z_STREAM_END&&s!==Ct.Z_OK)return this.onEnd(s),this.ended=!0,!1;n.next_out&&(n.avail_out===0||s===Ct.Z_STREAM_END||n.avail_in===0&&(o===Ct.Z_FINISH||o===Ct.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=wp.utf8border(n.output,n.next_out),l=n.next_out-a,c=wp.buf2string(n.output,a),n.next_out=l,n.avail_out=r-l,l&&Mf.arraySet(n.output,n.output,a,l,0),this.onData(c)):this.onData(Mf.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(u=!0)}while((n.avail_in>0||n.avail_out===0)&&s!==Ct.Z_STREAM_END);return s===Ct.Z_STREAM_END&&(o=Ct.Z_FINISH),o===Ct.Z_FINISH?(s=oc.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Ct.Z_OK):(o===Ct.Z_SYNC_FLUSH&&(this.onEnd(Ct.Z_OK),n.avail_out=0),!0)};ya.prototype.onData=function(t){this.chunks.push(t)};ya.prototype.onEnd=function(t){t===Ct.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Mf.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function vv(t,e){var n=new ya(e);if(n.push(t,!0),n.err)throw n.msg||bv[n.err];return n.result}function QH(t,e){return e=e||{},e.raw=!0,vv(t,e)}Rf.Inflate=ya;Rf.inflate=vv;Rf.inflateRaw=QH;Rf.ungzip=vv});var iA=W((Rme,rA)=>{"use strict";m();var KH=is().assign,ZH=o2(),YH=tA(),JH=wv(),nA={};KH(nA,ZH,YH,JH);rA.exports=nA});var aA=W((Lme,oA)=>{"use strict";m();var sA=(t,e)=>function(...n){let r=e.promiseModule;return new r((i,s)=>{e.multiArgs?n.push((...o)=>{e.errorFirst?o[0]?s(o):(o.shift(),i(o)):i(o)}):e.errorFirst?n.push((o,a)=>{o?s(o):i(a)}):n.push(i),t.apply(this,n)})};oA.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let n=typeof t;if(!(t!==null&&(n==="object"||n==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":n}\``);let r=s=>{let o=a=>typeof a=="string"?s===a:a.test(s);return e.include?e.include.some(o):!e.exclude.some(o)},i;n==="function"?i=function(...s){return e.excludeMain?t(...s):sA(t,e).apply(this,s)}:i=Object.create(Object.getPrototypeOf(t));for(let s in t){let o=t[s];i[s]=typeof o=="function"&&r(s)?sA(o,e):o}return i}});var gA=W(($me,pA)=>{m();function lA(t){return Array.isArray(t)?t:[t]}var Sv="",cA=" ",kv="\\",XH=/^\s+$/,eW=/(?:[^\\]|^)\\$/,tW=/^\\!/,nW=/^\\#/,rW=/\r?\n/g,iW=/^\.*\/|^\.+$/,xv="/",hA="node-ignore";typeof Symbol<"u"&&(hA=Symbol.for("node-ignore"));var uA=hA,sW=(t,e,n)=>Object.defineProperty(t,e,{value:n}),oW=/([0-z])-([0-z])/g,dA=()=>!1,aW=t=>t.replace(oW,(e,n,r)=>n.charCodeAt(0)<=r.charCodeAt(0)?e:Sv),lW=t=>{let{length:e}=t;return t.slice(0,e-e%2)},cW=[[/^\uFEFF/,()=>Sv],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,n)=>e+(n.indexOf("\\")===0?cA:Sv)],[/(\\+?)\s/g,(t,e)=>{let{length:n}=e;return e.slice(0,n-n%2)+cA}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,n)=>e+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,n)=>{let r=n.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>kv],[/\\\\/g,()=>kv],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,n,r,i)=>e===kv?`\\[${n}${lW(r)}${i}`:i==="]"&&r.length%2===0?`[${aW(n)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],fA=Object.create(null),uW=(t,e)=>{let n=fA[t];return n||(n=cW.reduce((r,[i,s])=>r.replace(i,s.bind(t)),t),fA[t]=n),e?new RegExp(n,"i"):new RegExp(n)},_v=t=>typeof t=="string",fW=t=>t&&_v(t)&&!XH.test(t)&&!eW.test(t)&&t.indexOf("#")!==0,hW=t=>t.split(rW),Dv=class{constructor(e,n,r,i){this.origin=e,this.pattern=n,this.negative=r,this.regex=i}},dW=(t,e)=>{let n=t,r=!1;t.indexOf("!")===0&&(r=!0,t=t.substr(1)),t=t.replace(tW,"!").replace(nW,"#");let i=uW(t,e);return new Dv(n,t,r,i)},mW=(t,e)=>{throw new e(t)},ls=(t,e,n)=>_v(t)?t?ls.isNotRelative(t)?n(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${e}\``,TypeError),mA=t=>iW.test(t);ls.isNotRelative=mA;ls.convert=t=>t;var Ev=class{constructor({ignorecase:e=!0,ignoreCase:n=e,allowRelativePaths:r=!1}={}){sW(this,uA,!0),this._rules=[],this._ignoreCase=n,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[uA]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(fW(e)){let n=dW(e,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(e){return this._added=!1,lA(_v(e)?hW(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,n){let r=!1,i=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(i===o&&r!==i||o&&!r&&!i&&!n)return;s.regex.test(e)&&(r=!o,i=o)}),{ignored:r,unignored:i}}_test(e,n,r,i){let s=e&&ls.convert(e);return ls(s,e,this._allowRelativePaths?dA:mW),this._t(s,n,r,i)}_t(e,n,r,i){if(e in n)return n[e];if(i||(i=e.split(xv)),i.pop(),!i.length)return n[e]=this._testOne(e,r);let s=this._t(i.join(xv)+xv,n,r,i);return n[e]=s.ignored?s:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return lA(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},bp=t=>new Ev(t),pW=t=>ls(t&&ls.convert(t),t,dA);bp.isPathValid=pW;bp.default=bp;pA.exports=bp;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");ls.convert=t;let e=/^[a-z]:\//i;ls.isNotRelative=n=>e.test(n)||mA(n)}});var wA=W((jme,yA)=>{"use strict";m();function gW(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ii(t,e,n){return e=e instanceof RegExp?e:new RegExp(gW(e),"g"),t.replace(e,n)}var yW={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Ii(e,"./","/"),e=Ii(e,"..","."),e=Ii(e," ","-"),e=Ii(e,/^[~^:?*\\\-]/g,""),e=Ii(e,/[~^:?*\\]/g,"-"),e=Ii(e,/[~^:?*\\\-]$/g,""),e=Ii(e,"@{","-"),e=Ii(e,/\.$/g,""),e=Ii(e,/\/$/g,""),e=Ii(e,/\.lock$/g,""),e}};yA.exports=yW});var vA=W((Vme,bA)=>{m();bA.exports=function(t,e){var n=t,r=e,i=n.length,s=r.length,o=!1,a=null,l=i+1,c=[],u=[],f=[],h="",d=-1,p=0,g=1,y,w,b=function(){i>=s&&(y=n,w=i,n=r,r=y,i=s,s=w,o=!0,l=i+1)},S=function(v,_,C){return{x:v,y:_,k:C}},D=function(v,_){return{elem:v,t:_}},k=function(v,_,C){var A,P,N;for(_>C?A=c[v-1+l]:A=c[v+1+l],N=Math.max(_,C),P=N-v;P<i&&N<s&&n[P]===r[N];)++P,++N;return c[v+l]=u.length,u[u.length]=new S(P,N,A),N},E=function(v){var _,C,A,P,N;for(_=C=1,A=P=0,N=v.length-1;N>=0;--N)for(;A<v[N].x||P<v[N].y;)v[N].y-v[N].x>P-A?(o?f[f.length]=new D(r[P],d):f[f.length]=new D(r[P],g),++C,++P):v[N].y-v[N].x<P-A?(o?f[f.length]=new D(n[A],g):f[f.length]=new D(n[A],d),++_,++A):(f[f.length]=new D(n[A],p),h+=n[A],++_,++C,++A,++P)};return b(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return a},getlcs:function(){return h},getses:function(){return f},compose:function(){var v,_,C,A,P,N,B,L;for(v=s-i,_=i+s+3,C={},B=0;B<_;++B)C[B]=-1,c[B]=-1;A=-1;do{for(++A,L=-A;L<=v-1;++L)C[L+l]=k(L,C[L-1+l]+1,C[L+1+l]);for(L=v+A;L>=v+1;--L)C[L+l]=k(L,C[L-1+l]+1,C[L+1+l]);C[v+l]=k(v,C[v-1+l]+1,C[v+1+l])}while(C[v+l]!==s);for(a=v+2*A,P=c[v+l],N=[];P!==-1;)N[N.length]=new S(u[P].x,u[P].y,null),P=u[P].k;E(N)}}}});var SA=W((Wme,xA)=>{m();var wW=vA();function bW(t,e){var n=new wW(t,e);n.compose();for(var r=n.getses(),i,s,o=t.length-1,a=e.length-1,l=r.length-1;l>=0;--l)r[l].t===n.SES_COMMON?(s?(s.chain={file1index:o,file2index:a,chain:null},s=s.chain):(i={file1index:o,file2index:a,chain:null},s=i),o--,a--):r[l].t===n.SES_DELETE?o--:r[l].t===n.SES_ADD&&a--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,i):c}function kA(t,e){for(var n=[],r=t.length,i=e.length,s=bW(t,e);s!==null;s=s.chain){var o=r-s.file1index-1,a=i-s.file2index-1;r=s.file1index,i=s.file2index,(o||a)&&n.push({file1:[r+1,o],file2:[i+1,a]})}return n.reverse(),n}function vW(t,e,n){var r,i=kA(e,t),s=kA(e,n),o=[];function a(B,L){o.push([B.file1[0],L,B.file1[1],B.file2[0],B.file2[1]])}for(r=0;r<i.length;r++)a(i[r],0);for(r=0;r<s.length;r++)a(s[r],2);o.sort(function(B,L){return B[0]-L[0]});var l=[],c=0;function u(B){B>c&&(l.push([1,c,B-c]),c=B)}for(var f=0;f<o.length;f++){for(var h=f,d=o[f],p=d[0],g=p+d[2];f<o.length-1;){var y=o[f+1],w=y[0];if(w>g)break;g=Math.max(g,w+y[2]),f++}if(u(p),h==f)d[4]>0&&l.push([d[1],d[3],d[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[n.length,-1,e.length,-1]};for(r=h;r<=f;r++){d=o[r];var S=d[1],D=b[S],k=d[0],E=k+d[2],v=d[3],_=v+d[4];D[0]=Math.min(v,D[0]),D[1]=Math.max(_,D[1]),D[2]=Math.min(k,D[2]),D[3]=Math.max(E,D[3])}var C=b[0][0]+(p-b[0][2]),A=b[0][1]+(g-b[0][3]),P=b[2][0]+(p-b[2][2]),N=b[2][1]+(g-b[2][3]);l.push([-1,C,A-C,p,g-p,P,N-P])}c=g}return u(e.length),l}function kW(t,e,n){var r=[],i=[t,e,n],s=vW(t,e,n),o=[];function a(){o.length&&r.push({ok:o}),o=[]}function l(d){for(var p=0;p<d.length;p++)o.push(d[p])}function c(d){if(d[2]!=d[6])return!0;for(var p=d[1],g=d[5],y=0;y<d[2];y++)if(t[y+p]!=n[y+g])return!0;return!1}for(var u=0;u<s.length;u++){var f=s[u],h=f[0];h==-1?c(f)?(a(),r.push({conflict:{a:t.slice(f[1],f[1]+f[2]),aIndex:f[1],o:e.slice(f[3],f[3]+f[4]),oIndex:f[3],b:n.slice(f[5],f[5]+f[6]),bIndex:f[5]}})):l(i[0].slice(f[1],f[1]+f[2])):l(i[h].slice(f[1],f[1]+f[2]))}return a(),r}xA.exports=kW});var UP=W(oe=>{"use strict";m();Object.defineProperty(oe,"__esModule",{value:!0});function ro(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Lf=ro(JC()),WA=ro(pI()),xW=ro(yI()),Yv=ro(iA()),vp=ro(aA()),SW=ro(gA()),Bf=ro(wA()),DW=ro(SA()),je=class t extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let n=new t(e.message);return n.code=e.code,n.data=e.data,n.caller=e.caller,n.stack=e.stack,n}get isIsomorphicGitError(){return!0}},$f=class t extends je{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=t.code,this.data={filepaths:e}}};$f.code="UnmergedPathsError";var Ce=class t extends je{constructor(e){super(`An internal error caused this command to fail.
|
||
|
||
If you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.
|
||
|
||
Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};Ce.code="InternalError";var lc=class t extends je{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};lc.code="UnsafeFilepathError";var Pr=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let n=this.buffer.slice(this._start,this._start+e);return this._start+=e,n}toString(e,n){let r=this.buffer.toString(e,this._start,this._start+n);return this._start+=n,r}write(e,n,r){let i=this.buffer.write(e,this._start,n,r);return this._start+=n,i}copy(e,n,r){let i=e.copy(this.buffer,this._start,n,r);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let n=this.buffer.writeUInt8(e,this._start);return this._start+=1,n}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let n=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,n}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let n=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,n}};function Pp(t,e){return-(t<e)||+(t>e)}function GA(t,e){return Pp(t.path,e.path)}function QA(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let n=t&511;return n&73?n=493:n=420,e!==8&&(n=0),(e<<12)+n}var Ai=2**32;function DA(t,e,n,r){if(t!==void 0&&e!==void 0)return[t,e];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3),s=(n-i*1e3)*1e6;return[i,s]}function cc(t){let[e,n]=DA(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[r,i]=DA(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%Ai,ctimeNanoseconds:n%Ai,mtimeSeconds:r%Ai,mtimeNanoseconds:i%Ai,dev:t.dev%Ai,ino:t.ino%Ai,mode:QA(t.mode%Ai),uid:t.uid%Ai,gid:t.gid%Ai,size:t.size>-1?t.size%Ai:0}}function EW(t){let e="";for(let n of new Uint8Array(t))n<16&&(e+="0"),e+=n.toString(16);return e}var Cv=null;async function us(t){return Cv===null&&(Cv=await CW()),Cv?KA(t):_W(t)}function _W(t){return new WA().update(t).digest("hex")}async function KA(t){let e=await crypto.subtle.digest("SHA-1",t);return EW(e)}async function CW(){try{return await KA(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch{}return!1}function TW(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function FW(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(x.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Bv=class t{constructor(e,n){this._dirty=!1,this._unmergedPaths=n||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let n=this._entries.get(e.path);n||(this._entries.set(e.path,e),n=e),n.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(x.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new Ce("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new Ce("Index file is empty (.git/index)");let n=new t,r=new Pr(e),i=r.toString("utf8",4);if(i!=="DIRC")throw new Ce(`Invalid dircache magic file number: ${i}`);let s=await us(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new Ce(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let a=r.readUInt32BE();if(a!==2)throw new Ce(`Unsupported dircache version: ${a}`);let l=r.readUInt32BE(),c=0;for(;!r.eof()&&c<l;){let u={};u.ctimeSeconds=r.readUInt32BE(),u.ctimeNanoseconds=r.readUInt32BE(),u.mtimeSeconds=r.readUInt32BE(),u.mtimeNanoseconds=r.readUInt32BE(),u.dev=r.readUInt32BE(),u.ino=r.readUInt32BE(),u.mode=r.readUInt32BE(),u.uid=r.readUInt32BE(),u.gid=r.readUInt32BE(),u.size=r.readUInt32BE(),u.oid=r.slice(20).toString("hex");let f=r.readUInt16BE();u.flags=TW(f);let h=e.indexOf(0,r.tell()+1)-r.tell();if(h<1)throw new Ce(`Got a path length of: ${h}`);if(u.path=r.toString("utf8",h),u.path.includes("..\\")||u.path.includes("../"))throw new lc(u.path);let d=8-(r.tell()-12)%8;for(d===0&&(d=8);d--;){let p=r.readUInt8();if(p!==0)throw new Ce(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(r.eof())throw new Ce("Unexpected end of file")}u.stages=[],n._addEntry(u),c++}return n}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(GA)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(n=>n):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:n,oid:r,stage:i=0}){n||(n={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),n=cc(n);let s=x.from(e),o={ctimeSeconds:n.ctimeSeconds,ctimeNanoseconds:n.ctimeNanoseconds,mtimeSeconds:n.mtimeSeconds,mtimeNanoseconds:n.mtimeNanoseconds,dev:n.dev,ino:n.ino,mode:n.mode||33188,uid:n.uid,gid:n.gid,size:n.size,path:e,oid:r,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(o),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let n of this._entries.keys())n.startsWith(e+"/")&&this._entries.delete(n);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
|
||
`)}static async _entryToBuffer(e){let n=x.from(e.path),r=Math.ceil((62+n.length+1)/8)*8,i=x.alloc(r),s=new Pr(i),o=cc(e);return s.writeUInt32BE(o.ctimeSeconds),s.writeUInt32BE(o.ctimeNanoseconds),s.writeUInt32BE(o.mtimeSeconds),s.writeUInt32BE(o.mtimeNanoseconds),s.writeUInt32BE(o.dev),s.writeUInt32BE(o.ino),s.writeUInt32BE(o.mode),s.writeUInt32BE(o.uid),s.writeUInt32BE(o.gid),s.writeUInt32BE(o.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(FW(e)),s.write(e.path,n.length,"utf8"),i}async toObject(){let e=x.alloc(12),n=new Pr(e);n.write("DIRC",4,"utf8"),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let r=[];for(let a of this.entries)if(r.push(t._entryToBuffer(a)),a.stages.length>1)for(let l of a.stages)l&&l!==a&&r.push(t._entryToBuffer(l));r=await Promise.all(r);let i=x.concat(r),s=x.concat([e,i]),o=await us(s);return x.concat([s,x.from(o,"hex")])}};function Sp(t,e,n=!0,r=!0){let i=cc(t),s=cc(e);return n&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.ctimeSeconds!==s.ctimeSeconds||i.uid!==s.uid||i.gid!==s.gid||r&&i.ino!==s.ino||i.size!==s.size}var Tv=null,Fv=Symbol("IndexCache");function IW(){return{map:new Map,stats:new Map}}async function AW(t,e,n){let[r,i]=await Promise.all([t.lstat(e),t.read(e)]),s=await Bv.from(i);n.map.set(e,s),n.stats.set(e,r)}async function OW(t,e,n){let r=n.stats.get(e);if(r===void 0)return!0;if(r===null)return!1;let i=await t.lstat(e);return i===null?!1:Sp(r,i)}var Tt=class{static async acquire({fs:e,gitdir:n,cache:r,allowUnmerged:i=!0},s){r[Fv]||(r[Fv]=IW());let o=`${n}/index`;Tv===null&&(Tv=new Lf({maxPending:1/0}));let a,l=[];return await Tv.acquire(o,async()=>{let c=r[Fv];await OW(e,o,c)&&await AW(e,o,c);let u=c.map.get(o);if(l=u.unmergedPaths,l.length&&!i)throw new $f(l);if(a=await s(u),u._dirty){let f=await u.toObject();await e.write(o,f),c.stats.set(o,await e.lstat(o)),u._dirty=!1}}),a}};function Dp(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function va(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function ZA(t){let e=new Map,n=function(i){if(!e.has(i)){let s={type:"tree",fullpath:i,basename:Dp(i),metadata:{},children:[]};e.set(i,s),s.parent=n(va(i)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(i)},r=function(i,s){if(!e.has(i)){let o={type:"blob",fullpath:i,basename:Dp(i),metadata:s,parent:n(va(i)),children:[]};o.parent&&o.parent.children.push(o),e.set(i,o)}return e.get(i)};n(".");for(let i of t)r(i.path,i);return e}function PW(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new Ce(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var $v=class{constructor({fs:e,gitdir:n,cache:r}){this.treePromise=Tt.acquire({fs:e,gitdir:n,cache:r},async function(s){return ZA(s.entries)});let i=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let n=e._fullpath,i=(await this.treePromise).get(n);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${n}'`);let s=i.children.map(o=>o.fullpath);return s.sort(Pp),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let r=(await this.treePromise).get(e._fullpath);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.type==="tree"?{}:cc(r.metadata);e._type=r.type==="tree"?"tree":PW(i.mode),e._mode=i.mode,r.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let r=(await this.treePromise).get(e._fullpath);e._oid=r.metadata.oid}return e._oid}},Np=Symbol("GitWalkSymbol");function Da(){let t=Object.create(null);return Object.defineProperty(t,Np,{value:function({fs:e,gitdir:n,cache:r}){return new $v({fs:e,gitdir:n,cache:r})}}),Object.freeze(t),t}var st=class t extends je{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};st.code="NotFoundError";var bn=class t extends je{constructor(e,n,r,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=t.code,this.data={oid:e,actual:n,expected:r,filepath:i}}};bn.code="ObjectTypeError";var Ys=class t extends je{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Ys.code="InvalidOidError";var Uf=class t extends je{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following:
|
||
[remote "${e}"]
|
||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||
`),this.code=this.name=t.code,this.data={remote:e}}};Uf.code="NoRefspecError";var Ep=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let n=null;this.parsedConfig=e.trim().split(`
|
||
`).map(r=>{if(/^\s*#/.test(r))return{line:r,comment:!0};let i=r.indexOf(" ");if(r.startsWith("^")){let s=r.slice(1);return this.refs.set(n+"^{}",s),{line:r,ref:n,peeled:s}}else{let s=r.slice(0,i);return n=r.slice(i+1),this.refs.set(n,s),{line:r,ref:n,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(n=>n.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
||
`)+`
|
||
`}},_p=class t{constructor({remotePath:e,localPath:n,force:r,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:n,force:r,matchPrefix:i})}static from(e){let[n,r,i,s,o]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),a=n==="+",l=i==="*";if(l!==(o==="*"))throw new Ce("Invalid refspec");return new t({remotePath:r,localPath:s,force:a,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},Uv=class t{constructor(e=[]){this.rules=e}static from(e){let n=[];for(let r of e)n.push(_p.from(r));return new t(n)}add(e){let n=_p.from(e);this.rules.push(n)}translate(e){let n=[];for(let r of this.rules)for(let i of e){let s=r.translate(i);s&&n.push([i,s])}return n}translateOne(e){let n=null;for(let r of this.rules){let i=r.translate(e);i&&(n=i)}return n}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function NW(t,e){let n=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),i=-(n<r)||+(n>r);return i===0?t.endsWith("^{}")?1:-1:i}function MW(t,e){let n="",r=0,i=-1,s=0,o="\0";for(let a=0;a<=t.length;++a){if(a<t.length)o=t[a];else{if(o==="/")break;o="/"}if(o==="/"){if(!(i===a-1||s===1))if(s===2){if(n.length<2||r!==2||n.at(-1)!=="."||n.at(-2)!=="."){if(n.length>2){let l=n.lastIndexOf("/");l===-1?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}else if(n.length!==0){n="",r=0,i=a,s=0;continue}}e&&(n+=n.length>0?"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,s=0}else o==="."&&s!==-1?++s:s=-1}return n}function RW(t){if(!t.length)return".";let e=t[0]==="/",n=t.at(-1)==="/";return t=MW(t,!e),t.length?(n&&(t+="/"),e?`/${t}`:t):e?"/":n?"./":"."}function V(...t){if(t.length===0)return".";let e;for(let n=0;n<t.length;++n){let r=t[n];r.length>0&&(e===void 0?e=r:e+="/"+r)}return e===void 0?".":RW(e)}var zW=t=>{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},zf=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},EA={core:{filemode:zf,bare:zf,logallrefupdates:zf,symlinks:zf,ignorecase:zf,bigFileThreshold:zW}},LW=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,BW=/^[A-Za-z0-9-.]+$/,$W=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,UW=/^[A-Za-z][A-Za-z-]*$/,jW=/^(.*?)( *[#;].*)$/,qW=t=>{let e=LW.exec(t);if(e!=null){let[n,r]=e.slice(1);return[n,r]}return null},VW=t=>{let e=$W.exec(t);if(e!=null){let[n,r="true"]=e.slice(1),i=HW(r),s=WW(i);return[n,s]}return null},HW=t=>{let e=jW.exec(t);if(e==null)return t;let[n,r]=e.slice(1);return _A(n)&&_A(r)?`${n}${r}`:n},_A=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,WW=t=>t.split("").reduce((e,n,r,i)=>{let s=n==='"'&&i[r-1]!=="\\",o=n==="\\"&&i[r+1]==='"';return s||o?e:e+n},""),CA=t=>t!=null?t.toLowerCase():null,jv=(t,e,n)=>[CA(t),e,CA(n)].filter(r=>r!=null).join("."),TA=t=>{let e=t.split("."),n=e.shift(),r=e.pop(),i=e.length?e.join("."):void 0;return{section:n,subsection:i,name:r,path:jv(n,i,r),sectionPath:jv(n,i,null),isSection:!!n}},GW=(t,e)=>t.reduce((n,r,i)=>e(r)?i:n,-1),qv=class t{constructor(e){let n=null,r=null;this.parsedConfig=e?e.split(`
|
||
`).map(i=>{let s=null,o=null,a=i.trim(),l=qW(a),c=l!=null;if(c)[n,r]=l;else{let f=VW(a);f!=null&&([s,o]=f)}let u=jv(n,r,s);return{line:i,isSection:c,section:n,subsection:r,name:s,value:o,path:u}}):[]}static from(e){return new t(e)}async get(e,n=!1){let r=TA(e).path,i=this.parsedConfig.filter(s=>s.path===r).map(({section:s,name:o,value:a})=>{let l=EA[s]&&EA[s][o];return l?l(a):a});return n?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(n=>n.isSection&&n.section===e).map(n=>n.subsection)}async deleteSection(e,n){this.parsedConfig=this.parsedConfig.filter(r=>!(r.section===e&&r.subsection===n))}async append(e,n){return this.set(e,n,!0)}async set(e,n,r=!1){let{section:i,subsection:s,name:o,path:a,sectionPath:l,isSection:c}=TA(e),u=GW(this.parsedConfig,f=>f.path===a);if(n==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],h=Object.assign({},f,{name:o,value:n,modified:!0});r?this.parsedConfig.splice(u+1,0,h):this.parsedConfig[u]=h}else{let f=this.parsedConfig.findIndex(d=>d.path===l),h={section:i,subsection:s,name:o,value:n,modified:!0,path:a};if(BW.test(i)&&UW.test(o))if(f>=0)this.parsedConfig.splice(f+1,0,h);else{let d={isSection:c,section:i,subsection:s,modified:!0,path:l};this.parsedConfig.push(d,h)}}}toString(){return this.parsedConfig.map(({line:e,section:n,subsection:r,name:i,value:s,modified:o=!1})=>o?i!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${i} = "${s}"`:` ${i} = ${s}`:r!=null?`[${n} "${r}"]`:`[${n}]`:e).join(`
|
||
`)}},Et=class{static async get({fs:e,gitdir:n}){let r=await e.read(`${n}/config`,{encoding:"utf8"});return qv.from(r)}static async save({fs:e,gitdir:n,config:r}){await e.write(`${n}/config`,r.toString(),{encoding:"utf8"})}},kp=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],QW=["config","description","index","shallow","commondir"],Iv;async function Ks(t,e){return Iv===void 0&&(Iv=new Lf),Iv.acquire(t,e)}var te=class t{static async updateRemoteRefs({fs:e,gitdir:n,remote:r,refs:i,symrefs:s,tags:o,refspecs:a=void 0,prune:l=!1,pruneTags:c=!1}){for(let y of i.values())if(!y.match(/[0-9a-f]{40}/))throw new Ys(y);let u=await Et.get({fs:e,gitdir:n});if(!a){if(a=await u.getall(`remote.${r}.fetch`),a.length===0)throw new Uf(r);a.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let f=Uv.from(a),h=new Map;if(c){let y=await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:n,refs:y.map(w=>`refs/tags/${w}`)})}if(o){for(let y of i.keys())if(y.startsWith("refs/tags")&&!y.endsWith("^{}")&&!await t.exists({fs:e,gitdir:n,ref:y})){let w=i.get(y);h.set(y,w)}}let d=f.translate([...i.keys()]);for(let[y,w]of d){let b=i.get(y);h.set(w,b)}let p=f.translate([...s.keys()]);for(let[y,w]of p){let b=s.get(y),S=f.translateOne(b);S&&h.set(w,`ref: ${S}`)}let g=[];if(l){for(let y of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:n,filepath:y})).map(b=>`${y}/${b}`);for(let b of w)h.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:n,refs:g})}for(let[y,w]of h)await Ks(y,async()=>e.write(V(n,y),`${w.trim()}
|
||
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:n,ref:r,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new Ys(i);await Ks(r,async()=>e.write(V(n,r),`${i.trim()}
|
||
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:n,ref:r,value:i}){await Ks(r,async()=>e.write(V(n,r),`ref: ${i.trim()}
|
||
`,"utf8"))}static async deleteRef({fs:e,gitdir:n,ref:r}){return t.deleteRefs({fs:e,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:n,refs:r}){await Promise.all(r.map(a=>e.rm(V(n,a))));let i=await Ks("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"})),s=Ep.from(i),o=s.refs.size;for(let a of r)s.refs.has(a)&&s.delete(a);s.refs.size<o&&(i=s.toString(),await Ks("packed-refs",async()=>e.write(`${n}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith("ref: "))return r=r.slice(5),t.resolve({fs:e,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let s=await t.packedRefs({fs:e,gitdir:n}),o=kp(r).filter(a=>!QW.includes(a));for(let a of o){let l=await Ks(a,async()=>await e.read(`${n}/${a}`,{encoding:"utf8"})||s.get(a));if(l)return t.resolve({fs:e,gitdir:n,ref:l.trim(),depth:i})}throw new st(r)}static async exists({fs:e,gitdir:n,ref:r}){try{return await t.expand({fs:e,gitdir:n,ref:r}),!0}catch{return!1}}static async expand({fs:e,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await t.packedRefs({fs:e,gitdir:n}),s=kp(r);for(let o of s)if(await Ks(o,async()=>e.exists(`${n}/${o}`))||i.has(o))return o;throw new st(r)}static async expandAgainstMap({ref:e,map:n}){let r=kp(e);for(let i of r)if(await n.has(i))return i;throw new st(e)}static resolveAgainstMap({ref:e,fullref:n=e,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:n,depth:r,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:n,oid:e};let s=kp(e);for(let o of s){let a=i.get(o);if(a)return t.resolveAgainstMap({ref:a.trim(),fullref:o,depth:r,map:i})}throw new st(e)}static async packedRefs({fs:e,gitdir:n}){let r=await Ks("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"}));return Ep.from(r).refs}static async listRefs({fs:e,gitdir:n,filepath:r}){let i=t.packedRefs({fs:e,gitdir:n}),s=null;try{s=await e.readdirDeep(`${n}/${r}`),s=s.map(o=>o.replace(`${n}/${r}/`,""))}catch{s=[]}for(let o of(await i).keys())o.startsWith(r)&&(o=o.replace(r+"/",""),s.includes(o)||s.push(o));return s.sort(NW),s}static async listBranches({fs:e,gitdir:n,remote:r}){return r?t.listRefs({fs:e,gitdir:n,filepath:`refs/remotes/${r}`}):t.listRefs({fs:e,gitdir:n,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:n}){return(await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function KW(t,e){return Pp(FA(t),FA(e))}function FA(t){return t.mode==="040000"?t.path+"/":t.path}function YA(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new Ce(`Unexpected GitTree entry mode: ${t}`)}function ZW(t){let e=[],n=0;for(;n<t.length;){let r=t.indexOf(32,n);if(r===-1)throw new Ce(`GitTree: Error parsing buffer at byte location ${n}: Could not find the next space character.`);let i=t.indexOf(0,n);if(i===-1)throw new Ce(`GitTree: Error parsing buffer at byte location ${n}: Could not find the next null character.`);let s=t.slice(n,r).toString("utf8");s==="40000"&&(s="040000");let o=YA(s),a=t.slice(r+1,i).toString("utf8");if(a.includes("\\")||a.includes("/"))throw new lc(a);let l=t.slice(i+1,i+21).toString("hex");n=i+21,e.push({mode:s,path:a,oid:l,type:o})}return e}function YW(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new Ce(`Could not understand file mode: ${t}`)}function JW(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=YW(t.mode),t.type||(t.type=YA(t.mode)),t}var zn=class t{constructor(e){if(x.isBuffer(e))this._entries=ZW(e);else if(Array.isArray(e))this._entries=e.map(JW);else throw new Ce("invalid type passed to GitTree constructor");this._entries.sort(GA)}static from(e){return new t(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
|
||
`)}toObject(){let e=[...this._entries];return e.sort(KW),x.concat(e.map(n=>{let r=x.from(n.mode.replace(/^0/,"")),i=x.from(" "),s=x.from(n.path,"utf8"),o=x.from([0]),a=x.from(n.oid,"hex");return x.concat([r,i,s,o,a])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Js=class{static wrap({type:e,object:n}){let r=`${e} ${n.length}\0`,i=r.length,s=i+n.length,o=new Uint8Array(s);for(let a=0;a<i;a++)o[a]=r.charCodeAt(a);return o.set(n,i),o}static unwrap(e){let n=e.indexOf(32),r=e.indexOf(0),i=e.slice(0,n).toString("utf8"),s=e.slice(n+1,r).toString("utf8"),o=e.length-(r+1);if(parseInt(s)!==o)throw new Ce(`Length mismatch: expected ${s} bytes but got ${o} instead.`);return{type:i,object:x.from(e.slice(r+1))}}};async function JA({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await t.read(`${e}/${r}`);return i?{object:i,format:"deflated",source:r}:null}function XW(t,e){let n=new Pr(t),r=IA(n);if(r!==e.byteLength)throw new Ce(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);let i=IA(n),s,o=OA(n,e);if(o.byteLength===i)s=o;else{s=x.alloc(i);let a=new Pr(s);for(a.copy(o);!n.eof();)a.copy(OA(n,e));let l=a.tell();if(i!==l)throw new Ce(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return s}function IA(t){let e=0,n=0,r=null;do r=t.readUInt8(),e|=(r&127)<<n,n+=7;while(r&128);return e}function AA(t,e,n){let r=0,i=0;for(;n--;)e&1&&(r|=t.readUInt8()<<i),e>>=1,i+=8;return r}function OA(t,e){let n=t.readUInt8(),r=128,i=15,s=112;if(n&r){let o=AA(t,n&i,4),a=AA(t,(n&s)>>4,3);return a===0&&(a=65536),e.slice(o,o+a)}else return t.slice(n)}function e9(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function XA(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:e9(t)}var Cp=class{constructor(e){if(typeof x>"u")throw new Error("Missing Buffer dependency");this.stream=XA(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:n}=await this.stream.next();return e&&(this._ended=!0,!n)?x.alloc(0):(n&&(n=x.from(n)),n)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let n=[this.buffer];for(;this.cursor+e>t9(n);){let r=await this._next();if(this._ended)break;n.push(r)}this.buffer=x.concat(n)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function t9(t){return t.reduce((e,n)=>e+n.length,0)}async function n9(t,e){let n=new Cp(t),r=await n.read(4);if(r=r.toString("utf8"),r!=="PACK")throw new Ce(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new Ce(`Invalid packfile version: ${i}`);let s=await n.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!n.eof()&&s--;){let o=n.tell(),{type:a,length:l,ofs:c,reference:u}=await r9(n),f=new Yv.Inflate;for(;!f.result;){let h=await n.chunk();if(!h)break;if(f.push(h,!1),f.err)throw new Ce(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new Ce("Inflated object size is different from that stated in packfile.");await n.undo(),await n.read(h.length-f.strm.avail_in);let d=n.tell();await e({data:f.result,type:a,num:s,offset:o,end:d,reference:u,ofs:c})}}}}async function r9(t){let e=await t.byte(),n=e>>4&7,r=e&15;if(e&128){let o=4;do e=await t.byte(),r|=(e&127)<<o,o+=7;while(e&128)}let i,s;if(n===6){let o=0;i=0;let a=[];do e=await t.byte(),i|=(e&127)<<o,o+=7,a.push(e);while(e&128);s=x.from(a)}return n===7&&(s=await t.read(20)),{type:n,length:r,ofs:i,reference:s}}var Av=!1;async function eO(t){return Av===null&&(Av=s9()),Av?i9(t):Yv.inflate(t)}async function i9(t){let e=new DecompressionStream("deflate"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}function s9(){try{if(new DecompressionStream("deflate"))return!0}catch{}return!1}function o9(t){let e=[],n=0,r=0;do{n=t.readUInt8();let i=n&127;e.push(i),r=n&128}while(r);return e.reduce((i,s)=>i+1<<7|s,-1)}function a9(t,e){let n=e,r=4,i=null;do i=t.readUInt8(),n|=(i&127)<<r,r+=7;while(i&128);return n}var jf=class t{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:n}){let r=new Pr(e);if(r.slice(4).toString("hex")!=="ff744f63")return;let s=r.readUInt32BE();if(s!==2)throw new Ce(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new Ce("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");r.seek(r.tell()+4*255);let o=r.readUInt32BE(),a=[];for(let u=0;u<o;u++){let f=r.slice(20).toString("hex");a[u]=f}r.seek(r.tell()+4*o);let l=new Map;for(let u=0;u<o;u++)l.set(a[u],r.readUInt32BE());let c=r.slice(20).toString("hex");return new t({hashes:a,crcs:{},offsets:l,packfileSha:c,getExternalRefDelta:n})}static async fromPack({pack:e,getExternalRefDelta:n,onProgress:r}){let i={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},s={},o=e.slice(-20).toString("hex"),a=[],l={},c=new Map,u=null,f=null;await n9([e],async({data:y,type:w,reference:b,offset:S,num:D})=>{u===null&&(u=D);let k=Math.floor((u-D)*100/u);k!==f&&r&&await r({phase:"Receiving objects",loaded:u-D,total:u}),f=k,w=i[w],["commit","tree","blob","tag"].includes(w)?s[S]={type:w,offset:S}:w==="ofs-delta"?s[S]={type:w,offset:S}:w==="ref-delta"&&(s[S]={type:w,offset:S})});let h=Object.keys(s).map(Number);for(let[y,w]of h.entries()){let b=y+1===h.length?e.byteLength-20:h[y+1],S=s[w],D=xW.buf(e.slice(w,b))>>>0;S.end=b,S.crc=D}let d=new t({pack:Promise.resolve(e),packfileSha:o,crcs:l,hashes:a,offsets:c,getExternalRefDelta:n});f=null;let p=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let y in s){y=Number(y);let w=Math.floor(p*100/u);w!==f&&r&&await r({phase:"Resolving deltas",loaded:p,total:u}),p++,f=w;let b=s[y];if(!b.oid)try{d.readDepth=0,d.externalReadDepth=0;let{type:S,object:D}=await d.readSlice({start:y});g[d.readDepth]+=1;let k=await us(Js.wrap({type:S,object:D}));b.oid=k,a.push(k),c.set(k,y),l[k]=b.crc}catch{continue}}return a.sort(),d}async toBuffer(){let e=[],n=(c,u)=>{e.push(x.from(c,u))};n("ff744f63","hex"),n("00000002","hex");let r=new Pr(x.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=c&&u++;r.writeUInt32BE(u)}e.push(r.buffer);for(let c of this.hashes)n(c,"hex");let i=new Pr(x.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);e.push(i.buffer);let s=new Pr(x.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),n(this.packfileSha,"hex");let o=x.concat(e),a=await us(o),l=x.alloc(20);return l.write(a,"hex"),x.concat([o,l])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new Ce(`Could not read object ${e} from packfile`)}let n=this.offsets.get(e);return this.readSlice({start:n})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let n={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new Ce("Tried to read from a GitPackIndex with no packfile loaded into memory");let r=(await this.pack).slice(e),i=new Pr(r),s=i.readUInt8(),o=s&112,a=n[o];if(a===void 0)throw new Ce("Unrecognized type: 0b"+o.toString(2));let l=s&15,c=l;s&128&&(c=a9(i,l));let f=null,h=null;if(a==="ofs_delta"){let p=o9(i),g=e-p;({object:f,type:a}=await this.readSlice({start:g}))}if(a==="ref_delta"){let p=i.slice(20).toString("hex");({object:f,type:a}=await this.read({oid:p}))}let d=r.slice(i.tell());if(h=x.from(await eO(d)),h.byteLength!==c)throw new Ce(`Packfile told us object would have length ${c} but it had length ${h.byteLength}`);return f&&(h=x.from(XW(h,f))),this.readDepth>3&&(this.offsetCache[e]={type:a,object:h}),{type:a,format:"content",object:h}}},xp=Symbol("PackfileCache");async function l9({fs:t,filename:e,getExternalRefDelta:n,emitter:r,emitterPrefix:i}){let s=await t.read(e);return jf.fromIdx({idx:s,getExternalRefDelta:n})}function Jv({fs:t,cache:e,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:s}){e[xp]||(e[xp]=new Map);let o=e[xp].get(n);return o||(o=l9({fs:t,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:s}),e[xp].set(n,o)),o}async function c9({fs:t,cache:e,gitdir:n,oid:r,format:i="content",getExternalRefDelta:s}){let o=await t.readdir(V(n,"objects/pack"));o=o.filter(a=>a.endsWith(".idx"));for(let a of o){let l=`${n}/objects/pack/${a}`,c=await Jv({fs:t,cache:e,filename:l,getExternalRefDelta:s});if(c.error)throw new Ce(c.error);if(c.offsets.has(r)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=t.read(f)}let u=await c.read({oid:r,getExternalRefDelta:s});return u.format="content",u.source=`objects/pack/${a.replace(/idx$/,"pack")}`,u}}return null}async function ct({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let s=u=>ct({fs:t,cache:e,gitdir:n,oid:u}),o;if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(o={format:"wrapped",object:x.from("tree 0\0")}),o||(o=await JA({fs:t,gitdir:n,oid:r})),!o){if(o=await c9({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:s}),!o)throw new st(r);return o}if(i==="deflated"||(o.format==="deflated"&&(o.object=x.from(await eO(o.object)),o.format="wrapped"),i==="wrapped"))return o;let a=await us(o.object);if(a!==r)throw new Ce(`SHA check failed! Expected ${r}, computed ${a}`);let{object:l,type:c}=Js.unwrap(o.object);if(o.type=c,o.object=l,o.format="content",i==="content")return o;throw new Ce(`invalid requested format "${i}"`)}var ii=class t extends je{constructor(e,n,r=!0){super(`Failed to create ${e} at ${n} because it already exists.${r?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:n,canForce:r}}};ii.code="AlreadyExistsError";var qf=class t extends je{constructor(e,n,r){super(`Found multiple ${e} matching "${n}" (${r.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:n,matches:r}}};qf.code="AmbiguousError";var Vf=class t extends je{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};Vf.code="CheckoutConflictError";var Hf=class t extends je{constructor(e,n){super(`Failed to checkout "${e}" because commit ${n} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=t.code,this.data={ref:e,oid:n}}};Hf.code="CommitNotFetchedError";var Wf=class t extends je{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};Wf.code="EmptyServerResponseError";var Gf=class t extends je{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};Gf.code="FastForwardError";var Qf=class t extends je{constructor(e,n){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:n}}};Qf.code="GitPushError";var uc=class t extends je{constructor(e,n,r){super(`HTTP Error: ${e} ${n}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:n,response:r}}};uc.code="HttpError";var Xs=class t extends je{constructor(e){let n="invalid filepath";e==="leading-slash"||e==="trailing-slash"?n='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(n='"filepath" should not be a directory.'),super(n),this.code=this.name=t.code,this.data={reason:e}}};Xs.code="InvalidFilepathError";var si=class t extends je{constructor(e,n){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:n}}};si.code="InvalidRefNameError";var Kf=class t extends je{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};Kf.code="MaxDepthError";var fc=class t extends je{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};fc.code="MergeNotSupportedError";var hc=class t extends je{constructor(e,n,r,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:n,deleteByUs:r,deleteByTheirs:i}}};hc.code="MergeConflictError";var ln=class t extends je{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=t.code,this.data={role:e}}};ln.code="MissingNameError";var Rn=class t extends je{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Rn.code="MissingParameterError";var Zf=class t extends je{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=t.code,this.data={errors:e},this.errors=e}};Zf.code="MultipleGitError";var ka=class t extends je{constructor(e,n){super(`Expected "${e}" but received "${n}".`),this.code=this.name=t.code,this.data={expected:e,actual:n}}};ka.code="ParseError";var dc=class t extends je{constructor(e){let n="";e==="not-fast-forward"?n=" because it was not a simple fast-forward":e==="tag-exists"&&(n=" because tag already exists"),super(`Push rejected${n}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};dc.code="PushRejectedError";var Zs=class t extends je{constructor(e,n){super(`Remote does not support the "${e}" so the "${n}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:n}}};Zs.code="RemoteCapabilityError";var Yf=class t extends je{constructor(e,n){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=t.code,this.data={preview:e,response:n}}};Yf.code="SmartHttpError";var Jf=class t extends je{constructor(e,n,r){super(`Git remote "${e}" uses an unrecognized transport protocol: "${n}"`),this.code=this.name=t.code,this.data={url:e,transport:n,suggestion:r}}};Jf.code="UnknownTransportError";var Xf=class t extends je{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};Xf.code="UrlParseError";var mc=class t extends je{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};mc.code="UserCanceledError";var eh=class t extends je{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=t.code,this.data={filepath:e}}};eh.code="IndexResetError";var th=class t extends je{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=t.code,this.data={ref:e}}};th.code="NoCommitError";var tO=Object.freeze({__proto__:null,AlreadyExistsError:ii,AmbiguousError:qf,CheckoutConflictError:Vf,CommitNotFetchedError:Hf,EmptyServerResponseError:Wf,FastForwardError:Gf,GitPushError:Qf,HttpError:uc,InternalError:Ce,InvalidFilepathError:Xs,InvalidOidError:Ys,InvalidRefNameError:si,MaxDepthError:Kf,MergeNotSupportedError:fc,MergeConflictError:hc,MissingNameError:ln,MissingParameterError:Rn,MultipleGitError:Zf,NoRefspecError:Uf,NotFoundError:st,ObjectTypeError:bn,ParseError:ka,PushRejectedError:dc,RemoteCapabilityError:Zs,SmartHttpError:Yf,UnknownTransportError:Jf,UnsafeFilepathError:lc,UrlParseError:Xf,UserCanceledError:mc,UnmergedPathsError:$f,IndexResetError:eh,NoCommitError:th});function Vv({name:t,email:e,timestamp:n,timezoneOffset:r}){return r=u9(r),`${t} <${e}> ${n} ${r}`}function u9(t){let e=f9(h9(t));t=Math.abs(t);let n=Math.floor(t/60);t-=n*60;let r=String(n),i=String(t);return r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),(e===-1?"-":"+")+r+i}function f9(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function h9(t){return t===0?t:-t}function cs(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+`
|
||
`,t}function Tp(t){let[,e,n,r,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:n,timestamp:Number(r),timezoneOffset:d9(i)}}function d9(t){let[,e,n,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=(e==="+"?1:-1)*(Number(n)*60+Number(r)),m9(r)}function m9(t){return t===0?t:-t}var lr=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(x.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new Ce("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
|
||
type ${e.type}
|
||
tag ${e.tag}
|
||
tagger ${Vv(e.tagger)}
|
||
|
||
${e.message}
|
||
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||
|
||
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
|
||
|
||
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
||
`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=`
|
||
`+i.slice(1):n.push(i);let r={};for(let i of n){let s=i.slice(0,i.indexOf(" ")),o=i.slice(i.indexOf(" ")+1);Array.isArray(r[s])?r[s].push(o):r[s]=o}return r.tagger&&(r.tagger=Tp(r.tagger)),r.committer&&(r.committer=Tp(r.committer)),r}withoutSignature(){let e=cs(this._tag);return e.indexOf(`
|
||
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
||
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
||
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return cs(e)}payload(){return this.withoutSignature()+`
|
||
`}toObject(){return x.from(this._tag,"utf8")}static async sign(e,n,r){let i=e.payload(),{signature:s}=await n({payload:i,secretKey:r});s=cs(s);let o=i+s;return t.from(o)}};function Ov(t){return t.trim().split(`
|
||
`).map(e=>" "+e).join(`
|
||
`)+`
|
||
`}function p9(t){return t.split(`
|
||
`).map(e=>e.replace(/^ /,"")).join(`
|
||
`)}var Ln=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(x.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new Ce("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:n}){let r=t.justHeaders(e),i=t.justMessage(e),s=cs(r+`
|
||
gpgsig`+Ov(n)+`
|
||
`+i);return new t(s)}static from(e){return new t(e)}toObject(){return x.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return cs(e.slice(e.indexOf(`
|
||
|
||
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
||
|
||
`))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
|
||
`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=`
|
||
`+i.slice(1):n.push(i);let r={parent:[]};for(let i of n){let s=i.slice(0,i.indexOf(" ")),o=i.slice(i.indexOf(" ")+1);Array.isArray(r[s])?r[s].push(o):r[s]=o}return r.author&&(r.author=Tp(r.author)),r.committer&&(r.committer=Tp(r.committer)),r}static renderHeaders(e){let n="";if(e.tree?n+=`tree ${e.tree}
|
||
`:n+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||
`,e.parent){if(e.parent.length===void 0)throw new Ce("commit 'parent' property should be an array");for(let s of e.parent)n+=`parent ${s}
|
||
`}let r=e.author;n+=`author ${Vv(r)}
|
||
`;let i=e.committer||e.author;return n+=`committer ${Vv(i)}
|
||
`,e.gpgsig&&(n+="gpgsig"+Ov(e.gpgsig)),n}static render(e){return t.renderHeaders(e)+`
|
||
`+cs(e.message)}render(){return this._commit}withoutSignature(){let e=cs(this._commit);if(e.indexOf(`
|
||
gpgsig`)===-1)return e;let n=e.slice(0,e.indexOf(`
|
||
gpgsig`)),r=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
||
`)+28);return cs(n+`
|
||
`+r)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return p9(e)}static async sign(e,n,r){let i=e.withoutSignature(),s=t.justMessage(e._commit),{signature:o}=await n({payload:i,secretKey:r});o=cs(o);let l=t.justHeaders(e._commit)+`
|
||
gpgsig`+Ov(o)+`
|
||
`+s;return t.from(l)}};async function pc({fs:t,cache:e,gitdir:n,oid:r}){if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:zn.from([]),oid:r};let{type:i,object:s}=await ct({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=lr.from(s).parse().object,pc({fs:t,cache:e,gitdir:n,oid:r});if(i==="commit")return r=Ln.from(s).parse().tree,pc({fs:t,cache:e,gitdir:n,oid:r});if(i!=="tree")throw new bn(r,i,"tree");return{tree:zn.from(s),oid:r}}var Hv=class{constructor({fs:e,gitdir:n,ref:r,cache:i}){this.fs=e,this.cache=i,this.gitdir=n,this.mapPromise=(async()=>{let o=new Map,a;try{a=await te.resolve({fs:e,gitdir:n,ref:r})}catch(c){c instanceof st&&(a="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await pc({fs:e,cache:this.cache,gitdir:n,oid:a});return l.type="tree",l.mode="40000",o.set(".",l),o})();let s=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,cache:i,gitdir:s}=this,o=await this.mapPromise,a=o.get(n);if(!a)throw new Error(`No obj for ${n}`);let l=a.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(a)}`);if(a.type!=="tree")return null;let{type:c,object:u}=await ct({fs:r,cache:i,gitdir:s,oid:l});if(c!==a.type)throw new bn(l,c,a.type);let f=zn.from(u);for(let h of f)o.set(V(n,h.path),h);return f.entries().map(h=>V(n,h.path))}async type(e){if(e._type===!1){let n=await this.mapPromise,{type:r}=n.get(e._fullpath);e._type=r}return e._type}async mode(e){if(e._mode===!1){let n=await this.mapPromise,{mode:r}=n.get(e._fullpath);e._mode=QA(parseInt(r,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let n=await this.mapPromise,{fs:r,cache:i,gitdir:s}=this,a=n.get(e._fullpath).oid,{type:l,object:c}=await ct({fs:r,cache:i,gitdir:s,oid:a});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let r=(await this.mapPromise).get(e._fullpath);e._oid=r.oid}return e._oid}};function ar({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Np,{value:function({fs:n,gitdir:r,cache:i}){return new Hv({fs:n,gitdir:r,ref:t,cache:i})}}),Object.freeze(e),e}var Wv=class{constructor({fs:e,dir:n,gitdir:r,cache:i}){this.fs=e,this.cache=i,this.dir=n,this.gitdir=r,this.config=null;let s=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,dir:i}=this,s=await r.readdir(V(i,n));return s===null?null:s.map(o=>V(n,o))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:n,dir:r}=this,i=await n.lstat(`${r}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=i.isDirectory()?"tree":"blob";s==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(s="special"),e._type=s,i=cc(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:n,dir:r,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let o=await(await this._getGitConfig(n,i)).get("core.autocrlf"),a=await n.read(`${r}/${e._fullpath}`,{autocrlf:o});e._actualSize=a.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(a)}}return e._content}async oid(e){if(e._oid===!1){let n=this,{fs:r,gitdir:i,cache:s}=this,o;await Tt.acquire({fs:r,gitdir:i,cache:s},async function(a){let l=a.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await n._getGitConfig(r,i)).get("core.filemode"),h=typeof process<"u"?process.platform!=="win32":!0;if(!l||Sp(c,l,f,h)){let d=await e.content();d===void 0?o=void 0:(o=await us(Js.wrap({type:"blob",object:d})),l&&o===l.oid&&(!f||c.mode===l.mode)&&Sp(c,l,f,h)&&a.insert({filepath:e._fullpath,stats:c,oid:o}))}else o=l.oid}),e._oid=o}return e._oid}async _getGitConfig(e,n){return this.config?this.config:(this.config=await Et.get({fs:e,gitdir:n}),this.config)}};function kc(){let t=Object.create(null);return Object.defineProperty(t,Np,{value:function({fs:e,dir:n,gitdir:r,cache:i}){return new Wv({fs:e,dir:n,gitdir:r,cache:i})}}),Object.freeze(t),t}function g9(t,e){let n=e-t;return Array.from({length:n},(r,i)=>t+i)}var nO=typeof Array.prototype.flat>"u"?t=>t.reduce((e,n)=>e.concat(n),[]):t=>t.flat(),Gv=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};function*y9(t){let e=new Gv,n,r=[],i=t.length;for(let s=0;s<i;s++)r[s]=t[s].next().value,r[s]!==void 0&&e.consider(r[s]);if(e.value!==null)for(;;){let s=[];n=e.value,e.reset();for(let o=0;o<i;o++)r[o]!==void 0&&r[o]===n?(s[o]=r[o],r[o]=t[o].next().value):s[o]=null,r[o]!==void 0&&e.consider(r[o]);if(yield s,e.value===null)return}}async function eo({fs:t,cache:e,dir:n,gitdir:r,trees:i,map:s=async(l,c)=>c,reduce:o=async(l,c)=>{let u=nO(c);return l!==void 0&&u.unshift(l),u},iterate:a=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(d=>d[Np]({fs:t,dir:n,gitdir:r,cache:e})),c=new Array(l.length).fill("."),u=g9(0,l.length),f=async d=>{u.forEach(y=>{let w=d[y];d[y]=w&&new l[y].ConstructEntry(w)});let g=(await Promise.all(u.map(y=>{let w=d[y];return w?l[y].readdir(w):[]}))).map(y=>(y===null?[]:y)[Symbol.iterator]());return{entries:d,children:y9(g)}},h=async d=>{let{entries:p,children:g}=await f(d),y=p.find(b=>b&&b._fullpath)._fullpath,w=await s(y,p);if(w!==null){let b=await a(h,g);return b=b.filter(S=>S!==void 0),o(w,b)}};return h(c)}async function Qv(t,e){let n=await t.readdir(e);n==null?await t.rm(e):n.length?await Promise.all(n.map(r=>{let i=V(e,r);return t.lstat(i).then(s=>{if(s)return s.isDirectory()?Qv(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function w9(t){return b9(t)&&PA(t.then)&&PA(t.catch)}function b9(t){return t&&typeof t=="object"}function PA(t){return typeof t=="function"}function NA(t){return w9((n=>{try{return n.readFile().catch(r=>r)}catch(r){return r}})(t))}var MA=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function RA(t,e){if(NA(e))for(let n of MA)t[`_${n}`]=e[n].bind(e);else for(let n of MA)t[`_${n}`]=vp(e[n].bind(e));NA(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=Qv.bind(null,t)):(e.cp&&(t._cp=vp(e.cp.bind(e))),e.rm?t._rm=vp(e.rm.bind(e)):e.rmdir.length>2?t._rm=vp(e.rmdir.bind(e)):t._rm=Qv.bind(null,t))}var fe=class{constructor(e){if(typeof e._original_unwrapped_fs<"u")return e;let n=Object.getOwnPropertyDescriptor(e,"promises");n&&n.enumerable?RA(this,e.promises):RA(this,e),this._original_unwrapped_fs=e}async exists(e,n={}){try{return await this._stat(e),!0}catch(r){if(r.code==="ENOENT"||r.code==="ENOTDIR"||(r.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',r),r}}async read(e,n={}){try{let r=await this._readFile(e,n);if(n.autocrlf==="true")try{r=new TextDecoder("utf8",{fatal:!0}).decode(r),r=r.replace(/\r\n/g,`
|
||
`),r=new TextEncoder().encode(r)}catch{}return typeof r!="string"&&(r=x.from(r)),r}catch{return null}}async write(e,n,r={}){try{await this._writeFile(e,n,r)}catch{await this.mkdir(va(e)),await this._writeFile(e,n,r)}}async mkdir(e,n=!1){try{await this._mkdir(e)}catch(r){if(r===null||r.code==="EEXIST")return;if(n)throw r;if(r.code==="ENOENT"){let i=va(e);if(i==="."||i==="/"||i===e)throw r;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(n){if(n.code!=="ENOENT")throw n}}async rmdir(e,n){try{n&&n.recursive?await this._rm(e,n):await this._rmdir(e)}catch(r){if(r.code!=="ENOENT")throw r}}async readdir(e){try{let n=await this._readdir(e);return n.sort(Pp),n}catch(n){return n.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let n=await this._readdir(e);return(await Promise.all(n.map(async i=>{let s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(n){if(n.code==="ENOENT"||(n.code||"").includes("ENS"))return null;throw n}}async readlink(e,n={encoding:"buffer"}){try{let r=await this._readlink(e,n);return x.isBuffer(r)?r:x.from(r)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async writelink(e,n){return this._symlink(n.toString("utf8"),e)}};function R(t,e){if(e===void 0)throw new Rn(t)}async function de({fsp:t,dotgit:e}){R("fsp",t),R("dotgit",e);let n=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return n.isDirectory()?e:n.isFile()?t._readFile(e,"utf8").then(r=>r.trimRight().substr(8)).then(r=>V(va(e),r)):e}async function Fp(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function rO({fs:t,dir:e,gitdir:n=V(e,".git"),commit:r="HEAD",cache:i={}}){try{R("fs",t),R("dir",e),R("gitdir",n);let s=new fe(t),o=[ar({ref:r}),kc(),Da()],a=[],l=await de({fsp:s,dotgit:n});await Tt.acquire({fs:s,gitdir:l,cache:i},async function(u){a=u.unmergedPaths});let c=await eo({fs:s,cache:i,dir:e,gitdir:l,trees:o,map:async function(u,[f,h,d]){let p=!await Fp(h,d),g=a.includes(u),y=!await Fp(d,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(y)return!1;throw new eh(u)}});await Tt.acquire({fs:s,gitdir:l,cache:i},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let h=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,h,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var to=class{static async isIgnored({fs:e,dir:n,gitdir:r=V(n,".git"),filepath:i}){if(Dp(i)===".git")return!0;if(i===".")return!1;let s="",o=V(r,"info","exclude");await e.exists(o)&&(s=await e.read(o,"utf8"));let a=[{gitignore:V(n,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),h=l.slice(u).join("/");a.push({gitignore:V(n,f,".gitignore"),filepath:h})}let c=!1;for(let u of a){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let h=SW().add(s);h.add(f);let d=va(u.filepath);if(d!=="."&&h.ignores(d))return!0;c?c=!h.test(u.filepath).unignored:c=h.test(u.filepath).ignored}return c}};async function v9({fs:t,gitdir:e,object:n,format:r,oid:i}){if(r!=="deflated")throw new Ce("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${i.slice(0,2)}/${i.slice(2)}`,o=`${e}/${s}`;await t.exists(o)||await t.write(o,n)}var Pv=null;async function iO(t){return Pv===null&&(Pv=x9()),Pv?k9(t):Yv.deflate(t)}async function k9(t){let e=new CompressionStream("deflate"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}function x9(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch{return!1}}async function Bn({fs:t,gitdir:e,type:n,object:r,format:i="content",oid:s=void 0,dryRun:o=!1}){return i!=="deflated"&&(i!=="wrapped"&&(r=Js.wrap({type:n,object:r})),s=await us(r),r=x.from(await iO(r))),o||await v9({fs:t,gitdir:e,object:r,format:"deflated",oid:s}),s}function sO(t){let e;for(;~(e=t.indexOf(92));)t[e]=47;return t}async function oO({fs:t,dir:e,gitdir:n=V(e,".git"),filepath:r,cache:i={},force:s=!1,parallel:o=!0}){try{R("fs",t),R("dir",e),R("gitdir",n),R("filepath",r);let a=new fe(t),l=await de({fsp:a,dotgit:n});await Tt.acquire({fs:a,gitdir:l,cache:i},async c=>{let f=await(await Et.get({fs:a,gitdir:l})).get("core.autocrlf");return Kv({dir:e,gitdir:l,fs:a,filepath:r,index:c,force:s,parallel:o,autocrlf:f})})}catch(a){throw a.caller="git.add",a}}async function Kv({dir:t,gitdir:e,fs:n,filepath:r,index:i,force:s,parallel:o,autocrlf:a}){r=Array.isArray(r)?r:[r];let l=r.map(async h=>{if(!s&&await to.isIgnored({fs:n,dir:t,gitdir:e,filepath:h}))return;let d=await n.lstat(V(t,h));if(!d)throw new st(h);if(d.isDirectory()){let p=await n.readdir(V(t,h));if(o){let g=p.map(y=>Kv({dir:t,gitdir:e,fs:n,filepath:[V(h,y)],index:i,force:s,parallel:o,autocrlf:a}));await Promise.all(g)}else for(let g of p)await Kv({dir:t,gitdir:e,fs:n,filepath:[V(h,g)],index:i,force:s,parallel:o,autocrlf:a})}else{let p=d.isSymbolicLink()?await n.readlink(V(t,h)).then(sO):await n.read(V(t,h),{autocrlf:a});if(p===null)throw new st(h);let g=await Bn({fs:n,gitdir:e,type:"blob",object:p});i.insert({filepath:h,stats:d,oid:g})}}),c=await Promise.allSettled(l),u=c.filter(h=>h.status==="rejected").map(h=>h.reason);if(u.length>1)throw new Zf(u);if(u.length===1)throw u[0];return c.filter(h=>h.status==="fulfilled"&&h.value).map(h=>h.value)}async function nh({fs:t,gitdir:e,path:n}){return(await Et.get({fs:t,gitdir:e})).get(n)}function aO(t,...e){for(let n of e)if(n)for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(t[r]=i)}return t}async function no({fs:t,gitdir:e,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),s={name:await nh({fs:t,gitdir:e,path:"user.name"}),email:await nh({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},o=aO({},s,r?r.author:void 0,n);if(o.name!==void 0)return o}async function gc({fs:t,gitdir:e,author:n,committer:r,commit:i}){let s=Math.floor(Date.now()/1e3),o={name:await nh({fs:t,gitdir:e,path:"user.name"}),email:await nh({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},a=aO({},o,i?i.committer:void 0,n,r);if(a.name!==void 0)return a}async function lO({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:s}=await ct({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=lr.from(s).parse().object,lO({fs:t,cache:e,gitdir:n,oid:r});if(i!=="commit")throw new bn(r,i,"commit");return{commit:Ln.from(s),oid:r}}async function yc({fs:t,cache:e,gitdir:n,oid:r}){let{commit:i,oid:s}=await lO({fs:t,cache:e,gitdir:n,oid:r});return{oid:s,commit:i.parse(),payload:i.withoutSignature()}}async function Mp({fs:t,cache:e,onSign:n,gitdir:r,message:i,author:s,committer:o,signingKey:a,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:h,tree:d}){let p=!1;f||(f=await te.resolve({fs:t,gitdir:r,ref:"HEAD",depth:2}));let g,y;try{g=await te.resolve({fs:t,gitdir:r,ref:f}),y=await yc({fs:t,gitdir:r,oid:g,cache:{}})}catch{p=!0}if(l&&p)throw new th(f);let w=l?await no({fs:t,gitdir:r,author:s,commit:y.commit}):await no({fs:t,gitdir:r,author:s});if(!w)throw new ln("author");let b=l?await gc({fs:t,gitdir:r,author:w,committer:o,commit:y.commit}):await gc({fs:t,gitdir:r,author:w,committer:o});if(!b)throw new ln("committer");return Tt.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async function(S){let k=ZA(S.entries).get(".");if(d||(d=await cO({fs:t,gitdir:r,inode:k,dryRun:c})),h?h=await Promise.all(h.map(_=>te.resolve({fs:t,gitdir:r,ref:_}))):l?h=y.commit.parent:h=g?[g]:[],!i)if(l)i=y.commit.message;else throw new Rn("message");let E=Ln.from({tree:d,parent:h,author:w,committer:b,message:i});a&&(E=await Ln.sign(E,n,a));let v=await Bn({fs:t,gitdir:r,type:"commit",object:E.toObject(),dryRun:c});return!u&&!c&&await te.writeRef({fs:t,gitdir:r,ref:f,value:v}),v})}async function cO({fs:t,gitdir:e,inode:n,dryRun:r}){let i=n.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await cO({fs:t,gitdir:e,inode:l,dryRun:r}));let s=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),o=zn.from(s);return await Bn({fs:t,gitdir:e,type:"tree",object:o.toObject(),dryRun:r})}async function ih({fs:t,cache:e,gitdir:n,oid:r,filepath:i}){if(i.startsWith("/"))throw new Xs("leading-slash");if(i.endsWith("/"))throw new Xs("trailing-slash");let s=r,o=await pc({fs:t,cache:e,gitdir:n,oid:r}),a=o.tree;if(i==="")r=o.oid;else{let l=i.split("/");r=await uO({fs:t,cache:e,gitdir:n,tree:a,pathArray:l,oid:s,filepath:i})}return r}async function uO({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:s,filepath:o}){let a=i.shift();for(let l of r)if(l.path===a){if(i.length===0)return l.oid;{let{type:c,object:u}=await ct({fs:t,cache:e,gitdir:n,oid:l.oid});if(c!=="tree")throw new bn(s,c,"tree",o);return r=zn.from(u),uO({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:s,filepath:o})}}throw new st(`file or directory found at "${s}:${o}"`)}async function xc({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){i!==void 0&&(r=await ih({fs:t,cache:e,gitdir:n,oid:r,filepath:i}));let{tree:s,oid:o}=await pc({fs:t,cache:e,gitdir:n,oid:r});return{oid:o,tree:s.entries()}}async function sh({fs:t,gitdir:e,tree:n}){let r=zn.from(n).toObject();return await Bn({fs:t,gitdir:e,type:"tree",object:r,format:"content"})}async function S9({fs:t,cache:e,onSign:n,gitdir:r,ref:i,oid:s,note:o,force:a,author:l,committer:c,signingKey:u}){let f;try{f=await te.resolve({gitdir:r,fs:t,ref:i})}catch(w){if(!(w instanceof st))throw w}let d=(await xc({fs:t,cache:e,gitdir:r,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(a)d=d.filter(w=>w.path!==s);else for(let w of d)if(w.path===s)throw new ii("note",s);typeof o=="string"&&(o=x.from(o,"utf8"));let p=await Bn({fs:t,gitdir:r,type:"blob",object:o,format:"content"});d.push({mode:"100644",path:s,oid:p,type:"blob"});let g=await sh({fs:t,gitdir:r,tree:d});return await Mp({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote'
|
||
`,author:l,committer:c,signingKey:u})}async function fO({fs:t,onSign:e,dir:n,gitdir:r=V(n,".git"),ref:i="refs/notes/commits",oid:s,note:o,force:a,author:l,committer:c,signingKey:u,cache:f={}}){try{R("fs",t),R("gitdir",r),R("oid",s),R("note",o),u&&R("onSign",e);let h=new fe(t),d=await no({fs:h,gitdir:r,author:l});if(!d)throw new ln("author");let p=await gc({fs:h,gitdir:r,author:d,committer:c});if(!p)throw new ln("committer");let g=await de({fsp:h,dotgit:r});return await S9({fs:h,cache:f,onSign:e,gitdir:g,ref:i,oid:s,note:o,force:a,author:d,committer:p,signingKey:u})}catch(h){throw h.caller="git.addNote",h}}var D9=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function rh(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!D9.test(t)&&(!!e||t.includes("/"))}async function hO({fs:t,gitdir:e,remote:n,url:r,force:i}){if(!rh(n,!0))throw new si(n,Bf.clean(n));let s=await Et.get({fs:t,gitdir:e});if(!i&&(await s.getSubsections("remote")).includes(n)&&r!==await s.get(`remote.${n}.url`))throw new ii("remote",n);await s.set(`remote.${n}.url`,r),await s.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await Et.save({fs:t,gitdir:e,config:s})}async function dO({fs:t,dir:e,gitdir:n=V(e,".git"),remote:r,url:i,force:s=!1}){try{R("fs",t),R("gitdir",n),R("remote",r),R("url",i);let o=new fe(t),a=await de({fsp:o,dotgit:n});return await hO({fs:o,gitdir:a,remote:r,url:i,force:s})}catch(o){throw o.caller="git.addRemote",o}}async function E9({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await te.exists({fs:t,gitdir:r,ref:i}))throw new ii("tag",i);let f=await te.resolve({fs:t,gitdir:r,ref:l||"HEAD"}),{type:h}=await ct({fs:t,cache:e,gitdir:r,oid:f}),d=lr.from({object:f,type:h,tag:i.replace("refs/tags/",""),tagger:s,message:o,gpgsig:a});c&&(d=await lr.sign(d,n,c));let p=await Bn({fs:t,gitdir:r,type:"tag",object:d.toObject()});await te.writeRef({fs:t,gitdir:r,ref:i,value:p})}async function mO({fs:t,onSign:e,dir:n,gitdir:r=V(n,".git"),ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1,cache:f={}}){try{R("fs",t),R("gitdir",r),R("ref",i),c&&R("onSign",e);let h=new fe(t),d=await de({fsp:h,dotgit:r}),p=await no({fs:h,gitdir:d,author:s});if(!p)throw new ln("tagger");return await E9({fs:h,cache:f,onSign:e,gitdir:d,ref:i,tagger:p,message:o,gpgsig:a,object:l,signingKey:c,force:u})}catch(h){throw h.caller="git.annotatedTag",h}}async function _9({fs:t,gitdir:e,ref:n,object:r,checkout:i=!1,force:s=!1}){if(!rh(n,!0))throw new si(n,Bf.clean(n));let o=`refs/heads/${n}`;if(!s&&await te.exists({fs:t,gitdir:e,ref:o}))throw new ii("branch",n,!1);let a;try{a=await te.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch{}a&&await te.writeRef({fs:t,gitdir:e,ref:o,value:a}),i&&await te.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}async function pO({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r,object:i,checkout:s=!1,force:o=!1}){try{R("fs",t),R("gitdir",n),R("ref",r);let a=new fe(t),l=await de({fsp:a,dotgit:n});return await _9({fs:a,gitdir:l,ref:r,object:i,checkout:s,force:o})}catch(a){throw a.caller="git.branch",a}}var gO=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Xv({fs:t,cache:e,onProgress:n,onPostCheckout:r,dir:i,gitdir:s,remote:o,ref:a,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:h,track:d=!0,nonBlocking:p=!1,batchSize:g=100}){let y;if(r)try{y=await te.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch{y="0000000000000000000000000000000000000000"}let w;try{w=await te.resolve({fs:t,gitdir:s,ref:a})}catch(b){if(a==="HEAD")throw b;let S=`${o}/${a}`;if(w=await te.resolve({fs:t,gitdir:s,ref:S}),d){let D=await Et.get({fs:t,gitdir:s});await D.set(`branch.${a}.remote`,o),await D.set(`branch.${a}.merge`,`refs/heads/${a}`),await Et.save({fs:t,gitdir:s,config:D})}await te.writeRef({fs:t,gitdir:s,ref:`refs/heads/${a}`,value:w})}if(!c){let b;try{b=await C9({fs:t,cache:e,onProgress:n,dir:i,gitdir:s,ref:a,force:h,filepaths:l})}catch(v){throw v instanceof st&&v.data.what===w?new Hf(a,w):v}let S=b.filter(([v])=>v==="conflict").map(([v,_])=>_);if(S.length>0)throw new Vf(S);let D=b.filter(([v])=>v==="error").map(([v,_])=>_);if(D.length>0)throw new Ce(D.join(", "));if(f){r&&await r({previousHead:y,newHead:w,type:l!=null&&l.length>0?"file":"branch"});return}let k=0,E=b.length;if(await Tt.acquire({fs:t,gitdir:s,cache:e},async function(v){await Promise.all(b.filter(([_])=>_==="delete"||_==="delete-index").map(async function([_,C]){let A=`${i}/${C}`;_==="delete"&&await t.rm(A),v.delete({filepath:C}),n&&await n({phase:"Updating workdir",loaded:++k,total:E})}))}),await Tt.acquire({fs:t,gitdir:s,cache:e},async function(v){for(let[_,C]of b)if(_==="rmdir"||_==="rmdir-index"){let A=`${i}/${C}`;try{_==="rmdir"&&await t.rmdir(A),v.delete({filepath:C}),n&&await n({phase:"Updating workdir",loaded:++k,total:E})}catch(P){if(P.code==="ENOTEMPTY")console.log(`Did not delete ${C} because directory is not empty`);else throw P}}}),await Promise.all(b.filter(([v])=>v==="mkdir"||v==="mkdir-index").map(async function([v,_]){let C=`${i}/${_}`;await t.mkdir(C),n&&await n({phase:"Updating workdir",loaded:++k,total:E})})),p){let v=b.filter(([C])=>C==="create"||C==="create-index"||C==="update"||C==="mkdir-index"),_=await zA("Update Working Dir",v.map(([C,A,P,N,B])=>()=>F9({fs:t,cache:e,gitdir:s,dir:i},[C,A,P,N,B])),n,g);await Tt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(C){await zA("Update Index",_.map(([A,P,N])=>()=>T9({index:C,fullpath:A,oid:P,stats:N})),n,g)})}else await Tt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(v){await Promise.all(b.filter(([_])=>_==="create"||_==="create-index"||_==="update"||_==="mkdir-index").map(async function([_,C,A,P,N]){let B=`${i}/${C}`;try{if(_!=="create-index"&&_!=="mkdir-index"){let{object:G}=await ct({fs:t,cache:e,gitdir:s,oid:A});if(N&&await t.rm(B),P===33188)await t.write(B,G);else if(P===33261)await t.write(B,G,{mode:511});else if(P===40960)await t.writelink(B,G);else throw new Ce(`Invalid mode 0o${P.toString(8)} detected in blob ${A}`)}let L=await t.lstat(B);P===33261&&(L.mode=493),_==="mkdir-index"&&(L.mode=57344),v.insert({filepath:C,stats:L,oid:A}),n&&await n({phase:"Updating workdir",loaded:++k,total:E})}catch(L){console.log(L)}}))});r&&await r({previousHead:y,newHead:w,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let b=await te.expand({fs:t,gitdir:s,ref:a});b.startsWith("refs/heads")?await te.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:b}):await te.writeRef({fs:t,gitdir:s,ref:"HEAD",value:w})}}async function C9({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,ref:s,force:o,filepaths:a}){let l=0;return eo({fs:t,cache:e,dir:r,gitdir:i,trees:[ar({ref:s}),kc(),Da()],map:async function(c,[u,f,h]){if(c===".")return;if(a&&!a.some(p=>gO(c,p)))return null;switch(n&&await n({phase:"Analyzing workdir",loaded:++l}),[!!h,!!u,!!f].map(Number).join("")){case"000":return;case"001":return o&&a&&a.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await f.oid()?o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?o?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await h.type()){case"tree":return["rmdir-index",c];case"blob":return await h.oid()!==await f.oid()?o?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await h.type()}`]}case"110":case"111":switch(`${await h.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await h.oid()===await u.oid()&&await h.mode()===await u.mode()&&!o)return;if(f){if(await f.oid()!==await h.oid()&&await f.oid()!==await u.oid())return o?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(o)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()];return await u.mode()!==await h.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await h.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await h.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=nO(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function T9({index:t,fullpath:e,stats:n,oid:r}){try{t.insert({filepath:e,stats:n,oid:r})}catch(i){console.warn(`Error inserting ${e} into index:`,i)}}async function F9({fs:t,cache:e,gitdir:n,dir:r},[i,s,o,a,l]){let c=`${r}/${s}`;if(i!=="create-index"&&i!=="mkdir-index"){let{object:f}=await ct({fs:t,cache:e,gitdir:n,oid:o});if(l&&await t.rm(c),a===33188)await t.write(c,f);else if(a===33261)await t.write(c,f,{mode:511});else if(a===40960)await t.writelink(c,f);else throw new Ce(`Invalid mode 0o${a.toString(8)} detected in blob ${o}`)}let u=await t.lstat(c);return a===33261&&(u.mode=493),i==="mkdir-index"&&(u.mode=57344),[s,o,u]}async function zA(t,e,n,r){let i=[];try{for(let s=0;s<e.length;s+=r){let o=e.slice(s,s+r).map(l=>l());(await Promise.allSettled(o)).forEach(l=>{l.status==="fulfilled"&&i.push(l.value)}),n&&await n({phase:"Updating workdir",loaded:s+o.length,total:e.length})}return i}catch(s){console.error(`Error during ${t}: ${s}`)}return i}async function e1({fs:t,onProgress:e,onPostCheckout:n,dir:r,gitdir:i=V(r,".git"),remote:s="origin",ref:o,filepaths:a,noCheckout:l=!1,noUpdateHead:c=o===void 0,dryRun:u=!1,force:f=!1,track:h=!0,cache:d={},nonBlocking:p=!1,batchSize:g=100}){try{R("fs",t),R("dir",r),R("gitdir",i);let y=o||"HEAD",w=new fe(t),b=await de({fsp:w,dotgit:i});return await Xv({fs:w,cache:d,onProgress:e,onPostCheckout:n,dir:r,gitdir:b,remote:s,ref:y,filepaths:a,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:h,nonBlocking:p,batchSize:g})}catch(y){throw y.caller="git.checkout",y}}var I9=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function ba(t){let e=I9.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function io({fs:t,gitdir:e,fullname:n=!1,test:r=!1}){let i=await te.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(r)try{await te.resolve({fs:t,gitdir:e,ref:i})}catch{return}if(i.startsWith("refs/"))return n?i:ba(i)}function A9(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function yO({username:t="",password:e=""}){return`Basic ${x.from(`${t}:${e}`).toString("base64")}`}async function oh(t,e){let n=XA(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function Ip(t){let e=0,n=[];await oh(t,s=>{n.push(s),e+=s.byteLength});let r=new Uint8Array(e),i=0;for(let s of n)r.set(s,i),i+=s.byteLength;return r}function LA(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[n,r]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:n,password:r}}}function Zv(t,e){let n=e.toString(16);return"0".repeat(t-n.length)+n}var gt=class{static flush(){return x.from("0000","utf8")}static delim(){return x.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=x.from(e));let n=e.length+4,r=Zv(4,n);return x.concat([x.from(r,"utf8"),e])}static streamReader(e){let n=new Cp(e);return async function(){try{let i=await n.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let s=await n.read(i-4);return s??!0}catch(i){return e.error=i,!0}}}};async function BA(t){let e={},n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let r=n.indexOf("=");if(r>-1){let i=n.slice(0,r),s=n.slice(r+1);e[i]=s}else e[n]=!0}return{protocolVersion:2,capabilities2:e}}async function $A(t,{service:e}){let n=new Set,r=new Map,i=new Map,s=gt.streamReader(t),o=await s();for(;o===null;)o=await s();if(o===!0)throw new Wf;if(o.includes("version 2"))return BA(s);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new ka(`# service=${e}\\n`,o.toString("utf8"));let a=await s();for(;a===null;)a=await s();if(a===!0)return{capabilities:n,refs:r,symrefs:i};if(a=a.toString("utf8"),a.includes("version 2"))return BA(s);let[l,c]=Nv(a,"\0","\\x00");if(c.split(" ").map(u=>n.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Nv(l," "," ");for(r.set(f,u);;){let h=await s();if(h===!0)break;if(h!==null){let[d,p]=Nv(h.toString("utf8")," "," ");r.set(p,d)}}}for(let u of n)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:n,refs:r,symrefs:i}}function Nv(t,e,n){let r=t.trim().split(e);if(r.length!==2)throw new ka(`Two strings separated by '${n}'`,t.toString("utf8"));return r}var UA=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,jA=(t,e)=>{(e.username||e.password)&&(t.Authorization=yO(e)),e.headers&&Object.assign(t,e.headers)},Mv=async t=>{try{let e=x.from(await Ip(t.body)),n=e.toString("utf8");return{preview:n.length<256?n:n.slice(0,256)+"...",response:n,data:e}}catch{return{}}},wc=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:n,onAuth:r,onAuthSuccess:i,onAuthFailure:s,corsProxy:o,service:a,url:l,headers:c,protocolVersion:u}){let{url:f,auth:h}=LA(l),d=o?UA(o,f):f;(h.username||h.password)&&(c.Authorization=yO(h)),u===2&&(c["Git-Protocol"]="version=2");let p,g,y=!1;do if(p=await e.request({onProgress:n,method:"GET",url:`${d}/info/refs?service=${a}`,headers:c}),g=!1,p.statusCode===401||p.statusCode===203){let w=y?s:r;if(w){if(h=await w(f,{...h,headers:{...c}}),h&&h.cancel)throw new mc;h&&(jA(c,h),y=!0,g=!0)}}else p.statusCode===200&&y&&i&&await i(f,h);while(g);if(p.statusCode!==200){let{response:w}=await Mv(p);throw new uc(p.statusCode,p.statusMessage,w)}if(p.headers["content-type"]===`application/x-${a}-advertisement`){let w=await $A(p.body,{service:a});return w.auth=h,w}else{let{preview:w,response:b,data:S}=await Mv(p);try{let D=await $A([S],{service:a});return D.auth=h,D}catch{throw new Yf(w,b)}}}static async connect({http:e,onProgress:n,corsProxy:r,service:i,url:s,auth:o,body:a,headers:l}){let c=LA(s);c&&(s=c.url),r&&(s=UA(r,s)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,jA(l,o);let u=await e.request({onProgress:n,method:"POST",url:`${s}/${i}`,body:a,headers:l});if(u.statusCode!==200){let{response:f}=Mv(u);throw new uc(u.statusCode,u.statusMessage,f)}return u}},bc=class{static getRemoteHelperFor({url:e}){let n=new Map;n.set("http",wc),n.set("https",wc);let r=O9({url:e});if(!r)throw new Xf(e);if(n.has(r.transport))return n.get(r.transport);throw new Jf(e,r.transport,r.transport==="ssh"?A9(e):void 0)}};function O9({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}var wa=null,xa=class{static async read({fs:e,gitdir:n}){wa===null&&(wa=new Lf);let r=V(n,"shallow"),i=new Set;return await wa.acquire(r,async function(){let s=await e.read(r,{encoding:"utf8"});if(s===null||s.trim()==="")return i;s.trim().split(`
|
||
`).map(o=>i.add(o))}),i}static async write({fs:e,gitdir:n,oids:r}){wa===null&&(wa=new Lf);let i=V(n,"shallow");if(r.size>0){let s=[...r].join(`
|
||
`)+`
|
||
`;await wa.acquire(i,async function(){await e.write(i,s,{encoding:"utf8"})})}else await wa.acquire(i,async function(){await e.rm(i)})}};async function P9({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return t.exists(`${e}/${r}`)}async function N9({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let s=await t.readdir(V(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let a=`${n}/objects/pack/${o}`,l=await Jv({fs:t,cache:e,filename:a,getExternalRefDelta:i});if(l.error)throw new Ce(l.error);if(l.offsets.has(r))return!0}return!1}async function qA({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let s=a=>ct({fs:t,cache:e,gitdir:n,oid:a}),o=await P9({fs:t,gitdir:n,oid:r});return o||(o=await N9({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:s})),o}function M9(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function wO(t,e){let n=t.map(r=>r.split("=",1)[0]);return e.filter(r=>{let i=r.split("=",1)[0];return n.includes(i)})}var Rp={name:"isomorphic-git",version:"1.36.1",agent:"git/isomorphic-git@1.36.1"},ac=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let n=this._waiting;this._waiting=null,n({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function R9(t){let e=t.indexOf("\r"),n=t.indexOf(`
|
||
`);return e===-1&&n===-1?-1:e===-1?n+1:n===-1?e+1:n===e+1?n+1:Math.min(e,n)+1}function bO(t){let e=new ac,n="";return(async()=>(await oh(t,r=>{for(r=r.toString("utf8"),n+=r;;){let i=R9(n);if(i===-1)break;e.write(n.slice(0,i)),n=n.slice(i)}}),n.length>0&&e.write(n),e.end()))(),e}var Ap=class{static demux(e){let n=gt.streamReader(e),r=new ac,i=new ac,s=new ac,o=async function(){let a=await n();if(a===null)return o();if(a===!0){r.end(),s.end(),e.error?i.destroy(e.error):i.end();return}switch(a[0]){case 1:{i.write(a.slice(1));break}case 2:{s.write(a.slice(1));break}case 3:{let l=a.slice(1);s.write(l),r.end(),s.end(),i.destroy(new Error(l.toString("utf8")));return}default:r.write(a)}o()};return o(),{packetlines:r,packfile:i,progress:s}}};async function z9(t){let{packetlines:e,packfile:n,progress:r}=Ap.demux(t),i=[],s=[],o=[],a=!1,l=!1;return new Promise((c,u)=>{oh(e,f=>{let h=f.toString("utf8").trim();if(h.startsWith("shallow")){let d=h.slice(-41).trim();d.length!==40&&u(new Ys(d)),i.push(d)}else if(h.startsWith("unshallow")){let d=h.slice(-41).trim();d.length!==40&&u(new Ys(d)),s.push(d)}else if(h.startsWith("ACK")){let[,d,p]=h.split(" ");o.push({oid:d,status:p}),p||(l=!0)}else h.startsWith("NAK")?(a=!0,l=!0):(l=!0,a=!0);l&&(t.error?u(t.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:n,progress:r}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:n,progress:r}))})})}function L9({capabilities:t=[],wants:e=[],haves:n=[],shallows:r=[],depth:i=null,since:s=null,exclude:o=[]}){let a=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)a.push(gt.encode(`want ${c}${l}
|
||
`)),l="";for(let c of r)a.push(gt.encode(`shallow ${c}
|
||
`));i!==null&&a.push(gt.encode(`deepen ${i}
|
||
`)),s!==null&&a.push(gt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
|
||
`));for(let c of o)a.push(gt.encode(`deepen-not ${c}
|
||
`));a.push(gt.flush());for(let c of n)a.push(gt.encode(`have ${c}
|
||
`));return a.push(gt.encode(`done
|
||
`)),a}async function t1({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:l,ref:c,remoteRef:u,remote:f,url:h,corsProxy:d,depth:p=null,since:g=null,exclude:y=[],relative:w=!1,tags:b=!1,singleBranch:S=!1,headers:D={},prune:k=!1,pruneTags:E=!1}){let v=c||await io({fs:t,gitdir:l,test:!0}),_=await Et.get({fs:t,gitdir:l}),C=f||v&&await _.get(`branch.${v}.remote`)||"origin",A=h||await _.get(`remote.${C}.url`);if(typeof A>"u")throw new Rn("remote OR url");let P=u||v&&await _.get(`branch.${v}.merge`)||c||"HEAD";d===void 0&&(d=await _.get("http.corsProxy"));let N=bc.getRemoteHelperFor({url:A}),B=await N.discover({http:n,onAuth:s,onAuthSuccess:o,onAuthFailure:a,corsProxy:d,service:"git-upload-pack",url:A,headers:D,protocolVersion:1}),L=B.auth,G=B.refs;if(G.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!B.capabilities.has("shallow"))throw new Zs("shallow","depth");if(g!==null&&!B.capabilities.has("deepen-since"))throw new Zs("deepen-since","since");if(y.length>0&&!B.capabilities.has("deepen-not"))throw new Zs("deepen-not","exclude");if(w===!0&&!B.capabilities.has("deepen-relative"))throw new Zs("deepen-relative","relative");let{oid:U,fullref:he}=te.resolveAgainstMap({ref:P,map:G});for(let Ne of G.keys())Ne===he||Ne==="HEAD"||Ne.startsWith("refs/heads/")||b&&Ne.startsWith("refs/tags/")||G.delete(Ne);let Te=wO([...B.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Rp.agent}`]);w&&Te.push("deepen-relative");let Xe=S?[U]:G.values(),O=S?[v]:await te.listRefs({fs:t,gitdir:l,filepath:"refs"}),De=[];for(let Ne of O)try{Ne=await te.expand({fs:t,gitdir:l,ref:Ne});let lt=await te.resolve({fs:t,gitdir:l,ref:Ne});await qA({fs:t,cache:e,gitdir:l,oid:lt})&&De.push(lt)}catch{}De=[...new Set(De)];let ve=await xa.read({fs:t,gitdir:l}),I=B.capabilities.has("shallow")?[...ve]:[],Pe=L9({capabilities:Te,wants:Xe,haves:De,shallows:I,depth:p,since:g,exclude:y}),Nt=x.from(await Ip(Pe)),tt=await N.connect({http:n,onProgress:r,corsProxy:d,service:"git-upload-pack",url:A,auth:L,body:[Nt],headers:D}),Ve=await z9(tt.body);tt.headers&&(Ve.headers=tt.headers);for(let Ne of Ve.shallows)if(!ve.has(Ne))try{let{object:lt}=await ct({fs:t,cache:e,gitdir:l,oid:Ne}),At=new Ln(lt),dt=await Promise.all(At.headers().parent.map(Qn=>qA({fs:t,cache:e,gitdir:l,oid:Qn})));dt.length===0||dt.every(Qn=>Qn)||ve.add(Ne)}catch{ve.add(Ne)}for(let Ne of Ve.unshallows)ve.delete(Ne);if(await xa.write({fs:t,gitdir:l,oids:ve}),S){let Ne=new Map([[he,U]]),lt=new Map,At=10,dt=he;for(;At--;){let gi=B.symrefs.get(dt);if(gi===void 0)break;lt.set(dt,gi),dt=gi}let An=G.get(dt);An&&Ne.set(dt,An);let{pruned:Qn}=await te.updateRemoteRefs({fs:t,gitdir:l,remote:C,refs:Ne,symrefs:lt,tags:b,prune:k});k&&(Ve.pruned=Qn)}else{let{pruned:Ne}=await te.updateRemoteRefs({fs:t,gitdir:l,remote:C,refs:G,symrefs:B.symrefs,tags:b,prune:k,pruneTags:E});k&&(Ve.pruned=Ne)}if(Ve.HEAD=B.symrefs.get("HEAD"),Ve.HEAD===void 0){let{oid:Ne}=te.resolveAgainstMap({ref:"HEAD",map:G});for(let[lt,At]of G.entries())if(lt!=="HEAD"&&At===Ne){Ve.HEAD=lt;break}}let bt=he.startsWith("refs/tags")?"tag":"branch";if(Ve.FETCH_HEAD={oid:U,description:`${bt} '${ba(he)}' of ${A}`},r||i){let Ne=bO(Ve.progress);oh(Ne,async lt=>{if(i&&await i(lt),r){let At=lt.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);At&&await r({phase:At[1].trim(),loaded:parseInt(At[2],10),total:parseInt(At[3],10)})}})}let dn=x.from(await Ip(Ve.packfile));if(tt.body.error)throw tt.body.error;let It=dn.slice(-20).toString("hex"),Ut={defaultBranch:Ve.HEAD,fetchHead:Ve.FETCH_HEAD.oid,fetchHeadDescription:Ve.FETCH_HEAD.description};if(Ve.headers&&(Ut.headers=Ve.headers),k&&(Ut.pruned=Ve.pruned),It!==""&&!M9(dn)){Ut.packfile=`objects/pack/pack-${It}.pack`;let Ne=V(l,Ut.packfile);await t.write(Ne,dn);let lt=dt=>ct({fs:t,cache:e,gitdir:l,oid:dt}),At=await jf.fromPack({pack:dn,getExternalRefDelta:lt,onProgress:r});await t.write(Ne.replace(/\.pack$/,".idx"),await At.toBuffer())}return Ut}async function vO({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:V(n,".git"),defaultBranch:i="master"}){if(await t.exists(r+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(o=>r+"/"+o);for(let o of s)await t.mkdir(o);await t.write(r+"/config",`[core]
|
||
repositoryformatversion = 0
|
||
filemode = false
|
||
bare = ${e}
|
||
`+(e?"":` logallrefupdates = true
|
||
`)+` symlinks = false
|
||
ignorecase = true
|
||
`),await t.write(r+"/HEAD",`ref: refs/heads/${i}
|
||
`)}async function B9({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:h,ref:d,remote:p,depth:g,since:y,exclude:w,relative:b,singleBranch:S,noCheckout:D,noTags:k,headers:E,nonBlocking:v,batchSize:_=100}){try{if(await vO({fs:t,gitdir:u}),await hO({fs:t,gitdir:u,remote:p,url:f,force:!1}),h){let P=await Et.get({fs:t,gitdir:u});await P.set("http.corsProxy",h),await Et.save({fs:t,gitdir:u,config:P})}let{defaultBranch:C,fetchHead:A}=await t1({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:u,ref:d,remote:p,corsProxy:h,depth:g,since:y,exclude:w,relative:b,singleBranch:S,headers:E,tags:!k});if(A===null)return;d=d||C,d=d.replace("refs/heads/",""),await Xv({fs:t,cache:e,onProgress:r,onPostCheckout:l,dir:c,gitdir:u,ref:d,remote:p,noCheckout:D,nonBlocking:v,batchSize:_})}catch(C){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),C}}async function kO({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:c=V(l,".git"),url:u,corsProxy:f=void 0,ref:h=void 0,remote:d="origin",depth:p=void 0,since:g=void 0,exclude:y=[],relative:w=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:D=!1,headers:k={},cache:E={},nonBlocking:v=!1,batchSize:_=100}){try{R("fs",t),R("http",e),R("gitdir",c),S||R("dir",l),R("url",u);let C=new fe(t),A=await de({fsp:C,dotgit:c});return await B9({fs:C,cache:E,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:A,url:u,corsProxy:f,ref:h,remote:d,depth:p,since:g,exclude:y,relative:w,singleBranch:b,noCheckout:S,noTags:D,headers:k,nonBlocking:v,batchSize:_})}catch(C){throw C.caller="git.clone",C}}async function xO({fs:t,onSign:e,dir:n,gitdir:r=V(n,".git"),message:i,author:s,committer:o,signingKey:a,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:h,tree:d,cache:p={}}){try{R("fs",t),l||R("message",i),a&&R("onSign",e);let g=new fe(t),y=await de({fsp:g,dotgit:r});return await Mp({fs:g,cache:p,onSign:e,gitdir:y,message:i,author:s,committer:o,signingKey:a,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:h,tree:d})}catch(g){throw g.caller="git.commit",g}}async function SO({fs:t,dir:e,gitdir:n=V(e,".git"),fullname:r=!1,test:i=!1}){try{R("fs",t),R("gitdir",n);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await io({fs:s,gitdir:o,fullname:r,test:i})}catch(s){throw s.caller="git.currentBranch",s}}async function $9({fs:t,gitdir:e,ref:n}){if(n=n.startsWith("refs/heads/")?n:`refs/heads/${n}`,!await te.exists({fs:t,gitdir:e,ref:n}))throw new st(n);let i=await te.expand({fs:t,gitdir:e,ref:n}),s=await io({fs:t,gitdir:e,fullname:!0});if(i===s){let l=await te.resolve({fs:t,gitdir:e,ref:i});await te.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await te.deleteRef({fs:t,gitdir:e,ref:i});let o=ba(n),a=await Et.get({fs:t,gitdir:e});await a.deleteSection("branch",o),await Et.save({fs:t,gitdir:e,config:a})}async function DO({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r}){try{R("fs",t),R("ref",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await $9({fs:i,gitdir:s,ref:r})}catch(i){throw i.caller="git.deleteBranch",i}}async function EO({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r}){try{R("fs",t),R("ref",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});await te.deleteRef({fs:i,gitdir:s,ref:r})}catch(i){throw i.caller="git.deleteRef",i}}async function U9({fs:t,gitdir:e,remote:n}){let r=await Et.get({fs:t,gitdir:e});await r.deleteSection("remote",n),await Et.save({fs:t,gitdir:e,config:r})}async function _O({fs:t,dir:e,gitdir:n=V(e,".git"),remote:r}){try{R("fs",t),R("remote",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await U9({fs:i,gitdir:s,remote:r})}catch(i){throw i.caller="git.deleteRemote",i}}async function j9({fs:t,gitdir:e,ref:n}){n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,await te.deleteRef({fs:t,gitdir:e,ref:n})}async function CO({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r}){try{R("fs",t),R("ref",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await j9({fs:i,gitdir:s,ref:r})}catch(i){throw i.caller="git.deleteTag",i}}async function q9({fs:t,gitdir:e,oid:n}){let r=n.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map(s=>`${r}${s}`).filter(s=>s.startsWith(n))}async function V9({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let s=[],o=await t.readdir(V(n,"objects/pack"));o=o.filter(a=>a.endsWith(".idx"));for(let a of o){let l=`${n}/objects/pack/${a}`,c=await Jv({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new Ce(c.error);for(let u of c.offsets.keys())u.startsWith(r)&&s.push(u)}return s}async function H9({fs:t,cache:e,gitdir:n,oid:r}){let i=a=>ct({fs:t,cache:e,gitdir:n,oid:a}),s=await q9({fs:t,gitdir:n,oid:r}),o=await V9({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i});for(let a of o)s.indexOf(a)===-1&&s.push(a);if(s.length===1)return s[0];throw s.length>1?new qf("oids",r,s):new st(`an object matching "${r}"`)}async function TO({fs:t,dir:e,gitdir:n=V(e,".git"),oid:r,cache:i={}}){try{R("fs",t),R("gitdir",n),R("oid",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await H9({fs:s,cache:i,gitdir:o,oid:r})}catch(s){throw s.caller="git.expandOid",s}}async function FO({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r}){try{R("fs",t),R("gitdir",n),R("ref",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await te.expand({fs:i,gitdir:s,ref:r})}catch(i){throw i.caller="git.expandRef",i}}async function n1({fs:t,cache:e,gitdir:n,oids:r}){let i={},s=r.length,o=r.map((a,l)=>({index:l,oid:a}));for(;o.length;){let a=new Set;for(let{oid:c,index:u}of o)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===s&&a.add(c);if(a.size>0)return[...a];let l=new Map;for(let{oid:c,index:u}of o)try{let{object:f}=await ct({fs:t,cache:e,gitdir:n,oid:c}),h=Ln.from(f),{parent:d}=h.parseHeaders();for(let p of d)(!i[p]||!i[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch{}o=Array.from(l.values())}return[]}var Rv=/^.*(\r?\n|$)/gm;function W9({branches:t,contents:e}){let n=t[1],r=t[2],i=e[0],s=e[1],o=e[2],a=s.match(Rv),l=i.match(Rv),c=o.match(Rv),u=DW(a,l,c),f=7,h="",d=!0;for(let p of u)p.ok&&(h+=p.ok.join("")),p.conflict&&(d=!1,h+=`${"<".repeat(f)} ${n}
|
||
`,h+=p.conflict.a.join(""),h+=`${"=".repeat(f)}
|
||
`,h+=p.conflict.b.join(""),h+=`${">".repeat(f)} ${r}
|
||
`);return{cleanMerge:d,mergedText:h}}async function G9({fs:t,cache:e,dir:n,gitdir:r=V(n,".git"),index:i,ourOid:s,baseOid:o,theirOid:a,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:h=!0,mergeDriver:d}){let p=ar({ref:s}),g=ar({ref:o}),y=ar({ref:a}),w=[],b=[],S=[],D=[],k=await eo({fs:t,cache:e,dir:n,gitdir:r,trees:[p,g,y],map:async function(E,[v,_,C]){let A=Dp(E),P=await Fp(v,_),N=await Fp(C,_);switch(`${P}-${N}`){case"false-false":return{mode:await _.mode(),path:A,oid:await _.oid(),type:await _.type()};case"false-true":return!C&&await v.type()==="tree"?{mode:await v.mode(),path:A,oid:await v.oid(),type:await v.type()}:C?{mode:await C.mode(),path:A,oid:await C.oid(),type:await C.type()}:void 0;case"true-false":return!v&&await C.type()==="tree"?{mode:await C.mode(),path:A,oid:await C.oid(),type:await C.type()}:v?{mode:await v.mode(),path:A,oid:await v.oid(),type:await v.type()}:void 0;case"true-true":{if(v&&C&&await v.type()==="tree"&&await C.type()==="tree")return{mode:await v.mode(),path:A,oid:await v.oid(),type:"tree"};if(v&&C&&await v.type()==="blob"&&await C.type()==="blob")return Q9({fs:t,gitdir:r,path:A,ours:v,base:_,theirs:C,ourName:l,baseName:c,theirName:u,mergeDriver:d}).then(async B=>{if(B.cleanMerge)h||i.insert({filepath:E,oid:B.mergeResult.oid,stage:0});else if(w.push(E),b.push(E),!h){let L="";_&&await _.type()==="blob"&&(L=await _.oid());let G=await v.oid(),U=await C.oid();i.delete({filepath:E}),L&&i.insert({filepath:E,oid:L,stage:1}),i.insert({filepath:E,oid:G,stage:2}),i.insert({filepath:E,oid:U,stage:3})}return B.mergeResult});if(_&&!v&&C&&await _.type()==="blob"&&await C.type()==="blob"){if(w.push(E),S.push(E),!h){let B=await _.oid(),L=await C.oid();i.delete({filepath:E}),i.insert({filepath:E,oid:B,stage:1}),i.insert({filepath:E,oid:L,stage:3})}return{mode:await C.mode(),oid:await C.oid(),type:"blob",path:A}}if(_&&v&&!C&&await _.type()==="blob"&&await v.type()==="blob"){if(w.push(E),D.push(E),!h){let B=await _.oid(),L=await v.oid();i.delete({filepath:E}),i.insert({filepath:E,oid:B,stage:1}),i.insert({filepath:E,oid:L,stage:2})}return{mode:await v.mode(),oid:await v.oid(),type:"blob",path:A}}if(_&&!v&&!C&&(await _.type()==="blob"||await _.type()==="tree"))return;throw new fc}}},reduce:w.length!==0&&(!n||h)?void 0:async(E,v)=>{let _=v.filter(Boolean);if(E&&!(E&&E.type==="tree"&&_.length===0&&E.path!==".")){if(_.length>0||E.path==="."&&_.length===0){let A=new zn(_).toObject(),P=await Bn({fs:t,gitdir:r,type:"tree",object:A,dryRun:f});E.oid=P}return E}}});return w.length!==0?(n&&!h&&await eo({fs:t,cache:e,dir:n,gitdir:r,trees:[ar({ref:k.oid})],map:async function(E,[v]){let _=`${n}/${E}`;if(await v.type()==="blob"){let C=await v.mode(),A=new TextDecoder().decode(await v.content());await t.write(_,A,{mode:C})}return!0}}),new hc(w,b,S,D)):k.oid}async function Q9({fs:t,gitdir:e,path:n,ours:r,base:i,theirs:s,ourName:o,theirName:a,baseName:l,dryRun:c,mergeDriver:u=W9}){let f="blob",h="100755",d="",p="";i&&await i.type()==="blob"&&(h=await i.mode(),d=await i.oid(),p=x.from(await i.content()).toString("utf8"));let g=h===await r.mode()?await s.mode():await r.mode();if(await r.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await r.oid(),type:f}};if(await r.oid()===d)return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await s.oid(),type:f}};if(await s.oid()===d)return{cleanMerge:!0,mergeResult:{mode:g,path:n,oid:await r.oid(),type:f}};let y=x.from(await r.content()).toString("utf8"),w=x.from(await s.content()).toString("utf8"),{mergedText:b,cleanMerge:S}=await u({branches:[l,o,a],contents:[p,y,w],path:n}),D=await Bn({fs:t,gitdir:e,type:"blob",object:x.from(b,"utf8"),dryRun:c});return{cleanMerge:S,mergeResult:{mode:g,path:n,oid:D,type:f}}}async function IO({fs:t,cache:e,dir:n,gitdir:r,ours:i,theirs:s,fastForward:o=!0,fastForwardOnly:a=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,onSign:g,mergeDriver:y,allowUnrelatedHistories:w=!1}){i===void 0&&(i=await io({fs:t,gitdir:r,fullname:!0})),i=await te.expand({fs:t,gitdir:r,ref:i}),s=await te.expand({fs:t,gitdir:r,ref:s});let b=await te.resolve({fs:t,gitdir:r,ref:i}),S=await te.resolve({fs:t,gitdir:r,ref:s}),D=await n1({fs:t,cache:e,gitdir:r,oids:[b,S]});if(D.length!==1)if(D.length===0&&w)D.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new fc;let k=D[0];if(k===S)return{oid:b,alreadyMerged:!0};if(o&&k===b)return!l&&!c&&await te.writeRef({fs:t,gitdir:r,ref:i,value:S}),{oid:S,fastForward:!0};{if(a)throw new Gf;let E=await Tt.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async _=>G9({fs:t,cache:e,dir:n,gitdir:r,index:_,ourOid:b,theirOid:S,baseOid:k,ourName:ba(i),baseName:"base",theirName:ba(s),dryRun:l,abortOnConflict:u,mergeDriver:y}));if(E instanceof hc)throw E;return f||(f=`Merge branch '${ba(s)}' into ${ba(i)}`),{oid:await Mp({fs:t,cache:e,gitdir:r,message:f,ref:i,tree:E,parent:[b,S],author:h,committer:d,signingKey:p,onSign:g,dryRun:l,noUpdateBranch:c}),tree:E,mergeCommit:!0}}}async function AO({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,dir:l,gitdir:c,ref:u,url:f,remote:h,remoteRef:d,prune:p,pruneTags:g,fastForward:y,fastForwardOnly:w,corsProxy:b,singleBranch:S,headers:D,author:k,committer:E,signingKey:v}){try{if(!u){let A=await io({fs:t,gitdir:c});if(!A)throw new Rn("ref");u=A}let{fetchHead:_,fetchHeadDescription:C}=await t1({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:c,corsProxy:b,ref:u,url:f,remote:h,remoteRef:d,singleBranch:S,headers:D,prune:p,pruneTags:g});await IO({fs:t,cache:e,gitdir:c,ours:u,theirs:_,fastForward:y,fastForwardOnly:w,message:`Merge ${C}`,author:k,committer:E,signingKey:v,dryRun:!1,noUpdateBranch:!1}),await Xv({fs:t,cache:e,onProgress:r,dir:l,gitdir:c,ref:u,remote:h,noCheckout:!1})}catch(_){throw _.caller="git.pull",_}}async function OO({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=V(a,".git"),ref:c,url:u,remote:f,remoteRef:h,corsProxy:d,singleBranch:p,headers:g={},cache:y={}}){try{R("fs",t),R("http",e),R("gitdir",l);let w={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},b=new fe(t),S=await de({fsp:b,dotgit:l});return await AO({fs:b,cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:S,ref:c,url:u,remote:f,remoteRef:h,fastForwardOnly:!0,corsProxy:d,singleBranch:p,headers:g,author:w,committer:w})}catch(w){throw w.caller="git.fastForward",w}}async function PO({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=V(a,".git"),ref:c,remote:u,remoteRef:f,url:h,corsProxy:d,depth:p=null,since:g=null,exclude:y=[],relative:w=!1,tags:b=!1,singleBranch:S=!1,headers:D={},prune:k=!1,pruneTags:E=!1,cache:v={}}){try{R("fs",t),R("http",e),R("gitdir",l);let _=new fe(t),C=await de({fsp:_,dotgit:l});return await t1({fs:_,cache:v,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,gitdir:C,ref:c,remote:u,remoteRef:f,url:h,corsProxy:d,depth:p,since:g,exclude:y,relative:w,tags:b,singleBranch:S,headers:D,prune:k,pruneTags:E})}catch(_){throw _.caller="git.fetch",_}}async function NO({fs:t,dir:e,gitdir:n=V(e,".git"),oids:r,cache:i={}}){try{R("fs",t),R("gitdir",n),R("oids",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await n1({fs:s,cache:i,gitdir:o,oids:r})}catch(s){throw s.caller="git.findMergeBase",s}}async function MO({fs:t,filepath:e}){if(await t.exists(V(e,".git")))return e;{let n=va(e);if(n===e)throw new st(`git root for ${e}`);return MO({fs:t,filepath:n})}}async function RO({fs:t,filepath:e}){try{return R("fs",t),R("filepath",e),await MO({fs:new fe(t),filepath:e})}catch(n){throw n.caller="git.findRoot",n}}async function zO({fs:t,dir:e,gitdir:n=V(e,".git"),path:r}){try{R("fs",t),R("gitdir",n),R("path",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await nh({fs:i,gitdir:s,path:r})}catch(i){throw i.caller="git.getConfig",i}}async function K9({fs:t,gitdir:e,path:n}){return(await Et.get({fs:t,gitdir:e})).getall(n)}async function LO({fs:t,dir:e,gitdir:n=V(e,".git"),path:r}){try{R("fs",t),R("gitdir",n),R("path",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await K9({fs:i,gitdir:s,path:r})}catch(i){throw i.caller="git.getConfigAll",i}}async function BO({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:s,headers:o={},forPush:a=!1}){try{R("http",t),R("url",s);let c=await bc.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,h]of c.refs){let d=f.split("/"),p=d.pop(),g=u;for(let y of d)g[y]=g[y]||{},g=g[y];g[p]=h}for(let[f,h]of c.symrefs){let d=f.split("/"),p=d.pop(),g=u;for(let y of d)g[y]=g[y]||{},g=g[y];g[p]=h}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function $O(t,e,n,r){let i=[];for(let[s,o]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(r){let l=s.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=o}continue}let a={ref:s,oid:o};n&&t.symrefs.has(s)&&(a.target=t.symrefs.get(s)),i.push(a)}return i}async function UO({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:s,headers:o={},forPush:a=!1,protocolVersion:l=2}){try{R("http",t),R("url",s);let u=await bc.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let h of u.capabilities){let[d,p]=h.split("=");p?f[d]=p:f[d]=!0}return{protocolVersion:1,capabilities:f,refs:$O(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function Z9({type:t,object:e,format:n="content",oid:r=void 0}){return n!=="deflated"&&(n!=="wrapped"&&(e=Js.wrap({type:t,object:e})),r=await us(e)),{oid:r,object:e}}async function jO({object:t}){try{R("object",t),typeof t=="string"?t=x.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:n,object:r}=await Z9({type:e,format:"content",object:t});return{oid:n,type:e,object:r,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function Y9({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,filepath:s}){try{s=V(r,s);let o=await t.read(s),a=c=>ct({fs:t,cache:e,gitdir:i,oid:c}),l=await jf.fromPack({pack:o,getExternalRefDelta:a,onProgress:n});return await t.write(s.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(o){throw o.caller="git.indexPack",o}}async function qO({fs:t,onProgress:e,dir:n,gitdir:r=V(n,".git"),filepath:i,cache:s={}}){try{R("fs",t),R("dir",n),R("gitdir",n),R("filepath",i);let o=new fe(t),a=await de({fsp:o,dotgit:r});return await Y9({fs:o,cache:s,onProgress:e,dir:n,gitdir:a,filepath:i})}catch(o){throw o.caller="git.indexPack",o}}async function VO({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:V(n,".git"),defaultBranch:i="master"}){try{R("fs",t),R("gitdir",r),e||R("dir",n);let s=new fe(t),o=await de({fsp:s,dotgit:r});return await vO({fs:s,bare:e,dir:n,gitdir:o,defaultBranch:i})}catch(s){throw s.caller="git.init",s}}async function HO({fs:t,cache:e,gitdir:n,oid:r,ancestor:i,depth:s}){let o=await xa.read({fs:t,gitdir:n});if(!r)throw new Rn("oid");if(!i)throw new Rn("ancestor");if(r===i)return!1;let a=[r],l=new Set,c=0;for(;a.length;){if(c++===s)throw new Kf(s);let u=a.shift(),{type:f,object:h}=await ct({fs:t,cache:e,gitdir:n,oid:u});if(f!=="commit")throw new bn(u,f,"commit");let d=Ln.from(h).parse();for(let p of d.parent)if(p===i)return!0;if(!o.has(u))for(let p of d.parent)l.has(p)||(a.push(p),l.add(p))}return!1}async function WO({fs:t,dir:e,gitdir:n=V(e,".git"),oid:r,ancestor:i,depth:s=-1,cache:o={}}){try{R("fs",t),R("gitdir",n),R("oid",r),R("ancestor",i);let a=new fe(t),l=await de({fsp:a,dotgit:n});return await HO({fs:a,cache:o,gitdir:l,oid:r,ancestor:i,depth:s})}catch(a){throw a.caller="git.isDescendent",a}}async function GO({fs:t,dir:e,gitdir:n=V(e,".git"),filepath:r}){try{R("fs",t),R("dir",e),R("gitdir",n),R("filepath",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return to.isIgnored({fs:i,dir:e,gitdir:s,filepath:r})}catch(i){throw i.caller="git.isIgnored",i}}async function QO({fs:t,dir:e,gitdir:n=V(e,".git"),remote:r}){try{R("fs",t),R("gitdir",n);let i=new fe(t),s=await de({fsp:i,dotgit:n});return te.listBranches({fs:i,gitdir:s,remote:r})}catch(i){throw i.caller="git.listBranches",i}}async function J9({fs:t,gitdir:e,ref:n,cache:r}){if(n){let i=await te.resolve({gitdir:e,fs:t,ref:n}),s=[];return await KO({fs:t,cache:r,gitdir:e,oid:i,filenames:s,prefix:""}),s}else return Tt.acquire({fs:t,gitdir:e,cache:r},async function(i){return i.entries.map(s=>s.path)})}async function KO({fs:t,cache:e,gitdir:n,oid:r,filenames:i,prefix:s}){let{tree:o}=await xc({fs:t,cache:e,gitdir:n,oid:r});for(let a of o)a.type==="tree"?await KO({fs:t,cache:e,gitdir:n,oid:a.oid,filenames:i,prefix:V(s,a.path)}):i.push(V(s,a.path))}async function ZO({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r,cache:i={}}){try{R("fs",t),R("gitdir",n);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await J9({fs:s,cache:i,gitdir:o,ref:r})}catch(s){throw s.caller="git.listFiles",s}}async function X9({fs:t,cache:e,gitdir:n,ref:r}){let i;try{i=await te.resolve({gitdir:n,fs:t,ref:r})}catch(a){if(a instanceof st)return[]}return(await xc({fs:t,cache:e,gitdir:n,oid:i})).tree.map(a=>({target:a.path,note:a.oid}))}async function YO({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r="refs/notes/commits",cache:i={}}){try{R("fs",t),R("gitdir",n),R("ref",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await X9({fs:s,cache:i,gitdir:o,ref:r})}catch(s){throw s.caller="git.listNotes",s}}async function JO({fs:t,dir:e,gitdir:n=V(e,".git"),filepath:r}){try{R("fs",t),R("gitdir",n);let i=new fe(t),s=await de({fsp:i,dotgit:n});return te.listRefs({fs:i,gitdir:s,filepath:r})}catch(i){throw i.caller="git.listRefs",i}}async function eG({fs:t,gitdir:e}){let n=await Et.get({fs:t,gitdir:e}),r=await n.getSubsections("remote");return Promise.all(r.map(async s=>{let o=await n.get(`remote.${s}.url`);return{remote:s,url:o}}))}async function XO({fs:t,dir:e,gitdir:n=V(e,".git")}){try{R("fs",t),R("gitdir",n);let r=new fe(t),i=await de({fsp:r,dotgit:n});return await eG({fs:r,gitdir:i})}catch(r){throw r.caller="git.listRemotes",r}}async function tG(t){let e=gt.streamReader(t),n=[],r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let[i,s,...o]=r.split(" "),a={ref:s,oid:i};for(let l of o){let[c,u]=l.split(":");c==="symref-target"?a.target=u:c==="peeled"&&(a.peeled=u)}n.push(a)}return n}async function nG({prefix:t,symrefs:e,peelTags:n}){let r=[];return r.push(gt.encode(`command=ls-refs
|
||
`)),r.push(gt.encode(`agent=${Rp.agent}
|
||
`)),(n||e||t)&&r.push(gt.delim()),n&&r.push(gt.encode("peel")),e&&r.push(gt.encode("symrefs")),t&&r.push(gt.encode(`ref-prefix ${t}`)),r.push(gt.flush()),r}async function eP({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:s,headers:o={},forPush:a=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{R("http",t),R("url",s);let h=await wc.discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:l});if(h.protocolVersion===1)return $O(h,c,u,f);let d=await nG({prefix:c,symrefs:u,peelTags:f}),p=await wc.connect({http:t,auth:h.auth,headers:o,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,body:d});return tG(p.body)}catch(h){throw h.caller="git.listServerRefs",h}}async function tP({fs:t,dir:e,gitdir:n=V(e,".git")}){try{R("fs",t),R("gitdir",n);let r=new fe(t),i=await de({fsp:r,dotgit:n});return te.listTags({fs:r,gitdir:i})}catch(r){throw r.caller="git.listTags",r}}function rG(t,e){return t.committer.timestamp-e.committer.timestamp}var iG="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function VA({fs:t,cache:e,gitdir:n,oid:r,fileId:i}){if(i===iG)return;let s=r,o,a=await pc({fs:t,cache:e,gitdir:n,oid:r}),l=a.tree;return i===a.oid?o=a.path:(o=await nP({fs:t,cache:e,gitdir:n,tree:l,fileId:i,oid:s}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function nP({fs:t,cache:e,gitdir:n,tree:r,fileId:i,oid:s,filepaths:o=[],parentPath:a=""}){let l=r.entries().map(function(c){let u;return c.oid===i?(u=V(a,c.path),o.push(u)):c.type==="tree"&&(u=ct({fs:t,cache:e,gitdir:n,oid:c.oid}).then(function({object:f}){return nP({fs:t,cache:e,gitdir:n,tree:zn.from(f),fileId:i,oid:s,filepaths:o,parentPath:V(a,c.path)})})),u});return await Promise.all(l),o}async function sG({fs:t,cache:e,gitdir:n,filepath:r,ref:i,depth:s,since:o,force:a,follow:l}){let c=typeof o>"u"?void 0:Math.floor(o.valueOf()/1e3),u=[],f=await xa.read({fs:t,gitdir:n}),h=await te.resolve({fs:t,gitdir:n,ref:i}),d=[await yc({fs:t,cache:e,gitdir:n,oid:h})],p,g,y;function w(b){y&&r&&u.push(b)}for(;d.length>0;){let b=d.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(r){let S;try{S=await ih({fs:t,cache:e,gitdir:n,oid:b.commit.tree,filepath:r}),g&&p!==S&&u.push(g),p=S,g=b,y=!0}catch(D){if(D instanceof st){let k=l&&p;if(k&&(k=await VA({fs:t,cache:e,gitdir:n,oid:b.commit.tree,fileId:p}),k))if(Array.isArray(k)){if(g){let E=await VA({fs:t,cache:e,gitdir:n,oid:g.commit.tree,fileId:p});if(Array.isArray(E))if(k=k.filter(v=>E.indexOf(v)===-1),k.length===1)k=k[0],r=k,g&&u.push(g);else{k=!1,g&&u.push(g);break}}}else r=k,g&&u.push(g);if(!k){if(y&&p&&(u.push(g),!a))break;if(!a&&!l)throw D}g=b,y=!1}else throw D}}else u.push(b);if(s!==void 0&&u.length===s){w(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let D=await yc({fs:t,cache:e,gitdir:n,oid:S});d.map(k=>k.oid).includes(D.oid)||d.push(D)}d.length===0&&w(b),d.sort((S,D)=>rG(S.commit,D.commit))}return u}async function rP({fs:t,dir:e,gitdir:n=V(e,".git"),filepath:r,ref:i="HEAD",depth:s,since:o,force:a,follow:l,cache:c={}}){try{R("fs",t),R("gitdir",n),R("ref",i);let u=new fe(t),f=await de({fsp:u,dotgit:n});return await sG({fs:u,cache:c,gitdir:f,filepath:r,ref:i,depth:s,since:o,force:a,follow:l})}catch(u){throw u.caller="git.log",u}}async function iP({fs:t,onSign:e,dir:n,gitdir:r=V(n,".git"),ours:i,theirs:s,fastForward:o=!0,fastForwardOnly:a=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,cache:g={},mergeDriver:y,allowUnrelatedHistories:w=!1}){try{R("fs",t),p&&R("onSign",e);let b=new fe(t),S=await de({fsp:b,dotgit:r}),D=await no({fs:b,gitdir:S,author:h});if(!D&&(!a||!o))throw new ln("author");let k=await gc({fs:b,gitdir:S,author:D,committer:d});if(!k&&(!a||!o))throw new ln("committer");return await IO({fs:b,cache:g,dir:n,gitdir:S,ours:i,theirs:s,fastForward:o,fastForwardOnly:a,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:D,committer:k,signingKey:p,onSign:e,mergeDriver:y,allowUnrelatedHistories:w})}catch(b){throw b.caller="git.merge",b}}var oG={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function sP({fs:t,cache:e,dir:n,gitdir:r=V(n,".git"),oids:i}){let s=new WA,o=[];function a(u,f){let h=x.from(u,f);o.push(h),s.update(h)}async function l({stype:u,object:f}){let h=oG[u],d=f.length,p=d>15?128:0,g=d&15;d=d>>>4;let y=(p|h|g).toString(16);for(a(y,"hex");p;)p=d>127?128:0,y=p|d&127,a(Zv(2,y),"hex"),d=d>>>7;a(x.from(await iO(f)))}a("PACK"),a("00000002","hex"),a(Zv(8,i.length),"hex");for(let u of i){let{type:f,object:h}=await ct({fs:t,cache:e,gitdir:r,oid:u});await l({write:a,object:h,stype:f})}let c=s.digest();return o.push(c),o}async function aG({fs:t,cache:e,gitdir:n,oids:r,write:i}){let s=await sP({fs:t,cache:e,gitdir:n,oids:r}),o=x.from(await Ip(s)),l=`pack-${o.slice(-20).toString("hex")}.pack`;return i?(await t.write(V(n,`objects/pack/${l}`),o),{filename:l}):{filename:l,packfile:new Uint8Array(o)}}async function oP({fs:t,dir:e,gitdir:n=V(e,".git"),oids:r,write:i=!1,cache:s={}}){try{R("fs",t),R("gitdir",n),R("oids",r);let o=new fe(t),a=await de({fsp:o,dotgit:n});return await aG({fs:o,cache:s,gitdir:a,oids:r,write:i})}catch(o){throw o.caller="git.packObjects",o}}async function aP({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=V(a,".git"),ref:c,url:u,remote:f,remoteRef:h,prune:d=!1,pruneTags:p=!1,fastForward:g=!0,fastForwardOnly:y=!1,corsProxy:w,singleBranch:b,headers:S={},author:D,committer:k,signingKey:E,cache:v={}}){try{R("fs",t),R("gitdir",l);let _=new fe(t),C=await de({fsp:_,dotgit:l}),A=await no({fs:_,gitdir:C,author:D});if(!A)throw new ln("author");let P=await gc({fs:_,gitdir:C,author:A,committer:k});if(!P)throw new ln("committer");return await AO({fs:_,cache:v,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:C,ref:c,url:u,remote:f,remoteRef:h,fastForward:g,fastForwardOnly:y,corsProxy:w,singleBranch:b,headers:S,author:A,committer:P,signingKey:E,prune:d,pruneTags:p})}catch(_){throw _.caller="git.pull",_}}async function lG({fs:t,cache:e,dir:n,gitdir:r=V(n,".git"),start:i,finish:s}){let o=await xa.read({fs:t,gitdir:r}),a=new Set,l=new Set;for(let f of i)a.add(await te.resolve({fs:t,gitdir:r,ref:f}));for(let f of s)try{let h=await te.resolve({fs:t,gitdir:r,ref:f});l.add(h)}catch{}let c=new Set;async function u(f){c.add(f);let{type:h,object:d}=await ct({fs:t,cache:e,gitdir:r,oid:f});if(h==="tag"){let g=lr.from(d).headers().object;return u(g)}if(h!=="commit")throw new bn(f,h,"commit");if(!o.has(f)){let g=Ln.from(d).headers().parent;for(f of g)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of a)await u(f);return c}async function zv({fs:t,cache:e,dir:n,gitdir:r=V(n,".git"),oids:i}){let s=new Set;async function o(a){if(s.has(a))return;s.add(a);let{type:l,object:c}=await ct({fs:t,cache:e,gitdir:r,oid:a});if(l==="tag"){let f=lr.from(c).headers().object;await o(f)}else if(l==="commit"){let f=Ln.from(c).headers().tree;await o(f)}else if(l==="tree"){let u=zn.from(c);for(let f of u)f.type==="blob"&&s.add(f.oid),f.type==="tree"&&await o(f.oid)}}for(let a of i)await o(a);return s}async function cG(t){let e={},n="",r=gt.streamReader(t),i=await r();for(;i!==!0;)i!==null&&(n+=i.toString("utf8")+`
|
||
`),i=await r();let s=n.toString("utf8").split(`
|
||
`);if(i=s.shift(),!i.startsWith("unpack "))throw new ka('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let o of s){if(o.trim()==="")continue;let a=o.slice(0,2),l=o.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:a==="ok",error:f}}return e}async function uG({capabilities:t=[],triplets:e=[]}){let n=[],r=`\0 ${t.join(" ")}`;for(let i of e)n.push(gt.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${r}
|
||
`)),r="";return n.push(gt.flush()),n}async function fG({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:h,url:d,force:p=!1,delete:g=!1,corsProxy:y,headers:w={}}){let b=u||await io({fs:t,gitdir:c});if(typeof b>"u")throw new Rn("ref");let S=await Et.get({fs:t,gitdir:c});h=h||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let D=d||await S.get(`remote.${h}.pushurl`)||await S.get(`remote.${h}.url`);if(typeof D>"u")throw new Rn("remote OR url");let k=f||await S.get(`branch.${b}.merge`);if(typeof D>"u")throw new Rn("remoteRef");y===void 0&&(y=await S.get("http.corsProxy"));let E=await te.expand({fs:t,gitdir:c,ref:b}),v=g?"0000000000000000000000000000000000000000":await te.resolve({fs:t,gitdir:c,ref:E}),_=bc.getRemoteHelperFor({url:D}),C=await _.discover({http:n,onAuth:s,onAuthSuccess:o,onAuthFailure:a,corsProxy:y,service:"git-receive-pack",url:D,headers:w,protocolVersion:1}),A=C.auth,P;if(!k)P=E;else try{P=await te.expandAgainstMap({ref:k,map:C.refs})}catch(ve){if(ve instanceof st)P=k.startsWith("refs/")?k:`refs/heads/${k}`;else throw ve}let N=C.refs.get(P)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:h,url:D,localRef:{ref:g?"(delete)":E,oid:v},remoteRef:{ref:P,oid:N}}))throw new mc;let B=!C.capabilities.has("no-thin"),L=new Set;if(!g){let ve=[...C.refs.values()],I=new Set;if(N!=="0000000000000000000000000000000000000000"){let Pe=await n1({fs:t,cache:e,gitdir:c,oids:[v,N]});for(let Nt of Pe)ve.push(Nt);B&&(I=await zv({fs:t,cache:e,gitdir:c,oids:Pe}))}if(!ve.includes(v)){let Pe=await lG({fs:t,cache:e,gitdir:c,start:[v],finish:ve});L=await zv({fs:t,cache:e,gitdir:c,oids:Pe})}if(B){try{let Pe=await te.resolve({fs:t,gitdir:c,ref:`refs/remotes/${h}/HEAD`,depth:2}),{oid:Nt}=await te.resolveAgainstMap({ref:Pe.replace(`refs/remotes/${h}/`,""),fullref:Pe,map:C.refs}),tt=[Nt];for(let Ve of await zv({fs:t,cache:e,gitdir:c,oids:tt}))I.add(Ve)}catch{}for(let Pe of I)L.delete(Pe)}if(v===N&&(p=!0),!p){if(E.startsWith("refs/tags")&&N!=="0000000000000000000000000000000000000000")throw new dc("tag-exists");if(v!=="0000000000000000000000000000000000000000"&&N!=="0000000000000000000000000000000000000000"&&!await HO({fs:t,cache:e,gitdir:c,oid:v,ancestor:N,depth:-1}))throw new dc("not-fast-forward")}}let G=wO([...C.capabilities],["report-status","side-band-64k",`agent=${Rp.agent}`]),U=await uG({capabilities:G,triplets:[{oldoid:N,oid:v,fullRef:P}]}),he=g?[]:await sP({fs:t,cache:e,gitdir:c,oids:[...L]}),Te=await _.connect({http:n,onProgress:r,corsProxy:y,service:"git-receive-pack",url:D,auth:A,headers:w,body:[...U,...he]}),{packfile:Xe,progress:O}=await Ap.demux(Te.body);if(i){let ve=bO(O);oh(ve,async I=>{await i(I)})}let De=await cG(Xe);if(Te.headers&&(De.headers=Te.headers),h&&De.ok&&De.refs[P].ok&&!E.startsWith("refs/tags")){let ve=`refs/remotes/${h}/${P.replace("refs/heads","")}`;g?await te.deleteRef({fs:t,gitdir:c,ref:ve}):await te.writeRef({fs:t,gitdir:c,ref:ve,value:v})}if(De.ok&&Object.values(De.refs).every(ve=>ve.ok))return De;{let ve=Object.entries(De.refs).filter(([I,Pe])=>!Pe.ok).map(([I,Pe])=>`
|
||
- ${I}: ${Pe.error}`).join("");throw new Qf(ve,De)}}async function lP({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,dir:l,gitdir:c=V(l,".git"),ref:u,remoteRef:f,remote:h="origin",url:d,force:p=!1,delete:g=!1,corsProxy:y,headers:w={},cache:b={}}){try{R("fs",t),R("http",e),R("gitdir",c);let S=new fe(t),D=await de({fsp:S,dotgit:c});return await fG({fs:S,cache:b,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,gitdir:D,ref:u,remoteRef:f,remote:h,url:d,force:p,delete:g,corsProxy:y,headers:w})}catch(S){throw S.caller="git.push",S}}async function cP({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:s}=await ct({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=lr.from(s).parse().object,cP({fs:t,cache:e,gitdir:n,oid:r});if(i!=="blob")throw new bn(r,i,"blob");return{oid:r,blob:new Uint8Array(s)}}async function uP({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){return i!==void 0&&(r=await ih({fs:t,cache:e,gitdir:n,oid:r,filepath:i})),await cP({fs:t,cache:e,gitdir:n,oid:r})}async function fP({fs:t,dir:e,gitdir:n=V(e,".git"),oid:r,filepath:i,cache:s={}}){try{R("fs",t),R("gitdir",n),R("oid",r);let o=new fe(t),a=await de({fsp:o,dotgit:n});return await uP({fs:o,cache:s,gitdir:a,oid:r,filepath:i})}catch(o){throw o.caller="git.readBlob",o}}async function r1({fs:t,dir:e,gitdir:n=V(e,".git"),oid:r,cache:i={}}){try{R("fs",t),R("gitdir",n),R("oid",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await yc({fs:s,cache:i,gitdir:o,oid:r})}catch(s){throw s.caller="git.readCommit",s}}async function hG({fs:t,cache:e,gitdir:n,ref:r="refs/notes/commits",oid:i}){let s=await te.resolve({gitdir:n,fs:t,ref:r}),{blob:o}=await uP({fs:t,cache:e,gitdir:n,oid:s,filepath:i});return o}async function hP({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r="refs/notes/commits",oid:i,cache:s={}}){try{R("fs",t),R("gitdir",n),R("ref",r),R("oid",i);let o=new fe(t),a=await de({fsp:o,dotgit:n});return await hG({fs:o,cache:s,gitdir:a,ref:r,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function dP({fs:t,dir:e,gitdir:n=V(e,".git"),oid:r,format:i="parsed",filepath:s=void 0,encoding:o=void 0,cache:a={}}){try{R("fs",t),R("gitdir",n),R("oid",r);let l=new fe(t),c=await de({fsp:l,dotgit:n});s!==void 0&&(r=await ih({fs:l,cache:a,gitdir:c,oid:r,filepath:s}));let f=await ct({fs:l,cache:a,gitdir:c,oid:r,format:i==="parsed"?"content":i});if(f.oid=r,i==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Ln.from(f.object).parse();break;case"tree":f.object=zn.from(f.object).entries();break;case"blob":o?f.object=f.object.toString(o):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=lr.from(f.object).parse();break;default:throw new bn(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function dG({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:s}=await ct({fs:t,cache:e,gitdir:n,oid:r,format:"content"});if(i!=="tag")throw new bn(r,i,"tag");let o=lr.from(s);return{oid:r,tag:o.parse(),payload:o.payload()}}async function mP({fs:t,dir:e,gitdir:n=V(e,".git"),oid:r,cache:i={}}){try{R("fs",t),R("gitdir",n),R("oid",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await dG({fs:s,cache:i,gitdir:o,oid:r})}catch(s){throw s.caller="git.readTag",s}}async function pP({fs:t,dir:e,gitdir:n=V(e,".git"),oid:r,filepath:i=void 0,cache:s={}}){try{R("fs",t),R("gitdir",n),R("oid",r);let o=new fe(t),a=await de({fsp:o,dotgit:n});return await xc({fs:o,cache:s,gitdir:a,oid:r,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function gP({fs:t,dir:e,gitdir:n=V(e,".git"),filepath:r,cache:i={}}){try{R("fs",t),R("gitdir",n),R("filepath",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});await Tt.acquire({fs:s,gitdir:o,cache:i},async function(a){a.delete({filepath:r})})}catch(s){throw s.caller="git.remove",s}}async function mG({fs:t,cache:e,onSign:n,gitdir:r,ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l}){let c;try{c=await te.resolve({gitdir:r,fs:t,ref:i})}catch(p){if(!(p instanceof st))throw p}let f=(await xc({fs:t,cache:e,gitdir:r,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let h=await sh({fs:t,gitdir:r,tree:f});return await Mp({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:h,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
|
||
`,author:o,committer:a,signingKey:l})}async function yP({fs:t,onSign:e,dir:n,gitdir:r=V(n,".git"),ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l,cache:c={}}){try{R("fs",t),R("gitdir",r),R("oid",s);let u=new fe(t),f=await de({fsp:u,dotgit:r}),h=await no({fs:u,gitdir:f,author:o});if(!h)throw new ln("author");let d=await gc({fs:u,gitdir:f,author:h,committer:a});if(!d)throw new ln("committer");return await mG({fs:u,cache:c,onSign:e,gitdir:f,ref:i,oid:s,author:h,committer:d,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function pG({fs:t,gitdir:e,oldref:n,ref:r,checkout:i=!1}){if(!rh(r,!0))throw new si(r,Bf.clean(r));if(!rh(n,!0))throw new si(n,Bf.clean(n));let s=`refs/heads/${n}`,o=`refs/heads/${r}`;if(await te.exists({fs:t,gitdir:e,ref:o}))throw new ii("branch",r,!1);let l=await te.resolve({fs:t,gitdir:e,ref:s,depth:1});await te.writeRef({fs:t,gitdir:e,ref:o,value:l}),await te.deleteRef({fs:t,gitdir:e,ref:s});let u=await io({fs:t,gitdir:e,fullname:!0})===s;(i||u)&&await te.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:o})}async function wP({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r,oldref:i,checkout:s=!1}){try{R("fs",t),R("gitdir",n),R("ref",r),R("oldref",i);let o=new fe(t),a=await de({fsp:o,dotgit:n});return await pG({fs:o,gitdir:a,ref:r,oldref:i,checkout:s})}catch(o){throw o.caller="git.renameBranch",o}}async function bP({gitdir:t,type:e,object:n}){return us(Js.wrap({type:e,object:n}))}async function vP({fs:t,dir:e,gitdir:n=V(e,".git"),filepath:r,ref:i,cache:s={}}){try{R("fs",t),R("gitdir",n),R("filepath",r);let o=new fe(t),a=await de({fsp:o,dotgit:n}),l,c;try{l=await te.resolve({fs:o,gitdir:a,ref:i||"HEAD"})}catch(h){if(i)throw h}if(l)try{l=await ih({fs:o,cache:s,gitdir:a,oid:l,filepath:r})}catch{l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await o.read(V(e,r));f&&(c=await bP({gitdir:a,type:"blob",object:f}),l===c&&(u=await o.lstat(V(e,r)))),await Tt.acquire({fs:o,gitdir:a,cache:s},async function(h){h.delete({filepath:r}),l&&h.insert({filepath:r,stats:u,oid:l})})}catch(o){throw o.caller="git.reset",o}}async function kP({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r,depth:i}){try{R("fs",t),R("gitdir",n),R("ref",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});return await te.resolve({fs:s,gitdir:o,ref:r,depth:i})}catch(s){throw s.caller="git.resolveRef",s}}async function xP({fs:t,dir:e,gitdir:n=V(e,".git"),path:r,value:i,append:s=!1}){try{R("fs",t),R("gitdir",n),R("path",r);let o=new fe(t),a=await de({fsp:o,dotgit:n}),l=await Et.get({fs:o,gitdir:a});s?await l.append(r,i):await l.set(r,i),await Et.save({fs:o,gitdir:a,config:l})}catch(o){throw o.caller="git.setConfig",o}}async function SP({fs:t,gitdir:e,commit:n}){let r=Ln.from(n).toObject();return await Bn({fs:t,gitdir:e,type:"commit",object:r,format:"content"})}var Op=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),n=Math.abs(Math.floor(e/60)),r=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${n.toString().padStart(2,"0")}${r}`}static createStashReflogEntry(e,n,r){let i=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",o=Math.floor(Date.now()/1e3),a=t.timezoneOffsetForRefLogEntry;return`${s} ${n} ${i} ${e.email} ${o} ${a} ${r}
|
||
`}static getStashReflogEntry(e,n=!1){return e.split(`
|
||
`).filter(s=>s).reverse().map((s,o)=>n?`stash@{${o}}: ${s.split(" ")[1]}`:s)}},gG={stage:Da,workdir:kc},Lv;async function vc(t,e){return Lv===void 0&&(Lv=new Lf),Lv.acquire(t,e)}async function yG(t,e,n,r,i=null){let s=V(n,r),o=await t.lstat(s);if(!o)throw new st(s);if(o.isDirectory())throw new Ce(`${s}: file expected, but found directory`);let a=i?await JA({fs:t,gitdir:e,oid:i}):void 0,l=a?i:void 0;return a||await vc({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=o.isSymbolicLink()?await t.readlink(s).then(sO):await t.read(s);if(c===null)throw new st(s);l=await Bn({fs:t,gitdir:e,type:"blob",object:c})}),l}async function wG({fs:t,dir:e,gitdir:n,entries:r}){async function i(s){if(s.type==="tree"){if(!s.oid){let o=await Promise.all(s.children.map(i));s.oid=await sh({fs:t,gitdir:n,tree:o}),s.mode=16384}}else s.type==="blob"&&(s.oid=await yG(t,n,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(r.map(i))}async function HA({fs:t,dir:e,gitdir:n,treePair:r}){let i=r[1]==="stage",s=r.map(d=>typeof d=="string"?gG[d]():d),o=[],u=await eo({fs:t,cache:{},dir:e,gitdir:n,trees:s,map:async(d,[p,g])=>{if(!(d==="."||await to.isIgnored({fs:t,dir:e,gitdir:n,filepath:d}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&o.push([p,g]),{mode:await g.mode(),path:d,oid:await g.oid(),type:await g.type()}},reduce:async(d,p)=>(p=p.filter(Boolean),d?(d.children=p,d):p.length>0?p:void 0),iterate:async(d,p)=>{let g=[];for(let y of p){let[w,b]=y;i?b&&(await t.exists(`${e}/${b.toString()}`)?g.push(y):o.push([null,b])):w&&(b?g.push(y):o.push([w,null]))}return g.length?Promise.all(g.map(d)):[]}});if(o.length===0||u.length===0)return null;let h=(await wG({fs:t,dir:e,gitdir:n,entries:u})).filter(Boolean).map(d=>({mode:d.mode,path:d.path,oid:d.oid,type:d.type}));return sh({fs:t,gitdir:n,tree:h})}async function bG({fs:t,dir:e,gitdir:n,stashCommit:r,parentCommit:i,wasStaged:s}){let o=[],a=[],l=await eo({fs:t,cache:{},dir:e,gitdir:n,trees:[ar({ref:i}),ar({ref:r})],map:async(c,[u,f])=>{if(c==="."||await to.isIgnored({fs:t,dir:e,gitdir:n,filepath:c}))return;let h=f?await f.type():await u.type();if(h!=="tree"&&h!=="blob")return;if(!f&&u){let p=h==="tree"?"rmdir":"rm";return h==="tree"&&o.push(c),h==="blob"&&s&&a.push({filepath:c,oid:await u.oid()}),{method:p,filepath:c}}let d=await f.oid();if(!u||await u.oid()!==d)return h==="tree"?{method:"mkdir",filepath:c}:(s&&a.push({filepath:c,oid:d,stats:await t.lstat(V(e,c))}),{method:"write",filepath:c,oid:d})}});await vc({fs:t,gitdir:n,dirRemoved:o,ops:l},async()=>{for(let c of l){let u=V(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!o.some(f=>u.startsWith(f))){let{object:f}=await ct({fs:t,cache:{},gitdir:n,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,f)}break}}}),await Tt.acquire({fs:t,gitdir:n,cache:{}},async c=>{a.forEach(({filepath:u,stats:f,oid:h})=>{c.insert({filepath:u,stats:f,oid:h})})})}var Sa=class t{constructor({fs:e,dir:n,gitdir:r=V(n,".git")}){Object.assign(this,{fs:e,dir:n,gitdir:r,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return V(this.gitdir,t.refStash)}get refLogsStashPath(){return V(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await no({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new ln("author");return this._author}async getStashSHA(e,n){return await this.fs.exists(this.refStashPath)?(n||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:n,parent:r}){return SP({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:n,parent:r,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let n=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>n.length-1))throw new si(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let r=await this.getStashSHA(e,n);return r?yc({fs:this.fs,cache:{},gitdir:this.gitdir,oid:r}):{}}async writeStashRef(e){return te.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:n}){let r=await this.getAuthor(),i=Op.createStashReflogEntry(r,e,n),s=this.refLogsStashPath;await vc({filepath:s,entry:i},async()=>{let o=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,o+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let n=await this.fs.read(this.refLogsStashPath,"utf8");return Op.getStashReflogEntry(n,e)}};async function DP({fs:t,dir:e,gitdir:n,message:r=""}){let i=new Sa({fs:t,dir:e,gitdir:n});await i.getAuthor();let s=await io({fs:t,gitdir:n,fullname:!1}),o=await te.resolve({fs:t,gitdir:n,ref:"HEAD"}),l=(await r1({fs:t,dir:e,gitdir:n,oid:o})).commit.message,c=[o],u=null,f=ar({ref:"HEAD"}),h=await HA({fs:t,dir:e,gitdir:n,treePair:[ar({ref:"HEAD"}),"stage"]});if(h){let y=await i.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:c});c.push(y),u=h,f=Da()}let d=await HA({fs:t,dir:e,gitdir:n,treePair:[f,"workdir"]});if(d){let y=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:[c[c.length-1]]});c.push(y),u=d}if(!u||!h&&!d)throw new st("changes, nothing to stash");let p=(r.trim()||`WIP on ${s}`)+`: ${o.substring(0,7)} ${l}`;return{stashCommit:await i.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:i}}async function vG({fs:t,dir:e,gitdir:n,message:r=""}){let{stashCommit:i,stashMsg:s,branch:o,stashMgr:a}=await DP({fs:t,dir:e,gitdir:n,message:r});return await a.writeStashRef(i),await a.writeStashReflogEntry({stashCommit:i,message:s}),await e1({fs:t,dir:e,gitdir:n,ref:o,track:!1,force:!0}),i}async function kG({fs:t,dir:e,gitdir:n,message:r=""}){let{stashCommit:i}=await DP({fs:t,dir:e,gitdir:n,message:r});return i}async function EP({fs:t,dir:e,gitdir:n,refIdx:r=0}){let s=await new Sa({fs:t,dir:e,gitdir:n}).readStashCommit(r),{parent:o=null}=s.commit?s.commit:{};if(!(!o||!Array.isArray(o)))for(let a=0;a<o.length-1;a++){let c=(await yc({fs:t,cache:{},gitdir:n,oid:o[a+1]})).commit.message.startsWith("stash-Index");await bG({fs:t,dir:e,gitdir:n,stashCommit:o[a+1],parentCommit:o[a],wasStaged:c})}}async function _P({fs:t,dir:e,gitdir:n,refIdx:r=0}){let i=new Sa({fs:t,dir:e,gitdir:n});if(!(await i.readStashCommit(r)).commit)return;let o=i.refStashPath;await vc(o,async()=>{await t.exists(o)&&await t.rm(o)});let a=await i.readStashReflogs({parsed:!1});if(!a.length)return;a.splice(r,1);let l=i.refLogsStashPath;await vc({reflogEntries:a,stashReflogPath:l,stashMgr:i},async()=>{if(a.length){await t.write(l,a.reverse().join(`
|
||
`)+`
|
||
`,"utf8");let c=a[a.length-1].split(" ")[1];await i.writeStashRef(c)}else await t.rm(l)})}async function xG({fs:t,dir:e,gitdir:n}){return new Sa({fs:t,dir:e,gitdir:n}).readStashReflogs({parsed:!0})}async function SG({fs:t,dir:e,gitdir:n}){let r=new Sa({fs:t,dir:e,gitdir:n}),i=[r.refStashPath,r.refLogsStashPath];await vc(i,async()=>{await Promise.all(i.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function DG({fs:t,dir:e,gitdir:n,refIdx:r=0}){await EP({fs:t,dir:e,gitdir:n,refIdx:r}),await _P({fs:t,dir:e,gitdir:n,refIdx:r})}async function CP({fs:t,dir:e,gitdir:n=V(e,".git"),op:r="push",message:i="",refIdx:s=0}){R("fs",t),R("dir",e),R("gitdir",n),R("op",r);let o={push:vG,apply:EP,drop:_P,list:xG,clear:SG,pop:DG,create:kG},a=["apply","drop","pop"];try{let l=new fe(t),c=await de({fsp:l,dotgit:n});["refs","logs","logs/refs"].map(h=>V(c,h)).forEach(async h=>{await l.exists(h)||await l.mkdir(h)});let f=o[r];if(f){if(a.includes(r)&&s<0)throw new si(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:i,refIdx:s})}throw new Error(`To be implemented: ${r}`)}catch(l){throw l.caller="git.stash",l}}async function TP({fs:t,dir:e,gitdir:n=V(e,".git"),filepath:r,cache:i={}}){try{R("fs",t),R("gitdir",n),R("filepath",r);let s=new fe(t),o=await de({fsp:s,dotgit:n});if(await to.isIgnored({fs:s,gitdir:o,dir:e,filepath:r}))return"ignored";let l=await EG({fs:s,cache:i,gitdir:o}),c=await FP({fs:s,cache:i,gitdir:o,tree:l,path:r}),u=await Tt.acquire({fs:s,gitdir:o,cache:i},async function(y){for(let w of y)if(w.path===r)return w;return null}),f=await s.lstat(V(e,r)),h=c!==null,d=u!==null,p=f!==null,g=async()=>{if(d&&!Sp(u,f))return u.oid;{let y=await s.read(V(e,r)),w=await bP({gitdir:o,type:"blob",object:y});return d&&u.oid===w&&f.size!==-1&&Tt.acquire({fs:s,gitdir:o,cache:i},async function(b){b.insert({filepath:r,stats:f,oid:w})}),w}};if(!h&&!p&&!d)return"absent";if(!h&&!p&&d)return"*absent";if(!h&&p&&!d)return"*added";if(!h&&p&&d)return await g()===u.oid?"added":"*added";if(h&&!p&&!d)return"deleted";if(h&&!p&&d)return c===u.oid,"*deleted";if(h&&p&&!d)return await g()===c?"*undeleted":"*undeletemodified";if(h&&p&&d){let y=await g();return y===c?y===u.oid?"unmodified":"*unmodified":y===u.oid?"modified":"*modified"}}catch(s){throw s.caller="git.status",s}}async function FP({fs:t,cache:e,gitdir:n,tree:r,path:i}){typeof i=="string"&&(i=i.split("/"));let s=i.shift();for(let o of r)if(o.path===s){if(i.length===0)return o.oid;let{type:a,object:l}=await ct({fs:t,cache:e,gitdir:n,oid:o.oid});if(a==="tree"){let c=zn.from(l);return FP({fs:t,cache:e,gitdir:n,tree:c,path:i})}if(a==="blob")throw new bn(o.oid,a,"blob",i.join("/"))}return null}async function EG({fs:t,cache:e,gitdir:n}){let r;try{r=await te.resolve({fs:t,gitdir:n,ref:"HEAD"})}catch(s){if(s instanceof st)return[]}let{tree:i}=await xc({fs:t,cache:e,gitdir:n,oid:r});return i}async function IP({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r="HEAD",filepaths:i=["."],filter:s,cache:o={},ignored:a=!1}){try{R("fs",t),R("gitdir",n),R("ref",r);let l=new fe(t),c=await de({fsp:l,dotgit:n});return await eo({fs:l,cache:o,dir:e,gitdir:c,trees:[ar({ref:r}),kc(),Da()],map:async function(u,[f,h,d]){if(!f&&!d&&h&&!a&&await to.isIgnored({fs:l,dir:e,filepath:u})||!i.some(v=>gO(u,v)))return null;if(s&&!s(u))return;let[p,g,y]=await Promise.all([f&&f.type(),h&&h.type(),d&&d.type()]),w=[p,g,y].includes("blob");if((p==="tree"||p==="special")&&!w)return;if(p==="commit")return null;if((g==="tree"||g==="special")&&!w)return;if(y==="commit")return null;if((y==="tree"||y==="special")&&!w)return;let b=p==="blob"?await f.oid():void 0,S=y==="blob"?await d.oid():void 0,D;p!=="blob"&&g==="blob"&&y!=="blob"?D="42":g==="blob"&&(D=await h.oid());let k=[void 0,b,D,S],E=k.map(v=>k.indexOf(v));return E.shift(),[u,...E]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function AP({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r,object:i,force:s=!1}){try{R("fs",t),R("gitdir",n),R("ref",r);let o=new fe(t);if(r===void 0)throw new Rn("ref");r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`;let a=await de({fsp:o,dotgit:n}),l=await te.resolve({fs:o,gitdir:a,ref:i||"HEAD"});if(!s&&await te.exists({fs:o,gitdir:a,ref:r}))throw new ii("tag",r);await te.writeRef({fs:o,gitdir:a,ref:r,value:l})}catch(o){throw o.caller="git.tag",o}}async function OP({fs:t,dir:e,gitdir:n=V(e,".git"),cache:r={},filepath:i,oid:s,mode:o,add:a,remove:l,force:c}){try{R("fs",t),R("gitdir",n),R("filepath",i);let u=new fe(t),f=await de({fsp:u,dotgit:n});if(l)return await Tt.acquire({fs:u,gitdir:f,cache:r},async function(d){if(!c){let p=await u.lstat(V(e,i));if(p){if(p.isDirectory())throw new Xs("directory");return}}d.has({filepath:i})&&d.delete({filepath:i})});let h;if(!s){if(h=await u.lstat(V(e,i)),!h)throw new st(`file at "${i}" on disk and "remove" not set`);if(h.isDirectory())throw new Xs("directory")}return await Tt.acquire({fs:u,gitdir:f,cache:r},async function(d){if(!a&&!d.has({filepath:i}))throw new st(`file at "${i}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{p=h;let g=p.isSymbolicLink()?await u.readlink(V(e,i)):await u.read(V(e,i));s=await Bn({fs:u,gitdir:f,type:"blob",format:"content",object:g})}return d.insert({filepath:i,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}function PP(){try{return Rp.version}catch(t){throw t.caller="git.version",t}}async function NP({fs:t,dir:e,gitdir:n=V(e,".git"),trees:r,map:i,reduce:s,iterate:o,cache:a={}}){try{R("fs",t),R("gitdir",n),R("trees",r);let l=new fe(t),c=await de({fsp:l,dotgit:n});return await eo({fs:l,cache:a,dir:e,gitdir:c,trees:r,map:i,reduce:s,iterate:o})}catch(l){throw l.caller="git.walk",l}}async function MP({fs:t,dir:e,gitdir:n=V(e,".git"),blob:r}){try{R("fs",t),R("gitdir",n),R("blob",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await Bn({fs:i,gitdir:s,type:"blob",object:r,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function RP({fs:t,dir:e,gitdir:n=V(e,".git"),commit:r}){try{R("fs",t),R("gitdir",n),R("commit",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await SP({fs:i,gitdir:s,commit:r})}catch(i){throw i.caller="git.writeCommit",i}}async function zP({fs:t,dir:e,gitdir:n=V(e,".git"),type:r,object:i,format:s="parsed",oid:o,encoding:a=void 0}){try{let l=new fe(t),c=await de({fsp:l,dotgit:n});if(s==="parsed"){switch(r){case"commit":i=Ln.from(i).toObject();break;case"tree":i=zn.from(i).toObject();break;case"blob":i=x.from(i,a);break;case"tag":i=lr.from(i).toObject();break;default:throw new bn(o||"",r,"blob|commit|tag|tree")}s="content"}return o=await Bn({fs:l,gitdir:c,type:r,object:i,oid:o,format:s}),o}catch(l){throw l.caller="git.writeObject",l}}async function LP({fs:t,dir:e,gitdir:n=V(e,".git"),ref:r,value:i,force:s=!1,symbolic:o=!1}){try{R("fs",t),R("gitdir",n),R("ref",r),R("value",i);let a=new fe(t);if(!rh(r,!0))throw new si(r,Bf.clean(r));let l=await de({fsp:a,dotgit:n});if(!s&&await te.exists({fs:a,gitdir:l,ref:r}))throw new ii("ref",r);o?await te.writeSymbolicRef({fs:a,gitdir:l,ref:r,value:i}):(i=await te.resolve({fs:a,gitdir:l,ref:i}),await te.writeRef({fs:a,gitdir:l,ref:r,value:i}))}catch(a){throw a.caller="git.writeRef",a}}async function _G({fs:t,gitdir:e,tag:n}){let r=lr.from(n).toObject();return await Bn({fs:t,gitdir:e,type:"tag",object:r,format:"content"})}async function BP({fs:t,dir:e,gitdir:n=V(e,".git"),tag:r}){try{R("fs",t),R("gitdir",n),R("tag",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await _G({fs:i,gitdir:s,tag:r})}catch(i){throw i.caller="git.writeTag",i}}async function $P({fs:t,dir:e,gitdir:n=V(e,".git"),tree:r}){try{R("fs",t),R("gitdir",n),R("tree",r);let i=new fe(t),s=await de({fsp:i,dotgit:n});return await sh({fs:i,gitdir:s,tree:r})}catch(i){throw i.caller="git.writeTree",i}}var CG={Errors:tO,STAGE:Da,TREE:ar,WORKDIR:kc,add:oO,abortMerge:rO,addNote:fO,addRemote:dO,annotatedTag:mO,branch:pO,checkout:e1,clone:kO,commit:xO,getConfig:zO,getConfigAll:LO,setConfig:xP,currentBranch:SO,deleteBranch:DO,deleteRef:EO,deleteRemote:_O,deleteTag:CO,expandOid:TO,expandRef:FO,fastForward:OO,fetch:PO,findMergeBase:NO,findRoot:RO,getRemoteInfo:BO,getRemoteInfo2:UO,hashBlob:jO,indexPack:qO,init:VO,isDescendent:WO,isIgnored:GO,listBranches:QO,listFiles:ZO,listNotes:YO,listRefs:JO,listRemotes:XO,listServerRefs:eP,listTags:tP,log:rP,merge:iP,packObjects:oP,pull:aP,push:lP,readBlob:fP,readCommit:r1,readNote:hP,readObject:dP,readTag:mP,readTree:pP,remove:gP,removeNote:yP,renameBranch:wP,resetIndex:vP,updateIndex:OP,resolveRef:kP,status:TP,statusMatrix:IP,tag:AP,version:PP,walk:NP,writeBlob:MP,writeCommit:RP,writeObject:zP,writeRef:LP,writeTag:BP,writeTree:$P,stash:CP};oe.Errors=tO;oe.STAGE=Da;oe.TREE=ar;oe.WORKDIR=kc;oe.abortMerge=rO;oe.add=oO;oe.addNote=fO;oe.addRemote=dO;oe.annotatedTag=mO;oe.branch=pO;oe.checkout=e1;oe.clone=kO;oe.commit=xO;oe.currentBranch=SO;oe.default=CG;oe.deleteBranch=DO;oe.deleteRef=EO;oe.deleteRemote=_O;oe.deleteTag=CO;oe.expandOid=TO;oe.expandRef=FO;oe.fastForward=OO;oe.fetch=PO;oe.findMergeBase=NO;oe.findRoot=RO;oe.getConfig=zO;oe.getConfigAll=LO;oe.getRemoteInfo=BO;oe.getRemoteInfo2=UO;oe.hashBlob=jO;oe.indexPack=qO;oe.init=VO;oe.isDescendent=WO;oe.isIgnored=GO;oe.listBranches=QO;oe.listFiles=ZO;oe.listNotes=YO;oe.listRefs=JO;oe.listRemotes=XO;oe.listServerRefs=eP;oe.listTags=tP;oe.log=rP;oe.merge=iP;oe.packObjects=oP;oe.pull=aP;oe.push=lP;oe.readBlob=fP;oe.readCommit=r1;oe.readNote=hP;oe.readObject=dP;oe.readTag=mP;oe.readTree=pP;oe.remove=gP;oe.removeNote=yP;oe.renameBranch=wP;oe.resetIndex=vP;oe.resolveRef=kP;oe.setConfig=xP;oe.stash=CP;oe.status=TP;oe.statusMatrix=IP;oe.tag=AP;oe.updateIndex=OP;oe.version=PP;oe.walk=NP;oe.writeBlob=MP;oe.writeCommit=RP;oe.writeObject=zP;oe.writeRef=LP;oe.writeTag=BP;oe.writeTree=$P});var qP=W((Xme,jP)=>{m();jP.exports=TG;function TG(t){var e,n;if(typeof t!="function")throw new Error("expected a function but got "+t);return function(){return e||(e=!0,n=t.apply(this,arguments)),n}}});var HP=W(VP=>{m();(function(t){"use strict";function e(w,b){var S;return w instanceof x?S=w:S=x.from(w.buffer,w.byteOffset,w.byteLength),S.toString(b)}var n=function(w){return x.from(w)};function r(w){for(var b=0,S=Math.min(256*256,w.length+1),D=new Uint16Array(S),k=[],E=0;;){var v=b<w.length;if(!v||E>=S-1){var _=D.subarray(0,E),C=_;if(k.push(String.fromCharCode.apply(null,C)),!v)return k.join("");w=w.subarray(b),b=0,E=0}var A=w[b++];if((A&128)===0)D[E++]=A;else if((A&224)===192){var P=w[b++]&63;D[E++]=(A&31)<<6|P}else if((A&240)===224){var P=w[b++]&63,N=w[b++]&63;D[E++]=(A&31)<<12|P<<6|N}else if((A&248)===240){var P=w[b++]&63,N=w[b++]&63,B=w[b++]&63,L=(A&7)<<18|P<<12|N<<6|B;L>65535&&(L-=65536,D[E++]=L>>>10&1023|55296,L=56320|L&1023),D[E++]=L}}}function i(w){for(var b=0,S=w.length,D=0,k=Math.max(32,S+(S>>>1)+7),E=new Uint8Array(k>>>3<<3);b<S;){var v=w.charCodeAt(b++);if(v>=55296&&v<=56319){if(b<S){var _=w.charCodeAt(b);(_&64512)===56320&&(++b,v=((v&1023)<<10)+(_&1023)+65536)}if(v>=55296&&v<=56319)continue}if(D+4>E.length){k+=8,k*=1+b/w.length*2,k=k>>>3<<3;var C=new Uint8Array(k);C.set(E),E=C}if((v&4294967168)===0){E[D++]=v;continue}else if((v&4294965248)===0)E[D++]=v>>>6&31|192;else if((v&4294901760)===0)E[D++]=v>>>12&15|224,E[D++]=v>>>6&63|128;else if((v&4292870144)===0)E[D++]=v>>>18&7|240,E[D++]=v>>>12&63|128,E[D++]=v>>>6&63|128;else continue;E[D++]=v&63|128}return E.slice?E.slice(0,D):E.subarray(0,D)}var s="Failed to ",o=function(w,b,S){if(w)throw new Error("".concat(s).concat(b,": the '").concat(S,"' option is unsupported."))},a=typeof x=="function"&&x.from,l=a?n:i;function c(){this.encoding="utf-8"}c.prototype.encode=function(w,b){return o(b&&b.stream,"encode","stream"),l(w)};function u(w){var b;try{var S=new Blob([w],{type:"text/plain;charset=UTF-8"});b=URL.createObjectURL(S);var D=new XMLHttpRequest;return D.open("GET",b,!1),D.send(),D.responseText}finally{b&&URL.revokeObjectURL(b)}}var f=!a&&typeof Blob=="function"&&typeof URL=="function"&&typeof URL.createObjectURL=="function",h=["utf-8","utf8","unicode-1-1-utf-8"],d=r;a?d=e:f&&(d=function(w){try{return u(w)}catch{return r(w)}});var p="construct 'TextDecoder'",g="".concat(s," ").concat(p,": the ");function y(w,b){o(b&&b.fatal,p,"fatal"),w=w||"utf-8";var S;if(a?S=x.isEncoding(w):S=h.indexOf(w.toLowerCase())!==-1,!S)throw new RangeError("".concat(g," encoding label provided ('").concat(w,"') is invalid."));this.encoding=w,this.fatal=!1,this.ignoreBOM=!1}y.prototype.decode=function(w,b){o(b&&b.stream,"decode","stream");var S;return w instanceof Uint8Array?S=w:w.buffer instanceof ArrayBuffer?S=new Uint8Array(w.buffer):S=new Uint8Array(w),d(S,this.encoding)},t.TextEncoder=t.TextEncoder||c,t.TextDecoder=t.TextDecoder||y})(typeof window<"u"?window:typeof globalThis<"u"?globalThis:VP)});var GP=W((rpe,WP)=>{m();HP();WP.exports={encode:t=>new TextEncoder().encode(t),decode:t=>new TextDecoder().decode(t)}});var KP=W((spe,QP)=>{m();QP.exports=FG;function FG(t,e,n){var r;return function(){if(!e)return t.apply(this,arguments);var i=this,s=arguments,o=n&&!r;if(clearTimeout(r),r=setTimeout(function(){if(r=null,!o)return t.apply(i,s)},e),o)return t.apply(this,arguments)}}});var zp=W((ape,JP)=>{m();function ZP(t){if(t.length===0)return".";let e=YP(t);return e=e.reduce(PG,[]),i1(...e)}function IG(...t){let e="";for(let n of t)n.startsWith("/")?e=n:e=ZP(i1(e,n));return e}function i1(...t){if(t.length===0)return"";let e=t.join("/");return e=e.replace(/\/{2,}/g,"/"),e}function YP(t){if(t.length===0)return[];if(t==="/")return["/"];let e=t.split("/");return e[e.length-1]===""&&e.pop(),t[0]==="/"?e[0]="/":e[0]!=="."&&e.unshift("."),e}function AG(t){let e=t.lastIndexOf("/");if(e===-1)throw new Error(`Cannot get dirname of "${t}"`);return e===0?"/":t.slice(0,e)}function OG(t){if(t==="/")throw new Error(`Cannot get basename of "${t}"`);let e=t.lastIndexOf("/");return e===-1?t:t.slice(e+1)}function PG(t,e){if(t.length===0)return t.push(e),t;if(e===".")return t;if(e===".."){if(t.length===1){if(t[0]==="/")throw new Error("Unable to normalize path - traverses above root directory");if(t[0]===".")return t.push(e),t}return t[t.length-1]===".."?(t.push(".."),t):(t.pop(),t)}return t.push(e),t}JP.exports={join:i1,normalize:ZP,split:YP,basename:OG,dirname:AG,resolve:IG}});var s1=W((cpe,XP)=>{m();function Sc(t){return class extends Error{constructor(...e){super(...e),this.code=t,this.message?this.message=t+": "+this.message:this.message=t}}}var NG=Sc("EEXIST"),MG=Sc("ENOENT"),RG=Sc("ENOTDIR"),zG=Sc("ENOTEMPTY"),LG=Sc("ETIMEDOUT"),BG=Sc("EISDIR");XP.exports={EEXIST:NG,ENOENT:MG,ENOTDIR:RG,ENOTEMPTY:zG,ETIMEDOUT:LG,EISDIR:BG}});var rN=W((dpe,nN)=>{m();var vn=zp(),{EEXIST:eN,ENOENT:$G,ENOTDIR:tN,ENOTEMPTY:UG,EISDIR:jG}=s1(),cn=0;nN.exports=class{constructor(){}_makeRoot(e=new Map){return e.set(cn,{mode:511,type:"dir",size:0,ino:0,mtimeMs:Date.now()}),e}activate(e=null){e===null?this._root=new Map([["/",this._makeRoot()]]):typeof e=="string"?this._root=new Map([["/",this._makeRoot(this.parse(e))]]):this._root=e}get activated(){return!!this._root}deactivate(){this._root=void 0}size(){return this._countInodes(this._root.get("/"))-1}_countInodes(e){let n=1;for(let[r,i]of e)r!==cn&&(n+=this._countInodes(i));return n}autoinc(){return this._maxInode(this._root.get("/"))+1}_maxInode(e){let n=e.get(cn).ino;for(let[r,i]of e)r!==cn&&(n=Math.max(n,this._maxInode(i)));return n}print(e=this._root.get("/")){let n="",r=(i,s)=>{for(let[o,a]of i){if(o===0)continue;let l=a.get(cn),c=l.mode.toString(8);n+=`${" ".repeat(s)}${o} ${c}`,l.type==="file"?n+=` ${l.size} ${l.mtimeMs}
|
||
`:(n+=`
|
||
`,r(a,s+1))}};return r(e,0),n}parse(e){let n=0;function r(a){let l=++n,c=a.length===1?"dir":"file",[u,f,h]=a;return u=parseInt(u,8),f=f?parseInt(f):0,h=h?parseInt(h):Date.now(),new Map([[cn,{mode:u,type:c,size:f,mtimeMs:h,ino:l}]])}let i=e.trim().split(`
|
||
`),s=this._makeRoot(),o=[{indent:-1,node:s},{indent:0,node:null}];for(let a of i){let c=a.match(/^\t*/)[0].length;a=a.slice(c);let[u,...f]=a.split(" "),h=r(f);if(c<=o[o.length-1].indent)for(;c<=o[o.length-1].indent;)o.pop();o.push({indent:c,node:h}),o[o.length-2].node.set(u,h)}return s}_lookup(e,n=!0){let r=this._root,i="/",s=vn.split(e);for(let o=0;o<s.length;++o){let a=s[o];if(r=r.get(a),!r)throw new $G(e);if(n||o<s.length-1){let l=r.get(cn);if(l.type==="symlink"){let c=vn.resolve(i,l.target);r=this._lookup(c)}i?i=vn.join(i,a):i=a}}return r}mkdir(e,{mode:n}){if(e==="/")throw new eN;let r=this._lookup(vn.dirname(e)),i=vn.basename(e);if(r.has(i))throw new eN;let s=new Map,o={mode:n,type:"dir",size:0,mtimeMs:Date.now(),ino:this.autoinc()};s.set(cn,o),r.set(i,s)}rmdir(e){let n=this._lookup(e);if(n.get(cn).type!=="dir")throw new tN;if(n.size>1)throw new UG;let r=this._lookup(vn.dirname(e)),i=vn.basename(e);r.delete(i)}readdir(e){let n=this._lookup(e);if(n.get(cn).type!=="dir")throw new tN;return[...n.keys()].filter(r=>typeof r=="string")}writeStat(e,n,{mode:r}){let i,s;try{s=this.stat(e)}catch{}if(s!==void 0){if(s.type==="dir")throw new jG;r==null&&(r=s.mode),i=s.ino}r==null&&(r=438),i==null&&(i=this.autoinc());let o=this._lookup(vn.dirname(e)),a=vn.basename(e),l={mode:r,type:"file",size:n,mtimeMs:Date.now(),ino:i},c=new Map;return c.set(cn,l),o.set(a,c),l}unlink(e){let n=this._lookup(vn.dirname(e)),r=vn.basename(e);n.delete(r)}rename(e,n){let r=vn.basename(n),i=this._lookup(e);this._lookup(vn.dirname(n)).set(r,i),this.unlink(e)}stat(e){return this._lookup(e).get(cn)}lstat(e){return this._lookup(e,!1).get(cn)}readlink(e){return this._lookup(e,!1).get(cn).target}symlink(e,n){let r,i;try{let c=this.stat(n);i===null&&(i=c.mode),r=c.ino}catch{}i==null&&(i=40960),r==null&&(r=this.autoinc());let s=this._lookup(vn.dirname(n)),o=vn.basename(n),a={mode:i,type:"symlink",target:e,size:0,mtimeMs:Date.now(),ino:r},l=new Map;return l.set(cn,a),s.set(o,l),a}_du(e){let n=0;for(let[r,i]of e.entries())r===cn?n+=i.size:n+=this._du(i);return n}du(e){let n=this._lookup(e);return this._du(n)}}});var a1=W(Oi=>{"use strict";m();Object.defineProperty(Oi,"__esModule",{value:!0});var Lp=class{constructor(e="keyval-store",n="keyval"){this.storeName=n,this._dbName=e,this._storeName=n,this._init()}_init(){this._dbp||(this._dbp=new Promise((e,n)=>{let r=indexedDB.open(this._dbName);r.onerror=()=>n(r.error),r.onsuccess=()=>e(r.result),r.onupgradeneeded=()=>{r.result.createObjectStore(this._storeName)}}))}_withIDBStore(e,n){return this._init(),this._dbp.then(r=>new Promise((i,s)=>{let o=r.transaction(this.storeName,e);o.oncomplete=()=>i(),o.onabort=o.onerror=()=>s(o.error),n(o.objectStore(this.storeName))}))}_close(){return this._init(),this._dbp.then(e=>{e.close(),this._dbp=void 0})}},o1;function Ea(){return o1||(o1=new Lp),o1}function qG(t,e=Ea()){let n;return e._withIDBStore("readwrite",r=>{n=r.get(t)}).then(()=>n.result)}function VG(t,e,n=Ea()){return n._withIDBStore("readwrite",r=>{r.put(e,t)})}function HG(t,e,n=Ea()){return n._withIDBStore("readwrite",r=>{let i=r.get(t);i.onsuccess=()=>{r.put(e(i.result),t)}})}function WG(t,e=Ea()){return e._withIDBStore("readwrite",n=>{n.delete(t)})}function GG(t=Ea()){return t._withIDBStore("readwrite",e=>{e.clear()})}function QG(t=Ea()){let e=[];return t._withIDBStore("readwrite",n=>{(n.openKeyCursor||n.openCursor).call(n).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())}}).then(()=>e)}function KG(t=Ea()){return t._close()}Oi.Store=Lp;Oi.get=qG;Oi.set=VG;Oi.update=HG;Oi.del=WG;Oi.clear=GG;Oi.keys=QG;Oi.close=KG});var sN=W((wpe,iN)=>{m();var so=a1();iN.exports=class{constructor(e,n){this._database=e,this._storename=n,this._store=new so.Store(this._database,this._storename)}saveSuperblock(e){return so.set("!root",e,this._store)}loadSuperblock(){return so.get("!root",this._store)}readFile(e){return so.get(e,this._store)}writeFile(e,n){return so.set(e,n,this._store)}unlink(e){return so.del(e,this._store)}wipe(){return so.clear(this._store)}close(){return so.close(this._store)}}});var aN=W((kpe,oN)=>{m();oN.exports=class{constructor(e){this._url=e}loadSuperblock(){return fetch(this._url+"/.superblock.txt").then(e=>e.ok?e.text():null)}async readFile(e){let n=await fetch(this._url+e);if(n.status===200)return n.arrayBuffer();throw new Error("ENOENT")}async sizeFile(e){let n=await fetch(this._url+e,{method:"HEAD"});if(n.status===200)return n.headers.get("content-length");throw new Error("ENOENT")}}});var cN=W((Dpe,lN)=>{m();var ah=a1(),ZG=t=>new Promise(e=>setTimeout(e,t));lN.exports=class{constructor(e,n){this._id=Math.random(),this._database=e,this._storename=n,this._store=new ah.Store(this._database,this._storename),this._lock=null}async has({margin:e=2e3}={}){if(this._lock&&this._lock.holder===this._id){let n=Date.now();return this._lock.expires>n+e?!0:await this.renew()}else return!1}async renew({ttl:e=5e3}={}){let n;return await ah.update("lock",r=>{let s=Date.now()+e;return n=r&&r.holder===this._id,this._lock=n?{holder:this._id,expires:s}:r,this._lock},this._store),n}async acquire({ttl:e=5e3}={}){let n,r,i;if(await ah.update("lock",s=>{let o=Date.now(),a=o+e;return r=s&&s.expires<o,n=s===void 0||r,i=s&&s.holder===this._id,this._lock=n?{holder:this._id,expires:a}:s,this._lock},this._store),i)throw new Error("Mutex double-locked");return n}async wait({interval:e=100,limit:n=6e3,ttl:r}={}){for(;n--;){if(await this.acquire({ttl:r}))return!0;await ZG(e)}throw new Error("Mutex timeout")}async release({force:e=!1}={}){let n,r,i;if(await ah.update("lock",s=>(n=e||s&&s.holder===this._id,r=s===void 0,i=s&&s.holder!==this._id,this._lock=n?void 0:s,this._lock),this._store),await ah.close(this._store),!n&&!e){if(r)throw new Error("Mutex double-freed");if(i)throw new Error("Mutex lost ownership")}return n}}});var fN=W((Cpe,uN)=>{m();uN.exports=class{constructor(e){this._id=Math.random(),this._database=e,this._has=!1,this._release=null}async has(){return this._has}async acquire(){return new Promise(e=>{navigator.locks.request(this._database+"_lock",{ifAvailable:!0},n=>(this._has=!!n,e(!!n),new Promise(r=>{this._release=r})))})}async wait({timeout:e=6e5}={}){return new Promise((n,r)=>{let i=new AbortController;setTimeout(()=>{i.abort(),r(new Error("Mutex timeout"))},e),navigator.locks.request(this._database+"_lock",{signal:i.signal},s=>(this._has=!!s,n(!!s),new Promise(o=>{this._release=o})))})}async release({force:e=!1}={}){this._has=!1,this._release?this._release():e&&navigator.locks.request(this._database+"_lock",{steal:!0},n=>!0)}}});var mN=W((Ipe,dN)=>{m();var{encode:YG,decode:hN}=GP(),JG=KP(),XG=rN(),{ENOENT:e7,ENOTEMPTY:t7,ETIMEDOUT:n7}=s1(),r7=sN(),i7=aN(),s7=cN(),o7=fN(),lh=zp();dN.exports=class{constructor(){this.saveSuperblock=JG(()=>{this.flush()},500)}async init(e,{wipe:n,url:r,urlauto:i,fileDbName:s=e,db:o=null,fileStoreName:a=e+"_files",lockDbName:l=e+"_lock",lockStoreName:c=e+"_lock"}={}){this._name=e,this._idb=o||new r7(s,a),this._mutex=navigator.locks?new o7(e):new s7(l,c),this._cache=new XG(e),this._opts={wipe:n,url:r},this._needsWipe=!!n,r&&(this._http=new i7(r),this._urlauto=!!i)}async activate(){if(this._cache.activated)return;this._needsWipe&&(this._needsWipe=!1,await this._idb.wipe(),await this._mutex.release({force:!0})),await this._mutex.has()||await this._mutex.wait();let e=await this._idb.loadSuperblock();if(e)this._cache.activate(e);else if(this._http){let n=await this._http.loadSuperblock();this._cache.activate(n),await this._saveSuperblock()}else this._cache.activate();if(!await this._mutex.has())throw new n7}async deactivate(){await this._mutex.has()&&await this._saveSuperblock(),this._cache.deactivate();try{await this._mutex.release()}catch(e){console.log(e)}await this._idb.close()}async _saveSuperblock(){this._cache.activated&&(this._lastSavedAt=Date.now(),await this._idb.saveSuperblock(this._cache._root))}_writeStat(e,n,r){let i=lh.split(lh.dirname(e)),s=i.shift();for(let o of i){s=lh.join(s,o);try{this._cache.mkdir(s,{mode:511})}catch{}}return this._cache.writeStat(e,n,r)}async readFile(e,n){let r=typeof n=="string"?n:n&&n.encoding;if(r&&r!=="utf8")throw new Error('Only "utf8" encoding is supported in readFile');let i=null,s=null;try{s=this._cache.stat(e),i=await this._idb.readFile(s.ino)}catch(o){if(!this._urlauto)throw o}if(!i&&this._http){let o=this._cache.lstat(e);for(;o.type==="symlink";)e=lh.resolve(lh.dirname(e),o.target),o=this._cache.lstat(e);i=await this._http.readFile(e)}if(i&&((!s||s.size!=i.byteLength)&&(s=await this._writeStat(e,i.byteLength,{mode:s?s.mode:438}),this.saveSuperblock()),r==="utf8"?i=hN(i):i.toString=()=>hN(i)),!s)throw new e7(e);return i}async writeFile(e,n,r){let{mode:i,encoding:s="utf8"}=r;if(typeof n=="string"){if(s!=="utf8")throw new Error('Only "utf8" encoding is supported in writeFile');n=YG(n)}let o=await this._cache.writeStat(e,n.byteLength,{mode:i});await this._idb.writeFile(o.ino,n)}async unlink(e,n){let r=this._cache.lstat(e);this._cache.unlink(e),r.type!=="symlink"&&await this._idb.unlink(r.ino)}readdir(e,n){return this._cache.readdir(e)}mkdir(e,n){let{mode:r=511}=n;this._cache.mkdir(e,{mode:r})}rmdir(e,n){if(e==="/")throw new t7;this._cache.rmdir(e)}rename(e,n){this._cache.rename(e,n)}stat(e,n){return this._cache.stat(e)}lstat(e,n){return this._cache.lstat(e)}readlink(e,n){return this._cache.readlink(e)}symlink(e,n){this._cache.symlink(e,n)}async backFile(e,n){let r=await this._http.sizeFile(e);await this._writeStat(e,r,n)}du(e){return this._cache.du(e)}flush(){return this._saveSuperblock()}}});var gN=W((Ppe,pN)=>{m();pN.exports=class{constructor(e){this.type=e.type,this.mode=e.mode,this.size=e.size,this.ino=e.ino,this.mtimeMs=e.mtimeMs,this.ctimeMs=e.ctimeMs||e.mtimeMs,this.uid=1,this.gid=1,this.dev=1}isFile(){return this.type==="file"}isDirectory(){return this.type==="dir"}isSymbolicLink(){return this.type==="symlink"}}});var vN=W((Rpe,bN)=>{m();var a7=mN(),yN=gN(),Bp=zp();function Pi(t,e,...n){return t=Bp.normalize(t),(typeof e>"u"||typeof e=="function")&&(e={}),typeof e=="string"&&(e={encoding:e}),[t,e,...n]}function l7(t,e,n,...r){return t=Bp.normalize(t),(typeof n>"u"||typeof n=="function")&&(n={}),typeof n=="string"&&(n={encoding:n}),[t,e,n,...r]}function wN(t,e,...n){return[Bp.normalize(t),Bp.normalize(e),...n]}bN.exports=class{constructor(e,n={}){this.init=this.init.bind(this),this.readFile=this._wrap(this.readFile,Pi,!1),this.writeFile=this._wrap(this.writeFile,l7,!0),this.unlink=this._wrap(this.unlink,Pi,!0),this.readdir=this._wrap(this.readdir,Pi,!1),this.mkdir=this._wrap(this.mkdir,Pi,!0),this.rmdir=this._wrap(this.rmdir,Pi,!0),this.rename=this._wrap(this.rename,wN,!0),this.stat=this._wrap(this.stat,Pi,!1),this.lstat=this._wrap(this.lstat,Pi,!1),this.readlink=this._wrap(this.readlink,Pi,!1),this.symlink=this._wrap(this.symlink,wN,!0),this.backFile=this._wrap(this.backFile,Pi,!0),this.du=this._wrap(this.du,Pi,!1),this._deactivationPromise=null,this._deactivationTimeout=null,this._activationPromise=null,this._operations=new Set,e&&this.init(e,n)}async init(...e){return this._initPromiseResolve&&await this._initPromise,this._initPromise=this._init(...e),this._initPromise}async _init(e,n={}){await this._gracefulShutdown(),this._activationPromise&&await this._deactivate(),this._backend&&this._backend.destroy&&await this._backend.destroy(),this._backend=n.backend||new a7,this._backend.init&&await this._backend.init(e,n),this._initPromiseResolve&&(this._initPromiseResolve(),this._initPromiseResolve=null),n.defer||this.stat("/")}async _gracefulShutdown(){this._operations.size>0&&(this._isShuttingDown=!0,await new Promise(e=>this._gracefulShutdownResolve=e),this._isShuttingDown=!1,this._gracefulShutdownResolve=null)}_wrap(e,n,r){return async(...i)=>{i=n(...i);let s={name:e.name,args:i};this._operations.add(s);try{return await this._activate(),await e.apply(this,i)}finally{this._operations.delete(s),r&&this._backend.saveSuperblock(),this._operations.size===0&&(this._deactivationTimeout||clearTimeout(this._deactivationTimeout),this._deactivationTimeout=setTimeout(this._deactivate.bind(this),500))}}}async _activate(){this._initPromise||console.warn(new Error(`Attempted to use LightningFS ${this._name} before it was initialized.`)),await this._initPromise,this._deactivationTimeout&&(clearTimeout(this._deactivationTimeout),this._deactivationTimeout=null),this._deactivationPromise&&await this._deactivationPromise,this._deactivationPromise=null,this._activationPromise||(this._activationPromise=this._backend.activate?this._backend.activate():Promise.resolve()),await this._activationPromise}async _deactivate(){return this._activationPromise&&await this._activationPromise,this._deactivationPromise||(this._deactivationPromise=this._backend.deactivate?this._backend.deactivate():Promise.resolve()),this._activationPromise=null,this._gracefulShutdownResolve&&this._gracefulShutdownResolve(),this._deactivationPromise}async readFile(e,n){return this._backend.readFile(e,n)}async writeFile(e,n,r){return await this._backend.writeFile(e,n,r),null}async unlink(e,n){return await this._backend.unlink(e,n),null}async readdir(e,n){return this._backend.readdir(e,n)}async mkdir(e,n){return await this._backend.mkdir(e,n),null}async rmdir(e,n){return await this._backend.rmdir(e,n),null}async rename(e,n){return await this._backend.rename(e,n),null}async stat(e,n){let r=await this._backend.stat(e,n);return new yN(r)}async lstat(e,n){let r=await this._backend.lstat(e,n);return new yN(r)}async readlink(e,n){return this._backend.readlink(e,n)}async symlink(e,n){return await this._backend.symlink(e,n),null}async backFile(e,n){return await this._backend.backFile(e,n),null}async du(e){return this._backend.du(e)}async flush(){return this._backend.flush()}}});var xN=W((Bpe,kN)=>{m();var c7=qP(),u7=vN();function $n(t,e){return typeof t=="function"&&(e=t),e=c7(e),[(...r)=>e(null,...r),e]}kN.exports=class{constructor(...e){this.promises=new u7(...e),this.init=this.init.bind(this),this.readFile=this.readFile.bind(this),this.writeFile=this.writeFile.bind(this),this.unlink=this.unlink.bind(this),this.readdir=this.readdir.bind(this),this.mkdir=this.mkdir.bind(this),this.rmdir=this.rmdir.bind(this),this.rename=this.rename.bind(this),this.stat=this.stat.bind(this),this.lstat=this.lstat.bind(this),this.readlink=this.readlink.bind(this),this.symlink=this.symlink.bind(this),this.backFile=this.backFile.bind(this),this.du=this.du.bind(this),this.flush=this.flush.bind(this)}init(e,n){return this.promises.init(e,n)}readFile(e,n,r){let[i,s]=$n(n,r);this.promises.readFile(e,n).then(i).catch(s)}writeFile(e,n,r,i){let[s,o]=$n(r,i);this.promises.writeFile(e,n,r).then(s).catch(o)}unlink(e,n,r){let[i,s]=$n(n,r);this.promises.unlink(e,n).then(i).catch(s)}readdir(e,n,r){let[i,s]=$n(n,r);this.promises.readdir(e,n).then(i).catch(s)}mkdir(e,n,r){let[i,s]=$n(n,r);this.promises.mkdir(e,n).then(i).catch(s)}rmdir(e,n,r){let[i,s]=$n(n,r);this.promises.rmdir(e,n).then(i).catch(s)}rename(e,n,r){let[i,s]=$n(r);this.promises.rename(e,n).then(i).catch(s)}stat(e,n,r){let[i,s]=$n(n,r);this.promises.stat(e).then(i).catch(s)}lstat(e,n,r){let[i,s]=$n(n,r);this.promises.lstat(e).then(i).catch(s)}readlink(e,n,r){let[i,s]=$n(n,r);this.promises.readlink(e).then(i).catch(s)}symlink(e,n,r){let[i,s]=$n(r);this.promises.symlink(e,n).then(i).catch(s)}backFile(e,n,r){let[i,s]=$n(n,r);this.promises.backFile(e,n).then(i).catch(s)}du(e,n){let[r,i]=$n(n);this.promises.du(e).then(r).catch(i)}flush(e){let[n,r]=$n(e);this.promises.flush().then(n).catch(r)}}});function We(t){if(t&&typeof t=="object")switch(t[xn]){case li:case ds:return!0}return!1}function Le(t){if(t&&typeof t=="object")switch(t[xn]){case Kp:case li:case hr:case ds:return!0}return!1}var Kp,Zp,li,T1,hr,ds,xn,Un,dr,mr,Me,Ie,pr,Yp,qe=se(()=>{m();Kp=Symbol.for("yaml.alias"),Zp=Symbol.for("yaml.document"),li=Symbol.for("yaml.map"),T1=Symbol.for("yaml.pair"),hr=Symbol.for("yaml.scalar"),ds=Symbol.for("yaml.seq"),xn=Symbol.for("yaml.node.type"),Un=t=>!!t&&typeof t=="object"&&t[xn]===Kp,dr=t=>!!t&&typeof t=="object"&&t[xn]===Zp,mr=t=>!!t&&typeof t=="object"&&t[xn]===li,Me=t=>!!t&&typeof t=="object"&&t[xn]===T1,Ie=t=>!!t&&typeof t=="object"&&t[xn]===hr,pr=t=>!!t&&typeof t=="object"&&t[xn]===ds;Yp=t=>(Ie(t)||We(t))&&!!t.anchor});function zr(t,e){let n=MM(e);dr(t)?Fc(null,t.contents,n,Object.freeze([t]))===Ri&&(t.contents=null):Fc(null,t,n,Object.freeze([]))}function Fc(t,e,n,r){let i=RM(t,e,n,r);if(Le(i)||Me(i))return zM(t,r,i),Fc(t,i,n,r);if(typeof i!="symbol"){if(We(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let o=Fc(s,e.items[s],n,r);if(typeof o=="number")s=o-1;else{if(o===jn)return jn;o===Ri&&(e.items.splice(s,1),s-=1)}}}else if(Me(e)){r=Object.freeze(r.concat(e));let s=Fc("key",e.key,n,r);if(s===jn)return jn;s===Ri&&(e.key=null);let o=Fc("value",e.value,n,r);if(o===jn)return jn;o===Ri&&(e.value=null)}}return i}async function Ac(t,e){let n=MM(e);dr(t)?await Ic(null,t.contents,n,Object.freeze([t]))===Ri&&(t.contents=null):await Ic(null,t,n,Object.freeze([]))}async function Ic(t,e,n,r){let i=await RM(t,e,n,r);if(Le(i)||Me(i))return zM(t,r,i),Ic(t,i,n,r);if(typeof i!="symbol"){if(We(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let o=await Ic(s,e.items[s],n,r);if(typeof o=="number")s=o-1;else{if(o===jn)return jn;o===Ri&&(e.items.splice(s,1),s-=1)}}}else if(Me(e)){r=Object.freeze(r.concat(e));let s=await Ic("key",e.key,n,r);if(s===jn)return jn;s===Ri&&(e.key=null);let o=await Ic("value",e.value,n,r);if(o===jn)return jn;o===Ri&&(e.value=null)}}return i}function MM(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function RM(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(mr(e))return n.Map?.(t,e,r);if(pr(e))return n.Seq?.(t,e,r);if(Me(e))return n.Pair?.(t,e,r);if(Ie(e))return n.Scalar?.(t,e,r);if(Un(e))return n.Alias?.(t,e,r)}function zM(t,e,n){let r=e[e.length-1];if(We(r))r.items[t]=n;else if(Me(r))t==="key"?r.key=n:r.value=n;else if(dr(r))r.contents=n;else{let i=Un(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var jn,NM,Ri,wh=se(()=>{m();qe();jn=Symbol("break visit"),NM=Symbol("skip children"),Ri=Symbol("remove node");zr.BREAK=jn;zr.SKIP=NM;zr.REMOVE=Ri;Ac.BREAK=jn;Ac.SKIP=NM;Ac.REMOVE=Ri});var SQ,DQ,zi,F1=se(()=>{m();qe();wh();SQ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},DQ=t=>t.replace(/[!,[\]{}]/g,e=>SQ[e]),zi=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,o]=r;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(o){return n(String(o)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+DQ(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&Le(e.contents)){let s={};zr(e.contents,(o,a)=>{Le(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of r)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(`
|
||
`)}};zi.defaultYaml={explicit:!1,version:"1.2"};zi.defaultTags={"!!":"tag:yaml.org,2002:"}});function Jp(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function I1(t){let e=new Set;return zr(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function A1(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function LM(t,e){let n=[],r=new Map,i=null;return{onAnchor:s=>{n.push(s),i??(i=I1(t));let o=A1(e,i);return i.add(o),o},setAnchors:()=>{for(let s of n){let o=r.get(s);if(typeof o=="object"&&o.anchor&&(Ie(o.node)||We(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:r}}var Xp=se(()=>{m();qe();wh()});function co(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;i<s;++i){let o=r[i],a=co(t,r,String(i),o);a===void 0?delete r[i]:a!==o&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let s=r.get(i),o=co(t,r,i,s);o===void 0?r.delete(i):o!==s&&r.set(i,o)}else if(r instanceof Set)for(let i of Array.from(r)){let s=co(t,r,i,i);s===void 0?r.delete(i):s!==i&&(r.delete(i),r.add(s))}else for(let[i,s]of Object.entries(r)){let o=co(t,r,i,s);o===void 0?delete r[i]:o!==s&&(r[i]=o)}return t.call(e,n,r)}var O1=se(()=>{m()});function Bt(t,e,n){if(Array.isArray(t))return t.map((r,i)=>Bt(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Yp(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}var uo=se(()=>{m();qe()});var fo,eg=se(()=>{m();O1();qe();uo();fo=class{constructor(e){Object.defineProperty(this,xn,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!dr(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Bt(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof s=="function"?co(s,{"":a},"",a):a}}});function tg(t,e,n){if(Un(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(We(e)){let r=0;for(let i of e.items){let s=tg(t,i,n);s>r&&(r=s)}return r}else if(Me(e)){let r=tg(t,e.key,n),i=tg(t,e.value,n);return Math.max(r,i)}return 1}var ci,bh=se(()=>{m();Xp();wh();qe();eg();uo();ci=class extends fo{constructor(e){super(Kp),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],zr(e,{Node:(s,o)=>{(Un(o)||Yp(o))&&r.push(o)}}),n&&(n.aliasResolveCache=r));let i;for(let s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:s}=n,o=this.resolve(i,n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=r.get(o);if(a||(Bt(o,null,n),a=r.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=tg(i,o,r)),a.count*a.aliasCount>s)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(Jp(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}}});var ng,ue,Pt=se(()=>{m();qe();eg();uo();ng=t=>!t||typeof t!="function"&&typeof t!="object",ue=class extends fo{constructor(e){super(hr),this.value=e}toJSON(e,n){return n?.keep?this.value:Bt(this.value,e,n)}toString(){return String(this.value)}};ue.BLOCK_FOLDED="BLOCK_FOLDED";ue.BLOCK_LITERAL="BLOCK_LITERAL";ue.PLAIN="PLAIN";ue.QUOTE_DOUBLE="QUOTE_DOUBLE";ue.QUOTE_SINGLE="QUOTE_SINGLE"});function _Q(t,e,n){if(e){let r=n.filter(s=>s.tag===e),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function ms(t,e,n){if(dr(t)&&(t=t.contents),Le(t))return t;if(Me(t)){let f=n.schema[li].createNode?.(n.schema,null,n);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:o,sourceObjects:a}=n,l;if(r&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=i(t)),new ci(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=EQ+e.slice(2));let c=_Q(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new ue(t);return l&&(l.node=f),f}c=t instanceof Map?o[li]:Symbol.iterator in Object(t)?o[ds]:o[li]}s&&(s(c),delete n.onTagObj);let u=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new ue(t);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}var EQ,vh=se(()=>{m();bh();qe();Pt();EQ="tag:yaml.org,2002:"});function kh(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=r,r=o}else r=new Map([[s,r]])}return ms(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var Pc,Oc,rg=se(()=>{m();vh();qe();eg();Pc=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Oc=class extends fo{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>Le(r)||Me(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Pc(e))this.add(n);else{let[r,...i]=e,s=this.get(r,!0);if(We(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,kh(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(We(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,s=this.get(r,!0);return i.length===0?!n&&Ie(s)?s.value:s:We(s)?s.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!Me(n))return!1;let r=n.value;return r==null||e&&Ie(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return We(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let s=this.get(r,!0);if(We(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,kh(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}});function Lr(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var BM,Li,xh=se(()=>{m();BM=t=>t.replace(/^(?!$)(?: $)?/gm,"#");Li=(t,e,n)=>t.endsWith(`
|
||
`)?Lr(n,e):n.includes(`
|
||
`)?`
|
||
`+Lr(n,e):(t.endsWith(" ")?"":" ")+n});function Dh(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;i<s&&(s=0);let l=Math.max(1+s,1+i-e.length);if(t.length<=l)return t;let c=[],u={},f=i-e.length;typeof r=="number"&&(r>i-Math.max(2,s)?c.push(0):f=i-r);let h,d,p=!1,g=-1,y=-1,w=-1;n===ig&&(g=$M(t,g,e.length),g!==-1&&(f=g+l));for(let S;S=t[g+=1];){if(n===Sh&&S==="\\"){switch(y=g,t[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}w=g}if(S===`
|
||
`)n===ig&&(g=$M(t,g,e.length)),f=g+e.length+l,h=void 0;else{if(S===" "&&d&&d!==" "&&d!==`
|
||
`&&d!==" "){let D=t[g+1];D&&D!==" "&&D!==`
|
||
`&&D!==" "&&(h=g)}if(g>=f)if(h)c.push(h),f=h+l,h=void 0;else if(n===Sh){for(;d===" "||d===" ";)d=S,S=t[g+=1],p=!0;let D=g>w+1?g-2:y-1;if(u[D])return t;c.push(D),u[D]=!0,f=D+l,h=void 0}else p=!0}d=S}if(p&&a&&a(),c.length===0)return t;o&&o();let b=t.slice(0,c[0]);for(let S=0;S<c.length;++S){let D=c[S],k=c[S+1]||t.length;D===0?b=`
|
||
${e}${t.slice(0,k)}`:(n===Sh&&u[D]&&(b+=`${t[D]}\\`),b+=`
|
||
${e}${t.slice(D+1,k)}`)}return b}function $M(t,e,n){let r=e,i=e+1,s=t[i];for(;s===" "||s===" ";)if(e<i+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
|
||
`);r=e,i=e+1,s=t[i]}return r}var P1,ig,Sh,UM=se(()=>{m();P1="flow",ig="block",Sh="quoted"});function CQ(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let s=0,o=0;s<i;++s)if(t[s]===`
|
||
`){if(s-o>r)return!0;if(o=s+1,i-o<=r)return!1}return!0}function Eh(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(ag(t)?" ":""),o="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);let u=n.substr(l+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(r||n[l+2]==='"'||n.length<i)l+=1;else{for(o+=n.slice(a,l)+`
|
||
|
||
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)o+=`
|
||
`,l+=2;o+=s,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,r?o:Dh(o,s,Sh,og(e,!1))}function N1(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
||
`)||/[ \t]\n|\n[ \t]/.test(t))return Eh(t,e);let n=e.indent||(ag(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
||
${n}`)+"'";return e.implicitKey?r:Dh(r,n,P1,og(e,!1))}function Nc(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=Eh;else{let i=t.includes('"'),s=t.includes("'");i&&!s?r=N1:s&&!i?r=Eh:r=n?N1:Eh}return r(t,e)}function sg({comment:t,type:e,value:n},r,i,s){let{blockQuote:o,commentString:a,lineWidth:l}=r.options;if(!o||/\n[\t ]+$/.test(n))return Nc(n,r);let c=r.indent||(r.forceBlockIndent||ag(n)?" ":""),u=o==="literal"?!0:o==="folded"||e===ue.BLOCK_FOLDED?!1:e===ue.BLOCK_LITERAL?!0:!CQ(n,l,c.length);if(!n)return u?`|
|
||
`:`>
|
||
`;let f,h;for(h=n.length;h>0;--h){let k=n[h-1];if(k!==`
|
||
`&&k!==" "&&k!==" ")break}let d=n.substring(h),p=d.indexOf(`
|
||
`);p===-1?f="-":n===d||p!==d.length-1?(f="+",s&&s()):f="",d&&(n=n.slice(0,-d.length),d[d.length-1]===`
|
||
`&&(d=d.slice(0,-1)),d=d.replace(M1,`$&${c}`));let g=!1,y,w=-1;for(y=0;y<n.length;++y){let k=n[y];if(k===" ")g=!0;else if(k===`
|
||
`)w=y;else break}let b=n.substring(0,w<y?w+1:y);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let D=(g?c?"2":"1":"")+f;if(t&&(D+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let k=n.replace(/\n+/g,`
|
||
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),E=!1,v=og(r,!0);o!=="folded"&&e!==ue.BLOCK_FOLDED&&(v.onOverflow=()=>{E=!0});let _=Dh(`${b}${k}${d}`,c,ig,v);if(!E)return`>${D}
|
||
${c}${_}`}return n=n.replace(/\n+/g,`$&${c}`),`|${D}
|
||
${c}${b}${n}${d}`}function TQ(t,e,n,r){let{type:i,value:s}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:u}=e;if(a&&s.includes(`
|
||
`)||u&&/[[\]{},]/.test(s))return Nc(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||u||!s.includes(`
|
||
`)?Nc(s,e):sg(t,e,n,r);if(!a&&!u&&i!==ue.PLAIN&&s.includes(`
|
||
`))return sg(t,e,n,r);if(ag(s)){if(l==="")return e.forceBlockIndent=!0,sg(t,e,n,r);if(a&&l===c)return Nc(s,e)}let f=s.replace(/\n+/g,`$&
|
||
${l}`);if(o){let h=g=>g.default&&g.tag!=="tag:yaml.org,2002:str"&&g.test?.test(f),{compat:d,tags:p}=e.doc.schema;if(p.some(h)||d?.some(h))return Nc(s,e)}return a?f:Dh(f,l,P1,og(e,!1))}function ps(t,e,n,r){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==ue.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ue.QUOTE_DOUBLE);let l=u=>{switch(u){case ue.BLOCK_FOLDED:case ue.BLOCK_LITERAL:return i||s?Nc(o.value,e):sg(o,e,n,r);case ue.QUOTE_DOUBLE:return Eh(o.value,e);case ue.QUOTE_SINGLE:return N1(o.value,e);case ue.PLAIN:return TQ(o,e,n,r);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}var og,ag,M1,_h=se(()=>{m();Pt();UM();og=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),ag=t=>/^(%|---|\.\.\.)/m.test(t);try{M1=new RegExp(`(^|(?<!
|
||
))
|
||
+(?!
|
||
|$)`,"g")}catch{M1=/\n+(?!\n|$)/g}});function lg(t,e){let n=Object.assign({blockQuote:!0,commentString:BM,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function FQ(t,e){if(e.tag){let i=t.filter(s=>s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let n,r;if(Ie(e)){r=e.value;let i=t.filter(s=>s.identify?.(r));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}n=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function IQ(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],s=(Ie(t)||We(t))&&t.anchor;s&&Jp(s)&&(n.add(s),i.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(r.directives.tagString(o)),i.join(" ")}function gs(t,e,n,r){if(Me(t))return t.toString(e,n,r);if(Un(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,s=Le(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=FQ(e.doc.schema.tags,s));let o=IQ(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(s,e,n,r):Ie(s)?ps(s,e,n,r):s.toString(e,n,r);return o?Ie(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
||
${e.indent}${a}`:a}var Ch=se(()=>{m();Xp();qe();xh();_h()});function jM({key:t,value:e},n,r,i){let{allNullValues:s,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=n,h=Le(t)&&t.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(We(t)||!Le(t)&&typeof t=="object"){let v="With simple keys, collection cannot be used as a key value";throw new Error(v)}}let d=!f&&(!t||h&&e==null&&!n.inFlow||We(t)||(Ie(t)?t.type===ue.BLOCK_FOLDED||t.type===ue.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!d&&(f||!s),indent:a+l});let p=!1,g=!1,y=gs(t,n,()=>p=!0,()=>g=!0);if(!d&&!n.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(n.inFlow){if(s||e==null)return p&&r&&r(),y===""?"?":d?`? ${y}`:y}else if(s&&!f||e==null&&d)return y=`? ${y}`,h&&!p?y+=Li(y,n.indent,c(h)):g&&i&&i(),y;p&&(h=null),d?(h&&(y+=Li(y,n.indent,c(h))),y=`? ${y}
|
||
${a}:`):(y=`${y}:`,h&&(y+=Li(y,n.indent,c(h))));let w,b,S;Le(e)?(w=!!e.spaceBefore,b=e.commentBefore,S=e.comment):(w=!1,b=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!d&&!h&&Ie(e)&&(n.indentAtStart=y.length+1),g=!1,!u&&l.length>=2&&!n.inFlow&&!d&&pr(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let D=!1,k=gs(e,n,()=>D=!0,()=>g=!0),E=" ";if(h||w||b){if(E=w?`
|
||
`:"",b){let v=c(b);E+=`
|
||
${Lr(v,n.indent)}`}k===""&&!n.inFlow?E===`
|
||
`&&S&&(E=`
|
||
|
||
`):E+=`
|
||
${n.indent}`}else if(!d&&We(e)){let v=k[0],_=k.indexOf(`
|
||
`),C=_!==-1,A=n.inFlow??e.flow??e.items.length===0;if(C||!A){let P=!1;if(C&&(v==="&"||v==="!")){let N=k.indexOf(" ");v==="&"&&N!==-1&&N<_&&k[N+1]==="!"&&(N=k.indexOf(" ",N+1)),(N===-1||_<N)&&(P=!0)}P||(E=`
|
||
${n.indent}`)}}else(k===""||k[0]===`
|
||
`)&&(E="");return y+=E+k,n.inFlow?D&&r&&r():S&&!D?y+=Li(y,n.indent,c(S)):g&&i&&i(),y}var qM=se(()=>{m();qe();Pt();Ch();xh()});function cg(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var R1=se(()=>{m()});function L1(t,e,n){if(n=t&&Un(n)?n.resolve(t.doc):n,pr(n))for(let r of n.items)z1(t,e,r);else if(Array.isArray(n))for(let r of n)z1(t,e,r);else z1(t,e,n)}function z1(t,e,n){let r=t&&Un(n)?n.resolve(t.doc):n;if(!mr(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}var ug,ui,VM,fg=se(()=>{m();qe();Pt();ug="<<",ui={identify:t=>t===ug||typeof t=="symbol"&&t.description===ug,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ue(Symbol(ug)),{addToJSMap:L1}),stringify:()=>ug},VM=(t,e)=>(ui.identify(e)||Ie(e)&&(!e.type||e.type===ue.PLAIN)&&ui.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===ui.tag&&n.default)});function hg(t,e,{key:n,value:r}){if(Le(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(VM(t,n))L1(t,e,r);else{let i=Bt(n,"",t);if(e instanceof Map)e.set(i,Bt(r,i,t));else if(e instanceof Set)e.add(i);else{let s=AQ(n,i,t),o=Bt(r,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function AQ(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Le(t)&&n?.doc){let r=lg(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),cg(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}var B1=se(()=>{m();R1();fg();Ch();qe();uo()});function Mc(t,e,n){let r=ms(t,void 0,n),i=ms(e,void 0,n);return new ft(r,i)}var ft,ho=se(()=>{m();vh();qM();B1();qe();ft=class t{constructor(e,n=null){Object.defineProperty(this,xn,{value:T1}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Le(n)&&(n=n.clone(e)),Le(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return hg(n,r,this)}toString(e,n,r){return e?.doc?jM(this,e,n,r):JSON.stringify(this)}}});function mg(t,e,n){return(e.inFlow??t.flow?PQ:OQ)(t,e,n)}function OQ({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,u=Object.assign({},n,{indent:s,type:null}),f=!1,h=[];for(let p=0;p<e.length;++p){let g=e[p],y=null;if(Le(g))!f&&g.spaceBefore&&h.push(""),dg(n,h,g.commentBefore,f),g.comment&&(y=g.comment);else if(Me(g)){let b=Le(g.key)?g.key:null;b&&(!f&&b.spaceBefore&&h.push(""),dg(n,h,b.commentBefore,f))}f=!1;let w=gs(g,u,()=>y=null,()=>f=!0);y&&(w+=Li(w,s,c(y))),f&&y&&(f=!1),h.push(r+w)}let d;if(h.length===0)d=i.start+i.end;else{d=h[0];for(let p=1;p<h.length;++p){let g=h[p];d+=g?`
|
||
${l}${g}`:`
|
||
`}}return t?(d+=`
|
||
`+Lr(c(t),l),a&&a()):f&&o&&o(),d}function PQ({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:s,flowCollectionPadding:o,options:{commentString:a}}=e;r+=s;let l=Object.assign({},e,{indent:r,inFlow:!0,type:null}),c=!1,u=0,f=[];for(let p=0;p<t.length;++p){let g=t[p],y=null;if(Le(g))g.spaceBefore&&f.push(""),dg(e,f,g.commentBefore,!1),g.comment&&(y=g.comment);else if(Me(g)){let b=Le(g.key)?g.key:null;b&&(b.spaceBefore&&f.push(""),dg(e,f,b.commentBefore,!1),b.comment&&(c=!0));let S=Le(g.value)?g.value:null;S?(S.comment&&(y=S.comment),S.commentBefore&&(c=!0)):g.value==null&&b?.comment&&(y=b.comment)}y&&(c=!0);let w=gs(g,l,()=>y=null);c||(c=f.length>u||w.includes(`
|
||
`)),p<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((b,S)=>b+S.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),y&&(w+=Li(w,r,a(y))),f.push(w),u=f.length}let{start:h,end:d}=n;if(f.length===0)return h+d;if(!c){let p=f.reduce((g,y)=>g+y.length+2,2);c=e.options.lineWidth>0&&p>e.options.lineWidth}if(c){let p=h;for(let g of f)p+=g?`
|
||
${s}${i}${g}`:`
|
||
`;return`${p}
|
||
${i}${d}`}else return`${h}${o}${f.join(" ")}${o}${d}`}function dg({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let s=Lr(e(r),t);n.push(s.trimStart())}}var $1=se(()=>{m();qe();Ch();xh()});function mo(t,e){let n=Ie(e)?e.value:e;for(let r of t)if(Me(r)&&(r.key===e||r.key===n||Ie(r.key)&&r.key.value===n))return r}var wt,po=se(()=>{m();$1();B1();rg();qe();ho();Pt();wt=class extends Oc{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(li,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:s}=r,o=new this(e),a=(l,c)=>{if(typeof s=="function")c=s.call(n,l,c);else if(Array.isArray(s)&&!s.includes(l))return;(c!==void 0||i)&&o.items.push(Mc(l,c,r))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let r;Me(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new ft(e,e?.value):r=new ft(e.key,e.value);let i=mo(this.items,r.key),s=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ie(i.value)&&ng(r.value)?i.value.value=r.value:i.value=r.value}else if(s){let o=this.items.findIndex(a=>s(r,a)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){let n=mo(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=mo(this.items,e)?.value;return(!n&&Ie(i)?i.value:i)??void 0}has(e){return!!mo(this.items,e)}set(e,n){this.add(new ft(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let s of this.items)hg(n,i,s);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Me(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),mg(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}}});var fi,Rc=se(()=>{m();qe();po();fi={collection:"map",default:!0,nodeClass:wt,tag:"tag:yaml.org,2002:map",resolve(t,e){return mr(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>wt.from(t,e,n)}});function pg(t){let e=Ie(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Zt,go=se(()=>{m();vh();$1();rg();qe();Pt();uo();Zt=class extends Oc{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ds,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=pg(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=pg(e);if(typeof r!="number")return;let i=this.items[r];return!n&&Ie(i)?i.value:i}has(e){let n=pg(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=pg(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Ie(i)&&ng(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let s of this.items)r.push(Bt(s,String(i++),n));return r}toString(e,n,r){return e?mg(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,s=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof i=="function"){let l=n instanceof Set?a:String(o++);a=i.call(n,l,a)}s.items.push(ms(a,void 0,r))}}return s}}});var hi,zc=se(()=>{m();qe();go();hi={collection:"seq",default:!0,nodeClass:Zt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return pr(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Zt.from(t,e,n)}});var yo,Th=se(()=>{m();_h();yo={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),ps(t,e,n,r)}}});var Aa,gg=se(()=>{m();Pt();Aa={identify:t=>t==null,createNode:()=>new ue(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ue(null),stringify:({source:t},e)=>typeof t=="string"&&Aa.test.test(t)?t:e.options.nullStr}});var Fh,U1=se(()=>{m();Pt();Fh={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ue(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Fh.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}}});function fn({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(s)){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}var Lc=se(()=>{m()});var yg,wg,bg,j1=se(()=>{m();Pt();Lc();yg={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fn},wg={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():fn(t)}},bg={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new ue(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:fn}});function HM(t,e,n){let{value:r}=t;return vg(r)&&r>=0?n+r.toString(e):fn(t)}var vg,q1,kg,xg,Sg,V1=se(()=>{m();Lc();vg=t=>typeof t=="bigint"||Number.isInteger(t),q1=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);kg={identify:t=>vg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>q1(t,2,8,n),stringify:t=>HM(t,8,"0o")},xg={identify:vg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>q1(t,0,10,n),stringify:fn},Sg={identify:t=>vg(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>q1(t,2,16,n),stringify:t=>HM(t,16,"0x")}});var WM,GM=se(()=>{m();Rc();gg();zc();Th();U1();j1();V1();WM=[fi,hi,yo,Aa,Fh,kg,xg,Sg,yg,wg,bg]});function QM(t){return typeof t=="bigint"||Number.isInteger(t)}var Dg,NQ,MQ,KM,ZM=se(()=>{m();Pt();Rc();zc();Dg=({value:t})=>JSON.stringify(t),NQ=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Dg},{identify:t=>t==null,createNode:()=>new ue(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Dg},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Dg},{identify:QM,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>QM(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Dg}],MQ={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},KM=[fi,hi].concat(NQ,MQ)});var Ih,H1=se(()=>{m();Pt();_h();Ih={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,i,s){if(!n)return"";let o=n,a;if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=ue.BLOCK_LITERAL),e!==ue.QUOTE_DOUBLE){let l=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),c=Math.ceil(a.length/l),u=new Array(c);for(let f=0,h=0;f<c;++f,h+=l)u[f]=a.substr(h,l);a=u.join(e===ue.BLOCK_LITERAL?`
|
||
`:" ")}return ps({comment:t,type:e,value:a},r,i,s)}}});function W1(t,e){if(pr(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!Me(r)){if(mr(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new ft(new ue(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
||
${i.key.commentBefore}`:r.commentBefore),r.comment){let s=i.value??i.key;s.comment=s.comment?`${r.comment}
|
||
${s.comment}`:r.comment}r=i}t.items[n]=Me(r)?r:new ft(r)}}else e("Expected a sequence for this tag");return t}function G1(t,e,n){let{replacer:r}=n,i=new Zt(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(s++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(Mc(a,l,n))}return i}var Ah,Eg=se(()=>{m();qe();ho();Pt();go();Ah={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:W1,createNode:G1}});var Bc,Oh,Q1=se(()=>{m();qe();uo();po();go();Eg();Bc=class t extends Zt{constructor(){super(),this.add=wt.prototype.add.bind(this),this.delete=wt.prototype.delete.bind(this),this.get=wt.prototype.get.bind(this),this.has=wt.prototype.has.bind(this),this.set=wt.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let s,o;if(Me(i)?(s=Bt(i.key,"",n),o=Bt(i.value,s,n)):s=Bt(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,o)}return r}static from(e,n,r){let i=G1(e,n,r),s=new this;return s.items=i.items,s}};Bc.tag="tag:yaml.org,2002:omap";Oh={collection:"seq",identify:t=>t instanceof Map,nodeClass:Bc,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=W1(t,e),r=[];for(let{key:i}of n.items)Ie(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Bc,n)},createNode:(t,e,n)=>Bc.from(t,e,n)}});function YM({value:t,source:e},n){return e&&(t?K1:Z1).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var K1,Z1,JM=se(()=>{m();Pt();K1={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ue(!0),stringify:YM},Z1={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ue(!1),stringify:YM}});var XM,eR,tR,nR=se(()=>{m();Pt();Lc();XM={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fn},eR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():fn(t)}},tR={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new ue(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:fn}});function _g(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,n);return i==="-"?-1*s:s}function Y1(t,e,n){let{value:r}=t;if(Ph(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return fn(t)}var Ph,rR,iR,sR,oR,aR=se(()=>{m();Lc();Ph=t=>typeof t=="bigint"||Number.isInteger(t);rR={identify:Ph,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>_g(t,2,2,n),stringify:t=>Y1(t,2,"0b")},iR={identify:Ph,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>_g(t,1,8,n),stringify:t=>Y1(t,8,"0")},sR={identify:Ph,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>_g(t,0,10,n),stringify:fn},oR={identify:Ph,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>_g(t,2,16,n),stringify:t=>Y1(t,16,"0x")}});var $c,Nh,J1=se(()=>{m();qe();ho();po();$c=class t extends wt{constructor(e){super(e),this.tag=t.tag}add(e){let n;Me(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new ft(e.key,null):n=new ft(e,null),mo(this.items,n.key)||this.items.push(n)}get(e,n){let r=mo(this.items,e);return!n&&Me(r)?Ie(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=mo(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new ft(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),s.items.push(Mc(o,null,r));return s}};$c.tag="tag:yaml.org,2002:set";Nh={collection:"map",identify:t=>t instanceof Set,nodeClass:$c,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>$c.from(t,e,n),resolve(t,e){if(mr(t)){if(t.hasAllNullValues(!0))return Object.assign(new $c,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}}});function X1(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=r.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*s:s}function lR(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return fn(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),r+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Cg,Tg,Uc,ek=se(()=>{m();Lc();Cg={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>X1(t,n),stringify:lR},Tg={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>X1(t,!1),stringify:lR},Uc={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Uc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,s,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,i,s||0,o||0,a||0,l),u=e[8];if(u&&u!=="Z"){let f=X1(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""}});var tk,cR=se(()=>{m();Rc();gg();zc();Th();H1();JM();nR();aR();fg();Q1();Eg();J1();ek();tk=[fi,hi,yo,Aa,K1,Z1,rR,iR,sR,oR,XM,eR,tR,Ih,ui,Oh,Ah,Nh,Cg,Tg,Uc]});function Fg(t,e,n){let r=uR.get(e);if(r&&!t)return n&&!r.includes(ui)?r.concat(ui):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(uR.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(ui)),i.reduce((s,o)=>{let a=typeof o=="string"?fR[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(fR).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return s.includes(a)||s.push(a),s},[])}var uR,fR,hR,dR=se(()=>{m();Rc();gg();zc();Th();U1();j1();V1();GM();ZM();H1();fg();Q1();Eg();cR();J1();ek();uR=new Map([["core",WM],["failsafe",[fi,hi,yo]],["json",KM],["yaml11",tk],["yaml-1.1",tk]]),fR={binary:Ih,bool:Fh,float:bg,floatExp:wg,floatNaN:yg,floatTime:Tg,int:xg,intHex:Sg,intOct:kg,intTime:Cg,map:fi,merge:ui,null:Aa,omap:Oh,pairs:Ah,seq:hi,set:Nh,timestamp:Uc},hR={"tag:yaml.org,2002:binary":Ih,"tag:yaml.org,2002:merge":ui,"tag:yaml.org,2002:omap":Oh,"tag:yaml.org,2002:pairs":Ah,"tag:yaml.org,2002:set":Nh,"tag:yaml.org,2002:timestamp":Uc}});var RQ,Oa,nk=se(()=>{m();qe();Rc();zc();Th();dR();RQ=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Oa=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Fg(e,"compat"):e?Fg(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?hR:{},this.tags=Fg(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,li,{value:fi}),Object.defineProperty(this,hr,{value:yo}),Object.defineProperty(this,ds,{value:hi}),this.sortMapEntries=typeof o=="function"?o:o===!0?RQ:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}});function mR(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=lg(t,e),{commentString:s}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=s(t.commentBefore);n.unshift(Lr(l,""))}let o=!1,a=null;if(t.contents){if(Le(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);n.push(Lr(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=gs(t.contents,i,()=>a=null,l);a&&(c+=Li(c,"",s(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(gs(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=s(t.comment);l.includes(`
|
||
`)?(n.push("..."),n.push(Lr(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Lr(s(l),"")))}return n.join(`
|
||
`)+`
|
||
`}var pR=se(()=>{m();qe();Ch();xh()});function jc(t){if(We(t))return!0;throw new Error("Expected a YAML collection as document contents")}var gr,Mh=se(()=>{m();bh();rg();qe();ho();uo();nk();pR();Xp();O1();vh();F1();gr=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,xn,{value:Zp});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:o}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new zi({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[xn]:{value:Zp}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=Le(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){jc(this.contents)&&this.contents.add(e)}addIn(e,n){jc(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=I1(this);e.anchor=!n||r.has(n)?A1(n||"a",r):n}return new ci(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let y=b=>typeof b=="number"||b instanceof String||b instanceof Number,w=n.filter(y).map(String);w.length>0&&(n=n.concat(w)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:u}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:d}=LM(this,o||"a"),p={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},g=ms(e,u,p);return a&&We(g)&&(g.flow=!0),h(),g}createPair(e,n,r={}){let i=this.createNode(e,null,r),s=this.createNode(n,null,r);return new ft(i,s)}delete(e){return jc(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Pc(e)?this.contents==null?!1:(this.contents=null,!0):jc(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return We(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Pc(e)?!n&&Ie(this.contents)?this.contents.value:this.contents:We(this.contents)?this.contents.getIn(e,n):void 0}has(e){return We(this.contents)?this.contents.has(e):!1}hasIn(e){return Pc(e)?this.contents!==void 0:We(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=kh(this.schema,[e],n):jc(this.contents)&&this.contents.set(e,n)}setIn(e,n){Pc(e)?this.contents=n:this.contents==null?this.contents=kh(this.schema,Array.from(e),n):jc(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new zi({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new zi({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Oa(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Bt(this.contents,n??"",a);if(typeof s=="function")for(let{count:c,res:u}of a.anchors.values())s(u,c);return typeof o=="function"?co(o,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return mR(this,e)}}});var Pa,qn,Na,Rh,zh=se(()=>{m();Pa=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},qn=class extends Pa{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Na=class extends Pa{constructor(e,n,r){super("YAMLWarning",e,n,r)}},Rh=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="\u2026"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
||
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=n.linePos[1];l?.line===r&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-s)));let c=" ".repeat(s)+"^".repeat(a);n.message+=`:
|
||
|
||
${o}
|
||
${c}
|
||
`}}});function Bi(t,{flow:e,indicator:n,next:r,offset:i,onError:s,parentIndent:o,startOnNewline:a}){let l=!1,c=a,u=a,f="",h="",d=!1,p=!1,g=null,y=null,w=null,b=null,S=null,D=null,k=null;for(let _ of t)switch(p&&(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma"&&s(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p=!1),g&&(c&&_.type!=="comment"&&_.type!=="newline"&&s(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),_.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&_.source.includes(" ")&&(g=_),u=!0;break;case"comment":{u||s(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=_.source.substring(1)||" ";f?f+=h+C:f=C,h="",c=!1;break}case"newline":c?f?f+=_.source:(!D||n!=="seq-item-ind")&&(l=!0):h+=_.source,c=!0,d=!0,(y||w)&&(b=_),u=!0;break;case"anchor":y&&s(_,"MULTIPLE_ANCHORS","A node can have at most one anchor"),_.source.endsWith(":")&&s(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=_,k??(k=_.offset),c=!1,u=!1,p=!0;break;case"tag":{w&&s(_,"MULTIPLE_TAGS","A node can have at most one tag"),w=_,k??(k=_.offset),c=!1,u=!1,p=!0;break}case n:(y||w)&&s(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`),D&&s(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${e??"collection"}`),D=_,c=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&s(_,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=_,c=!1,u=!1;break}default:s(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),c=!1,u=!1}let E=t[t.length-1],v=E?E.offset+E.source.length:i;return p&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(c&&g.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&s(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:D,spaceBefore:l,comment:f,hasNewline:d,anchor:y,tag:w,newlineAfterProp:b,end:v,start:k??v}}var Lh=se(()=>{m()});function wo(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
||
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(wo(e.key)||wo(e.value))return!0}return!1;default:return!0}}var Ig=se(()=>{m()});function Bh(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&wo(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var rk=se(()=>{m();Ig()});function Ag(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(s,o)=>s===o||Ie(s)&&Ie(o)&&s.value===o.value;return e.some(s=>i(s.key,n))}var ik=se(()=>{m();qe()});function yR({composeNode:t,composeEmptyNode:e},n,r,i,s){let o=s?.nodeClass??wt,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,c=null;for(let u of r.items){let{start:f,key:h,sep:d,value:p}=u,g=Bi(f,{indicator:"explicit-key-ind",next:h??d?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0}),y=!g.found;if(y){if(h&&(h.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==r.indent&&i(l,"BAD_INDENT",gR)),!g.anchor&&!g.tag&&!d){c=g.end,g.comment&&(a.comment?a.comment+=`
|
||
`+g.comment:a.comment=g.comment);continue}(g.newlineAfterProp||wo(h))&&i(h??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else g.found?.indent!==r.indent&&i(l,"BAD_INDENT",gR);n.atKey=!0;let w=g.end,b=h?t(n,h,g,i):e(n,w,f,null,g,i);n.schema.compat&&Bh(r.indent,h,i),n.atKey=!1,Ag(n,a.items,b)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let S=Bi(d??[],{indicator:"map-value-ind",next:p,offset:b.range[2],onError:i,parentIndent:r.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=S.end,S.found){y&&(p?.type==="block-map"&&!S.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&g.start<S.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let D=p?t(n,p,S,i):e(n,l,d,null,S,i);n.schema.compat&&Bh(r.indent,p,i),l=D.range[2];let k=new ft(b,D);n.options.keepSourceTokens&&(k.srcToken=u),a.items.push(k)}else{y&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(b.comment?b.comment+=`
|
||
`+S.comment:b.comment=S.comment);let D=new ft(b);n.options.keepSourceTokens&&(D.srcToken=u),a.items.push(D)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,l,c??l],a}var gR,wR=se(()=>{m();ho();po();Lh();Ig();rk();ik();gR="All mapping items must start at the same column"});function bR({composeNode:t,composeEmptyNode:e},n,r,i,s){let o=s?.nodeClass??Zt,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset,c=null;for(let{start:u,value:f}of r.items){let h=Bi(u,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||f)f?.type==="block-seq"?i(h.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(a.comment=h.comment);continue}let d=f?t(n,f,h,i):e(n,h.end,u,null,h,i);n.schema.compat&&Bh(r.indent,f,i),l=d.range[2],a.items.push(d)}return a.range=[r.offset,l,c??l],a}var vR=se(()=>{m();go();Lh();rk()});function $i(t,e,n,r){let i="";if(t){let s=!1,o="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":s=!0;break;case"comment":{n&&!s&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=l),s=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}var qc=se(()=>{m()});function kR({composeNode:t,composeEmptyNode:e},n,r,i,s){let o=r.start.source==="{",a=o?"flow map":"flow sequence",l=s?.nodeClass??(o?wt:Zt),c=new l(n.schema);c.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let w=r.items[y],{start:b,key:S,sep:D,value:k}=w,E=Bi(b,{flow:a,indicator:"explicit-key-ind",next:S??D?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!D&&!k){y===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(c.comment?c.comment+=`
|
||
`+E.comment:c.comment=E.comment),f=E.end;continue}!o&&n.options.strict&&wo(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let v="";e:for(let _ of b)switch(_.type){case"comma":case"space":break;case"comment":v=_.source.substring(1);break e;default:break e}if(v){let _=c.items[c.items.length-1];Me(_)&&(_=_.value??_.key),_.comment?_.comment+=`
|
||
`+v:_.comment=v,E.comment=E.comment.substring(v.length+1)}}if(!o&&!D&&!E.found){let v=k?t(n,k,E,i):e(n,E.end,D,null,E,i);c.items.push(v),f=v.range[2],ok(k)&&i(v.range,"BLOCK_IN_FLOW",sk)}else{n.atKey=!0;let v=E.end,_=S?t(n,S,E,i):e(n,v,b,null,E,i);ok(S)&&i(_.range,"BLOCK_IN_FLOW",sk),n.atKey=!1;let C=Bi(D??[],{flow:a,indicator:"map-value-ind",next:k,offset:_.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!o&&!E.found&&n.options.strict){if(D)for(let N of D){if(N===C.found)break;if(N.type==="newline"){i(N,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<C.found.offset-1024&&i(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${a}`):i(C.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let A=k?t(n,k,C,i):C.found?e(n,C.end,D,null,C,i):null;A?ok(k)&&i(A.range,"BLOCK_IN_FLOW",sk):C.comment&&(_.comment?_.comment+=`
|
||
`+C.comment:_.comment=C.comment);let P=new ft(_,A);if(n.options.keepSourceTokens&&(P.srcToken=w),o){let N=c;Ag(n,N.items,_)&&i(v,"DUPLICATE_KEY","Map keys must be unique"),N.items.push(P)}else{let N=new wt(n.schema);N.flow=!0,N.items.push(P);let B=(A??_).range;N.range=[_.range[0],B[1],B[2]],c.items.push(N)}f=A?A.range[2]:C.end}}let h=o?"}":"]",[d,...p]=r.end,g=f;if(d?.source===h)g=d.offset+d.source.length;else{let y=a[0].toUpperCase()+a.substring(1),w=u?`${y} must end with a ${h}`:`${y} in block collection must be sufficiently indented and end with a ${h}`;i(f,u?"MISSING_CHAR":"BAD_INDENT",w),d&&d.source.length!==1&&p.unshift(d)}if(p.length>0){let y=$i(p,g,n.options.strict,i);y.comment&&(c.comment?c.comment+=`
|
||
`+y.comment:c.comment=y.comment),c.range=[r.offset,g,y.offset]}else c.range=[r.offset,g,g];return c}var sk,ok,xR=se(()=>{m();qe();ho();po();go();qc();Lh();Ig();ik();sk="Block collections are not allowed within flow collections",ok=t=>t&&(t.type==="block-map"||t.type==="block-seq")});function ak(t,e,n,r,i,s){let o=n.type==="block-map"?yR(t,e,n,r,s):n.type==="block-seq"?bR(t,e,n,r,s):kR(t,e,n,r,s),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function SR(t,e,n,r,i){let s=r.tag,o=s?e.directives.tagName(s.source,h=>i(s,"TAG_RESOLVE_FAILED",h)):null;if(n.type==="block-seq"){let{anchor:h,newlineAfterProp:d}=r,p=h&&s?h.offset>s.offset?h:s:h??s;p&&(!d||d.offset<p.offset)&&i(p,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!o||o==="!"||o===wt.tagName&&a==="map"||o===Zt.tagName&&a==="seq")return ak(t,e,n,i,o);let l=e.schema.tags.find(h=>h.tag===o&&h.collection===a);if(!l){let h=e.schema.knownTags[o];if(h?.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?i(s,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),ak(t,e,n,i,o)}let c=ak(t,e,n,i,o,l),u=l.resolve?.(c,h=>i(s,"TAG_RESOLVE_FAILED",h),e.options)??c,f=Le(u)?u:new ue(u);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}var DR=se(()=>{m();qe();Pt();po();go();wR();vR();xR()});function Og(t,e,n){let r=e.offset,i=zQ(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let s=i.mode===">"?ue.BLOCK_FOLDED:ue.BLOCK_LITERAL,o=e.source?LQ(e.source):[],a=o.length;for(let g=o.length-1;g>=0;--g){let y=o[g][1];if(y===""||y==="\r")a=g;else break}if(a===0){let g=i.chomp==="+"&&o.length>0?`
|
||
`.repeat(Math.max(1,o.length-1)):"",y=r+i.length;return e.source&&(y+=e.source.length),{value:g,type:s,comment:i.comment,range:[r,y,y]}}let l=e.indent+i.indent,c=e.offset+i.length,u=0;for(let g=0;g<a;++g){let[y,w]=o[g];if(w===""||w==="\r")i.indent===0&&y.length>l&&(l=y.length);else{y.length<l&&n(c+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=y.length),u=g,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=y.length+w.length+1}for(let g=o.length-1;g>=a;--g)o[g][0].length>l&&(a=g+1);let f="",h="",d=!1;for(let g=0;g<u;++g)f+=o[g][0].slice(l)+`
|
||
`;for(let g=u;g<a;++g){let[y,w]=o[g];c+=y.length+w.length+1;let b=w[w.length-1]==="\r";if(b&&(w=w.slice(0,-1)),w&&y.length<l){let D=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-w.length-(b?2:1),"BAD_INDENT",D),y=""}s===ue.BLOCK_LITERAL?(f+=h+y.slice(l)+w,h=`
|
||
`):y.length>l||w[0]===" "?(h===" "?h=`
|
||
`:!d&&h===`
|
||
`&&(h=`
|
||
|
||
`),f+=h+y.slice(l)+w,h=`
|
||
`,d=!0):w===""?h===`
|
||
`?f+=`
|
||
`:h=`
|
||
`:(f+=h+w,h=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let g=a;g<o.length;++g)f+=`
|
||
`+o[g][0].slice(l);f[f.length-1]!==`
|
||
`&&(f+=`
|
||
`);break;default:f+=`
|
||
`}let p=r+i.length+e.source.length;return{value:f,type:s,comment:i.comment,range:[r,p,p]}}function zQ({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],s=i[0],o=0,a="",l=-1;for(let h=1;h<i.length;++h){let d=i[h];if(!a&&(d==="-"||d==="+"))a=d;else{let p=Number(d);!o&&p?o=p:l===-1&&(l=t+h)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let h=1;h<e.length;++h){let d=e[h];switch(d.type){case"space":c=!0;case"newline":f+=d.source.length;break;case"comment":n&&!c&&r(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=d.source.length,u=d.source.substring(1);break;case"error":r(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{let p=`Unexpected token in block scalar header: ${d.type}`;r(d,"UNEXPECTED_TOKEN",p);let g=d.source;g&&typeof g=="string"&&(f+=g.length)}}}return{mode:s,indent:o,chomp:a,comment:u,length:f}}function LQ(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)s.push([e[o],e[o+1]]);return s}var lk=se(()=>{m();Pt()});function Pg(t,e,n){let{offset:r,type:i,source:s,end:o}=t,a,l,c=(h,d,p)=>n(r+h,d,p);switch(i){case"scalar":a=ue.PLAIN,l=BQ(s,c);break;case"single-quoted-scalar":a=ue.QUOTE_SINGLE,l=$Q(s,c);break;case"double-quoted-scalar":a=ue.QUOTE_DOUBLE,l=UQ(s,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let u=r+s.length,f=$i(o,u,e,n);return{value:l,type:a,comment:f.comment,range:[r,u,f.offset]}}function BQ(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),ER(t)}function $Q(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),ER(t.slice(1,-1)).replace(/''/g,"'")}function ER(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
||
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
||
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let i=r[1],s=" ",o=e.lastIndex;for(n.lastIndex=o;r=n.exec(t);)r[1]===""?s===`
|
||
`?i+=s:s=`
|
||
`:(i+=s+r[1],s=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,r=a.exec(t),i+s+(r?.[1]??"")}function UQ(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
|
||
`))if(i===`
|
||
`){let{fold:s,offset:o}=jQ(t,r);n+=s,r=o}else if(i==="\\"){let s=t[++r],o=qQ[s];if(o)n+=o;else if(s===`
|
||
`)for(s=t[r+1];s===" "||s===" ";)s=t[++r+1];else if(s==="\r"&&t[r+1]===`
|
||
`)for(s=t[++r+1];s===" "||s===" ";)s=t[++r+1];else if(s==="x"||s==="u"||s==="U"){let a={x:2,u:4,U:8}[s];n+=VQ(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let s=r,o=t[r+1];for(;o===" "||o===" ";)o=t[++r+1];o!==`
|
||
`&&!(o==="\r"&&t[r+2]===`
|
||
`)&&(n+=r>s?t.slice(s,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function jQ(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
|
||
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
||
`);)r===`
|
||
`&&(n+=`
|
||
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}function VQ(t,e,n,r){let i=t.substr(e,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}var qQ,ck=se(()=>{m();Pt();qc();qQ={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
||
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "}});function uk(t,e,n,r){let{value:i,type:s,comment:o,range:a}=e.type==="block-scalar"?Og(t,e,r):Pg(e,t.options.strict,r),l=n?t.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[hr]:l?c=HQ(t.schema,i,l,n,r):e.type==="scalar"?c=WQ(t,i,e,r):c=t.schema[hr];let u;try{let f=c.resolve(i,h=>r(n??e,"TAG_RESOLVE_FAILED",h),t.options);u=Ie(f)?f:new ue(f)}catch(f){let h=f instanceof Error?f.message:String(f);r(n??e,"TAG_RESOLVE_FAILED",h),u=new ue(i)}return u.range=a,u.source=i,s&&(u.type=s),l&&(u.tag=l),c.format&&(u.format=c.format),o&&(u.comment=o),u}function HQ(t,e,n,r,i){if(n==="!")return t[hr];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[hr])}function WQ({atKey:t,directives:e,schema:n},r,i,s){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[hr];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(r))??n[hr];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;s(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}var _R=se(()=>{m();qe();Pt();lk();ck()});function CR(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}var TR=se(()=>{m()});function fk(t,e,n,r){let i=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:l}=n,c,u=!0;switch(e.type){case"alias":c=QQ(t,e,r),(a||l)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=uk(t,e,l,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=SR(GQ,t,e,n,r),a&&(c.anchor=a.source.substring(1))}catch(f){let h=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",h)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=Ng(t,e.offset,void 0,null,n,r)),a&&c.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Ie(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&r(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),t.options.keepSourceTokens&&u&&(c.srcToken=e),c}function Ng(t,e,n,r,{spaceBefore:i,comment:s,anchor:o,tag:a,end:l},c){let u={type:"scalar",offset:CR(e,n,r),indent:-1,source:""},f=uk(t,u,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=l),f}function QQ({options:t},{offset:e,source:n,end:r},i){let s=new ci(n.substring(1));s.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=$i(r,o,t.strict,i);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}var GQ,FR=se(()=>{m();bh();qe();DR();_R();qc();TR();GQ={composeNode:fk,composeEmptyNode:Ng}});function IR(t,e,{offset:n,start:r,value:i,end:s},o){let a=Object.assign({_directives:e},t),l=new gr(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=Bi(r,{indicator:"doc-start",next:i??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?fk(c,i,u,o):Ng(c,u.end,r,null,u,o);let f=l.contents.range[2],h=$i(s,f,!1,o);return h.comment&&(l.comment=h.comment),l.range=[n,f,h.offset],l}var AR=se(()=>{m();Mh();FR();qc();Lh()});function $h(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function OR(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let s=t[i];switch(s[0]){case"#":e+=(e===""?"":r?`
|
||
|
||
`:`
|
||
`)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var bo,hk=se(()=>{m();F1();Mh();zh();qe();AR();qc();bo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,s)=>{let o=$h(n);s?this.warnings.push(new Na(o,r,i)):this.errors.push(new qn(o,r,i))},this.directives=new zi({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=OR(this.prelude);if(r){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
||
${r}`:r;else if(i||e.directives.docStart||!s)e.commentBefore=r;else if(We(s)&&!s.flow&&s.items.length>0){let o=s.items[0];Me(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${r}
|
||
${a}`:r}else{let o=s.commentBefore;s.commentBefore=o?`${r}
|
||
${o}`:r}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:OR(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let s=$h(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=IR(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new qn($h(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new qn($h(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=$i(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
||
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new qn($h(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new gr(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}});function PR(t,e=!0,n){if(t){let r=(i,s,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,s,o);else throw new qn([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Pg(t,e,r);case"block-scalar":return Og({options:{strict:e}},t,r)}}return null}function NR(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:s=-1,type:o="PLAIN"}=e,a=ps({type:o,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
||
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
||
`),u=a.substring(0,c),f=a.substring(c+1)+`
|
||
`,h=[{type:"block-scalar-header",offset:s,indent:r,source:u}];return RR(h,l)||h.push({type:"newline",offset:-1,indent:r,source:`
|
||
`}),{type:"block-scalar",offset:s,indent:r,props:h,source:f}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:a,end:l};default:return{type:"scalar",offset:s,indent:r,source:a,end:l}}}function MR(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=ps({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":KQ(t,l);break;case'"':dk(t,l,"double-quoted-scalar");break;case"'":dk(t,l,"single-quoted-scalar");break;default:dk(t,l,"scalar")}}function KQ(t,e){let n=e.indexOf(`
|
||
`),r=e.substring(0,n),i=e.substring(n+1)+`
|
||
`;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,t.source=i}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:r}];RR(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
||
`});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function RR(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function dk(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let s of r)s.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
||
`};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}var zR=se(()=>{m();lk();ck();zh();_h()});function Rg(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Rg(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Mg(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Mg(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Mg(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Mg({start:t,key:e,sep:n,value:r}){let i="";for(let s of t)i+=s.source;if(e&&(i+=Rg(e)),n)for(let s of n)i+=s.source;return r&&(i+=Rg(r)),i}var LR,BR=se(()=>{m();LR=t=>"type"in t?Rg(t):Mg(t)});function vo(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),UR(Object.freeze([]),t,e)}function UR(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let s=e[i];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=UR(Object.freeze(t.concat([[i,o]])),s.items[o],n);if(typeof a=="number")o=a-1;else{if(a===mk)return mk;a===$R&&(s.items.splice(o,1),o-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}var mk,ZQ,$R,jR=se(()=>{m();mk=Symbol("break visit"),ZQ=Symbol("skip children"),$R=Symbol("remove item");vo.BREAK=mk;vo.SKIP=ZQ;vo.REMOVE=$R;vo.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let s=n?.[r];if(s&&"items"in s)n=s.items[i];else return}return n};vo.parentCollection=(t,e)=>{let n=vo.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")}});var zg={};fu(zg,{BOM:()=>Uh,DOCUMENT:()=>jh,FLOW_END:()=>qh,SCALAR:()=>Vc,createScalarToken:()=>NR,isCollection:()=>YQ,isScalar:()=>JQ,prettyToken:()=>XQ,resolveAsScalar:()=>PR,setScalarValue:()=>MR,stringify:()=>LR,tokenType:()=>pk,visit:()=>vo});function XQ(t){switch(t){case Uh:return"<BOM>";case jh:return"<DOC>";case qh:return"<FLOW_END>";case Vc:return"<SCALAR>";default:return JSON.stringify(t)}}function pk(t){switch(t){case Uh:return"byte-order-mark";case jh:return"doc-mode";case qh:return"flow-error-end";case Vc:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
||
`:case`\r
|
||
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}var Uh,jh,qh,Vc,YQ,JQ,Lg=se(()=>{m();zR();BR();jR();Uh="\uFEFF",jh="",qh="",Vc="",YQ=t=>!!t&&"items"in t,JQ=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar")});function di(t){switch(t){case void 0:case" ":case`
|
||
`:case"\r":case" ":return!0;default:return!1}}var qR,eK,Bg,tK,gk,Ma,yk=se(()=>{m();Lg();qR=new Set("0123456789ABCDEFabcdef"),eK=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Bg=new Set(",[]{}"),tK=new Set(` ,[]{}
|
||
\r `),gk=t=>!t||tK.has(t),Ma=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
|
||
`?!0:n==="\r"?this.buffer[e+1]===`
|
||
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
|
||
`||!i&&!this.atEnd)return e+r+1}return n===`
|
||
`||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&di(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
||
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Uh&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let s=e[r-1];if(s===" "||s===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield jh,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&di(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!di(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&di(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(gk),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&di(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield qh,yield*this.parseLineStart();let s=0;for(;i[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(gk),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||di(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
|
||
`,this.pos);if(i!==-1){for(;i!==-1;){let s=this.continueScalar(i+1);if(s===-1)break;i=r.indexOf(`
|
||
`,s)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>di(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
|
||
`:e=s,n=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
||
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
|
||
`,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
||
`;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
|
||
`&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield Vc,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let s=this.buffer[r+1];if(di(s)||e&&Bg.has(s))break;n=r}else if(di(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===`
|
||
`?(r+=1,i=`
|
||
`,s=this.buffer[r+1]):n=r),s==="#"||e&&Bg.has(s))break;if(i===`
|
||
`){let o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Bg.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Vc,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(gk))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(di(n)||e&&Bg.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!di(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(eK.has(n))n=this.buffer[++e];else if(n==="%"&&qR.has(this.buffer[e+1])&&qR.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
||
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
||
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}});var Ra,wk=se(()=>{m();Ra=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<e?n=s+1:r=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}}});function ko(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function VR(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function WR(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function $g(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Hc(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function HR(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!ko(e.start,"explicit-key-ind")&&!ko(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,WR(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var xo,bk=se(()=>{m();Lg();yk();xo=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ma,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=pk(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&HR(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&VR(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{VR(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=$g(this.peek(2)),r=Hc(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
||
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
||
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ko(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(WR(n.key)&&!ko(n.sep,"newline")){let o=Hc(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(ko(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=Hc(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):ko(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!ko(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||ko(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=$g(r),s=Hc(i);HR(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
|
||
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
||
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=$g(e),r=Hc(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=$g(e),r=Hc(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}});function GR(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Ra||null,prettyErrors:e}}function vk(t,e={}){let{lineCounter:n,prettyErrors:r}=GR(e),i=new xo(n?.addNewLine),s=new bo(e),o=Array.from(s.compose(i.parse(t)));if(r&&n)for(let a of o)a.errors.forEach(Rh(t,n)),a.warnings.forEach(Rh(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function Wc(t,e={}){let{lineCounter:n,prettyErrors:r}=GR(e),i=new xo(n?.addNewLine),s=new bo(e),o=null;for(let a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new qn(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(Rh(t,n)),o.warnings.forEach(Rh(t,n))),o}function kk(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Wc(t,n);if(!i)return null;if(i.warnings.forEach(s=>cg(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function xk(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return dr(t)&&!r?t.toString(n):new gr(t,r,n).toString(n)}var QR=se(()=>{m();hk();Mh();zh();R1();qe();wk();bk()});var Sk={};fu(Sk,{Alias:()=>ci,CST:()=>zg,Composer:()=>bo,Document:()=>gr,Lexer:()=>Ma,LineCounter:()=>Ra,Pair:()=>ft,Parser:()=>xo,Scalar:()=>ue,Schema:()=>Oa,YAMLError:()=>Pa,YAMLMap:()=>wt,YAMLParseError:()=>qn,YAMLSeq:()=>Zt,YAMLWarning:()=>Na,isAlias:()=>Un,isCollection:()=>We,isDocument:()=>dr,isMap:()=>mr,isNode:()=>Le,isPair:()=>Me,isScalar:()=>Ie,isSeq:()=>pr,parse:()=>kk,parseAllDocuments:()=>vk,parseDocument:()=>Wc,stringify:()=>xk,visit:()=>zr,visitAsync:()=>Ac});var Dk=se(()=>{m();hk();Mh();nk();zh();bh();qe();ho();Pt();po();go();Lg();yk();wk();bk();QR();wh()});var KR={};fu(KR,{Alias:()=>ci,CST:()=>zg,Composer:()=>bo,Document:()=>gr,Lexer:()=>Ma,LineCounter:()=>Ra,Pair:()=>ft,Parser:()=>xo,Scalar:()=>ue,Schema:()=>Oa,YAMLError:()=>Pa,YAMLMap:()=>wt,YAMLParseError:()=>qn,YAMLSeq:()=>Zt,YAMLWarning:()=>Na,default:()=>nK,isAlias:()=>Un,isCollection:()=>We,isDocument:()=>dr,isMap:()=>mr,isNode:()=>Le,isPair:()=>Me,isScalar:()=>Ie,isSeq:()=>pr,parse:()=>kk,parseAllDocuments:()=>vk,parseDocument:()=>Wc,stringify:()=>xk,visit:()=>zr,visitAsync:()=>Ac});var nK,Ek=se(()=>{m();Dk();Dk();nK=Sk});var TY={};fu(TY,{default:()=>by});module.exports=JL(TY);m();var bs=require("obsidian");m();m();var Cx=require("obsidian"),tl=(t,e,n=!1)=>!!e?.[t]||n;function Tx(t,e,n=!1){return tl(t,e,n)?!0:(new Cx.Notice("Quartz Syncer: Note does not have the publish: true set. Please add this and try again."),!1)}m();var ea=require("obsidian");m();var l$=it(Hx()),pd=require("obsidian");async function nl(t){let e=new TextEncoder,n=e.encode(t),r=n.byteLength,i=e.encode(`blob ${r}\0`),s=new Uint8Array(i.length+n.length);s.set(i,0),s.set(n,i.length);let o=await crypto.subtle.digest("SHA-1",s);return Array.from(new Uint8Array(o)).map(a=>a.toString(16).padStart(2,"0")).join("")}function jr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Wx(t){return t.endsWith("/")&&t.slice(0,-1),t.startsWith("/")||(t="/"+t),t}function Ds(t){let e=app.plugins.enabledPlugins;return e.has(t)||e.has(t.toLowerCase())}function Ny(t){return t=decodeURI(t),t=t.replace(/\[#([^\]]+)\]\(#([^)]+)\)/g,'<a href="tags/$2" class="tag-link">$1</a>'),t=t.replace(/#([\w\\/]+)/g,'<a href="tags/$1" class="tag-link">$1</a>'),t=t.replace(/(\[.*?\]\()(.+?)\.md(\))/g,"$1$2$3"),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"[[$2|$1]]"),t.trim()}function Ki(t,e,n=5e3,r=500){return new Promise((i,s)=>{let o,a=()=>{window.clearTimeout(o)},l=new MutationObserver(()=>{a(),o=window.setTimeout(()=>{c(),i()},r)}),c=()=>{l.disconnect(),a(),window.clearTimeout(u)};l.observe(t,{childList:!0,subtree:!0});let u=window.setTimeout(()=>{c(),s(new Error(`Timeout waiting for selector: ${e}`))},n)})}function gd(t,e=1){let n=t.split(`
|
||
`),r="> ".repeat(e);return" "+n.join(`
|
||
${r}`)}function yd(t){let e=0,n=t.split(`
|
||
`),r=[];for(let s of n){let o=0;if(s.startsWith(">")){o+=1;let a=s.substring(1).trim();for(;a.startsWith(">");)a=a.substring(1).trim(),o+=1;r.push(a)}else r.push(s);e=Math.max(e,o)}let i=t;return e>0&&(i=r.join(`
|
||
`)),{isInsideCalloutDepth:e,finalQuery:i}}function du(t,e){let n=t.querySelectorAll("style"),r=(0,pd.sanitizeHTMLToDom)(t.innerHTML),i=document.createElement("div");i.appendChild(r),h$(i,"link, meta, title"),i.querySelectorAll("a.internal-link, a.tag, a:not(.external-link):not(.internal-link):not(.tag)").length>0&&f$(i),i=u$(i),i=d$(i);let o=i.classList,a=["datacore-table","datacore-list"],l=["p","h1","h2","h3","h4","h5","h6","ul","ol","li","table","thead","tbody","tr","td","th"];if(o.length>0&&Array.from(o).some(u=>a.includes(u))||l.includes(i.tagName.toLowerCase())){let u=(0,pd.htmlToMarkdown)(i)||"";return Ny(u)}return n.forEach(u=>{i.append(u)}),c$(i),e.serializeToString(i).replace(' xmlns="http://www.w3.org/1999/xhtml"',"")}function c$(t){let e=["__source","__self"];t.querySelectorAll(`${e.map(r=>`[${r}]`).join(", ")}`).forEach(r=>{e.forEach(i=>{r.removeAttribute(i)})})}function u$(t){let e=t.querySelectorAll(".callout");return e.length===0||e.forEach(n=>{let r=document.createElement("blockquote");n.hasAttribute("data-callout-fold")&&(n.getAttribute("data-callout-fold")==="-"&&r.classList.add("is-collapsed"),n.setAttribute("data-callout-fold","")),n.hasAttribute("data-callout")||n.setAttribute("data-callout","note");for(let a=0;a<n.attributes.length;a++)n.attributes.item(a)!==null&&r.setAttribute(n.attributes.item(a).name,n.attributes.item(a).value||"");r.replaceChildren(...Array.from(n.childNodes,a=>a.cloneNode(!0))),r.classList.remove("datacore");let i=r.querySelector(".callout-content");if(i){let a=document.createElement("div");a.classList.add("callout-content-inner"),a.replaceChildren(...Array.from(i.childNodes,l=>l.cloneNode(!0))),i.replaceChildren(),i.appendChild(a)}let s=r.querySelector(".callout-fold");if(s){s.classList.replace("callout-fold","fold-callout-icon");let a=s.querySelector("svg");a&&s.removeChild(a)}let o=r.querySelector(".callout-title");if(o&&o.children&&!o.children[0].classList.contains("callout-icon")){let a=document.createElement("div");a.classList.add("callout-icon"),o.prepend(a)}n.replaceWith(r)}),t}function f$(t){t.querySelectorAll("a.internal-link, a.tag, a:not(.external-link):not(.internal-link):not(.tag)").forEach(n=>{n.removeAttribute("target"),n.removeAttribute("rel"),n.removeAttribute("data-href"),n.hasAttribute("href")&&(n.getAttribute("href")?.startsWith("http")?n.classList.add("external-link"):n.classList.add("internal-link"))})}function h$(t,e){t.querySelectorAll(e).forEach(r=>{r.remove()})}function d$(t){for(;t.attributes.length===0&&t.children.length===1;){let e=t.firstElementChild;if(e)t.replaceWith(e),t=e;else break}return t}async function My(t,e,n=10,r){let i=[],s=t.length;for(let o=0;o<s;o+=n){let a=t.slice(o,o+n),l=await Promise.all(a.map(e));i.push(...l),r&&r(Math.min(o+n,s),s),await new Promise(c=>window.setTimeout(c,0))}return i}m();var Gx=/^\s*?---\n([\s\S]*?)\n---/g;var Qx=/target=["']_blank["'] rel=["']noopener["']/g,Kx=/^([^:]+)::\s(.*?)$/gm,Zx=/\[([^:\][]+)::\s(.*?)\]|\(([^:)(]+)::\s(.*?)\)/g;var S0=it(vt());m();m();m();function Ry(t){if(t)throw t}var kd=it(oS(),1);m();function mu(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}m();m();function zy(){let t=[],e={run:n,use:r};return e;function n(...i){let s=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){let u=t[++s],f=-1;if(l){o(l);return}for(;++f<i.length;)(c[f]===null||c[f]===void 0)&&(c[f]=i[f]);i=c,u?aS(u,a)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function aS(t,e){let n;return r;function r(...o){let a=t.length>o.length,l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){let u=c;if(a&&n)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}m();m();m();m();m();m();function Es(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?lS(t.position):"start"in t||"end"in t?lS(t):"line"in t||"column"in t?Ly(t):""}function Ly(t){return cS(t&&t.line)+":"+cS(t&&t.column)}function lS(t){return Ly(t&&t.start)+"-"+Ly(t&&t.end)}function cS(t){return t&&typeof t=="number"?t:1}var qt=class extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){let l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){let l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}let a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Es(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};qt.prototype.file="";qt.prototype.name="";qt.prototype.reason="";qt.prototype.message="";qt.prototype.stack="";qt.prototype.column=void 0;qt.prototype.line=void 0;qt.prototype.ancestors=void 0;qt.prototype.cause=void 0;qt.prototype.fatal=void 0;qt.prototype.place=void 0;qt.prototype.ruleId=void 0;qt.prototype.source=void 0;m();var qr={basename:m$,dirname:p$,extname:g$,join:y$,sep:"/"};function m$(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');pu(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function p$(t){if(pu(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function g$(t){pu(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){let a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function y$(...t){let e=-1,n;for(;++e<t.length;)pu(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":w$(n)}function w$(t){pu(t);let e=t.codePointAt(0)===47,n=b$(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function b$(t,e){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function pu(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}m();var uS={cwd:v$};function v$(){return"/"}m();m();function rl(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function fS(t){if(typeof t=="string")t=new URL(t);else if(!rl(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return k$(t)}function k$(t){if(t.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let e=t.pathname,n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){let r=e.codePointAt(n+2);if(r===70||r===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var By=["history","path","basename","stem","extname","dirname"],gu=class{constructor(e){let n;e?rl(e)?n={path:e}:typeof e=="string"||x$(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":uS.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<By.length;){let s=By[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)By.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?qr.basename(this.path):void 0}set basename(e){Uy(e,"basename"),$y(e,"basename"),this.path=qr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?qr.dirname(this.path):void 0}set dirname(e){hS(this.basename,"dirname"),this.path=qr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?qr.extname(this.path):void 0}set extname(e){if($y(e,"extname"),hS(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=qr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){rl(e)&&(e=fS(e)),Uy(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?qr.basename(this.path,this.extname):void 0}set stem(e){Uy(e,"stem"),$y(e,"stem"),this.path=qr.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){let i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){let i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){let i=new qt(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function $y(t,e){if(t&&t.includes(qr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+qr.sep+"`")}function Uy(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function hS(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function x$(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}m();var dS=function(t){let r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s};var S$={}.hasOwnProperty,Hy=class t extends dS{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=zy()}copy(){let e=new t,n=-1;for(;++n<this.attachers.length;){let r=this.attachers[n];e.use(...r)}return e.data((0,kd.default)(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Vy("data",this.frozen),this.namespace[e]=n,this):S$.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Vy("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let n=vd(e),r=this.parser||this.Parser;return jy("parse",r),r(String(n),n)}process(e,n){let r=this;return this.freeze(),jy("process",this.parser||this.Parser),qy("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){let a=vd(e),l=r.parse(a);r.run(l,a,function(u,f,h){if(u||!f||!h)return c(u);let d=f,p=r.stringify(d,h);E$(p)?h.value=p:h.result=p,c(u,h)});function c(u,f){u||!f?o(u):s?s(f):n(void 0,f)}}}processSync(e){let n=!1,r;return this.freeze(),jy("processSync",this.parser||this.Parser),qy("processSync",this.compiler||this.Compiler),this.process(e,i),pS("processSync","process",n),r;function i(s,o){n=!0,Ry(s),r=o}}run(e,n,r){mS(e),this.freeze();let i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){let l=vd(n);i.run(e,l,c);function c(u,f,h){let d=f||e;u?a(u):o?o(d):r(void 0,d,h)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),pS("runSync","run",r),i;function s(o,a){Ry(o),i=a,r=!0}}stringify(e,n){this.freeze();let r=vd(n),i=this.compiler||this.Compiler;return qy("stringify",i),mS(e),i(e,r)}use(e,...n){let r=this.attachers,i=this.namespace;if(Vy("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...f]=c;l(u,f)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=(0,kd.default)(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let f=c[u];s(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===c){h=f;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[d,...p]=u,g=r[h][1];mu(g)&&mu(d)&&(d=(0,kd.default)(!0,g,d)),r[h]=[c,d,...p]}}}},Wy=new Hy().freeze();function jy(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function qy(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Vy(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mS(t){if(!mu(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function pS(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function vd(t){return D$(t)?t:new gu(t)}function D$(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function E$(t){return typeof t=="string"||_$(t)}function _$(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}m();m();m();m();m();m();var C$={};function Lo(t,e){let n=e||C$,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return yS(t,r,i)}function yS(t,e,n){if(T$(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return gS(t.children,e,n)}return Array.isArray(t)?gS(t,e,n):""}function gS(t,e,n){let r=[],i=-1;for(;++i<t.length;)r[i]=yS(t[i],e,n);return r.join("")}function T$(t){return!!(t&&typeof t=="object")}m();m();var wS=document.createElement("i");function il(t){let e="&"+t+";";wS.innerHTML=e;let n=wS.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}m();function Xt(t,e,n,r){let i=t.length,s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function pn(t,e){return t.length>0?(Xt(t,t.length,0,e),t):e}m();var bS={}.hasOwnProperty;function vS(t){let e={},n=-1;for(;++n<t.length;)F$(e,t[n]);return e}function F$(t,e){let n;for(n in e){let i=(bS.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n],o;if(s)for(o in s){bS.call(i,o)||(i[o]=[]);let a=s[o];I$(i[o],Array.isArray(a)?a:a?[a]:[])}}}function I$(t,e){let n=-1,r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Xt(t,0,0,r)}m();function xd(t,e){let n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}m();function Zi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}m();var Yn=_s(/[A-Za-z]/),gn=_s(/[\dA-Za-z]/),kS=_s(/[#-'*+\--9=?A-Z^-~]/);function yu(t){return t!==null&&(t<32||t===127)}var wu=_s(/\d/),xS=_s(/[\dA-Fa-f]/),SS=_s(/[!-/:-@[-`{-~]/);function ae(t){return t!==null&&t<-2}function _t(t){return t!==null&&(t<0||t===32)}function be(t){return t===-2||t===-1||t===32}var DS=_s(/\p{P}|\p{S}/u),ES=_s(/\s/);function _s(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}m();m();m();function Fe(t,e,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,s=0;return o;function o(l){return be(l)?(t.enter(n),a(l)):e(l)}function a(l){return be(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}var _S={tokenize:A$};function A$(t){let e=t.attempt(this.parser.constructs.contentInitial,r,i),n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Fe(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){let l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return ae(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}m();var TS={tokenize:O$},CS={tokenize:P$};function O$(t){let e=this,n=[],r=0,i,s,o;return a;function a(S){if(r<n.length){let D=n[r];return e.containerState=D[1],t.attempt(D[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&b();let D=e.events.length,k=D,E;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){E=e.events[k][1].end;break}w(r);let v=D;for(;v<e.events.length;)e.events[v][1].end={...E},v++;return Xt(e.events,k+1,0,e.events.slice(D)),e.events.length=v,c(S)}return a(S)}function c(S){if(r===n.length){if(!i)return h(S);if(i.currentConstruct&&i.currentConstruct.concrete)return p(S);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(CS,u,f)(S)}function u(S){return i&&b(),w(r),h(S)}function f(S){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,p(S)}function h(S){return e.containerState={},t.attempt(CS,d,p)(S)}function d(S){return r++,n.push([e.currentConstruct,e.containerState]),h(S)}function p(S){if(S===null){i&&b(),w(0),t.consume(S);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(S)}function g(S){if(S===null){y(t.exit("chunkFlow"),!0),w(0),t.consume(S);return}return ae(S)?(t.consume(S),y(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(S),g)}function y(S,D){let k=e.sliceStream(S);if(D&&k.push(null),S.previous=s,s&&(s.next=S),s=S,i.defineSkip(S.start),i.write(k),e.parser.lazy[S.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<o&&(!i.events[E][1].end||i.events[E][1].end.offset>o))return;let v=e.events.length,_=v,C,A;for(;_--;)if(e.events[_][0]==="exit"&&e.events[_][1].type==="chunkFlow"){if(C){A=e.events[_][1].end;break}C=!0}for(w(r),E=v;E<e.events.length;)e.events[E][1].end={...A},E++;Xt(e.events,_+1,0,e.events.slice(v)),e.events.length=E}}function w(S){let D=n.length;for(;D-- >S;){let k=n[D];e.containerState=k[1],k[0].exit.call(e,t)}n.length=S}function b(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function P$(t,e,n){return Fe(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}m();m();m();m();function sl(t){if(t===null||_t(t)||ES(t))return 1;if(DS(t))return 2}m();function ol(t,e,n){let r=[],i=-1;for(;++i<t.length;){let s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}var bu={name:"attention",resolveAll:N$,tokenize:M$};function N$(t,e){let n=-1,r,i,s,o,a,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;let f={...t[r][1].end},h={...t[n][1].start};FS(f,-l),FS(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:h},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=pn(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=pn(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=pn(c,ol(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=pn(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=pn(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,Xt(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function M$(t,e){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=sl(r),s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;let c=t.exit("attentionSequence"),u=sl(l),f=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?f:f&&(i||!h)),c._close=!!(s===42?h:h&&(u||!f)),e(l)}}function FS(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}m();var Gy={name:"autolink",tokenize:R$};function R$(t,e,n){let r=0;return i;function i(d){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(d){return Yn(d)?(t.consume(d),o):d===64?n(d):c(d)}function o(d){return d===43||d===45||d===46||gn(d)?(r=1,a(d)):c(d)}function a(d){return d===58?(t.consume(d),r=0,l):(d===43||d===45||d===46||gn(d))&&r++<32?(t.consume(d),a):(r=0,c(d))}function l(d){return d===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):d===null||d===32||d===60||yu(d)?n(d):(t.consume(d),l)}function c(d){return d===64?(t.consume(d),u):kS(d)?(t.consume(d),c):n(d)}function u(d){return gn(d)?f(d):n(d)}function f(d){return d===46?(t.consume(d),r=0,u):d===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):h(d)}function h(d){if((d===45||gn(d))&&r++<63){let p=d===45?h:f;return t.consume(d),p}return n(d)}}m();var Cs={partial:!0,tokenize:z$};function z$(t,e,n){return r;function r(s){return be(s)?Fe(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||ae(s)?e(s):n(s)}}m();var Sd={continuation:{tokenize:B$},exit:$$,name:"blockQuote",tokenize:L$};function L$(t,e,n){let r=this;return i;function i(o){if(o===62){let a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return be(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function B$(t,e,n){let r=this;return i;function i(o){return be(o)?Fe(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(Sd,e,n)(o)}}function $$(t){t.exit("blockQuote")}m();var Dd={name:"characterEscape",tokenize:U$};function U$(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return SS(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}m();var Ed={name:"characterReference",tokenize:j$};function j$(t,e,n){let r=this,i=0,s,o;return a;function a(f){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),l}function l(f){return f===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(f),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=gn,u(f))}function c(f){return f===88||f===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(f),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=xS,u):(t.enter("characterReferenceValue"),s=7,o=wu,u(f))}function u(f){if(f===59&&i){let h=t.exit("characterReferenceValue");return o===gn&&!il(r.sliceSerialize(h))?n(f):(t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(f)&&i++<s?(t.consume(f),u):n(f)}}m();var IS={partial:!0,tokenize:V$},_d={concrete:!0,name:"codeFenced",tokenize:q$};function q$(t,e,n){let r=this,i={partial:!0,tokenize:k},s=0,o=0,a;return l;function l(E){return c(E)}function c(E){let v=r.events[r.events.length-1];return s=v&&v[1].type==="linePrefix"?v[2].sliceSerialize(v[1],!0).length:0,a=E,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===a?(o++,t.consume(E),u):o<3?n(E):(t.exit("codeFencedFenceSequence"),be(E)?Fe(t,f,"whitespace")(E):f(E))}function f(E){return E===null||ae(E)?(t.exit("codeFencedFence"),r.interrupt?e(E):t.check(IS,g,D)(E)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||ae(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),f(E)):be(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Fe(t,d,"whitespace")(E)):E===96&&E===a?n(E):(t.consume(E),h)}function d(E){return E===null||ae(E)?f(E):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===null||ae(E)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),f(E)):E===96&&E===a?n(E):(t.consume(E),p)}function g(E){return t.attempt(i,D,y)(E)}function y(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),w}function w(E){return s>0&&be(E)?Fe(t,b,"linePrefix",s+1)(E):b(E)}function b(E){return E===null||ae(E)?t.check(IS,g,D)(E):(t.enter("codeFlowValue"),S(E))}function S(E){return E===null||ae(E)?(t.exit("codeFlowValue"),b(E)):(t.consume(E),S)}function D(E){return t.exit("codeFenced"),e(E)}function k(E,v,_){let C=0;return A;function A(G){return E.enter("lineEnding"),E.consume(G),E.exit("lineEnding"),P}function P(G){return E.enter("codeFencedFence"),be(G)?Fe(E,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):N(G)}function N(G){return G===a?(E.enter("codeFencedFenceSequence"),B(G)):_(G)}function B(G){return G===a?(C++,E.consume(G),B):C>=o?(E.exit("codeFencedFenceSequence"),be(G)?Fe(E,L,"whitespace")(G):L(G)):_(G)}function L(G){return G===null||ae(G)?(E.exit("codeFencedFence"),v(G)):_(G)}}}function V$(t,e,n){let r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}m();var vu={name:"codeIndented",tokenize:W$},H$={partial:!0,tokenize:G$};function W$(t,e,n){let r=this;return i;function i(c){return t.enter("codeIndented"),Fe(t,s,"linePrefix",5)(c)}function s(c){let u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):ae(c)?t.attempt(H$,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||ae(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function G$(t,e,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):ae(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Fe(t,s,"linePrefix",5)(o)}function s(o){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):ae(o)?i(o):n(o)}}m();var Qy={name:"codeText",previous:K$,resolve:Q$,tokenize:Z$};function Q$(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function K$(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Z$(t,e,n){let r=this,i=0,s,o;return a;function a(h){return t.enter("codeText"),t.enter("codeTextSequence"),l(h)}function l(h){return h===96?(t.consume(h),i++,l):(t.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),c):h===96?(o=t.enter("codeTextSequence"),s=0,f(h)):ae(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||ae(h)?(t.exit("codeTextData"),c(h)):(t.consume(h),u)}function f(h){return h===96?(t.consume(h),s++,f):s===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(o.type="codeTextData",u(h))}}m();m();m();var Cd=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){let r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){let i=n||0;this.setCursor(Math.trunc(e));let s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ku(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),ku(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ku(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let n=this.left.splice(e,Number.POSITIVE_INFINITY);ku(this.right,n.reverse())}else{let n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);ku(this.left,n.reverse())}}};function ku(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Td(t){let e={},n=-1,r,i,s,o,a,l,c,u=new Cd(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Y$(u,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return Xt(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Y$(t,e){let n=t.get(e)[1],r=t.get(e)[2],i=e-1,s=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let a=o.events,l=[],c={},u,f,h=-1,d=n,p=0,g=0,y=[g];for(;d;){for(;t.get(++i)[1]!==d;);s.push(i),d._tokenizer||(u=r.sliceStream(d),d.next||u.push(null),f&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=d,d=d.next}for(d=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(g=h+1,y.push(g),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):y.pop(),h=y.length;h--;){let w=a.slice(y[h],y[h+1]),b=s.pop();l.push([b,b+w.length-1]),t.splice(b,2,w)}for(l.reverse(),h=-1;++h<l.length;)c[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return c}var Ky={resolve:X$,tokenize:e6},J$={partial:!0,tokenize:t6};function X$(t){return Td(t),t}function e6(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):ae(a)?t.check(J$,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function t6(t,e,n){let r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Fe(t,s,"linePrefix")}function s(o){if(o===null||ae(o))return n(o);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}m();m();function Fd(t,e,n,r,i,s,o,a,l){let c=l||Number.POSITIVE_INFINITY,u=0;return f;function f(w){return w===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(w),t.exit(s),h):w===null||w===32||w===41||yu(w)?n(w):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(w))}function h(w){return w===62?(t.enter(s),t.consume(w),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),d(w))}function d(w){return w===62?(t.exit("chunkString"),t.exit(a),h(w)):w===null||w===60||ae(w)?n(w):(t.consume(w),w===92?p:d)}function p(w){return w===60||w===62||w===92?(t.consume(w),d):d(w)}function g(w){return!u&&(w===null||w===41||_t(w))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(w)):u<c&&w===40?(t.consume(w),u++,g):w===41?(t.consume(w),u--,g):w===null||w===32||w===40||yu(w)?n(w):(t.consume(w),w===92?y:g)}function y(w){return w===40||w===41||w===92?(t.consume(w),g):g(w)}}m();function Id(t,e,n,r,i,s){let o=this,a=0,l;return c;function c(d){return t.enter(r),t.enter(i),t.consume(d),t.exit(i),t.enter(s),u}function u(d){return a>999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(d):d===93?(t.exit(s),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):ae(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||ae(d)||a++>999?(t.exit("chunkString"),u(d)):(t.consume(d),l||(l=!be(d)),d===92?h:f)}function h(d){return d===91||d===92||d===93?(t.consume(d),a++,f):f(d)}}m();function Ad(t,e,n,r,i,s){let o;return a;function a(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),o=h===40?41:h,l):n(h)}function l(h){return h===o?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(s),c(h))}function c(h){return h===o?(t.exit(s),l(o)):h===null?n(h):ae(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),Fe(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||ae(h)?(t.exit("chunkString"),c(h)):(t.consume(h),h===92?f:u)}function f(h){return h===o||h===92?(t.consume(h),u):u(h)}}m();function Bo(t,e){let n;return r;function r(i){return ae(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):be(i)?Fe(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}var Zy={name:"definition",tokenize:r6},n6={partial:!0,tokenize:i6};function r6(t,e,n){let r=this,i;return s;function s(d){return t.enter("definition"),o(d)}function o(d){return Id.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=Zi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return _t(d)?Bo(t,c)(d):c(d)}function c(d){return Fd(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return t.attempt(n6,f,f)(d)}function f(d){return be(d)?Fe(t,h,"whitespace")(d):h(d)}function h(d){return d===null||ae(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function i6(t,e,n){return r;function r(a){return _t(a)?Bo(t,i)(a):n(a)}function i(a){return Ad(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return be(a)?Fe(t,o,"whitespace")(a):o(a)}function o(a){return a===null||ae(a)?e(a):n(a)}}m();var Yy={name:"hardBreakEscape",tokenize:s6};function s6(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return ae(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}m();var Jy={name:"headingAtx",resolve:o6,tokenize:a6};function o6(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Xt(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function a6(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||_t(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||ae(u)?(t.exit("atxHeading"),e(u)):be(u)?Fe(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||_t(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}m();m();var AS=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Xy=["pre","script","style","textarea"];var ew={concrete:!0,name:"htmlFlow",resolveTo:u6,tokenize:f6},l6={partial:!0,tokenize:d6},c6={partial:!0,tokenize:h6};function u6(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function f6(t,e,n){let r=this,i,s,o,a,l;return c;function c(I){return u(I)}function u(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),f}function f(I){return I===33?(t.consume(I),h):I===47?(t.consume(I),s=!0,g):I===63?(t.consume(I),i=3,r.interrupt?e:O):Yn(I)?(t.consume(I),o=String.fromCharCode(I),y):n(I)}function h(I){return I===45?(t.consume(I),i=2,d):I===91?(t.consume(I),i=5,a=0,p):Yn(I)?(t.consume(I),i=4,r.interrupt?e:O):n(I)}function d(I){return I===45?(t.consume(I),r.interrupt?e:O):n(I)}function p(I){let Pe="CDATA[";return I===Pe.charCodeAt(a++)?(t.consume(I),a===Pe.length?r.interrupt?e:N:p):n(I)}function g(I){return Yn(I)?(t.consume(I),o=String.fromCharCode(I),y):n(I)}function y(I){if(I===null||I===47||I===62||_t(I)){let Pe=I===47,Nt=o.toLowerCase();return!Pe&&!s&&Xy.includes(Nt)?(i=1,r.interrupt?e(I):N(I)):AS.includes(o.toLowerCase())?(i=6,Pe?(t.consume(I),w):r.interrupt?e(I):N(I)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):s?b(I):S(I))}return I===45||gn(I)?(t.consume(I),o+=String.fromCharCode(I),y):n(I)}function w(I){return I===62?(t.consume(I),r.interrupt?e:N):n(I)}function b(I){return be(I)?(t.consume(I),b):A(I)}function S(I){return I===47?(t.consume(I),A):I===58||I===95||Yn(I)?(t.consume(I),D):be(I)?(t.consume(I),S):A(I)}function D(I){return I===45||I===46||I===58||I===95||gn(I)?(t.consume(I),D):k(I)}function k(I){return I===61?(t.consume(I),E):be(I)?(t.consume(I),k):S(I)}function E(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),l=I,v):be(I)?(t.consume(I),E):_(I)}function v(I){return I===l?(t.consume(I),l=null,C):I===null||ae(I)?n(I):(t.consume(I),v)}function _(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||_t(I)?k(I):(t.consume(I),_)}function C(I){return I===47||I===62||be(I)?S(I):n(I)}function A(I){return I===62?(t.consume(I),P):n(I)}function P(I){return I===null||ae(I)?N(I):be(I)?(t.consume(I),P):n(I)}function N(I){return I===45&&i===2?(t.consume(I),U):I===60&&i===1?(t.consume(I),he):I===62&&i===4?(t.consume(I),De):I===63&&i===3?(t.consume(I),O):I===93&&i===5?(t.consume(I),Xe):ae(I)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(l6,ve,B)(I)):I===null||ae(I)?(t.exit("htmlFlowData"),B(I)):(t.consume(I),N)}function B(I){return t.check(c6,L,ve)(I)}function L(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),G}function G(I){return I===null||ae(I)?B(I):(t.enter("htmlFlowData"),N(I))}function U(I){return I===45?(t.consume(I),O):N(I)}function he(I){return I===47?(t.consume(I),o="",Te):N(I)}function Te(I){if(I===62){let Pe=o.toLowerCase();return Xy.includes(Pe)?(t.consume(I),De):N(I)}return Yn(I)&&o.length<8?(t.consume(I),o+=String.fromCharCode(I),Te):N(I)}function Xe(I){return I===93?(t.consume(I),O):N(I)}function O(I){return I===62?(t.consume(I),De):I===45&&i===2?(t.consume(I),O):N(I)}function De(I){return I===null||ae(I)?(t.exit("htmlFlowData"),ve(I)):(t.consume(I),De)}function ve(I){return t.exit("htmlFlow"),e(I)}}function h6(t,e,n){let r=this;return i;function i(o){return ae(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function d6(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Cs,e,n)}}m();var tw={name:"htmlText",tokenize:m6};function m6(t,e,n){let r=this,i,s,o;return a;function a(O){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(O),l}function l(O){return O===33?(t.consume(O),c):O===47?(t.consume(O),k):O===63?(t.consume(O),S):Yn(O)?(t.consume(O),_):n(O)}function c(O){return O===45?(t.consume(O),u):O===91?(t.consume(O),s=0,p):Yn(O)?(t.consume(O),b):n(O)}function u(O){return O===45?(t.consume(O),d):n(O)}function f(O){return O===null?n(O):O===45?(t.consume(O),h):ae(O)?(o=f,he(O)):(t.consume(O),f)}function h(O){return O===45?(t.consume(O),d):f(O)}function d(O){return O===62?U(O):O===45?h(O):f(O)}function p(O){let De="CDATA[";return O===De.charCodeAt(s++)?(t.consume(O),s===De.length?g:p):n(O)}function g(O){return O===null?n(O):O===93?(t.consume(O),y):ae(O)?(o=g,he(O)):(t.consume(O),g)}function y(O){return O===93?(t.consume(O),w):g(O)}function w(O){return O===62?U(O):O===93?(t.consume(O),w):g(O)}function b(O){return O===null||O===62?U(O):ae(O)?(o=b,he(O)):(t.consume(O),b)}function S(O){return O===null?n(O):O===63?(t.consume(O),D):ae(O)?(o=S,he(O)):(t.consume(O),S)}function D(O){return O===62?U(O):S(O)}function k(O){return Yn(O)?(t.consume(O),E):n(O)}function E(O){return O===45||gn(O)?(t.consume(O),E):v(O)}function v(O){return ae(O)?(o=v,he(O)):be(O)?(t.consume(O),v):U(O)}function _(O){return O===45||gn(O)?(t.consume(O),_):O===47||O===62||_t(O)?C(O):n(O)}function C(O){return O===47?(t.consume(O),U):O===58||O===95||Yn(O)?(t.consume(O),A):ae(O)?(o=C,he(O)):be(O)?(t.consume(O),C):U(O)}function A(O){return O===45||O===46||O===58||O===95||gn(O)?(t.consume(O),A):P(O)}function P(O){return O===61?(t.consume(O),N):ae(O)?(o=P,he(O)):be(O)?(t.consume(O),P):C(O)}function N(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(t.consume(O),i=O,B):ae(O)?(o=N,he(O)):be(O)?(t.consume(O),N):(t.consume(O),L)}function B(O){return O===i?(t.consume(O),i=void 0,G):O===null?n(O):ae(O)?(o=B,he(O)):(t.consume(O),B)}function L(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||_t(O)?C(O):(t.consume(O),L)}function G(O){return O===47||O===62||_t(O)?C(O):n(O)}function U(O){return O===62?(t.consume(O),t.exit("htmlTextData"),t.exit("htmlText"),e):n(O)}function he(O){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),Te}function Te(O){return be(O)?Fe(t,Xe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):Xe(O)}function Xe(O){return t.enter("htmlTextData"),o(O)}}m();var $o={name:"labelEnd",resolveAll:w6,resolveTo:b6,tokenize:v6},p6={tokenize:k6},g6={tokenize:x6},y6={tokenize:S6};function w6(t){let e=-1,n=[];for(;++e<t.length;){let r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){let i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Xt(t,0,t.length,n),t}function b6(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);let l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=pn(a,t.slice(s+1,s+r+3)),a=pn(a,[["enter",u,e]]),a=pn(a,ol(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=pn(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=pn(a,t.slice(o+1)),a=pn(a,[["exit",l,e]]),Xt(t,s,t.length,a),t}function v6(t,e,n){let r=this,i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(h){return s?s._inactive?f(h):(o=r.parser.defined.includes(Zi(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),l):n(h)}function l(h){return h===40?t.attempt(p6,u,o?u:f)(h):h===91?t.attempt(g6,u,o?c:f)(h):o?u(h):f(h)}function c(h){return t.attempt(y6,u,f)(h)}function u(h){return e(h)}function f(h){return s._balanced=!0,n(h)}}function k6(t,e,n){return r;function r(f){return t.enter("resource"),t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),i}function i(f){return _t(f)?Bo(t,s)(f):s(f)}function s(f){return f===41?u(f):Fd(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return _t(f)?Bo(t,l)(f):u(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?Ad(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return _t(f)?Bo(t,u)(f):u(f)}function u(f){return f===41?(t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),t.exit("resource"),e):n(f)}}function x6(t,e,n){let r=this;return i;function i(a){return Id.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Zi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function S6(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}m();var nw={name:"labelStartImage",resolveAll:$o.resolveAll,tokenize:D6};function D6(t,e,n){let r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}m();var rw={name:"labelStartLink",resolveAll:$o.resolveAll,tokenize:E6};function E6(t,e,n){let r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}m();var xu={name:"lineEnding",tokenize:_6};function _6(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Fe(t,e,"linePrefix")}}m();m();var Uo={name:"thematicBreak",tokenize:C6};function C6(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||ae(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),be(c)?Fe(t,a,"whitespace")(c):a(c))}}var on={continuation:{tokenize:A6},exit:P6,name:"list",tokenize:I6},T6={partial:!0,tokenize:N6},F6={partial:!0,tokenize:O6};function I6(t,e,n){let r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(d){let p=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:wu(d)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Uo,n,c)(d):c(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return wu(d)&&++o<10?(t.consume(d),l):(!r.interrupt||o<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),c(d)):n(d)}function c(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(Cs,r.interrupt?n:u,t.attempt(T6,h,f))}function u(d){return r.containerState.initialBlankLine=!0,s++,h(d)}function f(d){return be(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),h):n(d)}function h(d){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function A6(t,e,n){let r=this;return r.containerState._closeFlow=void 0,t.check(Cs,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Fe(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!be(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(F6,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Fe(t,t.attempt(on,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function O6(t,e,n){let r=this;return Fe(t,i,"listItemIndent",r.containerState.size+1);function i(s){let o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function P6(t){t.exit(this.containerState.type)}function N6(t,e,n){let r=this;return Fe(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){let o=r.events[r.events.length-1];return!be(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}m();var Od={name:"setextUnderline",resolveTo:M6,tokenize:R6};function M6(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);let o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function R6(t,e,n){let r=this,i;return s;function s(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),be(c)?Fe(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ae(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}var OS={tokenize:z6};function z6(t){let e=this,n=t.attempt(Cs,r,t.attempt(this.parser.constructs.flowInitial,i,Fe(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Ky,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}m();var PS={resolveAll:zS()},NS=RS("string"),MS=RS("text");function RS(t){return{resolveAll:zS(t==="text"?L6:void 0),tokenize:e};function e(n){let r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;let f=i[u],h=-1;if(f)for(;++h<f.length;){let d=f[h];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function zS(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function L6(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){let r=t[n-1][1],i=e.sliceStream(r),s=i.length,o=-1,a=0,l;for(;s--;){let c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){let c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}var iw={};fu(iw,{attentionMarkers:()=>W6,contentInitial:()=>$6,disable:()=>G6,document:()=>B6,flow:()=>j6,flowInitial:()=>U6,insideSpan:()=>H6,string:()=>q6,text:()=>V6});m();var B6={42:on,43:on,45:on,48:on,49:on,50:on,51:on,52:on,53:on,54:on,55:on,56:on,57:on,62:Sd},$6={91:Zy},U6={[-2]:vu,[-1]:vu,32:vu},j6={35:Jy,42:Uo,45:[Od,Uo],60:ew,61:Od,95:Uo,96:_d,126:_d},q6={38:Ed,92:Dd},V6={[-5]:xu,[-4]:xu,[-3]:xu,33:nw,38:Ed,42:bu,60:[Gy,tw],91:rw,92:[Yy,Dd],93:$o,95:bu,96:Qy},H6={null:[bu,PS]},W6={null:[42,95]},G6={null:[]};m();function LS(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},s=[],o=[],a=[],l=!0,c={attempt:C(v),check:C(_),consume:D,enter:k,exit:E,interrupt:C(_,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:y,parser:t,previous:null,sliceSerialize:p,sliceStream:g,write:d},f=e.tokenize.call(u,c),h;return e.resolveAll&&s.push(e),u;function d(B){return o=pn(o,B),b(),o[o.length-1]!==null?[]:(A(e,0),u.events=ol(s,u.events,u),u.events)}function p(B,L){return K6(g(B),L)}function g(B){return Q6(o,B)}function y(){let{_bufferIndex:B,_index:L,line:G,column:U,offset:he}=r;return{_bufferIndex:B,_index:L,line:G,column:U,offset:he}}function w(B){i[B.line]=B.column,N()}function b(){let B;for(;r._index<o.length;){let L=o[r._index];if(typeof L=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<L.length;)S(L.charCodeAt(r._bufferIndex));else S(L)}}function S(B){l=void 0,h=B,f=f(B)}function D(B){ae(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,N()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=B,l=!0}function k(B,L){let G=L||{};return G.type=B,G.start=y(),u.events.push(["enter",G,u]),a.push(G),G}function E(B){let L=a.pop();return L.end=y(),u.events.push(["exit",L,u]),L}function v(B,L){A(B,L.from)}function _(B,L){L.restore()}function C(B,L){return G;function G(U,he,Te){let Xe,O,De,ve;return Array.isArray(U)?Pe(U):"tokenize"in U?Pe([U]):I(U);function I(bt){return dn;function dn(It){let Ut=It!==null&&bt[It],Ne=It!==null&&bt.null,lt=[...Array.isArray(Ut)?Ut:Ut?[Ut]:[],...Array.isArray(Ne)?Ne:Ne?[Ne]:[]];return Pe(lt)(It)}}function Pe(bt){return Xe=bt,O=0,bt.length===0?Te:Nt(bt[O])}function Nt(bt){return dn;function dn(It){return ve=P(),De=bt,bt.partial||(u.currentConstruct=bt),bt.name&&u.parser.constructs.disable.null.includes(bt.name)?Ve(It):bt.tokenize.call(L?Object.assign(Object.create(u),L):u,c,tt,Ve)(It)}}function tt(bt){return l=!0,B(De,ve),he}function Ve(bt){return l=!0,ve.restore(),++O<Xe.length?Nt(Xe[O]):Te}}}function A(B,L){B.resolveAll&&!s.includes(B)&&s.push(B),B.resolve&&Xt(u.events,L,u.events.length-L,B.resolve(u.events.slice(L),u)),B.resolveTo&&(u.events=B.resolveTo(u.events,u))}function P(){let B=y(),L=u.previous,G=u.currentConstruct,U=u.events.length,he=Array.from(a);return{from:U,restore:Te};function Te(){r=B,u.previous=L,u.currentConstruct=G,u.events.length=U,a=he,N()}}function N(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Q6(t,e){let n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex,o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){let a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function K6(t,e){let n=-1,r=[],i;for(;++n<t.length;){let s=t[n],o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
||
`;break}case-3:{o=`\r
|
||
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function sw(t){let r={constructs:vS([iw,...(t||{}).extensions||[]]),content:i(_S),defined:[],document:i(TS),flow:i(OS),lazy:{},string:i(NS),text:i(MS)};return r;function i(s){return o;function o(a){return LS(r,s,a)}}}m();function ow(t){for(;!Td(t););return t}m();var BS=/[\0\t\n\r]/g;function aw(){let t=1,e="",n=!0,r;return i;function i(s,o,a){let l=[],c,u,f,h,d;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),f=0,e="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(BS.lastIndex=f,c=BS.exec(s),h=c&&c.index!==void 0?c.index:s.length,d=s.charCodeAt(h),!c){e=s.slice(f);break}if(d===10&&f===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<h&&(l.push(s.slice(f,h)),t+=h-f),d){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}f=h+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}m();var Z6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Pd(t){return t.replace(Z6,Y6)}function Y6(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){let i=n.charCodeAt(1),s=i===120||i===88;return xd(n.slice(s?2:1),s?16:10)}return il(n)||t}var US={}.hasOwnProperty;function lw(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),J6(n)(ow(sw(n).document().write(aw()(t,e,!0))))}function J6(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(cu),autolinkProtocol:C,autolinkEmail:C,atxHeading:s(dt),blockQuote:s(It),characterEscape:C,characterReference:C,codeFenced:s(Ut),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ut,o),codeText:s(Ne,o),codeTextData:C,data:C,codeFlowValue:C,definition:s(lt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(At),hardBreakEscape:s(An),hardBreakTrailing:s(An),htmlFlow:s(Qn,o),htmlFlowData:C,htmlText:s(Qn,o),htmlTextData:C,image:s(gi),label:o,link:s(cu),listItem:s(cd),listItemValue:h,listOrdered:s(Po,f),listUnordered:s(Po),paragraph:s(uu),reference:I,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(dt),strong:s(No),thematicBreak:s(ky)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:dn,autolinkProtocol:bt,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:Nt,characterReferenceMarkerNumeric:Nt,characterReferenceValue:tt,characterReference:Ve,codeFenced:l(y),codeFencedFence:g,codeFencedFenceInfo:d,codeFencedFenceMeta:p,codeFlowValue:A,codeIndented:l(w),codeText:l(G),codeTextData:A,data:A,definition:l(),definitionDestinationString:D,definitionLabelString:b,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(N),hardBreakTrailing:l(N),htmlFlow:l(B),htmlFlowData:A,htmlText:l(L),htmlTextData:A,image:l(he),label:Xe,labelText:Te,lineEnding:P,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Pe,resourceDestinationString:O,resourceTitleString:De,resource:ve,setextHeading:l(_),setextHeadingLineSequence:v,setextHeadingText:E,strong:l(),thematicBreak:l()}};jS(e,(t||{}).mdastExtensions||[]);let n={};return r;function r(j){let ee={type:"root",children:[]},Ee={stack:[ee],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:n},Re=[],nt=-1;for(;++nt<j.length;)if(j[nt][1].type==="listOrdered"||j[nt][1].type==="listUnordered")if(j[nt][0]==="enter")Re.push(nt);else{let Kn=Re.pop();nt=i(j,Kn,nt)}for(nt=-1;++nt<j.length;){let Kn=e[j[nt][0]];US.call(Kn,j[nt][1].type)&&Kn[j[nt][1].type].call(Object.assign({sliceSerialize:j[nt][2].sliceSerialize},Ee),j[nt][1])}if(Ee.tokenStack.length>0){let Kn=Ee.tokenStack[Ee.tokenStack.length-1];(Kn[1]||$S).call(Ee,void 0,Kn[0])}for(ee.position={start:Ts(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:Ts(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},nt=-1;++nt<e.transforms.length;)ee=e.transforms[nt](ee)||ee;return ee}function i(j,ee,Ee){let Re=ee-1,nt=-1,Kn=!1,Hi,xr,vs,ks;for(;++Re<=Ee;){let sn=j[Re];switch(sn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{sn[0]==="enter"?nt++:nt--,ks=void 0;break}case"lineEndingBlank":{sn[0]==="enter"&&(Hi&&!ks&&!nt&&!vs&&(vs=Re),ks=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ks=void 0}if(!nt&&sn[0]==="enter"&&sn[1].type==="listItemPrefix"||nt===-1&&sn[0]==="exit"&&(sn[1].type==="listUnordered"||sn[1].type==="listOrdered")){if(Hi){let xs=Re;for(xr=void 0;xs--;){let T=j[xs];if(T[1].type==="lineEnding"||T[1].type==="lineEndingBlank"){if(T[0]==="exit")continue;xr&&(j[xr][1].type="lineEndingBlank",Kn=!0),T[1].type="lineEnding",xr=xs}else if(!(T[1].type==="linePrefix"||T[1].type==="blockQuotePrefix"||T[1].type==="blockQuotePrefixWhitespace"||T[1].type==="blockQuoteMarker"||T[1].type==="listItemIndent"))break}vs&&(!xr||vs<xr)&&(Hi._spread=!0),Hi.end=Object.assign({},xr?j[xr][1].start:sn[1].end),j.splice(xr||Re,0,["exit",Hi,sn[2]]),Re++,Ee++}if(sn[1].type==="listItemPrefix"){let xs={type:"listItem",_spread:!1,start:Object.assign({},sn[1].start),end:void 0};Hi=xs,j.splice(Re,0,["enter",xs,sn[2]]),Re++,Ee++,vs=void 0,ks=!0}}}return j[ee][1]._spread=Kn,Ee}function s(j,ee){return Ee;function Ee(Re){a.call(this,j(Re),Re),ee&&ee.call(this,Re)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(j,ee,Ee){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([ee,Ee||void 0]),j.position={start:Ts(ee.start),end:void 0}}function l(j){return ee;function ee(Ee){j&&j.call(this,Ee),c.call(this,Ee)}}function c(j,ee){let Ee=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==j.type&&(ee?ee.call(this,j,Re[0]):(Re[1]||$S).call(this,j,Re[0]));else throw new Error("Cannot close `"+j.type+"` ("+Es({start:j.start,end:j.end})+"): it\u2019s not open");Ee.position.end=Ts(j.end)}function u(){return Lo(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(j){if(this.data.expectingFirstListItemValue){let ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function d(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=j}function p(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=j}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.value=j.replace(/(\r?\n|\r)$/g,"")}function b(j){let ee=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=ee,Ee.identifier=Zi(this.sliceSerialize(j)).toLowerCase()}function S(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.title=j}function D(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.url=j}function k(j){let ee=this.stack[this.stack.length-1];if(!ee.depth){let Ee=this.sliceSerialize(j).length;ee.depth=Ee}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function v(j){let ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function C(j){let Ee=this.stack[this.stack.length-1].children,Re=Ee[Ee.length-1];(!Re||Re.type!=="text")&&(Re=vy(),Re.position={start:Ts(j.start),end:void 0},Ee.push(Re)),this.stack.push(Re)}function A(j){let ee=this.stack.pop();ee.value+=this.sliceSerialize(j),ee.position.end=Ts(j.end)}function P(j){let ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){let Ee=ee.children[ee.children.length-1];Ee.position.end=Ts(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ee.type)&&(C.call(this,j),A.call(this,j))}function N(){this.data.atHardBreak=!0}function B(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.value=j}function L(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.value=j}function G(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.value=j}function U(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let ee=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=ee,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function he(){let j=this.stack[this.stack.length-1];if(this.data.inReference){let ee=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=ee,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function Te(j){let ee=this.sliceSerialize(j),Ee=this.stack[this.stack.length-2];Ee.label=Pd(ee),Ee.identifier=Zi(ee).toLowerCase()}function Xe(){let j=this.stack[this.stack.length-1],ee=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){let Re=j.children;Ee.children=Re}else Ee.alt=ee}function O(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.url=j}function De(){let j=this.resume(),ee=this.stack[this.stack.length-1];ee.title=j}function ve(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function Pe(j){let ee=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=ee,Ee.identifier=Zi(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function Nt(j){this.data.characterReferenceType=j.type}function tt(j){let ee=this.sliceSerialize(j),Ee=this.data.characterReferenceType,Re;Ee?(Re=xd(ee,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=il(ee);let nt=this.stack[this.stack.length-1];nt.value+=Re}function Ve(j){let ee=this.stack.pop();ee.position.end=Ts(j.end)}function bt(j){A.call(this,j);let ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(j)}function dn(j){A.call(this,j);let ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(j)}function It(){return{type:"blockquote",children:[]}}function Ut(){return{type:"code",lang:null,meta:null,value:""}}function Ne(){return{type:"inlineCode",value:""}}function lt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function At(){return{type:"emphasis",children:[]}}function dt(){return{type:"heading",depth:0,children:[]}}function An(){return{type:"break"}}function Qn(){return{type:"html",value:""}}function gi(){return{type:"image",title:null,url:"",alt:null}}function cu(){return{type:"link",title:null,url:"",children:[]}}function Po(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function cd(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function uu(){return{type:"paragraph",children:[]}}function No(){return{type:"strong",children:[]}}function vy(){return{type:"text",value:""}}function ky(){return{type:"thematicBreak"}}}function Ts(t){return{line:t.line,column:t.column,offset:t.offset}}function jS(t,e){let n=-1;for(;++n<e.length;){let r=e[n];Array.isArray(r)?jS(t,r):X6(t,r)}}function X6(t,e){let n;for(n in e)if(US.call(e,n))switch(n){case"canContainEols":{let r=e[n];r&&t[n].push(...r);break}case"transforms":{let r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{let r=e[n];r&&Object.assign(t[n],r);break}}}function $S(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Es({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Es({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Es({start:e.start,end:e.end})+") is still open")}function Nd(t){let e=this;e.parser=n;function n(r){return lw(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}m();m();m();m();m();var qS={}.hasOwnProperty;function VS(t,e){let n=e||{};function r(i,...s){let o=r.invalid,a=r.handlers;if(i&&qS.call(i,t)){let l=String(i[t]);o=qS.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}m();var e3={}.hasOwnProperty;function cw(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)cw(t,e.extensions[n]);for(r in e)if(e3.call(e,r))switch(r){case"extensions":break;case"unsafe":{HS(t[r],e[r]);break}case"join":{HS(t[r],e[r]);break}case"handlers":{t3(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function HS(t,e){e&&t.push(...e)}function t3(t,e){e&&Object.assign(t,e)}m();m();function WS(t,e,n,r){let i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);let o=n.indentLines(n.containerFlow(t,s.current()),n3);return i(),o}function n3(t,e,n){return">"+(n?"":" ")+t}m();m();function Md(t,e){return GS(t,e.inConstruct,!0)&&!GS(t,e.notInConstruct,!1)}function GS(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function uw(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
||
`&&Md(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
||
`}m();m();function QS(t,e){let n=String(t),r=n.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}m();function Su(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}m();function KS(t){let e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function ZS(t,e,n,r){let i=KS(n),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Su(t,n)){let f=n.enter("codeIndented"),h=n.indentLines(s,r3);return f(),h}let a=n.createTracker(r),l=i.repeat(Math.max(QS(s,i)+1,3)),c=n.enter("codeFenced"),u=a.move(l);if(t.lang){let f=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),f()}if(t.lang&&t.meta){let f=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(t.meta,{before:u,after:`
|
||
`,encode:["`"],...a.current()})),f()}return u+=a.move(`
|
||
`),s&&(u+=a.move(s+`
|
||
`)),u+=a.move(l),c(),u}function r3(t,e,n){return(n?"":" ")+t}m();m();function al(t){let e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function YS(t,e,n,r){let i=al(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition"),a=n.enter("label"),l=n.createTracker(r),c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
|
||
`,...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}m();m();function JS(t){let e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}m();function Jn(t){return"&#x"+t.toString(16).toUpperCase()+";"}m();function ll(t,e,n){let r=sl(t),i=sl(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}fw.peek=i3;function fw(t,e,n,r){let i=JS(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i),l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()})),c=l.charCodeAt(0),u=ll(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Jn(c)+l.slice(1));let f=l.charCodeAt(l.length-1),h=ll(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+Jn(f));let d=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+d}function i3(t,e,n){return n.options.emphasis||"*"}m();m();m();m();m();m();m();m();var cl=function(t){if(t==null)return l3;if(typeof t=="function")return Rd(t);if(typeof t=="object")return Array.isArray(t)?s3(t):o3(t);if(typeof t=="string")return a3(t);throw new Error("Expected function, string, or object as test")};function s3(t){let e=[],n=-1;for(;++n<t.length;)e[n]=cl(t[n]);return Rd(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function o3(t){let e=t;return Rd(n);function n(r){let i=r,s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function a3(t){return Rd(e);function e(n){return n&&n.type===t}}function Rd(t){return e;function e(n,r,i){return!!(c3(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function l3(){return!0}function c3(t){return t!==null&&typeof t=="object"&&"type"in t}var XS=[],zd=!0,jo=!1,Ld="skip";function hw(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;let s=cl(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,u){let f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){let d=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return h;function h(){let d=XS,p,g,y;if((!e||s(l,c,u[u.length-1]||void 0))&&(d=u3(n(l,u)),d[0]===jo))return d;if("children"in l&&l.children){let w=l;if(w.children&&d[0]!==Ld)for(g=(r?w.children.length:-1)+o,y=u.concat(w);g>-1&&g<w.children.length;){let b=w.children[g];if(p=a(b,g,y)(),p[0]===jo)return p;g=typeof p[1]=="number"?p[1]:g+o}}return d}}}function u3(t){return Array.isArray(t)?t:typeof t=="number"?[zd,t]:t==null?XS:[t]}function ul(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),hw(t,s,a,i);function a(l,c){let u=c[c.length-1],f=u?u.children.indexOf(l):void 0;return o(l,f,u)}}function Bd(t,e){let n=!1;return ul(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,jo}),!!((!t.depth||t.depth<3)&&Lo(t)&&(e.options.setext||n))}function eD(t,e,n,r){let i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(Bd(t,n)){let u=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(t,{...s.current(),before:`
|
||
`,after:`
|
||
`});return f(),u(),h+`
|
||
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
||
`))+1))}let o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
|
||
`,...s.current()});return/^[\t ]/.test(c)&&(c=Jn(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}m();dw.peek=f3;function dw(t){return t.value||""}function f3(){return"<"}m();mw.peek=h3;function mw(t,e,n,r){let i=al(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image"),a=n.enter("label"),l=n.createTracker(r),c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(t.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function h3(){return"!"}m();pw.peek=d3;function pw(t,e,n,r){let i=t.referenceType,s=n.enter("imageReference"),o=n.enter("label"),a=n.createTracker(r),l=a.move("!["),c=n.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();let u=n.stack;n.stack=[],o=n.enter("reference");let f=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function d3(){return"!"}m();gw.peek=m3;function gw(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){let o=n.unsafe[s],a=n.compilePattern(o),l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function m3(){return"`"}m();m();function yw(t,e){let n=Lo(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}ww.peek=p3;function ww(t,e,n,r){let i=al(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r),a,l;if(yw(t,n)){let u=n.stack;n.stack=[],a=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(t,{before:f,after:">",...o.current()})),f+=o.move(">"),a(),n.stack=u,f}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(t.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function p3(t,e,n){return yw(t,n)?"<":"["}m();bw.peek=g3;function bw(t,e,n,r){let i=t.referenceType,s=n.enter("linkReference"),o=n.enter("label"),a=n.createTracker(r),l=a.move("["),c=n.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();let u=n.stack;n.stack=[],o=n.enter("reference");let f=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==f?l+=a.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function g3(){return"["}m();m();function fl(t){let e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}m();function tD(t){let e=fl(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}m();function nD(t){let e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}m();function $d(t){let e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function rD(t,e,n,r){let i=n.enter("list"),s=n.bulletCurrent,o=t.ordered?nD(n):fl(n),a=t.ordered?o==="."?")":".":tD(n),l=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){let u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),$d(n)===o&&u){let f=-1;for(;++f<t.children.length;){let h=t.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;let c=n.containerFlow(t,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}m();m();function iD(t){let e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function sD(t,e,n,r){let i=iD(n),s=n.bulletCurrent||fl(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);let a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,a.current()),u);return l(),c;function u(f,h,d){return h?(d?"":" ".repeat(o))+f:(d?s:s+" ".repeat(o-s.length))+f}}m();function oD(t,e,n,r){let i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,r);return s(),i(),o}m();m();m();var vw=cl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function aD(t,e,n,r){return(t.children.some(function(o){return vw(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}m();m();function lD(t){let e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}kw.peek=y3;function kw(t,e,n,r){let i=lD(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i),l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()})),c=l.charCodeAt(0),u=ll(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Jn(c)+l.slice(1));let f=l.charCodeAt(l.length-1),h=ll(r.after.charCodeAt(0),f,i);h.inside&&(l=l.slice(0,-1)+Jn(f));let d=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+d}function y3(t,e,n){return n.options.strong||"*"}m();function cD(t,e,n,r){return n.safe(t.value,r)}m();m();function uD(t){let e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function fD(t,e,n){let r=($d(n)+(n.options.ruleSpaces?" ":"")).repeat(uD(n));return n.options.ruleSpaces?r.slice(0,-1):r}var hD={blockquote:WS,break:uw,code:ZS,definition:YS,emphasis:fw,hardBreak:uw,heading:eD,html:dw,image:mw,imageReference:pw,inlineCode:gw,link:ww,linkReference:bw,list:rD,listItem:sD,paragraph:oD,root:aD,strong:kw,text:cD,thematicBreak:fD};m();var dD=[w3];function w3(t,e,n,r){if(e.type==="code"&&Su(e,r)&&(t.type==="list"||t.type===e.type&&Su(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&Bd(e,r))?void 0:n.spread?1:0}m();var qo=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],mD=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
||
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:qo},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
||
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:qo},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
||
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:qo},{atBreak:!0,character:"+",after:`(?:[ \r
|
||
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
||
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
||
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:qo},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:qo},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:qo},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:qo},{atBreak:!0,character:"~"}];m();function pD(t){return t.label||!t.identifier?t.label||"":Pd(t.identifier)}m();function gD(t){if(!t._compiled){let e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}m();function yD(t,e,n){let r=e.indexStack,i=t.children||[],s=[],o=-1,a=n.before,l;r.push(-1);let c=e.createTracker(n);for(;++o<i.length;){let u=i[o],f;if(r[r.length-1]=o,o+1<i.length){let p=e.handle.handlers[i[o+1].type];p&&p.peek&&(p=p.peek),f=p?p(i[o+1],t,e,{before:"",after:"",...c.current()}).charAt(0):""}else f=n.after;s.length>0&&(a==="\r"||a===`
|
||
`)&&u.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),a=" ",c=e.createTracker(n),c.move(s.join("")));let h=e.handle(u,t,e,{...c.current(),after:f,before:a});l&&l===h.slice(0,1)&&(h=Jn(l.charCodeAt(0))+h.slice(1));let d=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,l=void 0,d&&(s.length>0&&d.before&&a===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Jn(a.charCodeAt(0))),d.after&&(l=f)),c.move(h),s.push(h),a=h.slice(-1)}return r.pop(),s.join("")}m();function wD(t,e,n){let r=e.indexStack,i=t.children||[],s=e.createTracker(n),o=[],a=-1;for(r.push(-1);++a<i.length;){let l=i[a];r[r.length-1]=a,o.push(s.move(e.handle(l,t,e,{before:`
|
||
`,after:`
|
||
`,...s.current()}))),l.type!=="list"&&(e.bulletLastUsed=void 0),a<i.length-1&&o.push(s.move(b3(l,i[a+1],t,e)))}return r.pop(),o.join("")}function b3(t,e,n,r){let i=r.join.length;for(;i--;){let s=r.join[i](t,e,n,r);if(s===!0||s===1)break;if(typeof s=="number")return`
|
||
`.repeat(1+s);if(s===!1)return`
|
||
|
||
<!---->
|
||
|
||
`}return`
|
||
|
||
`}m();var v3=/\r?\n|\r/g;function bD(t,e){let n=[],r=0,i=0,s;for(;s=v3.exec(t);)o(t.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return o(t.slice(r)),n.join("");function o(a){n.push(e(a,i,!a))}}m();function kD(t,e,n){let r=(n.before||"")+(e||"")+(n.after||""),i=[],s=[],o={},a=-1;for(;++a<t.unsafe.length;){let u=t.unsafe[a];if(!Md(t.stack,u))continue;let f=t.compilePattern(u),h;for(;h=f.exec(r);){let d="before"in u||!!u.atBreak,p="after"in u,g=h.index+(d?h[1].length:0);i.includes(g)?(o[g].before&&!d&&(o[g].before=!1),o[g].after&&!p&&(o[g].after=!1)):(i.push(g),o[g]={before:d,after:p})}}i.sort(k3);let l=n.before?n.before.length:0,c=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){let u=i[a];u<l||u>=c||u+1<c&&i[a+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||i[a-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(l!==u&&s.push(vD(r.slice(l,u),"\\")),l=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!n.encode||!n.encode.includes(r.charAt(u)))?s.push("\\"):(s.push(Jn(r.charCodeAt(u))),l++))}return s.push(vD(r.slice(l,c),n.after)),s.join("")}function k3(t,e){return t-e}function vD(t,e){let n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=t+e,o=-1,a=0,l;for(;l=n.exec(s);)r.push(l.index);for(;++o<r.length;)a!==r[o]&&i.push(t.slice(a,r[o])),i.push("\\"),a=r[o];return i.push(t.slice(a)),i.join("")}m();function xD(t){let e=t||{},n=e.now||{},r=e.lineShift||0,i=n.line||1,s=n.column||1;return{move:l,current:o,shift:a};function o(){return{now:{line:i,column:s},lineShift:r}}function a(c){r+=c}function l(c){let u=c||"",f=u.split(/\r?\n|\r/g),h=f[f.length-1];return i+=f.length-1,s=f.length===1?s+h.length:1+h.length+r,u}}function xw(t,e){let n=e||{},r={associationId:pD,containerPhrasing:E3,containerFlow:_3,createTracker:xD,compilePattern:gD,enter:s,handlers:{...hD},handle:void 0,indentLines:bD,indexStack:[],join:[...dD],options:{},safe:C3,stack:[],unsafe:[...mD]};cw(r,n),r.options.tightDefinitions&&r.join.push(D3),r.handle=VS("type",{invalid:x3,unknown:S3,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
|
||
`,after:`
|
||
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
||
`),i;function s(o){return r.stack.push(o),a;function a(){r.stack.pop()}}}function x3(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function S3(t){let e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function D3(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function E3(t,e){return yD(t,this,e)}function _3(t,e){return wD(t,this,e)}function C3(t,e){return kD(this,t,e)}function Ud(t){let e=this;e.compiler=n;function n(r){return xw(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}m();m();m();m();m();m();m();m();var DD=it(SD(),1),Du=Object.assign(Vo(Error),{eval:Vo(EvalError),range:Vo(RangeError),reference:Vo(ReferenceError),syntax:Vo(SyntaxError),type:Vo(TypeError),uri:Vo(URIError)});function Vo(t){return e.displayName=t.displayName||t.name,e;function e(n,...r){let i=n&&(0,DD.default)(n,...r);return new t(i)}}var jd={}.hasOwnProperty,ED={yaml:"-",toml:"+"};function hl(t){let e=[],n=-1,r=Array.isArray(t)?t:t?[t]:["yaml"];for(;++n<r.length;)e[n]=T3(r[n]);return e}function T3(t){let e=t;if(typeof e=="string"){if(!jd.call(ED,e))throw Du("Missing matter definition for `%s`",e);e={type:e,marker:ED[e]}}else if(typeof e!="object")throw Du("Expected matter to be an object, not `%j`",e);if(!jd.call(e,"type"))throw Du("Missing `type` in matter `%j`",e);if(!jd.call(e,"fence")&&!jd.call(e,"marker"))throw Du("Missing `marker` or `fence` in matter `%j`",e);return e}function Ew(t){let e=hl(t),n={},r=-1;for(;++r<e.length;){let i=e[r],s=Dw(i,"open").charCodeAt(0),o=F3(i),a=n[s];Array.isArray(a)?a.push(o):n[s]=[o]}return{flow:n}}function F3(t){let e=t.anywhere,n=t.type,r=n+"Fence",i=r+"Sequence",s=n+"Value",o={tokenize:u,partial:!0},a,l=0;return{tokenize:c,concrete:!0};function c(f,h,d){let p=this;return g;function g(v){let _=p.now();return _.column===1&&(_.line===1||e)&&(a=Dw(t,"open"),l=0,v===a.charCodeAt(l))?(f.enter(n),f.enter(r),f.enter(i),y(v)):d(v)}function y(v){return l===a.length?(f.exit(i),be(v)?(f.enter("whitespace"),w(v)):b(v)):v===a.charCodeAt(l++)?(f.consume(v),y):d(v)}function w(v){return be(v)?(f.consume(v),w):(f.exit("whitespace"),b(v))}function b(v){return ae(v)?(f.exit(r),f.enter("lineEnding"),f.consume(v),f.exit("lineEnding"),a=Dw(t,"close"),l=0,f.attempt(o,E,S)):d(v)}function S(v){return v===null||ae(v)?k(v):(f.enter(s),D(v))}function D(v){return v===null||ae(v)?(f.exit(s),k(v)):(f.consume(v),D)}function k(v){return v===null?d(v):(f.enter("lineEnding"),f.consume(v),f.exit("lineEnding"),f.attempt(o,E,S))}function E(v){return f.exit(n),h(v)}}function u(f,h,d){let p=0;return g;function g(S){return S===a.charCodeAt(p)?(f.enter(r),f.enter(i),y(S)):d(S)}function y(S){return p===a.length?(f.exit(i),be(S)?(f.enter("whitespace"),w(S)):b(S)):S===a.charCodeAt(p++)?(f.consume(S),y):d(S)}function w(S){return be(S)?(f.consume(S),w):(f.exit("whitespace"),b(S))}function b(S){return S===null||ae(S)?(f.exit(r),h(S)):d(S)}}}function Dw(t,e){return t.marker?_D(t.marker,e).repeat(3):_D(t.fence,e)}function _D(t,e){return typeof t=="string"?t:t[e]}m();function _w(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Tw(t){let e=hl(t),n={},r={},i=-1;for(;++i<e.length;){let s=e[i];n[s.type]=I3(s),r[s.type]=A3,r[s.type+"Value"]=O3}return{enter:n,exit:r}}function I3(t){return e;function e(n){this.enter({type:t.type,value:""},n),this.buffer()}}function A3(t){let e=this.resume(),n=this.stack[this.stack.length-1];"value"in n,this.exit(t),n.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function O3(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function Fw(t){let e=[],n={},r=hl(t),i=-1;for(;++i<r.length;){let s=r[i];n[s.type]=P3(s);let o=Cw(s,"open");e.push({atBreak:!0,character:o.charAt(0),after:_w(o.charAt(1))})}return{unsafe:e,handlers:n}}function P3(t){let e=Cw(t,"open"),n=Cw(t,"close");return r;function r(i){return e+(i.value?`
|
||
`+i.value:"")+`
|
||
`+n}}function Cw(t,e){return t.marker?CD(t.marker,e).repeat(3):CD(t.fence,e)}function CD(t,e){return typeof t=="string"?t:t[e]}var N3="yaml";function qd(t){let e=this,n=t||N3,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Ew(n)),s.push(Tw(n)),o.push(Fw(n))}m();var ND=function(t){if(t==null)return L3;if(typeof t=="function")return Gd(t);if(typeof t=="object")return Array.isArray(t)?M3(t):R3(t);if(typeof t=="string")return z3(t);throw new Error("Expected function, string, or object as test")};function M3(t){let e=[],n=-1;for(;++n<t.length;)e[n]=ND(t[n]);return Gd(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function R3(t){let e=t;return Gd(n);function n(r){let i=r,s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function z3(t){return Gd(e);function e(n){return n&&n.type===t}}function Gd(t){return e;function e(n,r,i){return!!(B3(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function L3(){return!0}function B3(t){return t!==null&&typeof t=="object"&&"type"in t}function $3(t){return"\x1B[33m"+t+"\x1B[39m"}var MD=[],U3=!0,TD=!1,j3="skip";function q3(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;let s=ND(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,u){let f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){let d=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+$3(l.type+(d?"<"+d+">":""))+")"})}return h;function h(){let d=MD,p,g,y;if((!e||s(l,c,u[u.length-1]||void 0))&&(d=V3(n(l,u)),d[0]===TD))return d;if("children"in l&&l.children){let w=l;if(w.children&&d[0]!==j3)for(g=(r?w.children.length:-1)+o,y=u.concat(w);g>-1&&g<w.children.length;){let b=w.children[g];if(p=a(b,g,y)(),p[0]===TD)return p;g=typeof p[1]=="number"?p[1]:g+o}}return d}}}function V3(t){return Array.isArray(t)?t:typeof t=="number"?[U3,t]:t==null?MD:[t]}function RD(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),q3(t,s,a,i);function a(l,c){let u=c[c.length-1],f=u?u.children.indexOf(l):void 0;return o(l,f,u)}}var bi={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533},zD=33,Iw=35,Hd=91,FD=92,Fs=93,Ho=124;function Is(t){return t===bi.lineFeed||t===bi.carriageReturn}function H3(){return{text:{[Hd]:{name:"wikilink",tokenize:ID},[zD]:{name:"wikilink",tokenize:ID}}}}function ID(t,e,n){let r=!1,i=!1,s=!1;return o;function o(k){return k===zD?(t.enter("wikilink"),t.enter("wikilinkEmbedMarker"),t.consume(k),t.exit("wikilinkEmbedMarker"),a):k===Hd?(t.enter("wikilink"),a(k)):n(k)}function a(k){return k!==Hd?n(k):(t.enter("wikilinkMarker"),t.consume(k),l)}function l(k){return k!==Hd?n(k):(t.consume(k),t.exit("wikilinkMarker"),c)}function c(k){return k===Iw?h(k):k===Ho||k===Fs||k===null||Is(k)?n(k):(t.enter("wikilinkPath"),r=!0,u(k))}function u(k){return k===FD?(t.consume(k),f):k===Iw?(t.exit("wikilinkPath"),h(k)):k===Ho?(t.exit("wikilinkPath"),y(k)):k===Fs?(t.exit("wikilinkPath"),S(k)):k===null||Is(k)?n(k):(t.consume(k),u)}function f(k){return k===Ho?(t.exit("wikilinkPath"),y(k)):k===null||Is(k)?n(k):(t.consume(k),u)}function h(k){return k!==Iw?n(k):(t.enter("wikilinkHeadingMarker"),t.consume(k),t.exit("wikilinkHeadingMarker"),d)}function d(k){return k===null||Is(k)?n(k):k===Fs?(i=!0,S(k)):k===Ho?(i=!0,y(k)):(t.enter("wikilinkHeading"),i=!0,p(k))}function p(k){return k===FD?(t.consume(k),g):k===Ho?(t.exit("wikilinkHeading"),y(k)):k===Fs?(t.exit("wikilinkHeading"),S(k)):k===null||Is(k)?n(k):(t.consume(k),p)}function g(k){return k===Ho?(t.exit("wikilinkHeading"),y(k)):k===null||Is(k)?n(k):(t.consume(k),p)}function y(k){return k!==Ho?n(k):(t.enter("wikilinkAliasMarker"),t.consume(k),t.exit("wikilinkAliasMarker"),w)}function w(k){return k===Fs?S(k):k===null||Is(k)?n(k):(t.enter("wikilinkAlias"),s=!0,b(k))}function b(k){return k===Fs?(t.exit("wikilinkAlias"),S(k)):k===null||Is(k)?n(k):(t.consume(k),b)}function S(k){return k!==Fs||!r&&!i&&!s?n(k):(t.enter("wikilinkMarker"),t.consume(k),D)}function D(k){return k!==Fs?n(k):(t.consume(k),t.exit("wikilinkMarker"),t.exit("wikilink"),e)}}var Wo=61;function AD(t){return t===bi.lineFeed||t===bi.carriageReturn}function W3(){return{text:{[Wo]:{name:"highlight",tokenize:G3}}}}function G3(t,e,n){let r={tokenize:c,partial:!0},i=!1;return s;function s(f){return f!==Wo?n(f):(t.enter("highlight"),t.enter("highlightMarker"),t.consume(f),o)}function o(f){return f!==Wo?n(f):(t.consume(f),t.exit("highlightMarker"),t.enter("highlightContent"),a)}function a(f){return f===null||AD(f)||!i&&(f===Wo||f===bi.greaterThan)?n(f):f===Wo?t.attempt(r,u,l)(f):(t.consume(f),i=!0,a)}function l(f){return f===null||AD(f)?n(f):(t.consume(f),a)}function c(f,h,d){return p;function p(y){return y!==Wo?d(y):(f.exit("highlightContent"),f.enter("highlightMarker"),f.consume(y),g)}function g(y){return y!==Wo?d(y):(f.consume(y),f.exit("highlightMarker"),h)}}function u(f){return t.exit("highlight"),e(f)}}var Xn=37,Q3=-4,K3=-3,Z3=-5;function Wd(t){return t===Q3||t===K3||t===Z3}var Y3={tokenize:eU,concrete:!0,name:"commentFlow"},Aw={tokenize:tU,partial:!0};function J3(){return{text:{[Xn]:{name:"comment",tokenize:X3}},flow:{[Xn]:Y3}}}function X3(t,e,n){let r={tokenize:l,partial:!0};return i;function i(u){return u!==Xn?n(u):(t.enter("comment"),t.enter("commentMarker"),t.consume(u),s)}function s(u){return u!==Xn?n(u):(t.consume(u),t.exit("commentMarker"),t.enter("commentContent"),o)}function o(u){return u===null?n(u):u===Xn?t.attempt(r,c,a)(u):(t.consume(u),o)}function a(u){return u===null?n(u):(t.consume(u),o)}function l(u,f,h){return d;function d(g){return g!==Xn?h(g):(u.exit("commentContent"),u.enter("commentMarker"),u.consume(g),p)}function p(g){return g!==Xn?h(g):(u.consume(g),u.exit("commentMarker"),f)}}function c(u){return t.exit("comment"),e(u)}}function eU(t,e,n){let r=this,i={tokenize:p,partial:!0};return s;function s(g){return g!==Xn?n(g):(t.enter("comment"),t.enter("commentMarker"),t.consume(g),o)}function o(g){return g!==Xn?n(g):(t.consume(g),t.exit("commentMarker"),a)}function a(g){return g===null?n(g):Wd(g)?t.attempt(Aw,l,d)(g):(t.enter("commentContent"),u(g))}function l(g){return g===null?d(g):Wd(g)?t.attempt(Aw,l,d)(g):g===Xn?t.attempt(i,h,c)(g):(t.enter("commentContent"),u(g))}function c(g){return t.enter("commentContent"),t.consume(g),u}function u(g){return g===null?d(g):g===Xn?t.attempt(i,h,f)(g):Wd(g)?(t.exit("commentContent"),t.attempt(Aw,l,d)(g)):(t.consume(g),u)}function f(g){return g===null?d(g):(t.consume(g),u)}function h(g){return t.exit("comment"),e(g)}function d(g){return t.exit("comment"),n(g)}function p(g,y,w){let b=!1;return S;function S(k){if(k!==Xn)return w(k);let E=r.events[r.events.length-1];return E&&E[0]==="enter"&&E[1].type==="commentContent"&&(g.exit("commentContent"),b=!0),g.enter("commentMarker"),g.consume(k),D}function D(k){return k!==Xn?(b&&(g.exit("commentMarker"),g.enter("commentContent")),w(k)):(g.consume(k),g.exit("commentMarker"),y)}}}function tU(t,e,n){let r=this;return i;function i(o){return o===null?e(o):Wd(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}var Nw=35,nU=47,rU=45,iU=95,sU=/[\p{L}\p{M}\p{Emoji}]/u;function oU(t){return t===bi.space||t===bi.horizontalTab||t===bi.lineFeed||t===bi.carriageReturn||t===bi.carriageReturnLineFeed}function Ow(t){return t===null||t<0?!1:t>=48&&t<=57||t===rU||t===iU?!0:sU.test(String.fromCodePoint(t))}function Pw(t){return t===null?!1:!(t>=48&&t<=57)}function aU(){return{text:{[Nw]:{name:"tag",tokenize:lU}}}}function lU(t,e,n){let r=!1,i=this;return s;function s(u){let f=i.previous;return!(f===null||oU(f)||f===Nw)||u!==Nw?n(u):(t.enter("tag"),t.enter("tagMarker"),t.consume(u),t.exit("tagMarker"),o)}function o(u){return Ow(u)?(t.enter("tagContent"),Pw(u)&&(r=!0),t.consume(u),a):n(u)}function a(u){return u===nU?(t.consume(u),l):Ow(u)?(Pw(u)&&(r=!0),t.consume(u),a):c(u)}function l(u){return Ow(u)?(Pw(u)&&(r=!0),t.consume(u),a):n(u)}function c(u){return r?(t.exit("tagContent"),t.exit("tag"),e(u)):n(u)}}function cU(){return{enter:{wikilink(t){this.enter({type:"wikilink",value:"",embedded:!1,path:"",heading:"",alias:""},t)},wikilinkEmbedMarker(){let t=this.stack[this.stack.length-1];t.embedded=!0},wikilinkPath(t){let e=this.stack[this.stack.length-1];e.path=this.sliceSerialize(t).replace(/\\([#\[\]])/g,"$1")},wikilinkHeading(t){let e=this.stack[this.stack.length-1];e.heading=this.sliceSerialize(t).replace(/\\([#\[\]])/g,"$1")},wikilinkAlias(t){let e=this.stack[this.stack.length-1];e.alias=this.sliceSerialize(t)}},exit:{wikilink(t){let e=this.stack[this.stack.length-1];e.alias&&(e.path.endsWith("\\")&&(e.path=e.path.slice(0,-1)),e.heading.endsWith("\\")&&(e.heading=e.heading.slice(0,-1))),this.exit(t)}}}}function uU(){return{enter:{highlight(t){this.enter({type:"highlight",children:[]},t)}},exit:{highlightContent(t){let e=this.stack[this.stack.length-1];e.children=[{type:"text",value:this.sliceSerialize(t)}]},highlight(t){this.exit(t)}}}}function fU(){return{enter:{comment(t){this.enter({type:"comment",value:""},t)}},exit:{commentContent(t){let e=this.stack[this.stack.length-1];e.value+=this.sliceSerialize(t)},comment(t){this.exit(t)}}}}function hU(){return{enter:{tag(t){this.enter({type:"tag",value:""},t)},tagContent(t){let e=this.stack[this.stack.length-1];e.type==="tag"&&(e.value=this.sliceSerialize(t))}},exit:{tag(t){this.exit(t)}}}}function dU(){return{handlers:{wikilink(t){let e=t.embedded?"!":"",n=t.heading?`#${t.heading}`:"",r=t.alias?`|${t.alias}`:"";return`${e}[[${t.path}${n}${r}]]`}}}}function mU(){return{handlers:{highlight(t,e,n,r){let i=n.enter("highlight"),s=n.containerPhrasing(t,r);return i(),`==${s}==`}}}}function pU(){return{handlers:{comment(t){return`%%${t.value}%%`}}}}function gU(){return{handlers:{tag(t){return`#${t.value}`}}}}function yU(t,e){RD(t,"listItem",n=>{if(typeof n.checked=="boolean"){let a=n.checked?"x":" ";if(e&&n.position?.start?.offset!=null){let c=e.slice(n.position.start.offset,n.position.start.offset+20).match(/\[([^\]])\]/);c&&(a=c[1])}n.data??={},n.data.taskChar=a,n.data.hProperties??={},n.data.hProperties.dataTaskChar=a;return}let r=n.children?.[0];if(!r||r.type!=="paragraph")return;let i=r.children?.[0];if(!i||i.type!=="text")return;let s=i.value.match(/^\[([^\]])\]\s/);if(!s)return;let o=s[1];n.checked=o!==" ",n.data??={},n.data.taskChar=o,n.data.hProperties??={},n.data.hProperties.dataTaskChar=o,i.value=i.value.slice(s[0].length),i.value.length===0?r.children.shift():i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column+=s[0].length,i.position.start.offset+=s[0].length)})}var zae=As(/[A-Za-z]/),Lae=As(/[\dA-Za-z]/),Bae=As(/[#-'*+\--9=?A-Z^-~]/),$ae=As(/\d/),Uae=As(/[\dA-Fa-f]/),jae=As(/[!-/:-@[-`{-~]/);function Go(t){return t!==null&&t<-2}function OD(t){return t===-2||t===-1||t===32}var qae=As(/\p{P}|\p{S}/u),Vae=As(/\s/);function As(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Vd(t,e,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,s=0;return o;function o(l){return OD(l)?(t.enter(n),a(l)):e(l)}function a(l){return OD(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}var wU={tokenize:bU,concrete:!0,name:"mathFlow"},PD={tokenize:vU,partial:!0};function bU(t,e,n){let r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(b){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(b)}function l(b){return b===36?(t.consume(b),o++,l):o<2?n(b):(t.exit("mathFlowFenceSequence"),Vd(t,c,"whitespace")(b))}function c(b){return b===null||Go(b)?f(b):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),u(b))}function u(b){return b===null||Go(b)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),f(b)):b===36?n(b):(t.consume(b),u)}function f(b){return t.exit("mathFlowFence"),r.interrupt?e(b):t.attempt(PD,h,y)(b)}function h(b){return t.attempt({tokenize:w,partial:!0},y,d)(b)}function d(b){return(s?Vd(t,p,"linePrefix",s+1):p)(b)}function p(b){return b===null?y(b):Go(b)?t.attempt(PD,h,y)(b):(t.enter("mathFlowValue"),g(b))}function g(b){return b===null||Go(b)?(t.exit("mathFlowValue"),p(b)):(t.consume(b),g)}function y(b){return t.exit("mathFlow"),e(b)}function w(b,S,D){let k=0;return Vd(b,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function E(C){return b.enter("mathFlowFence"),b.enter("mathFlowFenceSequence"),v(C)}function v(C){return C===36?(k++,b.consume(C),v):k<o?D(C):(b.exit("mathFlowFenceSequence"),Vd(b,_,"whitespace")(C))}function _(C){return C===null||Go(C)?(b.exit("mathFlowFence"),S(C)):D(C)}}}function vU(t,e,n){let r=this;return i;function i(o){return o===null?e(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function kU(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:xU,previous:SU,name:"mathText"};function r(i,s,o){let a=this,l=0,c,u;return f;function f(y){return i.enter("mathText"),i.enter("mathTextSequence"),h(y)}function h(y){return y===36?(i.consume(y),l++,h):l<2&&!n?o(y):(i.exit("mathTextSequence"),d(y))}function d(y){return y===null?o(y):y===36?(u=i.enter("mathTextSequence"),c=0,g(y)):y===32?(i.enter("space"),i.consume(y),i.exit("space"),d):Go(y)?(i.enter("lineEnding"),i.consume(y),i.exit("lineEnding"),d):(i.enter("mathTextData"),p(y))}function p(y){return y===null||y===32||y===36||Go(y)?(i.exit("mathTextData"),d(y)):(i.consume(y),p)}function g(y){return y===36?(i.consume(y),c++,g):c===l?(i.exit("mathTextSequence"),i.exit("mathText"),s(y)):(u.type="mathTextData",p(y))}}}function xU(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="mathTextData"){t[e][1].type="mathTextPadding",t[n][1].type="mathTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="mathTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function SU(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function DU(t){return{flow:{36:wU},text:{36:kU(t)}}}function EU(t,e){let n=String(t),r=n.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function _U(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function t(l){let c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function e(){this.buffer()}function n(){let l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){let c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c;let f=u.data.hChildren[0];f.type,f.tagName,f.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){let c=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c,u.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function CU(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
|
||
`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(s,o,a,l){let c=s.value||"",u=a.createTracker(l),f="$".repeat(Math.max(EU(c,"$")+1,2)),h=a.enter("mathFlow"),d=u.move(f);if(s.meta){let p=a.enter("mathFlowMeta");d+=u.move(a.safe(s.meta,{after:`
|
||
`,before:d,encode:["$"],...u.current()})),p()}return d+=u.move(`
|
||
`),c&&(d+=u.move(c+`
|
||
`)),d+=u.move(f),h(),d}function r(s,o,a){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;let u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let f=-1;for(;++f<a.unsafe.length;){let h=a.unsafe[f];if(!h.atBreak)continue;let d=a.compilePattern(h),p;for(;p=d.exec(l);){let g=p.index;l.codePointAt(g)===10&&l.codePointAt(g-1)===13&&g--,l=l.slice(0,g)+" "+l.slice(p.index+1)}}return u+l+u}function i(){return"$"}}var TU={wikilinks:!0,highlights:!0,comments:!0,tags:!0,customTaskChars:!0,math:!0};function LD(t){let e={...TU,...t},n=this.data();if(n.micromarkExtensions??=[],n.fromMarkdownExtensions??=[],n.toMarkdownExtensions??=[],e.wikilinks&&(n.micromarkExtensions.push(H3()),n.fromMarkdownExtensions.push(cU()),n.toMarkdownExtensions.push(dU())),e.comments&&(n.micromarkExtensions.push(J3()),n.fromMarkdownExtensions.push(fU()),n.toMarkdownExtensions.push(pU())),e.tags&&(n.micromarkExtensions.push(aU()),n.fromMarkdownExtensions.push(hU()),n.toMarkdownExtensions.push(gU())),e.highlights&&(n.micromarkExtensions.push(W3()),n.fromMarkdownExtensions.push(uU()),n.toMarkdownExtensions.push(mU())),e.math&&(n.micromarkExtensions.push(DU()),n.fromMarkdownExtensions.push(_U()),n.toMarkdownExtensions.push(CU())),!!(e.comments||e.customTaskChars))return(i,s)=>{e.comments&&RD(i,"comment",(o,a,l)=>{if(l&&typeof a=="number")return l.children.splice(a,1),a}),e.customTaskChars&&yU(i,String(s))}}m();m();m();m();var Qd=class{integrations=[];register(e){this.integrations.push(e)}getAll(){return[...this.integrations]}getByCategory(e){return this.integrations.filter(n=>n.category===e)}getEnabled(e){return this.integrations.filter(n=>e[n.settingKey]&&n.isAvailable()).sort((n,r)=>n.priority-r.priority)}getAvailable(){return this.integrations.filter(e=>e.isAvailable())}getAllPatterns(e){return this.getEnabled(e).flatMap(n=>n.getPatterns())}getCollectedAssets(e){let n=new Map;for(let r of this.getEnabled(e))r.assets.scss&&n.set(r.id,r.assets);return n}getById(e){return this.integrations.find(n=>n.id===e)}},Vt=new Qd;m();var BD=require("obsidian");var Yi=it(vt()),Mw="quartz/styles/syncer",FU="_index.scss",Kd="quartz/styles/custom.scss",dl='@use "./syncer";',Eu=class{settings;constructor(e){this.settings=e}async collectAssets(e){let n={success:!1,filesToStage:new Map,filesToDelete:[]};try{if(!this.settings.manageSyncerStyles){let i=await this.collectCleanup(e);return n.filesToDelete=i.filesToDelete,i.customScssUpdate&&n.filesToStage.set(Kd,i.customScssUpdate),(n.filesToDelete.length>0||n.filesToStage.size>0)&&Yi.default.info(`Will remove ${n.filesToDelete.length} syncer style files`),n.success=!0,n}let r=this.getScssFiles();if(r.size>0){for(let[s,o]of r)n.filesToStage.set(s,o);let i=await this.getCustomScssUpdate(e);i&&(n.filesToStage.set(Kd,i),Yi.default.info("Will add syncer import to custom.scss")),Yi.default.info(`Collected ${n.filesToStage.size} integration style files`)}n.success=!0}catch(r){Yi.default.error("Failed to collect integration assets",r),new BD.Notice("Quartz Syncer: Failed to collect integration styles. Check console for details.",1e4),n.success=!1}return n}async collectCleanup(e){let n=[],r=null;try{let i=await e.getContent();if(i){let s=i.tree.filter(o=>o.path.startsWith(Mw)&&o.type==="blob");for(let o of s)n.push(o.path)}}catch(i){Yi.default.debug("Could not list syncer style files for cleanup",i)}try{let i=await e.getRawFile(Kd);if(i){let s=x.from(i.content,"base64").toString("utf-8");s.includes(dl)&&(r=this.removeSyncerImport(s))}}catch{Yi.default.debug("custom.scss not found, no cleanup needed")}return{filesToDelete:n,customScssUpdate:r}}async getCustomScssUpdate(e){try{let n="";try{let r=await e.getRawFile(Kd);r&&(n=x.from(r.content,"base64").toString("utf-8"))}catch{Yi.default.debug("custom.scss not found, will create with import")}return n.includes(dl)?null:this.insertSyncerImport(n)}catch(n){throw Yi.default.error("Failed to check custom.scss",n),n}}insertSyncerImport(e){if(!e.trim())return`${dl}
|
||
`;let n=/@use\s+["']\.\/(?:base|variables)(?:\.scss)?["'](?:\s+as\s+\*)?;?/,r=e.match(n);if(r){let i=r.index+r[0].length,s=e.slice(0,i),o=e.slice(i);return`${s}
|
||
${dl}${o}`}return`${dl}
|
||
|
||
${e}`}removeSyncerImport(e){let n=new RegExp(`\\n?${dl.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\n?`,"g");return e.replace(n,`
|
||
`).replace(/^\n+/,"")}getScssFiles(){let e=new Map,n=Vt.getCollectedAssets(this.settings),r=[];for(let[i,s]of n)if(s.scss){let o=`_${i}.scss`,a=`${Mw}/${o}`;e.set(a,s.scss),r.push(`@use "./${i}";`)}if(r.length>0){let i=`// Quartz Syncer Integration Styles
|
||
// This file is auto-generated. Do not edit manually.
|
||
|
||
${r.join(`
|
||
`)}
|
||
`;e.set(`${Mw}/${FU}`,i)}return e}};m();var Dl=require("obsidian"),b_=it(w0()),v0=it(vt());function b0(){return(0,b_.getAPI)()}function y_(t,e,n){let r="";try{r=n.tryEvaluate(t.trim(),{this:n.page(e)??{}})?.toString()??""}catch(i){v0.default.warn("dvapi.tryEvaluate did not yield any result",i)}return r}async function w_(t,e,n){let r=activeDocument.createElement("div"),i=new Dl.Component;i.load(),await n.executeJs(t,r,i,e),await Ki(r,"[data-tag-name]");let s=(0,Dl.htmlToMarkdown)(r)||"";return Ny(s)}var v_={id:"dataview",name:"Dataview",settingKey:"useDataview",priority:100,category:"community",assets:{},isAvailable(){return!!b0()},getPatterns(){let t=b0(),e=[{id:"dv-block",pattern:/```dataview\s(.+?)```/gms,type:"block"}];if(t){let n=t.settings.dataviewJsKeyword||"dataviewjs",r=t.settings.inlineQueryPrefix||"=",i=t.settings.inlineJsQueryPrefix||"$=";e.push({id:"dv-js-block",pattern:new RegExp("```"+jr(n)+"\\s(.+?)```","gms"),type:"block"},{id:"dv-inline",pattern:new RegExp("`"+jr(r)+"(.+?)`","gms"),type:"inline"},{id:"dv-inline-js",pattern:new RegExp("`"+jr(i)+"(.+?)`","gms"),type:"inline"})}return e},async compile(t,e){let n=b0();if(!n)return t.fullMatch;let r=e.file.getPath(),i=t.captures[0],{isInsideCalloutDepth:s,finalQuery:o}=yd(i);try{let a="";switch(t.descriptor.id){case"dv-block":{let l=await n.tryQueryMarkdown(o,r);return s>0&&(l=gd(l,s)),l}case"dv-js-block":return await w_(o,r,n)??"";case"dv-inline":return a=y_(i.trim(),r,n),a?.toString()??"";case"dv-inline-js":return a=y_(i,r,n),a||(a=await w_(i,r,n)),a??"Unable to render query";default:return t.fullMatch}}catch(a){return v0.default.error(a),new Dl.Notice("Quartz Syncer: Unable to render dataview query. Please update the dataview plugin to the latest version."),t.fullMatch}}};m();var Qr=require("obsidian"),El=it(vt());m();var k_="auto-card-link",x_="obsidian-excalidraw-plugin",S_="datacore";var D_="obsidian-5e-statblocks";var O4=`
|
||
/* Card styles */
|
||
.datacore-card {
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 1.2rem;
|
||
border-radius: 0.5em;
|
||
background-color: var(--background-secondary);
|
||
min-width: 89%;
|
||
border: 2px solid var(--table-border-color);
|
||
overflow-y: scroll;
|
||
transition: all 0.3s cubic-bezier(0.65, 0.05, 0.36, 1);
|
||
}
|
||
|
||
.datacore-card-title {
|
||
margin-bottom: 0.6em;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
font-size: 1.8em;
|
||
}
|
||
|
||
.datacore-card-title.centered {
|
||
justify-content: center !important;
|
||
}
|
||
|
||
.datacore-card-content,
|
||
.datacore-card-inner {
|
||
transition: all 0.3s cubic-bezier(0.65, 0.05, 0.36, 1);
|
||
}
|
||
|
||
.datacore-card-inner {
|
||
overflow-y: scroll;
|
||
overflow-x: hidden;
|
||
max-height: 500px;
|
||
display: flex;
|
||
}
|
||
|
||
.datacore-card .datacore-card-collapser,
|
||
.datacore-card.is-collapsed .datacore-card-collapser {
|
||
transition: all 0.5s cubic-bezier(0.65, 0.05, 0.36, 1);
|
||
}
|
||
|
||
.datacore-card-content {
|
||
flex-grow: 1;
|
||
}
|
||
|
||
.datacore-card:not(.datacore-card.is-collapsed) .datacore-card-collapser {
|
||
transform: rotate(180deg);
|
||
}
|
||
|
||
.datacore-card.is-collapsed .datacore-card-collapser {
|
||
transform: rotate(0deg) !important;
|
||
}
|
||
|
||
.datacore-card-collapse,
|
||
.datacore-card-collapser svg {
|
||
min-width: 1em;
|
||
min-height: 1em;
|
||
fill: currentColor;
|
||
vertical-align: middle;
|
||
}
|
||
|
||
.datacore-card .datacore-card-footer {
|
||
font-size: 0.7em;
|
||
text-align: right;
|
||
padding: 0;
|
||
}
|
||
|
||
/* Table styles */
|
||
.datacore-table {
|
||
width: 100%;
|
||
}
|
||
|
||
.datacore-table > thead > tr,
|
||
.datacore-table > tbody > tr {
|
||
margin-top: 1em;
|
||
margin-bottom: 1em;
|
||
text-align: left;
|
||
}
|
||
|
||
.datacore-table > tbody > tr:hover {
|
||
background-color: var(--text-selection) !important;
|
||
}
|
||
|
||
.datacore-table > thead > tr > th {
|
||
font-weight: 700;
|
||
font-size: larger;
|
||
border-top: none;
|
||
border-left: none;
|
||
border-right: none;
|
||
border-bottom: solid;
|
||
max-width: 100%;
|
||
}
|
||
|
||
.datacore-table > tbody > tr > td {
|
||
text-align: left;
|
||
border: none;
|
||
font-weight: 400;
|
||
max-width: 100%;
|
||
}
|
||
|
||
.datacore-table ul,
|
||
.datacore-table ol {
|
||
margin-block-start: 0.2em !important;
|
||
margin-block-end: 0.2em !important;
|
||
}
|
||
|
||
.datacore-table-header-cell-content {
|
||
width: auto;
|
||
display: inline-flex;
|
||
flex-direction: row;
|
||
}
|
||
|
||
.datacore-table-sort {
|
||
flex-grow: 0;
|
||
margin-right: 0.25em;
|
||
align-items: center;
|
||
}
|
||
|
||
.datacore-table-header-title {
|
||
align-items: center;
|
||
flex-grow: 1;
|
||
}
|
||
|
||
/* Layout styles */
|
||
.dc-stack {
|
||
display: flex;
|
||
flex-direction: column;
|
||
margin: 4px;
|
||
}
|
||
|
||
.dc-group {
|
||
display: flex;
|
||
flex-direction: row;
|
||
margin: 4px;
|
||
}
|
||
|
||
/* Basic UI elements */
|
||
.dc-button {
|
||
padding: 4px;
|
||
margin-left: 4px;
|
||
margin-right: 4px;
|
||
margin-top: 2px;
|
||
margin-bottom: 2px;
|
||
}
|
||
|
||
.dc-intent-error {
|
||
background-color: var(--color-red) !important;
|
||
}
|
||
|
||
.dc-intent-warn {
|
||
background-color: var(--color-orange) !important;
|
||
}
|
||
|
||
.dc-intent-info {
|
||
background-color: var(--color-blue) !important;
|
||
}
|
||
|
||
.dc-intent-success {
|
||
background-color: var(--color-green) !important;
|
||
}
|
||
|
||
.dc-textbox {
|
||
padding: 4px;
|
||
margin-left: 4px;
|
||
margin-right: 4px;
|
||
margin-top: 2px;
|
||
margin-bottom: 2px;
|
||
}
|
||
|
||
.dc-checkbox {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
cursor: pointer;
|
||
margin: 4px 0;
|
||
font-size: 16px;
|
||
}
|
||
|
||
.dc-checkbox input[type="checkbox"] {
|
||
width: 16px;
|
||
height: 16px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.dc-checkbox:hover {
|
||
opacity: 0.8;
|
||
}
|
||
|
||
.dc-checkbox input[type="checkbox"]:focus {
|
||
outline: none;
|
||
box-shadow: var(--shadow-s);
|
||
}
|
||
|
||
.dc-checkbox-disabled {
|
||
cursor: not-allowed;
|
||
opacity: 0.6;
|
||
}
|
||
|
||
.dc-checkbox-disabled input[type="checkbox"] {
|
||
cursor: not-allowed;
|
||
}
|
||
|
||
.dc-slider {
|
||
-webkit-appearance: none;
|
||
appearance: none;
|
||
transition: background 0.3s;
|
||
}
|
||
|
||
.dc-switch.dc-switch-disabled {
|
||
cursor: not-allowed;
|
||
opacity: 0.6;
|
||
}
|
||
|
||
.dc-icon {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
}
|
||
|
||
/* Paging controls */
|
||
.dc-paging-control {
|
||
width: 100%;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
margin-top: 10px;
|
||
margin-bottom: 10px;
|
||
gap: 10px;
|
||
}
|
||
|
||
button.dc-paging-control-page {
|
||
width: var(--input-height);
|
||
height: var(--input-height);
|
||
padding: 0;
|
||
cursor: pointer;
|
||
background-color: unset;
|
||
box-shadow: none;
|
||
}
|
||
|
||
button.dc-paging-control-page:hover {
|
||
background-color: var(--text-selection);
|
||
}
|
||
|
||
button.dc-paging-control-page-active {
|
||
background-color: var(--text-selection);
|
||
}
|
||
|
||
button.dc-paging-control-page[disabled] {
|
||
cursor: inherit;
|
||
opacity: 0.5;
|
||
}
|
||
|
||
button.dc-paging-control-page[disabled]:hover {
|
||
background-color: unset;
|
||
box-shadow: none;
|
||
}
|
||
|
||
.dc-paging-control-separator:hover > .dc-paging-control-ellipsis {
|
||
display: none;
|
||
}
|
||
|
||
.dc-paging-control-separator > .dc-paging-control-leap-left,
|
||
.dc-paging-control-separator > .dc-paging-control-leap-right {
|
||
display: none;
|
||
}
|
||
|
||
.dc-paging-control-separator:hover > .dc-paging-control-leap-left,
|
||
.dc-paging-control-separator:hover > .dc-paging-control-leap-right {
|
||
display: flex;
|
||
}
|
||
|
||
.dc-paging-control-separator > .dc-paging-control-leap-left {
|
||
transform: rotate(180deg);
|
||
}
|
||
|
||
/* Callout styles */
|
||
.datacore .callout-content,
|
||
.datacore.callout {
|
||
transition: all 100ms cubic-bezier(0.02, 0.01, 0.47, 1);
|
||
margin-top: 10px;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.datacore .callout-fold {
|
||
align-self: center;
|
||
}
|
||
|
||
/* Embed styles */
|
||
.datacore-span-embed {
|
||
position: relative;
|
||
padding: 1px 8px 1px 8px;
|
||
margin: 4px 0px 4px 0px;
|
||
background-color: var(--color-base-25);
|
||
}
|
||
|
||
.datacore-embed-source {
|
||
position: absolute;
|
||
top: 4px;
|
||
right: 4px;
|
||
padding-left: 4px;
|
||
padding-right: 4px;
|
||
background-color: var(--background-secondary-alt);
|
||
color: var(--text-faint);
|
||
font-size: var(--font-smallest);
|
||
}
|
||
|
||
/* Error and loading styles */
|
||
.datacore-error-retry {
|
||
margin-top: 1em;
|
||
text-align: center;
|
||
}
|
||
|
||
.datacore-error-box {
|
||
width: 100%;
|
||
min-height: 150px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border: 4px dashed var(--background-secondary);
|
||
}
|
||
|
||
.datacore-error-title {
|
||
text-align: center;
|
||
}
|
||
|
||
.datacore-error-message {
|
||
color: var(--text-muted);
|
||
text-align: center;
|
||
}
|
||
|
||
.datacore-loading-boundary {
|
||
width: 100%;
|
||
min-height: 150px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border: 4px dashed var(--background-secondary);
|
||
}
|
||
|
||
.datacore-loading-title {
|
||
text-align: center;
|
||
}
|
||
|
||
.datacore-loading-content {
|
||
color: var(--text-muted);
|
||
text-align: center;
|
||
}
|
||
|
||
/* Language block styles */
|
||
.block-language-datacore li.selected,
|
||
.block-language-datacorejs li.selected {
|
||
background: var(--text-accent);
|
||
padding: 0.2em;
|
||
border-radius: 50%;
|
||
width: 2em;
|
||
height: 2em;
|
||
}
|
||
|
||
.block-language-datacore li.selected a,
|
||
.block-language-datacorejs li.selected a {
|
||
color: var(--text-on-accent-inverted);
|
||
display: block;
|
||
text-align: center;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.block-language-datacore .datacore-pager,
|
||
.block-language-datacorejs .datacore-pager {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
list-style: none;
|
||
min-width: 90%;
|
||
margin-right: 1.7em;
|
||
}
|
||
|
||
.block-language-datacore li.previous,
|
||
.block-language-datacore li.next,
|
||
.block-language-datacorejs li.previous,
|
||
.block-language-datacorejs li.next {
|
||
min-height: 1.4em;
|
||
min-width: 1.4em;
|
||
}
|
||
|
||
.block-language-datacore li.previous svg,
|
||
.block-language-datacore li.next svg,
|
||
.block-language-datacorejs li.previous svg,
|
||
.block-language-datacorejs li.next svg {
|
||
color: currentColor;
|
||
fill: currentColor !important;
|
||
}
|
||
`;function E_(){if(Ds(S_))return window.datacore}async function P4(t,e,n){let r=activeDocument.createElement("div"),i=new Qr.Component;try{n.executeJs(t,r,i,e)}catch(s){return El.default.error(s),new Qr.Notice(`Quartz Syncer: DatacoreJS execution error: ${String(s)}, trying JSX...`),__(t,e,n)}return i.load(),await Ki(r,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),r}async function __(t,e,n){let r=activeDocument.createElement("div"),i=new Qr.Component;try{n.executeJsx(t,r,i,e)}catch(s){return El.default.error(s),new Qr.Notice(`Quartz Syncer: DatacoreJSX execution error: ${String(s)}`),r}return i.load(),await Ki(r,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),r}async function N4(t,e,n){let r=activeDocument.createElement("div"),i=new Qr.Component;try{n.executeTs(t,r,i,e)}catch(s){return El.default.error(s),new Qr.Notice(`Quartz Syncer: DatacoreTS execution error: ${String(s)}, trying TSX...`),C_(t,e,n)}return i.load(),await Ki(r,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),r}async function C_(t,e,n){let r=activeDocument.createElement("div"),i=new Qr.Component;try{n.executeTsx(t,r,i,e)}catch(s){return El.default.error(s),new Qr.Notice(`Quartz Syncer: DatacoreTSX execution error: ${String(s)}`),r}return i.load(),await Ki(r,'[class*=datacore], [__self="[Object object]"], [__source="[Object object]"]'),r}var T_={id:"datacore",name:"Datacore",settingKey:"useDatacore",priority:100,category:"community",assets:{scss:O4},isAvailable(){return!!E_()},getPatterns(){return[{id:"dc-js",pattern:/```datacorejs\s(.+?)```/gms,type:"block"},{id:"dc-jsx",pattern:/```datacorejsx\s(.+?)```/gms,type:"block"},{id:"dc-ts",pattern:/```datacorets\s(.+?)```/gms,type:"block"},{id:"dc-tsx",pattern:/```datacoretsx\s(.+?)```/gms,type:"block"}]},async compile(t,e){let n=E_();if(!n)return t.fullMatch;let r=e.file.getPath(),i=t.captures[0],{isInsideCalloutDepth:s,finalQuery:o}=yd(i),a=new XMLSerializer;try{let l;switch(t.descriptor.id){case"dc-js":l=await P4(o,r,n);break;case"dc-jsx":l=await __(o,r,n);break;case"dc-ts":l=await N4(o,r,n);break;case"dc-tsx":l=await C_(o,r,n);break;default:return t.fullMatch}let c=du(l,a);return s>0?gd(c,s):c}catch(l){return El.default.error(l),new Qr.Notice(`Quartz Syncer: Datacore query error: ${String(l)}`),t.fullMatch}}};m();var F_={id:"excalidraw",name:"Excalidraw",settingKey:"useExcalidraw",priority:50,category:"community",assets:{},isAvailable(){return Ds(x_)},getPatterns(){return[]},async compile(t){return t.fullMatch}};m();var wm=require("obsidian"),k0=it(vt());var M4=`
|
||
// Quartz fixes
|
||
.statblock {
|
||
.statblock-item-container div {
|
||
display: inline;
|
||
&.tapered-rule,
|
||
span.statblock-table-header {
|
||
display: block;
|
||
}
|
||
&.statblock-table {
|
||
display: flex;
|
||
}
|
||
&.traits {
|
||
font-family: var(--active-traits-font);
|
||
color: var(--active-traits-font-color);
|
||
font-size: var(--active-traits-font-size);
|
||
font-weight: var(--active-traits-font-weight);
|
||
font-style: var(--active-traits-font-style);
|
||
}
|
||
}
|
||
p {
|
||
color: inherit;
|
||
display: inline;
|
||
font: inherit;
|
||
}
|
||
}
|
||
// Quartz fixes end
|
||
|
||
:root {
|
||
--statblock-primary-color: #7a200d;
|
||
--statblock-rule-color: #922610;
|
||
--statblock-background-color: #fdf1dc;
|
||
|
||
--statblock-bar-color: #e69a28;
|
||
--statblock-bar-border-size: 1px;
|
||
--statblock-bar-border-color: #000;
|
||
|
||
--statblock-image-width: 75px;
|
||
--statblock-image-height: 75px;
|
||
--statblock-image-border-size: 2px;
|
||
--statblock-image-border-color: var(--statblock-primary-color);
|
||
|
||
--statblock-border-size: 1px;
|
||
--statblock-border-color: #ddd;
|
||
|
||
--statblock-box-shadow-color: #ddd;
|
||
--statblock-box-shadow-x-offset: 0;
|
||
--statblock-box-shadow-y-offset: 0;
|
||
--statblock-box-shadow-blur: 1.5em;
|
||
|
||
--statblock-font-color: var(--statblock-primary-color);
|
||
--statblock-font-weight: 700;
|
||
|
||
--statblock-content-font: "Noto Sans", "Myriad Pro", Calibri, Helvetica, Arial, sans-serif;
|
||
--statblock-content-font-size: 14px;
|
||
|
||
--statblock-heading-font: "Libre Baskerville", "Lora", "Calisto MT", "Bookman Old Style", Bookman, "Goudy Old Style", Garamond, "Hoefler Text", "Bitstream Charter", Georgia, serif;
|
||
--statblock-heading-font-color: var(--statblock-font-color);
|
||
--statblock-heading-font-size: 23px;
|
||
--statblock-heading-font-variant: small-caps;
|
||
--statblock-heading-font-weight: var(--statblock-font-weight);
|
||
--statblock-heading-line-height: inherit;
|
||
|
||
--statblock-property-line-height: 1.4;
|
||
--statblock-property-font-color: var(--statblock-font-color);
|
||
--statblock-property-name-font-color: var(--statblock-font-color);
|
||
--statblock-property-name-font-weight: bold;
|
||
|
||
--statblock-section-heading-border-size: 1px;
|
||
--statblock-section-heading-border-color: var(--statblock-primary-color);
|
||
--statblock-section-heading-font-color: var(--statblock-font-color);
|
||
--statblock-section-heading-font-size: 21px;
|
||
--statblock-section-heading-font-variant: small-caps;
|
||
--statblock-section-heading-font-weight: normal;
|
||
|
||
--statblock-saves-line-height: 1.4;
|
||
|
||
--statblock-spells-font-style: italic;
|
||
|
||
--statblock-subheading-font-size: 12px;
|
||
--statblock-subheading-font-style: italic;
|
||
--statblock-subheading-font-weight: normal;
|
||
|
||
--statblock-table-header-font-weight: bold;
|
||
|
||
--statblock-traits-name-font-weight: bold;
|
||
--statblock-traits-name-font-style: italic;
|
||
|
||
--statblock-link-style: italic;
|
||
}
|
||
|
||
.statblock-item-container {
|
||
margin-bottom: 0.25rem;
|
||
}
|
||
|
||
.statblock-item-inline {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.statblock {
|
||
--active-primary-color: var(--statblock-primary-color);
|
||
--active-rule-color: var(--statblock-rule-color);
|
||
--active-background-color: var(--statblock-background-color);
|
||
|
||
--active-bar-color: var(--statblock-bar-color);
|
||
--active-bar-border-size: var(--statblock-bar-border-size);
|
||
--active-bar-border-color: var(--statblock-bar-border-color);
|
||
|
||
--active-image-width: var(--statblock-image-width);
|
||
--active-image-height: var(--statblock-image-height);
|
||
--active-image-border-size: var(--statblock-image-border-size);
|
||
--active-image-border-color: var(--statblock-image-border-color, var(--active-primary-color));
|
||
|
||
--active-border-size: var(--statblock-border-size);
|
||
--active-border-color: var(--statblock-border-color);
|
||
|
||
--active-box-shadow-color: var(--statblock-box-shadow-color);
|
||
--active-box-shadow-x-offset: var(--statblock-box-shadow-x-offset);
|
||
--active-box-shadow-y-offset: var(--statblock-box-shadow-y-offset);
|
||
--active-box-shadow-blur: var(--statblock-box-shadow-blur);
|
||
|
||
--active-font-color: var(--statblock-font-color, var(--active-primary-color));
|
||
--active-font-weight: var(--statblock-font-weight);
|
||
|
||
--active-content-font: var(--statblock-content-font);
|
||
--active-content-font-size: var(--statblock-content-font-size);
|
||
|
||
--active-heading-font: var(--statblock-heading-font);
|
||
--active-heading-font-color: var(--statblock-heading-font-color);
|
||
--active-heading-font-size: var(--statblock-heading-font-size);
|
||
--active-heading-font-variant: var(--statblock-heading-font-variant);
|
||
--active-heading-font-weight: var(--statblock-heading-font-weight);
|
||
--active-heading-line-height: var(--statblock-heading-line-height);
|
||
|
||
--active-property-line-height: var(--statblock-property-line-height);
|
||
--active-property-font: var(--statblock-property-font);
|
||
--active-property-font-color: var(--statblock-property-font-color);
|
||
--active-property-font-variant: var(--statblock-property-font-variant);
|
||
--active-property-font-size: var(--statblock-property-font-size);
|
||
--active-property-font-weight: var(--statblock-property-font-weight);
|
||
|
||
--active-property-name-font: var(--statblock-property-name-font);
|
||
--active-property-name-font-color: var(--statblock-property-name-font-color);
|
||
--active-property-name-font-variant: var(--statblock-property-name-font-variant);
|
||
--active-property-name-font-size: var(--statblock-property-name-font-size);
|
||
--active-property-name-font-weight: var(--statblock-property-name-font-weight);
|
||
|
||
--active-section-heading-border-size: var(--statblock-section-heading-border-size);
|
||
--active-section-heading-border-color: var(--statblock-section-heading-border-color);
|
||
--active-section-heading-font: var(--statblock-section-heading-font);
|
||
--active-section-heading-font-color: var(--statblock-section-heading-font-color);
|
||
--active-section-heading-font-size: var(--statblock-section-heading-font-size);
|
||
--active-section-heading-font-variant: var(--statblock-section-heading-font-variant);
|
||
--active-section-heading-font-weight: var(--statblock-section-heading-font-weight);
|
||
|
||
--active-saves-line-height: var(--statblock-saves-line-height);
|
||
|
||
--active-spells-font-style: var(--statblock-spells-font-style);
|
||
|
||
--active-subheading-font: var(--statblock-subheading-font);
|
||
--active-subheading-font-color: var(--statblock-subheading-font-color);
|
||
--active-subheading-font-size: var(--statblock-subheading-font-size);
|
||
--active-subheading-font-style: var(--statblock-subheading-font-style);
|
||
--active-subheading-font-weight: var(--statblock-subheading-font-weight);
|
||
|
||
--active-table-header-font-weight: var(--statblock-table-header-font-weight);
|
||
|
||
--active-traits-font: var(--statblock-traits-font);
|
||
--active-traits-font-color: var(--statblock-traits-font-color);
|
||
--active-traits-font-size: var(--statblock-traits-font-size);
|
||
--active-traits-font-weight: var(--statblock-traits-font-weight);
|
||
--active-traits-font-style: var(--statblock-traits-font-style);
|
||
--active-traits-name-font: var(--statblock-traits-name-font);
|
||
--active-traits-name-font-color: var(--statblock-traits-name-font-color);
|
||
--active-traits-name-font-size: var(--statblock-traits-name-font-size);
|
||
--active-traits-name-font-weight: var(--statblock-traits-name-font-weight);
|
||
--active-traits-name-font-style: var(--statblock-traits-name-font-style);
|
||
|
||
--active-link-style: var(--statblock-link-style);
|
||
|
||
margin: 0 auto;
|
||
position: relative;
|
||
|
||
a {
|
||
font-style: var(--statblock-link-style);
|
||
}
|
||
}
|
||
|
||
.statblock-content-container {
|
||
.statblock-content {
|
||
font-family: var(--active-content-font);
|
||
font-size: var(--active-content-font-size);
|
||
color: var(--active-font-color);
|
||
background-color: var(--active-background-color);
|
||
padding: 0.5em;
|
||
border: var(--active-border-size) var(--active-border-color) solid;
|
||
box-shadow: var(--active-box-shadow-x-offset)
|
||
var(--active-box-shadow-y-offset) var(--active-box-shadow-blur)
|
||
var(--active-box-shadow-color);
|
||
margin-left: 2px;
|
||
margin-right: 2px;
|
||
display: flex;
|
||
gap: 1rem;
|
||
|
||
> .column {
|
||
width: var(--statblock-column-width, 400px);
|
||
}
|
||
|
||
@media screen and (max-width: 400px) {
|
||
> .column {
|
||
width: 75vw;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.bar {
|
||
height: 5px;
|
||
background: var(--active-bar-color);
|
||
border: var(--active-bar-border-size) solid var(--active-bar-border-color);
|
||
z-index: 1;
|
||
width: auto;
|
||
}
|
||
|
||
.heading,
|
||
.statblock-heading {
|
||
font-family: var(--active-heading-font);
|
||
color: var(--active-heading-font-color);
|
||
font-weight: var(--active-heading-font-weight);
|
||
font-variant: var(--active-heading-font-variant);
|
||
font-size: var(--active-heading-font-size);
|
||
line-height: var(--active-heading-line-height);
|
||
margin: 0px;
|
||
letter-spacing: 1px;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
.flex-container {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
.subheading {
|
||
font-weight: var(--active-subheading-font-weight);
|
||
font-style: var(--active-subheading-font-style);
|
||
font-size: var(--active-subheading-font-size);
|
||
font-family: var(--active-subheading-font-family);
|
||
color: var(--active-subheading-font-color);
|
||
margin: 0;
|
||
}
|
||
|
||
.line {
|
||
line-height: var(--active-property-line-height);
|
||
display: block;
|
||
font-family: var(--active-property-font);
|
||
color: var(--active-property-font-color);
|
||
font-variant: var(--active-property-font-variant);
|
||
font-size: var(--active-property-font-size);
|
||
font-weight: var(--active-property-font-weight);
|
||
}
|
||
|
||
.property-name {
|
||
margin: 0;
|
||
margin-right: 0.25em;
|
||
display: inline;
|
||
font-family: var(--active-property-name-font);
|
||
color: var(--active-property-name-font-color);
|
||
font-variant: var(--active-property-name-font-variant);
|
||
font-size: var(--active-property-name-font-size);
|
||
font-weight: var(--active-property-name-font-weight);
|
||
}
|
||
|
||
.section-header {
|
||
border-bottom: var(--active-section-heading-border-size) solid var(--active-section-heading-border-color);
|
||
color: var(--active-section-heading-font-color);
|
||
font-size: var(--active-section-heading-font-size);
|
||
font-variant: var(--active-section-heading-font-variant);
|
||
font-weight: var(--active-section-heading-font-weight);
|
||
font-family: var(--active-section-heading-font);
|
||
letter-spacing: 1px;
|
||
margin: 0;
|
||
margin-bottom: 0.3em;
|
||
break-inside: avoid-column;
|
||
break-after: avoid-column;
|
||
}
|
||
|
||
.tapered-rule {
|
||
width: auto;
|
||
margin: 0.5em 0;
|
||
height: 5px;
|
||
background: linear-gradient(
|
||
90deg,
|
||
var(--active-rule-color) 0%,
|
||
var(--active-rule-color) 50%,
|
||
var(--active-background-color) 95%,
|
||
var(--active-background-color) 100%
|
||
);
|
||
clip-path: polygon(0 0, 0 100%, 95% 50%);
|
||
}
|
||
|
||
.trait {
|
||
font-family: var(--active-traits-font);
|
||
color: var(--active-traits-font-color);
|
||
font-size: var(--active-traits-font-size);
|
||
font-weight: var(--active-traits-font-weight);
|
||
font-style: var(--active-traits-font-style);
|
||
}
|
||
|
||
.trait-name {
|
||
font-family: var(--active-traits-name-font);
|
||
color: var(--active-traits-name-font-color);
|
||
font-size: var(--active-traits-name-font-size);
|
||
font-weight: var(--active-traits-name-font-weight);
|
||
font-style: var(--active-traits-name-font-style);
|
||
}
|
||
|
||
.statblock-nested-traits {
|
||
margin-left: 1rem;
|
||
}
|
||
|
||
.statblock-table {
|
||
display: flex;
|
||
justify-content: space-evenly;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.table-item {
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
flex-flow: column nowrap;
|
||
}
|
||
|
||
.statblock-table-header {
|
||
font-weight: var(--active-table-header-font-weight);
|
||
}
|
||
|
||
.calculated-modifier::before {
|
||
content: "(";
|
||
}
|
||
|
||
.calculated-modifier::after {
|
||
content: ")";
|
||
}
|
||
|
||
.info {
|
||
.line {
|
||
line-height: var(--active-saves-line-height);
|
||
display: block;
|
||
color: var(--active-font-color);
|
||
|
||
.property-name {
|
||
color: var(--active-property-name-font-color);
|
||
margin: 0;
|
||
margin-right: 0.25em;
|
||
display: inline;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.property-text {
|
||
display: inline;
|
||
margin: 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
.save-entry,
|
||
.save-name,
|
||
.save-value {
|
||
display: inline;
|
||
}
|
||
|
||
.save-entry:not(:last-child) .save-value::after {
|
||
content: ", ";
|
||
}
|
||
|
||
.image {
|
||
width: var(--active-image-width);
|
||
height: var(--active-image-height);
|
||
|
||
&.pointer {
|
||
cursor: pointer;
|
||
}
|
||
|
||
img {
|
||
object-fit: cover;
|
||
width: 100%;
|
||
height: 100%;
|
||
border-radius: 100%;
|
||
border: var(--active-image-border-size) solid var(--active-image-border-color);
|
||
object-position: center;
|
||
}
|
||
}
|
||
`;function I_(){if(Ds(D_))return window.FantasyStatblocks}async function R4(t,e,n){let r=activeDocument.createElement("div"),i=new wm.Component;i.load();try{n.renderMarkdown(t,r,e,i)}catch(s){return k0.default.error(s),new wm.Notice(`Quartz Syncer: Fantasy Statblocks execution error: ${String(s)}.`),r}return await Ki(r,".statblock",5e3),r}var A_={id:"fantasy-statblocks",name:"Fantasy Statblocks",settingKey:"useFantasyStatblocks",priority:100,category:"community",assets:{scss:M4},isAvailable(){return!!I_()},getPatterns(){return[{id:"statblock",pattern:/(```statblock\s.+?```)/gms,type:"block"}]},async compile(t,e){let n=I_();if(!n)return t.fullMatch;let r=t.fullMatch.trim();if(!r)return t.fullMatch;try{let i=await R4(r,e.file.getPath(),n);return[".clickable-icon.extra-setting-button",".statblock-inline-item.action-container"].forEach(c=>{i.querySelectorAll(c).forEach(u=>u.remove())}),i.querySelectorAll("span.calculated-modifier").forEach(c=>{c.textContent&&(c.textContent=`(${c.textContent})`)}),new XMLSerializer().serializeToString(i).replace(' xmlns="http://www.w3.org/1999/xhtml"',"")}catch(i){return k0.default.error(i),t.fullMatch}}};m();var _l=require("obsidian"),zu=it(vt());var z4=`
|
||
.auto-card-link-container {
|
||
background-color: transparent;
|
||
container-type: inline-size;
|
||
position: relative;
|
||
overflow: hidden;
|
||
user-select: none;
|
||
--auto-card-link-button-width: calc(var(--icon-size, 18px) + var(--size-2-3, 6px));
|
||
--auto-card-link-indent-size: 2.5em;
|
||
|
||
@for $i from 1 through 7 {
|
||
&[data-auto-card-link-depth="#{$i}"] {
|
||
margin-left: calc(var(--auto-card-link-indent-size) * #{$i});
|
||
}
|
||
}
|
||
}
|
||
|
||
.auto-card-link-title {
|
||
white-space: normal !important;
|
||
--lh: 1.5em;
|
||
line-height: var(--lh);
|
||
height: calc(var(--lh) * 3);
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.auto-card-link-card {
|
||
display: flex;
|
||
flex-direction: row-reverse;
|
||
height: 8em;
|
||
transition: 20ms ease-in;
|
||
cursor: pointer;
|
||
text-decoration: none;
|
||
color: var(--link-external-color, var(--highlight));
|
||
background: var(--background-primary-alt, var(--darkgray));
|
||
border: solid var(--border-width) var(--divider-color, var(--lightgray));
|
||
border-radius: var(--radius-s, 4px);
|
||
|
||
&:hover {
|
||
color: var(--link-external-color-hover, var(--tertiary));
|
||
}
|
||
}
|
||
|
||
.auto-card-link-main {
|
||
display: flex;
|
||
flex-grow: 1;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
gap: 0.18em;
|
||
padding: 0.5em 0.6em;
|
||
overflow: hidden;
|
||
text-align: left;
|
||
}
|
||
|
||
.auto-card-link-description {
|
||
overflow: hidden;
|
||
--lh: 1.4em;
|
||
line-height: var(--lh);
|
||
height: calc(var(--lh) * 3);
|
||
color: var(--text-muted, var(--darkgray));
|
||
font-size: var(--font-smallest, 0.9em);
|
||
}
|
||
|
||
.auto-card-link-host {
|
||
font-size: var(--font-smallest, 0.9em);
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.auto-card-link-thumbnail {
|
||
margin: 0;
|
||
width: unset !important;
|
||
max-height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
|
||
.auto-card-link-error-container {
|
||
color: var(--text-error);
|
||
padding: 0.5em;
|
||
border: 1px solid var(--text-error);
|
||
border-radius: var(--radius-s, 4px);
|
||
}
|
||
`,bm=class extends Error{},vm=class extends Error{},L4=/^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})$/i;function B4(t){return new RegExp(L4).test(t)}function $4(t){let e,n=-1;t=t.split(/\r?\n|\r|\n/g).map(r=>r.replace(/^\t+/g,i=>{let s=i.length;return n<0&&(n=s)," ".repeat(s)})).join(`
|
||
`);try{e=(0,_l.parseYaml)(t)}catch(r){throw zu.default.error(r),new bm("failed to parse yaml. Check debug console for more detail.")}if(!e||!e.url||!e.title)throw new vm("required params[url, title] are not found.");return{url:e.url,title:e.title,description:e.description,host:e.host,favicon:e.favicon,image:e.image,indent:n}}function x0(t){let e=activeDocument.createElement("div");e.addClass("auto-card-link-error-container");let n=activeDocument.createElement("span");return n.textContent=`cardlink error: ${t}`,e.appendChild(n),e}function U4(t,e){let n=activeDocument.createElement("div");n.addClass("auto-card-link-container"),n.setAttr("data-auto-card-link-depth",t.indent);let r=activeDocument.createElement("a");r.addClass("auto-card-link-card"),r.setAttr("href",t.url),n.appendChild(r);let i=activeDocument.createElement("div");i.addClass("auto-card-link-main"),r.appendChild(i);let s=activeDocument.createElement("div");if(s.addClass("auto-card-link-title"),s.textContent=t.title,i.appendChild(s),t.description){let a=activeDocument.createElement("div");a.addClass("auto-card-link-description"),a.textContent=t.description,i.appendChild(a)}let o=activeDocument.createElement("div");if(o.addClass("auto-card-link-host"),i.appendChild(o),t.host){let a=activeDocument.createElement("span");a.textContent=t.host,o.appendChild(a)}if(t.image){let a=t.image;if(!B4(a)){let c=a.slice(2,-2),u=e.metadataCache.getFirstLinkpathDest((0,_l.getLinkpath)(c),"")?.path;u&&(a=e.vault.adapter.getResourcePath(u))}let l=activeDocument.createElement("img");l.addClass("auto-card-link-thumbnail"),l.setAttr("src",a),l.setAttr("draggable","false"),r.appendChild(l)}return n}var O_={id:"auto-card-link",name:"Auto Card Link",settingKey:"useAutoCardLink",priority:100,category:"community",assets:{scss:z4},isAvailable(){return Ds(k_)},getPatterns(){return[{id:"cardlink",pattern:/```cardlink\s(.+?)```/gms,type:"block"}]},async compile(t,e){let n=t.captures[0];if(!n)return t.fullMatch;let r=new XMLSerializer;try{let i=activeDocument.createElement("div");try{let s=$4(n);i.appendChild(U4(s,e.app))}catch(s){return s instanceof vm||s instanceof bm?i.appendChild(x0(s.message)):s instanceof TypeError?(i.appendChild(x0("internal links must be surrounded by quotes.")),zu.default.error(s)):zu.default.error("Code Block: cardlink unknown error",s),du(i,r)}return du(i,r)}catch(i){return zu.default.error(i),new _l.Notice(`Quartz Syncer: Auto Card Link error: ${String(i)}`),t.fullMatch}}};m();function j4(){let t=app?.internalPlugins;return t?t.getPluginById("bases")?.enabled??!1:!1}var P_={id:"bases",name:"Bases",settingKey:"useBases",priority:200,category:"core",assets:{},isAvailable(){return j4()},getPatterns(){return[]},async compile(t){return t.fullMatch}};m();function q4(){let t=app?.internalPlugins;return t?t.getPluginById("canvas")?.enabled??!1:!1}var N_={id:"canvas",name:"Canvas",settingKey:"useCanvas",priority:200,category:"core",assets:{},isAvailable(){return q4()},getPatterns(){return[]},async compile(t){return t.fullMatch}};Vt.register(O_);Vt.register(v_);Vt.register(T_);Vt.register(F_);Vt.register(A_);Vt.register(P_);Vt.register(N_);var km=class{app;settings;constructor(e,n){this.app=e,this.settings=n}compile=e=>async n=>{let r=n,i=Vt.getEnabled(this.settings),s={app:this.app,file:e};for(let o of i)o.shouldTransformFile?.(e)&&(r=await o.transformFile(e,r,s));for(let o of i)r=await this.compilePatterns(o,r,s);return r};async compilePatterns(e,n,r){let i=n,s=e.getPatterns();for(let o of s){let a=new RegExp(o.pattern.source,o.pattern.flags),l=[],c;for(;(c=a.exec(n))!==null;)l.push({descriptor:o,fullMatch:c[0],captures:c.slice(1)});for(let u of l){let f=await e.compile(u,r);i=i.replace(u.fullMatch,f)}}return i}getEnabledIntegrations(){return Vt.getEnabled(this.settings)}getCollectedAssets(){return Vt.getCollectedAssets(this.settings)}};var xm=class t{app;vault;settings;metadataCache;datastore;constructor(e,n,r,i,s){this.app=e,this.vault=n,this.settings=r,this.metadataCache=i,this.datastore=s,this.datastore}runCompilerSteps=(e,n)=>async r=>await n.reduce(async(i,s)=>{let o=await i;return s(e)(o)},Promise.resolve(r));async resolveEmbeddedAssets(e){let n=await this.extractBlobLinks(e),r=[];for(let i of n)try{let s=this.vault.getFileByPath(i);if(!s)continue;let o=await this.vault.readBinary(s);r.push({path:s.path,content:(0,ea.arrayBufferToBase64)(o)})}catch{continue}return r}async generateMarkdown(e){let n=await e.cachedRead();if(e.getType()==="base"){let a=await this.resolveEmbeddedAssets(e);return[n,{blobs:a}]}if(e.getType()==="canvas"){let a=await this.resolveEmbeddedAssets(e);return[n,{blobs:a}]}if(e.file.name.endsWith(".excalidraw")||e.file.name.endsWith(".excalidraw.md")){let a=await this.resolveEmbeddedAssets(e);return[n,{blobs:a}]}let r=[this.convertFrontMatter,this.convertIntegrations,this.linkTargeting,this.astTransform],i=await this.runCompilerSteps(e,r)(n),[s,o]=await this.convertFileLinks(e)(i);return[s,{blobs:o}]}stripVaultPath(e){if(this.settings.vaultPath==="/"||this.settings.vaultPath==="")return e;let n=new RegExp("\\[\\["+jr(this.settings.vaultPath)+"(.*?)\\]\\]","g"),r=new RegExp("\\[(.*?)\\]\\("+jr(this.settings.vaultPath)+"(.*?)\\)","g");try{e=e.replace(n,"[[$1]]"),e=e.replace(r,"[$1]($2)")}catch(i){S0.default.error(`Error while stripping vault path from text: ${String(i)}`)}return e}astTransform=()=>async e=>{let n=this.settings.vaultPath,r=n!=="/"&&n!=="",i=Wy().use(Nd).use(qd,["yaml"]).use(LD).use(Ud,{bullet:"-",emphasis:"_",rule:"-"}),s=i.parse(e),o=await i.run(s);r&&(ul(o,"link",l=>{l.url.startsWith(n)&&(l.url=l.url.substring(n.length))}),ul(o,"image",l=>{l.url.startsWith(n)&&(l.url=l.url.substring(n.length))}));let a=i.stringify(o);return a=a.replace(/^((?:> ?)+)\\\[(![\w-]+(?:\|[^\]\r\n]*)?)]/gm,"$1[$2]"),a=a.replace(/\\\[(\^[\w-]+)\]/g,"[$1]"),a=a.replace(/^(\|.*)/gm,l=>l.replace(/(!?\[\[[^\]]*?)(?<!\\)\|([^\]]*?\]\])/g,"$1\\|$2")),a};convertFrontMatter=e=>n=>{let r=e.getCompiledFrontmatter(n);return n.replace(Gx,()=>r)};convertIntegrations=e=>async n=>(n=await new km(this.app,this.settings).compile(e)(n),n);linkTargeting=()=>e=>e.replace(Qx,"");static ASSET_EXTENSIONS=new Set(["png","jpg","jpeg","gif","webp","mp4","mkv","mov","avi","mp3","wav","ogg","pdf"]);extractBlobLinks=async e=>{let n=[];if(e.getType()==="canvas"){let i=await e.cachedRead();try{let s=JSON.parse(i);if(Array.isArray(s?.nodes)){for(let o of s.nodes)if(o.type==="file"&&typeof o.file=="string"){let a=this.metadataCache.getFirstLinkpathDest(o.file,e.getPath());a&&t.ASSET_EXTENSIONS.has(a.extension)&&n.push(a.path)}}}catch{S0.default.warn(`Failed to parse canvas file: ${e.getPath()}`)}return n}let r=this.metadataCache.getCache(e.getPath());if(e.getType()==="excalidraw"&&r?.links){for(let i of r.links)try{let s=this.metadataCache.getFirstLinkpathDest((0,ea.getLinkpath)(i.link),e.getPath());if(!s||!t.ASSET_EXTENSIONS.has(s.extension))continue;n.push(s.path)}catch{continue}return n}if(!r?.embeds)return n;for(let i of r.embeds)try{let s=this.metadataCache.getFirstLinkpathDest((0,ea.getLinkpath)(i.link),e.getPath());if(!s||!t.ASSET_EXTENSIONS.has(s.extension))continue;n.push(s.path)}catch{continue}return n};convertFileLinks=e=>async n=>{let r=e.getPath(),i=[],s=this.metadataCache.getCache(r);if(!s?.embeds)return[this.stripVaultPath(n),i];let o=n;for(let a of s.embeds)try{let l=this.metadataCache.getFirstLinkpathDest((0,ea.getLinkpath)(a.link),r);if(!l||!t.ASSET_EXTENSIONS.has(l.extension))continue;let c=await this.vault.readBinary(l),u=(0,ea.arrayBufferToBase64)(c),f=this.metadataCache.fileToLinktext(l,this.settings.vaultPath),h=this.metadataCache.getFirstLinkpathDest(l.path,this.settings.vaultPath)?.path??f;i.push({path:h,content:u});let d=a.original.startsWith("![["),p;if(d){let y=a.original.slice(3,-2),w=y.indexOf("|"),b=w>=0?y.substring(0,w):y,S=w>=0?y.substring(w):"",D=b.indexOf("#"),k=D>=0?b.substring(D):"";p=`![[${h}${k}${S}]]`}else{let y=a.original.indexOf("[")+1,w=a.original.indexOf("]"),b=a.original.substring(y,w),S=a.original.lastIndexOf("(")+1,D=a.original.lastIndexOf(")"),k=a.original.substring(S,D),E=k.indexOf("#"),v=E>=0?k.substring(E):"";p=``}let g=a.original.replace(/(\[\[[^\]]*?)\|([^\]]*?\]\])/g,"$1\\|$2");o.includes(a.original)?o=o.replace(a.original,p):o.includes(g)&&(o=o.replace(g,p))}catch{continue}return o=this.stripVaultPath(o),[o,i]}};m();m();var M_=require("obsidian");var Sm=class{settings;constructor(e){this.settings=e}compile(e,n){let r={...n};delete r.position;let i={publish:!0};i=this.addPermalink(e)(r,i),i=this.addDefaultPassThrough(r,i),i=this.addTimestampsFrontmatter(e)(r,i),i=this.addTags(r,i),i=this.addCSSClasses(r,i),i=this.addSocialImage(r,i);let s=this.settings.includeAllFrontmatter?{...i,...r}:i;return`---
|
||
${this.settings.frontmatterFormat==="json"?JSON.stringify(s)+`
|
||
`:(0,M_.stringifyYaml)(s)}---
|
||
`}addPermalink=e=>(n,r)=>{let i={...r};if(n&&(n.permalink?i.permalink=n.permalink:this.settings.usePermalink&&(i.permalink=Wx(n.permalink??e.getVaultPath())),n.aliases||n.alias)){let s=[],o=n.aliases;typeof n.aliases=="string"?s.push(...n.aliases.split(/,\s*/).filter(Boolean)):Array.isArray(o)&&s.push(...o);let a=n.alias;typeof n.alias=="string"?s.push(...n.alias.split(/,\s*/).filter(Boolean)):Array.isArray(a)&&s.push(...a),s.length>0&&(i.aliases=[...new Set(s)])}return i};addDefaultPassThrough(e,n){let r={...n};return e&&(e.title&&(r.title=e.title),e.description&&(r.description=e.description),e.draft&&(r.draft=e.draft),e.comments&&(r.comments=e.comments),e.lang&&(r.lang=e.lang),e.enableToc&&(r.enableToc=e.enableToc)),r}addTags(e,n){let r={...n};if(e){let i=(typeof e.tags=="string"?e.tags.split(/,\s*/).filter(Boolean):e.tags)||[];if(i.length>0&&(r.tags=i),e.tag!==void 0){if(typeof e.tag=="string")r.tags=[...r.tags??[],...e.tag.split(/,\s*/).filter(Boolean)];else if(Array.isArray(e.tag)){let s=e.tag;r.tags=[...r.tags??[],...s]}}r.tags&&(r.tags=[...new Set(r.tags)])}return r}addCSSClasses(e,n){let r={...n},i=[];if(e){let s=e.cssclasses;e.cssclasses!==void 0&&(typeof e.cssclasses=="string"?i.push(...e.cssclasses.split(/\s+/).filter(Boolean)):Array.isArray(s)&&i.push(...s));let o=e.cssclass;e.cssclass!==void 0&&(typeof e.cssclass=="string"?i.push(...e.cssclass.split(/\s+/).filter(Boolean)):Array.isArray(o)&&i.push(...o))}return i.length>0&&(r.cssclasses=[...new Set(i)]),r}addSocialImage(e,n){let r={...n};if(e){let i=e.socialImage??e.image??e.cover??"",s=e.socialDescription??"";i&&i!==""&&(r.socialImage=i),s&&s!==""&&(r.socialDescription=s)}return r}addTimestampsFrontmatter=e=>(n,r)=>{let{showCreatedTimestamp:i,showUpdatedTimestamp:s,showPublishedTimestamp:o}=this.settings,a=this.settings.includeAllFrontmatter,l=e.meta.getCreatedAt(),c=e.meta.getUpdatedAt(),u=e.meta.getPublishedAt();return l&&(i||a)&&(r.created=a?n.created??n.date??l:l),c&&(s||a)&&(r.modified=a?n.modified??n.lastmod??n.updated??n["last-modified"]??c:c),u&&(o||a)&&(r.published=a?n.published??n.publishDate??n.date??u:u),r}};m();m();m();m();m();var es=class extends Error{},Dm=class extends es{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Em=class extends es{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},_m=class extends es{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Kr=class extends es{},Cl=class extends es{constructor(e){super(`Invalid unit ${e}`)}},Dt=class extends es{},Zr=class extends es{constructor(){super("Zone is an abstract class")}};m();m();m();var ie="numeric",Yr="short",rr="long",Rs={year:ie,month:ie,day:ie},Lu={year:ie,month:Yr,day:ie},D0={year:ie,month:Yr,day:ie,weekday:Yr},Bu={year:ie,month:rr,day:ie},$u={year:ie,month:rr,day:ie,weekday:rr},Uu={hour:ie,minute:ie},ju={hour:ie,minute:ie,second:ie},qu={hour:ie,minute:ie,second:ie,timeZoneName:Yr},Vu={hour:ie,minute:ie,second:ie,timeZoneName:rr},Hu={hour:ie,minute:ie,hourCycle:"h23"},Wu={hour:ie,minute:ie,second:ie,hourCycle:"h23"},Gu={hour:ie,minute:ie,second:ie,hourCycle:"h23",timeZoneName:Yr},Qu={hour:ie,minute:ie,second:ie,hourCycle:"h23",timeZoneName:rr},Ku={year:ie,month:ie,day:ie,hour:ie,minute:ie},Zu={year:ie,month:ie,day:ie,hour:ie,minute:ie,second:ie},Yu={year:ie,month:Yr,day:ie,hour:ie,minute:ie},Ju={year:ie,month:Yr,day:ie,hour:ie,minute:ie,second:ie},E0={year:ie,month:Yr,day:ie,weekday:Yr,hour:ie,minute:ie},Xu={year:ie,month:rr,day:ie,hour:ie,minute:ie,timeZoneName:Yr},ef={year:ie,month:rr,day:ie,hour:ie,minute:ie,second:ie,timeZoneName:Yr},tf={year:ie,month:rr,day:ie,weekday:rr,hour:ie,minute:ie,timeZoneName:rr},nf={year:ie,month:rr,day:ie,weekday:rr,hour:ie,minute:ie,second:ie,timeZoneName:rr};m();m();m();m();var Nn=class{get type(){throw new Zr}get name(){throw new Zr}get ianaName(){return this.name}get isUniversal(){throw new Zr}offsetName(e,n){throw new Zr}formatOffset(e,n){throw new Zr}offset(e){throw new Zr}equals(e){throw new Zr}get isValid(){throw new Zr}};var _0=null,zs=class t extends Nn{static get instance(){return _0===null&&(_0=new t),_0}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return Tm(e,n,r)}formatOffset(e,n){return Ls(this.offset(e),n)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};m();var T0=new Map;function V4(t){let e=T0.get(t);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),T0.set(t,e)),e}var H4={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function W4(t,e){let n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,s,o,a,l,c,u]=r;return[o,i,s,a,l,c,u]}function G4(t,e){let n=t.formatToParts(e),r=[];for(let i=0;i<n.length;i++){let{type:s,value:o}=n[i],a=H4[s];s==="era"?r[a]=o:ye(a)||(r[a]=parseInt(o,10))}return r}var C0=new Map,an=class t extends Nn{static create(e){let n=C0.get(e);return n===void 0&&C0.set(e,n=new t(e)),n}static resetCache(){C0.clear(),T0.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return Tm(e,n,r,this.name)}formatOffset(e,n){return Ls(this.offset(e),n)}offset(e){if(!this.valid)return NaN;let n=new Date(e);if(isNaN(n))return NaN;let r=V4(this.name),[i,s,o,a,l,c,u]=r.formatToParts?G4(r,n):W4(r,n);a==="BC"&&(i=-Math.abs(i)+1);let h=Tl({year:i,month:s,day:o,hour:l===24?0:l,minute:c,second:u,millisecond:0}),d=+n,p=d%1e3;return d-=p>=0?p:1e3+p,(h-d)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};m();var R_={};function Q4(t,e={}){let n=JSON.stringify([t,e]),r=R_[n];return r||(r=new Intl.ListFormat(t,e),R_[n]=r),r}var F0=new Map;function I0(t,e={}){let n=JSON.stringify([t,e]),r=F0.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(t,e),F0.set(n,r)),r}var A0=new Map;function K4(t,e={}){let n=JSON.stringify([t,e]),r=A0.get(n);return r===void 0&&(r=new Intl.NumberFormat(t,e),A0.set(n,r)),r}var O0=new Map;function Z4(t,e={}){let{base:n,...r}=e,i=JSON.stringify([t,r]),s=O0.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(t,e),O0.set(i,s)),s}var rf=null;function Y4(){return rf||(rf=new Intl.DateTimeFormat().resolvedOptions().locale,rf)}var P0=new Map;function z_(t){let e=P0.get(t);return e===void 0&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),P0.set(t,e)),e}var N0=new Map;function J4(t){let e=N0.get(t);if(!e){let n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in e||(e={...L_,...e}),N0.set(t,e)}return e}function X4(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let n=t.indexOf("-u-");if(n===-1)return[t];{let r,i;try{r=I0(t).resolvedOptions(),i=t}catch{let l=t.substring(0,n);r=I0(l).resolvedOptions(),i=l}let{numberingSystem:s,calendar:o}=r;return[i,s,o]}}function ej(t,e,n){return(n||e)&&(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`)),t}function tj(t){let e=[];for(let n=1;n<=12;n++){let r=$e.utc(2009,n,1);e.push(t(r))}return e}function nj(t){let e=[];for(let n=1;n<=7;n++){let r=$e.utc(2016,11,13+n);e.push(t(r))}return e}function Fm(t,e,n,r){let i=t.listingMode();return i==="error"?null:i==="en"?n(e):r(e)}function rj(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||z_(t.locale).numberingSystem==="latn"}var M0=class{constructor(e,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:i,floor:s,...o}=r;if(!n||Object.keys(o).length>0){let a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=K4(e,a)}}format(e){if(this.inf){let n=this.floor?Math.floor(e):e;return this.inf.format(n)}else{let n=this.floor?Math.floor(e):Fl(e,3);return mt(n,this.padTo)}}},R0=class{constructor(e,n,r){this.opts=r,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&an.create(a).valid?(i=a,this.dt=e):(i="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,i=e.zone.name):(i="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=I0(n,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(n=>{if(n.type==="timeZoneName"){let r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...n,value:r}}else return n}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},z0=class{constructor(e,n,r){this.opts={style:"long",...r},!n&&Im()&&(this.rtf=Z4(e,r))}format(e,n){return this.rtf?this.rtf.format(e,n):B_(n,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,n){return this.rtf?this.rtf.formatToParts(e,n):[]}},L_={firstDay:1,minimalDays:4,weekend:[6,7]},Qe=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,n,r,i,s=!1){let o=e||Ge.defaultLocale,a=o||(s?"en-US":Y4()),l=n||Ge.defaultNumberingSystem,c=r||Ge.defaultOutputCalendar,u=sf(i)||Ge.defaultWeekSettings;return new t(a,l,c,u,o)}static resetCache(){rf=null,F0.clear(),A0.clear(),O0.clear(),P0.clear(),N0.clear()}static fromObject({locale:e,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return t.create(e,n,r,i)}constructor(e,n,r,i,s){let[o,a,l]=X4(e);this.locale=o,this.numberingSystem=n||a||null,this.outputCalendar=r||l||null,this.weekSettings=i,this.intl=ej(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=rj(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&n?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,sf(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,n=!1){return Fm(this,e,L0,()=>{let r=n?{month:e,day:"numeric"}:{month:e},i=n?"format":"standalone";return this.monthsCache[i][e]||(this.monthsCache[i][e]=tj(s=>this.extract(s,r,"month"))),this.monthsCache[i][e]})}weekdays(e,n=!1){return Fm(this,e,B0,()=>{let r=n?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},i=n?"format":"standalone";return this.weekdaysCache[i][e]||(this.weekdaysCache[i][e]=nj(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[i][e]})}meridiems(){return Fm(this,void 0,()=>$0,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[$e.utc(2016,11,13,9),$e.utc(2016,11,13,19)].map(n=>this.extract(n,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Fm(this,e,U0,()=>{let n={era:e};return this.eraCache[e]||(this.eraCache[e]=[$e.utc(-40,1,1),$e.utc(2017,1,1)].map(r=>this.extract(r,n,"era"))),this.eraCache[e]})}extract(e,n,r){let i=this.dtFormatter(e,n),s=i.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new M0(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,n={}){return new R0(e,this.intl,n)}relFormatter(e={}){return new z0(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Q4(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||z_(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Am()?J4(this.locale):L_}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}};m();m();var q0=null,Ht=class t extends Nn{static get utcInstance(){return q0===null&&(q0=new t(0)),q0}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let n=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new t(ta(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ls(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ls(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,n){return Ls(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};m();var Il=class extends Nn{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Jr(t,e){let n;if(ye(t)||t===null)return e;if(t instanceof Nn)return t;if($_(t)){let r=t.toLowerCase();return r==="default"?e:r==="local"||r==="system"?zs.instance:r==="utc"||r==="gmt"?Ht.utcInstance:Ht.parseSpecifier(r)||an.create(t)}else return Xr(t)?Ht.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new Il(t)}m();var H0={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},U_={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},ij=H0.hanidec.replace(/[\[|\]]/g,"").split("");function j_(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(t[n].search(H0.hanidec)!==-1)e+=ij.indexOf(t[n]);else for(let i in U_){let[s,o]=U_[i];r>=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}var V0=new Map;function q_(){V0.clear()}function Cr({numberingSystem:t},e=""){let n=t||"latn",r=V0.get(n);r===void 0&&(r=new Map,V0.set(n,r));let i=r.get(e);return i===void 0&&(i=new RegExp(`${H0[n]}${e}`),r.set(e,i)),i}var V_=()=>Date.now(),H_="system",W_=null,G_=null,Q_=null,K_=60,Z_,Y_=null,Ge=class{static get now(){return V_}static set now(e){V_=e}static set defaultZone(e){H_=e}static get defaultZone(){return Jr(H_,zs.instance)}static get defaultLocale(){return W_}static set defaultLocale(e){W_=e}static get defaultNumberingSystem(){return G_}static set defaultNumberingSystem(e){G_=e}static get defaultOutputCalendar(){return Q_}static set defaultOutputCalendar(e){Q_=e}static get defaultWeekSettings(){return Y_}static set defaultWeekSettings(e){Y_=sf(e)}static get twoDigitCutoffYear(){return K_}static set twoDigitCutoffYear(e){K_=e%100}static get throwOnInvalid(){return Z_}static set throwOnInvalid(e){Z_=e}static resetCaches(){Qe.resetCache(),an.resetCache(),$e.resetCache(),q_()}};m();m();var Wt=class{constructor(e,n){this.reason=e,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var J_=[0,31,59,90,120,151,181,212,243,273,304,334],X_=[0,31,60,91,121,152,182,213,244,274,305,335];function Tr(t,e){return new Wt("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Om(t,e,n){let r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function eC(t,e,n){return n+(ra(t)?X_:J_)[e-1]}function tC(t,e){let n=ra(t)?X_:J_,r=n.findIndex(s=>s<e),i=e-n[r];return{month:r+1,day:i}}function Pm(t,e){return(t-e+7)%7+1}function of(t,e=4,n=1){let{year:r,month:i,day:s}=t,o=eC(r,i,s),a=Pm(Om(r,i,s),n),l=Math.floor((o-a+14-e)/7),c;return l<1?(c=r-1,l=na(c,e,n)):l>na(r,e,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...lf(t)}}function W0(t,e=4,n=1){let{weekYear:r,weekNumber:i,weekday:s}=t,o=Pm(Om(r,1,e),n),a=Bs(r),l=i*7+s-o-7+e,c;l<1?(c=r-1,l+=Bs(c)):l>a?(c=r+1,l-=Bs(r)):c=r;let{month:u,day:f}=tC(c,l);return{year:c,month:u,day:f,...lf(t)}}function Nm(t){let{year:e,month:n,day:r}=t,i=eC(e,n,r);return{year:e,ordinal:i,...lf(t)}}function G0(t){let{year:e,ordinal:n}=t,{month:r,day:i}=tC(e,n);return{year:e,month:r,day:i,...lf(t)}}function Q0(t,e){if(!ye(t.localWeekday)||!ye(t.localWeekNumber)||!ye(t.localWeekYear)){if(!ye(t.weekday)||!ye(t.weekNumber)||!ye(t.weekYear))throw new Kr("Cannot mix locale-based week fields with ISO-based week fields");return ye(t.localWeekday)||(t.weekday=t.localWeekday),ye(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),ye(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function nC(t,e=4,n=1){let r=af(t.weekYear),i=ir(t.weekNumber,1,na(t.weekYear,e,n)),s=ir(t.weekday,1,7);return r?i?s?!1:Tr("weekday",t.weekday):Tr("week",t.weekNumber):Tr("weekYear",t.weekYear)}function rC(t){let e=af(t.year),n=ir(t.ordinal,1,Bs(t.year));return e?n?!1:Tr("ordinal",t.ordinal):Tr("year",t.year)}function K0(t){let e=af(t.year),n=ir(t.month,1,12),r=ir(t.day,1,Al(t.year,t.month));return e?n?r?!1:Tr("day",t.day):Tr("month",t.month):Tr("year",t.year)}function Z0(t){let{hour:e,minute:n,second:r,millisecond:i}=t,s=ir(e,0,23)||e===24&&n===0&&r===0&&i===0,o=ir(n,0,59),a=ir(r,0,59),l=ir(i,0,999);return s?o?a?l?!1:Tr("millisecond",i):Tr("second",r):Tr("minute",n):Tr("hour",e)}function ye(t){return typeof t>"u"}function Xr(t){return typeof t=="number"}function af(t){return typeof t=="number"&&t%1===0}function $_(t){return typeof t=="string"}function sC(t){return Object.prototype.toString.call(t)==="[object Date]"}function Im(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Am(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function oC(t){return Array.isArray(t)?t:[t]}function Y0(t,e,n){if(t.length!==0)return t.reduce((r,i)=>{let s=[e(i),i];return r&&n(r[0],s[0])===r[0]?r:s},null)[1]}function aC(t,e){return e.reduce((n,r)=>(n[r]=t[r],n),{})}function $s(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function sf(t){if(t==null)return null;if(typeof t!="object")throw new Dt("Week settings must be an object");if(!ir(t.firstDay,1,7)||!ir(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!ir(e,1,7)))throw new Dt("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function ir(t,e,n){return af(t)&&t>=e&&t<=n}function sj(t,e){return t-e*Math.floor(t/e)}function mt(t,e=2){let n=t<0,r;return n?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function ts(t){if(!(ye(t)||t===null||t===""))return parseInt(t,10)}function Us(t){if(!(ye(t)||t===null||t===""))return parseFloat(t)}function cf(t){if(!(ye(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Fl(t,e,n=!1){let r=10**e;return(n?Math.trunc:Math.round)(t*r)/r}function ra(t){return t%4===0&&(t%100!==0||t%400===0)}function Bs(t){return ra(t)?366:365}function Al(t,e){let n=sj(e-1,12)+1,r=t+(e-n)/12;return n===2?ra(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Tl(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function iC(t,e,n){return-Pm(Om(t,1,e),n)+e-1}function na(t,e=4,n=1){let r=iC(t,e,n),i=iC(t+1,e,n);return(Bs(t)-r+i)/7}function uf(t){return t>99?t:t>Ge.twoDigitCutoffYear?1900+t:2e3+t}function Tm(t,e,n,r=null){let i=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);let o={timeZoneName:e,...s},a=new Intl.DateTimeFormat(n,o).formatToParts(i).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function ta(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);let r=parseInt(e,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function J0(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Dt(`Invalid unit value ${t}`);return e}function Ol(t,e){let n={};for(let r in t)if($s(t,r)){let i=t[r];if(i==null)continue;n[e(r)]=J0(i)}return n}function Ls(t,e){let n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${mt(n,2)}:${mt(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${mt(n,2)}${mt(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function lf(t){return aC(t,["hour","minute","second","millisecond"])}var oj=["January","February","March","April","May","June","July","August","September","October","November","December"],X0=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],aj=["J","F","M","A","M","J","J","A","S","O","N","D"];function L0(t){switch(t){case"narrow":return[...aj];case"short":return[...X0];case"long":return[...oj];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var eb=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],tb=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],lj=["M","T","W","T","F","S","S"];function B0(t){switch(t){case"narrow":return[...lj];case"short":return[...tb];case"long":return[...eb];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var $0=["AM","PM"],cj=["Before Christ","Anno Domini"],uj=["BC","AD"],fj=["B","A"];function U0(t){switch(t){case"narrow":return[...fj];case"short":return[...uj];case"long":return[...cj];default:return null}}function lC(t){return $0[t.hour<12?0:1]}function cC(t,e){return B0(e)[t.weekday-1]}function uC(t,e){return L0(e)[t.month-1]}function fC(t,e){return U0(e)[t.year<0?0:1]}function B_(t,e,n="always",r=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(t)===-1;if(n==="auto"&&s){let f=t==="days";switch(e){case 1:return f?"tomorrow":`next ${i[t][0]}`;case-1:return f?"yesterday":`last ${i[t][0]}`;case 0:return f?"today":`this ${i[t][0]}`;default:}}let o=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=i[t],u=r?l?c[1]:c[2]||c[1]:l?i[t][0]:t;return o?`${a} ${u} ago`:`in ${a} ${u}`}function hC(t,e){let n="";for(let r of t)r.literal?n+=r.val:n+=e(r.val);return n}var hj={D:Rs,DD:Lu,DDD:Bu,DDDD:$u,t:Uu,tt:ju,ttt:qu,tttt:Vu,T:Hu,TT:Wu,TTT:Gu,TTTT:Qu,f:Ku,ff:Yu,fff:Xu,ffff:tf,F:Zu,FF:Ju,FFF:ef,FFFF:nf},Gt=class t{static create(e,n={}){return new t(e,n)}static parseFormat(e){let n=null,r="",i=!1,s=[];for(let o=0;o<e.length;o++){let a=e.charAt(o);a==="'"?(r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),n=null,r="",i=!i):i||a===n?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,n=a)}return r.length>0&&s.push({literal:i||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return hj[e]}constructor(e,n){this.opts=n,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...n}).format()}dtFormatter(e,n={}){return this.loc.dtFormatter(e,{...this.opts,...n})}formatDateTime(e,n){return this.dtFormatter(e,n).format()}formatDateTimeParts(e,n){return this.dtFormatter(e,n).formatToParts()}formatInterval(e,n){return this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,n){return this.dtFormatter(e,n).resolvedOptions()}num(e,n=0){if(this.opts.forceSimple)return mt(e,n);let r={...this.opts};return n>0&&(r.padTo=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,n){let r=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(d,p)=>this.loc.extract(e,d,p),o=d=>e.isOffsetFixed&&e.offset===0&&d.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,d.format):"",a=()=>r?lC(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(d,p)=>r?uC(e,d):s(p?{month:d}:{month:d,day:"numeric"},"month"),c=(d,p)=>r?cC(e,d):s(p?{weekday:d}:{weekday:d,month:"long",day:"numeric"},"weekday"),u=d=>{let p=t.macroTokenToFormatOpts(d);return p?this.formatWithSystemDefault(e,p):d},f=d=>r?fC(e,d):s({era:d},"era"),h=d=>{switch(d){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return i?s({day:"numeric"},"day"):this.num(e.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(e.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(e.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(d)}};return hC(t.parseFormat(n),h)}formatDurationFromString(e,n){let r=l=>{switch(l[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},i=l=>c=>{let u=r(c);return u?this.num(l.get(u),c.length):c},s=t.parseFormat(n),o=s.reduce((l,{literal:c,val:u})=>c?l:l.concat(u),[]),a=e.shiftTo(...o.map(r).filter(l=>l));return hC(s,i(a))}};m();var mC=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Nl(...t){let e=t.reduce((n,r)=>n+r.source,"");return RegExp(`^${e}$`)}function Ml(...t){return e=>t.reduce(([n,r,i],s)=>{let[o,a,l]=s(e,i);return[{...n,...o},a||r,l]},[{},null,1]).slice(0,2)}function Rl(t,...e){if(t==null)return[null,null];for(let[n,r]of e){let i=n.exec(t);if(i)return r(i)}return[null,null]}function pC(...t){return(e,n)=>{let r={},i;for(i=0;i<t.length;i++)r[t[i]]=ts(e[n+i]);return[r,null,n+i]}}var gC=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,dj=`(?:${gC.source}?(?:\\[(${mC.source})\\])?)?`,nb=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,yC=RegExp(`${nb.source}${dj}`),rb=RegExp(`(?:T${yC.source})?`),mj=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,pj=/(\d{4})-?W(\d\d)(?:-?(\d))?/,gj=/(\d{4})-?(\d{3})/,yj=pC("weekYear","weekNumber","weekDay"),wj=pC("year","ordinal"),bj=/(\d{4})-(\d\d)-(\d\d)/,wC=RegExp(`${nb.source} ?(?:${gC.source}|(${mC.source}))?`),vj=RegExp(`(?: ${wC.source})?`);function Pl(t,e,n){let r=t[e];return ye(r)?n:ts(r)}function kj(t,e){return[{year:Pl(t,e),month:Pl(t,e+1,1),day:Pl(t,e+2,1)},null,e+3]}function zl(t,e){return[{hours:Pl(t,e,0),minutes:Pl(t,e+1,0),seconds:Pl(t,e+2,0),milliseconds:cf(t[e+3])},null,e+4]}function ff(t,e){let n=!t[e]&&!t[e+1],r=ta(t[e+1],t[e+2]),i=n?null:Ht.instance(r);return[{},i,e+3]}function hf(t,e){let n=t[e]?an.create(t[e]):null;return[{},n,e+1]}var xj=RegExp(`^T?${nb.source}$`),Sj=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Dj(t){let[e,n,r,i,s,o,a,l,c]=t,u=e[0]==="-",f=l&&l[0]==="-",h=(d,p=!1)=>d!==void 0&&(p||d&&u)?-d:d;return[{years:h(Us(n)),months:h(Us(r)),weeks:h(Us(i)),days:h(Us(s)),hours:h(Us(o)),minutes:h(Us(a)),seconds:h(Us(l),l==="-0"),milliseconds:h(cf(c),f)}]}var Ej={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function ib(t,e,n,r,i,s,o){let a={year:e.length===2?uf(ts(e)):ts(e),month:X0.indexOf(n)+1,day:ts(r),hour:ts(i),minute:ts(s)};return o&&(a.second=ts(o)),t&&(a.weekday=t.length>3?eb.indexOf(t)+1:tb.indexOf(t)+1),a}var _j=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Cj(t){let[,e,n,r,i,s,o,a,l,c,u,f]=t,h=ib(e,i,r,n,s,o,a),d;return l?d=Ej[l]:c?d=0:d=ta(u,f),[h,new Ht(d)]}function Tj(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Fj=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Ij=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Aj=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function dC(t){let[,e,n,r,i,s,o,a]=t;return[ib(e,i,r,n,s,o,a),Ht.utcInstance]}function Oj(t){let[,e,n,r,i,s,o,a]=t;return[ib(e,a,n,r,i,s,o),Ht.utcInstance]}var Pj=Nl(mj,rb),Nj=Nl(pj,rb),Mj=Nl(gj,rb),Rj=Nl(yC),bC=Ml(kj,zl,ff,hf),zj=Ml(yj,zl,ff,hf),Lj=Ml(wj,zl,ff,hf),Bj=Ml(zl,ff,hf);function vC(t){return Rl(t,[Pj,bC],[Nj,zj],[Mj,Lj],[Rj,Bj])}function kC(t){return Rl(Tj(t),[_j,Cj])}function xC(t){return Rl(t,[Fj,dC],[Ij,dC],[Aj,Oj])}function SC(t){return Rl(t,[Sj,Dj])}var $j=Ml(zl);function DC(t){return Rl(t,[xj,$j])}var Uj=Nl(bj,vj),jj=Nl(wC),qj=Ml(zl,ff,hf);function EC(t){return Rl(t,[Uj,bC],[jj,qj])}var _C="Invalid Duration",TC={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Vj={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...TC},Fr=146097/400,Ll=146097/4800,Hj={years:{quarters:4,months:12,weeks:Fr/7,days:Fr,hours:Fr*24,minutes:Fr*24*60,seconds:Fr*24*60*60,milliseconds:Fr*24*60*60*1e3},quarters:{months:3,weeks:Fr/28,days:Fr/4,hours:Fr*24/4,minutes:Fr*24*60/4,seconds:Fr*24*60*60/4,milliseconds:Fr*24*60*60*1e3/4},months:{weeks:Ll/7,days:Ll,hours:Ll*24,minutes:Ll*24*60,seconds:Ll*24*60*60,milliseconds:Ll*24*60*60*1e3},...TC},ia=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Wj=ia.slice(0).reverse();function js(t,e,n=!1){let r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new pt(r)}function FC(t,e){let n=e.milliseconds??0;for(let r of Wj.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function CC(t,e){let n=FC(t,e)<0?-1:1;ia.reduceRight((r,i)=>{if(ye(e[i]))return r;if(r){let s=e[r]*n,o=t[i][r],a=Math.floor(s/o);e[i]+=a*n,e[r]-=a*o*n}return i},null),ia.reduce((r,i)=>{if(ye(e[i]))return r;if(r){let s=e[r]%1;e[r]-=s,e[i]+=s*t[r][i]}return i},null)}function Gj(t){let e={};for(let[n,r]of Object.entries(t))r!==0&&(e[n]=r);return e}var pt=class t{constructor(e){let n=e.conversionAccuracy==="longterm"||!1,r=n?Hj:Vj;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Qe.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,n){return t.fromObject({milliseconds:e},n)}static fromObject(e,n={}){if(e==null||typeof e!="object")throw new Dt(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Ol(e,t.normalizeUnit),loc:Qe.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(e){if(Xr(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Dt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,n){let[r]=SC(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,n){let[r]=DC(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,n=null){if(!e)throw new Dt("need to specify a reason the Duration is invalid");let r=e instanceof Wt?e:new Wt(e,n);if(Ge.throwOnInvalid)throw new _m(r);return new t({invalid:r})}static normalizeUnit(e){let n={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!n)throw new Cl(e);return n}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,n={}){let r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?Gt.create(this.loc,r).formatDurationFromString(this,e):_C}toHuman(e={}){if(!this.isValid)return _C;let n=ia.map(r=>{let i=this.values[r];return ye(i)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(i)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Fl(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let n=this.toMillis();return n<0||n>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},$e.fromMillis(n,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?FC(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e),r={};for(let i of ia)($s(n.values,i)||$s(this.values,i))&&(r[i]=n.get(i)+this.get(i));return js(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let n={};for(let r of Object.keys(this.values))n[r]=J0(e(this.values[r],r));return js(this,{values:n},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let n={...this.values,...Ol(e,t.normalizeUnit)};return js(this,{values:n})}reconfigure({locale:e,numberingSystem:n,conversionAccuracy:r,matrix:i}={}){let o={loc:this.loc.clone({locale:e,numberingSystem:n}),matrix:i,conversionAccuracy:r};return js(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return CC(this.matrix,e),js(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Gj(this.normalize().shiftToAll().toObject());return js(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>t.normalizeUnit(o));let n={},r={},i=this.toObject(),s;for(let o of ia)if(e.indexOf(o)>=0){s=o;let a=0;for(let c in r)a+=this.matrix[c][o]*r[c],r[c]=0;Xr(i[o])&&(a+=i[o]);let l=Math.trunc(a);n[o]=l,r[o]=(a*1e3-l*1e3)/1e3}else Xr(i[o])&&(r[o]=i[o]);for(let o in r)r[o]!==0&&(n[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return CC(this.matrix,n),js(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let n of Object.keys(this.values))e[n]=this.values[n]===0?0:-this.values[n];return js(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function n(r,i){return r===void 0||r===0?i===void 0||i===0:r===i}for(let r of ia)if(!n(this.values[r],e.values[r]))return!1;return!0}};m();var Bl="Invalid Interval";function Qj(t,e){return!t||!t.isValid?ns.invalid("missing or invalid start"):!e||!e.isValid?ns.invalid("missing or invalid end"):e<t?ns.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var ns=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,n=null){if(!e)throw new Dt("need to specify a reason the Interval is invalid");let r=e instanceof Wt?e:new Wt(e,n);if(Ge.throwOnInvalid)throw new Em(r);return new t({invalid:r})}static fromDateTimes(e,n){let r=$l(e),i=$l(n),s=Qj(r,i);return s??new t({start:r,end:i})}static after(e,n){let r=pt.fromDurationLike(n),i=$l(e);return t.fromDateTimes(i,i.plus(r))}static before(e,n){let r=pt.fromDurationLike(n),i=$l(e);return t.fromDateTimes(i.minus(r),i)}static fromISO(e,n){let[r,i]=(e||"").split("/",2);if(r&&i){let s,o;try{s=$e.fromISO(r,n),o=s.isValid}catch{o=!1}let a,l;try{a=$e.fromISO(i,n),l=a.isValid}catch{l=!1}if(o&&l)return t.fromDateTimes(s,a);if(o){let c=pt.fromISO(i,n);if(c.isValid)return t.after(s,c)}else if(l){let c=pt.fromISO(r,n);if(c.isValid)return t.before(a,c)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",n){if(!this.isValid)return NaN;let r=this.start.startOf(e,n),i;return n?.useLocaleWeeks?i=this.end.reconfigure({locale:r.locale}):i=this.end,i=i.startOf(e,n),Math.floor(i.diff(r,e).get(e))+(i.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:n}={}){return this.isValid?t.fromDateTimes(e||this.s,n||this.e):this}splitAt(...e){if(!this.isValid)return[];let n=e.map($l).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),r=[],{s:i}=this,s=0;for(;i<this.e;){let o=n[s]||this.e,a=+o>+this.e?this.e:o;r.push(t.fromDateTimes(i,a)),i=a,s+=1}return r}splitBy(e){let n=pt.fromDurationLike(e);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,i=1,s,o=[];for(;r<this.e;){let a=this.start.plus(n.mapUnits(l=>l*i));s=+a>+this.e?this.e:a,o.push(t.fromDateTimes(r,s)),r=s,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let n=this.s>e.s?this.s:e.s,r=this.e<e.e?this.e:e.e;return n>=r?null:t.fromDateTimes(n,r)}union(e){if(!this.isValid)return this;let n=this.s<e.s?this.s:e.s,r=this.e>e.e?this.e:e.e;return t.fromDateTimes(n,r)}static merge(e){let[n,r]=e.sort((i,s)=>i.s-s.s).reduce(([i,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[i,s.union(o)]:[i.concat([s]),o]:[i,o],[[],null]);return r&&n.push(r),n}static xor(e){let n=null,r=0,i=[],s=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((l,c)=>l.time-c.time);for(let l of a)r+=l.type==="s"?1:-1,r===1?n=l.time:(n&&+n!=+l.time&&i.push(t.fromDateTimes(n,l.time)),n=null);return t.merge(i)}difference(...e){return t.xor([this].concat(e)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Bl}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Rs,n={}){return this.isValid?Gt.create(this.s.loc.clone(n),e).formatInterval(this):Bl}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Bl}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Bl}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Bl}toFormat(e,{separator:n=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${n}${this.e.toFormat(e)}`:Bl}toDuration(e,n){return this.isValid?this.e.diff(this.s,e,n):pt.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};m();var rs=class{static hasDST(e=Ge.defaultZone){let n=$e.now().setZone(e).set({month:12});return!e.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(e){return an.isValidZone(e)}static normalizeZone(e){return Jr(e,Ge.defaultZone)}static getStartOfWeek({locale:e=null,locObj:n=null}={}){return(n||Qe.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:n=null}={}){return(n||Qe.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:n=null}={}){return(n||Qe.create(e)).getWeekendDays().slice()}static months(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Qe.create(n,r,s)).months(e)}static monthsFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Qe.create(n,r,s)).months(e,!0)}static weekdays(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||Qe.create(n,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:i=null}={}){return(i||Qe.create(n,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Qe.create(e).meridiems()}static eras(e="short",{locale:n=null}={}){return Qe.create(n,null,"gregory").eras(e)}static features(){return{relative:Im(),localeWeek:Am()}}};m();function IC(t,e){let n=i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(pt.fromMillis(r).as("days"))}function Kj(t,e,n){let r=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{let u=IC(l,c);return(u-u%7)/7}],["days",IC]],i={},s=t,o,a;for(let[l,c]of r)n.indexOf(l)>=0&&(o=l,i[l]=c(t,e),a=s.plus(i),a>e?(i[l]--,t=s.plus(i),t>e&&(a=t,i[l]--,t=s.plus(i))):t=a);return[t,i,a,o]}function AC(t,e,n,r){let[i,s,o,a]=Kj(t,e,n),l=e-i,c=n.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);c.length===0&&(o<e&&(o=i.plus({[a]:1})),o!==i&&(s[a]=(s[a]||0)+l/(o-i)));let u=pt.fromObject(s,r);return c.length>0?pt.fromMillis(l,r).shiftTo(...c).plus(u):u}m();var Zj="missing Intl.DateTimeFormat.formatToParts support";function Ye(t,e=n=>n){return{regex:t,deser:([n])=>e(j_(n))}}var Yj="\xA0",NC=`[ ${Yj}]`,MC=new RegExp(NC,"g");function Jj(t){return t.replace(/\./g,"\\.?").replace(MC,NC)}function OC(t){return t.replace(/\./g,"").replace(MC," ").toLowerCase()}function ei(t,e){return t===null?null:{regex:RegExp(t.map(Jj).join("|")),deser:([n])=>t.findIndex(r=>OC(n)===OC(r))+e}}function PC(t,e){return{regex:t,deser:([,n,r])=>ta(n,r),groups:e}}function Mm(t){return{regex:t,deser:([e])=>e}}function Xj(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function eq(t,e){let n=Cr(e),r=Cr(e,"{2}"),i=Cr(e,"{3}"),s=Cr(e,"{4}"),o=Cr(e,"{6}"),a=Cr(e,"{1,2}"),l=Cr(e,"{1,3}"),c=Cr(e,"{1,6}"),u=Cr(e,"{1,9}"),f=Cr(e,"{2,4}"),h=Cr(e,"{4,6}"),d=y=>({regex:RegExp(Xj(y.val)),deser:([w])=>w,literal:!0}),g=(y=>{if(t.literal)return d(y);switch(y.val){case"G":return ei(e.eras("short"),0);case"GG":return ei(e.eras("long"),0);case"y":return Ye(c);case"yy":return Ye(f,uf);case"yyyy":return Ye(s);case"yyyyy":return Ye(h);case"yyyyyy":return Ye(o);case"M":return Ye(a);case"MM":return Ye(r);case"MMM":return ei(e.months("short",!0),1);case"MMMM":return ei(e.months("long",!0),1);case"L":return Ye(a);case"LL":return Ye(r);case"LLL":return ei(e.months("short",!1),1);case"LLLL":return ei(e.months("long",!1),1);case"d":return Ye(a);case"dd":return Ye(r);case"o":return Ye(l);case"ooo":return Ye(i);case"HH":return Ye(r);case"H":return Ye(a);case"hh":return Ye(r);case"h":return Ye(a);case"mm":return Ye(r);case"m":return Ye(a);case"q":return Ye(a);case"qq":return Ye(r);case"s":return Ye(a);case"ss":return Ye(r);case"S":return Ye(l);case"SSS":return Ye(i);case"u":return Mm(u);case"uu":return Mm(a);case"uuu":return Ye(n);case"a":return ei(e.meridiems(),0);case"kkkk":return Ye(s);case"kk":return Ye(f,uf);case"W":return Ye(a);case"WW":return Ye(r);case"E":case"c":return Ye(n);case"EEE":return ei(e.weekdays("short",!1),1);case"EEEE":return ei(e.weekdays("long",!1),1);case"ccc":return ei(e.weekdays("short",!0),1);case"cccc":return ei(e.weekdays("long",!0),1);case"Z":case"ZZ":return PC(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return PC(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return Mm(/[a-z_+-/]{1,256}?/i);case" ":return Mm(/[^\S\n\r]/);default:return d(y)}})(t)||{invalidReason:Zj};return g.token=t,g}var tq={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function nq(t,e,n){let{type:r,value:i}=t;if(r==="literal"){let l=/^\s+$/.test(i);return{literal:!l,val:l?" ":i}}let s=e[r],o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=n.hour12?"hour12":"hour24");let a=tq[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function rq(t){return[`^${t.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,t]}function iq(t,e,n){let r=t.match(e);if(r){let i={},s=1;for(let o in n)if($s(n,o)){let a=n[o],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(s,s+l))),s+=l}return[r,i]}else return[r,{}]}function sq(t){let e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},n=null,r;return ye(t.z)||(n=an.create(t.z)),ye(t.Z)||(n||(n=new Ht(t.Z)),r=t.Z),ye(t.q)||(t.M=(t.q-1)*3+1),ye(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),ye(t.u)||(t.S=cf(t.u)),[Object.keys(t).reduce((s,o)=>{let a=e(o);return a&&(s[a]=t[o]),s},{}),n,r]}var sb=null;function oq(){return sb||(sb=$e.fromMillis(1555555555555)),sb}function aq(t,e){if(t.literal)return t;let n=Gt.macroTokenToFormatOpts(t.val),r=lb(n,e);return r==null||r.includes(void 0)?t:r}function ob(t,e){return Array.prototype.concat(...t.map(n=>aq(n,e)))}var df=class{constructor(e,n){if(this.locale=e,this.format=n,this.tokens=ob(Gt.parseFormat(n),e),this.units=this.tokens.map(r=>eq(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){let[r,i]=rq(this.units);this.regex=RegExp(r,"i"),this.handlers=i}}explainFromTokens(e){if(this.isValid){let[n,r]=iq(e,this.regex,this.handlers),[i,s,o]=r?sq(r):[null,null,void 0];if($s(r,"a")&&$s(r,"H"))throw new Kr("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:n,matches:r,result:i,zone:s,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function ab(t,e,n){return new df(t,n).explainFromTokens(e)}function RC(t,e,n){let{result:r,zone:i,specificOffset:s,invalidReason:o}=ab(t,e,n);return[r,i,s,o]}function lb(t,e){if(!t)return null;let r=Gt.create(e,t).dtFormatter(oq()),i=r.formatToParts(),s=r.resolvedOptions();return i.map(o=>nq(o,t,s))}var cb="Invalid DateTime",zC=864e13;function mf(t){return new Wt("unsupported zone",`the zone "${t.name}" is not supported`)}function ub(t){return t.weekData===null&&(t.weekData=of(t.c)),t.weekData}function fb(t){return t.localWeekData===null&&(t.localWeekData=of(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function sa(t,e){let n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new $e({...n,...e,old:n})}function VC(t,e,n){let r=t-e*60*1e3,i=n.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;let s=n.offset(r);return i===s?[r,i]:[t-Math.min(i,s)*60*1e3,Math.max(i,s)]}function Rm(t,e){t+=e*60*1e3;let n=new Date(t);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Lm(t,e,n){return VC(Tl(t),e,n)}function LC(t,e){let n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...t.c,year:r,month:i,day:Math.min(t.c.day,Al(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=pt.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Tl(s),[l,c]=VC(a,n,t.zone);return o!==0&&(l+=o,c=t.zone.offset(l)),{ts:l,o:c}}function Ul(t,e,n,r,i,s){let{setZone:o,zone:a}=n;if(t&&Object.keys(t).length!==0||e){let l=e||a,c=$e.fromObject(t,{...n,zone:l,specificOffset:s});return o?c:c.setZone(a)}else return $e.invalid(new Wt("unparsable",`the input "${i}" can't be parsed as ${r}`))}function zm(t,e,n=!0){return t.isValid?Gt.create(Qe.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function hb(t,e){let n=t.c.year>9999||t.c.year<0,r="";return n&&t.c.year>=0&&(r+="+"),r+=mt(t.c.year,n?6:4),e?(r+="-",r+=mt(t.c.month),r+="-",r+=mt(t.c.day)):(r+=mt(t.c.month),r+=mt(t.c.day)),r}function BC(t,e,n,r,i,s){let o=mt(t.c.hour);return e?(o+=":",o+=mt(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=":")):o+=mt(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(o+=mt(t.c.second),(t.c.millisecond!==0||!r)&&(o+=".",o+=mt(t.c.millisecond,3))),i&&(t.isOffsetFixed&&t.offset===0&&!s?o+="Z":t.o<0?(o+="-",o+=mt(Math.trunc(-t.o/60)),o+=":",o+=mt(Math.trunc(-t.o%60))):(o+="+",o+=mt(Math.trunc(t.o/60)),o+=":",o+=mt(Math.trunc(t.o%60)))),s&&(o+="["+t.zone.ianaName+"]"),o}var HC={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},lq={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},cq={ordinal:1,hour:0,minute:0,second:0,millisecond:0},WC=["year","month","day","hour","minute","second","millisecond"],uq=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],fq=["year","ordinal","hour","minute","second","millisecond"];function hq(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new Cl(t);return e}function $C(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return hq(t)}}function dq(t){if(pf===void 0&&(pf=Ge.now()),t.type!=="iana")return t.offset(pf);let e=t.name,n=db.get(e);return n===void 0&&(n=t.offset(pf),db.set(e,n)),n}function UC(t,e){let n=Jr(e.zone,Ge.defaultZone);if(!n.isValid)return $e.invalid(mf(n));let r=Qe.fromObject(e),i,s;if(ye(t.year))i=Ge.now();else{for(let l of WC)ye(t[l])&&(t[l]=HC[l]);let o=K0(t)||Z0(t);if(o)return $e.invalid(o);let a=dq(n);[i,s]=Lm(t,a,n)}return new $e({ts:i,zone:n,loc:r,o:s})}function jC(t,e,n){let r=ye(n.round)?!0:n.round,i=(o,a)=>(o=Fl(o,r||n.calendary?0:2,!0),e.loc.clone(n).relFormatter(n).format(o,a)),s=o=>n.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(n.unit)return i(s(n.unit),n.unit);for(let o of n.units){let a=s(o);if(Math.abs(a)>=1)return i(a,o)}return i(t>e?-0:0,n.units[n.units.length-1])}function qC(t){let e={},n;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],n=Array.from(t).slice(0,t.length-1)):n=Array.from(t),[e,n]}var pf,db=new Map,$e=class t{constructor(e){let n=e.zone||Ge.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new Wt("invalid input"):null)||(n.isValid?null:mf(n));this.ts=ye(e.ts)?Ge.now():e.ts;let i=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(n))[i,s]=[e.old.c,e.old.o];else{let a=Xr(e.o)&&!e.old?e.o:n.offset(this.ts);i=Rm(this.ts,a),r=Number.isNaN(i.year)?new Wt("invalid input"):null,i=r?null:i,s=r?null:a}this._zone=n,this.loc=e.loc||Qe.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,n]=qC(arguments),[r,i,s,o,a,l,c]=n;return UC({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:c},e)}static utc(){let[e,n]=qC(arguments),[r,i,s,o,a,l,c]=n;return e.zone=Ht.utcInstance,UC({year:r,month:i,day:s,hour:o,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,n={}){let r=sC(e)?e.valueOf():NaN;if(Number.isNaN(r))return t.invalid("invalid input");let i=Jr(n.zone,Ge.defaultZone);return i.isValid?new t({ts:r,zone:i,loc:Qe.fromObject(n)}):t.invalid(mf(i))}static fromMillis(e,n={}){if(Xr(e))return e<-zC||e>zC?t.invalid("Timestamp out of range"):new t({ts:e,zone:Jr(n.zone,Ge.defaultZone),loc:Qe.fromObject(n)});throw new Dt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,n={}){if(Xr(e))return new t({ts:e*1e3,zone:Jr(n.zone,Ge.defaultZone),loc:Qe.fromObject(n)});throw new Dt("fromSeconds requires a numerical input")}static fromObject(e,n={}){e=e||{};let r=Jr(n.zone,Ge.defaultZone);if(!r.isValid)return t.invalid(mf(r));let i=Qe.fromObject(n),s=Ol(e,$C),{minDaysInFirstWeek:o,startOfWeek:a}=Q0(s,i),l=Ge.now(),c=ye(n.specificOffset)?r.offset(l):n.specificOffset,u=!ye(s.ordinal),f=!ye(s.year),h=!ye(s.month)||!ye(s.day),d=f||h,p=s.weekYear||s.weekNumber;if((d||u)&&p)throw new Kr("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(h&&u)throw new Kr("Can't mix ordinal dates with month/day");let g=p||s.weekday&&!d,y,w,b=Rm(l,c);g?(y=uq,w=lq,b=of(b,o,a)):u?(y=fq,w=cq,b=Nm(b)):(y=WC,w=HC);let S=!1;for(let A of y){let P=s[A];ye(P)?S?s[A]=w[A]:s[A]=b[A]:S=!0}let D=g?nC(s,o,a):u?rC(s):K0(s),k=D||Z0(s);if(k)return t.invalid(k);let E=g?W0(s,o,a):u?G0(s):s,[v,_]=Lm(E,c,r),C=new t({ts:v,zone:r,o:_,loc:i});return s.weekday&&d&&e.weekday!==C.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${C.toISO()}`):C.isValid?C:t.invalid(C.invalid)}static fromISO(e,n={}){let[r,i]=vC(e);return Ul(r,i,n,"ISO 8601",e)}static fromRFC2822(e,n={}){let[r,i]=kC(e);return Ul(r,i,n,"RFC 2822",e)}static fromHTTP(e,n={}){let[r,i]=xC(e);return Ul(r,i,n,"HTTP",n)}static fromFormat(e,n,r={}){if(ye(e)||ye(n))throw new Dt("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:s=null}=r,o=Qe.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[a,l,c,u]=RC(o,e,n);return u?t.invalid(u):Ul(a,l,r,`format ${n}`,e,c)}static fromString(e,n,r={}){return t.fromFormat(e,n,r)}static fromSQL(e,n={}){let[r,i]=EC(e);return Ul(r,i,n,"SQL",e)}static invalid(e,n=null){if(!e)throw new Dt("need to specify a reason the DateTime is invalid");let r=e instanceof Wt?e:new Wt(e,n);if(Ge.throwOnInvalid)throw new Dm(r);return new t({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,n={}){let r=lb(e,Qe.fromObject(n));return r?r.map(i=>i?i.val:null).join(""):null}static expandFormat(e,n={}){return ob(Gt.parseFormat(e),Qe.fromObject(n)).map(i=>i.val).join("")}static resetCache(){pf=void 0,db.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?ub(this).weekYear:NaN}get weekNumber(){return this.isValid?ub(this).weekNumber:NaN}get weekday(){return this.isValid?ub(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?fb(this).weekday:NaN}get localWeekNumber(){return this.isValid?fb(this).weekNumber:NaN}get localWeekYear(){return this.isValid?fb(this).weekYear:NaN}get ordinal(){return this.isValid?Nm(this.c).ordinal:NaN}get monthShort(){return this.isValid?rs.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?rs.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?rs.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?rs.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,n=6e4,r=Tl(this.c),i=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-i*n),a=this.zone.offset(r-s*n);if(o===a)return[this];let l=r-o*n,c=r-a*n,u=Rm(l,o),f=Rm(c,a);return u.hour===f.hour&&u.minute===f.minute&&u.second===f.second&&u.millisecond===f.millisecond?[sa(this,{ts:l}),sa(this,{ts:c})]:[this]}get isInLeapYear(){return ra(this.year)}get daysInMonth(){return Al(this.year,this.month)}get daysInYear(){return this.isValid?Bs(this.year):NaN}get weeksInWeekYear(){return this.isValid?na(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?na(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:n,numberingSystem:r,calendar:i}=Gt.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:i}}toUTC(e=0,n={}){return this.setZone(Ht.instance(e),n)}toLocal(){return this.setZone(Ge.defaultZone)}setZone(e,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(e=Jr(e,Ge.defaultZone),e.equals(this.zone))return this;if(e.isValid){let i=this.ts;if(n||r){let s=e.offset(this.ts),o=this.toObject();[i]=Lm(o,s,e)}return sa(this,{ts:i,zone:e})}else return t.invalid(mf(e))}reconfigure({locale:e,numberingSystem:n,outputCalendar:r}={}){let i=this.loc.clone({locale:e,numberingSystem:n,outputCalendar:r});return sa(this,{loc:i})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let n=Ol(e,$C),{minDaysInFirstWeek:r,startOfWeek:i}=Q0(n,this.loc),s=!ye(n.weekYear)||!ye(n.weekNumber)||!ye(n.weekday),o=!ye(n.ordinal),a=!ye(n.year),l=!ye(n.month)||!ye(n.day),c=a||l,u=n.weekYear||n.weekNumber;if((c||o)&&u)throw new Kr("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new Kr("Can't mix ordinal dates with month/day");let f;s?f=W0({...of(this.c,r,i),...n},r,i):ye(n.ordinal)?(f={...this.toObject(),...n},ye(n.day)&&(f.day=Math.min(Al(f.year,f.month),f.day))):f=G0({...Nm(this.c),...n});let[h,d]=Lm(f,this.o,this.zone);return sa(this,{ts:h,o:d})}plus(e){if(!this.isValid)return this;let n=pt.fromDurationLike(e);return sa(this,LC(this,n))}minus(e){if(!this.isValid)return this;let n=pt.fromDurationLike(e).negate();return sa(this,LC(this,n))}startOf(e,{useLocaleWeeks:n=!1}={}){if(!this.isValid)return this;let r={},i=pt.normalizeUnit(e);switch(i){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break;case"milliseconds":break}if(i==="weeks")if(n){let s=this.loc.getStartOfWeek(),{weekday:o}=this;o<s&&(r.weekNumber=this.weekNumber-1),r.weekday=s}else r.weekday=1;if(i==="quarters"){let s=Math.ceil(this.month/3);r.month=(s-1)*3+1}return this.set(r)}endOf(e,n){return this.isValid?this.plus({[e]:1}).startOf(e,n).minus(1):this}toFormat(e,n={}){return this.isValid?Gt.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this,e):cb}toLocaleString(e=Rs,n={}){return this.isValid?Gt.create(this.loc.clone(n),e).formatDateTime(this):cb}toLocaleParts(e={}){return this.isValid?Gt.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:n=!1,suppressMilliseconds:r=!1,includeOffset:i=!0,extendedZone:s=!1}={}){if(!this.isValid)return null;let o=e==="extended",a=hb(this,o);return a+="T",a+=BC(this,o,n,r,i,s),a}toISODate({format:e="extended"}={}){return this.isValid?hb(this,e==="extended"):null}toISOWeekDate(){return zm(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:n=!1,includeOffset:r=!0,includePrefix:i=!1,extendedZone:s=!1,format:o="extended"}={}){return this.isValid?(i?"T":"")+BC(this,o==="extended",n,e,r,s):null}toRFC2822(){return zm(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return zm(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?hb(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:n=!1,includeOffsetSpace:r=!0}={}){let i="HH:mm:ss.SSS";return(n||e)&&(r&&(i+=" "),n?i+="z":e&&(i+="ZZ")),zm(this,i,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():cb}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let n={...this.c};return e.includeConfig&&(n.outputCalendar=this.outputCalendar,n.numberingSystem=this.loc.numberingSystem,n.locale=this.loc.locale),n}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,n="milliseconds",r={}){if(!this.isValid||!e.isValid)return pt.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...r},s=oC(n).map(pt.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,l=o?e:this,c=AC(a,l,s,i);return o?c.negate():c}diffNow(e="milliseconds",n={}){return this.diff(t.now(),e,n)}until(e){return this.isValid?ns.fromDateTimes(this,e):this}hasSame(e,n,r){if(!this.isValid)return!1;let i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(n,r)<=i&&i<=s.endOf(n,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let n=e.base||t.fromObject({},{zone:this.zone}),r=e.padding?this<n?-e.padding:e.padding:0,i=["years","months","days","hours","minutes","seconds"],s=e.unit;return Array.isArray(e.unit)&&(i=e.unit,s=void 0),jC(n,this.plus(r),{...e,numeric:"always",units:i,unit:s})}toRelativeCalendar(e={}){return this.isValid?jC(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Dt("min requires all arguments be DateTimes");return Y0(e,n=>n.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Dt("max requires all arguments be DateTimes");return Y0(e,n=>n.valueOf(),Math.max)}static fromFormatExplain(e,n,r={}){let{locale:i=null,numberingSystem:s=null}=r,o=Qe.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return ab(o,e,n)}static fromStringExplain(e,n,r={}){return t.fromFormatExplain(e,n,r)}static buildFormatParser(e,n={}){let{locale:r=null,numberingSystem:i=null}=n,s=Qe.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return new df(s,e)}static fromFormatParser(e,n,r={}){if(ye(e)||ye(n))throw new Dt("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:s=null}=r,o=Qe.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!o.equals(n.locale))throw new Dt(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:a,zone:l,specificOffset:c,invalidReason:u}=n.explainFromTokens(e);return u?t.invalid(u):Ul(a,l,r,`format ${n.format}`,e,c)}static get DATE_SHORT(){return Rs}static get DATE_MED(){return Lu}static get DATE_MED_WITH_WEEKDAY(){return D0}static get DATE_FULL(){return Bu}static get DATE_HUGE(){return $u}static get TIME_SIMPLE(){return Uu}static get TIME_WITH_SECONDS(){return ju}static get TIME_WITH_SHORT_OFFSET(){return qu}static get TIME_WITH_LONG_OFFSET(){return Vu}static get TIME_24_SIMPLE(){return Hu}static get TIME_24_WITH_SECONDS(){return Wu}static get TIME_24_WITH_SHORT_OFFSET(){return Gu}static get TIME_24_WITH_LONG_OFFSET(){return Qu}static get DATETIME_SHORT(){return Ku}static get DATETIME_SHORT_WITH_SECONDS(){return Zu}static get DATETIME_MED(){return Yu}static get DATETIME_MED_WITH_SECONDS(){return Ju}static get DATETIME_MED_WITH_WEEKDAY(){return E0}static get DATETIME_FULL(){return Xu}static get DATETIME_FULL_WITH_SECONDS(){return ef}static get DATETIME_HUGE(){return tf}static get DATETIME_HUGE_WITH_SECONDS(){return nf}};function $l(t){if($e.isDateTime(t))return t;if(t&&t.valueOf&&Xr(t.valueOf()))return $e.fromJSDate(t);if(t&&typeof t=="object")return $e.fromObject(t);throw new Dt(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var Bm=class{file;frontmatter;settings;constructor(e,n,r){this.file=e,this.frontmatter=n,this.settings=r}getCreatedAt(){let e=this.settings.createdTimestampKey.split(",");for(let n of e){let r=this.frontmatter[n.trim()];if(r)return r}return $e.fromMillis(this.file.stat.ctime).toISO()}getUpdatedAt(){let e=this.settings.updatedTimestampKey.split(",");for(let n of e){let r=this.frontmatter[n.trim()];if(r)return r}return $e.fromMillis(this.file.stat.mtime).toISO()}getPublishedAt(){let e=this.settings.publishedTimestampKey.split(",");for(let n of e){let r=this.frontmatter[n.trim()];if(r)return r}return $e.fromMillis(this.file.stat.mtime).toISO()}};m();var GC=it(w0());function QC(t){if(/```dataview\s/ms.test(t)||/```datacorejs\s/ms.test(t)||/```datacorejsx\s/ms.test(t)||/```datacorets\s/ms.test(t)||/```datacoretsx\s/ms.test(t))return!0;let e=(0,GC.getAPI)();if(e){let n=e.settings.dataviewJsKeyword;if(new RegExp("```"+jr(n)+"\\s","ms").test(t))return!0;let i=e.settings.inlineQueryPrefix;if(new RegExp("`"+jr(i)+".+?`","ms").test(t))return!0;let o=e.settings.inlineJsQueryPrefix;if(new RegExp("`"+jr(o)+".+?`","ms").test(t))return!0}return!1}var oa=class{file;compiler;vault;compiledFile;metadataCache;frontmatter;settings;meta;datastore;constructor({file:e,compiler:n,metadataCache:r,vault:i,settings:s,datastore:o}){this.compiler=n,this.metadataCache=r,this.file=e,this.settings=s,this.vault=i,this.frontmatter=this.getFrontmatter(),this.datastore=o,this.meta=new Bm(e,this.frontmatter,s)}async compile(){let e;if(this.settings.useCache){let n=await this.datastore.loadLocalFile(this.file.path),r=n?await this.datastore.isLocalFileOutdated(this.file.path,this.file.stat.mtime):!0,i=null;if(n&&!r)i=n;else{let s=await this.vault.cachedRead(this.file),o=QC(s);if(i=await this.compiler.generateMarkdown(this),!i)throw new Error(`Failed to compile file: ${this.file.path}. Compiler returned null.`);let a=await nl(i[0]);await this.datastore.storeLocalFile(this.file.path,this.file.stat.mtime,i,o),await this.datastore.storeLocalHash(this.file.path,this.file.stat.mtime,a)}e=i}else e=await this.compiler.generateMarkdown(this);return new mb({file:this.file,compiler:this.compiler,metadataCache:this.metadataCache,vault:this.vault,settings:this.settings,datastore:this.datastore},e)}getType(){return this.file.name.endsWith(".excalidraw")||this.file.name.endsWith(".excalidraw.md")?"excalidraw":this.file.extension==="base"?"base":this.file.extension==="canvas"?"canvas":"markdown"}shouldPublish(){return this.file.extension==="base"?this.settings.useBases:this.file.extension==="canvas"?this.settings.useCanvas:this.file.name.endsWith(".excalidraw")||this.file.name.endsWith(".excalidraw.md")?this.settings.useExcalidraw:tl(this.settings.publishFrontmatterKey,this.frontmatter,this.settings.allNotesPublishableByDefault)}async getBlobLinks(){return this.compiler.extractBlobLinks(this)}async cachedRead(){return this.vault.cachedRead(this.file)}getMetadata(){return this.metadataCache.getCache(this.file.path)??{}}getBlock(e){return this.getMetadata().blocks?.[e]}getFrontmatter(){return this.metadataCache.getCache(this.file.path)?.frontmatter??{}}compare(e){return this.file.path.localeCompare(e.file.path)}getPath=()=>this.file.path;getVaultPath=()=>this.settings.vaultPath!=="/"&&this.file.path.startsWith(this.settings.vaultPath)?this.file.path.replace(this.settings.vaultPath,""):this.file.path;getCompiledFrontmatter(e){let n=!!this.settings.useDataview,r=new Sm(this.settings),i=this.metadataCache.getCache(this.file.path)?.frontmatter??{};if(n){let s=e.matchAll(Kx),o=e.matchAll(Zx);for(let a of s)a[1]&&a[2]&&(i[a[1]]=a[2]);for(let a of o)a[1]&&a[2]?i[a[1]]=a[2]:a[3]&&a[4]&&(i[a[3]]=a[4])}return r.compile(this,i)}},mb=class extends oa{compiledFile;remoteHash;constructor(e,n){super(e),this.compiledFile=n}getCompiledFile(){return this.compiledFile}setRemoteHash(e){this.remoteHash=e}};m();var le=it(UP()),SN=it(xN()),uh=require("obsidian"),DN=it(vt()),ot=DN.default.get("repository-connection");async function f7(t){if(!t)return;let e=[];for await(let s of t)e.push(s);let n=e.reduce((s,o)=>s+o.length,0),r=new Uint8Array(n),i=0;for(let s of e)r.set(s,i),i+=s.length;return r}var ch={async request(t){let{url:e,method:n="GET",headers:r={},body:i}=t;try{let s=await f7(i),o=await(0,uh.requestUrl)({url:e,method:n,headers:r,body:s?s.buffer:void 0,throw:!1}),a={};if(o.headers)for(let[u,f]of Object.entries(o.headers))a[u.toLowerCase()]=f;let l=new Uint8Array(o.arrayBuffer);async function*c(){yield l}return{url:e,method:n,headers:a,body:c(),statusCode:o.status,statusMessage:o.status>=200&&o.status<300?"OK":"Error"}}catch(s){throw ot.error("HTTP request failed",s),s}}},rt=class{remoteUrl;branch;corsProxyUrl;auth;fs=null;dir;contentFolder;vaultPath;initialized=!1;constructor({gitSettings:e,contentFolder:n,vaultPath:r}){this.remoteUrl=e.remoteUrl,this.branch=e.branch||"main",this.corsProxyUrl=e.corsProxyUrl||void 0,this.auth=e.auth,this.contentFolder=n,this.vaultPath=r,this.dir="/repo"}getFs(){if(!this.fs)try{let e=this.getFsName();this.fs=new SN.default(e)}catch(e){throw ot.error("Failed to initialize LightningFS",e),new Error("Failed to initialize filesystem. IndexedDB may not be available on this platform.")}return this.fs}getFsName(){return`quartz-syncer-${this.hashString(this.remoteUrl+this.branch)}`}hashString(e){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);n=(n<<5)-n+i,n=n&n}return Math.abs(n).toString(36)}getOnAuth(){return()=>{if(this.auth.type!=="none")return this.auth.type==="bearer"?{username:"x-access-token",password:this.auth.secret||""}:{username:this.auth.username||"",password:this.auth.secret||""}}}async pushWithRetry(e=3){for(let n=0;n<=e;n++)try{await le.default.push({...this.getGitConfig(),url:this.remoteUrl,remote:"origin",ref:this.branch});return}catch(r){if(!(r instanceof Error&&(r.message.includes("401")||r.message.includes("403")||r.message.includes("429")||r.message.includes("5")))||n===e)throw r;let s=Math.pow(2,n)*1e3;ot.warn(`Push attempt ${n+1} failed, retrying in ${s}ms...`,r),await new Promise(o=>window.setTimeout(o,s))}}getGitConfig(){let e={fs:this.getFs(),http:ch,dir:this.dir};return this.corsProxyUrl&&(e.corsProxy=this.corsProxyUrl),this.auth.type!=="none"&&(e.onAuth=this.getOnAuth()),e}getRepositoryName(){try{return new URL(this.remoteUrl).pathname.replace(/^\//,"").replace(/\.git$/,"")}catch{return this.remoteUrl}}getRepositoryPath(e){let n=e.startsWith(this.contentFolder)?e.replace(this.contentFolder,""):e;return n.startsWith("/")?n.slice(1):n}getVaultPath(e){e=(0,uh.normalizePath)(e);let n=e.startsWith(this.vaultPath)?e.replace(this.vaultPath,""):e;return n.startsWith("/")?n.slice(1):n}setRepositoryPath(e){e=(0,uh.normalizePath)(e);let n=e.startsWith(this.contentFolder)?e:`${this.contentFolder}/${e}`;return n.startsWith("/")?n.slice(1):n}setVaultPath(e){let n=e.startsWith("/")?"":"/",r=e.startsWith(this.vaultPath)?e:`${this.vaultPath}${n}${e}`;return r.startsWith("/")?r.slice(1):r}repositoryToVaultPath(e){return this.setVaultPath(this.getRepositoryPath(e))}repositoryToRepositoryPath(e){return this.setRepositoryPath(this.getVaultPath(e))}async checkExistingRepo(){try{return await this.getFs().promises.stat(this.dir),(await le.default.listRemotes({...this.getGitConfig()})).length>0}catch{return!1}}async createDirIfNotExists(e){try{await this.getFs().promises.mkdir(e)}catch{ot.debug(`Directory ${e} already exists`)}}async ensureRepoInitialized(){if(this.initialized)return;if(await this.checkExistingRepo()){this.initialized=!0;return}ot.info(`Cloning repository ${this.getRepositoryName()}`),await this.createDirIfNotExists(this.dir);try{await le.default.clone({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0,depth:1,noCheckout:!1}),this.initialized=!0}catch(n){throw ot.error("Failed to clone repository",n),new Error(`Could not clone repository ${this.getRepositoryName()}: ${String(n)}`)}}async getContent(e){try{await this.ensureRepoInitialized(),await le.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let n=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{commit:r}=await le.default.readCommit({...this.getGitConfig(),oid:n}),i=[],s=async(o,a="")=>{let{tree:l}=await le.default.readTree({...this.getGitConfig(),oid:o});for(let c of l){let u=a?`${a}/${c.path}`:c.path;i.push({path:u,oid:c.oid,type:c.type}),c.type==="tree"&&await s(c.oid,u)}};return await s(r.tree),{tree:i,sha:n,truncated:!1}}catch(n){throw ot.error("Could not get repository content",n),new Error(`Could not get files from repository ${this.getRepositoryName()}`)}}async getAllBlobContents(e){try{await this.ensureRepoInitialized();let n=`origin/${this.branch}`,r=new Map;return await le.default.walk({...this.getGitConfig(),trees:[le.default.TREE({ref:n})],map:async(i,[s])=>{if(!s||i===".")return;let o=await s.type();if(o==="tree")return e&&!e.startsWith(i)&&!i.startsWith(e)?void 0:i;if(o!=="blob"||e&&!i.startsWith(e))return;let a=await s.content();if(a){let l=new TextDecoder().decode(a);r.set(i,l)}return i}}),r}catch(n){throw ot.error("Could not bulk-read blob contents",n),new Error(`Could not bulk-read blob contents from repository ${this.getRepositoryName()}`)}}async getFile(e,n){e=this.setRepositoryPath(this.getVaultPath(this.getRepositoryPath(e))),ot.info(`Getting file ${e} from repository ${this.getRepositoryName()}`);try{await this.ensureRepoInitialized();let r=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{blob:i,oid:s}=await le.default.readBlob({...this.getGitConfig(),oid:r,filepath:e});return{content:x.from(i).toString("base64"),sha:s,path:e,type:"file"}}catch(r){throw ot.error(`Could not get file ${e}`,r),new Error(`Could not get file ${e} from repository ${this.getRepositoryName()}`)}}async getRawFile(e){ot.info(`Getting raw file ${e} from repository ${this.getRepositoryName()}`);try{await this.ensureRepoInitialized();let n=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{blob:r,oid:i}=await le.default.readBlob({...this.getGitConfig(),oid:n,filepath:e});return{content:x.from(r).toString("base64"),sha:i,path:e,type:"file"}}catch(n){throw ot.error(`Could not get raw file ${e}`,n),new Error(`Could not get file ${e} from repository ${this.getRepositoryName()}`)}}async listDirectory(e){try{await this.ensureRepoInitialized();let n=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{commit:r}=await le.default.readCommit({...this.getGitConfig(),oid:n}),i=r.tree,s=e.split("/").filter(a=>a.length>0);for(let a of s){let{tree:l}=await le.default.readTree({...this.getGitConfig(),oid:i}),c=l.find(u=>u.path===a&&u.type==="tree");if(!c)return[];i=c.oid}let{tree:o}=await le.default.readTree({...this.getGitConfig(),oid:i});return o.map(a=>({name:a.path,type:a.type}))}catch(n){return ot.debug(`Could not list directory ${e}`,n),[]}}async getLatestCommit(){try{await this.ensureRepoInitialized(),await le.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0,depth:1});let e=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`}),{commit:n}=await le.default.readCommit({...this.getGitConfig(),oid:e});return{sha:e,commit:{tree:{sha:n.tree}}}}catch(e){ot.error("Could not get latest commit",e);return}}async hasCommitInHistory(e,n=100){try{return await this.ensureRepoInitialized(),await le.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0,depth:n}),(await le.default.log({...this.getGitConfig(),ref:`origin/${this.branch}`,depth:n})).some(i=>i.oid===e)}catch{return!1}}async upgradeFromUpstream(e,n){await this.ensureRepoInitialized(),await le.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let r=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await le.default.checkout({...this.getGitConfig(),ref:r,force:!0}),await le.default.branch({...this.getGitConfig(),ref:this.branch,object:r,force:!0}),await le.default.checkout({...this.getGitConfig(),ref:this.branch});let i="upstream";(await le.default.listRemotes({...this.getGitConfig()})).some(f=>f.remote===i)&&await le.default.deleteRemote({...this.getGitConfig(),remote:i}),await le.default.addRemote({...this.getGitConfig(),remote:i,url:e}),await le.default.fetch({...this.getGitConfig(),url:e,remote:i,ref:n,singleBranch:!0});let o=`remotes/${i}/${n}`,a="quartz.lock.json",l={name:"Quartz Syncer",email:"268450573+quartz-syncer-publisher[bot]@users.noreply.github.com"},c=null;try{let{blob:f}=await le.default.readBlob({...this.getGitConfig(),oid:r,filepath:a});c=f}catch{ot.debug("No quartz.lock.json found, skipping backup")}let u;try{u=await le.default.merge({...this.getGitConfig(),ours:this.branch,theirs:o,abortOnConflict:!0,author:l})}catch(f){let h=this.extractConflictFiles(f);if(!h)throw f;if(h.filter(b=>b!==a).length>0)throw new Error(`Merge conflicts in: ${h.join(", ")}`);if(!c)throw new Error(`Merge conflicts in: ${h.join(", ")}`);ot.info("Only quartz.lock.json conflicts, auto-resolving");try{await le.default.merge({...this.getGitConfig(),ours:this.branch,theirs:o,abortOnConflict:!1,author:l})}catch(b){let S=this.extractConflictFiles(b);if(!S)throw b;if(S.filter(k=>k!==a).length>0)throw new Error(`Merge conflicts in: ${S.join(", ")}`)}let p=`${this.dir}/${a}`;await this.getFs().promises.writeFile(p,c),await le.default.add({...this.getGitConfig(),filepath:a});let g=await le.default.resolveRef({...this.getGitConfig(),ref:this.branch}),y=await le.default.resolveRef({...this.getGitConfig(),ref:o});u={oid:await le.default.commit({...this.getGitConfig(),message:`Merge upstream/${n} (auto-resolved quartz.lock.json)`,author:l,parent:[g,y]}),alreadyMerged:!1}}return u.alreadyMerged?{oid:u.oid??r,alreadyMerged:!0}:(await le.default.checkout({...this.getGitConfig(),ref:this.branch}),await this.pushWithRetry(),{oid:u.oid,alreadyMerged:!1})}extractConflictFiles(e){return e&&typeof e=="object"&&"data"in e&&e.data&&typeof e.data=="object"&&"filepaths"in e.data&&Array.isArray(e.data.filepaths)?e.data.filepaths:null}async deleteFiles(e,n){if(e.length!==0)try{await this.ensureRepoInitialized(),await le.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let r=o=>{let a;do a=o,o=o.replace(/\.\.\//g,"");while(o!==a);return o=this.getVaultPath(o),o.startsWith("/")?`${this.contentFolder}${o}`:`${this.contentFolder}/${o}`},i=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await le.default.checkout({...this.getGitConfig(),ref:i,force:!0}),await le.default.branch({...this.getGitConfig(),ref:this.branch,object:i,force:!0}),await le.default.checkout({...this.getGitConfig(),ref:this.branch});let s={};for(let o=0;o<e.length;o++){let a=r(e[o]),l=`${this.dir}/${a}`;try{await this.getFs().promises.unlink(l),await le.default.remove({...this.getGitConfig(),filepath:a,cache:s})}catch(c){ot.warn(`Could not delete file ${a}`,c)}n&&await n(o+1,e.length),o%50===49&&await new Promise(c=>window.setTimeout(c,0))}await le.default.commit({...this.getGitConfig(),message:`Deleted ${e.length} file${e.length===1?"":"s"}`,author:{name:"Quartz Syncer",email:"268450573+quartz-syncer-publisher[bot]@users.noreply.github.com"},cache:s}),await this.pushWithRetry()}catch(r){throw ot.error("Failed to delete files",r),r}}async updateFiles(e,n,r,i){let s=e.length>0,o=n&&n.size>0,a=r&&r.length>0;if(!(!s&&!o&&!a))try{await this.ensureRepoInitialized(),await le.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let l=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await le.default.checkout({...this.getGitConfig(),ref:l,force:!0}),await le.default.branch({...this.getGitConfig(),ref:this.branch,object:l,force:!0}),await le.default.checkout({...this.getGitConfig(),ref:this.branch});let c=g=>{let y;do y=g,g=g.replace(/\.\.\//g,"");while(g!==y);return g=this.getVaultPath(g),g.startsWith("/")?`${this.contentFolder}${g}`:`${this.contentFolder}/${g}`},u=async g=>{let y=g.split("/");y.pop();let w=this.dir;for(let b of y)if(b){w=`${w}/${b}`;try{await this.getFs().promises.mkdir(w)}catch{ot.debug(`Directory ${w} already exists`)}}},f={},h=[],d=e.length,p=0;for(let g of e){let[y,w]=g.compiledFile,b=c(g.getPath()),S=`${this.dir}/${b}`;await u(b),await this.getFs().promises.writeFile(S,y),h.push(b);for(let D of w.blobs){let k=c(D.path),E=`${this.dir}/${k}`;await u(k);let v=Uint8Array.from(atob(D.content),_=>_.charCodeAt(0));await this.getFs().promises.writeFile(E,v),h.push(k)}p++,i&&await i(p,d),(d<=100||p%50===0)&&await new Promise(D=>window.requestAnimationFrame(D))}h.length>0&&await le.default.add({...this.getGitConfig(),filepath:h,cache:f}),n&&n.size>0&&await this.stageRawFiles(n,f),r&&r.length>0&&await this.stageRawFileDeletions(r,f),await le.default.commit({...this.getGitConfig(),message:`Published ${e.length} file${e.length===1?"":"s"}`,author:{name:"Quartz Syncer",email:"268450573+quartz-syncer-publisher[bot]@users.noreply.github.com"},cache:f}),await this.pushWithRetry()}catch(l){throw ot.error("Failed to update files",l),l}}async stageRawFiles(e,n={}){if(e.size===0)return;let r=async s=>{let o=s.split("/");o.pop();let a=this.dir;for(let l of o)if(l){a=`${a}/${l}`;try{await this.getFs().promises.mkdir(a)}catch{ot.debug(`Directory ${a} already exists`)}}},i=[];for(let[s,o]of e){let a=`${this.dir}/${s}`;await r(s),await this.getFs().promises.writeFile(a,o),i.push(s)}i.length>0&&await le.default.add({...this.getGitConfig(),filepath:i,cache:n})}async stageRawFileDeletions(e,n={}){if(e.length!==0)for(let r of e){let i=`${this.dir}/${r}`;try{await this.getFs().promises.unlink(i),await le.default.remove({...this.getGitConfig(),filepath:r,cache:n})}catch(s){ot.debug(`Could not delete file ${r}`,s)}}}async writeRawFiles(e,n="Updated integration styles"){if(e.size!==0)try{await this.ensureRepoInitialized(),await le.default.fetch({...this.getGitConfig(),url:this.remoteUrl,ref:this.branch,singleBranch:!0});let r=await le.default.resolveRef({...this.getGitConfig(),ref:`origin/${this.branch}`});await le.default.checkout({...this.getGitConfig(),ref:r,force:!0}),await le.default.branch({...this.getGitConfig(),ref:this.branch,object:r,force:!0}),await le.default.checkout({...this.getGitConfig(),ref:this.branch}),await this.stageRawFiles(e),await le.default.commit({...this.getGitConfig(),message:n,author:{name:"Quartz Syncer",email:"268450573+quartz-syncer-publisher[bot]@users.noreply.github.com"}}),await this.pushWithRetry()}catch(r){throw ot.error("Failed to write raw files",r),r}}async testConnection(){try{return await le.default.getRemoteInfo({http:ch,url:this.remoteUrl,corsProxy:this.corsProxyUrl,onAuth:this.getOnAuth()}),!0}catch(e){return ot.error("Connection test failed",e),!1}}async clearLocalCache(){let e=this.getFsName();try{typeof indexedDB<"u"&&indexedDB.deleteDatabase(e),this.fs=null,this.initialized=!1,ot.info("Local git cache cleared")}catch(n){ot.error("Failed to clear local cache",n)}}static getOnAuth(e){if(e.type!=="none")return e.type==="bearer"?()=>({username:"x-access-token",password:e.secret||""}):()=>({username:e.username||"",password:e.secret||""})}static async fetchRemoteHeadCommit(e,n,r,i){try{let s=r?`refs/heads/${r}`:"HEAD",o=await le.default.listServerRefs({http:ch,url:e,corsProxy:i,onAuth:this.getOnAuth(n),prefix:s,symrefs:!0});return r?o.find(c=>c.ref===`refs/heads/${r}`)?.oid??null:o.find(l=>l.ref==="HEAD")?.oid??null}catch(s){return ot.debug("Failed to fetch remote HEAD commit",s),null}}static async fetchRemoteBranches(e,n,r){try{let i=await le.default.listServerRefs({http:ch,url:e,corsProxy:r,onAuth:this.getOnAuth(n),prefix:"refs/heads/",symrefs:!0}),s=i.filter(l=>l.ref.startsWith("refs/heads/")).map(l=>l.ref.replace("refs/heads/","")),o=null,a=i.find(l=>l.ref==="HEAD");return a?.target&&(o=a.target.replace("refs/heads/","")),{branches:s,defaultBranch:o}}catch(i){return ot.error("Failed to fetch remote branches",i),{branches:[],defaultBranch:null}}}static async checkWriteAccess(e,n,r){try{return await le.default.listServerRefs({http:ch,url:e,corsProxy:r,onAuth:this.getOnAuth(n),forPush:!0,prefix:"refs/heads/"}),!0}catch{return!1}}};var EN=it(vt()),cr=class{app;plugin;vault;metadataCache;compiler;settings;vaultPath;datastore;extendedCache;constructor(e,n,r,i,s,o,a){this.app=e,this.plugin=n,this.vault=r,this.metadataCache=i,this.settings=s,this.vaultPath=s.vaultPath,this.datastore=o,this.extendedCache=a,this.compiler=new xm(e,r,s,i,o)}shouldPublish(e){if(e.extension==="base")return this.settings.useBases;if(e.extension==="canvas")return this.settings.useCanvas;if(e.path.endsWith(".excalidraw")||e.path.endsWith(".excalidraw.md"))return this.settings.useExcalidraw;let n=this.metadataCache.getCache(e.path)?.frontmatter;return tl(this.settings.publishFrontmatterKey,n,this.settings.allNotesPublishableByDefault)}async getFilesMarkedForPublishing(){let e=this.settings.vaultPath==="/",n;if(this.settings.allNotesPublishableByDefault)n=new Set(this.vault.getMarkdownFiles().filter(f=>e||f.path.startsWith(this.settings.vaultPath)).map(f=>f.path));else if(this.extendedCache.isReady){let f=this.extendedCache.api.getFilesWithFrontmatterKey(this.settings.publishFrontmatterKey);n=new Set;for(let h of f)this.metadataCache.getCache(h)?.frontmatter?.[this.settings.publishFrontmatterKey]&&n.add(h)}else n=new Set(this.vault.getMarkdownFiles().filter(f=>{if(!e&&!f.path.startsWith(this.settings.vaultPath))return!1;let h=this.metadataCache.getCache(f.path)?.frontmatter;return tl(this.settings.publishFrontmatterKey,h,!1)}).map(f=>f.path));let r=e?n:new Set([...n].filter(f=>f.startsWith(this.settings.vaultPath))),i=this.settings.useBases?this.vault.getFiles().filter(f=>f.extension==="base"&&(e||f.path.startsWith(this.settings.vaultPath))):[],s=this.settings.useCanvas?this.vault.getFiles().filter(f=>f.extension==="canvas"&&(e||f.path.startsWith(this.settings.vaultPath))):[],o=this.settings.useExcalidraw?this.vault.getMarkdownFiles().filter(f=>(f.path.endsWith(".excalidraw")||f.path.endsWith(".excalidraw.md"))&&(e||f.path.startsWith(this.settings.vaultPath))):[];for(let f of o)r.delete(f.path);let l=[...[...r].map(f=>this.vault.getFileByPath(f)).filter(f=>f!==null),...i,...s,...o],c=[],u=new Set;for(let f of l)try{let h=new oa({file:f,compiler:this.compiler,metadataCache:this.metadataCache,vault:this.vault,settings:this.settings,datastore:this.datastore});c.push(h),(await h.getBlobLinks()).forEach(p=>u.add(p))}catch(h){EN.default.error(h)}return{notes:c.sort((f,h)=>f.compare(h)),blobs:Array.from(u)}}createConnection(){return new rt({gitSettings:this.plugin.getGitSettingsWithSecret(),contentFolder:this.settings.contentFolder,vaultPath:this.settings.vaultPath})}async deleteBatch(e,n,r){if(e.length===0)return!0;try{if(await(n??this.createConnection()).deleteFiles(e,r),this.settings.useCache)for(let s of e)await this.datastore.dropFile(s);return!0}catch(i){return console.error(i),!1}}async publishBatch(e,n,r){let i=e.filter(s=>s.file.extension==="base"?this.settings.useBases:s.file.extension==="canvas"?this.settings.useCanvas:s.file.path.endsWith(".excalidraw")||s.file.path.endsWith(".excalidraw.md")?this.settings.useExcalidraw:Tx(this.settings.publishFrontmatterKey,s.frontmatter,this.settings.allNotesPublishableByDefault));if(i.length===0)return!0;try{let s=n??this.createConnection(),a=await new Eu(this.settings).collectAssets(s);if(await s.updateFiles(i,a.filesToStage,a.filesToDelete,r),this.settings.useCache)for(let l of i){let c=await this.datastore.loadFile(l.file.path);c&&c.localData&&await this.datastore.storeRemoteFile(l.file.path,l.file.stat.mtime,c.localData)}return!0}catch(s){return console.error(s),!1}}};m();var Ia=require("obsidian");m();m();m();m();function He(){}function l1(t){return t()}function $p(){return Object.create(null)}function kn(t){t.forEach(l1)}function _a(t){return typeof t=="function"}function Ni(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function _N(t){return Object.keys(t).length===0}function Dc(t){return t&&_a(t.destroy)?t.destroy:He}m();m();m();m();m();m();var c1=typeof window<"u"?window:globalThis;var Up=class t{_listeners="WeakMap"in c1?new WeakMap:void 0;_observer=void 0;options;constructor(e){this.options=e}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver(e=>{for(let n of e)t.entries.set(n.target,n),this._listeners.get(n.target)?.(n)}))}};Up.entries="WeakMap"in c1?new WeakMap:void 0;var CN=!1;function TN(){CN=!0}function FN(){CN=!1}function H(t,e){t.appendChild(e)}function IN(t,e,n){let r=AN(t);if(!r.getElementById(e)){let i=X("style");i.id=e,i.textContent=n,m7(r,i)}}function AN(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function m7(t,e){return H(t.head||t,e),e.sheet}function pe(t,e,n){t.insertBefore(e,n||null)}function me(t){t.parentNode&&t.parentNode.removeChild(t)}function fs(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function X(t){return document.createElement(t)}function p7(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function et(t){return document.createTextNode(t)}function we(){return et(" ")}function oo(){return et("")}function un(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function ne(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function ON(t){return Array.from(t.childNodes)}function yt(t,e){e=""+e,t.data!==e&&(t.data=e)}function Ft(t,e,n){t.classList.toggle(e,!!n)}function jp(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}var Ca=class{is_svg=!1;e=void 0;n=void 0;t=void 0;a=void 0;constructor(e=!1){this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,n,r=null){this.e||(this.is_svg?this.e=p7(n.nodeName):this.e=X(n.nodeType===11?"TEMPLATE":n.nodeName),this.t=n.tagName!=="TEMPLATE"?n:n.content,this.c(e)),this.i(r)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let n=0;n<this.n.length;n+=1)pe(this.t,this.n[n],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(me)}};function PN(t){let e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}m();m();m();m();var ao;function hs(t){ao=t}function u1(){if(!ao)throw new Error("Function called outside component initialization");return ao}function f1(t){u1().$$.on_mount.push(t)}function h1(){let t=u1();return(e,n,{cancelable:r=!1}={})=>{let i=t.$$.callbacks[e];if(i){let s=jp(e,n,{cancelable:r});return i.slice().forEach(o=>{o.call(t,s)}),!s.defaultPrevented}return!0}}var Ta=[];var NN=[],_c=[],MN=[],RN=Promise.resolve(),m1=!1;function p1(){m1||(m1=!0,RN.then(qp))}function fh(){return p1(),RN}function hh(t){_c.push(t)}var d1=new Set,Ec=0;function qp(){if(Ec!==0)return;let t=ao;do{try{for(;Ec<Ta.length;){let e=Ta[Ec];Ec++,hs(e),k7(e.$$)}}catch(e){throw Ta.length=0,Ec=0,e}for(hs(null),Ta.length=0,Ec=0;NN.length;)NN.pop()();for(let e=0;e<_c.length;e+=1){let n=_c[e];d1.has(n)||(d1.add(n),n())}_c.length=0}while(Ta.length);for(;MN.length;)MN.pop()();m1=!1,d1.clear(),hs(t)}function k7(t){if(t.fragment!==null){t.update(),kn(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(hh)}}function zN(t){let e=[],n=[];_c.forEach(r=>t.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),_c=e}var Vp=new Set,Fa;function Nr(){Fa={r:0,c:[],p:Fa}}function Mr(){Fa.r||kn(Fa.c),Fa=Fa.p}function xe(t,e){t&&t.i&&(Vp.delete(t),t.i(e))}function Oe(t,e,n,r){if(t&&t.o){if(Vp.has(t))return;Vp.add(t),Fa.c.push(()=>{Vp.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}m();function tn(t){return t?.length!==void 0?t:Array.from(t)}m();m();m();var x7=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],S7=new Set([...x7]);m();m();m();function Kt(t){t&&t.c()}function zt(t,e,n){let{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),hh(()=>{let s=t.$$.on_mount.map(l1).filter(_a);t.$$.on_destroy?t.$$.on_destroy.push(...s):kn(s),t.$$.on_mount=[]}),i.forEach(hh)}function Lt(t,e){let n=t.$$;n.fragment!==null&&(zN(n.after_update),kn(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function E7(t,e){t.$$.dirty[0]===-1&&(Ta.push(t),p1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Mi(t,e,n,r,i,s,o=null,a=[-1]){let l=ao;hs(t);let c=t.$$={fragment:null,ctx:[],props:s,update:He,not_equal:i,bound:$p(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:$p(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};o&&o(c.root);let u=!1;if(c.ctx=n?n(t,e.props||{},(f,h,...d)=>{let p=d.length?d[0]:h;return c.ctx&&i(c.ctx[f],c.ctx[f]=p)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](p),u&&E7(t,f)),h}):[],c.update(),u=!0,kn(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){TN();let f=ON(e.target);c.fragment&&c.fragment.l(f),f.forEach(me)}else c.fragment&&c.fragment.c();e.intro&&xe(t.$$.fragment),zt(t,e.target,e.anchor),FN(),qp()}hs(l)}var _7;typeof HTMLElement=="function"&&(_7=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,n){super(),this.$$ctor=t,this.$$s=e,n&&this.attachShadow({mode:"open"})}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){let r=this.$$c.$on(t,e);this.$$l_u.set(e,r)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){let r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}if(this.$$l[t]){let r=this.$$l[t].indexOf(e);r>=0&&this.$$l[t].splice(r,1)}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(i){return()=>{let s;return{c:function(){s=X("slot"),i!=="default"&&ne(s,"name",i)},m:function(l,c){pe(l,s,c)},d:function(l){l&&me(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let e={},n=PN(this);for(let i of this.$$s)i in n&&(e[i]=[t(i)]);for(let i of this.attributes){let s=this.$$g_p(i.name);s in this.$$d||(this.$$d[s]=g1(s,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});let r=()=>{this.$$r=!0;for(let i in this.$$p_d)if(this.$$d[i]=this.$$c.$$.ctx[this.$$c.$$.props[i]],this.$$p_d[i].reflect){let s=g1(i,this.$$d[i],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,s)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let i in this.$$l)for(let s of this.$$l[i]){let o=this.$$c.$on(i,s);this.$$l_u.set(s,o)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=g1(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(t){return Object.keys(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function g1(t,e,n,r){let i=n[t]?.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var ur=class{$$=void 0;$$set=void 0;$destroy(){Lt(this,1),this.$destroy=He}$on(e,n){if(!_a(n))return He;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!_N(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};m();m();var LN="4";m();typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(LN);var mh=require("obsidian");m();m();var y1=require("obsidian");function C7(t){let e,n=(0,y1.getIcon)(t[0])?.outerHTML+"",r;return{c(){e=new Ca(!1),r=oo(),e.a=r},m(i,s){e.m(n,i,s),pe(i,r,s)},p(i,[s]){s&1&&n!==(n=(0,y1.getIcon)(i[0])?.outerHTML+"")&&e.p(n)},i:He,o:He,d(i){i&&(me(r),e.d())}}}function T7(t,e,n){let{name:r="book-heart"}=e;return t.$$set=i=>{"name"in i&&n(0,r=i.name)},[r]}var w1=class extends ur{constructor(e){super(),Mi(this,e,T7,C7,Ni,{name:0})}},oi=w1;m();m();function BN(t,e,n){let r=t.slice();return r[13]=e[n],r}function F7(t){let e,n,r,i,s,o,a,l=t[0].name+"",c,u,f,h,d,p,g;i=new oi({props:{name:"file"}});let y=!t[1]&&$N(t),w=t[0].fileType==="base"&&UN(t),b=t[0].fileType==="canvas"&&jN(t),S=t[2]&&qN(t);return{c(){e=X("span"),n=X("span"),r=we(),Kt(i.$$.fragment),s=we(),y&&y.c(),o=we(),a=X("span"),c=et(l),u=we(),w&&w.c(),f=we(),b&&b.c(),h=we(),S&&S.c(),ne(n,"class","no-arrow")},m(D,k){pe(D,e,k),H(e,n),H(e,r),zt(i,e,null),H(e,s),y&&y.m(e,null),H(e,o),H(e,a),H(a,c),H(e,u),w&&w.m(e,null),H(e,f),b&&b.m(e,null),H(e,h),S&&S.m(e,null),d=!0,p||(g=un(a,"click",t[6]),p=!0)},p(D,k){D[1]?y&&(y.d(1),y=null):y?y.p(D,k):(y=$N(D),y.c(),y.m(e,o)),(!d||k&1)&&l!==(l=D[0].name+"")&&yt(c,l),D[0].fileType==="base"?w||(w=UN(D),w.c(),w.m(e,f)):w&&(w.d(1),w=null),D[0].fileType==="canvas"?b||(b=jN(D),b.c(),b.m(e,h)):b&&(b.d(1),b=null),D[2]?S?(S.p(D,k),k&4&&xe(S,1)):(S=qN(D),S.c(),xe(S,1),S.m(e,null)):S&&(Nr(),Oe(S,1,1,()=>{S=null}),Mr())},i(D){d||(xe(i.$$.fragment,D),xe(S),d=!0)},o(D){Oe(i.$$.fragment,D),Oe(S),d=!1},d(D){D&&me(e),Lt(i),y&&y.d(),w&&w.d(),b&&b.d(),S&&S.d(),p=!1,g()}}}function I7(t){let e,n,r,i,s,o,a,l,c,u,f;r=new oi({props:{name:"chevron-right"}});let h=[O7,A7],d=[];function p(y,w){return y[5]?1:0}s=p(t,-1),o=d[s]=h[s](t);let g=t[3]&&WN(t);return{c(){e=X("span"),n=X("span"),Kt(r.$$.fragment),i=we(),o.c(),a=we(),g&&g.c(),l=oo(),ne(n,"class","arrow"),Ft(n,"arrowDown",t[4])},m(y,w){pe(y,e,w),H(e,n),zt(r,n,null),H(e,i),d[s].m(e,null),pe(y,a,w),g&&g.m(y,w),pe(y,l,w),c=!0,u||(f=un(n,"click",t[6]),u=!0)},p(y,w){(!c||w&16)&&Ft(n,"arrowDown",y[4]),o.p(y,w),y[3]?g?(g.p(y,w),w&8&&xe(g,1)):(g=WN(y),g.c(),xe(g,1),g.m(l.parentNode,l)):g&&(Nr(),Oe(g,1,1,()=>{g=null}),Mr())},i(y){c||(xe(r.$$.fragment,y),xe(o),xe(g),c=!0)},o(y){Oe(r.$$.fragment,y),Oe(o),Oe(g),c=!1},d(y){y&&(me(e),me(a),me(l)),Lt(r),d[s].d(),g&&g.d(y),u=!1,f()}}}function $N(t){let e,n,r,i,s,o;return{c(){e=X("input"),ne(e,"type","checkbox"),ne(e,"data-label",n=t[0].name),e.checked=r=t[0].checked,e.indeterminate=i=t[0].indeterminate},m(a,l){pe(a,e,l),s||(o=un(e,"click",t[7]),s=!0)},p(a,l){l&1&&n!==(n=a[0].name)&&ne(e,"data-label",n),l&1&&r!==(r=a[0].checked)&&(e.checked=r),l&1&&i!==(i=a[0].indeterminate)&&(e.indeterminate=i)},d(a){a&&me(e),s=!1,o()}}}function UN(t){let e;return{c(){e=X("span"),e.textContent="BASE",ne(e,"class","quartz-syncer-file-badge quartz-syncer-badge-base")},m(n,r){pe(n,e,r)},d(n){n&&me(e)}}}function jN(t){let e;return{c(){e=X("span"),e.textContent="CANVAS",ne(e,"class","quartz-syncer-file-badge quartz-syncer-badge-canvas")},m(n,r){pe(n,e,r)},d(n){n&&me(e)}}}function qN(t){let e,n,r,i,s;return n=new oi({props:{name:"file-diff"}}),{c(){e=X("span"),Kt(n.$$.fragment),ne(e,"title","Show changes"),ne(e,"class","quartz-syncer-icon-diff")},m(o,a){pe(o,e,a),zt(n,e,null),r=!0,i||(s=un(e,"click",t[9]),i=!0)},p:He,i(o){r||(xe(n.$$.fragment,o),r=!0)},o(o){Oe(n.$$.fragment,o),r=!1},d(o){o&&me(e),Lt(n),i=!1,s()}}}function A7(t){let e,n,r=t[0].name+"",i,s,o,a=!t[1]&&VN(t);return{c(){a&&a.c(),e=we(),n=X("span"),i=et(r),ne(n,"class","root-header")},m(l,c){a&&a.m(l,c),pe(l,e,c),pe(l,n,c),H(n,i),s||(o=un(n,"click",t[6]),s=!0)},p(l,c){l[1]?a&&(a.d(1),a=null):a?a.p(l,c):(a=VN(l),a.c(),a.m(e.parentNode,e)),c&1&&r!==(r=l[0].name+"")&&yt(i,r)},i:He,o:He,d(l){l&&(me(e),me(n)),a&&a.d(l),s=!1,o()}}}function O7(t){let e,n,r,i,s=t[0].name+"",o,a,l,c;e=new oi({props:{name:"folder"}});let u=!t[1]&&HN(t);return{c(){Kt(e.$$.fragment),n=we(),u&&u.c(),r=we(),i=X("span"),o=et(s)},m(f,h){zt(e,f,h),pe(f,n,h),u&&u.m(f,h),pe(f,r,h),pe(f,i,h),H(i,o),a=!0,l||(c=un(i,"click",t[6]),l=!0)},p(f,h){f[1]?u&&(u.d(1),u=null):u?u.p(f,h):(u=HN(f),u.c(),u.m(r.parentNode,r)),(!a||h&1)&&s!==(s=f[0].name+"")&&yt(o,s)},i(f){a||(xe(e.$$.fragment,f),a=!0)},o(f){Oe(e.$$.fragment,f),a=!1},d(f){f&&(me(n),me(r),me(i)),Lt(e,f),u&&u.d(f),l=!1,c()}}}function VN(t){let e,n,r,i,s,o;return{c(){e=X("input"),ne(e,"type","checkbox"),ne(e,"data-label",n=t[0].name),e.checked=r=t[0].checked,e.indeterminate=i=t[0].indeterminate},m(a,l){pe(a,e,l),s||(o=un(e,"click",t[7]),s=!0)},p(a,l){l&1&&n!==(n=a[0].name)&&ne(e,"data-label",n),l&1&&r!==(r=a[0].checked)&&(e.checked=r),l&1&&i!==(i=a[0].indeterminate)&&(e.indeterminate=i)},d(a){a&&me(e),s=!1,o()}}}function HN(t){let e,n,r,i,s,o;return{c(){e=X("input"),ne(e,"type","checkbox"),ne(e,"data-label",n=t[0].name),e.checked=r=t[0].checked,e.indeterminate=i=t[0].indeterminate},m(a,l){pe(a,e,l),s||(o=un(e,"click",t[7]),s=!0)},p(a,l){l&1&&n!==(n=a[0].name)&&ne(e,"data-label",n),l&1&&r!==(r=a[0].checked)&&(e.checked=r),l&1&&i!==(i=a[0].indeterminate)&&(e.indeterminate=i)},d(a){a&&me(e),s=!1,o()}}}function WN(t){let e,n,r=tn(t[0].children),i=[];for(let o=0;o<r.length;o+=1)i[o]=GN(BN(t,r,o));let s=o=>Oe(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=oo()},m(o,a){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(o,a);pe(o,e,a),n=!0},p(o,a){if(a&1287){r=tn(o[0].children);let l;for(l=0;l<r.length;l+=1){let c=BN(o,r,l);i[l]?(i[l].p(c,a),xe(i[l],1)):(i[l]=GN(c),i[l].c(),xe(i[l],1),i[l].m(e.parentNode,e))}for(Nr(),l=r.length;l<i.length;l+=1)s(l);Mr()}},i(o){if(!n){for(let a=0;a<r.length;a+=1)xe(i[a]);n=!0}},o(o){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)Oe(i[a]);n=!1},d(o){o&&me(e),fs(i,o)}}}function GN(t){let e,n;return e=new Hp({props:{enableShowDiff:t[2],readOnly:t[1],tree:t[13]}}),e.$on("toggle",t[8]),e.$on("showDiff",t[11]),{c(){Kt(e.$$.fragment)},m(r,i){zt(e,r,i),n=!0},p(r,i){let s={};i&4&&(s.enableShowDiff=r[2]),i&2&&(s.readOnly=r[1]),i&1&&(s.tree=r[13]),e.$set(s)},i(r){n||(xe(e.$$.fragment,r),n=!0)},o(r){Oe(e.$$.fragment,r),n=!1},d(r){Lt(e,r)}}}function P7(t){let e,n,r,i,s,o=[I7,F7],a=[];function l(c,u){return c[0].children?0:c[5]?-1:1}return~(r=l(t,-1))&&(i=a[r]=o[r](t)),{c(){e=X("ul"),n=X("li"),i&&i.c(),Ft(e,"isRoot",t[5])},m(c,u){pe(c,e,u),H(e,n),~r&&a[r].m(n,null),s=!0},p(c,[u]){let f=r;r=l(c,u),r===f?~r&&a[r].p(c,u):(i&&(Nr(),Oe(a[f],1,1,()=>{a[f]=null}),Mr()),~r?(i=a[r],i?i.p(c,u):(i=a[r]=o[r](c),i.c()),xe(i,1),i.m(n,null)):i=null)},i(c){s||(xe(i),s=!0)},o(c){Oe(i),s=!1},d(c){c&&me(e),~r&&a[r].d()}}}var QN={};function N7(t,e,n){let r,{tree:i}=e,{readOnly:s=!1}=e,{enableShowDiff:o=!1}=e,a=h1(),{isRoot:l}=i,c=QN[i.path]||!1,u=()=>{n(3,c=QN[i.path]=!c)},f=()=>{n(0,i.checked=!i.checked,i),a("toggle",{node:i})},h=y=>{a("toggle",{node:y.detail.node})},d=y=>{y.stopPropagation(),a("showDiff",{node:i})},p=y=>{a("showDiff",{node:y})},g=y=>p(y.detail.node);return t.$$set=y=>{"tree"in y&&n(0,i=y.tree),"readOnly"in y&&n(1,s=y.readOnly),"enableShowDiff"in y&&n(2,o=y.enableShowDiff)},t.$$.update=()=>{t.$$.dirty&8&&n(4,r=c)},[i,s,o,c,r,l,u,f,h,d,p,g]}var Hp=class extends ur{constructor(e){super(),Mi(this,e,N7,P7,Ni,{tree:0,readOnly:1,enableShowDiff:2})}},KN=Hp;function M7(t){let e,n,r;return n=new KN({props:{tree:t[0],readOnly:t[1],enableShowDiff:t[2]}}),n.$on("toggle",t[4]),n.$on("showDiff",t[5]),{c(){e=X("div"),Kt(n.$$.fragment)},m(i,s){pe(i,e,s),zt(n,e,null),r=!0},p(i,[s]){let o={};s&1&&(o.tree=i[0]),s&2&&(o.readOnly=i[1]),s&4&&(o.enableShowDiff=i[2]),n.$set(o)},i(i){r||(xe(n.$$.fragment,i),r=!0)},o(i){Oe(n.$$.fragment,i),r=!1},d(i){i&&me(e),Lt(n)}}}function ZN(t,e=!0){if(t.children){for(let n of t.children)e&&(n.checked=!!t.checked),ZN(n,e);t.indeterminate=t.children.some(n=>n.indeterminate)||t.children.some(n=>!!n.checked)&&t.children.some(n=>!n.checked)}}function R7(t,e,n){let{tree:r}=e,{readOnly:i=!1}=e,{enableShowDiff:s=!1}=e,{showDiff:o}=e,a={};function l(f){if(f.children)for(let h of f.children)a[h.path]=f,l(h)}l(r);function c(f,h=!0){let d=f.detail.node,p=a[d.path];for(ZN(d,h);p;)p?.children?.every(y=>!!y.checked)?(p.indeterminate=!1,p.checked=!0):(p?.children?.some(w=>!!w.checked||w.indeterminate)?p.indeterminate=!0:p.indeterminate=!1,p.checked=!1),p=a[p.path];n(0,r)}c({detail:{node:r}},!1);let u=f=>o(f.detail.node.path);return t.$$set=f=>{"tree"in f&&n(0,r=f.tree),"readOnly"in f&&n(1,i=f.readOnly),"enableShowDiff"in f&&n(2,s=f.enableShowDiff),"showDiff"in f&&n(3,o=f.showDiff)},[r,i,s,o,c,u]}var b1=class extends ur{constructor(e){super(),Mi(this,e,R7,M7,Ni,{tree:0,readOnly:1,enableShowDiff:2,showDiff:3})}},dh=b1;function YN(t,e,n){let r=t.slice();return r[29]=e[n],r}function JN(t,e,n){let r=t.slice();return r[32]=e[n],r}function XN(t){let e;return{c(){e=X("hr"),ne(e,"class","quartz-syncer-publisher-title-separator")},m(n,r){pe(n,e,r)},d(n){n&&me(e)}}}function z7(t){let e,n,r,i,s,o=`${t[6].length} of ${t[3].length+t[4].length+t[5].length} notes published`,a,l,c,u,f,h,d,p,g,y,w,b,S,D,k,E,v=t[18].length>0&&$7(t),_=tn(t[3].concat(t[4])),C=[];for(let L=0;L<_.length;L+=1)C[L]=tM(JN(t,_,L));let A=L=>Oe(C[L],1,1,()=>{C[L]=null}),P=tn(t[5]),N=[];for(let L=0;L<P.length;L+=1)N[L]=rM(YN(t,P,L));let B=L=>Oe(N[L],1,1,()=>{N[L]=null});return{c(){e=X("div"),n=X("div"),r=X("div"),r.textContent="Publishing Notes",i=we(),s=X("div"),a=et(o),l=we(),v&&v.c(),c=we(),u=X("div"),f=X("div"),d=we();for(let L=0;L<C.length;L+=1)C[L].c();p=we();for(let L=0;L<N.length;L+=1)N[L].c();g=we(),y=X("hr"),w=we(),b=X("div"),S=X("button"),S.textContent="DONE",ne(r,"class","quartz-syncer-publisher-callout-title-inner"),ne(f,"class","quartz-syncer-progress-bar-container"),ne(u,"class","quartz-syncer-publisher-loading-container"),ne(n,"class","quartz-syncer-publisher-callout"),ne(y,"class","quartz-syncer-publisher-footer-separator"),ne(S,"class","quartz-syncer-publisher-button"),ne(b,"class","quartz-syncer-publisher-footer")},m(L,G){pe(L,e,G),H(e,n),H(n,r),H(n,i),H(n,s),H(s,a),H(n,l),v&&v.m(n,null),H(n,c),H(n,u),H(u,f),H(e,d);for(let U=0;U<C.length;U+=1)C[U]&&C[U].m(e,null);H(e,p);for(let U=0;U<N.length;U+=1)N[U]&&N[U].m(e,null);H(e,g),H(e,y),H(e,w),H(e,b),H(b,S),D=!0,k||(E=[Dc(h=t[16].call(null,f)),un(S,"click",function(){_a(t[1])&&t[1].apply(this,arguments)})],k=!0)},p(L,G){if(t=L,(!D||G[0]&120)&&o!==(o=`${t[6].length} of ${t[3].length+t[4].length+t[5].length} notes published`)&&yt(a,o),t[18].length>0&&v.p(t,G),G[0]&394328){_=tn(t[3].concat(t[4]));let U;for(U=0;U<_.length;U+=1){let he=JN(t,_,U);C[U]?(C[U].p(he,G),xe(C[U],1)):(C[U]=tM(he),C[U].c(),xe(C[U],1),C[U].m(e,p))}for(Nr(),U=_.length;U<C.length;U+=1)A(U);Mr()}if(G[0]&132192){P=tn(t[5]);let U;for(U=0;U<P.length;U+=1){let he=YN(t,P,U);N[U]?(N[U].p(he,G),xe(N[U],1)):(N[U]=rM(he),N[U].c(),xe(N[U],1),N[U].m(e,g))}for(Nr(),U=P.length;U<N.length;U+=1)B(U);Mr()}},i(L){if(!D){for(let G=0;G<_.length;G+=1)xe(C[G]);for(let G=0;G<P.length;G+=1)xe(N[G]);D=!0}},o(L){C=C.filter(Boolean);for(let G=0;G<C.length;G+=1)Oe(C[G]);N=N.filter(Boolean);for(let G=0;G<N.length;G+=1)Oe(N[G]);D=!1},d(L){L&&me(e),v&&v.d(),fs(C,L),fs(N,L),k=!1,kn(E)}}}function L7(t){let e,n,r,i,s,o,a,l,c,u,f,h,d,p,g;return e=new dh({props:{tree:t[13]??t[20],showDiff:t[0]}}),r=new dh({props:{tree:t[12]??t[20],showDiff:t[0],enableShowDiff:!0}}),s=new dh({props:{tree:t[11]??t[20],showDiff:t[0]}}),a=new dh({props:{readOnly:!0,tree:t[14]??t[20],showDiff:t[0]}}),{c(){Kt(e.$$.fragment),n=we(),Kt(r.$$.fragment),i=we(),Kt(s.$$.fragment),o=we(),Kt(a.$$.fragment),l=we(),c=X("hr"),u=we(),f=X("div"),h=X("button"),h.textContent="PUBLISH SELECTED CHANGES",ne(c,"class","quartz-syncer-publisher-footer-separator"),ne(h,"class","quartz-syncer-publisher-button"),ne(f,"class","quartz-syncer-publisher-footer")},m(y,w){zt(e,y,w),pe(y,n,w),zt(r,y,w),pe(y,i,w),zt(s,y,w),pe(y,o,w),zt(a,y,w),pe(y,l,w),pe(y,c,w),pe(y,u,w),pe(y,f,w),H(f,h),d=!0,p||(g=un(h,"click",t[19]),p=!0)},p(y,w){let b={};w[0]&8192&&(b.tree=y[13]??y[20]),w[0]&1&&(b.showDiff=y[0]),e.$set(b);let S={};w[0]&4096&&(S.tree=y[12]??y[20]),w[0]&1&&(S.showDiff=y[0]),r.$set(S);let D={};w[0]&2048&&(D.tree=y[11]??y[20]),w[0]&1&&(D.showDiff=y[0]),s.$set(D);let k={};w[0]&16384&&(k.tree=y[14]??y[20]),w[0]&1&&(k.showDiff=y[0]),a.$set(k)},i(y){d||(xe(e.$$.fragment,y),xe(r.$$.fragment,y),xe(s.$$.fragment,y),xe(a.$$.fragment,y),d=!0)},o(y){Oe(e.$$.fragment,y),Oe(r.$$.fragment,y),Oe(s.$$.fragment,y),Oe(a.$$.fragment,y),d=!1},d(y){y&&(me(n),me(i),me(o),me(l),me(c),me(u),me(f)),Lt(e,y),Lt(r,y),Lt(s,y),Lt(a,y),p=!1,g()}}}function B7(t){let e,n,r,i,s,o,a,l,c,u,f;return{c(){e=X("div"),n=X("div"),i=we(),s=X("div"),o=et(t[9]),a=we(),l=X("div"),c=et(t[8]),ne(n,"class","quartz-syncer-progress-bar-container"),ne(s,"class","quartz-syncer-progress-bar-text"),ne(l,"class","quartz-syncer-progress-bar-text"),ne(e,"class","quartz-syncer-publisher-loading-msg")},m(h,d){pe(h,e,d),H(e,n),H(e,i),H(e,s),H(s,o),H(e,a),H(e,l),H(l,c),u||(f=Dc(r=t[15].call(null,n)),u=!0)},p(h,d){d[0]&512&&yt(o,h[9]),d[0]&256&&yt(c,h[8])},i:He,o:He,d(h){h&&me(e),u=!1,f()}}}function $7(t){let e;return{c(){e=X("div"),e.textContent=`${`(${t[18].length} failed)`}`},m(n,r){pe(n,e,r)},p:He,d(n){n&&me(e)}}}function U7(t){let e,n;return e=new oi({props:{name:"clock"}}),{c(){Kt(e.$$.fragment)},m(r,i){zt(e,r,i),n=!0},p:He,i(r){n||(xe(e.$$.fragment,r),n=!0)},o(r){Oe(e.$$.fragment,r),n=!1},d(r){Lt(e,r)}}}function j7(t){let e,n;return e=new oi({props:{name:"cross"}}),{c(){Kt(e.$$.fragment)},m(r,i){zt(e,r,i),n=!0},p:He,i(r){n||(xe(e.$$.fragment,r),n=!0)},o(r){Oe(e.$$.fragment,r),n=!1},d(r){Lt(e,r)}}}function q7(t){let e,n;return e=new oi({props:{name:"check"}}),{c(){Kt(e.$$.fragment)},m(r,i){zt(e,r,i),n=!0},p:He,i(r){n||(xe(e.$$.fragment,r),n=!0)},o(r){Oe(e.$$.fragment,r),n=!1},d(r){Lt(e,r)}}}function V7(t){let e,n=t[17]()?.outerHTML+"",r;return{c(){e=new Ca(!1),r=oo(),e.a=r},m(i,s){e.m(n,i,s),pe(i,r,s)},p:He,i:He,o:He,d(i){i&&(me(r),e.d())}}}function eM(t){let e;return{c(){e=X("span"),e.textContent="- PUBLISHED",ne(e,"class","quartz-syncer-publisher-published")},m(n,r){pe(n,e,r)},d(n){n&&me(e)}}}function tM(t){let e,n,r,i,s,o,a,l=t[32].file.name+"",c,u,f=t[6].includes(t[32].getVaultPath()),h,d=[V7,q7,j7,U7],p=[];function g(w,b){return b[0]&1048&&(n=null),b[0]&88&&(r=null),b[0]&24&&(i=null),n==null&&(n=!!w[10].includes(w[32].getVaultPath())),n?0:(r==null&&(r=!!w[6].includes(w[32].getVaultPath())),r?1:(i==null&&(i=!!w[18].includes(w[32].getVaultPath())),i?2:3))}s=g(t,[-1,-1]),o=p[s]=d[s](t);let y=f&&eM(t);return{c(){e=X("div"),o.c(),a=we(),c=et(l),u=we(),y&&y.c(),ne(e,"class","quartz-syncer-publisher-note-list")},m(w,b){pe(w,e,b),p[s].m(e,null),H(e,a),H(e,c),H(e,u),y&&y.m(e,null),h=!0},p(w,b){let S=s;s=g(w,b),s===S?p[s].p(w,b):(Nr(),Oe(p[S],1,1,()=>{p[S]=null}),Mr(),o=p[s],o?o.p(w,b):(o=p[s]=d[s](w),o.c()),xe(o,1),o.m(e,a)),(!h||b[0]&24)&&l!==(l=w[32].file.name+"")&&yt(c,l),b[0]&88&&(f=w[6].includes(w[32].getVaultPath())),f?y||(y=eM(w),y.c(),y.m(e,null)):y&&(y.d(1),y=null)},i(w){h||(xe(o),h=!0)},o(w){Oe(o),h=!1},d(w){w&&me(e),p[s].d(),y&&y.d()}}}function H7(t){let e,n;return e=new oi({props:{name:"clock"}}),{c(){Kt(e.$$.fragment)},m(r,i){zt(e,r,i),n=!0},p:He,i(r){n||(xe(e.$$.fragment,r),n=!0)},o(r){Oe(e.$$.fragment,r),n=!1},d(r){Lt(e,r)}}}function W7(t){let e,n;return e=new oi({props:{name:"check"}}),{c(){Kt(e.$$.fragment)},m(r,i){zt(e,r,i),n=!0},p:He,i(r){n||(xe(e.$$.fragment,r),n=!0)},o(r){Oe(e.$$.fragment,r),n=!1},d(r){Lt(e,r)}}}function G7(t){let e,n=t[17]()?.outerHTML+"",r;return{c(){e=new Ca(!1),r=oo(),e.a=r},m(i,s){e.m(n,i,s),pe(i,r,s)},p:He,i:He,o:He,d(i){i&&(me(r),e.d())}}}function nM(t){let e;return{c(){e=X("span"),e.textContent="- DELETED",ne(e,"class","quartz-syncer-publisher-deleted")},m(n,r){pe(n,e,r)},d(n){n&&me(e)}}}function rM(t){let e,n,r,i,s,o,a=t[29].split("/").last()+"",l,c,u=t[6].includes(t[29]),f,h=[G7,W7,H7],d=[];function p(y,w){return w[0]&1056&&(n=null),w[0]&96&&(r=null),n==null&&(n=!!y[10].includes(y[29])),n?0:(r==null&&(r=!!y[6].includes(y[29])),r?1:2)}i=p(t,[-1,-1]),s=d[i]=h[i](t);let g=u&&nM(t);return{c(){e=X("div"),s.c(),o=we(),l=et(a),c=we(),g&&g.c(),ne(e,"class","quartz-syncer-publisher-note-list")},m(y,w){pe(y,e,w),d[i].m(e,null),H(e,o),H(e,l),H(e,c),g&&g.m(e,null),f=!0},p(y,w){let b=i;i=p(y,w),i===b?d[i].p(y,w):(Nr(),Oe(d[b],1,1,()=>{d[b]=null}),Mr(),s=d[i],s?s.p(y,w):(s=d[i]=h[i](y),s.c()),xe(s,1),s.m(e,o)),(!f||w[0]&32)&&a!==(a=y[29].split("/").last()+"")&&yt(l,a),w[0]&96&&(u=y[6].includes(y[29])),u?g||(g=nM(y),g.c(),g.m(e,null)):g&&(g.d(1),g=null)},i(y){f||(xe(s),f=!0)},o(y){Oe(s),f=!1},d(y){y&&me(e),d[i].d(),g&&g.d()}}}function Q7(t){let e,n,r,i,s,o=t[2]&&XN(t),a=[B7,L7,z7],l=[];function c(u,f){return u[2]?u[7]?2:1:0}return r=c(t,[-1,-1]),i=l[r]=a[r](t),{c(){e=X("div"),o&&o.c(),n=we(),i.c()},m(u,f){pe(u,e,f),o&&o.m(e,null),H(e,n),l[r].m(e,null),s=!0},p(u,f){u[2]?o||(o=XN(u),o.c(),o.m(e,n)):o&&(o.d(1),o=null);let h=r;r=c(u,f),r===h?l[r].p(u,f):(Nr(),Oe(l[h],1,1,()=>{l[h]=null}),Mr(),i=l[r],i?i.p(u,f):(i=l[r]=a[r](u),i.c()),xe(i,1),i.m(e,null))},i(u){s||(xe(i),s=!0)},o(u){Oe(i),s=!1},d(u){u&&me(e),o&&o.d(),l[r].d()}}}function K7(t){return t.endsWith(".base")?"base":t.endsWith(".canvas")?"canvas":t.endsWith(".excalidraw")||t.endsWith(".excalidraw.md")?"excalidraw":t.endsWith(".md")?"markdown":"unknown"}function Z7(t,e,n,r,i){let s=t,o=e.split("/"),a=n.has(e);for(let l=0;l<o.length;l++){let c=o[l];s.children||(s.children=[]);let u=r.get(s);u||(u=new Map,r.set(s,u));let f=u.get(c),h=l===o.length-1;f||(f={name:c,isRoot:!1,path:o.slice(0,l+1).join("/"),indeterminate:!1,checked:a,fileType:h?i??K7(e):"folder"},s.children.push(f),u.set(c,f)),s=f}}function Y7(t,e,n){let r,i,s,o,a,{publishStatusManager:l}=e,{publisher:c}=e,{showDiff:u}=e,{close:f}=e,h,d=!1,p="Preparing to load...",g="Notes processed: 0/0",y,w;async function b(){n(2,h=await l.getPublishStatus(y))}f1(b);function S(U,he="root"){let Te={name:he,isRoot:!0,path:"/",indeterminate:!1,checked:!1},Xe=new Set(h?.deletedNotePaths?.map(De=>De.path)??[]),O=new WeakMap;for(let De of U)Z7(Te,De,Xe,O);return Te}function D(U){let he=new mh.ProgressBarComponent(U);return y={setProgress:Te=>{he.setValue(Te)},setIndexText:Te=>{n(9,g=Te)},setText:Te=>{n(8,p=Te)}},{destroy(){}}}function k(U){let he=new mh.ProgressBarComponent(U);return n(23,w={setProgress:Te=>{he.setValue(Te)},setIndexText:()=>{},setText:()=>{}}),{destroy(){}}}let E=()=>{let U=(0,mh.getIcon)("cog");return U?.classList.add("quartz-syncer-rotate","quartz-syncer-cog"),U},v=[],_=[],C=[],A=[],P=[],N=[],B=U=>{let he=[];if(U.children)for(let Te of U.children)he.push(...B(Te));else U.checked&&he.push(U.path);return he},L=async()=>{if(!o||!i)return;if(!h)throw new Error("Publish status is undefined");let U=B(o),he=B(i);n(5,C=B(s));let Te=C.filter(tt=>h.deletedNotePaths.some(Ve=>Ve.path===tt)),Xe=C.filter(tt=>h.deletedBlobPaths.some(Ve=>Ve.path===tt));n(3,v=h.unpublishedNotes.filter(tt=>U.includes(tt.getVaultPath()))??[]),n(4,_=h?.changedNotes.filter(tt=>he.includes(tt.getVaultPath()))??[]);let O=v.concat(_);n(7,d=!0),await fh();let De=c.createConnection(),ve=O.map(tt=>tt.getVaultPath()),I=[...Te,...Xe],Pe=[...ve,...I];n(10,A=[...Pe]),O.length>0&&await c.publishBatch(O,De,async(tt,Ve)=>{n(6,P=ve.slice(0,tt)),n(10,A=[...ve.slice(tt),...I]),await fh()});let Nt=[...ve];n(6,P=[...Nt]),I.length>0&&(n(10,A=[...I]),await c.deleteBatch(I,De,async(tt,Ve)=>{n(6,P=[...Nt,...I.slice(0,tt)]),n(10,A=I.slice(tt)),await fh()})),n(6,P=[...Pe]),n(10,A=[])},G={name:"",isRoot:!1,path:"",indeterminate:!1,checked:!1};return t.$$set=U=>{"publishStatusManager"in U&&n(21,l=U.publishStatusManager),"publisher"in U&&n(22,c=U.publisher),"showDiff"in U&&n(0,u=U.showDiff),"close"in U&&n(1,f=U.close)},t.$$.update=()=>{t.$$.dirty[0]&4&&n(14,r=h&&S(h.publishedNotes.map(U=>U.getVaultPath()),"Unchanged notes"+(h.publishedNotes.length>0?` (${h.publishedNotes.length===1?"1 note":`${h.publishedNotes.length} notes`})`:""))),t.$$.dirty[0]&4&&n(12,i=h&&S(h.changedNotes.map(U=>U.getVaultPath()),"Changed notes"+(h.changedNotes.length>0?` (${h.changedNotes.length===1?"1 note":`${h.changedNotes.length} notes`})`:""))),t.$$.dirty[0]&4&&n(11,s=h&&S([...h.deletedNotePaths,...h.deletedBlobPaths].map(U=>U.path),"Published notes (select to unpublish)"+(h.changedNotes.length+h.publishedNotes.length>0?` (${h.changedNotes.length+h.publishedNotes.length===1?"1 note":`${h.changedNotes.length+h.publishedNotes.length} notes`})`:""))),t.$$.dirty[0]&4&&n(13,o=h&&S(h.unpublishedNotes.map(U=>U.getVaultPath()),"Unpublished notes"+(h.unpublishedNotes.length>0?` (${h.unpublishedNotes.length===1?"1 note":`${h.unpublishedNotes.length} notes`})`:""))),t.$$.dirty[0]&120&&n(24,a=(P.length+N.length)/(v.length+_.length+C.length)*100),t.$$.dirty[0]&25165824&&w?.setProgress(a)},[u,f,h,v,_,C,P,d,p,g,A,s,i,o,r,D,k,E,N,L,G,l,c,w,a]}var v1=class extends ur{constructor(e){super(),Mi(this,e,Y7,Q7,Ni,{publishStatusManager:21,publisher:22,showDiff:0,close:1},null,[-1,-1])}},iM=v1;m();m();m();var ph=class{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);let s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;let o=b=>{if(b=this.postProcess(b,r),i){setTimeout(function(){i(b)},0);return}else return b},a=n.length,l=e.length,c=1,u=a+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));let f=(s=r.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(d[0],n,e,0,r);if(d[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(d[0].lastComponent,n,e));let g=-1/0,y=1/0,w=()=>{for(let b=Math.max(g,-c);b<=Math.min(y,c);b+=2){let S,D=d[b-1],k=d[b+1];D&&(d[b-1]=void 0);let E=!1;if(k){let _=k.oldPos-b;E=k&&0<=_&&_<a}let v=D&&D.oldPos+1<l;if(!E&&!v){d[b]=void 0;continue}if(!v||E&&D.oldPos<k.oldPos?S=this.addToPath(k,!0,!1,0,r):S=this.addToPath(D,!1,!0,1,r),p=this.extractCommon(S,n,e,b,r),S.oldPos+1>=l&&p+1>=a)return o(this.buildValues(S.lastComponent,n,e))||!0;d[b]=S,S.oldPos+1>=l&&(y=Math.min(y,b-1)),p+1>=a&&(g=Math.max(g,b+1))}c++};if(i)(function b(){setTimeout(function(){if(c>u||Date.now()>h)return i(void 0);w()||b()},0)})();else for(;c<=u&&Date.now()<=h;){let b=w();if(b)return b}}addToPath(e,n,r,i,s){let o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){let o=n.length,a=r.length,l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){let i=[],s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();let o=i.length,a=0,l=0,c=0;for(;a<o;a++){let u=i[a];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(l,l+u.count);f=f.map(function(h,d){let p=r[c+d];return p.length>h.length?p:h}),u.value=this.join(f)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}};m();var k1=class extends ph{constructor(){super(...arguments),this.tokenize=J7}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
|
||
`))&&(e=e.trim()),(!r.newlineIsToken||!n.includes(`
|
||
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
|
||
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
||
`)&&(n=n.slice(0,-1))),super.equals(e,n,r)}},sM=new k1;function x1(t,e,n){return sM.diff(t,e,n)}function J7(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
||
`));let n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){let s=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}var dM=require("obsidian");function X7(t){IN(t,"svelte-1o1t5ba",`.diff-view-wrapper.svelte-1o1t5ba.svelte-1o1t5ba{font-family:var(--font-monospace);font-size:12px;border:1px solid var(--background-modifier-border);border-radius:6px;overflow:hidden}.diff-header.svelte-1o1t5ba.svelte-1o1t5ba{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:var(--background-secondary);border-bottom:1px solid var(--background-modifier-border)}.diff-info.svelte-1o1t5ba.svelte-1o1t5ba{display:flex;align-items:center;gap:12px}.diff-stats.svelte-1o1t5ba.svelte-1o1t5ba{display:flex;gap:8px;font-weight:500}.additions.svelte-1o1t5ba.svelte-1o1t5ba{color:var(--color-green)}.deletions.svelte-1o1t5ba.svelte-1o1t5ba{color:var(--color-red)}.diff-filename.svelte-1o1t5ba.svelte-1o1t5ba{color:var(--text-muted)}.diff-controls.svelte-1o1t5ba.svelte-1o1t5ba{display:flex;gap:4px}.view-toggle.svelte-1o1t5ba.svelte-1o1t5ba{padding:4px 12px;border:1px solid var(--background-modifier-border);background:var(--background-primary);border-radius:4px;cursor:pointer;font-size:11px;color:var(--text-muted)}.view-toggle.svelte-1o1t5ba.svelte-1o1t5ba:hover{background:var(--background-modifier-hover)}.view-toggle.active.svelte-1o1t5ba.svelte-1o1t5ba{background:var(--interactive-accent);color:var(--text-on-accent);border-color:var(--interactive-accent)}.diff-split.svelte-1o1t5ba.svelte-1o1t5ba{display:flex;height:50vh}.diff-pane.svelte-1o1t5ba.svelte-1o1t5ba{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.diff-pane.svelte-1o1t5ba.svelte-1o1t5ba:first-child{border-right:1px solid var(--background-modifier-border)}.diff-pane-header.svelte-1o1t5ba.svelte-1o1t5ba{padding:6px 12px;background:var(--background-secondary);border-bottom:1px solid var(--background-modifier-border);font-size:11px;font-weight:500;color:var(--text-muted)}.diff-scroll-area.svelte-1o1t5ba.svelte-1o1t5ba{flex:1;overflow:auto}.diff-unified-scroll.svelte-1o1t5ba.svelte-1o1t5ba{height:50vh;overflow:auto}.diff-lines-inner.svelte-1o1t5ba.svelte-1o1t5ba{display:inline-block;min-width:100%}.diff-line.svelte-1o1t5ba.svelte-1o1t5ba{display:flex;line-height:20px;white-space:pre}.diff-line.added.svelte-1o1t5ba.svelte-1o1t5ba{--fallback-color-added:46, 160, 67;background:rgba(
|
||
var(
|
||
--background-modifier-success-rgb,
|
||
var(--color-green-rgb, var(--fallback-color-added))
|
||
),
|
||
0.15
|
||
)}.diff-line.removed.svelte-1o1t5ba.svelte-1o1t5ba{--fallback-color-removed:248, 81, 73;background:rgba(
|
||
var(
|
||
--background-modifier-error-rgb,
|
||
var(--color-red-rgb, var(--fallback-color-removed))
|
||
),
|
||
0.15
|
||
)}.diff-line.empty.svelte-1o1t5ba.svelte-1o1t5ba{background:var(--background-secondary)}.line-num.svelte-1o1t5ba.svelte-1o1t5ba{min-width:40px;padding:0 8px;text-align:right;color:var(--text-faint);background:var(--background-secondary);user-select:none;border-right:1px solid var(--background-modifier-border);flex-shrink:0}.diff-line.added.svelte-1o1t5ba>.line-num.svelte-1o1t5ba,.diff-line.removed.svelte-1o1t5ba>.line-num.svelte-1o1t5ba{background:transparent}.line-indicator.svelte-1o1t5ba.svelte-1o1t5ba{width:20px;min-width:20px;text-align:center;color:var(--text-muted);user-select:none;flex-shrink:0}.diff-line.added.svelte-1o1t5ba .line-indicator.svelte-1o1t5ba{color:var(--color-green);font-weight:bold}.diff-line.removed.svelte-1o1t5ba .line-indicator.svelte-1o1t5ba{color:var(--color-red);font-weight:bold}.line-content.svelte-1o1t5ba.svelte-1o1t5ba{flex:1;padding:0 8px}.diff-footer.svelte-1o1t5ba.svelte-1o1t5ba{padding:8px 12px;background:var(--background-secondary);border-top:1px solid var(--background-modifier-border);font-size:11px;color:var(--text-muted);font-family:var(--font-interface)}`)}function oM(t,e,n){let r=t.slice();return r[24]=e[n],r}function aM(t,e,n){let r=t.slice();return r[19]=e[n],r}function lM(t,e,n){let r=t.slice();return r[19]=e[n],r}function cM(t){let e,n;return{c(){e=X("span"),n=et(t[0]),ne(e,"class","diff-filename svelte-1o1t5ba")},m(r,i){pe(r,e,i),H(e,n)},p(r,i){i&1&&yt(n,r[0])},d(r){r&&me(e)}}}function eQ(t){let e,n,r=tn(t[4]),i=[];for(let s=0;s<r.length;s+=1)i[s]=uM(oM(t,r,s));return{c(){e=X("div"),n=X("div");for(let s=0;s<i.length;s+=1)i[s].c();ne(n,"class","diff-lines-inner svelte-1o1t5ba"),ne(e,"class","diff-unified-scroll svelte-1o1t5ba")},m(s,o){pe(s,e,o),H(e,n);for(let a=0;a<i.length;a+=1)i[a]&&i[a].m(n,null)},p(s,o){if(o&16){r=tn(s[4]);let a;for(a=0;a<r.length;a+=1){let l=oM(s,r,a);i[a]?i[a].p(l,o):(i[a]=uM(l),i[a].c(),i[a].m(n,null))}for(;a<i.length;a+=1)i[a].d(1);i.length=r.length}},d(s){s&&me(e),fs(i,s)}}}function tQ(t){let e,n,r,i,s,o,a,l,c,u,f,h,d,p,g,y,w=tn(t[5]),b=[];for(let k=0;k<w.length;k+=1)b[k]=fM(lM(t,w,k));let S=tn(t[5]),D=[];for(let k=0;k<S.length;k+=1)D[k]=hM(aM(t,S,k));return{c(){e=X("div"),n=X("div"),r=X("div"),r.textContent="Remote (Published)",i=we(),s=X("div"),o=X("div");for(let k=0;k<b.length;k+=1)b[k].c();l=we(),c=X("div"),u=X("div"),u.textContent="Local (Current)",f=we(),h=X("div"),d=X("div");for(let k=0;k<D.length;k+=1)D[k].c();ne(r,"class","diff-pane-header svelte-1o1t5ba"),ne(o,"class","diff-lines-inner svelte-1o1t5ba"),ne(s,"class","diff-scroll-area svelte-1o1t5ba"),ne(n,"class","diff-pane svelte-1o1t5ba"),ne(u,"class","diff-pane-header svelte-1o1t5ba"),ne(d,"class","diff-lines-inner svelte-1o1t5ba"),ne(h,"class","diff-scroll-area svelte-1o1t5ba"),ne(c,"class","diff-pane svelte-1o1t5ba"),ne(e,"class","diff-split svelte-1o1t5ba")},m(k,E){pe(k,e,E),H(e,n),H(n,r),H(n,i),H(n,s),H(s,o);for(let v=0;v<b.length;v+=1)b[v]&&b[v].m(o,null);H(e,l),H(e,c),H(c,u),H(c,f),H(c,h),H(h,d);for(let v=0;v<D.length;v+=1)D[v]&&D[v].m(d,null);g||(y=[Dc(a=t[6].call(null,s)),Dc(p=t[7].call(null,h))],g=!0)},p(k,E){if(E&32){w=tn(k[5]);let v;for(v=0;v<w.length;v+=1){let _=lM(k,w,v);b[v]?b[v].p(_,E):(b[v]=fM(_),b[v].c(),b[v].m(o,null))}for(;v<b.length;v+=1)b[v].d(1);b.length=w.length}if(E&32){S=tn(k[5]);let v;for(v=0;v<S.length;v+=1){let _=aM(k,S,v);D[v]?D[v].p(_,E):(D[v]=hM(_),D[v].c(),D[v].m(d,null))}for(;v<D.length;v+=1)D[v].d(1);D.length=S.length}},d(k){k&&me(e),fs(b,k),fs(D,k),g=!1,kn(y)}}}function nQ(t){let e=" ",n;return{c(){n=et(e)},m(r,i){pe(r,n,i)},d(r){r&&me(n)}}}function rQ(t){let e;return{c(){e=et("-")},m(n,r){pe(n,e,r)},d(n){n&&me(e)}}}function iQ(t){let e;return{c(){e=et("+")},m(n,r){pe(n,e,r)},d(n){n&&me(e)}}}function uM(t){let e,n,r=(t[24].oldLineNum??"")+"",i,s,o,a=(t[24].newLineNum??"")+"",l,c,u,f,h,d=t[24].content+"",p,g;function y(S,D){return S[24].type==="added"?iQ:S[24].type==="removed"?rQ:nQ}let w=y(t,-1),b=w(t);return{c(){e=X("div"),n=X("span"),i=et(r),s=we(),o=X("span"),l=et(a),c=we(),u=X("span"),b.c(),f=we(),h=X("span"),p=et(d),g=we(),ne(n,"class","line-num svelte-1o1t5ba"),ne(o,"class","line-num svelte-1o1t5ba"),ne(u,"class","line-indicator svelte-1o1t5ba"),ne(h,"class","line-content svelte-1o1t5ba"),ne(e,"class","diff-line svelte-1o1t5ba"),Ft(e,"added",t[24].type==="added"),Ft(e,"removed",t[24].type==="removed")},m(S,D){pe(S,e,D),H(e,n),H(n,i),H(e,s),H(e,o),H(o,l),H(e,c),H(e,u),b.m(u,null),H(e,f),H(e,h),H(h,p),H(e,g)},p(S,D){D&16&&r!==(r=(S[24].oldLineNum??"")+"")&&yt(i,r),D&16&&a!==(a=(S[24].newLineNum??"")+"")&&yt(l,a),w!==(w=y(S,D))&&(b.d(1),b=w(S),b&&(b.c(),b.m(u,null))),D&16&&d!==(d=S[24].content+"")&&yt(p,d),D&16&&Ft(e,"added",S[24].type==="added"),D&16&&Ft(e,"removed",S[24].type==="removed")},d(S){S&&me(e),b.d()}}}function fM(t){let e,n,r=(t[19].leftLineNum??"")+"",i,s,o,a=t[19].left?.type==="removed"?"-":" ",l,c,u,f=(t[19].left?.content??"")+"",h,d;return{c(){e=X("div"),n=X("span"),i=et(r),s=we(),o=X("span"),l=et(a),c=we(),u=X("span"),h=et(f),d=we(),ne(n,"class","line-num svelte-1o1t5ba"),ne(o,"class","line-indicator svelte-1o1t5ba"),ne(u,"class","line-content svelte-1o1t5ba"),ne(e,"class","diff-line svelte-1o1t5ba"),Ft(e,"removed",t[19].left?.type==="removed"),Ft(e,"empty",t[19].left===null)},m(p,g){pe(p,e,g),H(e,n),H(n,i),H(e,s),H(e,o),H(o,l),H(e,c),H(e,u),H(u,h),H(e,d)},p(p,g){g&32&&r!==(r=(p[19].leftLineNum??"")+"")&&yt(i,r),g&32&&a!==(a=p[19].left?.type==="removed"?"-":" ")&&yt(l,a),g&32&&f!==(f=(p[19].left?.content??"")+"")&&yt(h,f),g&32&&Ft(e,"removed",p[19].left?.type==="removed"),g&32&&Ft(e,"empty",p[19].left===null)},d(p){p&&me(e)}}}function hM(t){let e,n,r=(t[19].rightLineNum??"")+"",i,s,o,a=t[19].right?.type==="added"?"+":" ",l,c,u,f=(t[19].right?.content??"")+"",h,d;return{c(){e=X("div"),n=X("span"),i=et(r),s=we(),o=X("span"),l=et(a),c=we(),u=X("span"),h=et(f),d=we(),ne(n,"class","line-num svelte-1o1t5ba"),ne(o,"class","line-indicator svelte-1o1t5ba"),ne(u,"class","line-content svelte-1o1t5ba"),ne(e,"class","diff-line svelte-1o1t5ba"),Ft(e,"added",t[19].right?.type==="added"),Ft(e,"empty",t[19].right===null)},m(p,g){pe(p,e,g),H(e,n),H(n,i),H(e,s),H(e,o),H(o,l),H(e,c),H(e,u),H(u,h),H(e,d)},p(p,g){g&32&&r!==(r=(p[19].rightLineNum??"")+"")&&yt(i,r),g&32&&a!==(a=p[19].right?.type==="added"?"+":" ")&&yt(l,a),g&32&&f!==(f=(p[19].right?.content??"")+"")&&yt(h,f),g&32&&Ft(e,"added",p[19].right?.type==="added"),g&32&&Ft(e,"empty",p[19].right===null)},d(p){p&&me(e)}}}function sQ(t){let e,n,r,i,s,o,a,l,c,u,f,h,d,p,g,y,w,b,S,D,k,E,v=t[0]&&cM(t);function _(P,N){return P[1]==="split"?tQ:eQ}let C=_(t,-1),A=C(t);return{c(){e=X("div"),n=X("div"),r=X("div"),i=X("span"),s=X("span"),o=et("+"),a=et(t[3]),l=we(),c=X("span"),u=et("-"),f=et(t[2]),h=we(),v&&v.c(),d=we(),p=X("div"),g=X("button"),g.textContent="Split",y=we(),w=X("button"),w.textContent="Unified",b=we(),A.c(),S=we(),D=X("div"),D.textContent=`Differences between your local file and the published file. Content may
|
||
differ slightly due to plugin processing.`,ne(s,"class","additions svelte-1o1t5ba"),ne(c,"class","deletions svelte-1o1t5ba"),ne(i,"class","diff-stats svelte-1o1t5ba"),ne(r,"class","diff-info svelte-1o1t5ba"),ne(g,"class","view-toggle svelte-1o1t5ba"),Ft(g,"active",t[1]==="split"),ne(w,"class","view-toggle svelte-1o1t5ba"),Ft(w,"active",t[1]==="unified"),ne(p,"class","diff-controls svelte-1o1t5ba"),ne(n,"class","diff-header svelte-1o1t5ba"),ne(D,"class","diff-footer svelte-1o1t5ba"),ne(e,"class","quartz-syncer-diff-view diff-view-wrapper svelte-1o1t5ba")},m(P,N){pe(P,e,N),H(e,n),H(n,r),H(r,i),H(i,s),H(s,o),H(s,a),H(i,l),H(i,c),H(c,u),H(c,f),H(r,h),v&&v.m(r,null),H(n,d),H(n,p),H(p,g),H(p,y),H(p,w),H(e,b),A.m(e,null),H(e,S),H(e,D),k||(E=[un(g,"click",t[12]),un(w,"click",t[13])],k=!0)},p(P,[N]){N&8&&yt(a,P[3]),N&4&&yt(f,P[2]),P[0]?v?v.p(P,N):(v=cM(P),v.c(),v.m(r,null)):v&&(v.d(1),v=null),N&2&&Ft(g,"active",P[1]==="split"),N&2&&Ft(w,"active",P[1]==="unified"),C===(C=_(P,N))&&A?A.p(P,N):(A.d(1),A=C(P),A&&(A.c(),A.m(e,S)))},i:He,o:He,d(P){P&&me(e),v&&v.d(),A.d(),k=!1,kn(E)}}}function oQ(t){let e=[],n=1,r=1;for(let i of t){let s=i.value.replace(/\n$/,"").split(`
|
||
`);if(i.added)for(let o of s){let a=e[e.length-1];a&&a.right===null?(a.right={content:o,type:"added"},a.rightLineNum=r++):e.push({left:null,right:{content:o,type:"added"},leftLineNum:null,rightLineNum:r++})}else if(i.removed)for(let o of s)e.push({left:{content:o,type:"removed"},right:null,leftLineNum:n++,rightLineNum:null});else for(let o of s)e.push({left:{content:o,type:"unchanged"},right:{content:o,type:"unchanged"},leftLineNum:n++,rightLineNum:r++})}return e}function aQ(t){let e=[],n=1,r=1;for(let i of t){let s=i.value.replace(/\n$/,"").split(`
|
||
`);for(let o of s)i.added?e.push({content:o,type:"added",oldLineNum:null,newLineNum:r++}):i.removed?e.push({content:o,type:"removed",oldLineNum:n++,newLineNum:null}):e.push({content:o,type:"unchanged",oldLineNum:n++,newLineNum:r++})}return e}function lQ(t,e,n){let r,i,s,o,a,{oldContent:l}=e,{newContent:c}=e,{fileName:u=""}=e,{defaultViewStyle:f="auto"}=e;function h(){return f==="split"?"split":f==="unified"||dM.Platform.isMobile?"unified":"split"}let d=h(),p=null,g=null,y=!1;function w(E,v){y||(y=!0,v.scrollTop=E.scrollTop,v.scrollLeft=E.scrollLeft,requestAnimationFrame(()=>{y=!1}))}function b(E){p=E;let v=()=>{g&&w(E,g)};return E.addEventListener("scroll",v),{destroy(){E.removeEventListener("scroll",v),p=null}}}function S(E){g=E;let v=()=>{p&&w(E,p)};return E.addEventListener("scroll",v),{destroy(){E.removeEventListener("scroll",v),g=null}}}let D=()=>n(1,d="split"),k=()=>n(1,d="unified");return t.$$set=E=>{"oldContent"in E&&n(8,l=E.oldContent),"newContent"in E&&n(9,c=E.newContent),"fileName"in E&&n(0,u=E.fileName),"defaultViewStyle"in E&&n(10,f=E.defaultViewStyle)},t.$$.update=()=>{t.$$.dirty&768&&n(11,r=x1(l,c)),t.$$.dirty&2048&&n(5,i=oQ(r)),t.$$.dirty&2048&&n(4,s=aQ(r)),t.$$.dirty&2048&&n(3,o=r.filter(E=>E.added).reduce((E,v)=>E+v.count,0)),t.$$.dirty&2048&&n(2,a=r.filter(E=>E.removed).reduce((E,v)=>E+v.count,0))},[u,d,a,o,s,i,b,S,l,c,f,r,D,k]}var S1=class extends ur{constructor(e){super(),Mi(this,e,lQ,sQ,Ni,{oldContent:8,newContent:9,fileName:0,defaultViewStyle:10},X7)}},mM=S1;var Wp=class{modal;settings;publishStatusManager;publisher;siteManager;vault;publicationCenterUi;constructor(e,n,r,i,s){this.modal=new Ia.Modal(e),this.settings=s,this.publishStatusManager=n,this.publisher=r,this.siteManager=i,this.vault=e.vault,this.modal.titleEl.createSpan({text:"Publication center"}).prepend(this.getIcon("leaf")),this.modal.titleEl.addClass("quartz-syncer-modal-title"),this.modal.contentEl.addClass("quartz-syncer-modal-content")}getIcon(e){let n=(0,Ia.getIcon)(e)??activeDocument.createSpan();return n instanceof SVGSVGElement&&n.addClass("quartz-syncer-svg-icon"),n}showDiff=async e=>{try{let n,r,i,s;this.settings.useCache&&(await this.publisher.datastore.loadRemoteFile(e),r=n?n[0]:void 0),(!n||!this.settings.useCache)&&(r=await this.siteManager.getNoteContent(e));let o="";if(this.settings.vaultPath!=="/"&&this.settings.vaultPath!==""?o=this.settings.vaultPath+e:o=e,this.settings.useCache)i=await this.publisher.datastore.loadLocalFile(o),s=i?i[0]:void 0;else if(i=this.vault.getFileByPath(o),!(i instanceof Ia.TFile))s="";else{if(i=await this.publisher.compiler.generateMarkdown(new oa({file:i,vault:this.vault,compiler:this.publisher.compiler,datastore:this.publisher.datastore,metadataCache:this.publisher.metadataCache,settings:this.settings})),!i)throw new Error(`Failed to compile local file: ${o}. Compiler returned null.`);s=i[0]}if(r&&s){let a,l=new Ia.Modal(this.modal.app),c=e.split("/").pop()||"Diff";l.modalEl.addClass("quartz-syncer-diff-modal"),l.titleEl.createSpan({text:`${c}`}).prepend(this.getIcon("file-diff")),l.onOpen=()=>{a=new mM({target:l.contentEl,props:{oldContent:r,newContent:s,fileName:c,defaultViewStyle:this.settings.diffViewStyle}})},l.onClose=()=>{a&&a.$destroy()},l.open()}}catch(n){console.error(n)}};open=()=>{this.modal.onClose=()=>{this.publicationCenterUi.$destroy()},this.modal.onOpen=()=>{this.modal.contentEl.empty(),this.publicationCenterUi=new iM({target:this.modal.contentEl,props:{publishStatusManager:this.publishStatusManager,publisher:this.publisher,showDiff:this.showDiff,close:()=>{this.modal.close()}}})},this.modal.open()}};m();var fr=class{siteManager;publisher;constructor(e,n){this.siteManager=e,this.publisher=n}getDeletedNotePaths(){throw new Error("Method not implemented.")}getDeletedBlobsPaths(){throw new Error("Method not implemented.")}generateDeletedContentPaths(e,n){let r=new Set(n),i=l=>l.endsWith(".js"),s=l=>r.has(l);return Object.keys(e).filter(l=>!i(l)&&!s(l)).map(l=>({path:l,sha:e[l]}))}async getPublishStatus(e){let n=[],r=[],i=[],s=[],o=[];e&&(e.setText("Retrieving publish status..."),e.setProgress(0));let a=await this.siteManager.userSyncerConnection.getContent("HEAD");if(!a)throw new Error("Could not get content tree from base garden");let l=await this.siteManager.getNoteHashes(a),c=await this.siteManager.getBlobHashes(a),u=Object.entries(c);if(this.publisher.settings.useCache){await this.publisher.datastore.preloadCache();let g=u.filter(([D,k])=>k?D.endsWith(".md")||this.publisher.settings.useBases&&D.endsWith(".base")||this.publisher.settings.useCanvas&&D.endsWith(".canvas"):!1),y=g.length,w=y.toString().length,b=0,S=await this.siteManager.getAllNoteContents();await My(g,async([D,k])=>{b++,e&&(e.setProgress(Math.floor(b/y*100)),e.setIndexText(`Syncing remote cache: ${b.toString().padStart(w)}/${y}`),e.setText(`Processing ${D}...`));let E=await this.publisher.datastore.loadRemoteHash(D);if(E&&E===k||!this.publisher.vault.getFileByPath(D))return;let v=S.get(D)??"";if(!v)return;let _=await this.publisher.datastore.getTime(D)??Date.now();await this.publisher.datastore.storeRemoteFile(D,_,[v,{blobs:[]}]),await this.publisher.datastore.storeRemoteHash(D,_,k)},10),e&&(e.setText("Syncing cache to disk..."),e.setProgress(0)),await this.publisher.datastore.flushCache(e)}e&&(e.setText("Loading published notes..."),e.setProgress(100));let f=await this.publisher.getFilesMarkedForPublishing();this.publisher.settings.useCache&&(await this.publisher.datastore.synchronize(f.notes.map(g=>g.getPath())),this.publisher.settings.syncCache&&await this.publisher.plugin.compareDataToCache()),e&&(e.setText("Compiling notes..."),e.setProgress(0));let h=f.notes.length,d=h.toString().length,p=0;try{await My(f.notes,async g=>{p++,e&&(e.setProgress(Math.floor(p/h*100)),e.setIndexText(`Compiling: ${p.toString().padStart(d)}/${h}`),e.setText(`Compiling ${g.getVaultPath()}...`));let y=await g.compile(),[w]=y.getCompiledFile(),b=await nl(w),S=l[g.getVaultPath()];S?S===b?(y.setRemoteHash(S),r.push(y)):(y.setRemoteHash(S),i.push(y)):n.push(y)},10)}finally{e&&(e.setText("Saving compiled cache to disk..."),e.setProgress(0)),await this.publisher.datastore.flushCache(e),this.publisher.datastore.clearMemoryCache()}return s.push(...this.generateDeletedContentPaths(l,f.notes.map(g=>g.getVaultPath()))),o.push(...this.generateDeletedContentPaths(c,f.blobs)),r.sort((g,y)=>g.compare(y)),i.sort((g,y)=>g.compare(y)),s.sort((g,y)=>g.path.localeCompare(y.path)),{unpublishedNotes:n,publishedNotes:r,changedNotes:i,deletedNotePaths:s,deletedBlobPaths:o}}};m();var lo=class{metadataCache;file;vault;fileManager;generatedFrontMatter={};constructor(e,n,r,i){this.metadataCache=n,this.vault=e,this.file=r,this.fileManager=i}set(e,n){return this.generatedFrontMatter[e]=n,this}remove(e){return this.generatedFrontMatter[e]=void 0,this}get(e){return this.getFrontMatterSnapshot()[e]}async apply(){let e=this.getFrontMatterSnapshot();await this.fileManager.processFrontMatter(this.file,n=>{for(let r of Object.keys(e))n[r]=e[r]})}getFrontMatterSnapshot(){let e={...this.metadataCache.getCache(this.file?.path)?.frontmatter};return delete e.position,{...e,...this.generatedFrontMatter}}};m();m();var vM="3.7.7",cQ=vM,Tc=typeof x=="function",pM=typeof TextDecoder=="function"?new TextDecoder:void 0,gM=typeof TextEncoder=="function"?new TextEncoder:void 0,uQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",gh=Array.prototype.slice.call(uQ),Gp=(t=>{let e={};return t.forEach((n,r)=>e[n]=r),e})(gh),fQ=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,nn=String.fromCharCode.bind(String),yM=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),kM=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),xM=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),SM=t=>{let e,n,r,i,s="",o=t.length%3;for(let a=0;a<t.length;){if((n=t.charCodeAt(a++))>255||(r=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=n<<16|r<<8|i,s+=gh[e>>18&63]+gh[e>>12&63]+gh[e>>6&63]+gh[e&63]}return o?s.slice(0,o-3)+"===".substring(o):s},_1=typeof btoa=="function"?t=>btoa(t):Tc?t=>x.from(t,"binary").toString("base64"):SM,D1=Tc?t=>x.from(t).toString("base64"):t=>{let n=[];for(let r=0,i=t.length;r<i;r+=4096)n.push(nn.apply(null,t.subarray(r,r+4096)));return _1(n.join(""))},Qp=(t,e=!1)=>e?kM(D1(t)):D1(t),hQ=t=>{if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?nn(192|e>>>6)+nn(128|e&63):nn(224|e>>>12&15)+nn(128|e>>>6&63)+nn(128|e&63)}else{var e=65536+(t.charCodeAt(0)-55296)*1024+(t.charCodeAt(1)-56320);return nn(240|e>>>18&7)+nn(128|e>>>12&63)+nn(128|e>>>6&63)+nn(128|e&63)}},dQ=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,DM=t=>t.replace(dQ,hQ),wM=Tc?t=>x.from(t,"utf8").toString("base64"):gM?t=>D1(gM.encode(t)):t=>_1(DM(t)),Cc=(t,e=!1)=>e?kM(wM(t)):wM(t),bM=t=>Cc(t,!0),mQ=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,pQ=t=>{switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),n=e-65536;return nn((n>>>10)+55296)+nn((n&1023)+56320);case 3:return nn((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return nn((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},EM=t=>t.replace(mQ,pQ),_M=t=>{if(t=t.replace(/\s+/g,""),!fQ.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(t.length&3));let e,n="",r,i;for(let s=0;s<t.length;)e=Gp[t.charAt(s++)]<<18|Gp[t.charAt(s++)]<<12|(r=Gp[t.charAt(s++)])<<6|(i=Gp[t.charAt(s++)]),n+=r===64?nn(e>>16&255):i===64?nn(e>>16&255,e>>8&255):nn(e>>16&255,e>>8&255,e&255);return n},C1=typeof atob=="function"?t=>atob(xM(t)):Tc?t=>x.from(t,"base64").toString("binary"):_M,CM=Tc?t=>yM(x.from(t,"base64")):t=>yM(C1(t).split("").map(e=>e.charCodeAt(0))),TM=t=>CM(FM(t)),gQ=Tc?t=>x.from(t,"base64").toString("utf8"):pM?t=>pM.decode(CM(t)):t=>EM(C1(t)),FM=t=>xM(t.replace(/[-_]/g,e=>e=="-"?"+":"/")),E1=t=>gQ(FM(t)),yQ=t=>{if(typeof t!="string")return!1;let e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},IM=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),AM=function(){let t=(e,n)=>Object.defineProperty(String.prototype,e,IM(n));t("fromBase64",function(){return E1(this)}),t("toBase64",function(e){return Cc(this,e)}),t("toBase64URI",function(){return Cc(this,!0)}),t("toBase64URL",function(){return Cc(this,!0)}),t("toUint8Array",function(){return TM(this)})},OM=function(){let t=(e,n)=>Object.defineProperty(Uint8Array.prototype,e,IM(n));t("toBase64",function(e){return Qp(this,e)}),t("toBase64URI",function(){return Qp(this,!0)}),t("toBase64URL",function(){return Qp(this,!0)})},wQ=()=>{AM(),OM()},Rr={version:vM,VERSION:cQ,atob:C1,atobPolyfill:_M,btoa:_1,btoaPolyfill:SM,fromBase64:E1,toBase64:Cc,encode:Cc,encodeURI:bM,encodeURL:bM,utob:DM,btou:EM,decode:E1,isValid:yQ,fromUint8Array:Qp,toUint8Array:TM,extendString:AM,extendUint8Array:OM,extendBuiltins:wQ};m();var PM=it(vt()),yh=PM.default.get("quartz-version-detector"),bQ="quartz.config.yaml",vQ="quartz.plugins.json",kQ="quartz.config.ts",xQ="package.json",ai=class t{static async detectQuartzVersion(e){return await t.fileExists(e,bQ)?(yh.info("Detected Quartz v5 (YAML config)"),"v5-yaml"):await t.fileExists(e,vQ)?(yh.info("Detected Quartz v5 (legacy JSON config)"),"v5-json"):await t.fileExists(e,kQ)?(yh.info("Detected Quartz v4 (TypeScript config)"),"v4"):(yh.info("No Quartz configuration detected"),"unknown")}static async getQuartzPackageVersion(e){try{let n=await e.getRawFile(xQ);if(!n)return null;let r=Rr.decode(n.content);return JSON.parse(r).version??null}catch(n){return yh.warn("Could not read package.json version",n),null}}static async fileExists(e,n){try{return await e.getRawFile(n)!==void 0}catch{return!1}}};m();Ek();var XR=it(vt()),_k=XR.default.get("quartz-config-service"),ZR="quartz.config.yaml",YR="quartz.plugins.json",JR="quartz.lock.json",rK="yaml-language-server: $schema=./quartz/plugins/quartz-plugins.schema.json",So=class{repo;yamlDocument=null;configFormat=null;constructor(e){this.repo=e}async readConfig(){let{content:e,format:n}=await this.readRawConfig();return this.configFormat=n,n==="json"?JSON.parse(e):(this.yamlDocument=Wc(e,{keepSourceTokens:!0}),this.yamlDocument.toJSON())}serializeConfig(e){if(this.configFormat==="json")return JSON.stringify(e,null,2)+`
|
||
`;if(this.yamlDocument)return this.yamlDocument.set("configuration",e.configuration),this.yamlDocument.set("plugins",e.plugins),e.layout?this.yamlDocument.set("layout",e.layout):this.yamlDocument.delete("layout"),this.ensureSchemaComment(this.yamlDocument),this.yamlDocument.toString();let n=new gr(e);return this.ensureSchemaComment(n),n.toString()}async writeConfig(e,n="Update Quartz configuration via Syncer"){let r=this.serializeConfig(e),i=this.configFormat==="json"?YR:ZR,s=new Map;s.set(i,r),await this.repo.writeRawFiles(s,n)}async readLockFile(){try{let e=await this.repo.getRawFile(JR);if(!e)return null;let n=Rr.decode(e.content);return JSON.parse(n)}catch(e){return _k.debug("Could not read lock file",e),null}}async writeLockFile(e,n="Update plugin lock file via Syncer"){let r=JSON.stringify(e,null,2)+`
|
||
`,i=new Map;i.set(JR,r),await this.repo.writeRawFiles(i,n)}getConfigFormat(){return this.configFormat}getRawYamlDocument(){return this.yamlDocument}async readRawConfig(){try{let e=await this.repo.getRawFile(ZR);if(e)return{content:Rr.decode(e.content),format:"yaml"}}catch{_k.debug("No YAML config found, trying JSON fallback")}try{let e=await this.repo.getRawFile(YR);if(e)return{content:Rr.decode(e.content),format:"json"}}catch{_k.debug("No JSON config found either")}throw new Error("No Quartz v5 configuration file found. Expected quartz.config.yaml or quartz.plugins.json.")}ensureSchemaComment(e){e.toString().includes("yaml-language-server")||(e.commentBefore=rK)}};var Sn=class{settings;metadataCache;baseSyncerConnection;userSyncerConnection;quartzVersion=null;configService=null;constructor(e,n,r){this.settings=n,this.metadataCache=e,this.baseSyncerConnection=new rt({gitSettings:{remoteUrl:"https://github.com/jackyzha0/quartz.git",branch:"v4",auth:{type:"none"}},contentFolder:"content",vaultPath:"/"}),this.userSyncerConnection=new rt({gitSettings:r,contentFolder:n.contentFolder,vaultPath:n.vaultPath})}async getNoteContent(e){e.startsWith("/")&&(e=e.substring(1));let n=await this.userSyncerConnection.getFile(`${this.settings.contentFolder}/${e}`);return n?Rr.decode(n.content):""}async getAllNoteContents(){let e=await this.userSyncerConnection.getAllBlobContents(this.settings.contentFolder),n=new Map,r=this.settings.contentFolder;for(let[i,s]of e){let o=i.replace(r,"");o.startsWith("/")&&(o=o.substring(1)),n.set(o,s)}return n}async getNoteHashes(e){let n=e.tree,r=o=>o.endsWith(".md")||this.settings.useBases&&o.endsWith(".base")||this.settings.useCanvas&&o.endsWith(".canvas"),i=n.filter(o=>typeof o.path=="string"&&o.path.startsWith(this.settings.contentFolder)&&o.type==="blob"&&r(o.path)),s={};for(let o of i){let a=o.path.replace(this.settings.contentFolder,""),l=a.startsWith("/")?a.substring(1):a;s[l]=o.oid}return s}async getBlobHashes(e){let r=(e.tree??[]).filter(s=>typeof s.path=="string"&&s.path.startsWith(this.settings.contentFolder)&&s.type==="blob"),i={};for(let s of r){let o=s.path.replace(this.settings.contentFolder,""),a=o.startsWith("/")?o.substring(1):o;i[a]=s.oid}return i}async getQuartzVersion(){return this.quartzVersion||(this.quartzVersion=await ai.detectQuartzVersion(this.userSyncerConnection)),this.quartzVersion}async getConfigService(){let e=await this.getQuartzVersion();return e!=="v5-yaml"&&e!=="v5-json"?null:(this.configService||(this.configService=new So(this.userSyncerConnection)),this.configService)}isQuartzV5(){return this.quartzVersion==="v5-yaml"||this.quartzVersion==="v5-json"}};m();var pz=require("obsidian");m();var Gh=require("obsidian");m();var $t=require("obsidian");m();var jg=require("obsidian"),Ug=class extends jg.AbstractInputSuggest{folders;inputEl;constructor(e,n){super(e,n),this.inputEl=n,this.folders=this.app.vault.getAllFolders(!0).map(r=>(0,jg.normalizePath)(r.path))}getSuggestions(e){let n=e.toLowerCase();return this.folders.filter(r=>r.toLowerCase().includes(n))}renderSuggestion(e,n){n.setText(e)}selectSuggestion(e){this.inputEl.value=e;let n=new Event("input");this.inputEl.dispatchEvent(n),this.close()}};m();var ez=it(vt()),za=ez.default.get("secret-storage-service"),Ck="quartz-syncer-git-token",Gc=class{secretStorage;cachedToken=null;constructor(e){this.secretStorage=e.secretStorage}getToken(){if(this.cachedToken!==null)return this.cachedToken;let e=this.secretStorage.getSecret(Ck);return this.cachedToken=e,e}setToken(e){if(!e){za.warn("Attempted to store empty token");return}this.secretStorage.setSecret(Ck,e),this.cachedToken=e,za.info("Git authentication token stored in secure storage")}clearToken(){this.secretStorage.setSecret(Ck,""),this.cachedToken=null,za.info("Git authentication token cleared from secure storage")}hasToken(){let e=this.getToken();return e!==null&&e!==""}async migrateFromSettings(e,n){let r=e.git?.auth?.secret;if(!r)return za.debug("No legacy token found in settings, skipping migration"),!1;let i=this.getToken();return i&&i!==""?(za.debug("Token already exists in secure storage, skipping migration"),e.git?.auth?.secret&&(e.git.auth.secret=void 0,await n(),za.info("Cleared legacy token from settings (secure storage already has token)")),!1):(this.setToken(r),e.git.auth.secret=void 0,await n(),za.info("Successfully migrated Git authentication token from settings to secure storage"),!0)}listSecrets(){return this.secretStorage.listSecrets().filter(n=>n.startsWith("quartz-syncer-"))}};var qg=class extends $t.PluginSettingTab{app;plugin;settings;readStatus;writeStatus;settingsRootElement;readStatusElement;writeStatusElement;remoteBranches=[];defaultBranch=null;branchSettingEl=null;branchesLoaded=!1;secretStorageService;constructor(e,n,r,i){super(e,n),this.app=e,this.plugin=n,this.settings=r,this.settingsRootElement=i,this.settingsRootElement.classList.add("settings-tab-content"),this.readStatus="loading",this.writeStatus="loading",this.secretStorageService=new Gc(e),this.readStatusElement=createSpan({text:"pending..."}),this.writeStatusElement=createSpan({text:"pending..."})}display(){this.settingsRootElement.empty(),this.settingsRootElement.addClass("quartz-syncer-github-settings"),this.branchSettingEl=null,this.initializeGitHeader(),this.initializeRemoteUrlSetting(),this.initializeBranchSetting(),this.initializeProviderHintSetting(),this.initializeAuthTypeSetting(),this.initializeUsernameSetting(),this.initializeSecretSetting(),this.initializeCorsProxySetting(),this.initializeVaultFolderSetting(),this.settings.settings.lastUsedSettingsTab="git",this.settings.plugin.saveSettings()}initializeGitHeader=()=>{this.readStatusElement=createSpan({text:"pending..."}),this.writeStatusElement=createSpan({text:"pending..."}),this.checkConnectionAndSaveSettings();let e=createSpan(),n=e.createSpan();n.appendText(" (read: "),n.append(this.readStatusElement),n.appendText(")"),n.addClass("quartz-syncer-connection-status","quartz-syncer-connection-status-pending");let r=e.createSpan();r.appendText(" (write: "),r.append(this.writeStatusElement),r.appendText(")"),r.addClass("quartz-syncer-connection-status","quartz-syncer-connection-status-pending"),new $t.Setting(this.settingsRootElement).setName("Git Repository").setDesc("Configure your Git remote. Works with GitHub, GitLab, Bitbucket, and self-hosted Git servers.").setHeading().nameEl.append(e)};checkConnectionAndSaveSettings=async()=>{this.settings.plugin.saveSettings(),this.debouncedUpdateConnectionStatus()};updateConnectionStatus=async()=>{let e=this.settings.settings.git;if(!e.remoteUrl){this.readStatus="error",this.writeStatus="error",this.remoteBranches=[],this.defaultBranch=null,this.updateConnectionStatusIndicator();return}let n={...e.auth,secret:this.secretStorageService.getToken()||void 0};try{let{branches:r,defaultBranch:i}=await rt.fetchRemoteBranches(e.remoteUrl,n,e.corsProxyUrl);this.remoteBranches=r,this.defaultBranch=i;let s=this.branchesLoaded;r.length>0?(this.readStatus="connected",this.branchesLoaded=!0,e.branch||(e.branch=i||"v4",await this.settings.plugin.saveSettings()),s||this.refreshBranchSetting()):this.readStatus="error"}catch{this.readStatus="error",this.remoteBranches=[],this.defaultBranch=null}try{let r=await rt.checkWriteAccess(e.remoteUrl,n,e.corsProxyUrl);this.writeStatus=r?"connected":"error"}catch{this.writeStatus="error"}this.updateConnectionStatusIndicator()};refreshBranchSetting(){this.branchSettingEl&&(this.branchSettingEl.empty(),this.initializeBranchSetting())}debouncedUpdateConnectionStatus=(0,$t.debounce)(this.updateConnectionStatus,500,!0);updateConnectionStatusIndicator=()=>{this.applyStatusToElement(this.readStatusElement,this.readStatus),this.applyStatusToElement(this.writeStatusElement,this.writeStatus)};applyStatusToElement(e,n){e.parentElement!==null&&(n==="loading"&&(e.innerText="pending...",e.parentElement.classList.remove("quartz-syncer-connection-status-success","quartz-syncer-connection-status-failed"),e.parentElement.classList.add("quartz-syncer-connection-status-pending")),n==="connected"&&(e.innerText="ok",e.parentElement.classList.remove("quartz-syncer-connection-status-pending","quartz-syncer-connection-status-failed"),e.parentElement.classList.add("quartz-syncer-connection-status-success")),n==="error"&&(e.innerText="failed",e.parentElement.classList.remove("quartz-syncer-connection-status-pending","quartz-syncer-connection-status-success"),e.parentElement.classList.add("quartz-syncer-connection-status-failed")))}initializeRemoteUrlSetting(){new $t.Setting(this.settingsRootElement).setName("Remote URL").setDesc("The full URL of your Git repository (e.g., https://github.com/username/quartz.git)").addText(e=>e.setPlaceholder("https://github.com/username/quartz.git").setValue(this.settings.settings.git.remoteUrl).onChange(async n=>{this.settings.settings.git.remoteUrl=n,this.autoDetectProvider(n),await this.checkConnectionAndSaveSettings()}))}autoDetectProvider(e){let n="custom";try{let r=new URL(e).hostname.toLowerCase();r==="github.com"||r.endsWith(".github.com")?n="github":r==="gitlab.com"||r.endsWith(".gitlab.com")?n="gitlab":r==="bitbucket.org"||r.endsWith(".bitbucket.org")?n="bitbucket":r==="codeberg.org"&&(n="gitea")}catch{n="custom"}this.settings.settings.git.providerHint=n}initializeBranchSetting(){this.branchSettingEl||(this.branchSettingEl=this.settingsRootElement.createDiv());let e=new $t.Setting(this.branchSettingEl).setName("Branch").setDesc("The branch to sync with");this.remoteBranches.length>0?e.addDropdown(n=>{for(let i of this.remoteBranches){let s=i===this.defaultBranch?`${i} (default)`:i;n.addOption(i,s)}let r=this.settings.settings.git.branch;r&&this.remoteBranches.includes(r)?n.setValue(r):this.defaultBranch?(n.setValue(this.defaultBranch),this.settings.settings.git.branch=this.defaultBranch):this.remoteBranches.includes("v4")?(n.setValue("v4"),this.settings.settings.git.branch="v4"):this.remoteBranches.length>0&&(n.setValue(this.remoteBranches[0]),this.settings.settings.git.branch=this.remoteBranches[0]),n.onChange(async i=>{this.settings.settings.git.branch=i,await this.checkConnectionAndSaveSettings()})}):e.addText(n=>n.setPlaceholder("v4").setValue(this.settings.settings.git.branch).onChange(async r=>{this.settings.settings.git.branch=r||"v4",await this.checkConnectionAndSaveSettings()}))}initializeProviderHintSetting(){new $t.Setting(this.settingsRootElement).setName("Provider").setDesc("Select your Git provider for optimized authentication hints").addDropdown(e=>e.addOption("github","GitHub").addOption("gitlab","GitLab").addOption("bitbucket","Bitbucket").addOption("gitea","Gitea / Codeberg").addOption("custom","Custom / Self-hosted").setValue(this.settings.settings.git.providerHint||"github").onChange(async n=>{this.settings.settings.git.providerHint=n,await this.checkConnectionAndSaveSettings()}))}initializeAuthTypeSetting(){new $t.Setting(this.settingsRootElement).setName("Authentication Type").setDesc("How to authenticate with the Git server").addDropdown(e=>e.addOption("basic","Username & Token/Password").addOption("bearer","Bearer Token").addOption("none","None (public repos)").setValue(this.settings.settings.git.auth.type).onChange(async n=>{this.settings.settings.git.auth.type=n,await this.checkConnectionAndSaveSettings(),this.display()}))}initializeUsernameSetting(){if(this.settings.settings.git.auth.type!=="basic")return;let e=this.settings.settings.git.providerHint,n="username",r="Your username for authentication";e==="gitlab"?(n="oauth2 or username",r="Use 'oauth2' for personal access tokens, or your username"):e==="bitbucket"&&(n="x-token-auth or username",r="Use 'x-token-auth' for app passwords, or your username"),new $t.Setting(this.settingsRootElement).setName("Username").setDesc(r).addText(i=>i.setPlaceholder(n).setValue(this.settings.settings.git.auth.username||"").onChange(async s=>{this.settings.settings.git.auth.username=s,await this.checkConnectionAndSaveSettings()}))}initializeSecretSetting(){if(this.settings.settings.git.auth.type==="none")return;let e=this.settings.settings.git.providerHint,n="Access Token",r="Your personal access token or password";e==="github"?r="A GitHub Personal Access Token (classic or fine-grained) with 'Contents' permission":e==="gitlab"?r="A GitLab Personal Access Token with 'read_repository' and 'write_repository' scopes":e==="bitbucket"&&(n="App Password",r="A Bitbucket App Password with repository write access");let i=createFragment();i.createSpan({text:r+". "}),i.createEl("a",{text:"Documentation",href:"https://saberzero1.github.io/quartz-syncer-docs/Settings/Git/Access-Token"});let s=this.secretStorageService.hasToken(),l=new $t.Setting(this.settingsRootElement).setName(n).setDesc(i).controlEl.createDiv({cls:"quartz-syncer-token-container"}),c=l.createSpan({cls:`quartz-syncer-token-status ${s?"quartz-syncer-token-status-set":"quartz-syncer-token-status-unset"}`});c.setText(s?"Token stored securely":"No token set");let u=l.createDiv({cls:"quartz-syncer-token-input-container"}),f=u.createEl("input",{type:"password",cls:"quartz-syncer-token-input",placeholder:s?"Enter new token to replace":"Enter token"}),h=u.createEl("button",{cls:"quartz-syncer-token-toggle clickable-icon",attr:{"aria-label":"Toggle token visibility"}});(0,$t.setIcon)(h,"eye");let d=!1;h.addEventListener("click",w=>{w.preventDefault(),d=!d,f.type=d?"text":"password",(0,$t.setIcon)(h,d?"eye-off":"eye")});let p=l.createDiv({cls:"quartz-syncer-token-buttons"}),g=p.createEl("button",{cls:"mod-cta",text:s?"Update":"Save"}),y=async()=>{let w=f.value.trim();w&&(this.secretStorageService.setToken(w),f.value="",f.placeholder="Enter new token to replace",c.setText("Token stored securely"),c.removeClass("quartz-syncer-token-status-unset"),c.addClass("quartz-syncer-token-status-set"),g.setText("Update"),await this.checkConnectionAndSaveSettings())};if(g.addEventListener("click",()=>{y()}),s){let w=p.createEl("button",{cls:"mod-warning",text:"Clear"}),b=async()=>{this.secretStorageService.clearToken(),f.value="",f.placeholder="Enter token",c.setText("No token set"),c.removeClass("quartz-syncer-token-status-set"),c.addClass("quartz-syncer-token-status-unset"),g.setText("Save"),w.remove(),await this.checkConnectionAndSaveSettings()};w.addEventListener("click",()=>{b()})}}initializeCorsProxySetting(){let e=createFragment();e.createSpan({text:"A CORS proxy URL for browser environments. Required on mobile/web if your Git server doesn't support CORS. "}),e.createEl("a",{text:"Learn more",href:"https://github.com/isomorphic-git/cors-proxy"}),new $t.Setting(this.settingsRootElement).setName("CORS Proxy (optional)").setDesc(e).addText(n=>n.setPlaceholder("https://cors.isomorphic-git.org").setValue(this.settings.settings.git.corsProxyUrl||"").onChange(async r=>{this.settings.settings.git.corsProxyUrl=r||void 0,await this.checkConnectionAndSaveSettings()}))}initializeVaultFolderSetting(){let e=this.settings.app;new $t.Setting(this.settingsRootElement).setName("Vault root folder").setDesc('The folder in your Obsidian vault to sync. Use "/" for the entire vault.').addSearch(n=>{new Ug(e,n.inputEl),n.setPlaceholder("/").setValue(this.settings.settings.vaultPath).onChange(async r=>{r=(0,$t.normalizePath)(r.trim()),r==="/"&&(r=""),this.settings.settings.vaultPath=`${r}/`,await this.checkConnectionAndSaveSettings()})})}};m();var Z=require("obsidian");m();function Hg(t){return typeof t=="object"&&t!==null&&"repo"in t&&typeof t.repo=="string"}function Vn(t){return Hg(t)?t.name?t.name:tz(t.repo):tz(t)}function Dn(t){if(Hg(t)){let e=Vg(t.repo);return t.subdir?`${e}::${t.subdir}`:e}return Vg(t)}function Qc(t){let e=Hg(t)?t.repo:t,n=Vg(e);return n.startsWith("github:")?`https://github.com/${n.slice(7)}.git`:n.startsWith("git+")?n.slice(4):n}function nz(t){if(Hg(t))return t.ref;let e=t.indexOf("#");return e!==-1?t.slice(e+1):void 0}function Vg(t){let e=t.indexOf("#");return e!==-1?t.slice(0,e):t}function tz(t){let e=Vg(t);if(e.startsWith("github:")){let r=e.slice(7),i=r.split("/");return i[i.length-1]||r}if(e.includes("://"))try{let i=new URL(e.replace(/^git\+/,"")).pathname.replace(/\.git$/,""),s=i.split("/").filter(Boolean);return s[s.length-1]||i}catch{}let n=e.split("/").filter(Boolean);return n[n.length-1]||e}m();var Wg=50,La=class{addPlugin(e,n,r){let i=Dn(n);if(e.plugins.find(a=>Dn(a.source)===i))throw new Error(`Plugin "${i}" is already in the configuration.`);let o={source:n,enabled:r?.enabled??!0,order:r?.order??Wg,options:r?.options??{}};return e.plugins.push(o),o}removePlugin(e,n){let r=e.plugins.findIndex(s=>Dn(s.source)===n);if(r===-1)throw new Error(`Plugin "${n}" not found in the configuration.`);let[i]=e.plugins.splice(r,1);return i}findPlugin(e,n){return e.plugins.find(r=>Dn(r.source)===n)}};m();var rz=it(vt()),iK=rz.default.get("quartz-plugin-update-checker"),Do=class{auth;corsProxyUrl;constructor(e,n){this.auth=e,this.corsProxyUrl=n}async checkUpdates(e,n){let r=n?.plugins??{},i=e.map(s=>this.checkSinglePlugin(s,r));return Promise.all(i)}async checkSinglePlugin(e,n){let r=Vn(e.source),s=n[r]?.commit??null;if(!s)return{name:r,sourceKey:r,lockedCommit:null,remoteCommit:null,hasUpdate:!1};try{let o=Qc(e.source),a=nz(e.source)??void 0,l=await rt.fetchRemoteHeadCommit(o,this.auth,a,this.corsProxyUrl);return l?{name:r,sourceKey:r,lockedCommit:s,remoteCommit:l,hasUpdate:l!==s}:{name:r,sourceKey:r,lockedCommit:s,remoteCommit:null,hasUpdate:!1,error:"Could not reach remote"}}catch(o){let a=o instanceof Error?o.message:String(o);return iK.debug(`Update check failed for ${r}`,o),{name:r,sourceKey:r,lockedCommit:s,remoteCommit:null,hasUpdate:!1,error:a}}}};m();var iz=require("obsidian"),sz=it(vt()),Br=sz.default.get("quartz-upgrade-service"),sK="https://raw.githubusercontent.com/jackyzha0/quartz/v5/package.json",Kc="https://github.com/jackyzha0/quartz.git",Zc="v5",Tk={type:"none"},Vh=class{userRepo;constructor(e){this.userRepo=e}async checkForUpgrade(){let e=null;try{e=await ai.getQuartzPackageVersion(this.userRepo)}catch(o){Br.debug("Could not read current Quartz version",o)}let n=null;try{n=await this.fetchUpstreamVersion()}catch(o){let a=o instanceof Error?o.message:String(o);return Br.debug("Could not reach upstream Quartz",o),{currentVersion:e,upstreamVersion:null,hasUpgrade:!1,latestUpstreamSha:null,hasNewerCommits:!1,error:`Could not reach upstream Quartz: ${a}`}}if(!n)return{currentVersion:e,upstreamVersion:null,hasUpgrade:!1,latestUpstreamSha:null,hasNewerCommits:!1,error:"Could not determine upstream Quartz version"};let r=e!==null&&n!==e,i=null;try{i=await rt.fetchRemoteHeadCommit(Kc,Tk,Zc),Br.info(`Upstream HEAD commit: ${i??"null"}`)}catch(o){Br.warn("Could not fetch upstream HEAD commit SHA",o)}let s=!1;if(i){Br.info(`Checking if ${i.slice(0,7)} exists in user repo history`);let o=await this.userRepo.hasCommitInHistory(i);s=!o,Br.info(`Commit ${i.slice(0,7)} ${o?"found":"NOT found"} in user repo`)}else Br.warn("Could not determine upstream HEAD SHA, skipping commit check");return{currentVersion:e,upstreamVersion:n,hasUpgrade:r,latestUpstreamSha:i,hasNewerCommits:s}}async performUpgrade(){try{Br.info("Starting Quartz upgrade from upstream");let e=await this.userRepo.upgradeFromUpstream(Kc,Zc);return e.alreadyMerged?(Br.info("Quartz is already up to date with upstream"),{success:!0,alreadyMerged:!0,oid:e.oid}):(Br.info(`Quartz upgraded successfully to ${e.oid.slice(0,7)}`),{success:!0,oid:e.oid,alreadyMerged:!1})}catch(e){let n=e instanceof Error?e.message:String(e);return n.includes("Merge conflicts in:")||n.includes("MergeNotSupportedError")||n.includes("MergeConflictError")||n.includes("Merges with conflicts")?(Br.warn(`Upgrade aborted: ${n}`),{success:!1,error:`${n}. No changes were made. Run \`npx quartz upgrade\` manually to resolve conflicts.`}):(Br.error("Quartz upgrade failed",e),{success:!1,error:`Upgrade failed: ${n}`})}}async fetchUpstreamVersion(){let e=await(0,iz.requestUrl)({url:sK});return e.status<200||e.status>=300?null:e.json.version??null}};m();var az=it(vt()),oK=az.default.get("quartz-template-service"),oz="quartz/cli/templates",aK=["default","full-width","minimal"],Gg=class{repo;constructor(e){this.repo=e}async listTemplateNames(){return(await this.repo.listDirectory(oz)).filter(n=>n.type==="tree").map(n=>n.name)}async readTemplate(e){let n=`${oz}/${e}/quartz.config.yaml`;try{let r=await this.repo.getRawFile(n);if(!r)return null;let{parseDocument:i}=await Promise.resolve().then(()=>(Ek(),KR)),s=Rr.decode(r.content),a=i(s,{keepSourceTokens:!0}).toJSON();return{name:e,config:a}}catch(r){return oK.debug(`Could not read template ${e}`,r),null}}async getAvailableFrameNames(){let e=await this.listTemplateNames(),n=new Set(aK);for(let r of e)n.add(r);return[...n].sort()}applyTemplate(e,n){e.configuration={...n.config.configuration},e.plugins=[...n.config.plugins],e.layout=n.config.layout?{...n.config.layout}:void 0}};m();var lz=it(vt());var lK=lz.default.get("quartz-plugin-manifest-service");function cK(t){if(typeof t=="string")return t.startsWith("github:")?{url:`https://github.com/${t.replace("github:","").split("#")[0]}.git`}:t.startsWith("git+https://")?{url:t.replace("git+","").split("#")[0]}:t.startsWith("https://")?{url:t.split("#")[0]}:null;let e=t;return e.repo.startsWith("github:")?{url:`https://github.com/${e.repo.replace("github:","").split("#")[0]}.git`,subdir:e.subdir}:{url:e.repo.split("#")[0],subdir:e.subdir}}function uK(t){if(typeof t=="string"){let e=t.indexOf("#");return e>=0?t.slice(e+1):void 0}return t.ref}var Qg=class{auth;corsProxyUrl;cache=new Map;constructor(e,n){this.auth=e,this.corsProxyUrl=n}async fetchManifest(e){let n=typeof e=="string"?e:JSON.stringify(e);if(this.cache.has(n))return this.cache.get(n)??null;let r=cK(e);if(!r)return this.cache.set(n,null),null;try{let i=uK(e);if(!i){let{defaultBranch:f}=await rt.fetchRemoteBranches(r.url,this.auth,this.corsProxyUrl);i=f??"main"}let s=new rt({gitSettings:{remoteUrl:r.url,branch:i,auth:this.auth,corsProxyUrl:this.corsProxyUrl},contentFolder:"content",vaultPath:"/"}),o=r.subdir?`${r.subdir}/package.json`:"package.json",a=await s.getRawFile(o);if(!a)return this.cache.set(n,null),null;let l=Rr.decode(a.content),u=JSON.parse(l).quartz??null;return this.cache.set(n,u),u}catch(i){return lK.debug("Could not fetch plugin manifest",i),this.cache.set(n,null),null}}clearCache(){this.cache.clear()}};m();var uz=require("obsidian"),fz=it(vt()),cz=fz.default.get("quartz-plugin-registry"),fK="https://raw.githubusercontent.com/quartz-community/registry/main/registry.json",Yc=class{cache=null;fetchPromise=null;async getPlugins(){if(this.cache)return this.cache;if(this.fetchPromise)return this.fetchPromise;this.fetchPromise=this.fetchRegistry();try{let e=await this.fetchPromise;return this.cache=e,e}finally{this.fetchPromise=null}}clearCache(){this.cache=null}async fetchRegistry(){try{let e=await(0,uz.requestUrl)({url:fK});return e.status<200||e.status>=300?(cz.warn(`Failed to fetch plugin registry: ${e.status}`),[]):e.json.plugins??[]}catch(e){return cz.warn("Failed to fetch plugin registry:",e),[]}}};m();var Hh=require("obsidian");var dz=it(vt()),hz=dz.default.get("plugin-browser-modal"),Kg=class extends Hh.Modal{registry;config;onInstall;allPlugins=[];searchQuery="";selectedTag="";isLoading=!1;installingPlugins=new Set;constructor(e,n,r,i){super(e),this.registry=n,this.config=r,this.onInstall=i}async onOpen(){this.modalEl.addClass("quartz-syncer-plugin-browser"),this.titleEl.setText("Community Plugin Browser"),this.loadAndRender()}onClose(){this.contentEl.empty()}async loadAndRender(){this.isLoading=!0,this.render();try{this.allPlugins=await this.registry.getPlugins()}catch(e){hz.warn("Failed to load registry",e),this.allPlugins=[]}this.isLoading=!1,this.render()}render(){if(this.contentEl.empty(),this.isLoading){this.contentEl.createEl("p",{text:"Loading plugin registry...",cls:"quartz-syncer-plugin-browser-loading"});return}if(this.allPlugins.length===0){this.contentEl.createEl("p",{text:"Could not load the plugin registry. Check your internet connection and try again."});return}this.renderControls();let e=this.getFilteredPlugins(),n=this.contentEl.createDiv("quartz-syncer-plugin-browser-list");if(e.length===0){n.createEl("p",{text:"No plugins match your search.",cls:"quartz-syncer-plugin-browser-empty"});return}for(let r of e)this.renderPluginCard(n,r)}renderControls(){let e=this.contentEl.createDiv("quartz-syncer-plugin-browser-controls"),n=e.createEl("input",{type:"text",placeholder:"Search plugins...",cls:"quartz-syncer-plugin-browser-search"});n.value=this.searchQuery,n.addEventListener("input",()=>{this.searchQuery=n.value,this.renderList()});let r=this.getAllTags();if(r.length>0){let i=e.createEl("select",{cls:"quartz-syncer-plugin-browser-tag-filter"});i.createEl("option",{text:"All categories",value:""});for(let s of r)i.createEl("option",{text:s,value:s});i.value=this.selectedTag,i.addEventListener("change",()=>{this.selectedTag=i.value,this.renderList()})}}renderList(){let e=this.contentEl.querySelector(".quartz-syncer-plugin-browser-list");e&&e.remove();let n=this.getFilteredPlugins(),r=this.contentEl.createDiv("quartz-syncer-plugin-browser-list");if(n.length===0){r.createEl("p",{text:"No plugins match your search.",cls:"quartz-syncer-plugin-browser-empty"});return}for(let i of n)this.renderPluginCard(r,i)}renderPluginCard(e,n){let r=this.isPluginInstalled(n),i=this.installingPlugins.has(n.name),s=e.createDiv("quartz-syncer-plugin-browser-card"),o=s.createDiv("quartz-syncer-plugin-browser-card-header");o.createSpan({text:n.name,cls:"quartz-syncer-plugin-browser-card-name"}),n.official&&o.createSpan({text:"official",cls:"quartz-syncer-plugin-browser-badge-official"}),s.createEl("p",{text:n.description,cls:"quartz-syncer-plugin-browser-card-desc"});let a=s.createDiv("quartz-syncer-plugin-browser-card-footer"),l=a.createDiv("quartz-syncer-plugin-browser-card-tags");for(let c of n.tags)l.createSpan({text:c,cls:"quartz-syncer-plugin-browser-tag"});if(r)a.createSpan({text:"Installed",cls:"quartz-syncer-plugin-browser-installed"});else{let c=a.createEl("button",{text:i?"Installing...":"Install",cls:"quartz-syncer-plugin-browser-install-btn"});i&&(c.disabled=!0),c.addEventListener("click",()=>{this.handleInstall(n,c)})}}async handleInstall(e,n){if(!this.installingPlugins.has(e.name)){this.installingPlugins.add(e.name),n.textContent="Installing...",n.disabled=!0;try{await this.onInstall(e.source),new Hh.Notice(`Plugin "${e.name}" installed successfully.`),this.render()}catch(r){let i=r instanceof Error?r.message:String(r);hz.warn(`Failed to install ${e.name}`,r),new Hh.Notice(`Failed to install "${e.name}": ${i}`),n.textContent="Install",n.disabled=!1}finally{this.installingPlugins.delete(e.name)}}}isPluginInstalled(e){let n=Dn(e.source);return this.config.plugins.some(r=>Dn(r.source)===n)}getFilteredPlugins(){let e=this.searchQuery.toLowerCase().trim();return this.allPlugins.filter(n=>this.selectedTag&&!n.tags.includes(this.selectedTag)?!1:e?n.name.toLowerCase().includes(e)||n.description.toLowerCase().includes(e)||n.tags.some(r=>r.toLowerCase().includes(e)):!0)}getAllTags(){let e=new Set;for(let n of this.allPlugins)for(let r of n.tags)e.add(r);return[...e].sort()}};var mz=it(vt()),ys=mz.default.get("quartz-v5-settings"),hK=["left","right","beforeBody","afterBody","body"],dK=["all","mobile-only","desktop-only"],mK={light:"#faf8f8",lightgray:"#e5e5e5",gray:"#b8b8b8",darkgray:"#4e4e4e",dark:"#2b2b2b",secondary:"#284b63",tertiary:"#84a59d",highlight:"rgba(143, 159, 169, 0.15)",textHighlight:"#fff23688"},pK={light:"#161618",lightgray:"#393639",gray:"#646464",darkgray:"#d4d4d4",dark:"#ebebec",secondary:"#7b97aa",tertiary:"#84a59d",highlight:"rgba(143, 159, 169, 0.15)",textHighlight:"#fff23688"},gK=["content","folder","tag","canvas","bases","404"],Zg=class extends Z.PluginSettingTab{app;plugin;settings;settingsRootElement;siteManager=null;configService=null;cachedConfig=null;cachedLockFile=null;cachedVersion=null;cachedPackageVersion=null;cachedUpdateStatuses=null;cachedUpgradeStatus=null;cachedTemplateNames=[];cachedTemplates=new Map;templateService=null;manifestService=null;cachedManifests=new Map;expandedPlugins=new Set;pluginRegistry=new Yc;cachedThemesJson=null;isLoading=!1;isSaving=!1;isCheckingUpdates=!1;isCheckingUpgrade=!1;isUpgrading=!1;pluginManager=new La;constructor(e,n,r,i){super(e,n),this.app=e,this.plugin=n,this.settings=r,this.settingsRootElement=i}display(){this.settingsRootElement.empty(),this.settingsRootElement.addClass("quartz-syncer-github-settings"),this.settings.settings.lastUsedSettingsTab="quartz",this.settings.plugin.saveSettings(),this.renderQuartzHeader(),this.renderContentFolderSetting(),this.cachedConfig?this.renderV5Content():(this.renderLoading(),this.loadV5Data())}renderQuartzHeader(){new Z.Setting(this.settingsRootElement).setName("Quartz").setDesc("Quartz Syncer will apply these settings to your Quartz notes.").setHeading()}renderContentFolderSetting(){new Z.Setting(this.settingsRootElement).setName("Content folder").setDesc('The folder in your Quartz repository where Quartz Syncer should store your notes. By default "content".').addText(e=>e.setPlaceholder("content").setValue(this.settings.settings.contentFolder).onChange(async n=>{this.settings.settings.contentFolder=(0,Z.normalizePath)(n),await this.settings.plugin.saveSettings()}))}renderLoading(){new Z.Setting(this.settingsRootElement).setName("v5 Configuration").setDesc("Loading configuration from repository...")}renderNonV5Message(){new Z.Setting(this.settingsRootElement).setName("Quartz v5 not detected").setDesc("Your Quartz site uses the v4 configuration format. Run `npx quartz migrate` in your repository to enable plugin management from Obsidian.")}renderError(e){new Z.Setting(this.settingsRootElement).setName("Error").setDesc(e).addButton(n=>n.setButtonText("Retry").onClick(()=>{this.resetCache(),this.display()}))}async loadV5Data(){if(!this.isLoading){this.isLoading=!0;try{let e=this.getOrCreateSiteManager(),n=await e.getQuartzVersion();if(this.cachedVersion=n,n!=="v5-yaml"&&n!=="v5-json"){this.renderNonV5Message(),this.isLoading=!1;return}if(this.configService=await e.getConfigService(),!this.configService){this.renderError("Could not initialize config service for this repository."),this.isLoading=!1;return}this.templateService=new Gg(e.userSyncerConnection);let r=this.plugin.getGitSettingsWithSecret();this.manifestService=new Qg(r.auth,r.corsProxyUrl);let[i,s,o,a]=await Promise.all([this.configService.readConfig(),this.configService.readLockFile(),this.loadPackageVersion(e),this.templateService.listTemplateNames()]);this.cachedConfig=i,this.cachedLockFile=s,this.cachedPackageVersion=o,this.cachedTemplateNames=a,this.display(),this.settings.settings.upgradeCheckStrategy==="commit"&&!this.settings.settings.lastUpstreamCommitSha&&this.checkForQuartzUpgrade()}catch(e){let n=e instanceof Error?e.message:String(e);ys.warn("Failed to load Quartz v5 config",e),this.renderError(n)}finally{this.isLoading=!1}}}async loadPackageVersion(e){try{return await ai.getQuartzPackageVersion(e.userSyncerConnection)}catch{return null}}getOrCreateSiteManager(){return this.siteManager||(this.siteManager=new Sn(this.app.metadataCache,this.settings.settings,this.plugin.getGitSettingsWithSecret())),this.siteManager}resetCache(){this.cachedConfig=null,this.cachedLockFile=null,this.cachedVersion=null,this.cachedPackageVersion=null,this.cachedUpdateStatuses=null,this.cachedUpgradeStatus=null,this.cachedTemplateNames=[],this.cachedTemplates=new Map,this.cachedManifests=new Map,this.expandedPlugins=new Set,this.templateService=null,this.manifestService=null,this.configService=null,this.siteManager=null}markDirty(){}async saveConfig(){if(!(!this.cachedConfig||!this.configService||this.isSaving)){this.isSaving=!0;try{await this.configService.writeConfig(this.cachedConfig),new Z.Notice("Quartz configuration saved and pushed.")}catch(e){let n=e instanceof Error?e.message:String(e);ys.warn("Failed to save Quartz config",e),new Z.Notice(`Failed to save configuration: ${n}`)}finally{this.isSaving=!1}}}renderV5Content(){this.renderVersionSection(),this.renderUpgradeSection(),this.renderTemplateSection(),this.renderSiteConfigSection(),this.renderPluginListSection(),this.renderLayoutSection()}renderVersionSection(){new Z.Setting(this.settingsRootElement).setName("Quartz v5 Configuration").setDesc("Edit your Quartz v5 site configuration. Changes are pushed to your repository on save.").setHeading();let e=this.cachedPackageVersion?`${this.cachedPackageVersion} (${this.cachedVersion})`:this.cachedVersion??"unknown";new Z.Setting(this.settingsRootElement).setName("Quartz version").setDesc(e);let n=this.cachedVersion==="v5-yaml"?"YAML":"JSON";new Z.Setting(this.settingsRootElement).setName("Configuration format").setDesc(n),new Z.Setting(this.settingsRootElement).addButton(r=>r.setButtonText("Save").onClick(async()=>{await this.saveConfig()})).addButton(r=>r.setButtonText("Refresh").onClick(()=>{this.resetCache(),this.display()}))}renderUpgradeSection(){new Z.Setting(this.settingsRootElement).setName("Quartz Updates").setHeading().addButton(r=>r.setButtonText(this.isCheckingUpgrade?"Checking...":"Check for Quartz updates").setDisabled(this.isCheckingUpgrade).onClick(async()=>{await this.checkForQuartzUpgrade()}));let n=this.settings.settings.upgradeCheckStrategy;if(new Z.Setting(this.settingsRootElement).setName("Update check strategy").setDesc("Version: check for new Quartz releases. Commit: check for any new upstream commits (including unreleased changes).").addDropdown(r=>{r.addOption("version","Version"),r.addOption("commit","Commit"),r.setValue(n).onChange(async i=>{this.settings.settings.upgradeCheckStrategy=i,await this.settings.plugin.saveSettings(),this.cachedUpgradeStatus=null,this.display(),i==="commit"&&!this.settings.settings.lastUpstreamCommitSha&&this.checkForQuartzUpgrade()})}),this.cachedUpgradeStatus){let r=this.cachedUpgradeStatus,i=n==="commit"?r.hasNewerCommits:r.hasUpgrade;if(r.error)new Z.Setting(this.settingsRootElement).setName("Upgrade check failed").setDesc(r.error);else if(i){let s=n==="commit"?`Latest upstream commit: ${r.latestUpstreamSha?.slice(0,7)??"unknown"}.`:`Your Quartz is at ${r.currentVersion??"unknown"}, upstream is at ${r.upstreamVersion??"unknown"}.`;new Z.Setting(this.settingsRootElement).setName(n==="commit"?"New upstream commits available":"Quartz upgrade available").setDesc(s).addButton(a=>a.setButtonText(this.isUpgrading?"Upgrading...":"Upgrade now").setWarning().setDisabled(this.isUpgrading).onClick(async()=>{await this.performQuartzUpgrade()}))}else n==="commit"&&r.latestUpstreamSha?new Z.Setting(this.settingsRootElement).setName("Quartz is up to date").setDesc(`Current upstream commit: ${r.latestUpstreamSha.slice(0,7)}`):new Z.Setting(this.settingsRootElement).setName("Quartz is up to date").setDesc(`Current version: ${r.currentVersion??"unknown"}`)}}async checkForQuartzUpgrade(){if(!this.isCheckingUpgrade){this.isCheckingUpgrade=!0,this.display();try{let e=this.getOrCreateSiteManager(),n=new Vh(e.userSyncerConnection);this.cachedUpgradeStatus=await n.checkForUpgrade(),this.cachedUpgradeStatus.latestUpstreamSha&&!this.cachedUpgradeStatus.hasNewerCommits&&(this.settings.settings.lastUpstreamCommitSha=this.cachedUpgradeStatus.latestUpstreamSha,await this.settings.plugin.saveSettings());let r=this.settings.settings.upgradeCheckStrategy==="commit";(r?this.cachedUpgradeStatus.hasNewerCommits:this.cachedUpgradeStatus.hasUpgrade)?new Z.Notice(r?"New upstream Quartz commits available. Run `npx quartz upgrade` to upgrade.":"A Quartz upgrade is available. Run `npx quartz upgrade` to upgrade."):this.cachedUpgradeStatus.error?new Z.Notice(`Upgrade check failed: ${this.cachedUpgradeStatus.error}`):new Z.Notice("Quartz is up to date.")}catch(e){let n=e instanceof Error?e.message:String(e);ys.warn("Failed to check for Quartz upgrade",e),new Z.Notice(`Failed to check for Quartz upgrade: ${n}`)}finally{this.isCheckingUpgrade=!1,this.display()}}}async performQuartzUpgrade(){if(!this.isUpgrading){this.isUpgrading=!0,this.display();try{let e=this.getOrCreateSiteManager(),r=await new Vh(e.userSyncerConnection).performUpgrade();r.success?(r.alreadyMerged?new Z.Notice("Quartz is already up to date."):new Z.Notice(`Quartz upgraded successfully to ${r.oid?.slice(0,7)}.`),this.cachedUpgradeStatus=null,this.resetCache()):new Z.Notice(r.error??"Upgrade failed.")}catch(e){let n=e instanceof Error?e.message:String(e);ys.warn("Failed to upgrade Quartz",e),new Z.Notice(`Failed to upgrade Quartz: ${n}`)}finally{this.isUpgrading=!1,this.display()}}}renderTemplateSection(){if(this.cachedTemplateNames.length!==0){new Z.Setting(this.settingsRootElement).setName("Templates").setDesc("Apply a configuration template to replace your current settings with a preset.").setHeading();for(let e of this.cachedTemplateNames){let n=new Z.Setting(this.settingsRootElement).setName(e),r=this.cachedTemplates.get(e);r&&n.setDesc(`Title: "${r.config.configuration.pageTitle}" \xB7 ${r.config.plugins.length} plugin(s)`),n.addButton(i=>i.setButtonText("Preview").onClick(async()=>{if(!this.templateService)return;let s=this.cachedTemplates.get(e)??await this.templateService.readTemplate(e);if(!s){new Z.Notice(`Could not load template "${e}".`);return}this.cachedTemplates.set(e,s),new Z.Notice(`Template "${e}": ${s.config.plugins.length} plugin(s), title "${s.config.configuration.pageTitle}"`),this.display()})),n.addButton(i=>i.setButtonText("Apply").setWarning().onClick(async()=>{if(!this.cachedConfig||!this.templateService)return;let s=this.cachedTemplates.get(e)??await this.templateService.readTemplate(e);if(!s){new Z.Notice(`Could not load template "${e}".`);return}this.cachedTemplates.set(e,s),this.templateService.applyTemplate(this.cachedConfig,s),this.markDirty(),this.display(),new Z.Notice(`Template "${e}" applied. Save to push changes.`)}))}}}renderSiteConfigSection(){if(!this.cachedConfig)return;let e=this.cachedConfig.configuration;new Z.Setting(this.settingsRootElement).setName("Site Configuration").setDesc("Edit site settings. Changes are applied when you click Save above.").setHeading(),new Z.Setting(this.settingsRootElement).setName("Page title").setDesc("The title shown in the browser tab and site header.").addText(n=>n.setValue(e.pageTitle).onChange(r=>{e.pageTitle=r,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("Page title suffix").setDesc('Appended to the page title on subpages (e.g. " | My Site").').addText(n=>n.setValue(e.pageTitleSuffix??"").onChange(r=>{e.pageTitleSuffix=r||void 0,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("SPA mode").setDesc("Single Page Application mode for faster navigation between pages.").addToggle(n=>n.setValue(e.enableSPA).onChange(r=>{e.enableSPA=r,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("Popovers").setDesc("Show page preview popovers on hover.").addToggle(n=>n.setValue(e.enablePopovers??!1).onChange(r=>{e.enablePopovers=r,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("Locale").setDesc("BCP 47 locale tag for date formatting and i18n (e.g. en-US).").addText(n=>n.setValue(e.locale).onChange(r=>{e.locale=r,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("Base URL").setDesc("The base URL where your site is hosted (without protocol, e.g. example.com/quartz).").addText(n=>n.setPlaceholder("example.com").setValue(e.baseUrl??"").onChange(r=>{e.baseUrl=r||void 0,this.markDirty()})),e.analytics&&new Z.Setting(this.settingsRootElement).setName("Analytics provider").setDesc(e.analytics.provider),new Z.Setting(this.settingsRootElement).setName("Ignore patterns").setDesc("Comma-separated glob patterns for files to exclude from processing.").addText(n=>n.setPlaceholder("drafts/*, private/*").setValue((e.ignorePatterns??[]).join(", ")).onChange(r=>{e.ignorePatterns=r.split(",").map(i=>i.trim()).filter(i=>i.length>0),this.markDirty()})),e.theme&&this.renderThemeSection(e)}renderThemeSection(e){let n=e.theme;new Z.Setting(this.settingsRootElement).setName("Theme").setDesc("Typography and font settings.").setHeading(),new Z.Setting(this.settingsRootElement).setName("Header font").addText(i=>i.setValue(n.typography.header).onChange(s=>{n.typography.header=s,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("Body font").addText(i=>i.setValue(n.typography.body).onChange(s=>{n.typography.body=s,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("Code font").addText(i=>i.setValue(n.typography.code).onChange(s=>{n.typography.code=s,this.markDirty()})),new Z.Setting(this.settingsRootElement).setName("CDN caching").setDesc("Cache fonts via CDN for faster loading.").addToggle(i=>i.setValue(n.cdnCaching).onChange(s=>{n.cdnCaching=s,this.markDirty()}));let r=this.findQuartzThemesPlugin();new Z.Setting(this.settingsRootElement).setName("Use Quartz Themes").setDesc("Use community color themes from Quartz Themes instead of manual color editing.").addToggle(i=>i.setValue(r!==null).onChange(s=>{if(this.cachedConfig){if(s)try{this.pluginManager.addPlugin(this.cachedConfig,{name:"quartz-themes",repo:"github:saberzero1/quartz-themes",subdir:"plugin",ref:"main"}),new Z.Notice("Quartz Themes plugin added. Save to push changes.")}catch(o){let a=o instanceof Error?o.message:String(o);new Z.Notice(a)}else{let o=this.cachedConfig.plugins.findIndex(a=>Vn(a.source)==="quartz-themes");o!==-1&&(this.cachedConfig.plugins.splice(o,1),new Z.Notice("Quartz Themes plugin removed. Save to push changes."))}this.markDirty(),this.display()}})),r?this.renderQuartzThemesConfig(r):(this.renderColorSchemeSection("Light mode colors",n.colors.lightMode,mK),this.renderColorSchemeSection("Dark mode colors",n.colors.darkMode,pK))}renderColorSchemeSection(e,n,r){new Z.Setting(this.settingsRootElement).setName(e).setHeading();let i=[{key:"light",label:"Background"},{key:"lightgray",label:"Light gray (borders)"},{key:"gray",label:"Gray (graph, heavier borders)"},{key:"darkgray",label:"Dark gray (body text)"},{key:"dark",label:"Dark (headings)"},{key:"secondary",label:"Secondary (link color)"},{key:"tertiary",label:"Tertiary (hover states)"},{key:"highlight",label:"Highlight (internal link bg)"},{key:"textHighlight",label:"Text highlight (==marked==)"}];for(let{key:s,label:o}of i){let a=new Z.Setting(this.settingsRootElement).setName(o),l=n[s],c=r[s],u=/^#[0-9a-fA-F]{3,8}$/.test(l);l!==c&&a.addExtraButton(f=>f.setIcon("reset").setTooltip(`Reset to default: ${c}`).onClick(()=>{n[s]=c,this.markDirty(),this.display()})),u&&a.addColorPicker(f=>f.setValue(l).onChange(h=>{n[s]=h,this.markDirty(),this.display()})),a.addText(f=>f.setValue(l).onChange(h=>{n[s]=h,this.markDirty()}))}}findQuartzThemesPlugin(){return this.cachedConfig?this.cachedConfig.plugins.find(e=>Vn(e.source)==="quartz-themes")??null:null}renderQuartzThemesConfig(e){e.options||(e.options={});let n=e.options.theme??"default",r=e.options.variation??null,i=this.cachedThemesJson;if(!i){new Z.Setting(this.settingsRootElement).setName("Theme").setDesc("Loading available themes..."),this.fetchThemesJson().then(()=>this.display());return}let s=Object.keys(i).sort();new Z.Setting(this.settingsRootElement).setName("Theme").setDesc("Select a community color theme.").addDropdown(l=>{for(let c of s)l.addOption(c,c);l.setValue(n).onChange(c=>{e.options||(e.options={}),e.options.theme=c||"default";let u=c?i[c]:null;u&&u.variations&&u.variations.length>0?e.options.variation=null:delete e.options.variation,this.markDirty(),this.display()})});let a=(n?i[n]:null)?.variations??[];a.length>0&&new Z.Setting(this.settingsRootElement).setName("Variation").setDesc("Select a theme variation.").addDropdown(l=>{l.addOption("","\u2014 No variation \u2014");for(let c of a)l.addOption(c.name,c.name);l.setValue(r??"").onChange(c=>{e.options||(e.options={}),c?e.options.variation=c:delete e.options.variation,this.markDirty()})})}async fetchThemesJson(){if(!this.cachedThemesJson)try{let e=await(0,Z.requestUrl)({url:"https://raw.githubusercontent.com/saberzero1/quartz-themes/master/themes.json"});if(e.status<200||e.status>=300){ys.warn(`Failed to fetch themes.json: ${e.status}`);return}let n=JSON.parse(e.text);this.cachedThemesJson=n.themes}catch(e){ys.warn("Failed to fetch themes.json:",e)}}async checkForUpdates(){if(!(!this.cachedConfig||this.isCheckingUpdates)){this.isCheckingUpdates=!0,this.display();try{let e=this.plugin.getGitSettingsWithSecret(),r=await new Do(e.auth,e.corsProxyUrl).checkUpdates(this.cachedConfig.plugins,this.cachedLockFile);this.cachedUpdateStatuses=new Map(r.map(s=>[s.sourceKey,s]));let i=r.filter(s=>s.hasUpdate).length;i>0?new Z.Notice(`${i} plugin update(s) available.`):new Z.Notice("All plugins are up to date.")}catch(e){let n=e instanceof Error?e.message:String(e);ys.warn("Failed to check for plugin updates",e),new Z.Notice(`Failed to check for updates: ${n}`)}finally{this.isCheckingUpdates=!1,this.display()}}}async updatePlugin(e,n){if(!this.cachedLockFile||!this.configService)return;let r=this.cachedLockFile.plugins[e];if(!r){new Z.Notice(`No lock entry found for ${e}.`);return}try{r.commit=n,r.installedAt=new Date().toISOString(),await this.configService.writeLockFile(this.cachedLockFile,`Update ${e} to ${n.slice(0,7)} via Syncer`),this.cachedUpdateStatuses&&this.cachedUpdateStatuses.delete(e),new Z.Notice(`Updated ${e} to ${n.slice(0,7)}.`),this.display()}catch(i){let s=i instanceof Error?i.message:String(i);ys.warn(`Failed to update ${e}`,i),new Z.Notice(`Failed to update ${e}: ${s}`)}}async updateAllPlugins(){if(!this.cachedLockFile||!this.configService||!this.cachedUpdateStatuses)return;let e=[...this.cachedUpdateStatuses.values()].filter(n=>n.hasUpdate&&n.remoteCommit);if(e.length===0){new Z.Notice("No plugin updates available.");return}try{for(let r of e){let i=this.cachedLockFile.plugins[r.sourceKey];i&&r.remoteCommit&&(i.commit=r.remoteCommit,i.installedAt=new Date().toISOString())}let n=e.map(r=>r.sourceKey).join(", ");await this.configService.writeLockFile(this.cachedLockFile,`Update ${e.length} plugin(s) via Syncer: ${n}`),this.cachedUpdateStatuses=null,new Z.Notice(`Updated ${e.length} plugin(s): ${n}`),this.display()}catch(n){let r=n instanceof Error?n.message:String(n);ys.warn("Failed to update plugins",n),new Z.Notice(`Failed to update plugins: ${r}`)}}async installPlugin(e){if(!this.cachedConfig||!this.configService)throw new Error("Configuration not loaded.");let n=this.pluginManager.addPlugin(this.cachedConfig,e);if(this.manifestService)try{let i=await this.manifestService.fetchManifest(e);i?.defaultOptions&&(n.options={...i.defaultOptions})}catch{}await this.configService.writeConfig(this.cachedConfig);let r=this.plugin.getGitSettingsWithSecret();try{let o=(await new Do(r.auth,r.corsProxyUrl).checkUpdates([n],this.cachedLockFile))[0];if(o?.remoteCommit&&this.cachedLockFile&&this.configService){let a=Vn(e);this.cachedLockFile.plugins[a]={source:e,resolved:Qc(e),commit:o.remoteCommit,installedAt:new Date().toISOString()},await this.configService.writeLockFile(this.cachedLockFile,`Install ${a} via Syncer`)}}catch{}this.display()}renderPluginListSection(){if(!this.cachedConfig)return;let e=this.cachedConfig.plugins,n=this.cachedLockFile?.plugins??{},r=new Z.Setting(this.settingsRootElement).setName("Plugins").setDesc(`${e.length} plugin(s) configured. Toggle enabled state or adjust execution order.`).setHeading();r.addButton(o=>o.setButtonText(this.isCheckingUpdates?"Checking...":"Check for updates").setDisabled(this.isCheckingUpdates).onClick(async()=>{await this.checkForUpdates()}));let i=this.cachedUpdateStatuses?[...this.cachedUpdateStatuses.values()].filter(o=>o.hasUpdate).length:0;i>0&&r.addButton(o=>o.setButtonText(`Update all (${i})`).onClick(async()=>{await this.updateAllPlugins()})),r.addButton(o=>o.setButtonText("Browse plugins").onClick(()=>{if(!this.cachedConfig)return;new Kg(this.app,this.pluginRegistry,this.cachedConfig,async l=>this.installPlugin(l)).open()}));let s="";if(new Z.Setting(this.settingsRootElement).setName("Add plugin").setDesc('Enter a plugin source (e.g. "github:quartz-community/explorer").').addText(o=>o.setPlaceholder("github:org/plugin").onChange(a=>{s=a})).addButton(o=>o.setButtonText("Add").onClick(()=>{if(!(!this.cachedConfig||!s.trim()))try{this.pluginManager.addPlugin(this.cachedConfig,s.trim()),this.markDirty(),this.display(),new Z.Notice(`Plugin "${s.trim()}" added. Save to push changes.`)}catch(a){let l=a instanceof Error?a.message:String(a);new Z.Notice(l)}})),e.length===0){new Z.Setting(this.settingsRootElement).setName("No plugins").setDesc("No plugins are configured in your Quartz config.");return}for(let o=0;o<e.length;o++)this.renderPluginEntry(e[o],o,e.length,n)}renderPluginEntry(e,n,r,i){let s=Vn(e.source),o=[];e.order!==void 0&&o.push(`Order: ${e.order}`),e.layout?.position&&o.push(`Position: ${e.layout.position}`);let a=i[s];a?.commit&&o.push(`Commit: ${a.commit.slice(0,7)}`);let l=this.cachedUpdateStatuses?.get(s);l?.hasUpdate?o.push(`Update available: ${l.remoteCommit?.slice(0,7)}`):l&&!l.hasUpdate&&l.lockedCommit&&o.push("Up to date"),l?.error&&o.push(`Check failed: ${l.error}`);let c=l?.hasUpdate?`${s} *`:s,u=new Z.Setting(this.settingsRootElement).setName(c).setDesc(o.length>0?o.join(" \xB7 "):"");u.addToggle(h=>h.setTooltip("Enable or disable this plugin").setValue(e.enabled).onChange(d=>{e.enabled=d,this.markDirty()})),u.addExtraButton(h=>h.setIcon("arrow-up").setTooltip("Move up").setDisabled(n===0).onClick(()=>this.movePlugin(n,n-1))),u.addExtraButton(h=>h.setIcon("arrow-down").setTooltip("Move down").setDisabled(n===r-1).onClick(()=>this.movePlugin(n,n+1))),u.addExtraButton(h=>h.setIcon("trash").setTooltip("Remove plugin").onClick(()=>{if(!this.cachedConfig)return;let d=Dn(e.source);try{this.pluginManager.removePlugin(this.cachedConfig,d),this.markDirty(),this.display(),new Z.Notice(`Plugin "${Vn(e.source)}" removed. Save to push changes.`)}catch(p){let g=p instanceof Error?p.message:String(p);new Z.Notice(g)}})),e.layout&&this.renderPluginLayoutControls(e),l?.hasUpdate&&l.remoteCommit&&u.addExtraButton(h=>h.setIcon("download").setTooltip(`Update to ${l.remoteCommit?.slice(0,7)}`).onClick(async()=>{await this.updatePlugin(s,l.remoteCommit)}));let f=this.expandedPlugins.has(s);u.addExtraButton(h=>h.setIcon(f?"chevron-up":"settings").setTooltip(f?"Hide options":"Show options").onClick(async()=>{if(f)this.expandedPlugins.delete(s);else if(this.expandedPlugins.add(s),!this.cachedManifests.has(s)&&this.manifestService){let d=await this.manifestService.fetchManifest(e.source);this.cachedManifests.set(s,d)}this.display()})),f&&this.renderPluginOptions(e,s)}renderPluginOptions(e,n){e.options||(e.options={});let r=l=>l!==null&&typeof l=="object"?JSON.stringify(l):String(l),i=this.cachedManifests.get(n),s=i?.optionSchema??i?.configSchema??null,o=new Set([...Object.keys(e.options),...s?Object.keys(s):[]]);o.size===0&&new Z.Setting(this.settingsRootElement).setDesc(i?"This plugin has no configurable options.":"Loading manifest failed. You can still edit options manually.");for(let l of o){let c=e.options[l],u=s?.[l],f=u?.title??l,h=u?.description??"",d=new Z.Setting(this.settingsRootElement).setName(f).setDesc(h);typeof c=="boolean"?d.addToggle(p=>p.setValue(c).onChange(g=>{e.options[l]=g,this.markDirty()})):typeof c=="number"||u?.type==="number"||u?.type==="integer"?d.addText(p=>p.setValue(c!==void 0?r(c):"").setPlaceholder(u?.default!==void 0?r(u.default):"").onChange(g=>{let y=parseFloat(g);e.options[l]=isNaN(y)?void 0:y,this.markDirty()})):d.addText(p=>p.setValue(c!==void 0?r(c):"").setPlaceholder(u?.default!==void 0?r(u.default):"").onChange(g=>{e.options[l]=g||void 0,this.markDirty()}))}let a="";new Z.Setting(this.settingsRootElement).setDesc("Add a custom option key.").addText(l=>l.setPlaceholder("optionKey").onChange(c=>{a=c})).addButton(l=>l.setButtonText("Add option").onClick(()=>{if(!(!a.trim()||!e.options)){if(e.options[a.trim()]!==void 0){new Z.Notice(`Option "${a.trim()}" already exists.`);return}e.options[a.trim()]="",this.markDirty(),this.display()}}))}renderPluginLayoutControls(e){if(!e.layout)return;let n=e.layout,r=new Z.Setting(this.settingsRootElement).setDesc("Layout: position, priority, and display mode for this plugin's component.");r.addDropdown(i=>{i.addOption("","No position");for(let s of hK)i.addOption(s,s);i.setValue(n.position??"").onChange(s=>{n.position=s||void 0,this.markDirty()})}),r.addText(i=>i.setPlaceholder("Priority").setValue(n.priority!==void 0?String(n.priority):"").onChange(s=>{let o=parseInt(s,10);n.priority=isNaN(o)?void 0:o,this.markDirty()})),r.addDropdown(i=>{for(let s of dK)i.addOption(s,s);i.setValue(n.display??"all").onChange(s=>{n.display=s,this.markDirty()})})}renderLayoutSection(){if(!this.cachedConfig)return;let e=this.cachedConfig;e.layout||(e.layout={});let n=e.layout;new Z.Setting(this.settingsRootElement).setName("Layout Overrides").setDesc("Per-page-type layout overrides. Set a frame template or exclude plugins for specific page types.").setHeading();for(let r of gK)this.renderPageTypeOverride(n,r)}renderPageTypeOverride(e,n){e.byPageType||(e.byPageType={});let r=e.byPageType[n],i=r!==void 0,s=new Z.Setting(this.settingsRootElement).setName(n);if(!i){s.setDesc("No overrides configured."),s.addButton(o=>o.setButtonText("Add override").onClick(()=>{e.byPageType||(e.byPageType={}),e.byPageType[n]={},this.markDirty(),this.display()}));return}s.addButton(o=>o.setButtonText("Remove override").onClick(()=>{e.byPageType&&delete e.byPageType[n],this.markDirty(),this.display()})),new Z.Setting(this.settingsRootElement).setName("Template").setDesc(`Frame template for ${n} pages.`).addDropdown(o=>{o.addOption("","Default");let a=["default","full-width","minimal",...this.cachedTemplateNames.filter(l=>l!=="default"&&l!=="full-width"&&l!=="minimal")];for(let l of a)o.addOption(l,l);o.setValue(r.template??"").onChange(l=>{r.template=l||void 0,this.markDirty()})}),new Z.Setting(this.settingsRootElement).setName("Excluded plugins").setDesc(`Comma-separated plugin names to exclude from ${n} pages.`).addText(o=>o.setPlaceholder("reader-mode, graph").setValue((r.exclude??[]).join(", ")).onChange(a=>{r.exclude=a.split(",").map(l=>l.trim()).filter(l=>l.length>0),r.exclude.length===0&&(r.exclude=void 0),this.markDirty()}))}movePlugin(e,n){if(!this.cachedConfig)return;let r=this.cachedConfig.plugins;if(n<0||n>=r.length)return;let[i]=r.splice(e,1);r.splice(n,0,i),this.markDirty(),this.display()}};m();var En=require("obsidian"),Yg=class extends En.PluginSettingTab{app;plugin;settings;settingsRootElement;constructor(e,n,r,i){super(e,n),this.app=e,this.plugin=n,this.settings=r,this.plugin=n,this.settingsRootElement=i}display(){this.settingsRootElement.empty(),this.settingsRootElement.addClass("quartz-syncer-github-settings"),this.initializeFrontmatterHeader(),this.initializePublishFrontmatterKeySetting(),this.initializeFrontmatterFormatSetting(),this.initializeAllNotesPublishableByDefaultSetting(),this.initializeShowCreatedTimestampSetting(),this.initializeCreatedTimestampKeysSetting(),this.initializeShowUpdatedTimestampSetting(),this.initializeUpdatedTimestampKeysSetting(),this.initializeShowPublishedTimestampSetting(),this.initializePublishedTimestampKeysSetting(),this.initializeEnablePermalinkSetting(),this.initializeIncludeAllFrontmatterSetting();let e=["created"];(this.settings.settings.createdTimestampKey===""||e.includes(this.settings.settings.createdTimestampKey))&&(this.settings.settings.createdTimestampKey="created, created_at, date");let n=["modified"];(this.settings.settings.updatedTimestampKey===""||n.includes(this.settings.settings.updatedTimestampKey))&&(this.settings.settings.updatedTimestampKey="modified, lastmod, updated, last-modified");let r=["published"];(this.settings.settings.publishedTimestampKey===""||r.includes(this.settings.settings.publishedTimestampKey))&&(this.settings.settings.publishedTimestampKey="published, publishDate, date"),this.settings.settings.lastUsedSettingsTab="frontmatter",this.settings.plugin.saveSettings()}initializeFrontmatterHeader=()=>{new En.Setting(this.settingsRootElement).setName("Note properties (frontmatter)").setDesc("Quartz Syncer will apply these settings to your Quartz notes' properties or frontmatter.").setHeading()};initializeFrontmatterFormatSetting(){new En.Setting(this.settingsRootElement).setName("Frontmatter format").setDesc("Output format for frontmatter in published notes. YAML is more readable, JSON is supported in case you need it.").addDropdown(e=>e.addOption("yaml","YAML").addOption("json","JSON").setValue(this.settings.settings.frontmatterFormat??"yaml").onChange(async n=>{this.settings.settings.frontmatterFormat=n,await this.settings.plugin.saveSettings()}))}initializePublishFrontmatterKeySetting(){this.settings.settings.allNotesPublishableByDefault||new En.Setting(this.settingsRootElement).setName("Publish key").setDesc('Note property key used to mark a note as eligible to publish. Quartz Syncer will ignore all notes without this property. By default "publish".').addText(e=>e.setPlaceholder("publish").setValue(this.settings.settings.publishFrontmatterKey).onChange(async n=>{n.length===0&&(n="publish"),this.settings.settings.publishFrontmatterKey=n,await this.settings.plugin.saveSettings()}))}initializeAllNotesPublishableByDefaultSetting(){new En.Setting(this.settingsRootElement).setName("All notes publishable by default").setDesc("Make all notes publishable by default. This will override the publish key setting and make all notes eligible for publication.").addToggle(e=>e.setValue(this.settings.settings.allNotesPublishableByDefault).onChange(async n=>{this.settings.settings.allNotesPublishableByDefault=n,await this.settings.plugin.saveSettings(),this.display()}))}initializeIncludeAllFrontmatterSetting(){new En.Setting(this.settingsRootElement).setName("Include all properties").setDesc("Include all note properties in the Quartz Syncer note. Enabling this will overrides other property settings to include all properties keys and values. Even note properties that are not used by Quartz will be included in the note's frontmatter. You shouldn't need this setting unless you have Quartz components that require non-standard properties.").addToggle(e=>e.setValue(this.settings.settings.includeAllFrontmatter).onChange(async n=>{this.settings.settings.includeAllFrontmatter=n,await this.settings.plugin.saveSettings(),this.display()}))}initializeShowCreatedTimestampSetting(){this.settings.settings.includeAllFrontmatter||new En.Setting(this.settingsRootElement).setName("Include created timestamp").setDesc("Include the created timestamp in your note's properties.").addToggle(e=>e.setValue(this.settings.settings.showCreatedTimestamp).setDisabled(this.settings.settings.includeAllFrontmatter).onChange(async n=>{this.settings.settings.showCreatedTimestamp=n,await this.settings.plugin.saveSettings(),this.display()}))}initializeCreatedTimestampKeysSetting(){!this.settings.settings.includeAllFrontmatter&&this.settings.settings.showCreatedTimestamp&&new En.Setting(this.settingsRootElement).setName("Created timestamp keys").setDesc("Comma-separated list of keys to look for to determine the created timestamp. By default, Quartz Syncer will look for 'created', 'created_at', and 'date'.").addText(e=>e.setPlaceholder("created, created_at, date").setValue(this.settings.settings.createdTimestampKey).setDisabled(this.settings.settings.includeAllFrontmatter).onChange(async n=>{(n.length===0||this.settings.settings.createdTimestampKey==="")&&(n="created, created_at, date"),this.settings.settings.createdTimestampKey=n,await this.settings.plugin.saveSettings()}))}initializeShowUpdatedTimestampSetting(){this.settings.settings.includeAllFrontmatter||new En.Setting(this.settingsRootElement).setName("Include modified timestamp").setDesc("Include the modified timestamp in your note's properties.").addToggle(e=>e.setValue(this.settings.settings.showUpdatedTimestamp).setDisabled(this.settings.settings.includeAllFrontmatter).onChange(async n=>{this.settings.settings.showUpdatedTimestamp=n,await this.settings.plugin.saveSettings(),this.display()}))}initializeUpdatedTimestampKeysSetting(){!this.settings.settings.includeAllFrontmatter&&this.settings.settings.showUpdatedTimestamp&&new En.Setting(this.settingsRootElement).setName("Modified timestamp keys").setDesc("Comma-separated list of keys to look for to determine the modified timestamp. By default, Quartz Syncer will look for 'modified', 'lastmod', 'updated', and 'last-modified'.").addText(e=>e.setPlaceholder("modified, lastmod, updated, last-modified").setValue(this.settings.settings.updatedTimestampKey).setDisabled(this.settings.settings.includeAllFrontmatter).onChange(async n=>{(n.length===0||this.settings.settings.updatedTimestampKey==="")&&(n="modified, lastmod, updated, last-modified"),this.settings.settings.updatedTimestampKey=n,await this.settings.plugin.saveSettings()}))}initializeShowPublishedTimestampSetting(){this.settings.settings.includeAllFrontmatter||new En.Setting(this.settingsRootElement).setName("Include published timestamp").setDesc("Include the published timestamp in your note's properties.").addToggle(e=>e.setValue(this.settings.settings.showPublishedTimestamp).setDisabled(this.settings.settings.includeAllFrontmatter).onChange(async n=>{this.settings.settings.showPublishedTimestamp=n,await this.settings.plugin.saveSettings(),this.display()}))}initializePublishedTimestampKeysSetting(){!this.settings.settings.includeAllFrontmatter&&this.settings.settings.showPublishedTimestamp&&new En.Setting(this.settingsRootElement).setName("Published timestamp keys").setDesc("Comma-separated list of keys to look for to determine the published timestamp. By default, Quartz Syncer will look for 'published', 'publishDate', and 'date'.").addText(e=>e.setPlaceholder("published, publishDate, date").setValue(this.settings.settings.publishedTimestampKey).setDisabled(this.settings.settings.includeAllFrontmatter).onChange(async n=>{(n.length===0||this.settings.settings.publishedTimestampKey==="")&&(n="published, publishDate, date"),this.settings.settings.publishedTimestampKey=n,await this.settings.plugin.saveSettings()}))}initializeEnablePermalinkSetting(){new En.Setting(this.settingsRootElement).setName("Enable permalinks").setDesc(`Use the note's permalink as the Quartz note's URL if "permalink" is not in the frontmatter. This will override the default Quartz URL.`).addToggle(e=>e.setValue(this.settings.settings.usePermalink).setDisabled(this.settings.settings.includeAllFrontmatter).onChange(async n=>{this.settings.settings.usePermalink=n,await this.settings.plugin.saveSettings()}))}};m();var Eo=require("obsidian");var Jg=class extends Eo.PluginSettingTab{app;plugin;settings;settingsRootElement;constructor(e,n,r,i){super(e,n),this.app=e,this.plugin=n,this.settings=r,this.settingsRootElement=i}display(){this.settingsRootElement.empty(),this.settingsRootElement.addClass("quartz-syncer-github-settings");let e=Vt.getByCategory("core"),n=Vt.getByCategory("community");if(e.length>0){this.initializeCorePluginHeader();for(let r of e)this.initializeIntegrationSetting(r)}if(n.length>0){this.initializeCommunityPluginHeader();for(let r of n)this.initializeIntegrationSetting(r)}this.initializeStylesHeader(),this.initializeManageSyncerStylesSetting(),this.settings.settings.lastUsedSettingsTab="integration",this.settings.plugin.saveSettings()}initializeCorePluginHeader(){new Eo.Setting(this.settingsRootElement).setName("Core plugins").setDesc("Integrations for Obsidian's built-in core plugins.").setHeading()}initializeCommunityPluginHeader(){new Eo.Setting(this.settingsRootElement).setName("Community plugins").setDesc("Integrations for third-party community plugins.").setHeading()}initializeIntegrationSetting(e){let n=e.isAvailable(),r=e.settingKey,i=this.settings.settings[r];new Eo.Setting(this.settingsRootElement).setName(`Enable ${e.name} integration`).setDesc(this.getIntegrationDescription(e.id)).addToggle(s=>s.setValue(i&&n).setDisabled(!n).onChange(async o=>{this.settings.settings[r]=o&&n,await this.settings.plugin.saveSettings()})).setClass(n?"quartz-syncer-settings-enabled":"quartz-syncer-settings-disabled")}getIntegrationDescription(e){return{dataview:"Converts Dataview queries into Quartz-compatible markdown.",datacore:"Converts Datacore queries into Quartz-compatible markdown. Currently experimental.",excalidraw:"Syncs Excalidraw drawings to Quartz. Rendering is handled by the Quartz Excalidraw plugin.","fantasy-statblocks":"Converts Fantasy Statblocks queries into Quartz-compatible format.","auto-card-link":"Converts Auto Card Link queries into Quartz-compatible markdown.",bases:"Publishes Obsidian Bases (.base files) to Quartz. Processing is delegated to Quartz.",canvas:"Publishes JSON Canvas (.canvas files) to Quartz. Processing is delegated to Quartz."}[e]??`Enables ${e} integration.`}initializeStylesHeader(){new Eo.Setting(this.settingsRootElement).setName("Integration styles").setDesc("Settings for managing integration styles in your Quartz project.").setHeading()}initializeManageSyncerStylesSetting(){new Eo.Setting(this.settingsRootElement).setName("Manage integration styles").setDesc("When enabled, Quartz Syncer will automatically write SCSS files for enabled integrations and ensure custom.scss imports them.").addToggle(e=>e.setValue(this.settings.settings.manageSyncerStyles).onChange(async n=>{this.settings.settings.manageSyncerStyles=n,await this.settings.plugin.saveSettings()}))}};m();var mi=require("obsidian"),Xg=class extends mi.PluginSettingTab{app;plugin;settings;settingsRootElement;constructor(e,n,r,i){super(e,n),this.app=e,this.plugin=n,this.settings=r,this.settingsRootElement=i,this.settingsRootElement.classList.add("settings-tab-content")}display(){this.settingsRootElement.empty(),this.settingsRootElement.addClass("quartz-syncer-github-settings"),this.initializePerformanceHeader(),this.initializeEnableCacheSetting(),this.initializeSyncCacheSetting(),this.initializePersistCacheSetting(),this.initializeClearCacheSetting(),this.settings.settings.lastUsedSettingsTab="performance",this.settings.plugin.saveSettings()}initializePerformanceHeader=()=>{new mi.Setting(this.settingsRootElement).setName("Performance").setDesc("Quartz Syncer will use these settings to improve performance.").setHeading()};initializeEnableCacheSetting=()=>{new mi.Setting(this.settingsRootElement).setName("Enable caching").setDesc("Enable or disable the Quartz Syncer cache. This can improve performance by storing compiled files locally.").addToggle(e=>e.setValue(this.settings.settings.useCache).onChange(n=>{this.settings.settings.useCache=n,this.settings.plugin.saveSettings(),n||(this.plugin.datastore.persister.clear(),new mi.Notice("Quartz Syncer: Cache disabled. All cached data will be cleared.")),this.display()}))};initializeSyncCacheSetting=()=>{this.settings.settings.useCache&&new mi.Setting(this.settingsRootElement).setName("Synchronize cache between devices").setDesc("Whether to write the cache to `data.json`. This is useful for syncing the cache across devices. It is recommended to enable this setting if you are using Quartz Syncer on multiple devices.").addToggle(e=>e.setValue(this.settings.settings.syncCache).onChange(n=>{this.settings.settings.syncCache=n,this.settings.plugin.saveSettings()}))};initializePersistCacheSetting=()=>{this.settings.settings.useCache&&new mi.Setting(this.settingsRootElement).setName("Persist cache after unload").setDesc("Whether to persist the cache when the plugin is unloaded. This is useful for users that start Obsidian with the plugin disabled.").addToggle(e=>e.setValue(this.settings.settings.persistCache).onChange(n=>{this.settings.settings.persistCache=n,this.settings.plugin.saveSettings()}))};initializeClearCacheSetting=()=>{this.settings.settings.useCache&&new mi.Setting(this.settingsRootElement).setName("Clear cache").setDesc("Clear the Quartz Syncer cache. This will remove all cached files and force a re-fetch of all data from the remote repository.").addButton(e=>e.setButtonText("Clear cache").setCta().onClick(async()=>{await this.plugin.datastore.dropAllFiles(),this.settings.settings.cache="{}",this.settings.plugin.saveSettings(),new mi.Notice("Quartz Syncer: cache cleared.")}))}};m();var Wh=require("obsidian"),ey=class extends Wh.PluginSettingTab{app;plugin;settings;settingsRootElement;constructor(e,n,r,i){super(e,n),this.app=e,this.plugin=n,this.settings=r,this.settingsRootElement=i,this.settingsRootElement.classList.add("settings-tab-content")}display(){this.settingsRootElement.empty(),this.settingsRootElement.addClass("quartz-syncer-github-settings"),this.initializeUIHeader(),this.initializeDiffViewStyleSetting(),this.settings.settings.lastUsedSettingsTab="ui",this.settings.plugin.saveSettings()}initializeUIHeader=()=>{new Wh.Setting(this.settingsRootElement).setName("User Interface").setDesc("Customize the appearance and behavior of Quartz Syncer.").setHeading()};initializeDiffViewStyleSetting=()=>{new Wh.Setting(this.settingsRootElement).setName("Diff view style").setDesc("Choose how differences are displayed when comparing local and published files.").addDropdown(e=>e.addOption("auto","Auto (Split on desktop, Unified on mobile)").addOption("split","Always Split (side-by-side)").addOption("unified","Always Unified (single column)").setValue(this.settings.settings.diffViewStyle).onChange(async n=>{this.settings.settings.diffViewStyle=n,await this.settings.plugin.saveSettings()}))}};var Qh=class{app;plugin;settingsRootElement;settings;datastore;constructor(e,n,r,i,s){this.app=e,this.plugin=n,this.settingsRootElement=r,this.settingsRootElement.classList.add("quartz-syncer-settings"),Gh.Platform.isDesktop?this.settingsRootElement.classList.add("quartz-syncer-desktop"):Gh.Platform.isMobile&&this.settingsRootElement.classList.add("quartz-syncer-mobile"),this.settings=i,this.datastore=s}getIcon(e){return(0,Gh.getIcon)(e)??activeDocument.createSpan()}async initialize(){this.settingsRootElement.empty();let e=this.settingsRootElement.createDiv({cls:"quartz-syncer-settings-description"});e.createSpan({text:"Remember to read the "}),e.createEl("a",{text:"documentation",href:"https://saberzero1.github.io/quartz-syncer-docs/"}),e.createSpan({text:" if you haven't already. A "}),e.createEl("a",{text:"setup guide",href:"https://saberzero1.github.io/quartz-syncer-docs/Setup-Guide"}),e.createSpan({text:" and a "}),e.createEl("a",{text:"usage guide",href:"https://saberzero1.github.io/quartz-syncer-docs/Usage-Guide"}),e.createSpan({text:" are also available. If you encounter any issues, please see the "}),e.createEl("a",{text:"troubleshooting section",href:"https://saberzero1.github.io/quartz-syncer-docs/Troubleshooting/"}),e.createSpan({text:" for help."});let r=this.settingsRootElement.createDiv({cls:"quartz-syncer-setting-header"}).createDiv({cls:"quartz-syncer-setting-tab-group"}),i=this.createTab("Git","git-branch"),s=this.createTab("Quartz","leaf"),o=this.createTab("Frontmatter","archive"),a=this.createTab("Integration","cable"),l=this.createTab("Performance","zap"),c=this.createTab("UI","layout");r.appendChild(i),r.appendChild(s),r.appendChild(o),r.appendChild(a),r.appendChild(l),r.appendChild(c);let u=this.settingsRootElement.createDiv({cls:"quartz-syncer-setting-content"}),f=[];f.push(new qg(this.app,this.plugin,this,this.createSettingsTab(u,"Git"))),f.push(new Zg(this.app,this.plugin,this,this.createSettingsTab(u,"Quartz"))),f.push(new Yg(this.app,this.plugin,this,this.createSettingsTab(u,"Frontmatter"))),f.push(new Jg(this.app,this.plugin,this,this.createSettingsTab(u,"Integration"))),f.push(new Xg(this.app,this.plugin,this,this.createSettingsTab(u,"Performance"))),f.push(new ey(this.app,this.plugin,this,this.createSettingsTab(u,"UI"))),this.settingsRootElement.querySelectorAll("[data-quartz-syncer-tab]").forEach(d=>{d.addEventListener("click",()=>{let p=d.getAttribute("data-quartz-syncer-tab");p&&this.setActiveTab(p,f)})}),this.setActiveTab(this.settings.lastUsedSettingsTab??"git",f)}createTab(e,n){let r=this.settingsRootElement.createDiv({cls:"quartz-syncer-navigation-item",attr:{"data-quartz-syncer-tab":e.toLowerCase()}});return r.createSpan({cls:"quartz-syncer-navigation-item-icon"}).appendChild(this.getIcon(n)),r.createSpan({text:e,cls:"quartz-syncer-navigation-item-text"}),r}createSettingsTab(e,n){let r=e.createDiv({cls:"quartz-syncer-tab-settings"});return r.id=`quartz-syncer-settings-tab-${n.toLowerCase()}`,r}setActiveTab(e,n){this.settingsRootElement.querySelectorAll("[data-quartz-syncer-tab]").forEach(i=>{i.getAttribute("data-quartz-syncer-tab")===e?i.addClass("quartz-syncer-navigation-item-active"):i.removeClass("quartz-syncer-navigation-item-active")}),this.settingsRootElement.querySelectorAll(".quartz-syncer-tab-settings").forEach((i,s)=>{i.id===`quartz-syncer-settings-tab-${e}`?(i.classList.add("quartz-syncer-tab-settings-active"),n[s].display()):i.classList.remove("quartz-syncer-tab-settings-active")})}};var ty=class extends pz.PluginSettingTab{app;plugin;constructor(e,n){super(e,n),this.app=e,this.plugin=n,this.plugin.settings.noteSettingsIsInitialized||(this.plugin.settings.noteSettingsIsInitialized=!0,this.plugin.saveSettings())}display(){let{containerEl:e}=this;new Qh(this.app,this.plugin,e,this.plugin.settings,this.plugin.datastore).initialize()}};m();m();var Ba=class extends Error{constructor(e,n,r,i){super(n),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.setPrototypeOf(this,new.target.prototype),this.name="LocalSpaceError",this.code=e,this.details=r,i!==void 0&&(this.cause=i)}withDetails(e){return e?(this.details={...this.details??{},...e},this):this}},Je=(t,e,n)=>new Ba(t,e,n),ws=(t,e,n,r)=>{if(t instanceof Ba)return r?t.withDetails(r):t;let i=t instanceof Error?t:new Error(String(t)),s={...r??{},causeName:i.name,causeMessage:i.message};return new Ba(e,n,s,i)},Oz=(t,e="Unknown error")=>t instanceof Error?t instanceof Ba?t:ws(t,"UNKNOWN",t.message||e):ws(t,"UNKNOWN",typeof t=="string"?t:e);function ke(t,e){return e&&t.then(n=>e(null,n),n=>e(Oz(n),void 0)),t}function Jc(t,e,n,r){let i=o=>Oz(o);if(r?.compatibilityMode)return typeof e=="function"&&t.then(o=>{e(o)}),typeof n=="function"&&t.catch(o=>{n(i(o))}),t;let s=o=>{let a=i(o);n?n(a):e&&e(a,void 0)};return e?t.then(o=>e(null,o),s):n&&t.catch(s),t}function yK(t,e){return t.indexOf(e)!==-1}function Pz(t){return Array.isArray(t)}function ht(t){return typeof t!="string"?(console.warn(`key passed to LocalSpace API is not a string (got ${typeof t}). Using String() to convert.`),String(t)):t}function Fk(t,...e){let n=t;for(let r of e)if(r){let i=r;for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s)){let o=i[s];n[s]=Pz(o)?[...o]:o}}return t}function Hk(t,e){try{return new Blob(t,e)}catch(n){if(!(n instanceof Error)||n.name!=="TypeError")throw n;let r=window,i=r.BlobBuilder||r.MSBlobBuilder||r.MozBlobBuilder||r.WebKitBlobBuilder;if(!i)throw Je("BLOB_UNSUPPORTED","Blob constructor not supported");let s=new i;for(let o of t)s.append(o);return s.getBlob(e?.type)}}function ay(t){if(Array.isArray(t))return t.map(({key:n,value:r})=>({key:ht(n),value:r}));if(t instanceof Map){let n=[];return t.forEach((r,i)=>{n.push({key:ht(i),value:r})}),n}let e=[];for(let n of Object.keys(t))e.push({key:ht(n),value:t[n]});return e}function ji(t,e){if(e<=0||e>=t.length)return[t];let n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}var To="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gz=/^~~local_forage_type~([^~]+)~/,ny="__lfsc__:",yz="arbf",Ik="blob",Nz="si08",Mz="ui08",Rz="uic8",zz="si16",Lz="si32",Bz="ur16",$z="ui32",Uz="fl32",jz="fl64",qz="bi64",Vz="bu64",wK=Object.prototype.toString,Wk=()=>{let t;return t=typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t};function wz(t){let e=Wk(),n=.75*t.length,r=t.length,i=0,s=n;t[t.length-1]==="="&&(s--,t[t.length-2]==="="&&s--);let o=new e.ArrayBuffer(s),a=new e.Uint8Array(o);for(let l=0;l<r;l+=4){let c=To.indexOf(t[l]),u=To.indexOf(t[l+1]),f=To.indexOf(t[l+2]),h=To.indexOf(t[l+3]);a[i++]=c<<2|u>>4,a[i++]=(15&u)<<4|f>>2,a[i++]=(3&f)<<6|63&h}return o}function ry(t){let e=new(Wk()).Uint8Array(t),n="";for(let r=0;r<e.length;r+=3)n+=To[e[r]>>2],n+=To[(3&e[r])<<4|e[r+1]>>4],n+=To[(15&e[r+1])<<2|e[r+2]>>6],n+=To[63&e[r+2]];return e.length%3==2?n=n.substring(0,n.length-1)+"=":e.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var bK={"[object Int8Array]":Nz,"[object Uint8Array]":Mz,"[object Uint8ClampedArray]":Rz,"[object Int16Array]":zz,"[object Uint16Array]":Bz,"[object Int32Array]":Lz,"[object Uint32Array]":$z,"[object Float32Array]":Uz,"[object Float64Array]":jz,"[object BigInt64Array]":qz,"[object BigUint64Array]":Vz},$a={serialize:async function(t){let e=t!=null?wK.call(t):"";if(e==="[object ArrayBuffer]")return ny+yz+ry(t);if(function(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}(t)){let n=bK[e];if(!n)throw Je("SERIALIZATION_FAILED","Failed to get type for BinaryArray",{valueType:e});let r=t.byteOffset,i=t.byteLength,s=t.buffer,o=s instanceof ArrayBuffer?s.slice(r,r+i):new Uint8Array(s,r,i).slice().buffer;return ny+n+ry(o)}if(e==="[object Blob]"){let n=t,r=await n.arrayBuffer(),i="~~local_forage_type~"+n.type+"~"+ry(r);return ny+Ik+i}try{return JSON.stringify(t)}catch(n){throw console.error("Couldn't convert value into a JSON string: ",t),n}},deserialize:function(t){if(t.substring(0,9)!==ny)return JSON.parse(t);let e=t.substring(13),n=t.substring(9,13),r,i=e;if(n===Ik&&gz.test(e)){let a=e.match(gz);a&&(r=a[1],i=e.substring(a[0].length))}let s=wz(i),o=Wk();switch(n){case yz:return s;case Ik:return Hk([s],{type:r});case Nz:return new o.Int8Array(s);case Mz:return new o.Uint8Array(s);case Rz:return new o.Uint8ClampedArray(s);case zz:return new o.Int16Array(s);case Bz:return new o.Uint16Array(s);case Lz:return new o.Int32Array(s);case $z:return new o.Uint32Array(s);case Uz:return new o.Float32Array(s);case jz:return new o.Float64Array(s);case qz:if(o.BigInt64Array===void 0)throw Je("DESERIALIZATION_FAILED","BigInt64Array is not supported in this environment",{operation:"deserialize",type:n});return new o.BigInt64Array(s);case Vz:if(o.BigUint64Array===void 0)throw Je("DESERIALIZATION_FAILED","BigUint64Array is not supported in this environment",{operation:"deserialize",type:n});return new o.BigUint64Array(s);default:throw Je("DESERIALIZATION_FAILED","Unknown type: "+n,{operation:"deserialize",type:n})}},stringToBuffer:wz,bufferToString:ry},Rk="local-forage-detect-blob-support",ru,$r={},iy=Object.prototype.toString,pi="asyncStorage",Ui="readonly",_o="readwrite",Kh=null,_n=(t,e,n,r="OPERATION_FAILED")=>t.catch(i=>{let s=i instanceof Error&&i.message?i.message:`IndexedDB ${e} failed`;throw ws(i,r,s,{driver:pi,operation:e,...n??{}})}),Hz=()=>typeof window<"u"&&window.navigator?window.navigator:typeof navigator<"u"?navigator:void 0;function zk(){return typeof indexedDB<"u"?indexedDB:typeof window<"u"&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB)||null}function Lk(t){return t?.idbFactory?t.idbFactory:zk()}function bz(t){return typeof ru=="boolean"?Promise.resolve(ru):Kh||(Kh=new Promise(e=>{let n=t.transaction(Rk,_o),r=Hk([""]);n.objectStore(Rk).put(r,"key"),n.onabort=i=>{i.preventDefault(),i.stopPropagation(),e(!1)},n.onerror=n.onabort,n.oncomplete=()=>{let i=Hz(),s=i?.userAgent??"",o=s.match(/Chrome\/(\d+)/),a=s.match(/Edge\//),l=o?parseInt(o[1],10):NaN,c=!!a||!o||Number.isNaN(l)||l>=43;e(c)}}).then(e=>(ru=e,Kh=null,e)).catch(()=>(Kh=null,ru=!1,!1)),Kh)}async function Zh(t,e){if(typeof ru=="boolean")return ru;let n=e??t.db;if(n)return bz(n);if(await Yz(t),!t.db)throw Je("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:pi});return bz(t.db)}async function Ak(t){let e=await async function(n){if(typeof n.arrayBuffer=="function")return n.arrayBuffer();if(typeof FileReader>"u")throw Je("BLOB_UNSUPPORTED","Blob serialization not supported in this environment",{driver:pi});return new Promise((r,i)=>{let s=new FileReader;s.onerror=()=>i(s.error),s.onloadend=()=>r(s.result),s.readAsArrayBuffer(n)})}(t);return{__local_forage_encoded_blob:!0,data:$a.bufferToString(e),type:t.type}}function Yh(t){return Hk([$a.stringToBuffer(t.data)],{type:t.type})}function Jh(t){return!!t?.__local_forage_encoded_blob}function Wz(t){if(t.name)return t.name;throw Je("INVALID_CONFIG","IndexedDB database name is not configured.",{driver:pi,configKey:"name"})}function Cn(t){if(t.storeName)return t.storeName;throw Je("INVALID_CONFIG","IndexedDB storeName is not configured.",{driver:pi,configKey:"storeName"})}function Ua(t){let e=Wz(t);return t.bucket?.name?`${t.bucket.name}::${e}`:e}function Fo(t){return $r[Ua(t)]}function ly(t){let e=Ua(t);return $r[e]=$r[e]||{forages:[],db:null,dbReady:null,deferredOperations:[],prewarmPromise:null,prewarmed:!1,idleTimer:null,activeTransactions:0,pendingTransactions:[],coalesceStates:{}},$r[e]}function Gk(t){return Cn(t)}function Gz(t){let e=Fo(t);if(e)return e.coalesceStates[Gk(t)]}function vz(t){let e=Fo(t);if(!e)return;let n=Gk(t),r=e.coalesceStates[n];r&&(r.timer&&clearTimeout(r.timer),delete e.coalesceStates[n])}function oy(t){let e=ly(t),n={promise:null,resolve:null,reject:null};n.promise=new Promise((r,i)=>{n.resolve=r,n.reject=i}),e.deferredOperations.push(n),e.dbReady?e.dbReady=e.dbReady.then(()=>n.promise):e.dbReady=n.promise}function Bk(t){let e=Fo(t);if(!e)return;let n=e.deferredOperations.pop();return n?(n.resolve(),n.promise):void 0}function $k(t,e){let n=Fo(t);if(!n)return;let r=n.deferredOperations.pop();return r?(r.reject(e),r.promise):void 0}function iu(t,e){return new Promise((n,r)=>{let i=Lk(t);if(!i)return r(Je("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:pi}));let s=Ua(t);if($r[s]=$r[s]||{forages:[],db:null,dbReady:null,deferredOperations:[],prewarmPromise:null,prewarmed:!1,idleTimer:null,activeTransactions:0,pendingTransactions:[],coalesceStates:{}},t.db){if(!e)return n(t.db);oy(t),t.db.close()}let o=e?i.open(t.name,t.version):i.open(t.name);e&&(o.onupgradeneeded=a=>{let l=a.target.result;try{l.createObjectStore(t.storeName),a.oldVersion<=1&&l.createObjectStore(Rk)}catch(c){if(c.name!=="ConstraintError")throw c;console.warn(`The database "${t.name}" has been upgraded from version ${a.oldVersion} to version ${a.newVersion}, but the storage "${t.storeName}" already exists.`)}}),o.onerror=a=>{a.preventDefault(),r(a.target.error)},o.onsuccess=()=>{let a=o.result;a.onversionchange=l=>{l.target.close();let c=Ua(t),u=$r[c];if(u){u.db=null,u.prewarmed=!1;for(let f of u.forages)f._dbInfo.db=null}},n(a),Bk(t)}})}function Qz(t,e){if(!t.db)return!0;let n=!t.db.objectStoreNames.contains(t.storeName),r=t.version<t.db.version,i=t.version>t.db.version;if(r&&(t.version!==e&&console.warn(`The database "${t.name}" can't be downgraded from version ${t.db.version} to version ${t.version}.`),t.version=t.db.version),i||n){if(n){let s=t.db.version+1;s>t.version&&(t.version=s)}return!0}return!1}function Kz(t,e){if(e===_o&&t.durability)return{durability:t.durability}}function Zz(t){let e=Fo(t),n=t.connectionIdleMs;e&&e.db&&n&&!(n<=0)&&(e.idleTimer&&clearTimeout(e.idleTimer),e.idleTimer=setTimeout(()=>{if(e.pendingTransactions.length>0||e.activeTransactions>0)Zz(t);else{try{e.db?.close()}catch{}e.db=null,e.prewarmed=!1;for(let r of e.forages)r._dbInfo.db=null}},n))}function kz(t,e,n){let r=function(l){let c=ly(l),u=Gk(l);return c.coalesceStates[u]=c.coalesceStates[u]||{storeName:u,queue:[],timer:null,coalescing:!1,drainPromise:null,stats:{totalWrites:0,coalescedWrites:0,transactionsSaved:0}},c.coalesceStates[u]}(t),i=e.type==="set"?{type:"set",key:e.key,value:e.value,resolve:()=>{},reject:()=>{}}:{type:"remove",key:e.key,resolve:()=>{},reject:()=>{}};r.queue.push(i),r.stats.totalWrites++;let s=t.coalesceWindowMs??8,o=t.coalesceMaxBatchSize;typeof o=="number"&&Number.isFinite(o)&&o>0&&r.queue.length>=o?nd(t,r):r.timer||(r.timer=setTimeout(()=>{r.timer=null,nd(t,r)},s));let a=new Promise((l,c)=>{i.resolve=l,i.reject=c});return n?.resolveImmediately?(a.catch(l=>console.warn("[localspace] coalesced write failed (eventual mode)",l)),e.type==="set"?Promise.resolve(e.value):Promise.resolve()):a}function nd(t,e){if(e.timer&&(clearTimeout(e.timer),e.timer=null),e.coalescing)return e.drainPromise??Promise.resolve();let n=e.queue.splice(0);if(n.length===0)return Promise.resolve();let r=function(a,l){return a.storeName===l.storeName?a:{...a,storeName:l.storeName}}(t,e),i=t.coalesceMaxBatchSize,s=typeof i=="number"&&Number.isFinite(i)&&i>0?ji(n,i):[n];e.coalescing=!0;let o=new Promise((a,l)=>{let c=u=>new Promise((f,h)=>{Hn(r,_o,(d,p)=>{if(!d&&p)try{let g=Cn(r),y=p.objectStore(g),w=null;for(let b of u)if(b.type==="set"){let S=y.put(b.value,b.key);S.onerror=()=>{w=S.error||new Error(`Failed to set "${String(b.key)}"`)}}else{let S=y.delete(b.key);S.onerror=()=>{w=S.error||new Error(`Failed to remove "${String(b.key)}"`)}}p.oncomplete=()=>{for(let b of u)b.type==="set"?b.resolve(b.value):b.resolve();u.length>1&&(e.stats.coalescedWrites+=u.length,e.stats.transactionsSaved+=u.length-1),f()},p.onabort=p.onerror=()=>{h(w||p.error||new Error("Failed to apply coalesced writes"))}}catch(g){h(g)}else h(d||new Error("Failed to create transaction"))})});(async()=>{for(let u of s)await c(u)})().then(()=>a()).catch(u=>{for(let f of n)f.reject(u);l(u)})});return e.drainPromise=o.then(()=>{if(e.coalescing=!1,e.queue.length>0)return nd(t,e)}).catch(a=>{throw e.coalescing=!1,a}).finally(()=>{e.coalescing||e.queue.length!==0||(e.drainPromise=null)}),e.drainPromise}function yr(t,e){if(!e?.force&&!t.coalesceWrites||!e?.force&&t.coalesceReadConsistency==="eventual")return Promise.resolve();let n=Fo(t);if(!n)return Promise.resolve();if(e?.scope==="database")return Object.values(n.coalesceStates).reduce((i,s)=>i.then(()=>nd(t,s)),Promise.resolve());let r=Gz(t);return r?nd(t,r):Promise.resolve()}function Hn(t,e,n,r=1){let i=s=>{!(r>0)||t.db&&s.name!=="InvalidStateError"&&s.name!=="NotFoundError"?n(s):Promise.resolve().then(()=>{if(!t.db||s.name==="NotFoundError"&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),iu(t,!0)}).then(()=>Yz(t).then(()=>{Hn(t,e,n,r-1)})).catch(n)};try{let s=ly(t);s.idleTimer&&(clearTimeout(s.idleTimer),s.idleTimer=null);let o=t.maxConcurrentTransactions,a=()=>{if(s.pendingTransactions.length>0){let c=s.pendingTransactions.shift();c&&setTimeout(c,0)}},l=()=>{try{let c=Kz(t,e),u=c?t.db.transaction(t.storeName,e,c):t.db.transaction(t.storeName,e);s.activeTransactions+=1;let f=!1,h=()=>{f||(f=!0,s.activeTransactions=Math.max(0,s.activeTransactions-1),Zz(t),a())};u.addEventListener("complete",h),u.addEventListener("abort",h),u.addEventListener("error",h),n(null,u)}catch(c){i(c)}};if(o&&o>0&&s.activeTransactions>=o)return void s.pendingTransactions.push(l);l()}catch(s){i(s)}}function Yz(t){oy(t);let e=Ua(t),n=$r[e],r=n.forages;for(let i of r)i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null);return t.db=null,n.db=null,iu(t,!1).then(i=>(t.db=i,Qz(t,1)?iu(t,!0):i)).then(i=>{t.db=n.db=i;for(let s of r)s._dbInfo.db=i}).catch(i=>{throw $k(t,i),i})}function vK(t){let e=this,n=(e._initReady??e.ready).bind(e),r=_n(n().then(()=>{if(e._dbInfo){let i=Fo(e._dbInfo);if(i&&i.dbReady)return i.dbReady}}),"ready");return ke(r,t),r}var kK={_driver:"asyncStorage",_initStorage:async function(t){let e=this,n={db:null};for(let c in t)Object.assign(n,{[c]:t[c]});if(n.idbFactory=await async function(c){if(c.bucket?.name){let u=typeof navigator<"u"?navigator:void 0,f=u?.storageBuckets;if(f&&typeof f.open=="function")try{return(await f.open(c.bucket.name,{durability:c.bucket.durability,persisted:c.bucket.persisted})).indexedDB??null}catch(h){console.warn(`Failed to open storage bucket "${c.bucket.name}", falling back to default bucket.`,h)}}return zk()}(t),!n.idbFactory)throw Je("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:pi});Wz(n),Ua(n);let r=ly(n);r.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=vK);let i=[];function s(){return Promise.resolve()}for(let c of r.forages)if(c!==e){let u=(c._initReady??c.ready).bind(c);i.push(u().catch(s))}let o=r.forages.slice(0);await Promise.all(i),n.db=r.db;let a=await iu(n,!1);if(n.db=a,Qz(n,e._defaultConfig.version??1)){let c=await iu(n,!0);n.db=r.db=c}else n.db=r.db=a;e._dbInfo=n;for(let c of o)c!==e&&(c._dbInfo.db=n.db,c._dbInfo.version=n.version);let l=function(c,u){if(c.prewarmTransactions===!1)return;if(u.prewarmed||u.prewarmPromise)return u.prewarmPromise||Promise.resolve();let f=new Promise(h=>{try{let d=Cn(c),p=Kz(c,Ui),g=p?c.db.transaction(d,Ui,p):c.db.transaction(d,Ui);g.objectStore(d).count(),g.oncomplete=()=>h(),g.onabort=g.onerror=()=>h()}catch{h()}});return u.prewarmPromise=f,f.finally(()=>{u.prewarmPromise=null,u.prewarmed=!0}),f}(n,r);l&&l.catch(()=>{})},_support:()=>function(){try{let t=zk();if(!t)return!1;let e=Hz(),n=e?.userAgent??"";return!(e&&/Safari/.test(n)&&!/Chrome/.test(n))||new Promise(r=>{let i=t.open("__localforage_test");i.onsuccess=()=>{i.result.close(),t.deleteDatabase("__localforage_test"),r(!0)},i.onerror=()=>r(!1)})}catch{return!1}}(),iterate:function(t,e){let n=this,r=new Promise((s,o)=>{n.ready().then(()=>yr(n._dbInfo)).then(()=>{Hn(n._dbInfo,Ui,(a,l)=>{if(a)return o(a);try{let c=Cn(n._dbInfo),u=l.objectStore(c).openCursor(),f=1;u.onsuccess=()=>{let h=u.result;if(h){let d=h.value;d===void 0&&(d=null),Jh(d)&&(d=Yh(d));let p=t(d,h.key,f++);p!==void 0?s(p):h.continue()}else s(void 0)},u.onerror=()=>o(u.error)}catch(c){o(c)}})}).catch(o)}),i=_n(r,"iterate");return ke(i,e),i},getItem:function(t,e){let n=this;t=ht(t);let r=new Promise((s,o)=>{n.ready().then(()=>yr(n._dbInfo)).then(()=>{Hn(n._dbInfo,Ui,(a,l)=>{if(a)return o(a);try{let c=Cn(n._dbInfo),u=l.objectStore(c).get(t);u.onsuccess=()=>{let f=u.result;f===void 0&&(f=null),Jh(f)&&(f=Yh(f)),s(f)},u.onerror=()=>o(u.error)}catch(c){o(c)}})}).catch(o)}),i=_n(r,"getItem",{key:t},"OPERATION_FAILED");return ke(i,e),i},getItems:function(t,e){let n=this,r=t.map(o=>ht(o)),i=new Promise(async(o,a)=>{try{if(await n.ready(),await yr(n._dbInfo),r.length===0)return void o([]);let l=n._dbInfo,c=l.maxBatchSize??r.length,u=new Array(r.length),f=(p,g)=>new Promise((y,w)=>{Hn(l,Ui,(b,S)=>{if(b)return w(b);try{let D=Cn(l),k=S.objectStore(D),E=null,v=p.length;p.forEach((_,C)=>{let A=k.get(_);A.onsuccess=()=>{let P=A.result;P===void 0&&(P=null),Jh(P)&&(P=Yh(P)),u[g+C]={key:_,value:P},v-=1,v===0&&y()},A.onerror=()=>{E=A.error||new Error(`Failed to get "${_}"`)}}),S.onabort=S.onerror=()=>{w(E||S.error||new Error("Failed to get items transaction"))}}catch(D){w(D)}})}),h=ji(r,c),d=0;for(let p of h)await f(p,d),d+=p.length;o(u)}catch(l){a(l)}}),s=_n(i,"getItems",{keys:r},"OPERATION_FAILED");return ke(s,e),s},setItem:async function(t,e,n){let r=this;t=ht(t);let i=new Promise(async(o,a)=>{let l;try{l=r._dbInfo,l&&l.db||(await r.ready(),l=r._dbInfo),l.coalesceWrites&&l.coalesceReadConsistency!=="eventual"&&await yr(l),iy.call(e)==="[object Blob]"&&(await Zh(l)||(e=await Ak(e)));let c=e===void 0?null:e,u=!!l.coalesceWrites,f=l.coalesceReadConsistency==="eventual",h=u&&f&&!!l.coalesceFireAndForget;if(u){let d=kz(l,{type:"set",key:t,value:c},{resolveImmediately:h});return h?void o(c):void d.then(p=>o(p)).catch(a)}Hn(l,_o,(d,p)=>{if(d)return a(d);try{let g=Cn(l),y=p.objectStore(g).put(c,t);p.oncomplete=()=>{o(c)},p.onabort=p.onerror=()=>{let w=y.error||p.error;a(w)}}catch(g){a(g)}})}catch(c){a(c)}}),s=_n(i,"setItem",{key:t});return ke(s,n),s},setItems:function(t,e){let n=this,r=ay(t),i=r.map(a=>a.key),s=new Promise(async(a,l)=>{try{await n.ready(),await yr(n._dbInfo);let c=n._dbInfo,u;r.some(p=>iy.call(p.value)==="[object Blob]")&&(u=await Zh(c));let f=ji(r,c.maxBatchSize??r.length),h=[],d=async p=>{let g=[];for(let y of p){let w=y.value;w===void 0&&(w=null),iy.call(y.value)==="[object Blob]"&&((typeof u=="boolean"?u:await Zh(c))||(w=await Ak(y.value))),g.push({key:y.key,value:w})}return new Promise((y,w)=>{Hn(c,_o,(b,S)=>{if(b)return w(b);try{let D=Cn(c),k=S.objectStore(D),E=null;for(let v of g){let _=k.put(v.value,v.key);_.onerror=()=>{E=_.error||new Error(`Failed to set "${String(v.key)}"`)}}S.oncomplete=()=>y(g),S.onabort=S.onerror=()=>{w(E||S.error||new Error("Failed to set items transaction"))}}catch(D){w(D)}})})};for(let p of f){let g=await d(p);h.push(...g)}a(h)}catch(c){l(c)}}),o=_n(s,"setItems",{keys:i},"OPERATION_FAILED");return ke(o,e),o},removeItem:function(t,e){let n=this;t=ht(t);let r=new Promise((s,o)=>{(async()=>{let a=n._dbInfo;a&&a.db||(await n.ready(),a=n._dbInfo);let l=!!a.coalesceWrites,c=a.coalesceReadConsistency==="eventual",u=l&&c&&!!a.coalesceFireAndForget;if(l){let f=kz(a,{type:"remove",key:t},{resolveImmediately:u});return u?void s():void f.then(()=>s()).catch(o)}Hn(a,_o,(f,h)=>{if(f)return o(f);try{let d=Cn(a),p=h.objectStore(d).delete(t);h.oncomplete=()=>s(),h.onerror=()=>o(p.error),h.onabort=()=>{let g=p.error||h.error;o(g)}}catch(d){o(d)}})})().catch(o)}),i=_n(r,"removeItem",{key:t});return ke(i,e),i},removeItems:function(t,e){let n=this,r=t.map(o=>ht(o)),i=new Promise(async(o,a)=>{try{if(await n.ready(),r.length===0)return void o();let l=n._dbInfo,c=l.maxBatchSize??r.length;await yr(l,{force:!0});let u=h=>new Promise((d,p)=>{Hn(l,_o,(g,y)=>{if(g)return p(g);try{let w=Cn(l),b=y.objectStore(w),S=null;for(let D of h){let k=b.delete(D);k.onerror=()=>{S=k.error||new Error(`Failed to remove "${D}"`)}}y.oncomplete=()=>d(),y.onabort=y.onerror=()=>{p(S||y.error||new Error("Failed to remove items transaction"))}}catch(w){p(w)}})}),f=ji(r,c);for(let h of f)await u(h);o()}catch(l){a(l)}}),s=_n(i,"removeItems",{keys:r});return ke(s,e),s},runTransaction:function(t,e,n){let r=this,i=new Promise(async(o,a)=>{try{await r.ready();let l=r._dbInfo,c;await yr(l,{force:!0});try{c=await Zh(l)}catch{c=void 0}Hn(l,t,(u,f)=>{if(!u&&f)try{let h=Cn(l),d=f.objectStore(h),p=c,g=()=>{try{return f.objectStore(h),!0}catch{return!1}},y=async()=>(typeof p=="boolean"||(p=await Zh(l,f.db)),p),w=()=>{if(t===Ui)throw Je("TRANSACTION_READONLY","Transaction is readonly",{driver:pi,operation:"runTransaction",transactionMode:t})},b={get:E=>new Promise((v,_)=>{let C=d.get(ht(E));C.onsuccess=()=>{let A=C.result;A===void 0&&(A=null),Jh(A)&&(A=Yh(A)),v(A)},C.onerror=()=>_(C.error)}),set:async(E,v)=>{w();let _=v;if(_===void 0&&(_=null),iy.call(v)==="[object Blob]"&&(await y()||(_=await Ak(v))),!g())throw new Error("Transaction became inactive while preparing data.");return new Promise((C,A)=>{let P=d.put(_,ht(E));P.onsuccess=()=>C(_),P.onerror=()=>A(P.error)})},remove:E=>new Promise((v,_)=>{w();let C=d.delete(ht(E));C.onsuccess=()=>v(),C.onerror=()=>_(C.error)}),keys:()=>new Promise((E,v)=>{let _=[],C=d.openKeyCursor();C.onsuccess=()=>{let A=C.result;A?(_.push(A.key),A.continue()):E(_)},C.onerror=()=>v(C.error)}),iterate:E=>new Promise((v,_)=>{let C=d.openCursor(),A=1;C.onsuccess=()=>{let P=C.result;if(P){let N=P.value;N===void 0&&(N=null),Jh(N)&&(N=Yh(N));let B=E(N,P.key,A++);B!==void 0?v(B):P.continue()}else v(void 0)},C.onerror=()=>_(C.error)}),clear:()=>new Promise((E,v)=>{w();let _=d.clear();_.onsuccess=()=>E(),_.onerror=()=>v(_.error)})},S=Promise.resolve().then(()=>e(b)),D=new Promise((E,v)=>{f.oncomplete=()=>E(),f.onabort=()=>v(f.error||new Error("Transaction aborted")),f.onerror=()=>v(f.error||new Error("Transaction error"))}),k=S.catch(E=>{try{f.abort()}catch{}throw E});Promise.allSettled([k,D]).then(([E,v])=>{E.status!=="rejected"?v.status!=="rejected"?o(E.value):a(v.reason):a(E.reason)})}catch(h){a(h)}else a(u||new Error("Failed to create transaction"))})}catch(l){a(l)}}),s=_n(i,"runTransaction",{transactionMode:t});return ke(s,n),s},clear:function(t){let e=this,n=new Promise((i,s)=>{e.ready().then(()=>yr(e._dbInfo,{force:!0})).then(()=>{Hn(e._dbInfo,_o,(o,a)=>{if(o)return s(o);try{let l=Cn(e._dbInfo),c=a.objectStore(l).clear();a.oncomplete=()=>i(),a.onabort=a.onerror=()=>{let u=c.error||a.error;s(u)}}catch(l){s(l)}})}).catch(s)}),r=_n(n,"clear");return ke(r,t),r},length:function(t){let e=this,n=new Promise((i,s)=>{e.ready().then(()=>yr(e._dbInfo)).then(()=>{Hn(e._dbInfo,Ui,(o,a)=>{if(o)return s(o);try{let l=Cn(e._dbInfo),c=a.objectStore(l).count();c.onsuccess=()=>i(c.result),c.onerror=()=>s(c.error)}catch(l){s(l)}})}).catch(s)}),r=_n(n,"length");return ke(r,t),r},key:function(t,e){let n=this,r=new Promise((s,o)=>{t<0?s(null):n.ready().then(()=>yr(n._dbInfo)).then(()=>{Hn(n._dbInfo,Ui,(a,l)=>{if(a)return o(a);try{let c=Cn(n._dbInfo),u=l.objectStore(c),f=!1,h=u.openKeyCursor();h.onsuccess=()=>{let d=h.result;d?t===0||f?s(d.key):(f=!0,d.advance(t)):s(null)},h.onerror=()=>o(h.error)}catch(c){o(c)}})}).catch(o)}),i=_n(r,"key",{keyIndex:t});return ke(i,e),i},keys:function(t){let e=this,n=new Promise((i,s)=>{e.ready().then(()=>yr(e._dbInfo)).then(()=>{Hn(e._dbInfo,Ui,(o,a)=>{if(o)return s(o);try{let l=Cn(e._dbInfo),c=a.objectStore(l).openKeyCursor(),u=[];c.onsuccess=()=>{let f=c.result;f?(u.push(f.key),f.continue()):i(u)},c.onerror=()=>s(c.error)}catch(l){s(l)}})}).catch(s)}),r=_n(n,"keys");return ke(r,t),r},dropInstance:function(t,e){let n=this,r=n.config(),i={...typeof t=="object"?t:{}};if(i.name||(i.name=r.name,i.storeName||(i.storeName=r.storeName)),!i.name){let p=Promise.reject(Je("INVALID_ARGUMENT","Invalid arguments",{driver:pi,operation:"dropInstance"})),g=_n(p,"dropInstance",{name:i.name,storeName:i.storeName});return ke(g,e),g}let s=n._dbInfo,o={...i,idbFactory:s?.idbFactory??void 0,coalesceWrites:s?.coalesceWrites,coalesceWindowMs:s?.coalesceWindowMs,coalesceReadConsistency:s?.coalesceReadConsistency,coalesceMaxBatchSize:s?.coalesceMaxBatchSize,coalesceFireAndForget:s?.coalesceFireAndForget};!o.bucket&&r.bucket&&(o.bucket=r.bucket);let a=i.name,l=n._dbInfo?.db??null,c=a===r.name&&l!==null,u=Ua(o),f,h;f=c&&l?Promise.resolve(l):iu(o,!1).then(p=>{let g=$r[u];if(g){let y=g.forages;g.db=p;for(let w of y)w._dbInfo.db=p}return p}),h=i.storeName?f.then(async p=>{if(await yr(o,{force:!0,scope:"database"}),!p.objectStoreNames.contains(i.storeName))return void vz(o);let g=p.version+1;oy(o);let y=$r[u],w=y?.forages||[];p.close();for(let S of w)S._dbInfo.db=null,S._dbInfo.version=g;return new Promise((S,D)=>{let k=Lk(o);if(!k)return D(Je("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:pi}));let E=k.open(a,g);E.onerror=()=>{let v=E.result;v&&v.close(),D(E.error||new Error("Failed to open database"))},E.onupgradeneeded=()=>{let v=E.result;v.objectStoreNames.contains(i.storeName)&&v.deleteObjectStore(i.storeName)},E.onsuccess=()=>{let v=E.result;S(v)}}).then(S=>{if(y){y.db=S,vz(o);for(let D of w)D._dbInfo.db=S,Bk(D._dbInfo)}}).catch(S=>{throw y&&$k(i,S),S})}):f.then(async p=>{await yr(o,{force:!0,scope:"database"}),oy(o);let g=$r[u],y=g?.forages||[];p.close();for(let w of y)w._dbInfo.db=null;return new Promise((w,b)=>{let S=Lk(o);if(!S)return b(Je("DRIVER_UNAVAILABLE","IndexedDB not available",{driver:pi}));let D=S.deleteDatabase(a);D.onerror=()=>{b(D.error||new Error("Failed to delete database"))},D.onblocked=()=>{console.warn(`dropInstance blocked for database "${a}" until all open connections are closed`)},D.onsuccess=()=>{w()}}).then(()=>{if(g){g.db=null;for(let w of y)Bk(w._dbInfo);delete $r[u]}}).catch(w=>{throw g&&$k(o,w),w})});let d=_n(h,"dropInstance",{name:i.name,storeName:i.storeName});return ke(d,e),d},getPerformanceStats:function(){let t=this._dbInfo;if(!t)return{totalWrites:0,coalescedWrites:0,transactionsSaved:0,avgCoalesceSize:0};if(!Fo(t))return{totalWrites:0,coalescedWrites:0,transactionsSaved:0,avgCoalesceSize:0};let e=Gz(t);if(!e)return{totalWrites:0,coalescedWrites:0,transactionsSaved:0,avgCoalesceSize:0};let n=e.stats,r=n.coalescedWrites>0?n.coalescedWrites/(n.totalWrites-n.transactionsSaved||1):0;return{totalWrites:n.totalWrites,coalescedWrites:n.coalescedWrites,transactionsSaved:n.transactionsSaved,avgCoalesceSize:parseFloat(r.toFixed(2))}}},Co="localStorageWrapper",br=(t,e,n,r="OPERATION_FAILED")=>t.catch(i=>{let s=i instanceof Error&&i.message?i.message:`localStorage ${e} failed`;throw ws(i,r,s,{driver:Co,operation:e,...n??{}})});function xz(t,e){let n=t.name+"/";return t.storeName!==e.storeName&&(n+=t.storeName+"/"),n}function xK(){if(!function(){let t="_localforage_support_test";try{return localStorage.setItem(t,"true"),localStorage.removeItem(t),!1}catch{return!0}}())return!0;try{return localStorage.length>0}catch{return!1}}function Sz(t){let e=br(this.ready().then(()=>{let n=this._dbInfo.keyPrefix;for(let r=localStorage.length-1;r>=0;r--){let i=localStorage.key(r);i&&i.indexOf(n)===0&&localStorage.removeItem(i)}}),"clear");return ke(e,t),e}function Dz(t,e){let n=ht(t),r=br(this.ready().then(()=>{let i=this._dbInfo,s=localStorage.getItem(i.keyPrefix+n);return s===null?null:i.serializer.deserialize(s)}),"getItem",{key:n});return ke(r,e),r}function Ez(t,e){let n=br(this.ready().then(()=>{let r=this._dbInfo,i=r.keyPrefix,s=i.length,o=localStorage.length,a=1;for(let l=0;l<o;l++){let c=localStorage.key(l);if(!c||c.indexOf(i)!==0)continue;let u=localStorage.getItem(c),f=null;u!==null&&(f=r.serializer.deserialize(u));let h=t(f,c.substring(s),a++);if(h!==void 0)return h}}),"iterate");return ke(n,e),n}function Ok(t){let e=br(this.ready().then(()=>{let n=this._dbInfo,r=localStorage.length,i=[];for(let s=0;s<r;s++){let o=localStorage.key(s);o&&o.indexOf(n.keyPrefix)===0&&i.push(o.substring(n.keyPrefix.length))}return i}),"keys");return ke(e,t),e}function _z(t,e){let n=ht(t),r=br(this.ready().then(()=>{let i=this._dbInfo;localStorage.removeItem(i.keyPrefix+n)}),"removeItem",{key:n});return ke(r,e),r}async function Cz(t,e,n){let r=ht(t),i=br(this.ready().then(async()=>{let s=e===void 0?null:e,o=await this._dbInfo.serializer.serialize(s);try{return localStorage.setItem(this._dbInfo.keyPrefix+r,o),s}catch(a){throw a instanceof Error&&(a.name==="QuotaExceededError"||a.name==="NS_ERROR_DOM_QUOTA_REACHED")?ws(a,"QUOTA_EXCEEDED",a.message||"Storage quota exceeded",{driver:Co,operation:"setItem",key:r}):ws(a,"OPERATION_FAILED","Failed to set item in localStorage",{driver:Co,operation:"setItem",key:r})}}),"setItem",{key:r});return ke(i,n),i}var SK={_driver:"localStorageWrapper",_initStorage:async function(t){let e={...t,keyPrefix:xz(t,this._defaultConfig),serializer:$a};if(!xK())throw Je("DRIVER_UNAVAILABLE","localStorage not usable",{driver:Co});this._dbInfo=e},_support:async()=>function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:Ez,getItem:Dz,getItems:function(t,e){let n=t.map(i=>ht(i)),r=br(this.ready().then(()=>{let i=this._dbInfo,s=[],o=i.maxBatchSize??n.length;for(let a of ji(n,o))for(let l of a){let c=localStorage.getItem(i.keyPrefix+l);if(c===null){s.push({key:l,value:null});continue}let u=i.serializer.deserialize(c);s.push({key:l,value:u})}return s}),"getItems",{keys:n});return ke(r,e),r},setItem:Cz,setItems:function(t,e){let n=ay(t),r=n.map(s=>s.key),i=br(this.ready().then(async()=>{let s=this._dbInfo,o=[],a=s.maxBatchSize??n.length,l=new Map;for(let c of ji(n,a))for(let u of c){let f=u.value===void 0?null:u.value,h=await s.serializer.serialize(f);l.has(u.key)||l.set(u.key,localStorage.getItem(s.keyPrefix+u.key));try{localStorage.setItem(s.keyPrefix+u.key,h),o.push({key:u.key,value:f})}catch(d){for(let[p,g]of l.entries()){let y=s.keyPrefix+p;g===null?localStorage.removeItem(y):localStorage.setItem(y,g)}throw d instanceof Error&&(d.name==="QuotaExceededError"||d.name==="NS_ERROR_DOM_QUOTA_REACHED")?ws(d,"QUOTA_EXCEEDED",d.message||"Storage quota exceeded",{driver:Co,operation:"setItems",key:u.key}):ws(d,"OPERATION_FAILED","Failed to set items in localStorage",{driver:Co,operation:"setItems",key:u.key})}}return o}),"setItems",{keys:r});return ke(i,e),i},removeItem:_z,removeItems:function(t,e){let n=t.map(i=>ht(i)),r=br(this.ready().then(()=>{let i=this._dbInfo,s=i.maxBatchSize??n.length;for(let o of ji(n,s))for(let a of o)localStorage.removeItem(i.keyPrefix+a)}),"removeItems",{keys:n});return ke(r,e),r},clear:Sz,length:function(t){let e=br(Ok.call(this).then(n=>n.length),"length");return ke(e,t),e},key:function(t,e){let n=br(this.ready().then(()=>{let r=this._dbInfo.keyPrefix,i=[];for(let s=0;s<localStorage.length;s++){let o=localStorage.key(s);o&&o.indexOf(r)===0&&i.push(o.substring(r.length))}return t<0||t>=i.length?null:i[t]}),"key",{keyIndex:t});return ke(n,e),n},keys:Ok,runTransaction(t,e,n){let r=()=>{if(t==="readonly")throw Je("TRANSACTION_READONLY","Transaction is readonly",{driver:Co,operation:"runTransaction",transactionMode:t})},i={get:o=>Dz.call(this,o),set:(o,a)=>(r(),Cz.call(this,o,a)),remove:o=>(r(),_z.call(this,o)),keys:()=>Ok.call(this),iterate:o=>Ez.call(this,o),clear:()=>(r(),Sz.call(this))},s=br(Promise.resolve().then(()=>e(i)).catch(o=>{throw o}),"runTransaction",{transactionMode:t});return ke(s,n),s},dropInstance:function(t,e){let n={...t||{}};if(!n.name){let s=this.config();n.name=s.name,n.storeName=s.storeName}let r=n.name?new Promise(s=>{let o=n.storeName?xz(n,this._defaultConfig):`${n.name}/`;for(let a=localStorage.length-1;a>=0;a--){let l=localStorage.key(a);l&&l.indexOf(o)===0&&localStorage.removeItem(l)}s()}):Promise.reject(Je("INVALID_ARGUMENT","Invalid arguments",{driver:Co,operation:"dropInstance"})),i=br(r,"dropInstance",{name:n.name,storeName:n.storeName??this._defaultConfig.storeName});return ke(i,e),i}},Xc="memoryStorageWrapper",eu={},wr=(t,e,n,r="OPERATION_FAILED")=>t.catch(i=>{let s=i instanceof Error&&i.message?i.message:`memoryStorage ${e} failed`;throw ws(i,r,s,{driver:Xc,operation:e,...n??{}})});function DK(t,e){return eu[t]=eu[t]||{},eu[t][e]=eu[t][e]||new Map,eu[t][e]}async function tu(t){if(t===null||typeof t!="object")return t;if(typeof structuredClone=="function")return structuredClone(t);let e=await $a.serialize(t);return $a.deserialize(e)}async function Pk(t){return tu(t===void 0?null:t)}var EK={_driver:Xc,_initStorage:async function(t){let e=function(r){if(r.name)return r.name;throw Je("INVALID_CONFIG","Memory storage database name is not configured.",{driver:Xc,configKey:"name"})}(t),n=function(r){if(r.storeName)return r.storeName;throw Je("INVALID_CONFIG","Memory storage storeName is not configured.",{driver:Xc,configKey:"storeName"})}(t);this._dbInfo={...t,name:e,storeName:n,serializer:$a,store:DK(e,n)}},_support:!0,iterate:function(t,e){let n=wr(this.ready().then(async()=>{let r=1;for(let[i,s]of this._dbInfo.store.entries()){let o=t(await tu(s),i,r++);if(o!==void 0)return o}}),"iterate");return ke(n,e),n},getItem:function(t,e){let n=ht(t),r=wr(this.ready().then(async()=>this._dbInfo.store.has(n)?tu(this._dbInfo.store.get(n)):null),"getItem",{key:n});return ke(r,e),r},getItems:function(t,e){let n=t.map(i=>ht(i)),r=wr(this.ready().then(async()=>{let i=[],s=this._dbInfo.maxBatchSize??n.length;for(let o of ji(n,s))for(let a of o){if(!this._dbInfo.store.has(a)){i.push({key:a,value:null});continue}let l=await tu(this._dbInfo.store.get(a));i.push({key:a,value:l})}return i}),"getItems",{keys:n});return ke(r,e),r},setItem:function(t,e,n){let r=ht(t),i=wr(this.ready().then(async()=>{let s=await Pk(e);return this._dbInfo.store.set(r,s),s}),"setItem",{key:r});return ke(i,n),i},setItems:function(t,e){let n=ay(t),r=n.map(s=>s.key),i=wr(this.ready().then(async()=>{let s=this._dbInfo.maxBatchSize??n.length,o=[];for(let a of ji(n,s)){let l=[];for(let c of a)l.push({key:c.key,value:await Pk(c.value)});for(let c of l)this._dbInfo.store.set(c.key,c.value),o.push({key:c.key,value:c.value})}return o}),"setItems",{keys:r});return ke(i,e),i},removeItem:function(t,e){let n=ht(t),r=wr(this.ready().then(()=>{this._dbInfo.store.delete(n)}),"removeItem",{key:n});return ke(r,e),r},removeItems:function(t,e){let n=t.map(i=>ht(i)),r=wr(this.ready().then(()=>{let i=this._dbInfo.maxBatchSize??n.length;for(let s of ji(n,i))for(let o of s)this._dbInfo.store.delete(o)}),"removeItems",{keys:n});return ke(r,e),r},clear:function(t){let e=wr(this.ready().then(()=>{this._dbInfo.store.clear()}),"clear");return ke(e,t),e},length:function(t){let e=wr(this.ready().then(()=>this._dbInfo.store.size),"length");return ke(e,t),e},key:function(t,e){let n=wr(this.ready().then(()=>Array.from(this._dbInfo.store.keys())[t]??null),"key",{keyIndex:t});return ke(n,e),n},keys:function(t){let e=wr(this.ready().then(()=>Array.from(this._dbInfo.store.keys())),"keys");return ke(e,t),e},runTransaction:function(t,e,n){let r=wr(this.ready().then(async()=>{let i=this._dbInfo.store,s=t==="readwrite"?new Map(i):null,o=()=>{if(t==="readonly")throw Je("TRANSACTION_READONLY","Transaction is readonly",{driver:Xc,operation:"runTransaction",transactionMode:t})},a={get:async l=>{let c=ht(l);return i.has(c)?tu(i.get(c)):null},set:async(l,c)=>{o();let u=ht(l),f=await Pk(c);return i.set(u,f),f},remove:async l=>{o(),i.delete(ht(l))},keys:async()=>Array.from(i.keys()),iterate:async l=>{let c=1;for(let[u,f]of i.entries()){let h=l(await tu(f),u,c++);if(h!==void 0)return h}},clear:async()=>{o(),i.clear()}};try{return await e(a)}catch(l){if(s){i.clear();for(let[c,u]of s.entries())i.set(c,u)}throw l}}),"runTransaction",{transactionMode:t});return ke(r,n),r},dropInstance:function(t,e){let n=wr(this.ready().then(()=>{let r=this._dbInfo,i=t?.name??r.name;if(!i)throw Je("INVALID_ARGUMENT","Invalid arguments",{driver:Xc,operation:"dropInstance"});let s=t!==void 0,o=typeof t?.storeName=="string",a=o?t.storeName:r.storeName,l=eu[i];if(l)if(s&&!o)for(let c of Object.values(l))c.clear();else l[a]?.clear()}),"dropInstance",{name:t?.name??this._dbInfo.name,storeName:t?.storeName??this._dbInfo.storeName});return ke(n,e),n}},Uk=class extends Error{constructor(e="Plugin aborted the operation"){super(e),this.name="PluginAbortError"}},_K={LENIENT_WITH_ENCRYPTION:{condition:(t,e)=>t.some(n=>n.name==="encryption")&&e.pluginErrorPolicy==="lenient",message:"[localspace] Warning: Using lenient error policy with encryption plugin may silently fail decryption. Consider using strict policy for security-critical plugins."},LENIENT_WITH_COMPRESSION:{condition:(t,e)=>t.some(n=>n.name==="compression")&&e.pluginErrorPolicy==="lenient",message:"[localspace] Warning: Using lenient error policy with compression plugin may cause data corruption if decompression fails."},ENCRYPTION_BEFORE_COMPRESSION:{condition:t=>{let e=t.findIndex(s=>s.name==="encryption"),n=t.findIndex(s=>s.name==="compression");if(e===-1||n===-1)return!1;let r=t[e]?.priority??0,i=t[n]?.priority??0;return r>i||r===i&&e<n},message:"[localspace] Warning: Encryption plugin runs before compression (either due to higher priority or earlier registration order). This means data will be encrypted before compression, which reduces compression effectiveness. Consider adjusting priorities (compression should have higher priority than encryption) or registration order."},QUOTA_NOT_LAST:{condition:t=>{let e=t.find(r=>r.name==="quota");if(!e)return!1;let n=e.priority??0;return t.some(r=>r.name!=="quota"&&r.name!=="sync"&&(r.priority??0)<n)},message:"[localspace] Warning: Quota plugin may not measure final payload sizes correctly. Consider giving it a lower priority than transformation plugins (TTL, compression, encryption)."}},jk=class{constructor(e,n=[]){Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sharedMetadata",{enumerable:!0,configurable:!0,writable:!0,value:Object.create(null)}),Object.defineProperty(this,"pluginRegistry",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"initialized",{enumerable:!0,configurable:!0,writable:!0,value:new WeakSet}),Object.defineProperty(this,"initPromises",{enumerable:!0,configurable:!0,writable:!0,value:new WeakMap}),Object.defineProperty(this,"destroyed",{enumerable:!0,configurable:!0,writable:!0,value:new WeakSet}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:new WeakSet}),Object.defineProperty(this,"orderCounter",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"warningsEmitted",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),this.host=e,n.length&&this.registerPlugins(n)}validatePluginCombinations(){let e=this.pluginRegistry.map(r=>r.plugin),n=this.host._config;for(let[r,i]of Object.entries(_K))this.warningsEmitted.has(r)||i.condition(e,n)&&(console.warn(i.message),this.warningsEmitted.add(r))}hasPlugins(){return this.pluginRegistry.length>0}registerPlugins(e){for(let n of e)n&&this.pluginRegistry.push({plugin:n,order:this.orderCounter++});this.sortPlugins(),this.validatePluginCombinations()}sortPlugins(){this.pluginRegistry.sort((e,n)=>{let r=e.plugin.priority??0,i=n.plugin.priority??0;return r===i?e.order-n.order:i-r})}getActivePlugins(e){let n=e?.reverse??!1,r=this.pluginRegistry.map(i=>i.plugin).filter(i=>{if(this.disabled.has(i))return!1;let s=i.enabled;if(typeof s=="function")try{return!!s()}catch(o){return console.warn(`Plugin "${i.name}" enabled() check failed`,o),!1}return s!==!1});return n?r.slice().reverse():r}async ensureInitialized(){for(let e of this.getActivePlugins()){if(this.initialized.has(e))continue;if(typeof e.onInit!="function"){this.initialized.add(e);continue}let n=this.initPromises.get(e);if(n){await n;continue}let r=this.createContext(null),i=(async()=>{try{await e.onInit(r),this.initialized.add(e)}catch(s){if(await this.dispatchPluginError(e,s,"init","lifecycle",void 0,r),(this.host._config.pluginInitPolicy??"fail")==="disable-and-continue")return void this.disabled.add(e);throw s}finally{this.initPromises.delete(e)}})();this.initPromises.set(e,i),await i}}createContext(e){return{instance:this.host,driver:this.host.driver?this.host.driver():null,dbInfo:this.host._dbInfo??null,config:this.host._config,metadata:this.sharedMetadata,operation:e,operationState:Object.create(null)}}async beforeSet(e,n,r){let i=n;for(let s of this.getActivePlugins())s.beforeSet&&(i=await this.invokeValueHook(s,()=>s.beforeSet(e,i,r),"before","setItem",e,r,i));return i}async afterSet(e,n,r){for(let i of this.getActivePlugins({reverse:!0}))i.afterSet&&await this.invokeVoidHook(i,()=>i.afterSet(e,n,r),"after","setItem",e,r)}async beforeGet(e,n){let r=e;for(let i of this.getActivePlugins())i.beforeGet&&(r=await this.invokeValueHook(i,()=>i.beforeGet(r,n),"before","getItem",r,n,r));return r}async afterGet(e,n,r){let i=n;for(let s of this.getActivePlugins({reverse:!0}))s.afterGet&&(i=await this.invokeValueHook(s,()=>s.afterGet(e,i,r),"after","getItem",e,r,i));return i}async beforeRemove(e,n){let r=e;for(let i of this.getActivePlugins())i.beforeRemove&&(r=await this.invokeValueHook(i,()=>i.beforeRemove(r,n),"before","removeItem",r,n,r));return r}async afterRemove(e,n){for(let r of this.getActivePlugins({reverse:!0}))r.afterRemove&&await this.invokeVoidHook(r,()=>r.afterRemove(e,n),"after","removeItem",e,n)}async beforeSetItems(e,n){let r=e;for(let i of this.getActivePlugins())i.beforeSetItems&&(r=await this.invokeValueHook(i,()=>i.beforeSetItems(r,n),"before","setItems",void 0,n,r));return r}async afterSetItems(e,n){let r=e;for(let i of this.getActivePlugins({reverse:!0}))i.afterSetItems&&(r=await this.invokeValueHook(i,()=>i.afterSetItems(r,n),"after","setItems",void 0,n,r));return r}async beforeGetItems(e,n){let r=e;for(let i of this.getActivePlugins())i.beforeGetItems&&(r=await this.invokeValueHook(i,()=>i.beforeGetItems(r,n),"before","getItems",void 0,n,r));return r}async afterGetItems(e,n){let r=e;for(let i of this.getActivePlugins({reverse:!0}))i.afterGetItems&&(r=await this.invokeValueHook(i,()=>i.afterGetItems(r,n),"after","getItems",void 0,n,r));return r}async beforeRemoveItems(e,n){let r=e;for(let i of this.getActivePlugins())i.beforeRemoveItems&&(r=await this.invokeValueHook(i,()=>i.beforeRemoveItems(r,n),"before","removeItems",void 0,n,r));return r}async afterRemoveItems(e,n){for(let r of this.getActivePlugins({reverse:!0}))r.afterRemoveItems&&await this.invokeVoidHook(r,()=>r.afterRemoveItems(e,n),"after","removeItems",void 0,n)}async destroy(){let e=this.pluginRegistry.map(n=>n.plugin).slice().reverse();for(let n of e){if(this.destroyed.has(n)||this.disabled.has(n))continue;if(typeof n.onDestroy!="function"){this.destroyed.add(n);continue}let r=this.createContext(null);try{await n.onDestroy(r)}catch(i){await this.dispatchPluginError(n,i,"destroy","lifecycle",void 0,r)}finally{this.destroyed.add(n)}}}normalizeBatch(e){return ay(e)}shouldPropagate(e,n){return n==="strict"||e instanceof Ba||e instanceof Uk}async dispatchPluginError(e,n,r,i,s,o){let a={plugin:e.name,operation:i,stage:r,key:s,context:o,error:n};if(typeof e.onError=="function")try{return void await e.onError(n,a)}catch(l){console.error(`Plugin onError handler failed for "${e.name}"`,l)}console.warn(`Plugin "${e.name}" error during ${i}`,n)}async invokeValueHook(e,n,r,i,s,o,a){try{let l=await n();return l===void 0?a:l}catch(l){let c=this.host._config.pluginErrorPolicy??"strict";if(this.shouldPropagate(l,c))throw l;return await this.dispatchPluginError(e,l,r,i,s,o),a}}async invokeVoidHook(e,n,r,i,s,o){try{await n()}catch(a){let l=this.host._config.pluginErrorPolicy??"strict";if(this.shouldPropagate(a,l))throw a;await this.dispatchPluginError(e,a,r,i,s,o)}}},nu={},Xh={},td={INDEXEDDB:kK,LOCALSTORAGE:SK,MEMORY:EK},CK=[td.INDEXEDDB._driver,td.LOCALSTORAGE._driver],sy={},qk=["dropInstance","setItems","getItems","removeItems","runTransaction"],Tz=["clear","getItem","getItems","iterate","key","keys","length","removeItem","removeItems","setItem","setItems","runTransaction"].concat(qk),Fz=["setItem","getItem","removeItem","setItems","getItems","removeItems"],TK={description:"",driver:CK.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1,compatibilityMode:!1,coalesceWrites:!1,coalesceWindowMs:8,coalesceReadConsistency:"strong",coalesceFireAndForget:!1,coalesceMaxBatchSize:void 0,pluginInitPolicy:"fail",pluginErrorPolicy:"lenient"},ed=(t,e)=>{if(t)return n=>{e?.compatibilityMode?t(n):t(n,void 0)}};function FK(t,e){t[e]=function(...n){return t.ready().then(()=>t[e].apply(t,n))}}function IK(t,e){let n=e._driver;if(nu[n])return Promise.resolve();let r=sy[n];if(r)return r;let i=t.defineDriver(e).finally(()=>{sy[n]===i&&delete sy[n]});return sy[n]=i,i}var Vk=class t{constructor(e){Object.defineProperty(this,"INDEXEDDB",{enumerable:!0,configurable:!0,writable:!0,value:"asyncStorage"}),Object.defineProperty(this,"LOCALSTORAGE",{enumerable:!0,configurable:!0,writable:!0,value:"localStorageWrapper"}),Object.defineProperty(this,"MEMORY",{enumerable:!0,configurable:!0,writable:!0,value:"memoryStorageWrapper"}),Object.defineProperty(this,"REACTNATIVEASYNCSTORAGE",{enumerable:!0,configurable:!0,writable:!0,value:"reactNativeAsyncStorageWrapper"}),Object.defineProperty(this,"_defaultConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_driverSet",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pendingDriverInitialization",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_isRunningDefaultDriverSelection",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_manualDriverOverride",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_initDriver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_ready",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_dbInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_driver",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pluginManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rawDriverMethods",{enumerable:!0,configurable:!0,writable:!0,value:{}});let n=[],{plugins:r=[],...i}=e??{};for(let o in td)if(Object.prototype.hasOwnProperty.call(td,o)){let a=td[o],l=a._driver;this[o]=l,n.push(IK(this,a).catch(c=>{console.warn(`Failed to define LocalSpace driver "${l}"`,c)}))}this._defaultConfig=Fk({},TK),this._config=Fk({},this._defaultConfig,i),this._pluginManager=new jk(this,r),this._wrapLibraryMethodsWithReady();let s=n.length>0?Promise.all(n).then(()=>{}):Promise.resolve();this._pendingDriverInitialization=s.then(()=>this._runDefaultDriverSelection()),this._pendingDriverInitialization.then(()=>{this._pendingDriverInitialization=null},()=>{this._pendingDriverInitialization=null})}config(e){if(typeof e=="object"&&e!==null){if(this._ready)return Je("CONFIG_LOCKED","Can't call config() after LocalSpace has been used.",{operation:"config"});let n=e;for(let i of Object.keys(n)){let s=n[i];if(i==="version"&&typeof s!="number")return Je("INVALID_CONFIG","Database version must be a number.",{configKey:"version",providedType:typeof s})}let r=this._config;for(let i of Object.keys(n)){let s=n[i];i!=="storeName"||typeof s!="string"?r[i]=s:r.storeName=s.replace(/\W/g,"_")}return!n.driver||this.setDriver(this._config.driver)}if(typeof e=="string"){let n=e;return this._config[n]}return this._config}createInstance(e){return new t(e)}use(e){let n=Array.isArray(e)?e:[e];return this._pluginManager.registerPlugins(n),this._refreshPluginWrappers(),this}async destroy(){await this._pluginManager.ensureInitialized(),await this._pluginManager.destroy()}async defineDriver(e,n,r){let i=new Promise(async(o,a)=>{try{let l=e._driver,c=Je("DRIVER_COMPLIANCE","Custom driver not compliant",{driver:l});if(!e._driver)return void a(c);let u=e,f=Tz.concat("_initStorage");for(let d of f){let p=!yK(qk,d),g=u[d];if((p||g)&&typeof g!="function")return void a(c)}(()=>{let d=p=>function(...g){let y=Je("UNSUPPORTED_OPERATION",`Method ${p} is not implemented by the current driver`,{operation:p}),w=g[g.length-1];return typeof w=="function"&&w(y),Promise.reject(y)};for(let p of qk)u[p]||(u[p]=d(p))})();let h=d=>{nu[l]&&console.info(`Redefining LocalSpace driver: ${l}`),nu[l]=e,Xh[l]=d,o()};"_support"in e?e._support&&typeof e._support=="function"?h(await e._support()):h(!!e._support):h(!0)}catch(l){a(l)}}),s=this._getCallbackOptions();return Jc(i,n,ed(r,s),s),i}driver(){return this._driver||null}async getDriver(e,n,r){let i=nu[e]?Promise.resolve(nu[e]):Promise.reject(Je("DRIVER_NOT_FOUND","Driver not found.",{driver:e})),s=this._getCallbackOptions();return Jc(i,n,ed(r,s),s),i}async getSerializer(e){let n=Promise.resolve($a);return Jc(n,e,void 0,this._getCallbackOptions()),n}async ready(e){let n=(this._driverSet??this._pendingDriverInitialization??Promise.resolve()).then(()=>(this._ready===null&&(this._ready=this._initDriver?this._initDriver():Promise.resolve()),this._ready)),r=this._getCallbackOptions();return Jc(n,e,ed(e,r),r),n}async setDriver(e,n,r){this._pendingDriverInitialization&&!this._isRunningDefaultDriverSelection&&await this._pendingDriverInitialization.catch(()=>{}),this._isRunningDefaultDriverSelection||(this._manualDriverOverride=!0),Pz(e)||(e=[e]);let i=e,s=await this._resolveSupportedDrivers(i),o=this._getCallbackOptions();if(s.length===0){let f=Je("DRIVER_UNAVAILABLE","No available storage method found.",{attemptedDrivers:i}),h=Promise.resolve().then(()=>{throw f});return this._driverSet=h,Jc(h,n,ed(r,o),o),h}let a=()=>{this._config.driver=this.driver()??void 0},l=async f=>{this._extend(f),this._driver=f._driver,a();let h=this._initStorage;return this._ready=typeof h=="function"?h.call(this,this._config):Promise.resolve(),await this._ready,this._ready},c=f=>async()=>{let h=0;return(async()=>{for(;h<f.length;){let d=f[h];h++,this._dbInfo=null,this._ready=null;try{let p=await this.getDriver(d);return void await l(p)}catch{}}throw a(),Je("DRIVER_UNAVAILABLE","No available storage method found.",{attemptedDrivers:f})})()},u=this._driverSet!==null?this._driverSet.catch(()=>Promise.resolve()):Promise.resolve();return this._driverSet=u.then(async()=>{let f=s[0];this._dbInfo=null,this._ready=null;let h=await this.getDriver(f);this._driver=h._driver,a(),this._wrapLibraryMethodsWithReady(),this._initDriver=c(s)}).catch(()=>{throw a(),Je("DRIVER_UNAVAILABLE","No available storage method found.",{attemptedDrivers:s})}),Jc(this._driverSet,n,ed(r,o),o),this._driverSet}supports(e){return!!Xh[e]||this._isDriverForcedByInstanceConfig(e)}_extend(e){Fk(this,e),this._capturePluginAwareMethods(e)}_capturePluginAwareMethods(e){for(let n of Fz){let r=e[n];typeof r=="function"&&(this._rawDriverMethods[n]=r.bind(this))}this._refreshPluginWrappers()}_refreshPluginWrappers(){for(let e of Fz){let n=this._rawDriverMethods[e];if(n)if(this._pluginManager&&this._pluginManager.hasPlugins())switch(e){case"setItem":this[e]=this._createSetItemWrapper(n);break;case"getItem":this[e]=this._createGetItemWrapper(n);break;case"removeItem":this[e]=this._createRemoveItemWrapper(n);break;case"setItems":this[e]=this._createSetItemsWrapper(n);break;case"getItems":this[e]=this._createGetItemsWrapper(n);break;case"removeItems":this[e]=this._createRemoveItemsWrapper(n);break;default:this[e]=n}else this[e]=n}}_createSetItemWrapper(e){return(n,r,i)=>{let s=typeof i=="function"?i:void 0;return ke((async()=>{await this._pluginManager.ensureInitialized();let o=this._pluginManager.createContext("setItem");o.operationState.originalValue=r;let a=await this._pluginManager.beforeSet(n,r,o),l=await e(n,a);return o.operationState.driverResult=l,await this._pluginManager.afterSet(n,a,o),o.operationState.returnValue??o.operationState.originalValue??r})(),s)}}_createGetItemWrapper(e){return(n,r)=>{let i=typeof r=="function"?r:void 0;return ke((async()=>{await this._pluginManager.ensureInitialized();let s=this._pluginManager.createContext("getItem"),o=await this._pluginManager.beforeGet(n,s),a=await e(o);return await this._pluginManager.afterGet(o,a,s)})(),i)}}_createRemoveItemWrapper(e){return(n,r)=>{let i=typeof r=="function"?r:void 0;return ke((async()=>{await this._pluginManager.ensureInitialized();let s=this._pluginManager.createContext("removeItem"),o=await this._pluginManager.beforeRemove(n,s);await e(o),await this._pluginManager.afterRemove(o,s)})(),i)}}_createSetItemsWrapper(e){return(n,r)=>{let i=typeof r=="function"?r:void 0;return ke((async()=>{await this._pluginManager.ensureInitialized();let s=this._pluginManager.createContext("setItems");s.operationState.isBatch=!0;let o=await this._pluginManager.beforeSetItems(n,s),a=this._pluginManager.normalizeBatch(o);s.operationState.batchSize=a.length;let l=[],c=new Map;for(let h of a){let d=this._pluginManager.createContext("setItem");d.operationState.originalValue=h.value,d.operationState.isBatch=!0,d.operationState.batchSize=a.length;let p=await this._pluginManager.beforeSet(h.key,h.value,d),g={key:h.key,value:p,context:d};l.push(g),c.set(h.key,{value:p,context:d})}let u=await e(l),f=await this._pluginManager.afterSetItems(u,s);for(let h of l)await this._pluginManager.afterSet(h.key,h.value,h.context);return f.map(h=>{let d=c.get(h.key),p=d?.context.operationState.returnValue,g=p!==void 0?p:h.value!==void 0?h.value:d?.context.operationState.originalValue??d?.value;return{key:h.key,value:g}})})(),i)}}_createGetItemsWrapper(e){return(n,r)=>{let i=typeof r=="function"?r:void 0,s=(async()=>{await this._pluginManager.ensureInitialized();let o=this._pluginManager.createContext("getItems");o.operationState.isBatch=!0,o.operationState.batchSize=n.length;let a=await this._pluginManager.beforeGetItems(n,o),l=[],c=new Map;for(let d of a){let p=this._pluginManager.createContext("getItem");p.operationState.isBatch=!0,p.operationState.batchSize=a.length;let g=await this._pluginManager.beforeGet(d,p);c.set(g,d),l.push({requestedKey:d,targetKey:g,context:p})}let u=l.map(d=>d.targetKey),f=await e(u),h=[];for(let d=0;d<f.length;d++){let p=f[d],g=l[d]?.context??l.find(w=>w.targetKey===p.key)?.context??this._pluginManager.createContext("getItem");g.operationState.isBatch=!0,g.operationState.batchSize=a.length;let y=await this._pluginManager.afterGet(p.key,p.value,g);h.push({key:p.key,value:y})}return(await this._pluginManager.afterGetItems(h,o)).map(d=>({key:c.get(d.key)??d.key,value:d.value}))})();return ke(s,i)}}_createRemoveItemsWrapper(e){return(n,r)=>{let i=typeof r=="function"?r:void 0,s=(async()=>{await this._pluginManager.ensureInitialized();let o=this._pluginManager.createContext("removeItems");o.operationState.isBatch=!0,o.operationState.batchSize=n.length;let a=await this._pluginManager.beforeRemoveItems(n,o),l=[];for(let u of a){let f=this._pluginManager.createContext("removeItem");f.operationState.isBatch=!0,f.operationState.batchSize=a.length;let h=await this._pluginManager.beforeRemove(u,f);l.push({key:h,context:f})}let c=l.map(u=>u.key);await e(c),await this._pluginManager.afterRemoveItems(c,o);for(let u of l)await this._pluginManager.afterRemove(u.key,u.context)})();return ke(s,i)}}_getSupportedDrivers(e){let n=[];for(let r of e)(this.supports(r)||this._isDriverForcedByInstanceConfig(r))&&n.push(r);return n}_isDriverForcedByInstanceConfig(e){return e===this.REACTNATIVEASYNCSTORAGE&&!!this._config.reactNativeAsyncStorage}async _resolveSupportedDrivers(e){let n=[];for(let r of e){let i=nu[r];if(i){if(!Xh[r]&&typeof i._support=="function")try{let s=await i._support();Xh[r]=!!s}catch{Xh[r]=!1}(this.supports(r)||this._isDriverForcedByInstanceConfig(r))&&n.push(r)}}return n}_wrapLibraryMethodsWithReady(){for(let e of Tz)FK(this,e)}_runDefaultDriverSelection(){return this._manualDriverOverride?this._driverSet??Promise.resolve():(this._isRunningDefaultDriverSelection=!0,this.setDriver(this._config.driver).then(()=>{this._isRunningDefaultDriverSelection=!1},e=>{throw this._isRunningDefaultDriverSelection=!1,e}))}_getCallbackOptions(){return{compatibilityMode:!(!this._config||typeof this._config.compatibilityMode!="boolean")&&!!this._config.compatibilityMode}}_notInitializedError(e){return Je("DRIVER_NOT_INITIALIZED","Driver not initialized",{operation:e})}async iterate(e,n){throw this._notInitializedError("iterate")}async getItems(e,n){throw this._notInitializedError("getItems")}async getItem(e,n){throw this._notInitializedError("getItem")}async setItem(e,n,r){throw this._notInitializedError("setItem")}async setItems(e,n){throw this._notInitializedError("setItems")}async removeItem(e,n){throw this._notInitializedError("removeItem")}async removeItems(e,n){throw this._notInitializedError("removeItems")}async runTransaction(e,n,r){throw this._notInitializedError("runTransaction")}async clear(e){throw this._notInitializedError("clear")}async length(e){throw this._notInitializedError("length")}async key(e,n){throw this._notInitializedError("key")}async keys(e){throw this._notInitializedError("keys")}async dropInstance(e,n){throw this._notInitializedError("dropInstance")}};var Iz,Az={exports:{}},Nk,Mk,LEe=(Iz||(Iz=1,Nk=Az,Mk=function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function i(o,a){if(!r[o]){r[o]={};for(var l=0;l<o.length;l++)r[o][o.charAt(l)]=l}return r[o][a]}var s={compressToBase64:function(o){if(o==null)return"";var a=s._compress(o,6,function(l){return e.charAt(l)});switch(a.length%4){default:case 0:return a;case 1:return a+"===";case 2:return a+"==";case 3:return a+"="}},decompressFromBase64:function(o){return o==null?"":o==""?null:s._decompress(o.length,32,function(a){return i(e,o.charAt(a))})},compressToUTF16:function(o){return o==null?"":s._compress(o,15,function(a){return t(a+32)})+" "},decompressFromUTF16:function(o){return o==null?"":o==""?null:s._decompress(o.length,16384,function(a){return o.charCodeAt(a)-32})},compressToUint8Array:function(o){for(var a=s.compress(o),l=new Uint8Array(2*a.length),c=0,u=a.length;c<u;c++){var f=a.charCodeAt(c);l[2*c]=f>>>8,l[2*c+1]=f%256}return l},decompressFromUint8Array:function(o){if(o==null)return s.decompress(o);for(var a=new Array(o.length/2),l=0,c=a.length;l<c;l++)a[l]=256*o[2*l]+o[2*l+1];var u=[];return a.forEach(function(f){u.push(t(f))}),s.decompress(u.join(""))},compressToEncodedURIComponent:function(o){return o==null?"":s._compress(o,6,function(a){return n.charAt(a)})},decompressFromEncodedURIComponent:function(o){return o==null?"":o==""?null:(o=o.replace(/ /g,"+"),s._decompress(o.length,32,function(a){return i(n,o.charAt(a))}))},compress:function(o){return s._compress(o,16,function(a){return t(a)})},_compress:function(o,a,l){if(o==null)return"";var c,u,f,h={},d={},p="",g="",y="",w=2,b=3,S=2,D=[],k=0,E=0;for(f=0;f<o.length;f+=1)if(p=o.charAt(f),Object.prototype.hasOwnProperty.call(h,p)||(h[p]=b++,d[p]=!0),g=y+p,Object.prototype.hasOwnProperty.call(h,g))y=g;else{if(Object.prototype.hasOwnProperty.call(d,y)){if(y.charCodeAt(0)<256){for(c=0;c<S;c++)k<<=1,E==a-1?(E=0,D.push(l(k)),k=0):E++;for(u=y.charCodeAt(0),c=0;c<8;c++)k=k<<1|1&u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u>>=1}else{for(u=1,c=0;c<S;c++)k=k<<1|u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u=0;for(u=y.charCodeAt(0),c=0;c<16;c++)k=k<<1|1&u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u>>=1}--w==0&&(w=Math.pow(2,S),S++),delete d[y]}else for(u=h[y],c=0;c<S;c++)k=k<<1|1&u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u>>=1;--w==0&&(w=Math.pow(2,S),S++),h[g]=b++,y=String(p)}if(y!==""){if(Object.prototype.hasOwnProperty.call(d,y)){if(y.charCodeAt(0)<256){for(c=0;c<S;c++)k<<=1,E==a-1?(E=0,D.push(l(k)),k=0):E++;for(u=y.charCodeAt(0),c=0;c<8;c++)k=k<<1|1&u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u>>=1}else{for(u=1,c=0;c<S;c++)k=k<<1|u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u=0;for(u=y.charCodeAt(0),c=0;c<16;c++)k=k<<1|1&u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u>>=1}--w==0&&(w=Math.pow(2,S),S++),delete d[y]}else for(u=h[y],c=0;c<S;c++)k=k<<1|1&u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u>>=1;--w==0&&(w=Math.pow(2,S),S++)}for(u=2,c=0;c<S;c++)k=k<<1|1&u,E==a-1?(E=0,D.push(l(k)),k=0):E++,u>>=1;for(;;){if(k<<=1,E==a-1){D.push(l(k));break}E++}return D.join("")},decompress:function(o){return o==null?"":o==""?null:s._decompress(o.length,32768,function(a){return o.charCodeAt(a)})},_decompress:function(o,a,l){var c,u,f,h,d,p,g,y=[],w=4,b=4,S=3,D="",k=[],E={val:l(0),position:a,index:1};for(c=0;c<3;c+=1)y[c]=c;for(f=0,d=Math.pow(2,2),p=1;p!=d;)h=E.val&E.position,E.position>>=1,E.position==0&&(E.position=a,E.val=l(E.index++)),f|=(h>0?1:0)*p,p<<=1;switch(f){case 0:for(f=0,d=Math.pow(2,8),p=1;p!=d;)h=E.val&E.position,E.position>>=1,E.position==0&&(E.position=a,E.val=l(E.index++)),f|=(h>0?1:0)*p,p<<=1;g=t(f);break;case 1:for(f=0,d=Math.pow(2,16),p=1;p!=d;)h=E.val&E.position,E.position>>=1,E.position==0&&(E.position=a,E.val=l(E.index++)),f|=(h>0?1:0)*p,p<<=1;g=t(f);break;case 2:return""}for(y[3]=g,u=g,k.push(g);;){if(E.index>o)return"";for(f=0,d=Math.pow(2,S),p=1;p!=d;)h=E.val&E.position,E.position>>=1,E.position==0&&(E.position=a,E.val=l(E.index++)),f|=(h>0?1:0)*p,p<<=1;switch(g=f){case 0:for(f=0,d=Math.pow(2,8),p=1;p!=d;)h=E.val&E.position,E.position>>=1,E.position==0&&(E.position=a,E.val=l(E.index++)),f|=(h>0?1:0)*p,p<<=1;y[b++]=t(f),g=b-1,w--;break;case 1:for(f=0,d=Math.pow(2,16),p=1;p!=d;)h=E.val&E.position,E.position>>=1,E.position==0&&(E.position=a,E.val=l(E.index++)),f|=(h>0?1:0)*p,p<<=1;y[b++]=t(f),g=b-1,w--;break;case 2:return k.join("")}if(w==0&&(w=Math.pow(2,S),S++),y[g])D=y[g];else{if(g!==b)return null;D=u+u.charAt(0)}k.push(D),y[b++]=u+D.charAt(0),u=D,--w==0&&(w=Math.pow(2,S),S++)}}};return s}(),Nk!=null?Nk.exports=Mk:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return Mk})),Az.exports);var BEe=new TextEncoder;var su=new Vk;var cy=class{constructor(e,n,r){this.vaultName=e;this.appId=n;this.version=r;this.persister=su.createInstance({name:`quartz-syncer/cache/${e}/${n}/${r}`,driver:[su.INDEXEDDB]})}persister;memoryCache=null;dirtyKeys=new Set;async preloadCache(){let e=new Map;await this.persister.iterate((n,r)=>{r.startsWith("file:")&&e.set(r,n)}),this.memoryCache=e}clearMemoryCache(){this.memoryCache=null,this.dirtyKeys.clear()}async flushCache(e){if(!this.memoryCache||this.dirtyKeys.size===0)return;let n=this.dirtyKeys.size,r=0;for(let i of this.dirtyKeys){let s=this.memoryCache.get(i);s&&await this.persister.setItem(i,s),r++,e&&(e.setProgress(Math.floor(r/n*100)),e.setIndexText(`Saving: ${r}/${n}`))}this.dirtyKeys.clear()}async getCacheEntry(e){let n=this.fileKey(e);return this.memoryCache?this.memoryCache.get(n)??null:await this.persister.getItem(n)}async setCacheEntry(e,n){let r=this.fileKey(e);if(this.memoryCache){this.memoryCache.set(r,n),this.dirtyKeys.add(r);return}await this.persister.setItem(r,n)}async recreate(){await su.dropInstance({name:`quartz-syncer/cache/${this.vaultName}/${this.appId}/${this.version}`}),await this.dropOutdatedCache(),this.persister=su.createInstance({name:`quartz-syncer/cache/${this.vaultName}/${this.appId}/${this.version}`,driver:[su.INDEXEDDB]})}async dropOutdatedCache(){let n=(await indexedDB.databases()).filter(r=>r.name&&r.name.startsWith(`quartz-syncer/cache/${this.vaultName}/${this.appId}/`)&&r.name!==`quartz-syncer/cache/${this.vaultName}/${this.appId}/${this.version}`);for(let r of n)indexedDB.deleteDatabase(r.name)}async isLocalFileOutdated(e,n){let r=await this.getCacheEntry(e);return r&&r.localData?r.hasDynamicContent?!0:r.time<n||r.version!==this.version:!0}async hasDynamicContentFlag(e){return(await this.getCacheEntry(e))?.hasDynamicContent??!1}async isRemoteFileOutdated(e){let n=await this.getCacheEntry(e);return n&&n.remoteData?n.version!==this.version:!0}async areLocalAndRemoteIdentical(e){let n=await this.getCacheEntry(e);return n&&n.localData&&n.remoteData?n.localHash===n.remoteHash&&n.version===this.version:!1}async loadLocalFile(e){let n=await this.getCacheEntry(e);return n&&n.localData?n.localData:null}async loadRemoteFile(e){let n=await this.getCacheEntry(e);return n&&n.remoteData?n.remoteData:null}async storeLocalFile(e,n,r,i){let s=await this.getCacheEntry(e),o=s?.localHash??await nl(r[0]);await this.setCacheEntry(e,{version:this.version,time:n??Date.now(),localData:r,localHash:o,remoteData:s?.remoteData??null,remoteHash:s?.remoteHash,hasDynamicContent:i??s?.hasDynamicContent})}async storeRemoteFile(e,n,r){let i=await this.getCacheEntry(e);await this.setCacheEntry(e,{version:this.version,time:n??Date.now(),localData:i?.localData??null,localHash:i?.localHash,remoteData:r,remoteHash:i?.remoteHash,hasDynamicContent:i?.hasDynamicContent})}async loadLocalHash(e){let n=await this.getCacheEntry(e);return n&&n.localHash?n.localHash:null}async loadRemoteHash(e){let n=await this.getCacheEntry(e);return n&&n.remoteHash?n.remoteHash:null}async storeLocalHash(e,n,r){let i=await this.getCacheEntry(e);await this.setCacheEntry(e,{version:this.version,time:n??Date.now(),localData:i?.localData??null,localHash:r,remoteData:i?.remoteData??null,remoteHash:i?.remoteHash,hasDynamicContent:i?.hasDynamicContent})}async storeRemoteHash(e,n,r){let i=await this.getCacheEntry(e);await this.setCacheEntry(e,{version:this.version,time:n??Date.now(),localData:i?.localData??null,localHash:i?.localHash,remoteData:i?.remoteData??null,remoteHash:r,hasDynamicContent:i?.hasDynamicContent})}async getTime(e){let n=await this.getCacheEntry(e);return n?n.time:null}async loadFile(e){return this.getCacheEntry(e).then(n=>n)}async dropFile(e){await this.persister.removeItem(this.fileKey(e))}async dropAllFiles(){let e=await this.allFiles();for(let n of e)await this.persister.removeItem(this.fileKey(n))}async synchronize(e){let n=new Set(await this.allFiles());for(let r of e)n.delete(r);for(let r of n)await this.persister.removeItem(this.fileKey(r));return n}async saveToDataJson(e,n){let r={},i=await this.allKeys();for(let o of i){if(!o.startsWith("file:"))continue;let a=await this.persister.getItem(o);a&&(r[o]=a)}Object.keys(r).sort();let s=JSON.stringify(r,null,2);n.settings.cache=s,await n.saveSettings(),await this.setLastUpdateTimestamp(e,n)}async loadFromDataJson(e,n){let r=n.settings.cache,i=JSON.parse(r);for(let[s,o]of Object.entries(i))await this.persister.setItem(s,o);await this.setLastUpdateTimestamp(e,n)}async allKeys(){return this.persister.keys()}async allFiles(){return(await this.allKeys()).filter(n=>n.startsWith("file:")).map(n=>n.substring(5))}fileKey(e){return"file:"+e}async getLastUpdateTimestamp(){let e=await this.persister.getItem("data.json");return e||null}async setLastUpdateTimestamp(e,n){n.settings.cacheTimestamp=e,await this.persister.setItem("data.json",e),await n.saveSettings()}};m();m();var kr=require("obsidian"),AK=class{pathToId=new Map;idToPath=[];intern(t){let e=this.pathToId.get(t);if(e!==void 0)return e;let n=this.idToPath.length;return this.pathToId.set(t,n),this.idToPath.push(t),n}getId(t){return this.pathToId.get(t)}getPath(t){return this.idToPath[t]}rename(t,e){let n=this.pathToId.get(t);n!==void 0&&(this.pathToId.delete(t),this.pathToId.set(e,n),this.idToPath[n]=e)}internWithId(t,e){for(this.pathToId.set(t,e);this.idToPath.length<=e;)this.idToPath.push(void 0);this.idToPath[e]=t}allPaths(){return this.pathToId.keys()}has(t){return this.pathToId.has(t)}get size(){return this.pathToId.size}resolvePaths(t){let e=new Set;for(let n of t){let r=this.idToPath[n];r!==void 0&&e.add(r)}return e}clear(){this.pathToId.clear(),this.idToPath.length=0}},vr=class{index=new Map;get(t){return this.index.get(t)??PK}has(t){let e=this.index.get(t);return e!==void 0&&e.size>0}add(t,e){let n=this.index.get(t);n===void 0&&(n=new Set,this.index.set(t,n)),n.add(e)}remove(t,e){let n=this.index.get(t);n!==void 0&&(n.delete(e),n.size===0&&this.index.delete(t))}removeFromKeys(t,e){for(let n of t)this.remove(n,e)}entries(){return this.index}get size(){return this.index.size}clear(){this.index.clear()}},OK=class{index=new Map;get(t){return this.index.get(t)}has(t){return this.index.has(t)}set(t,e){this.index.set(t,e)}remove(t){this.index.delete(t)}removeKeys(t){for(let e of t)this.index.delete(e)}clear(){this.index.clear()}},PK=Object.freeze(new Set),NK=1,uy="meta",Io="intern",Ao="contrib",MK=class{db=null;dbName;constructor(t){this.dbName=`inverse-metadatacache:${t}`}async open(){try{return this.db=await LK(this.dbName,NK,t=>{t.objectStoreNames.contains(uy)||t.createObjectStore(uy),t.objectStoreNames.contains(Io)||t.createObjectStore(Io,{keyPath:"path"}),t.objectStoreNames.contains(Ao)||t.createObjectStore(Ao,{keyPath:"id"})}),!0}catch{return this.db=null,!1}}get isOpen(){return this.db!==null}async loadSnapshot(){if(!this.db)return null;try{let t=this.db.transaction([Io,Ao],"readonly"),[e,n]=await Promise.all([Jz(t.objectStore(Io)),Jz(t.objectStore(Ao))]);return{interns:e,contribs:n}}catch{return null}}async flush(t,e,n,r){if(!this.db)return!1;try{let i=this.db.transaction([Io,Ao],"readwrite"),s=i.objectStore(Io),o=i.objectStore(Ao);for(let a of t)s.put(a);for(let a of e)o.put(a);for(let a of n)o.delete(a);for(let a of r)s.delete(a);return await Xz(i),!0}catch{return!1}}async clear(){if(this.db)try{let t=this.db.transaction([uy,Io,Ao],"readwrite");t.objectStore(uy).clear(),t.objectStore(Io).clear(),t.objectStore(Ao).clear(),await Xz(t)}catch{}}close(){this.db?.close(),this.db=null}};function RK(t,e,n){let r={id:t,mtime:e};return n.tags?.size&&(r.tags=[...n.tags]),n.bodyTags?.size&&(r.bodyTags=[...n.bodyTags]),n.frontmatterTags?.size&&(r.frontmatterTags=[...n.frontmatterTags]),n.backlinks?.size&&(r.backlinks=[...n.backlinks]),n.bodyBacklinks?.size&&(r.bodyBacklinks=[...n.bodyBacklinks]),n.frontmatterBacklinks?.size&&(r.frontmatterBacklinks=[...n.frontmatterBacklinks]),n.unresolvedBacklinks?.size&&(r.unresolvedBacklinks=[...n.unresolvedBacklinks]),n.embeds?.size&&(r.embeds=[...n.embeds]),n.headings?.size&&(r.headings=[...n.headings]),n.frontmatterKeys?.size&&(r.frontmatterKeys=[...n.frontmatterKeys]),n.frontmatterValues?.size&&(r.frontmatterValues=[...n.frontmatterValues]),n.aliases?.size&&(r.aliases=[...n.aliases]),n.blocks?.size&&(r.blocks=[...n.blocks]),n.taskStatuses?.size&&(r.taskStatuses=[...n.taskStatuses]),r}function zK(t){let e={};return t.tags?.length&&(e.tags=new Set(t.tags)),t.bodyTags?.length&&(e.bodyTags=new Set(t.bodyTags)),t.frontmatterTags?.length&&(e.frontmatterTags=new Set(t.frontmatterTags)),t.backlinks?.length&&(e.backlinks=new Set(t.backlinks)),t.bodyBacklinks?.length&&(e.bodyBacklinks=new Set(t.bodyBacklinks)),t.frontmatterBacklinks?.length&&(e.frontmatterBacklinks=new Set(t.frontmatterBacklinks)),t.unresolvedBacklinks?.length&&(e.unresolvedBacklinks=new Set(t.unresolvedBacklinks)),t.embeds?.length&&(e.embeds=new Set(t.embeds)),t.headings?.length&&(e.headings=new Set(t.headings)),t.frontmatterKeys?.length&&(e.frontmatterKeys=new Set(t.frontmatterKeys)),t.frontmatterValues?.length&&(e.frontmatterValues=new Set(t.frontmatterValues)),t.aliases?.length&&(e.aliases=new Set(t.aliases)),t.blocks?.length&&(e.blocks=new Set(t.blocks)),t.taskStatuses?.length&&(e.taskStatuses=new Set(t.taskStatuses)),e}function LK(t,e,n){return new Promise((r,i)=>{let s=indexedDB.open(t,e);s.onupgradeneeded=()=>n(s.result),s.onsuccess=()=>r(s.result),s.onerror=()=>i(s.error)})}function Jz(t){return new Promise((e,n)=>{let r=t.getAll();r.onsuccess=()=>e(r.result),r.onerror=()=>n(r.error)})}function Xz(t){return new Promise((e,n)=>{t.oncomplete=()=>e(),t.onerror=()=>n(t.error),t.onabort=()=>n(t.error)})}var BK=500,$K=2e3,UK=3e4,fy=Object.freeze(new Set),jK=Object.freeze(new Map),qK=class extends kr.Events{app;files;contributions=new Map;mtimes=new Map;chunkSize;tagIndex=new vr;bodyTagIndex=new vr;frontmatterTagIndex=new vr;backlinkIndex=new vr;bodyBacklinkIndex=new vr;frontmatterBacklinkIndex=new vr;unresolvedBacklinkIndex=new vr;embedIndex=new vr;headingIndex=new vr;frontmatterKeyIndex=new vr;frontmatterValueIndex=new vr;aliasIndex=new vr;blockIndex=new OK;taskStatusIndex=new vr;eventRefs=[];_isReady=!1;_destroyed=!1;store=null;persistEnabled;dirtyFileIds=new Set;deletedFileIds=new Set;deletedPaths=new Set;dirtyInternPaths=new Set;flushTimer=null;flushIntervalTimer=null;flushDebounceMs;flushIntervalMs;get isReady(){return this._isReady}get isDestroyed(){return this._destroyed}on(t,e,n){return super.on(t,e,n)}constructor(t,e){super(),this.app=t,this.files=new AK,this.chunkSize=e?.chunkSize??BK,this.persistEnabled=e?.persist!==!1,this.flushDebounceMs=e?.flushDebounceMs??$K,this.flushIntervalMs=e?.flushIntervalMs??UK,this.waitForMetadataCacheThenInitialize()}waitForMetadataCacheThenInitialize(){this.registerEvents();let t=this.app.metadataCache.resolvedLinks;if(Object.keys(t).some(a=>Object.keys(t[a]??{}).length>0)){this.initialize();return}let n=!1,r=!1,i=!1,s=()=>{r&&i&&this.finalizeLinks()},o=()=>{n?(this.app.metadataCache.off("resolved",o),i=!0,s()):(n=!0,this.initializeAndWaitForLinks().then(()=>{r=!0,s()}))};this.app.metadataCache.on("resolved",o)}async initializeAndWaitForLinks(){let t=!1;this.persistEnabled&&(t=await this.tryLoadFromDb()),t?await this.reconcileWithVault():await this.buildInitialIndex(),this.persistEnabled&&this.store?.isOpen&&this.startPeriodicFlush()}finalizeLinks(){this.rebuildAllLinkIndexes(),this._isReady=!0,this.trigger("ready")}registerEvents(){let t=this.app.metadataCache,e=this.app.vault;this.eventRefs.push(t.on("changed",(n,r,i)=>{this.updateFileFromCache(n.path,i,n.stat.mtime)})),this.eventRefs.push(t.on("deleted",(n,r)=>{this.removeFile(n.path)})),this.eventRefs.push(t.on("resolve",n=>{this.updateFileLinks(n.path)})),this.eventRefs.push(e.on("rename",(n,r)=>{this.handleRename(r,n.path)}))}async initialize(){let t=!1;this.persistEnabled&&(t=await this.tryLoadFromDb()),t?await this.reconcileWithVault():await this.buildInitialIndex(),this.rebuildAllLinkIndexes(),this.persistEnabled&&this.store?.isOpen&&this.startPeriodicFlush(),this._isReady||(this._isReady=!0,this.trigger("ready"))}async tryLoadFromDb(){try{let t=this.app.appId;if(this.store=new MK(t??"default"),!await this.store.open())return this.disablePersistence(),!1;let n=await this.store.loadSnapshot();return!n||n.interns.length===0?!1:(this.restoreFromSnapshot(n.interns,n.contribs),!0)}catch{return this.disablePersistence(),!1}}restoreFromSnapshot(t,e){for(let{path:n,id:r}of t)this.files.internWithId(n,r);for(let n of e){let r=zK(n);this.contributions.set(n.id,r),this.mtimes.set(n.id,n.mtime),this.rebuildIndexesFromContributions(n.id,r)}}rebuildIndexesFromContributions(t,e){if(e.tags)for(let n of e.tags)this.tagIndex.add(n,t);if(e.bodyTags)for(let n of e.bodyTags)this.bodyTagIndex.add(n,t);if(e.frontmatterTags)for(let n of e.frontmatterTags)this.frontmatterTagIndex.add(n,t);if(e.backlinks)for(let n of e.backlinks)this.backlinkIndex.add(n,t);if(e.bodyBacklinks)for(let n of e.bodyBacklinks)this.bodyBacklinkIndex.add(n,t);if(e.frontmatterBacklinks)for(let n of e.frontmatterBacklinks)this.frontmatterBacklinkIndex.add(n,t);if(e.unresolvedBacklinks)for(let n of e.unresolvedBacklinks)this.unresolvedBacklinkIndex.add(n,t);if(e.embeds)for(let n of e.embeds)this.embedIndex.add(n,t);if(e.headings)for(let n of e.headings)this.headingIndex.add(n,t);if(e.frontmatterKeys)for(let n of e.frontmatterKeys)this.frontmatterKeyIndex.add(n,t);if(e.frontmatterValues)for(let n of e.frontmatterValues)this.frontmatterValueIndex.add(n,t);if(e.aliases)for(let n of e.aliases)this.aliasIndex.add(n,t);if(e.blocks)for(let n of e.blocks)this.blockIndex.set(n,t);if(e.taskStatuses)for(let n of e.taskStatuses)this.taskStatusIndex.add(n,t)}async reconcileWithVault(){let t=this.app.vault.getMarkdownFiles(),e=new Set,n=[];for(let o of t){e.add(o.path);let a=this.files.getId(o.path);(a===void 0||this.mtimes.get(a)!==o.stat.mtime)&&n.push(o)}let r=this.files.allPaths();for(let o of r)e.has(o)||this.removeFile(o);let i=n.length,s=0;for(let o=0;o<i;o+=this.chunkSize){if(this._destroyed)return;let a=n.slice(o,o+this.chunkSize);for(let l of a){let c=this.app.metadataCache.getFileCache(l);c&&this.reindexFile(l.path,c,l.stat.mtime),this.reindexFileLinks(l.path)}s=Math.min(o+this.chunkSize,i),this.trigger("rebuild-progress",{processed:s,total:i}),o+this.chunkSize<i&&await eL()}}reindexFile(t,e,n){let r=this.files.intern(t);this.removeCacheContributions(r);let i=this.getOrCreateContributions(r);this.indexTags(r,e,i),this.indexEmbeds(r,e,i),this.indexHeadings(r,e,i),this.indexFrontmatter(r,e,i),this.indexAliases(r,e,i),this.indexBlocks(r,e,i),this.indexTasks(r,e,i),this.mtimes.set(r,n),this.markDirty(r,t)}reindexFileLinks(t){let e=this.files.intern(t);this.removeLinkContributions(e);let n=this.getOrCreateContributions(e);this.indexBacklinksWithSeparation(e,t,n),this.indexUnresolvedBacklinks(e,t,n),this.markDirty(e,t)}async buildInitialIndex(){let t=this.app.vault.getMarkdownFiles(),e=t.length,n=0;for(let r=0;r<e;r+=this.chunkSize){if(this._destroyed)return;let i=t.slice(r,r+this.chunkSize);for(let s of i){let o=this.app.metadataCache.getFileCache(s);o&&this.indexFileFromCache(s.path,o),this.mtimes.set(this.files.intern(s.path),s.stat.mtime),this.markDirty(this.files.intern(s.path),s.path)}n=Math.min(r+this.chunkSize,e),this.trigger("rebuild-progress",{processed:n,total:e}),r+this.chunkSize<e&&await eL()}this.persistEnabled&&await this.flushToDb()}rebuildAllLinkIndexes(){this.backlinkIndex.clear(),this.bodyBacklinkIndex.clear(),this.frontmatterBacklinkIndex.clear(),this.unresolvedBacklinkIndex.clear(),this.embedIndex.clear();for(let[,n]of this.contributions)n.backlinks=void 0,n.bodyBacklinks=void 0,n.frontmatterBacklinks=void 0,n.unresolvedBacklinks=void 0,n.embeds=void 0;let t=this.app.metadataCache.resolvedLinks,e=this.app.metadataCache.unresolvedLinks;for(let n of Object.keys(t)){let r=this.files.intern(n),i=this.getOrCreateContributions(r),s=t[n];if(!s)continue;let o=new Map,a=this.app.vault.getFileByPath(n);if(a){let f=this.app.metadataCache.getFileCache(a);if(f?.frontmatterLinks)for(let h of f.frontmatterLinks){let d=(0,kr.getLinkpath)(h.link),p=this.app.metadataCache.getFirstLinkpathDest(d,n);p&&o.set(p.path,(o.get(p.path)??0)+1)}}let l=new Set,c=new Set,u=new Set;for(let f of Object.keys(s)){l.add(f),this.backlinkIndex.add(f,r);let h=o.get(f)??0,d=s[f]??0;h>0&&(u.add(f),this.frontmatterBacklinkIndex.add(f,r)),(d>h||h===0)&&(c.add(f),this.bodyBacklinkIndex.add(f,r))}i.backlinks=l,i.bodyBacklinks=c,i.frontmatterBacklinks=u}for(let n of Object.keys(e)){let r=this.files.intern(n),i=this.getOrCreateContributions(r),s=e[n];if(s){let o=new Set;for(let a of Object.keys(s)){let l=a.toLowerCase();o.add(l),this.unresolvedBacklinkIndex.add(l,r)}i.unresolvedBacklinks=o}}for(let n of this.app.vault.getMarkdownFiles()){let r=this.files.getId(n.path);if(r===void 0)continue;let i=this.app.metadataCache.getFileCache(n);if(!i?.embeds)continue;let s=this.getOrCreateContributions(r),o=new Set;for(let a of i.embeds){let l=(0,kr.getLinkpath)(a.link),u=this.app.metadataCache.getFirstLinkpathDest(l,n.path)?.path??l;o.add(u),this.embedIndex.add(u,r)}s.embeds=o,this.markDirty(r,n.path)}}indexFileFromCache(t,e){let n=this.files.intern(t),r=this.getOrCreateContributions(n);this.indexTags(n,e,r),this.indexEmbeds(n,e,r),this.indexHeadings(n,e,r),this.indexFrontmatter(n,e,r),this.indexAliases(n,e,r),this.indexBlocks(n,e,r),this.indexTasks(n,e,r)}indexTags(t,e,n){let r=(0,kr.getAllTags)(e);if(!r)return;let i=new Set;for(let l of r){let c=l.toLowerCase();i.add(c),this.tagIndex.add(c,t)}n.tags=i;let s=new Set;if(e.tags)for(let l of e.tags){let c=l.tag.toLowerCase();s.add(c),this.bodyTagIndex.add(c,t)}n.bodyTags=s;let o=new Set,a=(0,kr.parseFrontMatterTags)(e.frontmatter??null);if(a)for(let l of a){let c=l.toLowerCase();o.add(c),this.frontmatterTagIndex.add(c,t)}n.frontmatterTags=o}indexTasks(t,e,n){if(!e.listItems)return;let r=new Set;for(let i of e.listItems)i.task!==void 0&&(r.add(i.task),this.taskStatusIndex.add(i.task,t));n.taskStatuses=r}indexEmbeds(t,e,n){if(!e.embeds)return;let r=new Set;for(let i of e.embeds){let s=(0,kr.getLinkpath)(i.link),a=this.app.metadataCache.getFirstLinkpathDest(s,this.files.getPath(t)??"")?.path??s;r.add(a),this.embedIndex.add(a,t)}n.embeds=r}indexHeadings(t,e,n){if(!e.headings)return;let r=new Set;for(let i of e.headings){let s=i.heading.toLowerCase();r.add(s),this.headingIndex.add(s,t)}n.headings=r}indexFrontmatter(t,e,n){if(!e.frontmatter)return;let r=new Set,i=new Set;for(let[s,o]of Object.entries(e.frontmatter)){if(s==="position")continue;let a=s.toLowerCase();r.add(a),this.frontmatterKeyIndex.add(a,t);let l=VK(a,o);for(let c of l)i.add(c),this.frontmatterValueIndex.add(c,t)}n.frontmatterKeys=r,n.frontmatterValues=i}indexAliases(t,e,n){let r=(0,kr.parseFrontMatterAliases)(e.frontmatter??null);if(!r)return;let i=new Set;for(let s of r){let o=s.toLowerCase();i.add(o),this.aliasIndex.add(o,t)}n.aliases=i}indexBlocks(t,e,n){if(!e.blocks)return;let r=new Set;for(let i of Object.keys(e.blocks))r.add(i),this.blockIndex.set(i,t);n.blocks=r}indexUnresolvedBacklinks(t,e,n){let r=this.app.metadataCache.unresolvedLinks[e];if(!r)return;let i=new Set;for(let s of Object.keys(r)){let o=s.toLowerCase();i.add(o),this.unresolvedBacklinkIndex.add(o,t)}n.unresolvedBacklinks=i}updateFileFromCache(t,e,n){let r=this.files.intern(t);this.removeCacheContributions(r);let i=this.getOrCreateContributions(r);this.indexTags(r,e,i),this.indexEmbeds(r,e,i),this.indexHeadings(r,e,i),this.indexFrontmatter(r,e,i),this.indexAliases(r,e,i),this.indexBlocks(r,e,i),this.indexTasks(r,e,i),this.mtimes.set(r,n),this.markDirty(r,t),this.trigger("file-updated",t)}updateFileLinks(t){let e=this.files.getId(t);if(e===void 0)return;this.removeLinkContributions(e);let n=this.getOrCreateContributions(e);this.indexBacklinksWithSeparation(e,t,n),this.indexUnresolvedBacklinks(e,t,n),this.markDirty(e,t),this.trigger("file-updated",t)}indexBacklinksWithSeparation(t,e,n){let r=this.app.metadataCache.resolvedLinks[e];if(!r)return;let i=new Map,s=this.app.vault.getFileByPath(e);if(s){let c=this.app.metadataCache.getFileCache(s);if(c?.frontmatterLinks)for(let u of c.frontmatterLinks){let f=(0,kr.getLinkpath)(u.link),h=this.app.metadataCache.getFirstLinkpathDest(f,e);h&&i.set(h.path,(i.get(h.path)??0)+1)}}let o=new Set,a=new Set,l=new Set;for(let c of Object.keys(r)){o.add(c),this.backlinkIndex.add(c,t);let u=i.get(c)??0,f=r[c]??0;u>0&&(l.add(c),this.frontmatterBacklinkIndex.add(c,t)),(f>u||u===0)&&(a.add(c),this.bodyBacklinkIndex.add(c,t))}n.backlinks=o,n.bodyBacklinks=a,n.frontmatterBacklinks=l}removeFile(t){let e=this.files.getId(t);e!==void 0&&(this.removeAllContributions(e),this.contributions.delete(e),this.mtimes.delete(e),this.deletedFileIds.add(e),this.deletedPaths.add(t),this.dirtyFileIds.delete(e),this.scheduleDebouncedFlush(),this.trigger("file-updated",t))}handleRename(t,e){this.files.rename(t,e);let n=this.files.getId(e);if(n===void 0)return;let r=this.contributions.get(n);r&&(r.backlinks&&(this.backlinkIndex.removeFromKeys(r.backlinks,n),r.backlinks=void 0),r.unresolvedBacklinks&&(this.unresolvedBacklinkIndex.removeFromKeys(r.unresolvedBacklinks,n),r.unresolvedBacklinks=void 0),this.deletedPaths.add(t),this.markDirty(n,e),this.trigger("file-updated",e))}removeCacheContributions(t){let e=this.contributions.get(t);e&&(e.tags&&this.tagIndex.removeFromKeys(e.tags,t),e.bodyTags&&this.bodyTagIndex.removeFromKeys(e.bodyTags,t),e.frontmatterTags&&this.frontmatterTagIndex.removeFromKeys(e.frontmatterTags,t),e.embeds&&this.embedIndex.removeFromKeys(e.embeds,t),e.headings&&this.headingIndex.removeFromKeys(e.headings,t),e.frontmatterKeys&&this.frontmatterKeyIndex.removeFromKeys(e.frontmatterKeys,t),e.frontmatterValues&&this.frontmatterValueIndex.removeFromKeys(e.frontmatterValues,t),e.aliases&&this.aliasIndex.removeFromKeys(e.aliases,t),e.blocks&&this.blockIndex.removeKeys(e.blocks),e.taskStatuses&&this.taskStatusIndex.removeFromKeys(e.taskStatuses,t),e.tags=void 0,e.bodyTags=void 0,e.frontmatterTags=void 0,e.embeds=void 0,e.headings=void 0,e.frontmatterKeys=void 0,e.frontmatterValues=void 0,e.aliases=void 0,e.blocks=void 0,e.taskStatuses=void 0)}removeLinkContributions(t){let e=this.contributions.get(t);e&&(e.backlinks&&this.backlinkIndex.removeFromKeys(e.backlinks,t),e.bodyBacklinks&&this.bodyBacklinkIndex.removeFromKeys(e.bodyBacklinks,t),e.frontmatterBacklinks&&this.frontmatterBacklinkIndex.removeFromKeys(e.frontmatterBacklinks,t),e.unresolvedBacklinks&&this.unresolvedBacklinkIndex.removeFromKeys(e.unresolvedBacklinks,t),e.backlinks=void 0,e.bodyBacklinks=void 0,e.frontmatterBacklinks=void 0,e.unresolvedBacklinks=void 0)}removeAllContributions(t){this.removeCacheContributions(t),this.removeLinkContributions(t)}getOrCreateContributions(t){let e=this.contributions.get(t);return e||(e={},this.contributions.set(t,e)),e}markDirty(t,e){this.dirtyFileIds.add(t),this.dirtyInternPaths.add(e),this.scheduleDebouncedFlush()}scheduleDebouncedFlush(){!this.persistEnabled||!this.store?.isOpen||this.flushTimer===null&&(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flushToDb()},this.flushDebounceMs))}startPeriodicFlush(){this.flushIntervalTimer=setInterval(()=>{this.flushToDb()},this.flushIntervalMs)}async flushToDb(){if(!this.store?.isOpen||this.dirtyFileIds.size===0&&this.deletedFileIds.size===0)return;let t=[];for(let s of this.dirtyInternPaths){let o=this.files.getId(s);o!==void 0&&t.push({path:s,id:o})}let e=[];for(let s of this.dirtyFileIds){let o=this.contributions.get(s),a=this.mtimes.get(s)??0;o&&e.push(RK(s,a,o))}let n=[...this.deletedFileIds],r=[...this.deletedPaths];this.dirtyFileIds.clear(),this.dirtyInternPaths.clear(),this.deletedFileIds.clear(),this.deletedPaths.clear(),await this.store.flush(t,e,n,r)||this.disablePersistence()}disablePersistence(){this.persistEnabled=!1,this.store?.close(),this.store=null}resolveIndex(t,e){let n=t.get(e);return n.size===0?fy:this.files.resolvePaths(n)}resolveFullIndex(t){let e=t.entries();if(e.size===0)return jK;let n=new Map;for(let[r,i]of e)n.set(r,this.files.resolvePaths(i));return n}getFilesWithTag(t){let e=t.startsWith("#")?t.toLowerCase():`#${t.toLowerCase()}`;return this.resolveIndex(this.tagIndex,e)}getFilesWithTagInBody(t){let e=t.startsWith("#")?t.toLowerCase():`#${t.toLowerCase()}`;return this.resolveIndex(this.bodyTagIndex,e)}getFilesWithTagInFrontmatter(t){let e=t.startsWith("#")?t.toLowerCase():`#${t.toLowerCase()}`;return this.resolveIndex(this.frontmatterTagIndex,e)}getAllTagsWithFiles(){return this.resolveFullIndex(this.tagIndex)}getBacklinksForFile(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.backlinkIndex,e)}getBacklinksFromBody(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.bodyBacklinkIndex,e)}getBacklinksFromFrontmatter(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.frontmatterBacklinkIndex,e)}getAllBacklinksWithFiles(){return this.resolveFullIndex(this.backlinkIndex)}getUnresolvedBacklinks(t){return this.resolveIndex(this.unresolvedBacklinkIndex,t.toLowerCase())}getFilesEmbedding(t){let e=typeof t=="string"?t:t.path;return this.resolveIndex(this.embedIndex,e)}getAllEmbedsWithFiles(){return this.resolveFullIndex(this.embedIndex)}getFilesWithHeading(t){return this.resolveIndex(this.headingIndex,t.toLowerCase())}getAllHeadingsWithFiles(){return this.resolveFullIndex(this.headingIndex)}getFilesWithFrontmatterKey(t){return this.resolveIndex(this.frontmatterKeyIndex,t.toLowerCase())}getFilesWithFrontmatterValue(t,e){let n=Kk(t.toLowerCase(),e);return this.resolveIndex(this.frontmatterValueIndex,n)}getAllFrontmatterKeysWithFiles(){return this.resolveFullIndex(this.frontmatterKeyIndex)}getFilesWithAlias(t){return this.resolveIndex(this.aliasIndex,t.toLowerCase())}getAllAliasesWithFiles(){return this.resolveFullIndex(this.aliasIndex)}getFileWithBlockId(t){let e=this.blockIndex.get(t);if(e===void 0)return null;let n=this.files.getPath(e);return n===void 0?null:this.app.vault.getFileByPath(n)??null}getFilesWithTasks(){let t=new Set;for(let e of this.taskStatusIndex.entries().values())for(let n of e)t.add(n);return t.size===0?fy:this.files.resolvePaths(t)}getFilesWithTaskStatus(t){if(typeof t=="string")return this.resolveIndex(this.taskStatusIndex,t);let e=new Set;for(let n of t)for(let r of this.taskStatusIndex.get(n))e.add(r);return e.size===0?fy:this.files.resolvePaths(e)}getAllTaskStatusesWithFiles(){return this.resolveFullIndex(this.taskStatusIndex)}getFilesWithOpenTasks(){return this.resolveIndex(this.taskStatusIndex," ")}getFilesWithCompletedTasks(){let t=new Set;for(let[e,n]of this.taskStatusIndex.entries())if(e!==" ")for(let r of n)t.add(r);return t.size===0?fy:this.files.resolvePaths(t)}destroy(){if(!this._destroyed){this._destroyed=!0,this.flushTimer!==null&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.flushIntervalTimer!==null&&(clearInterval(this.flushIntervalTimer),this.flushIntervalTimer=null),this.flushToDb();for(let t of this.eventRefs)this.app.metadataCache.offref(t),this.app.vault.offref(t);this.eventRefs.length=0,this.store?.close(),this.store=null,this.tagIndex.clear(),this.bodyTagIndex.clear(),this.frontmatterTagIndex.clear(),this.backlinkIndex.clear(),this.bodyBacklinkIndex.clear(),this.frontmatterBacklinkIndex.clear(),this.unresolvedBacklinkIndex.clear(),this.embedIndex.clear(),this.headingIndex.clear(),this.frontmatterKeyIndex.clear(),this.frontmatterValueIndex.clear(),this.aliasIndex.clear(),this.blockIndex.clear(),this.taskStatusIndex.clear(),this.contributions.clear(),this.mtimes.clear(),this.files.clear()}}};function Kk(t,e){return`${t}\0${HK(e)}`}function VK(t,e){return Array.isArray(e)?e.map(n=>Kk(t,n)):[Kk(t,e)]}function HK(t){return t==null?"":typeof t=="string"?t.toLowerCase():typeof t=="number"||typeof t=="boolean"?String(t):t instanceof Date?t.toISOString().toLowerCase():JSON.stringify(t).toLowerCase()}function eL(){return new Promise(t=>{typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):setTimeout(t,0)})}var Qk=0,WK=1,GK="0.5.1",tL=Symbol.for("obsidian-extended-metadatacache/registry");function QK(){let t=globalThis,e=t[tL];return e||(e={majors:new Map},t[tL]=e),e}function nL(t,e){let n=QK(),r=n.majors.get(Qk),s=!r||r.instance.isDestroyed?(()=>{let c={instance:new qK(t,e),version:GK,apiMajor:Qk,apiMinor:WK,acquireCount:0};return n.majors.set(Qk,c),c})():r;s.acquireCount++;let o=s,a=!1;return{api:o.instance,release(){a||(a=!0,o.acquireCount--)}}}var hy=class{handle=null;readyPromise;resolveReady;constructor(e){this.readyPromise=new Promise(r=>{this.resolveReady=r}),this.handle=nL(e);let n=this.handle.api;n.isReady?this.resolveReady():n.on("ready",()=>this.resolveReady())}get api(){if(!this.handle)throw new Error("ExtendedCacheService already destroyed");return this.handle.api}get isReady(){return this.handle?.api.isReady??!1}waitForReady(){return this.readyPromise}destroy(){this.handle?.release(),this.handle=null}};var In=it(vt());m();m();var KK={h:"help",v:"verbose"},rL={help:{description:"Show this help message"},h:{description:"Show this help message"},"--help":{description:"Show this help message"},verbose:{description:"Enable verbose output"},v:{description:"Enable verbose output"},"--verbose":{description:"Enable verbose output"}};function iL(t){let e={};for(let n of Object.keys(t)){let r=n.replace(/^-{1,2}/,""),i=KK[r]??r;e[i]=t[n]}return e}function sL(t){let e={...rL};if(!t)return e;for(let[n,r]of Object.entries(t))e[n]=r,e[`--${n}`]=r;return e}function oL(t,e,n){let r=[`Usage: obsidian ${t} [flags]`,"",e];if(n&&Object.keys(n).length>0){let i=Object.entries(n).filter(([s])=>!s.startsWith("-")&&!Object.keys(rL).includes(s));if(i.length>0){r.push("","Flags:");for(let[s,o]of i){let a=o.value?`=${o.value}`:"";r.push(` ${s}${a} ${o.description}`)}}}return r.push("","Global flags:"," help, h Show this help message"," verbose, v Enable verbose output"),r.join(`
|
||
`)}function Q(t,e){if(t.format==="json")return JSON.stringify(e,null,2);if(!e.ok)return`Error: ${e.error??"Unknown error"}`;let n=e.message??JSON.stringify(e.data),r=e.durationMs?` (${(e.durationMs/1e3).toFixed(1)}s)`:"";return`${n}${r}`}function ce(t,e){return{ok:!1,command:t,error:e}}function Se(t,e,n,r){return{ok:!0,command:t,message:e,data:n,durationMs:r}}m();m();function Yt(t){return t.settings.git.remoteUrl?t.settings.git.branch?null:"Git branch is not configured. Set it in plugin settings or via 'obsidian quartz-syncer:config action=set key=git.branch value=<branch>'.":"Git remote URL is not configured. Set it in plugin settings or via 'obsidian quartz-syncer:config action=set key=git.remoteUrl value=<url>'."}m();var dy=it(vt()),qi=class{setProgress(e){dy.default.debug(`CLI progress: ${e}%`)}setIndexText(e){dy.default.debug(`CLI index: ${e}`)}setText(e){dy.default.debug(`CLI status: ${e}`)}};var my="quartz-syncer:status",ZK={format:{value:"<json|text>",description:"Output format (default: text)"}};function aL(t,e){t(my,"Show the publish status of all marked notes",ZK,async n=>{try{let r=Yt(e);if(r)return Q(n,ce(my,r));let i=Date.now(),s=new Sn(e.app.metadataCache,e.settings,e.getGitSettingsWithSecret()),o=new cr(e.app,e,e.app.vault,e.app.metadataCache,e.settings,e.datastore,e.extendedCache),a=new fr(s,o),l=new qi,c=await a.getPublishStatus(l),u=new Set([...c.unpublishedNotes.map(S=>S.getPath()),...c.changedNotes.map(S=>S.getPath()),...c.publishedNotes.map(S=>S.getPath()),...c.deletedNotePaths.map(S=>S.path)]),f=c.deletedBlobPaths.filter(S=>!u.has(S.path)),h={unpublished:c.unpublishedNotes.map(S=>S.getPath()),changed:c.changedNotes.map(S=>S.getPath()),published:c.publishedNotes.map(S=>S.getPath()),deletedNotes:c.deletedNotePaths.map(S=>S.path),deletedBlobs:f.map(S=>S.path),summary:{unpublished:c.unpublishedNotes.length,changed:c.changedNotes.length,published:c.publishedNotes.length,deletedNotes:c.deletedNotePaths.length,deletedBlobs:f.length}},p=n.verbose==="true"&&n.format!=="json",g=[],y=(S,D)=>{g.push(S),!(!p||D.length===0)&&g.push(...D.map(k=>` ${k}`))},w=[...h.deletedNotes,...h.deletedBlobs];y(`Unpublished: ${h.summary.unpublished}`,h.unpublished),y(`Changed: ${h.summary.changed}`,h.changed),y(`Published: ${h.summary.published}`,h.published),y(`Deleted: ${h.summary.deletedNotes+h.summary.deletedBlobs}`,w);let b=g.join(`
|
||
`);return Q(n,Se(my,b,h,Date.now()-i))}catch(r){return Q(n,ce(my,r instanceof Error?r.message:String(r)))}})}m();var ou="quartz-syncer:sync",YK={force:{description:"Apply deletions (required to delete remote files)"},"dry-run":{description:"Show what would be published/deleted without changes"},format:{value:"<json|text>",description:"Output format (default: text)"}};function lL(t,e){t(ou,"Publish pending notes and optionally delete removed notes",YK,async n=>{try{let r=Yt(e);if(r)return Q(n,ce(ou,r));let i=Date.now(),s=n["dry-run"]==="true",o=n.force==="true",l=n.verbose==="true"&&n.format!=="json",c=new Sn(e.app.metadataCache,e.settings,e.getGitSettingsWithSecret()),u=new cr(e.app,e,e.app.vault,e.app.metadataCache,e.settings,e.datastore,e.extendedCache),f=new fr(c,u),h=new qi,d=await f.getPublishStatus(h),p=[...d.unpublishedNotes,...d.changedNotes],g=new Set([...d.unpublishedNotes.map(N=>N.getPath()),...d.changedNotes.map(N=>N.getPath()),...d.publishedNotes.map(N=>N.getPath()),...d.deletedNotePaths.map(N=>N.path)]),y=d.deletedBlobPaths.filter(N=>!g.has(N.path)),w=[...d.deletedNotePaths.map(N=>N.path),...y.map(N=>N.path)],b={publish:p.map(N=>N.getPath()),delete:w,skippedDeletes:[],summary:{published:p.length,deleted:0,skippedDeletes:0}},S=(N,B,L,G)=>{if(!l)return G;let U=[];return N.length>0&&(U.push(`Published ${N.length} file${N.length===1?"":"s"}:`),U.push(...N.map(he=>` ${he}`))),B.length>0&&(U.push(`Deleted ${B.length} file${B.length===1?"":"s"}:`),U.push(...B.map(he=>` ${he}`))),L.length>0&&(U.push(`Skipped ${L.length} deletion${L.length===1?"":"s"}:`),U.push(...L.map(he=>` ${he}`))),U.length>0?U.join(`
|
||
`):G};if(s){b.summary.deleted=w.length;let N=`Dry run: ${b.summary.published} to publish, ${w.length} to delete.`,B=S(b.publish,b.delete,[],N);return Q(n,Se(ou,B,b,Date.now()-i))}if(p.length===0&&w.length===0)return Q(n,Se(ou,S([],[],[],"Nothing to sync."),b,Date.now()-i));let D=u.createConnection();if(!await u.publishBatch(p,D))throw new Error("Failed to publish files.");let E=0,v=[];if(w.length>0)if(o){if(!await u.deleteBatch(w,D))throw new Error("Failed to delete files.");E=w.length}else v=w;b.skippedDeletes=v,b.summary.deleted=E,b.summary.skippedDeletes=v.length;let _=[`Published ${p.length} file${p.length===1?"":"s"}`,`Deleted ${E} file${E===1?"":"s"}`];v.length>0&&_.push(`Skipped ${v.length} deletion${v.length===1?"":"s"} (use force)`);let C=_.join(". ")+".",A=o?w:[],P=S(b.publish,A,v,C);return Q(n,Se(ou,P,b,Date.now()-i))}catch(r){return Q(n,ce(ou,r instanceof Error?r.message:String(r)))}})}m();var au="quartz-syncer:publish",JK={"dry-run":{description:"Show what would be published without changes"},format:{value:"<json|text>",description:"Output format (default: text)"}};function cL(t,e){t(au,"Publish pending notes without deletions",JK,async n=>{try{let r=Yt(e);if(r)return Q(n,ce(au,r));let i=Date.now(),s=n["dry-run"]==="true",a=n.verbose==="true"&&n.format!=="json",l=new Sn(e.app.metadataCache,e.settings,e.getGitSettingsWithSecret()),c=new cr(e.app,e,e.app.vault,e.app.metadataCache,e.settings,e.datastore,e.extendedCache),u=new fr(l,c),f=new qi,h=await u.getPublishStatus(f),d=[...h.unpublishedNotes,...h.changedNotes],p={publish:d.map(D=>D.getPath()),summary:{published:d.length}},g=(D,k)=>!a||D.length===0?k:[`Published ${D.length} file${D.length===1?"":"s"}:`,...D.map(E=>` ${E}`)].join(`
|
||
`);if(s){let D=`Dry run: ${d.length} to publish.`,k=g(p.publish,D);return Q(n,Se(au,k,p,Date.now()-i))}if(d.length===0)return Q(n,Se(au,g([],"Nothing to publish."),p,Date.now()-i));let y=c.createConnection();if(!await c.publishBatch(d,y))throw new Error("Failed to publish files.");let b=`Published ${d.length} file${d.length===1?"":"s"}.`,S=g(p.publish,b);return Q(n,Se(au,S,p,Date.now()-i))}catch(r){return Q(n,ce(au,r instanceof Error?r.message:String(r)))}})}m();var ja="quartz-syncer:delete",XK={force:{description:"Apply deletions (required)"},"dry-run":{description:"Show what would be deleted without changes"},format:{value:"<json|text>",description:"Output format (default: text)"}};function uL(t,e){t(ja,"Delete removed notes from the remote repository",XK,async n=>{try{let r=Yt(e);if(r)return Q(n,ce(ja,r));let i=Date.now(),s=n["dry-run"]==="true",o=n.force==="true",l=n.verbose==="true"&&n.format!=="json",c=new Sn(e.app.metadataCache,e.settings,e.getGitSettingsWithSecret()),u=new cr(e.app,e,e.app.vault,e.app.metadataCache,e.settings,e.datastore,e.extendedCache),f=new fr(c,u),h=new qi,d=await f.getPublishStatus(h),p=new Set([...d.unpublishedNotes.map(v=>v.getPath()),...d.changedNotes.map(v=>v.getPath()),...d.publishedNotes.map(v=>v.getPath()),...d.deletedNotePaths.map(v=>v.path)]),g=d.deletedBlobPaths.filter(v=>!p.has(v.path)),y=[...d.deletedNotePaths.map(v=>v.path),...g.map(v=>v.path)],w={delete:y,summary:{deleted:y.length}},b=(v,_)=>!l||v.length===0?_:[`Deleted ${v.length} file${v.length===1?"":"s"}:`,...v.map(C=>` ${C}`)].join(`
|
||
`);if(s){let v=`Dry run: ${y.length} to delete.`,_=b(y,v);return Q(n,Se(ja,_,w,Date.now()-i))}if(y.length===0)return Q(n,Se(ja,b([],"Nothing to delete."),w,Date.now()-i));if(!o)return Q(n,ce(ja,"Deletion requires the 'force' flag."));let S=u.createConnection();if(!await u.deleteBatch(y,S))throw new Error("Failed to delete files.");let k=`Deleted ${y.length} file${y.length===1?"":"s"}.`,E=b(y,k);return Q(n,Se(ja,E,w,Date.now()-i))}catch(r){return Q(n,ce(ja,r instanceof Error?r.message:String(r)))}})}m();m();var gy=require("obsidian");m();m();m();var Zk=(t,e,n)=>{let r=t instanceof RegExp?fL(t,n):t,i=e instanceof RegExp?fL(e,n):e,s=r!==null&&i!=null&&eZ(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},fL=(t,e)=>{let n=e.match(t);return n?n[0]:null},eZ=(t,e,n)=>{let r,i,s,o,a,l=n.indexOf(t),c=n.indexOf(e,l+1),u=l;if(l>=0&&c>0){if(t===e)return[l,c];for(r=[],s=n.length;u>=0&&!a;){if(u===l)r.push(u),l=n.indexOf(t,u+1);else if(r.length===1){let f=r.pop();f!==void 0&&(a=[f,c])}else i=r.pop(),i!==void 0&&i<s&&(s=i,o=c),c=n.indexOf(e,u+1);u=l<c&&l>=0?l:c}r.length&&o!==void 0&&(a=[s,o])}return a};var hL="\0SLASH"+Math.random()+"\0",dL="\0OPEN"+Math.random()+"\0",Jk="\0CLOSE"+Math.random()+"\0",mL="\0COMMA"+Math.random()+"\0",pL="\0PERIOD"+Math.random()+"\0",tZ=new RegExp(hL,"g"),nZ=new RegExp(dL,"g"),rZ=new RegExp(Jk,"g"),iZ=new RegExp(mL,"g"),sZ=new RegExp(pL,"g"),oZ=/\\\\/g,aZ=/\\{/g,lZ=/\\}/g,cZ=/\\,/g,uZ=/\\\./g,fZ=1e5;function Yk(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function hZ(t){return t.replace(oZ,hL).replace(aZ,dL).replace(lZ,Jk).replace(cZ,mL).replace(uZ,pL)}function dZ(t){return t.replace(tZ,"\\").replace(nZ,"{").replace(rZ,"}").replace(iZ,",").replace(sZ,".")}function gL(t){if(!t)return[""];let e=[],n=Zk("{","}",t);if(!n)return t.split(",");let{pre:r,body:i,post:s}=n,o=r.split(",");o[o.length-1]+="{"+i+"}";let a=gL(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function yL(t,e={}){if(!t)return[];let{max:n=fZ}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),rd(hZ(t),n,!0).map(dZ)}function mZ(t){return"{"+t+"}"}function pZ(t){return/^-?0\d/.test(t)}function gZ(t,e){return t<=e}function yZ(t,e){return t>=e}function rd(t,e,n){let r=[],i=Zk("{","}",t);if(!i)return[t];let s=i.pre,o=i.post.length?rd(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let l=s+"{"+i.body+"}"+o[a];r.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=a||l,u=i.body.indexOf(",")>=0;if(!c&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+Jk+i.post,rd(t,e,!0)):[t];let f;if(c)f=i.body.split(/\.\./);else if(f=gL(i.body),f.length===1&&f[0]!==void 0&&(f=rd(f[0],e,!1).map(mZ),f.length===1))return o.map(d=>i.pre+f[0]+d);let h;if(c&&f[0]!==void 0&&f[1]!==void 0){let d=Yk(f[0]),p=Yk(f[1]),g=Math.max(f[0].length,f[1].length),y=f.length===3&&f[2]!==void 0?Math.max(Math.abs(Yk(f[2])),1):1,w=gZ;p<d&&(y*=-1,w=yZ);let S=f.some(pZ);h=[];for(let D=d;w(D,p);D+=y){let k;if(l)k=String.fromCharCode(D),k==="\\"&&(k="");else if(k=String(D),S){let E=g-k.length;if(E>0){let v=new Array(E+1).join("0");D<0?k="-"+v+k.slice(1):k=v+k}}h.push(k)}}else{h=[];for(let d=0;d<f.length;d++)h.push.apply(h,rd(f[d],e,!1))}for(let d=0;d<h.length;d++)for(let p=0;p<o.length&&r.length<e;p++){let g=s+h[d]+o[p];(!n||c||g)&&r.push(g)}}return r}m();var id=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};m();m();var wZ={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},sd=t=>t.replace(/[[\]\\-]/g,"\\$&"),bZ=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),wL=t=>t.join(""),bL=(t,e)=>{let n=e;if(t.charAt(n)!=="[")throw new Error("not in a brace expression");let r=[],i=[],s=n+1,o=!1,a=!1,l=!1,c=!1,u=n,f="";e:for(;s<t.length;){let g=t.charAt(s);if((g==="!"||g==="^")&&s===n+1){c=!0,s++;continue}if(g==="]"&&o&&!l){u=s+1;break}if(o=!0,g==="\\"&&!l){l=!0,s++;continue}if(g==="["&&!l){for(let[y,[w,b,S]]of Object.entries(wZ))if(t.startsWith(y,s)){if(f)return["$.",!1,t.length-n,!0];s+=y.length,S?i.push(w):r.push(w),a=a||b;continue e}}if(l=!1,f){g>f?r.push(sd(f)+"-"+sd(g)):g===f&&r.push(sd(g)),f="",s++;continue}if(t.startsWith("-]",s+1)){r.push(sd(g+"-")),s+=2;continue}if(t.startsWith("-",s+1)){f=g,s+=2;continue}r.push(sd(g)),s++}if(u<s)return["",!1,0,!1];if(!r.length&&!i.length)return["$.",!1,t.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!c){let g=r[0].length===2?r[0].slice(-1):r[0];return[bZ(g),!1,u-n,!1]}let h="["+(c?"^":"")+wL(r)+"]",d="["+(c?"":"^")+wL(i)+"]";return[r.length&&i.length?"("+h+"|"+d+")":r.length?h:d,a,u-n,!0]};m();var Oo=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!0}={})=>n?e?t.replace(/\[([^/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?t.replace(/\[([^/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");var Wn,vZ=new Set(["!","?","+","*","@"]),Xk=t=>vZ.has(t),vL=t=>Xk(t.type),kZ=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),xZ=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),SZ=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),kL=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),DZ="(?!(?:^|/)\\.\\.?(?:$|/))",py="(?!\\.)",EZ=new Set(["[","."]),_Z=new Set(["..","."]),CZ=new Set("().*{}+?[]^$\\!"),TZ=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ex="[^/]",xL=ex+"*?",SL=ex+"+?",FZ=0,qa=class{type;#n;#r;#i=!1;#e=[];#t;#a;#c;#l=!1;#s;#o;#u=!1;id=++FZ;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,n,r={}){this.type=e,e&&(this.#r=!0),this.#t=n,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?r:this.#n.#s,this.#c=this.#n===this?[]:this.#n.#c,e==="!"&&!this.#n.#l&&this.#c.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#o=this.#e.map(e=>String(e)).join("")}#y(){if(this!==this.#n)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let e;for(;e=this.#c.pop();){if(e.type!=="!")continue;let n=e,r=n.#t;for(;r;){for(let i=n.#a+1;!r.type&&i<r.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(r.#e[i])}n=r,r=n.#t}}return this}push(...e){for(let n of e)if(n!==""){if(typeof n!="string"&&!(n instanceof Wn&&n.#t===this))throw new Error("invalid part: "+n);this.#e.push(n)}}toJSON(){let e=this.type===null?this.#e.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#e.map(n=>n.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#l&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let n=0;n<this.#a;n++){let r=e.#e[n];if(!(r instanceof Wn&&r.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let n=new Wn(this.type,e);for(let r of this.#e)n.copyIn(r);return n}static#f(e,n,r,i,s){let o=i.maxExtglobRecursion??2,a=!1,l=!1,c=-1,u=!1;if(n.type===null){let g=r,y="";for(;g<e.length;){let w=e.charAt(g++);if(a||w==="\\"){a=!a,y+=w;continue}if(l){g===c+1?(w==="^"||w==="!")&&(u=!0):w==="]"&&!(g===c+2&&u)&&(l=!1),y+=w;continue}else if(w==="["){l=!0,c=g,u=!1,y+=w;continue}if(!i.noext&&Xk(w)&&e.charAt(g)==="("&&s<=o){n.push(y),y="";let S=new Wn(w,n);g=Wn.#f(e,S,g,i,s+1),n.push(S);continue}y+=w}return n.push(y),g}let f=r+1,h=new Wn(null,n),d=[],p="";for(;f<e.length;){let g=e.charAt(f++);if(a||g==="\\"){a=!a,p+=g;continue}if(l){f===c+1?(g==="^"||g==="!")&&(u=!0):g==="]"&&!(f===c+2&&u)&&(l=!1),p+=g;continue}else if(g==="["){l=!0,c=f,u=!1,p+=g;continue}if(!i.noext&&Xk(g)&&e.charAt(f)==="("&&(s<=o||n&&n.#h(g))){let w=n&&n.#h(g)?0:1;h.push(p),p="";let b=new Wn(g,h);h.push(b),f=Wn.#f(e,b,f,i,s+w);continue}if(g==="|"){h.push(p),p="",d.push(h),h=new Wn(null,n);continue}if(g===")")return p===""&&n.#e.length===0&&(n.#u=!0),h.push(p),p="",n.push(...d,h),f;p+=g}return n.type=null,n.#r=void 0,n.#e=[e.substring(r-1)],f}#w(e){return this.#m(e,xZ)}#m(e,n=kZ){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let r=e.#e[0];return!r||typeof r!="object"||r.type===null?!1:this.#h(r.type,n)}#h(e,n=SZ){return!!n.get(this.type)?.includes(e)}#b(e,n){let r=e.#e[0],i=new Wn(null,r,this.options);i.#e.push(""),r.push(i),this.#p(e,n)}#p(e,n){let r=e.#e[0];this.#e.splice(n,1,...r.#e);for(let i of r.#e)typeof i=="object"&&(i.#t=this);this.#o=void 0}#v(e){return!!kL.get(this.type)?.has(e)}#k(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#v(n.type)}#x(e){let n=kL.get(this.type),r=e.#e[0],i=n?.get(r.type);if(!i)return!1;this.#e=r.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=i,this.#o=void 0,this.#u=!1}static fromGlob(e,n={}){let r=new Wn(null,void 0,n);return Wn.#f(e,r,0,n,0),r}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[n,r,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return r;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,a),{_src:n,_glob:e})}get options(){return this.#s}toRegExpSource(e){let n=e??!!this.#s.dot;if(this.#n===this&&(this.#d(),this.#y()),!vL(this)){let l=this.isStart()&&this.isEnd()&&!this.#e.some(d=>typeof d!="string"),c=this.#e.map(d=>{let[p,g,y,w]=typeof d=="string"?Wn.#S(d,this.#r,l):d.toRegExpSource(e);return this.#r=this.#r||y,this.#i=this.#i||w,p}).join(""),u="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&_Z.has(this.#e[0]))){let p=EZ,g=n&&p.has(c.charAt(0))||c.startsWith("\\.")&&p.has(c.charAt(2))||c.startsWith("\\.\\.")&&p.has(c.charAt(4)),y=!n&&!e&&p.has(c.charAt(0));u=g?DZ:y?py:""}let f="";return this.isEnd()&&this.#n.#l&&this.#t?.type==="!"&&(f="(?:$|\\/)"),[u+c+f,Oo(c),this.#r=!!this.#r,this.#i]}let r=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#g(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString(),c=this;return c.#e=[l],c.type=null,c.#r=void 0,[l,Oo(this.toString()),!1,!1]}let o=!r||e||n||!py?"":this.#g(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#u)a=(this.isStart()&&!n?py:"")+SL;else{let l=this.type==="!"?"))"+(this.isStart()&&!n&&!e?py:"")+xL+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+l}return[a,Oo(s),this.#r=!!this.#r,this.#i]}#d(){if(vL(this)){let e=0,n=!1;do{n=!0;for(let r=0;r<this.#e.length;r++){let i=this.#e[r];typeof i=="object"&&(i.#d(),this.#m(i)?(n=!1,this.#p(i,r)):this.#w(i)?(n=!1,this.#b(i,r)):this.#k(i)&&(n=!1,this.#x(i)))}}while(!n&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#d();this.#o=void 0}#g(e){return this.#e.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[r,i,s,o]=n.toRegExpSource(e);return this.#i=this.#i||o,r}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#S(e,n,r=!1){let i=!1,s="",o=!1,a=!1;for(let l=0;l<e.length;l++){let c=e.charAt(l);if(i){i=!1,s+=(CZ.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,s+=r&&/^[*]+$/.test(e)?SL:xL,n=!0;continue}else a=!1;if(c==="\\"){l===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[u,f,h,d]=bL(e,l);if(h){s+=u,o=o||f,l+=h-1,n=n||d;continue}}if(c==="?"){s+=ex,n=!0;continue}s+=TZ(c)}return[s,Oo(e),!!n,o]}};Wn=qa;m();var tx=(t,{windowsPathsNoEscape:e=!1,magicalBraces:n=!1}={})=>n?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var rn=(t,e,n={})=>(id(e),!n.nocomment&&e.charAt(0)==="#"?!1:new lu(e,n).match(t)),IZ=/^\*+([^+@!?*[(]*)$/,AZ=t=>e=>!e.startsWith(".")&&e.endsWith(t),OZ=t=>e=>e.endsWith(t),PZ=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),NZ=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),MZ=/^\*+\.\*+$/,RZ=t=>!t.startsWith(".")&&t.includes("."),zZ=t=>t!=="."&&t!==".."&&t.includes("."),LZ=/^\.\*+$/,BZ=t=>t!=="."&&t!==".."&&t.startsWith("."),$Z=/^\*+$/,UZ=t=>t.length!==0&&!t.startsWith("."),jZ=t=>t.length!==0&&t!=="."&&t!=="..",qZ=/^\?+([^+@!?*[(]*)?$/,VZ=([t,e=""])=>{let n=_L([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},HZ=([t,e=""])=>{let n=CL([t]);return e?(e=e.toLowerCase(),r=>n(r)&&r.toLowerCase().endsWith(e)):n},WZ=([t,e=""])=>{let n=CL([t]);return e?r=>n(r)&&r.endsWith(e):n},GZ=([t,e=""])=>{let n=_L([t]);return e?r=>n(r)&&r.endsWith(e):n},_L=([t])=>{let e=t.length;return n=>n.length===e&&!n.startsWith(".")},CL=([t])=>{let e=t.length;return n=>n.length===e&&n!=="."&&n!==".."},TL=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",DL={win32:{sep:"\\"},posix:{sep:"/"}},QZ=TL==="win32"?DL.win32.sep:DL.posix.sep;rn.sep=QZ;var hn=Symbol("globstar **");rn.GLOBSTAR=hn;var KZ="[^/]",ZZ=KZ+"*?",YZ="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",JZ="(?:(?!(?:\\/|^)\\.).)*?",XZ=(t,e={})=>n=>rn(n,t,e);rn.filter=XZ;var Ur=(t,e={})=>Object.assign({},t,e),eY=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return rn;let e=rn;return Object.assign((r,i,s={})=>e(r,i,Ur(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,Ur(t,s))}static defaults(i){return e.defaults(Ur(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,Ur(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Ur(t,s))}},unescape:(r,i={})=>e.unescape(r,Ur(t,i)),escape:(r,i={})=>e.escape(r,Ur(t,i)),filter:(r,i={})=>e.filter(r,Ur(t,i)),defaults:r=>e.defaults(Ur(t,r)),makeRe:(r,i={})=>e.makeRe(r,Ur(t,i)),braceExpand:(r,i={})=>e.braceExpand(r,Ur(t,i)),match:(r,i,s={})=>e.match(r,i,Ur(t,s)),sep:e.sep,GLOBSTAR:hn})};rn.defaults=eY;var FL=(t,e={})=>(id(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:yL(t,{max:e.braceExpandMax}));rn.braceExpand=FL;var tY=(t,e={})=>new lu(t,e).makeRe();rn.makeRe=tY;var nY=(t,e,n={})=>{let r=new lu(e,n);return t=t.filter(i=>r.match(i)),r.options.nonull&&!t.length&&t.push(e),t};rn.match=nY;var EL=/[?*]|[+@!]\(.*?\)|\[|\]/,rY=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),lu=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,n={}){id(e),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=e,this.platform=n.platform||TL,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let n of e)if(typeof n!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,n=this.options;if(!n.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!EL.test(s[2]))&&!EL.test(s[3]),c=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(c)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let r of e)for(let i=0;i<r.length;i++)r[i]==="**"&&(r[i]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):n>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(n=>{let r=-1;for(;(r=n.indexOf("**",r+1))!==-1;){let i=r;for(;n[i+1]==="**";)i++;i!==r&&n.splice(r,i-r)}return n})}levelOneOptimize(e){return e.map(n=>(n=n.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(n=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(n=!0,e.pop())}let r=0;for(;(r=e.indexOf("..",r+1))!==-1;){let i=e[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(n=!0,e.splice(r-1,2),r-=2)}}while(n);return e.length===0?[""]:e}firstPhasePreProcess(e){let n=!1;do{n=!1;for(let r of e){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let o=i;for(;r[o+1]==="**";)o++;o>i&&r.splice(i+1,o-i);let a=r[i+1],l=r[i+2],c=r[i+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;n=!0,r.splice(i,1);let u=r.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<r.length-1;o++){let a=r[o];o===1&&a===""&&r[0]===""||(a==="."||a==="")&&(n=!0,r.splice(o,1),o--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(n=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let o=r[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){n=!0;let l=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...l),r.length===0&&r.push(""),s-=2}}}}while(n);return e}secondPhasePreProcess(e){for(let n=0;n<e.length-1;n++)for(let r=n+1;r<e.length;r++){let i=this.partsMatch(e[n],e[r],!this.preserveMultipleSlashes);if(i){e[n]=[],e[r]=i;break}}return e.filter(n=>n.length)}partsMatch(e,n,r=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<n.length;)if(e[i]===n[s])o.push(a==="b"?n[s]:e[i]),i++,s++;else if(r&&e[i]==="**"&&n[s]===e[i+1])o.push(e[i]),i++;else if(r&&n[s]==="**"&&e[i]===n[s+1])o.push(n[s]),s++;else if(e[i]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(n[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(n[s]),i++,s++}else return!1;return e.length===n.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,n=!1,r=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)n=!n,r++;r&&(this.pattern=e.slice(r)),this.negate=n}matchOne(e,n,r=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),l=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),c=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),u=!c&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),f=l?3:a?0:void 0,h=u?3:c?0:void 0;if(typeof f=="number"&&typeof h=="number"){let[d,p]=[e[f],n[h]];d.toLowerCase()===p.toLowerCase()&&(n[h]=d,s=h,i=f)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),n.includes(hn)?this.#n(e,n,r,i,s):this.#i(e,n,r,i,s)}#n(e,n,r,i,s){let o=n.indexOf(hn,s),a=n.lastIndexOf(hn),[l,c,u]=r?[n.slice(s,o),n.slice(o+1),[]]:[n.slice(s,o),n.slice(o+1,a),n.slice(a+1)];if(l.length){let b=e.slice(i,i+l.length);if(!this.#i(b,l,r,0,0))return!1;i+=l.length,s+=l.length}let f=0;if(u.length){if(u.length+i>e.length)return!1;let b=e.length-u.length;if(this.#i(e,u,r,b,0))f=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(b--,!this.#i(e,u,r,b,0)))return!1;f=u.length+1}}if(!c.length){let b=!!f;for(let S=i;S<e.length-f;S++){let D=String(e[S]);if(b=!0,D==="."||D===".."||!this.options.dot&&D.startsWith("."))return!1}return r||b}let h=[[[],0]],d=h[0],p=0,g=[0];for(let b of c)b===hn?(g.push(p),d=[[],0],h.push(d)):(d[0].push(b),p++);let y=h.length-1,w=e.length-f;for(let b of h)b[1]=w-(g[y--]+b[0].length);return!!this.#r(e,h,i,0,r,0,!!f)}#r(e,n,r,i,s,o,a){let l=n[i];if(!l){for(let f=r;f<e.length;f++){a=!0;let h=e[f];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1}return a}let[c,u]=l;for(;r<=u;){if(this.#i(e.slice(0,r+c.length),c,s,r,0)&&o<this.maxGlobstarRecursion){let d=this.#r(e,n,r+c.length,i+1,s,o+1,a);if(d!==!1)return d}let h=e[r];if(h==="."||h===".."||!this.options.dot&&h.startsWith("."))return!1;r++}return s||null}#i(e,n,r,i,s){let o,a,l,c;for(o=i,a=s,c=e.length,l=n.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");let u=n[a],f=e[o];if(this.debug(n,u,f),u===!1||u===hn)return!1;let h;if(typeof u=="string"?(h=f===u,this.debug("string match",u,f,h)):(h=u.test(f),this.debug("pattern match",u,f,h)),!h)return!1}if(o===c&&a===l)return!0;if(o===c)return r;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return FL(this.pattern,this.options)}parse(e){id(e);let n=this.options;if(e==="**")return hn;if(e==="")return"";let r,i=null;(r=e.match($Z))?i=n.dot?jZ:UZ:(r=e.match(IZ))?i=(n.nocase?n.dot?NZ:PZ:n.dot?OZ:AZ)(r[1]):(r=e.match(qZ))?i=(n.nocase?n.dot?HZ:VZ:n.dot?WZ:GZ)(r):(r=e.match(MZ))?i=n.dot?zZ:RZ:(r=e.match(LZ))&&(i=BZ);let s=qa.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?ZZ:n.dot?YZ:JZ,i=new Set(n.nocase?["i"]:[]),s=e.map(l=>{let c=l.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))i.add(h);return typeof f=="string"?rY(f):f===hn?hn:f._src});c.forEach((f,h)=>{let d=c[h+1],p=c[h-1];f!==hn||p===hn||(p===void 0?d!==void 0&&d!==hn?c[h+1]="(?:\\/|"+r+"\\/)?"+d:c[h]=r:d===void 0?c[h-1]=p+"(?:\\/|\\/"+r+")?":d!==hn&&(c[h-1]=p+"(?:\\/|\\/"+r+"\\/)"+d,c[h+1]=hn))});let u=c.filter(f=>f!==hn);if(this.partial&&u.length>=1){let f=[];for(let h=1;h<=u.length;h++)f.push(u.slice(0,h).join("/"));return"(?:"+f.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,n=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&n)return!0;let r=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let l=i;if(r.matchBase&&a.length===1&&(l=[o]),this.matchOne(l,a,n))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(e){return rn.defaults(e).Minimatch}};rn.AST=qa;rn.Minimatch=lu;rn.escape=tx;rn.unescape=Oo;function IL(t,e){if(e.startsWith("~")){let i=e.slice(1).trim(),s=(0,gy.prepareFuzzySearch)(i);return{files:t.vault.getFiles().map(a=>({file:a,result:s(a.path)})).filter(a=>a.result!==null).sort((a,l)=>l.result.score-a.result.score).map(a=>a.file),mode:"fuzzy",pattern:i}}if(e.includes("*")||e.includes("?")){let i=e.replace(/\\/g,"/");return{files:t.vault.getFiles().filter(o=>rn(o.path,i)),mode:"glob",pattern:i}}let n=(0,gy.normalizePath)(e),r=t.vault.getFileByPath(n);return{files:r?[r]:[],mode:"exact",pattern:n}}var Va="quartz-syncer:mark",iY={path:{value:"<vault-path|glob|~fuzzy>",description:"File path, glob, or fuzzy query (prefix with ~)"},value:{value:"<true|false|toggle>",description:"Publish flag value (default: true)"},"dry-run":{description:"Show matched files without modifying"},format:{value:"<json|text>",description:"Output format (default: text)"}};function sY(t){return!t||t==="true"?!0:t==="false"?!1:t==="toggle"?"toggle":null}function oY(t){return t===!0||t==="true"||t===1}function AL(t,e){t(Va,"Set or toggle the publish flag for matching files",iY,async n=>{try{let r=typeof n.path=="string"?n.path:"";if(!r)return Q(n,ce(Va,"Missing required flag: path"));let i=sY(typeof n.value=="string"?n.value:void 0);if(i===null)return Q(n,ce(Va,"Invalid value. Use true, false, or toggle."));let s=n["dry-run"]==="true",a=n.verbose==="true"&&n.format!=="json",l=IL(e.app,r),c=e.settings.vaultPath,u=c==="/",f=new Set(["md",...e.settings.useBases?["base"]:[],...e.settings.useCanvas?["canvas"]:[],...e.settings.useExcalidraw?["excalidraw"]:[]]),h=l.files.filter(E=>f.has(E.extension)&&(u||E.path.startsWith(c)));if(h.length===0)return Q(n,ce(Va,"No publishable files matched the provided path."));let d=[],p=[],g=[];for(let E of h)try{let v=new lo(e.app.vault,e.app.metadataCache,E,e.app.fileManager),_;if(i==="toggle"){let C=v.get(e.settings.publishFrontmatterKey);_=!oY(C)}else _=i;s||await v.set(e.settings.publishFrontmatterKey,_).apply(),d.push(E.path),g.push({path:E.path,value:_})}catch(v){p.push({path:E.path,error:v instanceof Error?v.message:String(v)})}let y={mode:l.mode,pattern:l.pattern,dryRun:s,matched:h.map(E=>E.path),updated:d,failed:p,appliedValues:g},w=[s?`Dry run: ${d.length} file${d.length===1?"":"s"} matched`:`Updated ${d.length} file${d.length===1?"":"s"}`,`Mode: ${l.mode}`];p.length>0&&w.push(`Failed: ${p.length} file${p.length===1?"":"s"}`);let b=w.join(". ")+".",S=[`Vault root: ${u?"/":c}`,`All notes publishable: ${e.settings.allNotesPublishableByDefault?"yes":"no"}`],D=a?[b,...S,...y.appliedValues.length>0?y.appliedValues.map(E=>` ${E.path} \u2192 ${E.value}`):[]].join(`
|
||
`):b,k=p.length>0?{ok:!1,command:Va,error:D,data:y}:Se(Va,D,y);return Q(n,k)}catch(r){return Q(n,ce(Va,r instanceof Error?r.message:String(r)))}})}m();var od="quartz-syncer:test",aY={format:{value:"<json|text>",description:"Output format (default: text)"}};function OL(t,e){t(od,"Test repository connection and credentials",aY,async n=>{try{let r=Yt(e);if(r)return Q(n,ce(od,r));let i=e.getGitSettingsWithSecret(),o=n.verbose==="true"&&n.format!=="json",a=new rt({gitSettings:i,contentFolder:e.settings.contentFolder,vaultPath:e.settings.vaultPath}),l=await a.testConnection(),c=l?await rt.checkWriteAccess(i.remoteUrl,i.auth,i.corsProxyUrl):!1,u={repository:a.getRepositoryName(),branch:i.branch,readAccess:l,writeAccess:c},f=l?`Connection OK (read: ${l?"yes":"no"}, write: ${c?"yes":"no"}).`:"Connection failed.",h=[`type: ${i.auth?.type??"unknown"}`];i.auth?.username&&h.push(`username: ${i.auth.username}`);let d=o&&l?[f,`Repository: ${u.repository}`,`Branch: ${u.branch}`,`Auth: ${h.join(", ")}`].join(`
|
||
`):f;return Q(n,l?Se(od,d,u):ce(od,d))}catch(r){return Q(n,ce(od,r instanceof Error?r.message:String(r)))}})}m();var PL=require("obsidian");var Vi="quartz-syncer:cache",lY={action:{value:"<status|clear|clear-all>",description:"Cache operation to perform"},path:{value:"<vault-path>",description:"File path (required for action=clear)"},force:{description:"Skip confirmation for clear-all"},format:{value:"<json|text>",description:"Output format (default: text)"}};function NL(t,e){t(Vi,"Manage the Quartz Syncer cache",lY,async n=>{try{if(!e.settings.useCache||!e.datastore)return Q(n,ce(Vi,"Cache is disabled."));let i=n.verbose==="true"&&n.format!=="json",s=typeof n.action=="string"?n.action:"";if(!s)return Q(n,ce(Vi,"Missing required flag: action"));if(s==="status"){let o=await e.datastore.allFiles(),a=await e.datastore.getLastUpdateTimestamp(),l={count:o.length,files:o,lastUpdated:a},c=`Cache contains ${o.length} file${o.length===1?"":"s"}.`,u=i&&o.length>0?[c,...o.map(f=>` ${f}`)].join(`
|
||
`):c;return Q(n,Se(Vi,u,l))}if(s==="clear"){let o=typeof n.path=="string"?n.path:"";if(!o)return Q(n,ce(Vi,"Missing required flag: path"));let a=(0,PL.normalizePath)(o);await e.datastore.persister.removeItem(e.datastore.fileKey(a)),await e.datastore.setLastUpdateTimestamp(Date.now(),e);let l=`Cache cleared for ${a}.`;return Q(n,Se(Vi,l,{path:a}))}return s==="clear-all"?n.force==="true"?(await e.datastore.recreate(),await e.datastore.setLastUpdateTimestamp(Date.now(),e),Q(n,Se(Vi,"Cache cleared for all files.",{cleared:!0}))):Q(n,ce(Vi,"Clearing all cache requires the 'force' flag.")):Q(n,ce(Vi,"Invalid action. Use status, clear, or clear-all."))}catch(r){return Q(n,ce(Vi,r instanceof Error?r.message:String(r)))}})}m();var nx=require("obsidian");m();var ML=new Set(["__proto__","constructor","prototype"]);function ad(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function yy(t,e){let n=e.split(".");if(n.some(i=>ML.has(i)))return;let r=t;for(let i of n){if(!ad(r)||!Object.hasOwn(r,i))return;r=r[i]}return r}function wy(t,e,n){let r=e.split(".");if(r.some(o=>ML.has(o)))return!1;let i=t;for(let o=0;o<r.length-1;o++){let a=r[o];if(!ad(i)||!Object.hasOwn(i,a))return!1;i=i[a]}if(!ad(i))return!1;let s=r[r.length-1];return i[s]=n,!0}function ld(t,e="",n={}){if(!ad(t))return e&&(n[e]=JSON.stringify(t)),n;for(let[r,i]of Object.entries(t)){if(i===void 0)continue;let s=e?`${e}.${r}`:r;ad(i)?ld(i,s,n):n[s]=JSON.stringify(i)}return n}var Tn="quartz-syncer:config",cY={action:{value:"<get|set|list>",description:"Config operation"},key:{value:"<setting-path>",description:"Dot-notation setting key"},value:{value:"<value>",description:"Value for action=set"},format:{value:"<json|text>",description:"Output format (default: text)"}},uY={"git.remoteUrl":"string","git.branch":"string","git.corsProxyUrl":"string","git.auth.type":"string","git.auth.username":"string","git.providerHint":"string",contentFolder:"string",vaultPath:"string",publishFrontmatterKey:"string",allNotesPublishableByDefault:"boolean",useCache:"boolean",syncCache:"boolean",useDataview:"boolean",useDatacore:"boolean",useExcalidraw:"boolean",useFantasyStatblocks:"boolean",useBases:"boolean",useCanvas:"boolean",frontmatterFormat:"string",diffViewStyle:"string"},fY={"git.auth.type":["none","basic","bearer"],"git.providerHint":["github","gitlab","bitbucket","gitea","custom"],frontmatterFormat:["yaml","json"],diffViewStyle:["split","unified","auto"]};function hY(t,e){return{...t,git:{...t.git,auth:{...t.git.auth,secret:e?"***":void 0}}}}function dY(t,e){return t==="string"?e:e==="true"?!0:e==="false"?!1:null}function RL(t,e){t(Tn,"Read or update Quartz Syncer settings",cY,async n=>{try{let i=n.verbose==="true"&&n.format!=="json",s=typeof n.action=="string"?n.action:"list",o=!!e.getGitSettingsWithSecret().auth?.secret;if(s==="list"){let l=hY(e.settings,o),{cache:c,cacheTimestamp:u,...f}=l,h=Object.entries(ld(f)).map(([d,p])=>`${d}=${p}`).join(`
|
||
`);return Q(n,Se(Tn,h,f))}let a=typeof n.key=="string"?n.key:"";if(!a)return Q(n,ce(Tn,"Missing required flag: key"));if(s==="get"){if(a==="git.auth.secret"){let h=o?"***":"not set",d={key:a,value:h},p=`${a}="${h}"`,g=i?`${p} (type: string)`:p;return Q(n,Se(Tn,g,d))}let l=yy(e.settings,a);if(l===void 0)return Q(n,ce(Tn,"Unknown setting key."));let c={key:a,value:l},u=`${a}=${JSON.stringify(l)}`,f=i?`${u} (type: ${typeof l})`:u;return Q(n,Se(Tn,f,c))}if(s==="set"){if(a==="git.auth.secret")return Q(n,ce(Tn,"git.auth.secret cannot be set via CLI."));let l=uY[a];if(!l)return Q(n,ce(Tn,"Setting is not writable via CLI."));if(typeof n.value!="string")return Q(n,ce(Tn,"Missing required flag: value"));let c=n.value,u=dY(l,c);if(u===null)return Q(n,ce(Tn,`Invalid value for ${a}. Expected ${l}.`));let f=fY[a];if(f&&typeof u=="string"&&!f.includes(u))return Q(n,ce(Tn,`Invalid value for ${a}. Expected one of: ${f.join(", ")}.`));let h=u;if(typeof u=="string")if(a==="vaultPath"){let y=u.trim();if(y==="/"||y==="")h="/";else{let w=(0,nx.normalizePath)(y);h=w.endsWith("/")?w:w+"/"}}else a==="contentFolder"&&(h=(0,nx.normalizePath)(u.trim()));if(!wy(e.settings,a,h))return Q(n,ce(Tn,"Failed to set value."));await e.saveSettings();let p={key:a,value:h},g=`Updated ${a}.`;return Q(n,Se(Tn,g,p))}return Q(n,ce(Tn,"Invalid action. Use get, set, or list."))}catch(r){return Q(n,ce(Tn,r instanceof Error?r.message:String(r)))}})}m();var Ha="quartz-syncer:upgrade",mY={force:{description:"Apply upgrade (required)"},"dry-run":{description:"Check for updates without applying"},format:{value:"<json|text>",description:"Output format (default: text)"}};function zL(t,e){t(Ha,"Upgrade the Quartz repository from upstream",mY,async n=>{try{let r=Yt(e);if(r)return Q(n,ce(Ha,r));let i=e.getGitSettingsWithSecret(),s=new rt({gitSettings:i,contentFolder:e.settings.contentFolder,vaultPath:e.settings.vaultPath}),o=n["dry-run"]==="true",l=n.verbose==="true"&&n.format!=="json",c=(p,g)=>l?[p,`Upstream: ${Kc}#${Zc}`,...g].join(`
|
||
`):p;if(o){let p=e.settings.lastUpstreamCommitSha||null,g=await rt.fetchRemoteHeadCommit(Kc,Tk,Zc,i.corsProxyUrl);if(g===null)return Q(n,ce(Ha,"Could not check upstream. The remote may be unreachable."));let y=g!==p,w=y?"Upstream updates available.":"Already up to date.",b=[`Recorded SHA: ${p??"none"}`,`Upstream HEAD: ${g}`],S=c(w,b);return Q(n,Se(Ha,S,{lastUpstreamCommitSha:p??null,upstreamHead:g,hasUpdate:y}))}if(!(n.force==="true"))return Q(n,ce(Ha,"Upgrade requires the 'force' flag."));let f=await s.upgradeFromUpstream(Kc,Zc);f.oid&&e.settings.lastUpstreamCommitSha!==f.oid&&(e.settings.lastUpstreamCommitSha=f.oid,await e.saveSettings());let h=f.alreadyMerged?"Already up to date.":`Upgraded to ${f.oid}.`,d=c(h,[`Upstream SHA: ${f.oid}`,`Recorded SHA: ${e.settings.lastUpstreamCommitSha||"none"}`]);return Q(n,Se(Ha,d,f))}catch(r){return Q(n,ce(Ha,r instanceof Error?r.message:String(r)))}})}m();var LL=require("obsidian");var rx="quartz-syncer:version",pY={format:{value:"<json|text>",description:"Output format (default: text)"}},gY={"v5-yaml":"quartz.config.yaml","v5-json":"quartz.plugins.json",v4:"quartz.config.ts",unknown:"unknown"};function BL(t,e){t(rx,"Show plugin, Obsidian, and Quartz version information",pY,async n=>{try{let i=n.verbose==="true"&&n.format!=="json",s=e.appVersion,o=LL.apiVersion??"unknown",a="unknown",l=null,c=null;if(!Yt(e)){let b=e.getGitSettingsWithSecret();c=new rt({gitSettings:b,contentFolder:e.settings.contentFolder,vaultPath:e.settings.vaultPath}),a=await ai.detectQuartzVersion(c),l=await ai.getQuartzPackageVersion(c)}let f=l??"unknown",h=a??"unknown",d=gY[h]??"unknown",p=[`Quartz Syncer: ${s}`,`Obsidian: ${o}`,`Quartz: ${f} (${h})`],g=c?[`Repository: ${c.getRepositoryName()}`,`Branch: ${e.settings.git.branch}`,`Quartz config: ${d}`]:["Git: not configured"],y=i?[...p,...g].join(`
|
||
`):p.join(`
|
||
`);return Q(n,Se(rx,y,{pluginVersion:s,obsidianVersion:o,quartzVersion:l,quartzFormat:h}))}catch(r){return Q(n,ce(rx,r instanceof Error?r.message:String(r)))}})}m();var Fn="quartz-syncer:plugin",yY={action:{value:"<list|add|remove|updates|update|browse>",description:"Plugin operation (default: list)"},source:{value:"<github:org/repo>",description:"Plugin source identifier"},force:{description:"Required for plugin removal"},format:{value:"<json|text>",description:"Output format (default: text)"}};function wY(t){let e=t.getGitSettingsWithSecret(),n=new rt({gitSettings:e,contentFolder:t.settings.contentFolder,vaultPath:t.settings.vaultPath});return new So(n)}function bY(t,e){let n=[];for(let r of t){let i=Vn(r.source),s=r.enabled?"enabled":"disabled",o=r.order??Wg;n.push(`${i} [${s}] (order: ${o})`),e&&(n.push(` Source: ${Dn(r.source)}`),n.push(` Options: ${JSON.stringify(r.options??{})}`))}return n.join(`
|
||
`)}function vY(t,e){let n=[];for(let r of t){let i=r.hasUpdate?"update available":"up to date";n.push(`${r.name} [${i}]`),e&&(n.push(` Locked: ${r.lockedCommit??"none"}`),n.push(` Remote: ${r.remoteCommit??"unknown"}`),r.error&&n.push(` Error: ${r.error}`))}return n.join(`
|
||
`)}function kY(t,e){let n=[];for(let r of t){let i=r.official?" [official]":"";n.push(`${r.name} - ${r.description}${i}`),e&&(n.push(` Source: ${Dn(r.source)}`),n.push(` Tags: ${r.tags.join(", ")||"none"}`))}return n.join(`
|
||
`)}function $L(t,e){t(Fn,"Manage Quartz v5 plugins",yY,async n=>{try{let i=n.verbose==="true"&&n.format!=="json",s=typeof n.action=="string"?n.action:"list";if(s==="browse"){let f=await new Yc().getPlugins(),h=kY(f,i);return Q(n,Se(Fn,h,{plugins:f}))}let o=Yt(e);if(o)return Q(n,ce(Fn,o));let a=wY(e),l=await a.readConfig();if(s==="list"){let u=bY(l.plugins,i),f={plugins:l.plugins.map(h=>({name:Vn(h.source),sourceKey:Dn(h.source),enabled:h.enabled,order:h.order??Wg,options:h.options??{},source:h.source}))};return Q(n,Se(Fn,u,f))}if(s==="updates"){let u=await a.readLockFile(),f=e.getGitSettingsWithSecret(),d=await new Do(f.auth,f.corsProxyUrl||void 0).checkUpdates(l.plugins,u),p=d.filter(w=>w.hasUpdate),g=i?d:p,y=g.length>0?vY(g,i):"All plugins are up to date.";return Q(n,Se(Fn,y,{updates:d,updatable:p.length}))}if(s==="update"){let u=await a.readLockFile(),f=e.getGitSettingsWithSecret(),p=(await new Do(f.auth,f.corsProxyUrl||void 0).checkUpdates(l.plugins,u)).filter(b=>b.hasUpdate&&b.remoteCommit);if(p.length===0)return Q(n,Se(Fn,"All plugins are up to date.",{updated:0}));if(n.force!=="true"){let b=p.map(S=>S.name).join(", ");return Q(n,ce(Fn,`${p.length} plugin${p.length===1?"":"s"} can be updated (${b}). Use 'force' to apply.`))}let g=u??{version:"1.0.0",plugins:{}};for(let b of p){let S=l.plugins.find(D=>Vn(D.source)===b.name);g.plugins[b.name]?g.plugins[b.name].commit=b.remoteCommit:S&&(g.plugins[b.name]={source:S.source,resolved:Qc(S.source),commit:b.remoteCommit,installedAt:new Date().toISOString()})}await a.writeLockFile(g,`Update ${p.length} plugin${p.length===1?"":"s"}`);let y=p.map(b=>b.name),w=`Updated ${p.length} plugin${p.length===1?"":"s"}: ${y.join(", ")}.`;return Q(n,Se(Fn,w,{updated:p.length,plugins:p.map(b=>({name:b.name,from:b.lockedCommit,to:b.remoteCommit}))}))}let c=typeof n.source=="string"?n.source:"";if(s==="add"){if(!c)return Q(n,ce(Fn,"Missing required flag: source"));let f=new La().addPlugin(l,c),h=Vn(f.source);return await a.writeConfig(l,`Add plugin: ${h}`),Q(n,Se(Fn,`Added plugin ${h}.`,{name:h,source:f.source}))}if(s==="remove"){if(!c)return Q(n,ce(Fn,"Missing required flag: source"));if(n.force!=="true")return Q(n,ce(Fn,"Removing a plugin requires the 'force' flag."));let u=new La,f=Dn(c),h=u.removePlugin(l,f),d=Vn(h.source);return await a.writeConfig(l,`Remove plugin: ${d}`),Q(n,Se(Fn,`Removed plugin ${d}.`,{name:d,source:h.source}))}return Q(n,ce(Fn,"Invalid action. Use list, add, remove, updates, update, or browse."))}catch(r){return Q(n,ce(Fn,r instanceof Error?r.message:String(r)))}})}m();var Gn="quartz-syncer:quartz-config",xY={action:{value:"<list|get|set>",description:"Config operation (default: list)"},key:{value:"<config-path>",description:"Dot-notation config key (e.g., pageTitle, theme.typography.header)"},value:{value:"<value>",description:"New value for action=set"},format:{value:"<json|text>",description:"Output format (default: text)"}},SY={pageTitle:"string",pageTitleSuffix:"string",enableSPA:"boolean",enablePopovers:"boolean",locale:"string",baseUrl:"string","theme.fontOrigin":"string","theme.cdnCaching":"boolean","theme.typography.header":"string","theme.typography.body":"string","theme.typography.code":"string","theme.colors.lightMode.light":"string","theme.colors.lightMode.lightgray":"string","theme.colors.lightMode.gray":"string","theme.colors.lightMode.darkgray":"string","theme.colors.lightMode.dark":"string","theme.colors.lightMode.secondary":"string","theme.colors.lightMode.tertiary":"string","theme.colors.lightMode.highlight":"string","theme.colors.lightMode.textHighlight":"string","theme.colors.darkMode.light":"string","theme.colors.darkMode.lightgray":"string","theme.colors.darkMode.gray":"string","theme.colors.darkMode.darkgray":"string","theme.colors.darkMode.dark":"string","theme.colors.darkMode.secondary":"string","theme.colors.darkMode.tertiary":"string","theme.colors.darkMode.highlight":"string","theme.colors.darkMode.textHighlight":"string"},DY=new Set(["googleFonts","local"]);function EY(t,e){return t==="string"?e:e==="true"?!0:e==="false"?!1:null}function UL(t,e){t(Gn,"Read or update Quartz v5 site configuration",xY,async n=>{try{let r=Yt(e);if(r)return Q(n,ce(Gn,r));let i=typeof n.action=="string"?n.action:"list",s=e.getGitSettingsWithSecret(),o=new rt({gitSettings:s,contentFolder:e.settings.contentFolder,vaultPath:e.settings.vaultPath}),a=new So(o);if(i==="list"){let c=await a.readConfig(),u=ld(c.configuration),f=Object.entries(u).map(([h,d])=>`${h}=${d}`).join(`
|
||
`);return Q(n,Se(Gn,f,c.configuration))}let l=typeof n.key=="string"?n.key:"";if(!l)return Q(n,ce(Gn,"Missing required flag: key"));if(i==="get"){let c=await a.readConfig(),u=yy(c.configuration,l);if(u===void 0)return Q(n,ce(Gn,"Unknown config key."));let f={key:l,value:u},h=`${l}=${JSON.stringify(u)}`;return Q(n,Se(Gn,h,f))}if(i==="set"){let c=SY[l];if(!c)return Q(n,ce(Gn,"Config key is not writable via CLI."));if(typeof n.value!="string")return Q(n,ce(Gn,"Missing required flag: value"));let u=EY(c,n.value);if(u===null)return Q(n,ce(Gn,`Invalid value for ${l}. Expected ${c}.`));if(l==="theme.fontOrigin"&&typeof u=="string"&&!DY.has(u))return Q(n,ce(Gn,"Invalid value for theme.fontOrigin. Expected googleFonts or local."));let f=await a.readConfig();if(!wy(f.configuration,l,u))return Q(n,ce(Gn,"Failed to set value."));await a.writeConfig(f,`Update Quartz config: ${l}`);let d={key:l,value:u},p=`Updated ${l}.`;return Q(n,Se(Gn,p,d))}return Q(n,ce(Gn,"Invalid action. Use get, set, or list."))}catch(r){return Q(n,ce(Gn,r instanceof Error?r.message:String(r)))}})}m();var jL="quartz-syncer",_Y={format:{value:"<json|text>",description:"Output format (default: text)"}},qL=`Quartz Syncer CLI \u2014 Manage and publish notes to Quartz from the terminal.
|
||
|
||
Usage: obsidian quartz-syncer[:<command>] [flags]
|
||
|
||
Commands:
|
||
status Show the publish status of all marked notes
|
||
sync Publish pending notes and optionally delete removed notes
|
||
publish Publish pending notes without deletions
|
||
delete Delete removed notes from the remote repository
|
||
mark Set or toggle the publish flag for matching files
|
||
test Test repository connection and credentials
|
||
cache Manage the Quartz Syncer cache
|
||
config Read or update Quartz Syncer settings
|
||
upgrade Upgrade the Quartz repository from upstream
|
||
version Show plugin, Obsidian, and Quartz version information
|
||
plugin Manage Quartz v5 plugins
|
||
quartz-config Read or update Quartz v5 site configuration
|
||
|
||
Global flags (all commands):
|
||
format=<json|text> Output format (default: text)
|
||
help, h Show command-specific help
|
||
verbose, v Enable detailed output
|
||
|
||
Command-specific flags:
|
||
dry-run Preview changes (sync, publish, delete, mark, upgrade)
|
||
force Required for destructive operations (sync, delete, upgrade, plugin)
|
||
|
||
Examples:
|
||
obsidian quartz-syncer:status
|
||
obsidian quartz-syncer:status format=json
|
||
obsidian quartz-syncer:sync force
|
||
obsidian quartz-syncer:publish dry-run
|
||
obsidian quartz-syncer:mark path="notes/post.md"
|
||
obsidian quartz-syncer:mark path="blog/**/*.md" dry-run
|
||
obsidian quartz-syncer:config action=get key=git.branch
|
||
|
||
Documentation: https://saberzero1.github.io/quartz-syncer-docs/`;function VL(t,e){t(jL,"Show available commands and usage information",_Y,n=>n.format==="json"?Q(n,Se(jL,qL,{commands:[{name:"quartz-syncer:status",description:"Show the publish status of all marked notes"},{name:"quartz-syncer:sync",description:"Publish pending notes and optionally delete removed notes"},{name:"quartz-syncer:publish",description:"Publish pending notes without deletions"},{name:"quartz-syncer:delete",description:"Delete removed notes from the remote repository"},{name:"quartz-syncer:mark",description:"Set or toggle the publish flag for matching files"},{name:"quartz-syncer:test",description:"Test repository connection and credentials"},{name:"quartz-syncer:cache",description:"Manage the Quartz Syncer cache"},{name:"quartz-syncer:config",description:"Read or update Quartz Syncer settings"},{name:"quartz-syncer:upgrade",description:"Upgrade the Quartz repository from upstream"},{name:"quartz-syncer:version",description:"Show plugin, Obsidian, and Quartz version information"},{name:"quartz-syncer:plugin",description:"Manage Quartz v5 plugins"},{name:"quartz-syncer:quartz-config",description:"Read or update Quartz v5 site configuration"}],version:e.appVersion})):qL)}var ix=it(vt());function HL(t){let e=t;if(typeof e.registerCliHandler!="function")return ix.default.debug("Skipping CLI handler registration: registerCliHandler is unavailable."),!1;let n=e.registerCliHandler.bind(e),r=(i,s,o,a)=>{let l=sL(o);n(i,s,l,c=>{let u=iL(c);if(u.help==="true"&&i!=="quartz-syncer"){let f=oL(i,s,o);return u.format==="json"?Q(u,{ok:!0,command:i,message:f}):f}return a(u)})};return VL(r,t),aL(r,t),lL(r,t),cL(r,t),uL(r,t),AL(r,t),OL(r,t),NL(r,t),RL(r,t),zL(r,t),BL(r,t),$L(r,t),UL(r,t),ix.default.info("CLI handlers registered successfully."),!0}var CY={git:{remoteUrl:"",branch:"v4",corsProxyUrl:"",auth:{type:"basic",username:""},providerHint:"github"},vaultPath:"/",githubRepo:void 0,githubUserName:void 0,githubToken:void 0,contentFolder:"content",publishFrontmatterKey:"publish",allNotesPublishableByDefault:!1,showCreatedTimestamp:!0,showUpdatedTimestamp:!0,showPublishedTimestamp:!1,usePermalink:!1,includeAllFrontmatter:!1,frontmatterFormat:"yaml",createdTimestampKey:"created, created_at, date",updatedTimestampKey:"modified, lastmod, updated, last-modified",publishedTimestampKey:"published, publishDate, date",timestampFormat:"MMM dd, yyyy h:mm a",useCache:!0,syncCache:!0,persistCache:!1,cacheTimestamp:0,cache:"{}",useAutoCardLink:!1,useDataview:!0,useDatacore:!1,useExcalidraw:!1,useFantasyStatblocks:!1,useBases:!1,useCanvas:!1,manageSyncerStyles:!0,lastUsedSettingsTab:"git",noteSettingsIsInitialized:!1,pluginVersion:"",lastUpstreamCommitSha:"",upgradeCheckStrategy:"version",diffViewStyle:"auto",ENABLE_DEVELOPER_TOOLS:!1,logLevel:In.default.OFF};In.default.useDefaults({defaultLevel:In.default.WARN,formatter:function(t,e){t.unshift(new Date().toUTCString()),t.unshift("QS: ")}});var by=class extends bs.Plugin{settings;appVersion;datastore;secretStorageService;extendedCache;publishModal;async onload(){this.appVersion=this.manifest.version,await this.loadSettings(),this.extendedCache=new hy(this.app),this.settings.logLevel&&In.default.setLevel(this.settings.logLevel),In.default.info("Initializing QuartzSyncer plugin v"+this.appVersion),In.default.info("Quartz Syncer log level set to "+In.default.getLevel().name),this.addSettingTab(new ty(this.app,this)),await this.addCommands(),HL(this),this.addRibbonIcon("leaf","Quartz Syncer publication center",async()=>{this.openPublishModal()})}onunload(){this.extendedCache?.destroy(),this.settings.persistCache||this.clearCacheForAllFiles(!0),super.onunload()}async onExternalSettingsChange(){In.default.info("External settings change detected, reloading settings."),await this.compareDataToCache()}async loadSettings(){this.settings=Object.assign({},CY,await this.loadData()),this.migrateGitHubSettings(),this.migrateRemovedThemesTab(),this.secretStorageService=new Gc(this.app),await this.secretStorageService.migrateFromSettings(this.settings,()=>this.saveSettings()),!this.datastore&&this.settings.useCache&&(this.datastore=new cy(this.app.vault.getName(),this.manifest.id,this.appVersion)),(!this.settings||this.settings.pluginVersion!==this.appVersion)&&(await this.clearCacheForAllFiles(!0),this.settings.pluginVersion=this.appVersion),await this.compareDataToCache()}migrateGitHubSettings(){let e=this.settings,n=e.githubRepo||e.githubUserName||e.githubToken,r=this.settings.git?.remoteUrl;if(n&&!r){In.default.info("Migrating legacy GitHub settings to generic Git settings");let i=e.githubRepo||"quartz",s=e.githubUserName||"",o=e.githubToken||"";this.settings.git={remoteUrl:s?`https://github.com/${s}/${i}.git`:"",branch:"v4",corsProxyUrl:"",auth:{type:"basic",username:s,secret:o},providerHint:"github"},this.settings.lastUsedSettingsTab==="github"&&(this.settings.lastUsedSettingsTab="git"),e.githubRepo=void 0,e.githubUserName=void 0,e.githubToken=void 0}}migrateRemovedThemesTab(){let e=this.settings;"useThemes"in e&&delete e.useThemes,this.settings.lastUsedSettingsTab==="themes"&&(this.settings.lastUsedSettingsTab="git")}async saveSettings(){await this.saveData(this.settings)}getGitSettingsWithSecret(){return{...this.settings.git,auth:{...this.settings.git.auth,secret:this.secretStorageService.getToken()||void 0}}}async addCommands(){this.addCommand({id:"open-publish-modal",name:"Open publication center",callback:async()=>{this.openPublishModal()}}),this.addCommand({id:"mark-note-for-publish",name:"Add publication flag",callback:async()=>{this.setPublishFlagValue(!0)}}),this.addCommand({id:"unmark-note-for-publish",name:"Remove publication flag",callback:async()=>{this.setPublishFlagValue(!1)}}),this.addCommand({id:"mark-toggle-publish-status",name:"Toggle publication flag",callback:async()=>{this.togglePublishFlag()}}),this.settings.useCache&&(this.addCommand({id:"clear-cache-for-active-file",name:"Clear cache for active file",callback:async()=>{await this.clearCacheForActiveFile()}}),this.addCommand({id:"clear-cache-for-all-files",name:"Clear cache for all files",callback:async()=>{await this.clearCacheForAllFiles()}}))}getActiveFile(e){let n=e.getActiveFile();return n||(new bs.Notice("Quartz Syncer: No file is open/active. Please open a file and try again."),null)}async clearCacheForActiveFile(){let e=this.getActiveFile(this.app.workspace);if(!e)return;let n=`file:${e.path}`;this.settings.useCache?(await this.datastore.persister.removeItem(n),this.settings.cacheTimestamp=Date.now(),await this.saveSettings(),await this.datastore.setLastUpdateTimestamp(this.settings.cacheTimestamp,this),In.default.info(`Cache cleared for file: ${e.path}`),new bs.Notice(`Quartz Syncer: Cache cleared for file: ${e.path}`)):(In.default.warn("Cache is disabled, no action taken."),new bs.Notice("Quartz Syncer: Cache is disabled, no action taken."))}async clearCacheForAllFiles(e=!1){if(e)this.datastore&&(this.settings.cache="{}",this.settings.cacheTimestamp=Date.now(),await this.saveSettings(),await this.datastore.persister.clear(),await this.datastore.dropOutdatedCache());else{if(!confirm("Are you sure you want to clear the Quartz Syncer cache for all files? This action cannot be undone.")){In.default.info("Cache clearing cancelled by user."),new bs.Notice("Quartz Syncer: Cache clearing cancelled.");return}this.settings.useCache?(this.settings.cache="{}",this.settings.cacheTimestamp=Date.now(),await this.saveSettings(),await this.datastore.setLastUpdateTimestamp(this.settings.cacheTimestamp,this),await this.datastore.recreate(),In.default.info("Cache cleared for all files."),new bs.Notice("Quartz Syncer: Cache cleared for all files.")):(In.default.warn("Cache is disabled, no action taken."),new bs.Notice("Quartz Syncer: Cache is disabled, no action taken."))}}async setPublishFlagValue(e){let n=this.getActiveFile(this.app.workspace);if(!n)return;new lo(this.app.vault,this.app.metadataCache,n,this.app.fileManager).set(this.settings.publishFrontmatterKey,e).apply()}async togglePublishFlag(){let e=this.getActiveFile(this.app.workspace);if(!e)return;let n=new lo(this.app.vault,this.app.metadataCache,e,this.app.fileManager);n.set(this.settings.publishFrontmatterKey,!n.get(this.settings.publishFrontmatterKey)).apply()}openPublishModal(){if(!this.publishModal){let e=new Sn(this.app.metadataCache,this.settings,this.getGitSettingsWithSecret()),n=new cr(this.app,this,this.app.vault,this.app.metadataCache,this.settings,this.datastore,this.extendedCache),r=new fr(e,n);this.publishModal=new Wp(this.app,r,n,e,this.settings)}this.publishModal.open()}async compareDataToCache(){if(!this.settings.useCache||!this.settings.syncCache)return;let e=await this.datastore.getLastUpdateTimestamp();e===null&&(e=0),e<this.settings.cacheTimestamp?await this.datastore.saveToDataJson(e,this):await this.datastore.loadFromDataJson(e,this)}};
|
||
/*! Bundled license information:
|
||
|
||
ieee754/index.js:
|
||
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
||
|
||
buffer/index.js:
|
||
(*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <https://feross.org>
|
||
* @license MIT
|
||
*)
|
||
|
||
js-logger/src/logger.js:
|
||
(*!
|
||
* js-logger - http://github.com/jonnyreeves/js-logger
|
||
* Jonny Reeves, http://jonnyreeves.co.uk/
|
||
* js-logger may be freely distributed under the MIT license.
|
||
*)
|
||
|
||
safe-buffer/index.js:
|
||
safe-buffer/index.js:
|
||
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
||
|
||
crc-32/crc32.js:
|
||
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
|
||
|
||
isomorphic-git/index.cjs:
|
||
(*!
|
||
* This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements.
|
||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||
* Copyright (c) James Prevett and other ZenFS contributors.
|
||
*)
|
||
*/
|
||
|
||
/* nosourcemap */ |