Oscar Plaisant bb9f9102c9 update
2024-03-13 11:36:31 +01:00

411 lines
711 KiB
JavaScript

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
"use strict";var fj=Object.create;var Ho=Object.defineProperty;var Ov=Object.getOwnPropertyDescriptor;var pj=Object.getOwnPropertyNames;var dj=Object.getPrototypeOf,mj=Object.prototype.hasOwnProperty;var hj=(e,t,r)=>t in e?Ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var $u=(e,t)=>()=>(e&&(t=e(e=0)),t);var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Av=(e,t)=>{for(var r in t)Ho(e,r,{get:t[r],enumerable:!0})},kv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of pj(t))!mj.call(e,o)&&o!==r&&Ho(e,o,{get:()=>t[o],enumerable:!(n=Ov(t,o))||n.enumerable});return e};var ge=(e,t,r)=>(r=e!=null?fj(dj(e)):{},kv(t||!e||!e.__esModule?Ho(r,"default",{value:e,enumerable:!0}):r,e)),Ed=e=>kv(Ho({},"__esModule",{value:!0}),e),le=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ov(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Ho(t,r,o),o};var Nv=(e,t,r)=>(hj(e,typeof t!="symbol"?t+"":t,r),r);var r0=g((Ine,t0)=>{var Jo=1e3,Zo=Jo*60,Yo=Zo*60,Gn=Yo*24,_j=Gn*7,Cj=Gn*365.25;t0.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Tj(e);if(r==="number"&&isFinite(e))return t.long?Aj(e):Oj(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Tj(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Cj;case"weeks":case"week":case"w":return r*_j;case"days":case"day":case"d":return r*Gn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Yo;case"minutes":case"minute":case"mins":case"min":case"m":return r*Zo;case"seconds":case"second":case"secs":case"sec":case"s":return r*Jo;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Oj(e){var t=Math.abs(e);return t>=Gn?Math.round(e/Gn)+"d":t>=Yo?Math.round(e/Yo)+"h":t>=Zo?Math.round(e/Zo)+"m":t>=Jo?Math.round(e/Jo)+"s":e+"ms"}function Aj(e){var t=Math.abs(e);return t>=Gn?Hu(e,t,Gn,"day"):t>=Yo?Hu(e,t,Yo,"hour"):t>=Zo?Hu(e,t,Zo,"minute"):t>=Jo?Hu(e,t,Jo,"second"):e+" ms"}function Hu(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var o0=g((_ne,n0)=>{function kj(e){r.debug=r,r.default=r,r.coerce=u,r.disable=i,r.enable=o,r.enabled=s,r.humanize=r0(),r.destroy=l,Object.keys(e).forEach(c=>{r[c]=e[c]}),r.names=[],r.skips=[],r.formatters={};function t(c){let f=0;for(let p=0;p<c.length;p++)f=(f<<5)-f+c.charCodeAt(p),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=t;function r(c){let f,p=null,d,h;function b(...y){if(!b.enabled)return;let v=b,w=Number(new Date),T=w-(f||w);v.diff=T,v.prev=f,v.curr=w,f=w,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let M=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(J,G)=>{if(J==="%%")return"%";M++;let K=r.formatters[G];if(typeof K=="function"){let P=y[M];J=K.call(v,P),y.splice(M,1),M--}return J}),r.formatArgs.call(v,y),(v.log||r.log).apply(v,y)}return b.namespace=c,b.useColors=r.useColors(),b.color=r.selectColor(c),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(d!==r.namespaces&&(d=r.namespaces,h=r.enabled(c)),h),set:y=>{p=y}}),typeof r.init=="function"&&r.init(b),b}function n(c,f){let p=r(this.namespace+(typeof f>"u"?":":f)+c);return p.log=this.log,p}function o(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let f,p=(typeof c=="string"?c:"").split(/[\s,]+/),d=p.length;for(f=0;f<d;f++)p[f]&&(c=p[f].replace(/\*/g,".*?"),c[0]==="-"?r.skips.push(new RegExp("^"+c.slice(1)+"$")):r.names.push(new RegExp("^"+c+"$")))}function i(){let c=[...r.names.map(a),...r.skips.map(a).map(f=>"-"+f)].join(",");return r.enable(""),c}function s(c){if(c[c.length-1]==="*")return!0;let f,p;for(f=0,p=r.skips.length;f<p;f++)if(r.skips[f].test(c))return!1;for(f=0,p=r.names.length;f<p;f++)if(r.names[f].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function u(c){return c instanceof Error?c.stack||c.message:c}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}n0.exports=kj});var Ue=g((At,Ku)=>{At.formatArgs=Rj;At.save=Dj;At.load=Pj;At.useColors=Nj;At.storage=Fj();At.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();At.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Nj(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Rj(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Ku.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}At.log=console.debug||console.log||(()=>{});function Dj(e){try{e?At.storage.setItem("debug",e):At.storage.removeItem("debug")}catch{}}function Pj(){let e;try{e=At.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Fj(){try{return localStorage}catch{}}Ku.exports=o0()(At);var{formatters:$j}=Ku.exports;$j.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var s0=g((Cne,i0)=>{"use strict";i0.exports=Mj;function Xo(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Mj(e){if(e=e||{},e.circles)return jj(e);return e.proto?n:r;function t(o,i){for(var s=Object.keys(o),a=new Array(s.length),u=0;u<s.length;u++){var l=s[u],c=o[l];typeof c!="object"||c===null?a[l]=c:c instanceof Date?a[l]=new Date(c):ArrayBuffer.isView(c)?a[l]=Xo(c):a[l]=i(c)}return a}function r(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,r);if(o instanceof Map)return new Map(t(Array.from(o),r));if(o instanceof Set)return new Set(t(Array.from(o),r));var i={};for(var s in o)if(Object.hasOwnProperty.call(o,s)!==!1){var a=o[s];typeof a!="object"||a===null?i[s]=a:a instanceof Date?i[s]=new Date(a):a instanceof Map?i[s]=new Map(t(Array.from(a),r)):a instanceof Set?i[s]=new Set(t(Array.from(a),r)):ArrayBuffer.isView(a)?i[s]=Xo(a):i[s]=r(a)}return i}function n(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,n);if(o instanceof Map)return new Map(t(Array.from(o),n));if(o instanceof Set)return new Set(t(Array.from(o),n));var i={};for(var s in o){var a=o[s];typeof a!="object"||a===null?i[s]=a:a instanceof Date?i[s]=new Date(a):a instanceof Map?i[s]=new Map(t(Array.from(a),n)):a instanceof Set?i[s]=new Set(t(Array.from(a),n)):ArrayBuffer.isView(a)?i[s]=Xo(a):i[s]=n(a)}return i}}function jj(e){var t=[],r=[];return e.proto?i:o;function n(s,a){for(var u=Object.keys(s),l=new Array(u.length),c=0;c<u.length;c++){var f=u[c],p=s[f];if(typeof p!="object"||p===null)l[f]=p;else if(p instanceof Date)l[f]=new Date(p);else if(ArrayBuffer.isView(p))l[f]=Xo(p);else{var d=t.indexOf(p);d!==-1?l[f]=r[d]:l[f]=a(p)}}return l}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,o);if(s instanceof Map)return new Map(n(Array.from(s),o));if(s instanceof Set)return new Set(n(Array.from(s),o));var a={};t.push(s),r.push(a);for(var u in s)if(Object.hasOwnProperty.call(s,u)!==!1){var l=s[u];if(typeof l!="object"||l===null)a[u]=l;else if(l instanceof Date)a[u]=new Date(l);else if(l instanceof Map)a[u]=new Map(n(Array.from(l),o));else if(l instanceof Set)a[u]=new Set(n(Array.from(l),o));else if(ArrayBuffer.isView(l))a[u]=Xo(l);else{var c=t.indexOf(l);c!==-1?a[u]=r[c]:a[u]=o(l)}}return t.pop(),r.pop(),a}function i(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,i);if(s instanceof Map)return new Map(n(Array.from(s),i));if(s instanceof Set)return new Set(n(Array.from(s),i));var a={};t.push(s),r.push(a);for(var u in s){var l=s[u];if(typeof l!="object"||l===null)a[u]=l;else if(l instanceof Date)a[u]=new Date(l);else if(l instanceof Map)a[u]=new Map(n(Array.from(l),i));else if(l instanceof Set)a[u]=new Set(n(Array.from(l),i));else if(ArrayBuffer.isView(l))a[u]=Xo(l);else{var c=t.indexOf(l);c!==-1?a[u]=r[c]:a[u]=i(l)}}return t.pop(),r.pop(),a}}});var Zn=g((Tne,l0)=>{var Lj=require("util"),Jn=Ue()("log4js:configuration"),Vu=[],Gu=[],a0=e=>!e,u0=e=>e&&typeof e=="object"&&!Array.isArray(e),qj=e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),Bj=e=>e&&typeof e=="number"&&Number.isInteger(e),zj=e=>{Gu.push(e),Jn(`Added listener, now ${Gu.length} listeners`)},Uj=e=>{Vu.push(e),Jn(`Added pre-processing listener, now ${Vu.length} listeners`)},c0=(e,t,r)=>{(Array.isArray(t)?t:[t]).forEach(o=>{if(o)throw new Error(`Problem with log4js configuration: (${Lj.inspect(e,{depth:5})}) - ${r}`)})},Wj=e=>{Jn("New configuration to be validated: ",e),c0(e,a0(u0(e)),"must be an object."),Jn(`Calling pre-processing listeners (${Vu.length})`),Vu.forEach(t=>t(e)),Jn("Configuration pre-processing finished."),Jn(`Calling configuration listeners (${Gu.length})`),Gu.forEach(t=>t(e)),Jn("Configuration finished.")};l0.exports={configure:Wj,addListener:zj,addPreProcessingListener:Uj,throwExceptionIf:c0,anObject:u0,anInteger:Bj,validIdentifier:qj,not:a0}});var Ju=g((One,zt)=>{"use strict";function f0(e,t){for(var r=e.toString();r.length<t;)r="0"+r;return r}function Yn(e){return f0(e,2)}function Hj(e){var t=Math.abs(e),r=String(Math.floor(t/60)),n=String(t%60);return r=("0"+r).slice(-2),n=("0"+n).slice(-2),e===0?"Z":(e<0?"+":"-")+r+":"+n}function p0(e,t){typeof e!="string"&&(t=e,e=zt.exports.ISO8601_FORMAT),t||(t=zt.exports.now());var r=Yn(t.getDate()),n=Yn(t.getMonth()+1),o=Yn(t.getFullYear()),i=Yn(o.substring(2,4)),s=e.indexOf("yyyy")>-1?o:i,a=Yn(t.getHours()),u=Yn(t.getMinutes()),l=Yn(t.getSeconds()),c=f0(t.getMilliseconds(),3),f=Hj(t.getTimezoneOffset()),p=e.replace(/dd/g,r).replace(/MM/g,n).replace(/y{1,4}/g,s).replace(/hh/g,a).replace(/mm/g,u).replace(/ss/g,l).replace(/SSS/g,c).replace(/O/g,f);return p}function dn(e,t,r,n){e["set"+(n?"":"UTC")+t](r)}function Kj(e,t,r){var n=e.indexOf("O")<0,o=!1,i=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(f,p){dn(f,"FullYear",p,n)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(f,p){dn(f,"Month",p-1,n),f.getMonth()!==p-1&&(o=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(f,p){o&&dn(f,"Month",f.getMonth()-1,n),dn(f,"Date",p,n)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(f,p){dn(f,"Hours",p,n)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(f,p){dn(f,"Minutes",p,n)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(f,p){dn(f,"Seconds",p,n)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(f,p){dn(f,"Milliseconds",p,n)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(f,p){p==="Z"?p=0:p=p.replace(":","");var d=Math.abs(p),h=(p>0?-1:1)*(d%100+Math.floor(d/100)*60);f.setUTCMinutes(f.getUTCMinutes()+h)}}],s=i.reduce(function(f,p){return p.pattern.test(f.regexp)?(p.index=f.regexp.match(p.pattern).index,f.regexp=f.regexp.replace(p.pattern,"("+p.regexp+")")):p.index=-1,f},{regexp:e,index:[]}),a=i.filter(function(f){return f.index>-1});a.sort(function(f,p){return f.index-p.index});var u=new RegExp(s.regexp),l=u.exec(t);if(l){var c=r||zt.exports.now();return a.forEach(function(f,p){f.fn(c,l[p+1])}),c}throw new Error("String '"+t+"' could not be parsed as '"+e+"'")}function Vj(e,t,r){if(!e)throw new Error("pattern must be supplied");return Kj(e,t,r)}function Gj(){return new Date}zt.exports=p0;zt.exports.asString=p0;zt.exports.parse=Vj;zt.exports.now=Gj;zt.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS";zt.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO";zt.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS";zt.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"});var $d=g((Ane,I0)=>{var mn=Ju(),d0=require("os"),gs=require("util"),hs=require("path"),m0=require("url"),h0=Ue()("log4js:layouts"),g0={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function y0(e){return e?`\x1B[${g0[e][0]}m`:""}function b0(e){return e?`\x1B[${g0[e][1]}m`:""}function Jj(e,t){return y0(t)+e+b0(t)}function v0(e,t){return Jj(gs.format("[%s] [%s] %s - ",mn.asString(e.startTime),e.level.toString(),e.categoryName),t)}function x0(e){return v0(e)+gs.format(...e.data)}function Zu(e){return v0(e,e.level.colour)+gs.format(...e.data)}function w0(e){return gs.format(...e.data)}function E0(e){return e.data[0]}function S0(e,t){let r="%r %p %c - %m%n",n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;e=e||r;function o(C,_){let I=C.categoryName;if(_){let B=parseInt(_,10),D=I.split(".");B<D.length&&(I=D.slice(D.length-B).join("."))}return I}function i(C,_){let I=mn.ISO8601_FORMAT;if(_)switch(I=_,I){case"ISO8601":case"ISO8601_FORMAT":I=mn.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":I=mn.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),h0("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":I=mn.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),h0("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":I=mn.DATETIME_FORMAT;break}return mn.asString(I,C.startTime)}function s(){return d0.hostname().toString()}function a(C){return gs.format(...C.data)}function u(){return d0.EOL}function l(C){return C.level.toString()}function c(C){return mn.asString("hh:mm:ss",C.startTime)}function f(C){return y0(C.level.colour)}function p(C){return b0(C.level.colour)}function d(){return"%"}function h(C){return C&&C.pid?C.pid.toString():process.pid.toString()}function b(){return h()}function y(C,_){return typeof t[_]<"u"?typeof t[_]=="function"?t[_](C):t[_]:null}function v(C,_){let I=C.context[_];return typeof I<"u"?typeof I=="function"?I(C):I:null}function w(C,_){let I=C.fileName||"";if(I=function(D){let re="file://";return D.startsWith(re)&&(typeof m0.fileURLToPath=="function"?D=m0.fileURLToPath(D):(D=hs.normalize(D.replace(new RegExp(`^${re}`),"")),process.platform==="win32"&&(D.startsWith("\\")?D=D.slice(1):D=hs.sep+hs.sep+D))),D}(I),_){let D=parseInt(_,10),re=I.split(hs.sep);re.length>D&&(I=re.slice(-D).join(hs.sep))}return I}function T(C){return C.lineNumber?`${C.lineNumber}`:""}function M(C){return C.columnNumber?`${C.columnNumber}`:""}function V(C){return C.callStack||""}let J={c:o,d:i,h:s,m:a,n:u,p:l,r:c,"[":f,"]":p,y:b,z:h,"%":d,x:y,X:v,f:w,l:T,o:M,s:V};function G(C,_,I){return J[C](_,I)}function K(C,_){let I;return C?(I=parseInt(C.slice(1),10),I>0?_.slice(0,I):_.slice(I)):_}function P(C,_){let I;if(C)if(C.charAt(0)==="-")for(I=parseInt(C.slice(1),10);_.length<I;)_+=" ";else for(I=parseInt(C,10);_.length<I;)_=` ${_}`;return _}function X(C,_,I){let B=C;return B=K(_,B),B=P(I,B),B}return function(C){let _="",I,B=e;for(;(I=n.exec(B))!==null;){let D=I[1],re=I[2],oe=I[3],me=I[5],ae=I[6];if(ae)_+=ae.toString();else{let E=G(oe,C,me);_+=X(E,re,D)}B=B.slice(I.index+I[0].length)}return _}}var Fd={messagePassThrough(){return w0},basic(){return x0},colored(){return Zu},coloured(){return Zu},pattern(e){return S0(e&&e.pattern,e&&e.tokens)},dummy(){return E0}};I0.exports={basicLayout:x0,messagePassThroughLayout:w0,patternLayout:S0,colouredLayout:Zu,coloredLayout:Zu,dummyLayout:E0,addLayout(e,t){Fd[e]=t},layout(e,t){return Fd[e]&&Fd[e](t)}}});var Xn=g((kne,C0)=>{var $e=Zn(),_0=["white","grey","black","blue","cyan","green","magenta","red","yellow"],Me=class{constructor(t,r,n){this.level=t,this.levelStr=r,this.colour=n}toString(){return this.levelStr}static getLevel(t,r){return t?t instanceof Me?t:(t instanceof Object&&t.levelStr&&(t=t.levelStr),Me[t.toString().toUpperCase()]||r):r}static addLevels(t){t&&(Object.keys(t).forEach(n=>{let o=n.toUpperCase();Me[o]=new Me(t[n].value,o,t[n].colour);let i=Me.levels.findIndex(s=>s.levelStr===o);i>-1?Me.levels[i]=Me[o]:Me.levels.push(Me[o])}),Me.levels.sort((n,o)=>n.level-o.level))}isLessThanOrEqualTo(t){return typeof t=="string"&&(t=Me.getLevel(t)),this.level<=t.level}isGreaterThanOrEqualTo(t){return typeof t=="string"&&(t=Me.getLevel(t)),this.level>=t.level}isEqualTo(t){return typeof t=="string"&&(t=Me.getLevel(t)),this.level===t.level}};Me.levels=[];Me.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}});$e.addListener(e=>{let t=e.levels;t&&($e.throwExceptionIf(e,$e.not($e.anObject(t)),"levels must be an object"),Object.keys(t).forEach(n=>{$e.throwExceptionIf(e,$e.not($e.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),$e.throwExceptionIf(e,$e.not($e.anObject(t[n])),`level "${n}" must be an object`),$e.throwExceptionIf(e,$e.not(t[n].value),`level "${n}" must have a 'value' property`),$e.throwExceptionIf(e,$e.not($e.anInteger(t[n].value)),`level "${n}".value must have an integer value`),$e.throwExceptionIf(e,$e.not(t[n].colour),`level "${n}" must have a 'colour' property`),$e.throwExceptionIf(e,$e.not(_0.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${_0.join(", ")}`)}))});$e.addListener(e=>{Me.addLevels(e.levels)});C0.exports=Me});var $0=g(bs=>{"use strict";var{parse:A0,stringify:k0}=JSON,{keys:Zj}=Object,ys=String,N0="string",T0={},Yu="object",R0=(e,t)=>t,Yj=e=>e instanceof ys?ys(e):e,Xj=(e,t)=>typeof t===N0?new ys(t):t,D0=(e,t,r,n)=>{let o=[];for(let i=Zj(r),{length:s}=i,a=0;a<s;a++){let u=i[a],l=r[u];if(l instanceof ys){let c=e[l];typeof c===Yu&&!t.has(c)?(t.add(c),r[u]=T0,o.push({k:u,a:[e,t,c,n]})):r[u]=n.call(r,u,c)}else r[u]!==T0&&(r[u]=n.call(r,u,l))}for(let{length:i}=o,s=0;s<i;s++){let{k:a,a:u}=o[s];r[a]=n.call(r,a,D0.apply(null,u))}return r},O0=(e,t,r)=>{let n=ys(t.push(r)-1);return e.set(r,n),n},P0=(e,t)=>{let r=A0(e,Xj).map(Yj),n=r[0],o=t||R0,i=typeof n===Yu&&n?D0(r,new Set,n,o):n;return o.call({"":i},"",i)};bs.parse=P0;var F0=(e,t,r)=>{let n=t&&typeof t===Yu?(c,f)=>c===""||-1<t.indexOf(c)?f:void 0:t||R0,o=new Map,i=[],s=[],a=+O0(o,i,n.call({"":e},"",e)),u=!a;for(;a<i.length;)u=!0,s[a]=k0(i[a++],l,r);return"["+s.join(",")+"]";function l(c,f){if(u)return u=!u,f;let p=n.call(this,c,f);switch(typeof p){case Yu:if(p===null)return p;case N0:return o.get(p)||O0(o,i,p)}return p}};bs.stringify=F0;var Qj=e=>A0(F0(e));bs.toJSON=Qj;var e3=e=>P0(k0(e));bs.fromJSON=e3});var Md=g((Rne,L0)=>{var M0=$0(),j0=Xn(),Qo=class{constructor(t,r,n,o,i){this.startTime=new Date,this.categoryName=t,this.data=n,this.level=r,this.context=Object.assign({},o),this.pid=process.pid,i&&(this.functionName=i.functionName,this.fileName=i.fileName,this.lineNumber=i.lineNumber,this.columnNumber=i.columnNumber,this.callStack=i.callStack)}serialise(){return M0.stringify(this,(t,r)=>(r&&r.message&&r.stack?r=Object.assign({message:r.message,stack:r.stack},r):typeof r=="number"&&(Number.isNaN(r)||!Number.isFinite(r))?r=r.toString():typeof r>"u"&&(r=typeof r),r))}static deserialise(t){let r;try{let n=M0.parse(t,(o,i)=>{if(i&&i.message&&i.stack){let s=new Error(i);Object.keys(i).forEach(a=>{s[a]=i[a]}),i=s}return i});n.location={functionName:n.functionName,fileName:n.fileName,lineNumber:n.lineNumber,columnNumber:n.columnNumber,callStack:n.callStack},r=new Qo(n.categoryName,j0.getLevel(n.level.levelStr),n.data,n.context,n.location),r.startTime=new Date(n.startTime),r.pid=n.pid,r.cluster=n.cluster}catch(n){r=new Qo("log4js",j0.ERROR,["Unable to parse log:",t,"because: ",n])}return r}};L0.exports=Qo});var Qu=g((Dne,z0)=>{var Ut=Ue()("log4js:clustering"),t3=Md(),r3=Zn(),ei=!1,Wt=null;try{Wt=require("cluster")}catch{Ut("cluster module not present"),ei=!0}var Ld=[],xs=!1,vs="NODE_APP_INSTANCE",q0=()=>xs&&process.env[vs]==="0",jd=()=>ei||Wt&&Wt.isMaster||q0(),B0=e=>{Ld.forEach(t=>t(e))},Xu=(e,t)=>{if(Ut("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&t.topic==="log4js:message"){Ut("received message: ",t.data);let r=t3.deserialise(t.data);B0(r)}};ei||r3.addListener(e=>{Ld.length=0,{pm2:xs,disableClustering:ei,pm2InstanceVar:vs="NODE_APP_INSTANCE"}=e,Ut(`clustering disabled ? ${ei}`),Ut(`cluster.isMaster ? ${Wt&&Wt.isMaster}`),Ut(`pm2 enabled ? ${xs}`),Ut(`pm2InstanceVar = ${vs}`),Ut(`process.env[${vs}] = ${process.env[vs]}`),xs&&process.removeListener("message",Xu),Wt&&Wt.removeListener&&Wt.removeListener("message",Xu),ei||e.disableClustering?Ut("Not listening for cluster messages, because clustering disabled."):q0()?(Ut("listening for PM2 broadcast messages"),process.on("message",Xu)):Wt&&Wt.isMaster?(Ut("listening for cluster messages"),Wt.on("message",Xu)):Ut("not listening for messages, because we are not a master process")});z0.exports={onlyOnMaster:(e,t)=>jd()?e():t,isMaster:jd,send:e=>{jd()?B0(e):(xs||(e.cluster={workerId:Wt.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{Ld.push(e)}}});var H0=g((Pne,W0)=>{function n3(e){if(typeof e=="number"&&Number.isInteger(e))return e;let t={K:1024,M:1024*1024,G:1024*1024*1024},r=Object.keys(t),n=e.slice(-1).toLocaleUpperCase(),o=e.slice(0,-1).trim();if(r.indexOf(n)<0||!Number.isInteger(Number(o)))throw Error(`maxLogSize: "${e}" is invalid`);return o*t[n]}function o3(e,t){let r=Object.assign({},t);return Object.keys(e).forEach(n=>{r[n]&&(r[n]=e[n](t[n]))}),r}function qd(e){return o3({maxLogSize:n3},e)}var U0={dateFile:qd,file:qd,fileSync:qd};W0.exports.modifyConfig=e=>U0[e.type]?U0[e.type](e):e});var V0=g((Fne,K0)=>{var i3=console.log.bind(console);function s3(e,t){return r=>{i3(e(r,t))}}function a3(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),s3(r,e.timezoneOffset)}K0.exports.configure=a3});var J0=g(G0=>{function u3(e,t){return r=>{process.stdout.write(`${e(r,t)}
`)}}function c3(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),u3(r,e.timezoneOffset)}G0.configure=c3});var Y0=g((Mne,Z0)=>{function l3(e,t){return r=>{process.stderr.write(`${e(r,t)}
`)}}function f3(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),l3(r,e.timezoneOffset)}Z0.exports.configure=f3});var Q0=g((jne,X0)=>{function p3(e,t,r,n){let o=n.getLevel(e),i=n.getLevel(t,n.FATAL);return s=>{let a=s.level;o.isLessThanOrEqualTo(a)&&i.isGreaterThanOrEqualTo(a)&&r(s)}}function d3(e,t,r,n){let o=r(e.appender);return p3(e.level,e.maxLevel,o,n)}X0.exports.configure=d3});var rx=g((Lne,tx)=>{var ex=Ue()("log4js:categoryFilter");function m3(e,t){return typeof e=="string"&&(e=[e]),r=>{ex(`Checking ${r.categoryName} against ${e}`),e.indexOf(r.categoryName)===-1&&(ex("Not excluded, sending to appender"),t(r))}}function h3(e,t,r){let n=r(e.appender);return m3(e.exclude,n)}tx.exports.configure=h3});var ix=g((qne,ox)=>{var nx=Ue()("log4js:noLogFilter");function g3(e){return e.filter(r=>r!=null&&r!=="")}function y3(e,t){return r=>{nx(`Checking data: ${r.data} against filters: ${e}`),typeof e=="string"&&(e=[e]),e=g3(e);let n=new RegExp(e.join("|"),"i");(e.length===0||r.data.findIndex(o=>n.test(o))<0)&&(nx("Not excluded, sending to appender"),t(r))}}function b3(e,t,r){let n=r(e.appender);return y3(e.exclude,n)}ox.exports.configure=b3});var gt=g(Bd=>{"use strict";Bd.fromCallback=function(e){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")e.apply(this,arguments);else return new Promise((t,r)=>{arguments[arguments.length]=(n,o)=>{if(n)return r(n);t(o)},arguments.length++,e.apply(this,arguments)})},"name",{value:e.name})};Bd.fromPromise=function(e){return Object.defineProperty(function(){let t=arguments[arguments.length-1];if(typeof t!="function")return e.apply(this,arguments);e.apply(this,arguments).then(r=>t(null,r),t)},"name",{value:e.name})}});var ax=g((zne,sx)=>{var hn=require("constants"),v3=process.cwd,ec=null,x3=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ec||(ec=v3.call(process)),ec};try{process.cwd()}catch{}typeof process.chdir=="function"&&(zd=process.chdir,process.chdir=function(e){ec=null,zd.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,zd));var zd;sx.exports=w3;function w3(e){hn.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=i(e.chown),e.fchown=i(e.fchown),e.lchown=i(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=o(e.chmodSync),e.fchmodSync=o(e.fchmodSync),e.lchmodSync=o(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(c,f,p){p&&process.nextTick(p)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(c,f,p,d){d&&process.nextTick(d)},e.lchownSync=function(){}),x3==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(c){function f(p,d,h){var b=Date.now(),y=0;c(p,d,function v(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){e.stat(d,function(T,M){T&&T.code==="ENOENT"?c(p,d,v):h(w)})},y),y<100&&(y+=10);return}h&&h(w)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,c),f}(e.rename)),e.read=typeof e.read!="function"?e.read:function(c){function f(p,d,h,b,y,v){var w;if(v&&typeof v=="function"){var T=0;w=function(M,V,J){if(M&&M.code==="EAGAIN"&&T<10)return T++,c.call(e,p,d,h,b,y,w);v.apply(this,arguments)}}return c.call(e,p,d,h,b,y,w)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,c),f}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(c){return function(f,p,d,h,b){for(var y=0;;)try{return c.call(e,f,p,d,h,b)}catch(v){if(v.code==="EAGAIN"&&y<10){y++;continue}throw v}}}(e.readSync);function t(c){c.lchmod=function(f,p,d){c.open(f,hn.O_WRONLY|hn.O_SYMLINK,p,function(h,b){if(h){d&&d(h);return}c.fchmod(b,p,function(y){c.close(b,function(v){d&&d(y||v)})})})},c.lchmodSync=function(f,p){var d=c.openSync(f,hn.O_WRONLY|hn.O_SYMLINK,p),h=!0,b;try{b=c.fchmodSync(d,p),h=!1}finally{if(h)try{c.closeSync(d)}catch{}else c.closeSync(d)}return b}}function r(c){hn.hasOwnProperty("O_SYMLINK")&&c.futimes?(c.lutimes=function(f,p,d,h){c.open(f,hn.O_SYMLINK,function(b,y){if(b){h&&h(b);return}c.futimes(y,p,d,function(v){c.close(y,function(w){h&&h(v||w)})})})},c.lutimesSync=function(f,p,d){var h=c.openSync(f,hn.O_SYMLINK),b,y=!0;try{b=c.futimesSync(h,p,d),y=!1}finally{if(y)try{c.closeSync(h)}catch{}else c.closeSync(h)}return b}):c.futimes&&(c.lutimes=function(f,p,d,h){h&&process.nextTick(h)},c.lutimesSync=function(){})}function n(c){return c&&function(f,p,d){return c.call(e,f,p,function(h){l(h)&&(h=null),d&&d.apply(this,arguments)})}}function o(c){return c&&function(f,p){try{return c.call(e,f,p)}catch(d){if(!l(d))throw d}}}function i(c){return c&&function(f,p,d,h){return c.call(e,f,p,d,function(b){l(b)&&(b=null),h&&h.apply(this,arguments)})}}function s(c){return c&&function(f,p,d){try{return c.call(e,f,p,d)}catch(h){if(!l(h))throw h}}}function a(c){return c&&function(f,p,d){typeof p=="function"&&(d=p,p=null);function h(b,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),d&&d.apply(this,arguments)}return p?c.call(e,f,p,h):c.call(e,f,h)}}function u(c){return c&&function(f,p){var d=p?c.call(e,f,p):c.call(e,f);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function l(c){if(!c||c.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(c.code==="EINVAL"||c.code==="EPERM"))}}});var lx=g((Une,cx)=>{var ux=require("stream").Stream;cx.exports=E3;function E3(e){return{ReadStream:t,WriteStream:r};function t(n,o){if(!(this instanceof t))return new t(n,o);ux.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var s=Object.keys(o),a=0,u=s.length;a<u;a++){var l=s[a];this[l]=o[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}e.open(this.path,this.flags,this.mode,function(c,f){if(c){i.emit("error",c),i.readable=!1;return}i.fd=f,i.emit("open",f),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);ux.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),s=0,a=i.length;s<a;s++){var u=i[s];this[u]=o[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var px=g((Wne,fx)=>{"use strict";fx.exports=I3;var S3=Object.getPrototypeOf||function(e){return e.__proto__};function I3(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:S3(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var je=g((Hne,Hd)=>{var Ce=require("fs"),_3=ax(),C3=lx(),T3=px(),tc=require("util"),Ye,nc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ye=Symbol.for("graceful-fs.queue"),nc=Symbol.for("graceful-fs.previous")):(Ye="___graceful-fs.queue",nc="___graceful-fs.previous");function O3(){}function hx(e,t){Object.defineProperty(e,Ye,{get:function(){return t}})}var Qn=O3;tc.debuglog?Qn=tc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Qn=function(){var e=tc.format.apply(tc,arguments);e="GFS4: "+e.split(/\n/).join(`
GFS4: `),console.error(e)});Ce[Ye]||(dx=global[Ye]||[],hx(Ce,dx),Ce.close=function(e){function t(r,n){return e.call(Ce,r,function(o){o||mx(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,nc,{value:e}),t}(Ce.close),Ce.closeSync=function(e){function t(r){e.apply(Ce,arguments),mx()}return Object.defineProperty(t,nc,{value:e}),t}(Ce.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Qn(Ce[Ye]),require("assert").equal(Ce[Ye].length,0)}));var dx;global[Ye]||hx(global,Ce[Ye]);Hd.exports=Ud(T3(Ce));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ce.__patched&&(Hd.exports=Ud(Ce),Ce.__patched=!0);function Ud(e){_3(e),e.gracefulify=Ud,e.createReadStream=V,e.createWriteStream=J;var t=e.readFile;e.readFile=r;function r(P,X,C){return typeof X=="function"&&(C=X,X=null),_(P,X,C);function _(I,B,D,re){return t(I,B,function(oe){oe&&(oe.code==="EMFILE"||oe.code==="ENFILE")?ti([_,[I,B,D],oe,re||Date.now(),Date.now()]):typeof D=="function"&&D.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=o;function o(P,X,C,_){return typeof C=="function"&&(_=C,C=null),I(P,X,C,_);function I(B,D,re,oe,me){return n(B,D,re,function(ae){ae&&(ae.code==="EMFILE"||ae.code==="ENFILE")?ti([I,[B,D,re,oe],ae,me||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}}var i=e.appendFile;i&&(e.appendFile=s);function s(P,X,C,_){return typeof C=="function"&&(_=C,C=null),I(P,X,C,_);function I(B,D,re,oe,me){return i(B,D,re,function(ae){ae&&(ae.code==="EMFILE"||ae.code==="ENFILE")?ti([I,[B,D,re,oe],ae,me||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=u);function u(P,X,C,_){return typeof C=="function"&&(_=C,C=0),I(P,X,C,_);function I(B,D,re,oe,me){return a(B,D,re,function(ae){ae&&(ae.code==="EMFILE"||ae.code==="ENFILE")?ti([I,[B,D,re,oe],ae,me||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}}var l=e.readdir;e.readdir=f;var c=/^v[0-5]\./;function f(P,X,C){typeof X=="function"&&(C=X,X=null);var _=c.test(process.version)?function(D,re,oe,me){return l(D,I(D,re,oe,me))}:function(D,re,oe,me){return l(D,re,I(D,re,oe,me))};return _(P,X,C);function I(B,D,re,oe){return function(me,ae){me&&(me.code==="EMFILE"||me.code==="ENFILE")?ti([_,[B,D,re],me,oe||Date.now(),Date.now()]):(ae&&ae.sort&&ae.sort(),typeof re=="function"&&re.call(this,me,ae))}}}if(process.version.substr(0,4)==="v0.8"){var p=C3(e);v=p.ReadStream,T=p.WriteStream}var d=e.ReadStream;d&&(v.prototype=Object.create(d.prototype),v.prototype.open=w);var h=e.WriteStream;h&&(T.prototype=Object.create(h.prototype),T.prototype.open=M),Object.defineProperty(e,"ReadStream",{get:function(){return v},set:function(P){v=P},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return T},set:function(P){T=P},enumerable:!0,configurable:!0});var b=v;Object.defineProperty(e,"FileReadStream",{get:function(){return b},set:function(P){b=P},enumerable:!0,configurable:!0});var y=T;Object.defineProperty(e,"FileWriteStream",{get:function(){return y},set:function(P){y=P},enumerable:!0,configurable:!0});function v(P,X){return this instanceof v?(d.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function w(){var P=this;K(P.path,P.flags,P.mode,function(X,C){X?(P.autoClose&&P.destroy(),P.emit("error",X)):(P.fd=C,P.emit("open",C),P.read())})}function T(P,X){return this instanceof T?(h.apply(this,arguments),this):T.apply(Object.create(T.prototype),arguments)}function M(){var P=this;K(P.path,P.flags,P.mode,function(X,C){X?(P.destroy(),P.emit("error",X)):(P.fd=C,P.emit("open",C))})}function V(P,X){return new e.ReadStream(P,X)}function J(P,X){return new e.WriteStream(P,X)}var G=e.open;e.open=K;function K(P,X,C,_){return typeof C=="function"&&(_=C,C=null),I(P,X,C,_);function I(B,D,re,oe,me){return G(B,D,re,function(ae,E){ae&&(ae.code==="EMFILE"||ae.code==="ENFILE")?ti([I,[B,D,re,oe],ae,me||Date.now(),Date.now()]):typeof oe=="function"&&oe.apply(this,arguments)})}}return e}function ti(e){Qn("ENQUEUE",e[0].name,e[1]),Ce[Ye].push(e),Wd()}var rc;function mx(){for(var e=Date.now(),t=0;t<Ce[Ye].length;++t)Ce[Ye][t].length>2&&(Ce[Ye][t][3]=e,Ce[Ye][t][4]=e);Wd()}function Wd(){if(clearTimeout(rc),rc=void 0,Ce[Ye].length!==0){var e=Ce[Ye].shift(),t=e[0],r=e[1],n=e[2],o=e[3],i=e[4];if(o===void 0)Qn("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-o>=6e4){Qn("TIMEOUT",t.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-i,u=Math.max(i-o,1),l=Math.min(u*1.2,100);a>=l?(Qn("RETRY",t.name,r),t.apply(null,r.concat([o]))):Ce[Ye].push(e)}rc===void 0&&(rc=setTimeout(Wd,0))}}});var Kd=g(eo=>{"use strict";var gx=gt().fromCallback,Ht=je(),A3=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(e=>typeof Ht[e]=="function");Object.keys(Ht).forEach(e=>{e!=="promises"&&(eo[e]=Ht[e])});A3.forEach(e=>{eo[e]=gx(Ht[e])});eo.exists=function(e,t){return typeof t=="function"?Ht.exists(e,t):new Promise(r=>Ht.exists(e,r))};eo.read=function(e,t,r,n,o,i){return typeof i=="function"?Ht.read(e,t,r,n,o,i):new Promise((s,a)=>{Ht.read(e,t,r,n,o,(u,l,c)=>{if(u)return a(u);s({bytesRead:l,buffer:c})})})};eo.write=function(e,t,...r){return typeof r[r.length-1]=="function"?Ht.write(e,t,...r):new Promise((n,o)=>{Ht.write(e,t,...r,(i,s,a)=>{if(i)return o(i);n({bytesWritten:s,buffer:a})})})};typeof Ht.realpath.native=="function"&&(eo.realpath.native=gx(Ht.realpath.native))});var Gd=g((Vne,bx)=>{"use strict";var Vd=require("path");function yx(e){return e=Vd.normalize(Vd.resolve(e)).split(Vd.sep),e.length>0?e[0]:null}var k3=/[<>:"|?*]/;function N3(e){let t=yx(e);return e=e.replace(t,""),k3.test(e)}bx.exports={getRootPath:yx,invalidWin32Path:N3}});var xx=g((Gne,vx)=>{"use strict";var R3=je(),Jd=require("path"),D3=Gd().invalidWin32Path,P3=parseInt("0777",8);function Zd(e,t,r,n){if(typeof t=="function"?(r=t,t={}):(!t||typeof t!="object")&&(t={mode:t}),process.platform==="win32"&&D3(e)){let s=new Error(e+" contains invalid WIN32 path characters.");return s.code="EINVAL",r(s)}let o=t.mode,i=t.fs||R3;o===void 0&&(o=P3&~process.umask()),n||(n=null),r=r||function(){},e=Jd.resolve(e),i.mkdir(e,o,s=>{if(!s)return n=n||e,r(null,n);switch(s.code){case"ENOENT":if(Jd.dirname(e)===e)return r(s);Zd(Jd.dirname(e),t,(a,u)=>{a?r(a,u):Zd(e,t,r,u)});break;default:i.stat(e,(a,u)=>{a||!u.isDirectory()?r(s,n):r(null,n)});break}})}vx.exports=Zd});var Ex=g((Jne,wx)=>{"use strict";var F3=je(),Yd=require("path"),$3=Gd().invalidWin32Path,M3=parseInt("0777",8);function Xd(e,t,r){(!t||typeof t!="object")&&(t={mode:t});let n=t.mode,o=t.fs||F3;if(process.platform==="win32"&&$3(e)){let i=new Error(e+" contains invalid WIN32 path characters.");throw i.code="EINVAL",i}n===void 0&&(n=M3&~process.umask()),r||(r=null),e=Yd.resolve(e);try{o.mkdirSync(e,n),r=r||e}catch(i){if(i.code==="ENOENT"){if(Yd.dirname(e)===e)throw i;r=Xd(Yd.dirname(e),t,r),Xd(e,t,r)}else{let s;try{s=o.statSync(e)}catch{throw i}if(!s.isDirectory())throw i}}return r}wx.exports=Xd});var kt=g((Zne,Sx)=>{"use strict";var j3=gt().fromCallback,Qd=j3(xx()),em=Ex();Sx.exports={mkdirs:Qd,mkdirsSync:em,mkdirp:Qd,mkdirpSync:em,ensureDir:Qd,ensureDirSync:em}});var tm=g((Yne,_x)=>{"use strict";var nt=je(),Ix=require("os"),oc=require("path");function L3(){let e=oc.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));e=oc.join(Ix.tmpdir(),e);let t=new Date(1435410243862);nt.writeFileSync(e,"https://github.com/jprichardson/node-fs-extra/pull/141");let r=nt.openSync(e,"r+");return nt.futimesSync(r,t,t),nt.closeSync(r),nt.statSync(e).mtime>1435410243e3}function q3(e){let t=oc.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));t=oc.join(Ix.tmpdir(),t);let r=new Date(1435410243862);nt.writeFile(t,"https://github.com/jprichardson/node-fs-extra/pull/141",n=>{if(n)return e(n);nt.open(t,"r+",(o,i)=>{if(o)return e(o);nt.futimes(i,r,r,s=>{if(s)return e(s);nt.close(i,a=>{if(a)return e(a);nt.stat(t,(u,l)=>{if(u)return e(u);e(null,l.mtime>1435410243e3)})})})})})}function B3(e){if(typeof e=="number")return Math.floor(e/1e3)*1e3;if(e instanceof Date)return new Date(Math.floor(e.getTime()/1e3)*1e3);throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")}function z3(e,t,r,n){nt.open(e,"r+",(o,i)=>{if(o)return n(o);nt.futimes(i,t,r,s=>{nt.close(i,a=>{n&&n(s||a)})})})}function U3(e,t,r){let n=nt.openSync(e,"r+");return nt.futimesSync(n,t,r),nt.closeSync(n)}_x.exports={hasMillisRes:q3,hasMillisResSync:L3,timeRemoveMillis:B3,utimesMillis:z3,utimesMillisSync:U3}});var Ss=g((Xne,Nx)=>{"use strict";var Kt=je(),yt=require("path"),Cx=10,Tx=5,W3=0,nm=process.versions.node.split("."),Ox=Number.parseInt(nm[0],10),Ax=Number.parseInt(nm[1],10),H3=Number.parseInt(nm[2],10);function ws(){if(Ox>Cx)return!0;if(Ox===Cx){if(Ax>Tx)return!0;if(Ax===Tx&&H3>=W3)return!0}return!1}function K3(e,t,r){ws()?Kt.stat(e,{bigint:!0},(n,o)=>{if(n)return r(n);Kt.stat(t,{bigint:!0},(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))}):Kt.stat(e,(n,o)=>{if(n)return r(n);Kt.stat(t,(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))})}function V3(e,t){let r,n;ws()?r=Kt.statSync(e,{bigint:!0}):r=Kt.statSync(e);try{ws()?n=Kt.statSync(t,{bigint:!0}):n=Kt.statSync(t)}catch(o){if(o.code==="ENOENT")return{srcStat:r,destStat:null};throw o}return{srcStat:r,destStat:n}}function G3(e,t,r,n){K3(e,t,(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;return a&&a.ino&&a.dev&&a.ino===s.ino&&a.dev===s.dev?n(new Error("Source and destination must not be the same.")):s.isDirectory()&&om(e,t)?n(new Error(Es(e,t,r))):n(null,{srcStat:s,destStat:a})})}function J3(e,t,r){let{srcStat:n,destStat:o}=V3(e,t);if(o&&o.ino&&o.dev&&o.ino===n.ino&&o.dev===n.dev)throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&om(e,t))throw new Error(Es(e,t,r));return{srcStat:n,destStat:o}}function rm(e,t,r,n,o){let i=yt.resolve(yt.dirname(e)),s=yt.resolve(yt.dirname(r));if(s===i||s===yt.parse(s).root)return o();ws()?Kt.stat(s,{bigint:!0},(a,u)=>a?a.code==="ENOENT"?o():o(a):u.ino&&u.dev&&u.ino===t.ino&&u.dev===t.dev?o(new Error(Es(e,r,n))):rm(e,t,s,n,o)):Kt.stat(s,(a,u)=>a?a.code==="ENOENT"?o():o(a):u.ino&&u.dev&&u.ino===t.ino&&u.dev===t.dev?o(new Error(Es(e,r,n))):rm(e,t,s,n,o))}function kx(e,t,r,n){let o=yt.resolve(yt.dirname(e)),i=yt.resolve(yt.dirname(r));if(i===o||i===yt.parse(i).root)return;let s;try{ws()?s=Kt.statSync(i,{bigint:!0}):s=Kt.statSync(i)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.ino&&s.dev&&s.ino===t.ino&&s.dev===t.dev)throw new Error(Es(e,r,n));return kx(e,t,i,n)}function om(e,t){let r=yt.resolve(e).split(yt.sep).filter(o=>o),n=yt.resolve(t).split(yt.sep).filter(o=>o);return r.reduce((o,i,s)=>o&&n[s]===i,!0)}function Es(e,t,r){return`Cannot ${r} '${e}' to a subdirectory of itself, '${t}'.`}Nx.exports={checkPaths:G3,checkPathsSync:J3,checkParentPaths:rm,checkParentPathsSync:kx,isSrcSubdir:om}});var Dx=g((Qne,Rx)=>{"use strict";Rx.exports=function(e){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(e)}catch{return new Buffer(e)}return new Buffer(e)}});var jx=g((eoe,Mx)=>{"use strict";var Ie=je(),Is=require("path"),Z3=kt().mkdirsSync,Y3=tm().utimesMillisSync,_s=Ss();function X3(e,t,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:o}=_s.checkPathsSync(e,t,"copy");return _s.checkParentPathsSync(e,n,t,"copy"),Q3(o,e,t,r)}function Q3(e,t,r,n){if(n.filter&&!n.filter(t,r))return;let o=Is.dirname(r);return Ie.existsSync(o)||Z3(o),Px(e,t,r,n)}function Px(e,t,r,n){if(!(n.filter&&!n.filter(t,r)))return e5(e,t,r,n)}function e5(e,t,r,n){let i=(n.dereference?Ie.statSync:Ie.lstatSync)(t);if(i.isDirectory())return o5(i,e,t,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return t5(i,e,t,r,n);if(i.isSymbolicLink())return a5(e,t,r,n)}function t5(e,t,r,n,o){return t?r5(e,r,n,o):Fx(e,r,n,o)}function r5(e,t,r,n){if(n.overwrite)return Ie.unlinkSync(r),Fx(e,t,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function Fx(e,t,r,n){return typeof Ie.copyFileSync=="function"?(Ie.copyFileSync(t,r),Ie.chmodSync(r,e.mode),n.preserveTimestamps?Y3(r,e.atime,e.mtime):void 0):n5(e,t,r,n)}function n5(e,t,r,n){let i=Dx()(65536),s=Ie.openSync(t,"r"),a=Ie.openSync(r,"w",e.mode),u=0;for(;u<e.size;){let l=Ie.readSync(s,i,0,65536,u);Ie.writeSync(a,i,0,l),u+=l}n.preserveTimestamps&&Ie.futimesSync(a,e.atime,e.mtime),Ie.closeSync(s),Ie.closeSync(a)}function o5(e,t,r,n,o){if(!t)return i5(e,r,n,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return $x(r,n,o)}function i5(e,t,r,n){return Ie.mkdirSync(r),$x(t,r,n),Ie.chmodSync(r,e.mode)}function $x(e,t,r){Ie.readdirSync(e).forEach(n=>s5(n,e,t,r))}function s5(e,t,r,n){let o=Is.join(t,e),i=Is.join(r,e),{destStat:s}=_s.checkPathsSync(o,i,"copy");return Px(s,o,i,n)}function a5(e,t,r,n){let o=Ie.readlinkSync(t);if(n.dereference&&(o=Is.resolve(process.cwd(),o)),e){let i;try{i=Ie.readlinkSync(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return Ie.symlinkSync(o,r);throw s}if(n.dereference&&(i=Is.resolve(process.cwd(),i)),_s.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(Ie.statSync(r).isDirectory()&&_s.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return u5(o,r)}else return Ie.symlinkSync(o,r)}function u5(e,t){return Ie.unlinkSync(t),Ie.symlinkSync(e,t)}Mx.exports=X3});var im=g((toe,Lx)=>{"use strict";Lx.exports={copySync:jx()}});var xr=g((roe,Bx)=>{"use strict";var c5=gt().fromPromise,qx=Kd();function l5(e){return qx.access(e).then(()=>!0).catch(()=>!1)}Bx.exports={pathExists:c5(l5),pathExistsSync:qx.existsSync}});var Zx=g((noe,Jx)=>{"use strict";var Xe=je(),Cs=require("path"),f5=kt().mkdirs,p5=xr().pathExists,d5=tm().utimesMillis,Ts=Ss();function m5(e,t,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
see https://github.com/jprichardson/node-fs-extra/issues/269`),Ts.checkPaths(e,t,"copy",(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;Ts.checkParentPaths(e,s,t,"copy",u=>u?n(u):r.filter?Wx(zx,a,e,t,r,n):zx(a,e,t,r,n))})}function zx(e,t,r,n,o){let i=Cs.dirname(r);p5(i,(s,a)=>{if(s)return o(s);if(a)return sm(e,t,r,n,o);f5(i,u=>u?o(u):sm(e,t,r,n,o))})}function Wx(e,t,r,n,o,i){Promise.resolve(o.filter(r,n)).then(s=>s?e(t,r,n,o,i):i(),s=>i(s))}function sm(e,t,r,n,o){return n.filter?Wx(Ux,e,t,r,n,o):Ux(e,t,r,n,o)}function Ux(e,t,r,n,o){(n.dereference?Xe.stat:Xe.lstat)(t,(s,a)=>{if(s)return o(s);if(a.isDirectory())return b5(a,e,t,r,n,o);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return h5(a,e,t,r,n,o);if(a.isSymbolicLink())return w5(e,t,r,n,o)})}function h5(e,t,r,n,o,i){return t?g5(e,r,n,o,i):Hx(e,r,n,o,i)}function g5(e,t,r,n,o){if(n.overwrite)Xe.unlink(r,i=>i?o(i):Hx(e,t,r,n,o));else return n.errorOnExist?o(new Error(`'${r}' already exists`)):o()}function Hx(e,t,r,n,o){return typeof Xe.copyFile=="function"?Xe.copyFile(t,r,i=>i?o(i):Kx(e,r,n,o)):y5(e,t,r,n,o)}function y5(e,t,r,n,o){let i=Xe.createReadStream(t);i.on("error",s=>o(s)).once("open",()=>{let s=Xe.createWriteStream(r,{mode:e.mode});s.on("error",a=>o(a)).on("open",()=>i.pipe(s)).once("close",()=>Kx(e,r,n,o))})}function Kx(e,t,r,n){Xe.chmod(t,e.mode,o=>o?n(o):r.preserveTimestamps?d5(t,e.atime,e.mtime,n):n())}function b5(e,t,r,n,o,i){return t?t&&!t.isDirectory()?i(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):Vx(r,n,o,i):v5(e,r,n,o,i)}function v5(e,t,r,n,o){Xe.mkdir(r,i=>{if(i)return o(i);Vx(t,r,n,s=>s?o(s):Xe.chmod(r,e.mode,o))})}function Vx(e,t,r,n){Xe.readdir(e,(o,i)=>o?n(o):Gx(i,e,t,r,n))}function Gx(e,t,r,n,o){let i=e.pop();return i?x5(e,i,t,r,n,o):o()}function x5(e,t,r,n,o,i){let s=Cs.join(r,t),a=Cs.join(n,t);Ts.checkPaths(s,a,"copy",(u,l)=>{if(u)return i(u);let{destStat:c}=l;sm(c,s,a,o,f=>f?i(f):Gx(e,r,n,o,i))})}function w5(e,t,r,n,o){Xe.readlink(t,(i,s)=>{if(i)return o(i);if(n.dereference&&(s=Cs.resolve(process.cwd(),s)),e)Xe.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Xe.symlink(s,r,o):o(a):(n.dereference&&(u=Cs.resolve(process.cwd(),u)),Ts.isSrcSubdir(s,u)?o(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${u}'.`)):e.isDirectory()&&Ts.isSrcSubdir(u,s)?o(new Error(`Cannot overwrite '${u}' with '${s}'.`)):E5(s,r,o)));else return Xe.symlink(s,r,o)})}function E5(e,t,r){Xe.unlink(t,n=>n?r(n):Xe.symlink(e,t,r))}Jx.exports=m5});var am=g((ooe,Yx)=>{"use strict";var S5=gt().fromCallback;Yx.exports={copy:S5(Zx())}});var sw=g((ioe,iw)=>{"use strict";var Xx=je(),rw=require("path"),pe=require("assert"),Os=process.platform==="win32";function nw(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{e[r]=e[r]||Xx[r],r=r+"Sync",e[r]=e[r]||Xx[r]}),e.maxBusyTries=e.maxBusyTries||3}function um(e,t,r){let n=0;typeof t=="function"&&(r=t,t={}),pe(e,"rimraf: missing path"),pe.strictEqual(typeof e,"string","rimraf: path should be a string"),pe.strictEqual(typeof r,"function","rimraf: callback function required"),pe(t,"rimraf: invalid options argument provided"),pe.strictEqual(typeof t,"object","rimraf: options should be object"),nw(t),Qx(e,t,function o(i){if(i){if((i.code==="EBUSY"||i.code==="ENOTEMPTY"||i.code==="EPERM")&&n<t.maxBusyTries){n++;let s=n*100;return setTimeout(()=>Qx(e,t,o),s)}i.code==="ENOENT"&&(i=null)}r(i)})}function Qx(e,t,r){pe(e),pe(t),pe(typeof r=="function"),t.lstat(e,(n,o)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Os)return ew(e,t,n,r);if(o&&o.isDirectory())return ic(e,t,n,r);t.unlink(e,i=>{if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return Os?ew(e,t,i,r):ic(e,t,i,r);if(i.code==="EISDIR")return ic(e,t,i,r)}return r(i)})})}function ew(e,t,r,n){pe(e),pe(t),pe(typeof n=="function"),r&&pe(r instanceof Error),t.chmod(e,438,o=>{o?n(o.code==="ENOENT"?null:r):t.stat(e,(i,s)=>{i?n(i.code==="ENOENT"?null:r):s.isDirectory()?ic(e,t,r,n):t.unlink(e,n)})})}function tw(e,t,r){let n;pe(e),pe(t),r&&pe(r instanceof Error);try{t.chmodSync(e,438)}catch(o){if(o.code==="ENOENT")return;throw r}try{n=t.statSync(e)}catch(o){if(o.code==="ENOENT")return;throw r}n.isDirectory()?sc(e,t,r):t.unlinkSync(e)}function ic(e,t,r,n){pe(e),pe(t),r&&pe(r instanceof Error),pe(typeof n=="function"),t.rmdir(e,o=>{o&&(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM")?I5(e,t,n):o&&o.code==="ENOTDIR"?n(r):n(o)})}function I5(e,t,r){pe(e),pe(t),pe(typeof r=="function"),t.readdir(e,(n,o)=>{if(n)return r(n);let i=o.length,s;if(i===0)return t.rmdir(e,r);o.forEach(a=>{um(rw.join(e,a),t,u=>{if(!s){if(u)return r(s=u);--i===0&&t.rmdir(e,r)}})})})}function ow(e,t){let r;t=t||{},nw(t),pe(e,"rimraf: missing path"),pe.strictEqual(typeof e,"string","rimraf: path should be a string"),pe(t,"rimraf: missing options"),pe.strictEqual(typeof t,"object","rimraf: options should be object");try{r=t.lstatSync(e)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Os&&tw(e,t,n)}try{r&&r.isDirectory()?sc(e,t,null):t.unlinkSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Os?tw(e,t,n):sc(e,t,n);if(n.code!=="EISDIR")throw n;sc(e,t,n)}}function sc(e,t,r){pe(e),pe(t),r&&pe(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")_5(e,t);else if(n.code!=="ENOENT")throw n}}function _5(e,t){if(pe(e),pe(t),t.readdirSync(e).forEach(r=>ow(rw.join(e,r),t)),Os){let r=Date.now();do try{return t.rmdirSync(e,t)}catch{}while(Date.now()-r<500)}else return t.rmdirSync(e,t)}iw.exports=um;um.sync=ow});var As=g((soe,uw)=>{"use strict";var C5=gt().fromCallback,aw=sw();uw.exports={remove:C5(aw),removeSync:aw.sync}});var gw=g((aoe,hw)=>{"use strict";var T5=gt().fromCallback,fw=je(),pw=require("path"),dw=kt(),mw=As(),cw=T5(function(t,r){r=r||function(){},fw.readdir(t,(n,o)=>{if(n)return dw.mkdirs(t,r);o=o.map(s=>pw.join(t,s)),i();function i(){let s=o.pop();if(!s)return r();mw.remove(s,a=>{if(a)return r(a);i()})}})});function lw(e){let t;try{t=fw.readdirSync(e)}catch{return dw.mkdirsSync(e)}t.forEach(r=>{r=pw.join(e,r),mw.removeSync(r)})}hw.exports={emptyDirSync:lw,emptydirSync:lw,emptyDir:cw,emptydir:cw}});var xw=g((uoe,vw)=>{"use strict";var O5=gt().fromCallback,yw=require("path"),ks=je(),bw=kt(),A5=xr().pathExists;function k5(e,t){function r(){ks.writeFile(e,"",n=>{if(n)return t(n);t()})}ks.stat(e,(n,o)=>{if(!n&&o.isFile())return t();let i=yw.dirname(e);A5(i,(s,a)=>{if(s)return t(s);if(a)return r();bw.mkdirs(i,u=>{if(u)return t(u);r()})})})}function N5(e){let t;try{t=ks.statSync(e)}catch{}if(t&&t.isFile())return;let r=yw.dirname(e);ks.existsSync(r)||bw.mkdirsSync(r),ks.writeFileSync(e,"")}vw.exports={createFile:O5(k5),createFileSync:N5}});var _w=g((coe,Iw)=>{"use strict";var R5=gt().fromCallback,Ew=require("path"),to=je(),Sw=kt(),ww=xr().pathExists;function D5(e,t,r){function n(o,i){to.link(o,i,s=>{if(s)return r(s);r(null)})}ww(t,(o,i)=>{if(o)return r(o);if(i)return r(null);to.lstat(e,s=>{if(s)return s.message=s.message.replace("lstat","ensureLink"),r(s);let a=Ew.dirname(t);ww(a,(u,l)=>{if(u)return r(u);if(l)return n(e,t);Sw.mkdirs(a,c=>{if(c)return r(c);n(e,t)})})})})}function P5(e,t){if(to.existsSync(t))return;try{to.lstatSync(e)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=Ew.dirname(t);return to.existsSync(n)||Sw.mkdirsSync(n),to.linkSync(e,t)}Iw.exports={createLink:R5(D5),createLinkSync:P5}});var Tw=g((loe,Cw)=>{"use strict";var gn=require("path"),Ns=je(),F5=xr().pathExists;function $5(e,t,r){if(gn.isAbsolute(e))return Ns.lstat(e,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:e,toDst:e}));{let n=gn.dirname(t),o=gn.join(n,e);return F5(o,(i,s)=>i?r(i):s?r(null,{toCwd:o,toDst:e}):Ns.lstat(e,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:e,toDst:gn.relative(n,e)})))}}function M5(e,t){let r;if(gn.isAbsolute(e)){if(r=Ns.existsSync(e),!r)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{let n=gn.dirname(t),o=gn.join(n,e);if(r=Ns.existsSync(o),r)return{toCwd:o,toDst:e};if(r=Ns.existsSync(e),!r)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:gn.relative(n,e)}}}Cw.exports={symlinkPaths:$5,symlinkPathsSync:M5}});var kw=g((foe,Aw)=>{"use strict";var Ow=je();function j5(e,t,r){if(r=typeof t=="function"?t:r,t=typeof t=="function"?!1:t,t)return r(null,t);Ow.lstat(e,(n,o)=>{if(n)return r(null,"file");t=o&&o.isDirectory()?"dir":"file",r(null,t)})}function L5(e,t){let r;if(t)return t;try{r=Ow.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}Aw.exports={symlinkType:j5,symlinkTypeSync:L5}});var Mw=g((poe,$w)=>{"use strict";var q5=gt().fromCallback,Rw=require("path"),ri=je(),Dw=kt(),B5=Dw.mkdirs,z5=Dw.mkdirsSync,Pw=Tw(),U5=Pw.symlinkPaths,W5=Pw.symlinkPathsSync,Fw=kw(),H5=Fw.symlinkType,K5=Fw.symlinkTypeSync,Nw=xr().pathExists;function V5(e,t,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,Nw(t,(o,i)=>{if(o)return n(o);if(i)return n(null);U5(e,t,(s,a)=>{if(s)return n(s);e=a.toDst,H5(a.toCwd,r,(u,l)=>{if(u)return n(u);let c=Rw.dirname(t);Nw(c,(f,p)=>{if(f)return n(f);if(p)return ri.symlink(e,t,l,n);B5(c,d=>{if(d)return n(d);ri.symlink(e,t,l,n)})})})})})}function G5(e,t,r){if(ri.existsSync(t))return;let o=W5(e,t);e=o.toDst,r=K5(o.toCwd,r);let i=Rw.dirname(t);return ri.existsSync(i)||z5(i),ri.symlinkSync(e,t,r)}$w.exports={createSymlink:q5(V5),createSymlinkSync:G5}});var Lw=g((doe,jw)=>{"use strict";var ac=xw(),uc=_w(),cc=Mw();jw.exports={createFile:ac.createFile,createFileSync:ac.createFileSync,ensureFile:ac.createFile,ensureFileSync:ac.createFileSync,createLink:uc.createLink,createLinkSync:uc.createLinkSync,ensureLink:uc.createLink,ensureLinkSync:uc.createLinkSync,createSymlink:cc.createSymlink,createSymlinkSync:cc.createSymlinkSync,ensureSymlink:cc.createSymlink,ensureSymlinkSync:cc.createSymlinkSync}});var Uw=g((moe,zw)=>{var ni;try{ni=je()}catch{ni=require("fs")}function J5(e,t,r){r==null&&(r=t,t={}),typeof t=="string"&&(t={encoding:t}),t=t||{};var n=t.fs||ni,o=!0;"throws"in t&&(o=t.throws),n.readFile(e,t,function(i,s){if(i)return r(i);s=Bw(s);var a;try{a=JSON.parse(s,t?t.reviver:null)}catch(u){return o?(u.message=e+": "+u.message,r(u)):r(null,null)}r(null,a)})}function Z5(e,t){t=t||{},typeof t=="string"&&(t={encoding:t});var r=t.fs||ni,n=!0;"throws"in t&&(n=t.throws);try{var o=r.readFileSync(e,t);return o=Bw(o),JSON.parse(o,t.reviver)}catch(i){if(n)throw i.message=e+": "+i.message,i;return null}}function qw(e,t){var r,n=`
`;typeof t=="object"&&t!==null&&(t.spaces&&(r=t.spaces),t.EOL&&(n=t.EOL));var o=JSON.stringify(e,t?t.replacer:null,r);return o.replace(/\n/g,n)+n}function Y5(e,t,r,n){n==null&&(n=r,r={}),r=r||{};var o=r.fs||ni,i="";try{i=qw(t,r)}catch(s){n&&n(s,null);return}o.writeFile(e,i,r,n)}function X5(e,t,r){r=r||{};var n=r.fs||ni,o=qw(t,r);return n.writeFileSync(e,o,r)}function Bw(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,""),e}var Q5={readFile:J5,readFileSync:Z5,writeFile:Y5,writeFileSync:X5};zw.exports=Q5});var fc=g((hoe,Hw)=>{"use strict";var Ww=gt().fromCallback,lc=Uw();Hw.exports={readJson:Ww(lc.readFile),readJsonSync:lc.readFileSync,writeJson:Ww(lc.writeFile),writeJsonSync:lc.writeFileSync}});var Gw=g((goe,Vw)=>{"use strict";var eL=require("path"),tL=kt(),rL=xr().pathExists,Kw=fc();function nL(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=eL.dirname(e);rL(o,(i,s)=>{if(i)return n(i);if(s)return Kw.writeJson(e,t,r,n);tL.mkdirs(o,a=>{if(a)return n(a);Kw.writeJson(e,t,r,n)})})}Vw.exports=nL});var Zw=g((yoe,Jw)=>{"use strict";var oL=je(),iL=require("path"),sL=kt(),aL=fc();function uL(e,t,r){let n=iL.dirname(e);oL.existsSync(n)||sL.mkdirsSync(n),aL.writeJsonSync(e,t,r)}Jw.exports=uL});var Xw=g((boe,Yw)=>{"use strict";var cL=gt().fromCallback,ut=fc();ut.outputJson=cL(Gw());ut.outputJsonSync=Zw();ut.outputJSON=ut.outputJson;ut.outputJSONSync=ut.outputJsonSync;ut.writeJSON=ut.writeJson;ut.writeJSONSync=ut.writeJsonSync;ut.readJSON=ut.readJson;ut.readJSONSync=ut.readJsonSync;Yw.exports=ut});var oE=g((voe,nE)=>{"use strict";var tE=je(),lL=require("path"),fL=im().copySync,rE=As().removeSync,pL=kt().mkdirpSync,Qw=Ss();function dL(e,t,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o}=Qw.checkPathsSync(e,t,"move");return Qw.checkParentPathsSync(e,o,t,"move"),pL(lL.dirname(t)),mL(e,t,n)}function mL(e,t,r){if(r)return rE(t),eE(e,t,r);if(tE.existsSync(t))throw new Error("dest already exists.");return eE(e,t,r)}function eE(e,t,r){try{tE.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return hL(e,t,r)}}function hL(e,t,r){return fL(e,t,{overwrite:r,errorOnExist:!0}),rE(e)}nE.exports=dL});var sE=g((xoe,iE)=>{"use strict";iE.exports={moveSync:oE()}});var fE=g((woe,lE)=>{"use strict";var gL=je(),yL=require("path"),bL=am().copy,cE=As().remove,vL=kt().mkdirp,xL=xr().pathExists,aE=Ss();function wL(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=r.overwrite||r.clobber||!1;aE.checkPaths(e,t,"move",(i,s)=>{if(i)return n(i);let{srcStat:a}=s;aE.checkParentPaths(e,a,t,"move",u=>{if(u)return n(u);vL(yL.dirname(t),l=>l?n(l):EL(e,t,o,n))})})}function EL(e,t,r,n){if(r)return cE(t,o=>o?n(o):uE(e,t,r,n));xL(t,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):uE(e,t,r,n))}function uE(e,t,r,n){gL.rename(e,t,o=>o?o.code!=="EXDEV"?n(o):SL(e,t,r,n):n())}function SL(e,t,r,n){bL(e,t,{overwrite:r,errorOnExist:!0},i=>i?n(i):cE(e,n))}lE.exports=wL});var dE=g((Eoe,pE)=>{"use strict";var IL=gt().fromCallback;pE.exports={move:IL(fE())}});var yE=g((Soe,gE)=>{"use strict";var _L=gt().fromCallback,Rs=je(),mE=require("path"),hE=kt(),CL=xr().pathExists;function TL(e,t,r,n){typeof r=="function"&&(n=r,r="utf8");let o=mE.dirname(e);CL(o,(i,s)=>{if(i)return n(i);if(s)return Rs.writeFile(e,t,r,n);hE.mkdirs(o,a=>{if(a)return n(a);Rs.writeFile(e,t,r,n)})})}function OL(e,...t){let r=mE.dirname(e);if(Rs.existsSync(r))return Rs.writeFileSync(e,...t);hE.mkdirsSync(r),Rs.writeFileSync(e,...t)}gE.exports={outputFile:_L(TL),outputFileSync:OL}});var lm=g((Ioe,cm)=>{"use strict";cm.exports=Object.assign({},Kd(),im(),am(),gw(),Lw(),Xw(),kt(),sE(),dE(),yE(),xr(),As());var bE=require("fs");Object.getOwnPropertyDescriptor(bE,"promises")&&Object.defineProperty(cm.exports,"promises",{get(){return bE.promises}})});var xE=g((_oe,vE)=>{vE.exports=()=>new Date});var EE=g((Coe,wE)=>{var AL=Ue()("streamroller:fileNameFormatter"),kL=require("path"),NL=".gz",RL=".";wE.exports=({file:e,keepFileExt:t,needsIndex:r,alwaysIncludeDate:n,compress:o,fileNameSep:i})=>{let s=i||RL,a=kL.join(e.dir,e.name),u=d=>d+e.ext,l=(d,h,b)=>(r||!b)&&h?d+s+h:d,c=(d,h,b)=>(h>0||n)&&b?d+s+b:d,f=(d,h)=>h&&o?d+NL:d,p=t?[c,l,u,f]:[u,c,l,f];return({date:d,index:h})=>(AL(`_formatFileName: date=${d}, index=${h}`),p.reduce((b,y)=>y(b,h,d),a))}});var CE=g((Toe,_E)=>{var ro=Ue()("streamroller:fileNameParser"),SE=".gz",IE=Ju(),DL=".";_E.exports=({file:e,keepFileExt:t,pattern:r,fileNameSep:n})=>{let o=n||DL,i=(p,d)=>p.endsWith(SE)?(ro("it is gzipped"),d.isCompressed=!0,p.slice(0,-1*SE.length)):p,s="__NOT_MATCHING__",f=[i,t?p=>p.startsWith(e.name)&&p.endsWith(e.ext)?(ro("it starts and ends with the right things"),p.slice(e.name.length+1,-1*e.ext.length)):s:p=>p.startsWith(e.base)?(ro("it starts with the right things"),p.slice(e.base.length+1)):s,r?(p,d)=>{let h=p.split(o),b=h[h.length-1];ro("items: ",h,", indexStr: ",b);let y=p;b!==void 0&&b.match(/^\d+$/)?(y=p.slice(0,-1*(b.length+1)),ro(`dateStr is ${y}`),r&&!y&&(y=b,b="0")):b="0";try{let v=IE.parse(r,y,new Date(0,0));return IE.asString(r,v)!==y?p:(d.index=parseInt(b,10),d.date=y,d.timestamp=v.getTime(),"")}catch(v){return ro(`Problem parsing ${y} as ${r}, error was: `,v),p}}:(p,d)=>p.match(/^\d+$/)?(ro("it has an index"),d.index=parseInt(p,10),""):p];return p=>{let d={filename:p,index:0,isCompressed:!1};return f.reduce((b,y)=>y(b,d),p)?null:d}}});var OE=g((Ooe,TE)=>{var bt=Ue()("streamroller:moveAndMaybeCompressFile"),qr=lm(),PL=require("zlib"),FL=function(e){let t={mode:parseInt("0600",8),compress:!1},r=Object.assign({},t,e);return bt(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(r)}`),r},$L=async(e,t,r)=>{if(r=FL(r),e===t){bt("moveAndMaybeCompressFile: source and target are the same, not doing anything");return}if(await qr.pathExists(e))if(bt(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${r.compress?"with":"without"} compress`),r.compress)await new Promise((n,o)=>{let i=!1,s=qr.createWriteStream(t,{mode:r.mode,flags:"wx"}).on("open",()=>{i=!0;let a=qr.createReadStream(e).on("open",()=>{a.pipe(PL.createGzip()).pipe(s)}).on("error",u=>{bt(`moveAndMaybeCompressFile: error reading ${e}`,u),s.destroy(u)})}).on("finish",()=>{bt(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),qr.unlink(e).then(n).catch(a=>{bt(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,a),qr.truncate(e).then(n).catch(u=>{bt(`moveAndMaybeCompressFile: error truncating ${e}`,u),o(u)})})}).on("error",a=>{i?(bt(`moveAndMaybeCompressFile: error writing ${t}, deleting`,a),qr.unlink(t).then(()=>{o(a)}).catch(u=>{bt(`moveAndMaybeCompressFile: error deleting ${t}`,u),o(u)})):(bt(`moveAndMaybeCompressFile: error creating ${t}`,a),o(a))})}).catch(()=>{});else{bt(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await qr.move(e,t,{overwrite:!0})}catch(n){if(bt(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),n.code!=="ENOENT"){bt("moveAndMaybeCompressFile: trying copy+truncate instead");try{await qr.copy(e,t,{overwrite:!0}),await qr.truncate(e)}catch(o){bt("moveAndMaybeCompressFile: error copy+truncate",o)}}}}};TE.exports=$L});var mc=g((Aoe,AE)=>{var Nt=Ue()("streamroller:RollingFileWriteStream"),oo=lm(),no=require("path"),ML=require("os"),pc=xE(),dc=Ju(),{Writable:jL}=require("stream"),LL=EE(),qL=CE(),BL=OE(),zL=e=>(Nt(`deleteFiles: files to delete: ${e}`),Promise.all(e.map(t=>oo.unlink(t).catch(r=>{Nt(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${r}`)})))),fm=class extends jL{constructor(t,r){if(Nt(`constructor: creating RollingFileWriteStream. path=${t}`),typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(no.sep))throw new Error(`Filename is a directory: ${t}`);t.indexOf(`~${no.sep}`)===0&&(t=t.replace("~",ML.homedir())),super(r),this.options=this._parseOption(r),this.fileObject=no.parse(t),this.fileObject.dir===""&&(this.fileObject=no.parse(no.join(process.cwd(),t))),this.fileFormatter=LL({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=qL({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=dc(this.options.pattern,pc())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),Nt(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{let t=oo.statSync(this.filename);this.state.currentSize=t.size,this.options.pattern&&(this.state.currentDate=dc(this.options.pattern,t.mtime))}catch{return}}_parseOption(t){let r={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},n=Object.assign({},r,t);if(!n.maxSize)delete n.maxSize;else if(n.maxSize<=0)throw new Error(`options.maxSize (${n.maxSize}) should be > 0`);if(n.numBackups||n.numBackups===0){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return Nt(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(t){this.currentFileStream.end("",this.options.encoding,t)}_write(t,r,n){this._shouldRoll().then(()=>{Nt(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${t}`),this.currentFileStream.write(t,r,o=>{this.state.currentSize+=t.length,n(o)})})}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(Nt(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==dc(this.options.pattern,pc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return Nt("_roll: closing the current stream"),new Promise((t,r)=>{this.currentFileStream.end("",this.options.encoding,()=>{this._moveOldFiles().then(t).catch(r)})})}async _moveOldFiles(){let t=await this._getExistingFiles(),r=this.state.currentDate?t.filter(n=>n.date===this.state.currentDate):t;for(let n=r.length;n>=0;n--){Nt(`_moveOldFiles: i = ${n}`);let o=this.fileFormatter({date:this.state.currentDate,index:n}),i=this.fileFormatter({date:this.state.currentDate,index:n+1}),s={compress:this.options.compress&&n===0,mode:this.options.mode};await BL(o,i,s)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?dc(this.options.pattern,pc()):null,Nt(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise((n,o)=>{this.currentFileStream.write("","utf8",()=>{this._clean().then(n).catch(o)})})}async _getExistingFiles(){let t=await oo.readdir(this.fileObject.dir).catch(()=>[]);Nt(`_getExistingFiles: files=${t}`);let r=t.map(o=>this.fileNameParser(o)).filter(o=>o),n=o=>(o.timestamp?o.timestamp:pc().getTime())-o.index;return r.sort((o,i)=>n(o)-n(i)),r}_renewWriteStream(){let t=this.fileFormatter({date:this.state.currentDate,index:0}),r=i=>{try{return oo.mkdirSync(i,{recursive:!0})}catch(s){if(s.code==="ENOENT")return r(no.dirname(i)),r(i);if(s.code!=="EEXIST"&&s.code!=="EROFS")throw s;try{if(oo.statSync(i).isDirectory())return i;throw s}catch{throw s}}};r(this.fileObject.dir);let n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode},o=function(i,s,a){return i[a]=i[s],delete i[s],i};oo.appendFileSync(t,"",o({...n},"flags","flag")),this.currentFileStream=oo.createWriteStream(t,n),this.currentFileStream.on("error",i=>{this.emit("error",i)})}async _clean(){let t=await this._getExistingFiles();if(Nt(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),Nt("_clean: existing files are: ",t),this._tooManyFiles(t.length)){let r=t.slice(0,t.length-this.options.numToKeep).map(n=>no.format({dir:this.fileObject.dir,base:n.filename}));await zL(r)}}_tooManyFiles(t){return this.options.numToKeep>0&&t>this.options.numToKeep}};AE.exports=fm});var NE=g((koe,kE)=>{var UL=mc(),pm=class extends UL{constructor(t,r,n,o){o||(o={}),r&&(o.maxSize=r),!o.numBackups&&o.numBackups!==0&&(!n&&n!==0&&(n=1),o.numBackups=n),super(t,o),this.backups=o.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};kE.exports=pm});var DE=g((Noe,RE)=>{var WL=mc(),dm=class extends WL{constructor(t,r,n){r&&typeof r=="object"&&(n=r,r=null),n||(n={}),r||(r="yyyy-MM-dd"),n.pattern=r,!n.numBackups&&n.numBackups!==0?(!n.daysToKeep&&n.daysToKeep!==0?n.daysToKeep=1:process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"),n.numBackups=n.daysToKeep):n.daysToKeep=n.numBackups,super(t,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}};RE.exports=dm});var mm=g((Roe,PE)=>{PE.exports={RollingFileWriteStream:mc(),RollingFileStream:NE(),DateRollingFileStream:DE()}});var LE=g((Doe,jE)=>{var FE=Ue()("log4js:file"),hm=require("path"),HL=mm(),ME=require("os"),KL=ME.EOL,hc=!1,gc=new Set;function $E(){gc.forEach(e=>{e.sighupHandler()})}function VL(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(hm.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${hm.sep}.+)`),ME.homedir()),e=hm.normalize(e),n=!n&&n!==0?5:n,FE("Creating file appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(l,c,f,p){let d=new HL.RollingFileStream(l,c,f,p);return d.on("error",h=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",l,h)}),d.on("drain",()=>{process.emit("log4js:pause",!1)}),d}let a=s(e,r,n,o),u=function(l){if(a.writable){if(o.removeColor===!0){let c=/\x1b[[0-9;]*m/g;l.data=l.data.map(f=>typeof f=="string"?f.replace(c,""):f)}a.write(t(l,i)+KL,"utf8")||process.emit("log4js:pause",!0)}};return u.reopen=function(){a.end(()=>{a=s(e,r,n,o)})},u.sighupHandler=function(){FE("SIGHUP handler called."),u.reopen()},u.shutdown=function(l){gc.delete(u),gc.size===0&&hc&&(process.removeListener("SIGHUP",$E),hc=!1),a.end("","utf-8",l)},gc.add(u),hc||(process.on("SIGHUP",$E),hc=!0),u}function GL(e,t){let r=t.basicLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,VL(e.filename,r,e.maxLogSize,e.backups,e,e.timezoneOffset)}jE.exports.configure=GL});var BE=g((Poe,qE)=>{var JL=mm(),ZL=require("os"),YL=ZL.EOL;function XL(e,t,r){let n=new JL.DateRollingFileStream(e,t,r);return n.on("error",o=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,o)}),n.on("drain",()=>{process.emit("log4js:pause",!1)}),n}function QL(e,t,r,n,o){n.maxSize=n.maxLogSize;let i=XL(e,t,n),s=function(a){i.writable&&(i.write(r(a,o)+YL,"utf8")||process.emit("log4js:pause",!0))};return s.shutdown=function(a){i.end("","utf-8",a)},s}function eq(e,t){let r=t.basicLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,QL(e.filename,e.pattern,r,e,e.timezoneOffset)}qE.exports.configure=eq});var HE=g((Foe,WE)=>{var Br=Ue()("log4js:fileSync"),Er=require("path"),wr=require("fs"),zE=require("os"),tq=zE.EOL;function UE(e,t){let r=n=>{try{return wr.mkdirSync(n,{recursive:!0})}catch(o){if(o.code==="ENOENT")return r(Er.dirname(n)),r(n);if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(wr.statSync(n).isDirectory())return n;throw o}catch{throw o}}};r(Er.dirname(e)),wr.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}var gm=class{constructor(t,r,n,o){if(Br("In RollingFileStream"),r<0)throw new Error(`maxLogSize (${r}) should be > 0`);this.filename=t,this.size=r,this.backups=n,this.options=o,this.currentSize=0;function i(s){let a=0;try{a=wr.statSync(s).size}catch{UE(s,o)}return a}this.currentSize=i(this.filename)}shouldRoll(){return Br("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(t){let r=this,n=new RegExp(`^${Er.basename(t)}`);function o(l){return n.test(l)}function i(l){return parseInt(l.slice(`${Er.basename(t)}.`.length),10)||0}function s(l,c){return i(l)-i(c)}function a(l){let c=i(l);if(Br(`Index of ${l} is ${c}`),r.backups===0)wr.truncateSync(t,0);else if(c<r.backups){try{wr.unlinkSync(`${t}.${c+1}`)}catch{}Br(`Renaming ${l} -> ${t}.${c+1}`),wr.renameSync(Er.join(Er.dirname(t),l),`${t}.${c+1}`)}}function u(){Br("Renaming the old files"),wr.readdirSync(Er.dirname(t)).filter(o).sort(s).reverse().forEach(a)}Br("Rolling, rolling, rolling"),u()}write(t,r){let n=this;function o(){Br("writing the chunk to the file"),n.currentSize+=t.length,wr.appendFileSync(n.filename,t)}Br("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),o()}};function rq(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Er.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${Er.sep}.+)`),zE.homedir()),e=Er.normalize(e),n=!n&&n!==0?5:n,Br("Creating fileSync appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(u,l,c){let f;return l?f=new gm(u,l,c,o):f=(p=>(UE(p,o),{write(d){wr.appendFileSync(p,d)}}))(u),f}let a=s(e,r,n);return u=>{a.write(t(u,i)+tq)}}function nq(e,t){let r=t.basicLayout;e.layout&&(r=t.layout(e.layout.type,e.layout));let n={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return rq(e.filename,r,e.maxLogSize,e.backups,n,e.timezoneOffset)}WE.exports.configure=nq});var VE=g(($oe,KE)=>{var Sr=Ue()("log4js:tcp"),oq=require("net");function iq(e,t){let r=!1,n=[],o,i=3,s="__LOG4JS__";function a(f){Sr("Writing log event to socket"),r=o.write(`${t(f)}${s}`,"utf8")}function u(){let f;for(Sr("emptying buffer");f=n.shift();)a(f)}function l(){Sr(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),s=`${e.endMsg||"__LOG4JS__"}`,o=oq.createConnection(e.port||5e3,e.host||"localhost"),o.on("connect",()=>{Sr("socket connected"),u(),r=!0}),o.on("drain",()=>{Sr("drain event received, emptying buffer"),r=!0,u()}),o.on("timeout",o.end.bind(o)),o.on("error",f=>{Sr("connection error",f),r=!1,u()}),o.on("close",l)}l();function c(f){r?a(f):(Sr("buffering log event because it cannot write at the moment"),n.push(f))}return c.shutdown=function(f){Sr("shutdown called"),n.length&&i?(Sr("buffer has items, waiting 100ms to empty"),i-=1,setTimeout(()=>{c.shutdown(f)},100)):(o.removeAllListeners("close"),o.end(f))},c}function sq(e,t){Sr(`configure with config = ${e}`);let r=function(n){return n.serialise()};return e.layout&&(r=t.layout(e.layout.type,e.layout)),iq(e,r)}KE.exports.configure=sq});var vm=g((Moe,bm)=>{var ym=require("path"),yn=Ue()("log4js:appenders"),Vt=Zn(),GE=Qu(),aq=Xn(),uq=$d(),cq=H0(),ar=new Map;ar.set("console",V0());ar.set("stdout",J0());ar.set("stderr",Y0());ar.set("logLevelFilter",Q0());ar.set("categoryFilter",rx());ar.set("noLogFilter",ix());ar.set("file",LE());ar.set("dateFile",BE());ar.set("fileSync",HE());ar.set("tcp",VE());var Ds=new Map,yc=(e,t)=>{let r;try{let n=`${e}.cjs`;r=require.resolve(n),yn("Loading module from ",n)}catch{r=e,yn("Loading module from ",e)}try{return require(r)}catch(n){Vt.throwExceptionIf(t,n.code!=="MODULE_NOT_FOUND",`appender "${e}" could not be loaded (error was: ${n})`);return}},lq=(e,t)=>ar.get(e)||yc(`./${e}`,t)||yc(e,t)||require.main&&require.main.filename&&yc(ym.join(ym.dirname(require.main.filename),e),t)||yc(ym.join(process.cwd(),e),t),bc=new Set,JE=(e,t)=>{if(Ds.has(e))return Ds.get(e);if(!t.appenders[e])return!1;if(bc.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);bc.add(e),yn(`Creating appender ${e}`);let r=fq(e,t);return bc.delete(e),Ds.set(e,r),r},fq=(e,t)=>{let r=t.appenders[e],n=r.type.configure?r.type:lq(r.type,t);return Vt.throwExceptionIf(t,Vt.not(n),`appender "${e}" is not valid (type "${r.type}" could not be found)`),n.appender&&(process.emitWarning(`Appender ${r.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),yn("[log4js-node-DEP0001]",`DEPRECATION: Appender ${r.type} exports an appender function.`)),n.shutdown&&(process.emitWarning(`Appender ${r.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),yn("[log4js-node-DEP0002]",`DEPRECATION: Appender ${r.type} exports a shutdown function.`)),yn(`${e}: clustering.isMaster ? ${GE.isMaster()}`),yn(`${e}: appenderModule is ${require("util").inspect(n)}`),GE.onlyOnMaster(()=>(yn(`calling appenderModule.configure for ${e} / ${r.type}`),n.configure(cq.modifyConfig(r),uq,o=>JE(o,t),aq)),()=>{})},ZE=e=>{if(Ds.clear(),bc.clear(),!e)return;let t=[];Object.values(e.categories).forEach(r=>{t.push(...r.appenders)}),Object.keys(e.appenders).forEach(r=>{(t.includes(r)||e.appenders[r].type==="tcp-server"||e.appenders[r].type==="multiprocess")&&JE(r,e)})},YE=()=>{ZE()};YE();Vt.addListener(e=>{Vt.throwExceptionIf(e,Vt.not(Vt.anObject(e.appenders)),'must have a property "appenders" of type object.');let t=Object.keys(e.appenders);Vt.throwExceptionIf(e,Vt.not(t.length),"must define at least one appender."),t.forEach(r=>{Vt.throwExceptionIf(e,Vt.not(e.appenders[r].type),`appender "${r}" is not valid (must be an object with property "type")`)})});Vt.addListener(ZE);bm.exports=Ds;bm.exports.init=YE});var Em=g((joe,vc)=>{var Ps=Ue()("log4js:categories"),ke=Zn(),xm=Xn(),XE=vm(),bn=new Map;function QE(e,t,r){if(t.inherit===!1)return;let n=r.lastIndexOf(".");if(n<0)return;let o=r.slice(0,n),i=e.categories[o];i||(i={inherit:!0,appenders:[]}),QE(e,i,o),!e.categories[o]&&i.appenders&&i.appenders.length&&i.level&&(e.categories[o]=i),t.appenders=t.appenders||[],t.level=t.level||i.level,i.appenders.forEach(s=>{t.appenders.includes(s)||t.appenders.push(s)}),t.parent=i}function pq(e){if(!e.categories)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r];QE(e,n,r)})}ke.addPreProcessingListener(e=>pq(e));ke.addListener(e=>{ke.throwExceptionIf(e,ke.not(ke.anObject(e.categories)),'must have a property "categories" of type object.');let t=Object.keys(e.categories);ke.throwExceptionIf(e,ke.not(t.length),"must define at least one category."),t.forEach(r=>{let n=e.categories[r];ke.throwExceptionIf(e,[ke.not(n.appenders),ke.not(n.level)],`category "${r}" is not valid (must be an object with properties "appenders" and "level")`),ke.throwExceptionIf(e,ke.not(Array.isArray(n.appenders)),`category "${r}" is not valid (appenders must be an array of appender names)`),ke.throwExceptionIf(e,ke.not(n.appenders.length),`category "${r}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(n,"enableCallStack")&&ke.throwExceptionIf(e,typeof n.enableCallStack!="boolean",`category "${r}" is not valid (enableCallStack must be boolean type)`),n.appenders.forEach(o=>{ke.throwExceptionIf(e,ke.not(XE.get(o)),`category "${r}" is not valid (appender "${o}" is not defined)`)}),ke.throwExceptionIf(e,ke.not(xm.getLevel(n.level)),`category "${r}" is not valid (level "${n.level}" not recognised; valid levels are ${xm.levels.join(", ")})`)}),ke.throwExceptionIf(e,ke.not(e.categories.default),'must define a "default" category.')});var wm=e=>{if(bn.clear(),!e)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r],o=[];n.appenders.forEach(i=>{o.push(XE.get(i)),Ps(`Creating category ${r}`),bn.set(r,{appenders:o,level:xm.getLevel(n.level),enableCallStack:n.enableCallStack||!1})})})},eS=()=>{wm()};eS();ke.addListener(wm);var oi=e=>{if(Ps(`configForCategory: searching for config for ${e}`),bn.has(e))return Ps(`configForCategory: ${e} exists in config, returning it`),bn.get(e);let t;return e.indexOf(".")>0?(Ps(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...oi(e.slice(0,e.lastIndexOf(".")))}):(bn.has("default")||wm({categories:{default:{appenders:["out"],level:"OFF"}}}),Ps("configForCategory: cloning default category"),t={...bn.get("default")}),bn.set(e,t),t},dq=e=>oi(e).appenders,mq=e=>oi(e).level,hq=(e,t)=>{oi(e).level=t},gq=e=>oi(e).enableCallStack===!0,yq=(e,t)=>{oi(e).enableCallStack=t};vc.exports=bn;vc.exports=Object.assign(vc.exports,{appendersForCategory:dq,getLevelForCategory:mq,setLevelForCategory:hq,getEnableCallStackForCategory:gq,setEnableCallStackForCategory:yq,init:eS})});var iS=g((Loe,oS)=>{var tS=Ue()("log4js:logger"),bq=Md(),Ir=Xn(),vq=Qu(),xc=Em(),rS=Zn(),xq=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function wq(e,t=4){try{let r=e.stack.split(`
`).slice(t),n=xq.exec(r[0]);if(n&&n.length===6)return{functionName:n[1],fileName:n[2],lineNumber:parseInt(n[3],10),columnNumber:parseInt(n[4],10),callStack:r.join(`
`)};console.error("log4js.logger - defaultParseCallStack error")}catch(r){console.error("log4js.logger - defaultParseCallStack error",r)}return null}var Fs=class{constructor(t){if(!t)throw new Error("No category provided.");this.category=t,this.context={},this.parseCallStack=wq,tS(`Logger created (${this.category}, ${this.level})`)}get level(){return Ir.getLevel(xc.getLevelForCategory(this.category),Ir.OFF)}set level(t){xc.setLevelForCategory(this.category,Ir.getLevel(t,this.level))}get useCallStack(){return xc.getEnableCallStackForCategory(this.category)}set useCallStack(t){xc.setEnableCallStackForCategory(this.category,t===!0)}log(t,...r){let n=Ir.getLevel(t);n?this.isLevelEnabled(n)&&this._log(n,r):rS.validIdentifier(t)&&r.length>0?(this.log(Ir.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",t),this.log(Ir.INFO,`[${t}]`,...r)):this.log(Ir.INFO,t,...r)}isLevelEnabled(t){return this.level.isLessThanOrEqualTo(t)}_log(t,r){tS(`sending log data (${t}) to appenders`);let n=new bq(this.category,t,r,this.context,this.useCallStack&&this.parseCallStack(new Error));vq.send(n)}addContext(t,r){this.context[t]=r}removeContext(t){delete this.context[t]}clearContext(){this.context={}}setParseCallStackFunction(t){this.parseCallStack=t}};function nS(e){let t=Ir.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,i=>i[1].toUpperCase()),o=n[0].toUpperCase()+n.slice(1);Fs.prototype[`is${o}Enabled`]=function(){return this.isLevelEnabled(t)},Fs.prototype[n]=function(...i){this.log(t,...i)}}Ir.levels.forEach(nS);rS.addListener(()=>{Ir.levels.forEach(nS)});oS.exports=Fs});var uS=g((qoe,aS)=>{var ii=Xn(),Eq=':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';function Sq(e){return e.originalUrl||e.url}function Iq(e,t,r){let n=i=>{let s=i.concat();for(let a=0;a<s.length;++a)for(let u=a+1;u<s.length;++u)s[a].token==s[u].token&&s.splice(u--,1);return s},o=[];return o.push({token:":url",replacement:Sq(e)}),o.push({token:":protocol",replacement:e.protocol}),o.push({token:":hostname",replacement:e.hostname}),o.push({token:":method",replacement:e.method}),o.push({token:":status",replacement:t.__statusCode||t.statusCode}),o.push({token:":response-time",replacement:t.responseTime}),o.push({token:":date",replacement:new Date().toUTCString()}),o.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),o.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),o.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),o.push({token:":user-agent",replacement:e.headers["user-agent"]}),o.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),o.push({token:/:req\[([^\]]+)]/g,replacement(i,s){return e.headers[s.toLowerCase()]}}),o.push({token:/:res\[([^\]]+)]/g,replacement(i,s){return t.getHeader(s.toLowerCase())||t.__headers&&t.__headers[s]}}),n(r.concat(o))}function sS(e,t){for(let r=0;r<t.length;r++)e=e.replace(t[r].token,t[r].replacement);return e}function _q(e){let t=null;if(e instanceof RegExp&&(t=e),typeof e=="string"&&(t=new RegExp(e)),Array.isArray(e)){let r=e.map(n=>n.source?n.source:n);t=new RegExp(r.join("|"))}return t}function Cq(e,t,r){let n=t;if(r){let o=r.find(i=>{let s=!1;return i.from&&i.to?s=e>=i.from&&e<=i.to:s=i.codes.indexOf(e)!==-1,s});o&&(n=ii.getLevel(o.level,n))}return n}aS.exports=function(t,r){typeof r=="string"||typeof r=="function"?r={format:r}:r=r||{};let n=t,o=ii.getLevel(r.level,ii.INFO),i=r.format||Eq;return(s,a,u)=>{if(s._logging!==void 0)return u();if(typeof r.nolog!="function"){let l=_q(r.nolog);if(l&&l.test(s.originalUrl))return u()}if(n.isLevelEnabled(o)||r.level==="auto"){let l=new Date,{writeHead:c}=a;s._logging=!0,a.writeHead=(d,h)=>{a.writeHead=c,a.writeHead(d,h),a.__statusCode=d,a.__headers=h||{}};let f=!1,p=()=>{if(f)return;if(f=!0,typeof r.nolog=="function"&&r.nolog(s,a)===!0){s._logging=!1;return}a.responseTime=new Date-l,a.statusCode&&r.level==="auto"&&(o=ii.INFO,a.statusCode>=300&&(o=ii.WARN),a.statusCode>=400&&(o=ii.ERROR)),o=Cq(a.statusCode,o,r.statusRules);let d=Iq(s,a,r.tokens||[]);if(r.context&&n.addContext("res",a),typeof i=="function"){let h=i(s,a,b=>sS(b,d));h&&n.log(o,h)}else n.log(o,sS(i,d));r.context&&n.removeContext("res")};a.on("end",p),a.on("finish",p),a.on("error",p),a.on("close",p)}return u()}}});var dS=g((Boe,pS)=>{var cS=Ue()("log4js:recording"),wc=[];function Tq(){return function(e){cS(`received logEvent, number of events now ${wc.length+1}`),cS("log event was ",e),wc.push(e)}}function lS(){return wc.slice()}function fS(){wc.length=0}pS.exports={configure:Tq,replay:lS,playback:lS,reset:fS,erase:fS}});var xS=g((zoe,vS)=>{var vn=Ue()("log4js:main"),Oq=require("fs"),Aq=s0()({proto:!0}),kq=Zn(),Nq=$d(),Rq=Xn(),mS=vm(),hS=Em(),Dq=iS(),Pq=Qu(),Fq=uS(),$q=dS(),$s=!1;function Mq(e){if(!$s)return;vn("Received log event ",e),hS.appendersForCategory(e.categoryName).forEach(r=>{r(e)})}function jq(e){vn(`Loading configuration from ${e}`);try{return JSON.parse(Oq.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}function gS(e){$s&&yS();let t=e;return typeof t=="string"&&(t=jq(e)),vn(`Configuration is ${t}`),kq.configure(Aq(t)),Pq.onMessage(Mq),$s=!0,bS}function Lq(){return $q}function yS(e){vn("Shutdown called. Disabling all log writing."),$s=!1;let t=Array.from(mS.values());mS.init(),hS.init();let r=t.reduceRight((s,a)=>a.shutdown?s+1:s,0);if(r===0)return vn("No appenders with shutdown functions found."),e!==void 0&&e();let n=0,o;vn(`Found ${r} appenders with shutdown functions.`);function i(s){o=o||s,n+=1,vn(`Appender shutdowns complete: ${n} / ${r}`),n>=r&&(vn("All shutdown functions completed."),e&&e(o))}return t.filter(s=>s.shutdown).forEach(s=>s.shutdown(i)),null}function qq(e){return $s||gS(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Dq(e||"default")}var bS={getLogger:qq,configure:gS,shutdown:yS,connectLogger:Fq,levels:Rq,addLayout:Nq.addLayout,recording:Lq};vS.exports=bS});var si=g(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});function wS(e,t){if(t)return e;throw new Error("Unhandled discriminated union member: "+JSON.stringify(e))}Ec.assertNever=wS;Ec.default=wS});var IS=g((Woe,SS)=>{"use strict";var Bq=["h","min","s","ms","\u03BCs","ns"],zq=["hour","minute","second","millisecond","microsecond","nanosecond"],ES=[3600,60,1,1e6,1e3,1];SS.exports=function(e,t){var r,n,o,i,s,a,u,l,c,f;if(r=!1,n=!1,t&&(r=t.verbose||!1,n=t.precise||!1),!Array.isArray(e)||e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")return"";for(e[1]<0&&(f=e[0]+e[1]/1e9,e[0]=parseInt(f),e[1]=parseFloat((f%1).toPrecision(9))*1e9),c="",o=0;o<6&&(i=o<3?0:1,s=e[i],o!==3&&o!==0&&(s=s%ES[o-1]),o===2&&(s+=e[1]/1e9),a=s/ES[o],!(a>=1&&(r&&(a=Math.floor(a)),n?l=a.toString():(u=a>=10?0:2,l=a.toFixed(u)),l.indexOf(".")>-1&&l[l.length-1]==="0"&&(l=l.replace(/\.?0+$/,"")),c&&(c+=" "),c+=l,r?(c+=" "+zq[o],l!=="1"&&(c+="s")):c+=" "+Bq[o],!r)));o++);return c}});var CS=g((Hoe,_S)=>{"use strict";_S.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)});var NS=g((Koe,kS)=>{"use strict";var AS="%[a-f0-9]{2}",TS=new RegExp("("+AS+")|([^%]+?)","gi"),OS=new RegExp("("+AS+")+","gi");function Sm(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],Sm(r),Sm(n))}function Uq(e){try{return decodeURIComponent(e)}catch{for(var t=e.match(TS)||[],r=1;r<t.length;r++)e=Sm(t,r).join(""),t=e.match(TS)||[];return e}}function Wq(e){for(var t={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=OS.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{var n=Uq(r[0]);n!==r[0]&&(t[r[0]]=n)}r=OS.exec(e)}t["%C2"]="\uFFFD";for(var o=Object.keys(t),i=0;i<o.length;i++){var s=o[i];e=e.replace(new RegExp(s,"g"),t[s])}return e}kS.exports=function(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch{return Wq(e)}}});var DS=g((Voe,RS)=>{"use strict";RS.exports=(e,t)=>{if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[e];let r=e.indexOf(t);return r===-1?[e]:[e.slice(0,r),e.slice(r+t.length)]}});var FS=g((Goe,PS)=>{"use strict";PS.exports=function(e,t){for(var r={},n=Object.keys(e),o=Array.isArray(t),i=0;i<n.length;i++){var s=n[i],a=e[s];(o?t.indexOf(s)!==-1:t(s,a,e))&&(r[s]=a)}return r}});var _m=g(vt=>{"use strict";var Hq=CS(),Kq=NS(),MS=DS(),Vq=FS(),Gq=e=>e==null,Im=Symbol("encodeFragmentIdentifier");function Jq(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{let o=r.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Re(t,e),"[",o,"]"].join("")]:[...r,[Re(t,e),"[",Re(o,e),"]=",Re(n,e)].join("")]};case"bracket":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Re(t,e),"[]"].join("")]:[...r,[Re(t,e),"[]=",Re(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Re(t,e),":list="].join("")]:[...r,[Re(t,e),":list=",Re(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{let t=e.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,o)=>o===void 0||e.skipNull&&o===null||e.skipEmptyString&&o===""?n:(o=o===null?"":o,n.length===0?[[Re(r,e),t,Re(o,e)].join("")]:[[n,Re(o,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,Re(t,e)]:[...r,[Re(t,e),"=",Re(n,e)].join("")]}}function Zq(e){let t;switch(e.arrayFormat){case"index":return(r,n,o)=>{if(t=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!t){o[r]=n;return}o[r]===void 0&&(o[r]={}),o[r][t[1]]=n};case"bracket":return(r,n,o)=>{if(t=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!t){o[r]=n;return}if(o[r]===void 0){o[r]=[n];return}o[r]=[].concat(o[r],n)};case"colon-list-separator":return(r,n,o)=>{if(t=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!t){o[r]=n;return}if(o[r]===void 0){o[r]=[n];return}o[r]=[].concat(o[r],n)};case"comma":case"separator":return(r,n,o)=>{let i=typeof n=="string"&&n.includes(e.arrayFormatSeparator),s=typeof n=="string"&&!i&&zr(n,e).includes(e.arrayFormatSeparator);n=s?zr(n,e):n;let a=i||s?n.split(e.arrayFormatSeparator).map(u=>zr(u,e)):n===null?n:zr(n,e);o[r]=a};case"bracket-separator":return(r,n,o)=>{let i=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!i){o[r]=n&&zr(n,e);return}let s=n===null?[]:n.split(e.arrayFormatSeparator).map(a=>zr(a,e));if(o[r]===void 0){o[r]=s;return}o[r]=[].concat(o[r],s)};default:return(r,n,o)=>{if(o[r]===void 0){o[r]=n;return}o[r]=[].concat(o[r],n)}}}function jS(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Re(e,t){return t.encode?t.strict?Hq(e):encodeURIComponent(e):e}function zr(e,t){return t.decode?Kq(e):e}function LS(e){return Array.isArray(e)?e.sort():typeof e=="object"?LS(Object.keys(e)).sort((t,r)=>Number(t)-Number(r)).map(t=>e[t]):e}function qS(e){let t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function Yq(e){let t="",r=e.indexOf("#");return r!==-1&&(t=e.slice(r)),t}function BS(e){e=qS(e);let t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function $S(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function zS(e,t){t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t),jS(t.arrayFormatSeparator);let r=Zq(t),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(let o of e.split("&")){if(o==="")continue;let[i,s]=MS(t.decode?o.replace(/\+/g," "):o,"=");s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:zr(s,t),r(zr(i,t),s,n)}for(let o of Object.keys(n)){let i=n[o];if(typeof i=="object"&&i!==null)for(let s of Object.keys(i))i[s]=$S(i[s],t);else n[o]=$S(i,t)}return t.sort===!1?n:(t.sort===!0?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((o,i)=>{let s=n[i];return s&&typeof s=="object"&&!Array.isArray(s)?o[i]=LS(s):o[i]=s,o},Object.create(null))}vt.extract=BS;vt.parse=zS;vt.stringify=(e,t)=>{if(!e)return"";t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t),jS(t.arrayFormatSeparator);let r=s=>t.skipNull&&Gq(e[s])||t.skipEmptyString&&e[s]==="",n=Jq(t),o={};for(let s of Object.keys(e))r(s)||(o[s]=e[s]);let i=Object.keys(o);return t.sort!==!1&&i.sort(t.sort),i.map(s=>{let a=e[s];return a===void 0?"":a===null?Re(s,t):Array.isArray(a)?a.length===0&&t.arrayFormat==="bracket-separator"?Re(s,t)+"[]":a.reduce(n(s),[]).join("&"):Re(s,t)+"="+Re(a,t)}).filter(s=>s.length>0).join("&")};vt.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);let[r,n]=MS(e,"#");return Object.assign({url:r.split("?")[0]||"",query:zS(BS(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:zr(n,t)}:{})};vt.stringifyUrl=(e,t)=>{t=Object.assign({encode:!0,strict:!0,[Im]:!0},t);let r=qS(e.url).split("?")[0]||"",n=vt.extract(e.url),o=vt.parse(n,{sort:!1}),i=Object.assign(o,e.query),s=vt.stringify(i,t);s&&(s=`?${s}`);let a=Yq(e.url);return e.fragmentIdentifier&&(a=`#${t[Im]?Re(e.fragmentIdentifier,t):e.fragmentIdentifier}`),`${r}${s}${a}`};vt.pick=(e,t,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[Im]:!1},r);let{url:n,query:o,fragmentIdentifier:i}=vt.parseUrl(e,r);return vt.stringifyUrl({url:n,query:Vq(o,t),fragmentIdentifier:i},r)};vt.exclude=(e,t,r)=>{let n=Array.isArray(t)?o=>!t.includes(o):(o,i)=>!t(o,i);return vt.pick(e,n,r)}});function Gr(e,t){for(var r in t)e[r]=t[r];return e}function d_(e){var t=e.parentNode;t&&t.removeChild(e)}function H(e,t,r){var n,o,i,s={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?aa.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return ia(e,s,n,o,null)}function ia(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:o??++l_};return o==null&&q.vnode!=null&&q.vnode(i),i}function fl(){return{current:null}}function $(e){return e.children}function Dt(e,t){this.props=e,this.context=t}function sa(e,t){if(t==null)return e.__?sa(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?sa(e):null}function m_(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return m_(e)}}function Ih(e){(!e.__d&&(e.__d=!0)&&oa.push(e)&&!cl.__r++||s_!==q.debounceRendering)&&((s_=q.debounceRendering)||setTimeout)(cl)}function cl(){for(var e;cl.__r=oa.length;)e=oa.sort(function(t,r){return t.__v.__b-r.__v.__b}),oa=[],e.some(function(t){var r,n,o,i,s,a;t.__d&&(s=(i=(r=t).__v).__e,(a=r.__P)&&(n=[],(o=Gr({},i)).__v=i.__v+1,_h(a,i,o,r.__n,a.ownerSVGElement!==void 0,i.__h!=null?[s]:null,n,s??sa(i),i.__h),b_(n,i),i.__e!=s&&m_(i)))})}function h_(e,t,r,n,o,i,s,a,u,l){var c,f,p,d,h,b,y,v=n&&n.__k||p_,w=v.length;for(r.__k=[],c=0;c<t.length;c++)if((d=r.__k[c]=(d=t[c])==null||typeof d=="boolean"?null:typeof d=="string"||typeof d=="number"||typeof d=="bigint"?ia(null,d,null,null,d):Array.isArray(d)?ia($,{children:d},null,null,null):d.__b>0?ia(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)!=null){if(d.__=r,d.__b=r.__b+1,(p=v[c])===null||p&&d.key==p.key&&d.type===p.type)v[c]=void 0;else for(f=0;f<w;f++){if((p=v[f])&&d.key==p.key&&d.type===p.type){v[f]=void 0;break}p=null}_h(e,d,p=p||ul,o,i,s,a,u,l),h=d.__e,(f=d.ref)&&p.ref!=f&&(y||(y=[]),p.ref&&y.push(p.ref,null,d),y.push(f,d.__c||h,d)),h!=null?(b==null&&(b=h),typeof d.type=="function"&&d.__k===p.__k?d.__d=u=g_(d,u,e):u=y_(e,d,p,v,h,u),typeof r.type=="function"&&(r.__d=u)):u&&p.__e==u&&u.parentNode!=e&&(u=sa(p))}for(r.__e=b,c=w;c--;)v[c]!=null&&x_(v[c],v[c]);if(y)for(c=0;c<y.length;c++)v_(y[c],y[++c],y[++c])}function g_(e,t,r){for(var n,o=e.__k,i=0;o&&i<o.length;i++)(n=o[i])&&(n.__=e,t=typeof n.type=="function"?g_(n,t,r):y_(r,n,n,o,n.__e,t));return t}function kr(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(r){kr(r,t)}):t.push(e)),t}function y_(e,t,r,n,o,i){var s,a,u;if(t.__d!==void 0)s=t.__d,t.__d=void 0;else if(r==null||o!=i||o.parentNode==null)e:if(i==null||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,u=0;(a=a.nextSibling)&&u<n.length;u+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return s!==void 0?s:o.nextSibling}function Az(e,t,r,n,o){var i;for(i in r)i==="children"||i==="key"||i in t||ll(e,i,null,r[i],n);for(i in t)o&&typeof t[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||r[i]===t[i]||ll(e,i,t[i],r[i],n)}function a_(e,t,r){t[0]==="-"?e.setProperty(t,r):e[t]=r==null?"":typeof r!="number"||Oz.test(t)?r:r+"px"}function ll(e,t,r,n,o){var i;e:if(t==="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||a_(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||a_(e.style,t,r[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n||e.addEventListener(t,i?c_:u_,i):e.removeEventListener(t,i?c_:u_,i);else if(t!=="dangerouslySetInnerHTML"){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t.indexOf("-")==-1?e.removeAttribute(t):e.setAttribute(t,r))}}function u_(e){this.l[e.type+!1](q.event?q.event(e):e)}function c_(e){this.l[e.type+!0](q.event?q.event(e):e)}function _h(e,t,r,n,o,i,s,a,u){var l,c,f,p,d,h,b,y,v,w,T,M,V,J,G,K=t.type;if(t.constructor!==void 0)return null;r.__h!=null&&(u=r.__h,a=t.__e=r.__e,t.__h=null,i=[a]),(l=q.__b)&&l(t);try{e:if(typeof K=="function"){if(y=t.props,v=(l=K.contextType)&&n[l.__c],w=l?v?v.props.value:l.__:n,r.__c?b=(c=t.__c=r.__c).__=c.__E:("prototype"in K&&K.prototype.render?t.__c=c=new K(y,w):(t.__c=c=new Dt(y,w),c.constructor=K,c.render=Nz),v&&v.sub(c),c.props=y,c.state||(c.state={}),c.context=w,c.__n=n,f=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),K.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=Gr({},c.__s)),Gr(c.__s,K.getDerivedStateFromProps(y,c.__s))),p=c.props,d=c.state,f)K.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(K.getDerivedStateFromProps==null&&y!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(y,w),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(y,c.__s,w)===!1||t.__v===r.__v){for(c.props=y,c.state=c.__s,t.__v!==r.__v&&(c.__d=!1),c.__v=t,t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(P){P&&(P.__=t)}),T=0;T<c._sb.length;T++)c.__h.push(c._sb[T]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(y,c.__s,w),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,d,h)})}if(c.context=w,c.props=y,c.__v=t,c.__P=e,M=q.__r,V=0,"prototype"in K&&K.prototype.render){for(c.state=c.__s,c.__d=!1,M&&M(t),l=c.render(c.props,c.state,c.context),J=0;J<c._sb.length;J++)c.__h.push(c._sb[J]);c._sb=[]}else do c.__d=!1,M&&M(t),l=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++V<25);c.state=c.__s,c.getChildContext!=null&&(n=Gr(Gr({},n),c.getChildContext())),f||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(p,d)),G=l!=null&&l.type===$&&l.key==null?l.props.children:l,h_(e,Array.isArray(G)?G:[G],t,r,n,o,i,s,a,u),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),b&&(c.__E=c.__=null),c.__e=!1}else i==null&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=kz(r.__e,t,r,n,o,i,s,u);(l=q.diffed)&&l(t)}catch(P){t.__v=null,(u||i!=null)&&(t.__e=a,t.__h=!!u,i[i.indexOf(a)]=null),q.__e(P,t,r)}}function b_(e,t){q.__c&&q.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(n){n.call(r)})}catch(n){q.__e(n,r.__v)}})}function kz(e,t,r,n,o,i,s,a){var u,l,c,f=r.props,p=t.props,d=t.type,h=0;if(d==="svg"&&(o=!0),i!=null){for(;h<i.length;h++)if((u=i[h])&&"setAttribute"in u==!!d&&(d?u.localName===d:u.nodeType===3)){e=u,i[h]=null;break}}if(e==null){if(d===null)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),i=null,a=!1}if(d===null)f===p||a&&e.data===p||(e.data=p);else{if(i=i&&aa.call(e.childNodes),l=(f=r.props||ul).dangerouslySetInnerHTML,c=p.dangerouslySetInnerHTML,!a){if(i!=null)for(f={},h=0;h<e.attributes.length;h++)f[e.attributes[h].name]=e.attributes[h].value;(c||l)&&(c&&(l&&c.__html==l.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(Az(e,p,f,o,a),c)t.__k=[];else if(h=t.props.children,h_(e,Array.isArray(h)?h:[h],t,r,n,o&&d!=="foreignObject",i,s,i?i[0]:r.__k&&sa(r,0),a),i!=null)for(h=i.length;h--;)i[h]!=null&&d_(i[h]);a||("value"in p&&(h=p.value)!==void 0&&(h!==e.value||d==="progress"&&!h||d==="option"&&h!==f.value)&&ll(e,"value",h,f.value,!1),"checked"in p&&(h=p.checked)!==void 0&&h!==e.checked&&ll(e,"checked",h,f.checked,!1))}return e}function v_(e,t,r){try{typeof e=="function"?e(t):e.current=t}catch(n){q.__e(n,r)}}function x_(e,t,r){var n,o;if(q.unmount&&q.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||v_(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){q.__e(i,t)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&x_(n[o],t,r||typeof e.type!="function");r||e.__e==null||d_(e.__e),e.__=e.__e=e.__d=void 0}function Nz(e,t,r){return this.constructor(e,r)}function xi(e,t,r){var n,o,i;q.__&&q.__(e,t),o=(n=typeof r=="function")?null:r&&r.__k||t.__k,i=[],_h(t,e=(!n&&r||t).__k=H($,null,[e]),o||ul,ul,t.ownerSVGElement!==void 0,!n&&r?[r]:o?null:t.firstChild?aa.call(t.childNodes):null,i,!n&&r?r:o?o.__e:t.firstChild,n),b_(i,e)}function Ch(e,t){xi(e,t,Ch)}function w_(e,t,r){var n,o,i,s=Gr({},e.props);for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:s[i]=t[i];return arguments.length>2&&(s.children=arguments.length>3?aa.call(arguments,2):r),ia(e.type,s,n||e.key,o||e.ref,null)}function Le(e,t){var r={__c:t="__cC"+f_++,__:e,Consumer:function(n,o){return n.children(o)},Provider:function(n){var o,i;return this.getChildContext||(o=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(Ih)},this.sub=function(s){o.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){o.splice(o.indexOf(s),1),a&&a.call(s)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}var aa,q,l_,Tz,oa,s_,f_,ul,p_,Oz,wi=$u(()=>{ul={},p_=[],Oz=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;aa=p_.slice,q={__e:function(e,t,r,n){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},l_=0,Tz=function(e){return e!=null&&e.constructor===void 0},Dt.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Gr({},this.state),typeof e=="function"&&(e=e(Gr({},r),this.props)),e&&Gr(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ih(this))},Dt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ih(this))},Dt.prototype.render=$,oa=[],cl.__r=0,f_=0});function ho(e,t){q.__h&&q.__h(Ee,e,Ei||t),Ei=0;var r=Ee.__H||(Ee.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:pl}),r.__[e]}function j(e){return Ei=1,Nr(k_,e)}function Nr(e,t,r){var n=ho(Tn++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):k_(void 0,t),function(i){var s=n.__N?n.__N[0]:n.__[0],a=n.t(s,i);s!==a&&(n.__N=[a,n.__[1]],n.__c.setState({}))}],n.__c=Ee,!Ee.u)){Ee.u=!0;var o=Ee.shouldComponentUpdate;Ee.shouldComponentUpdate=function(i,s,a){if(!n.__c.__H)return!0;var u=n.__c.__H.__.filter(function(c){return c.__c});if(u.every(function(c){return!c.__N}))return!o||o.call(this,i,s,a);var l=!1;return u.forEach(function(c){if(c.__N){var f=c.__[0];c.__=c.__N,c.__N=void 0,f!==c.__[0]&&(l=!0)}}),!(!l&&n.__c.props===i)&&(!o||o.call(this,i,s,a))}}return n.__N||n.__}function U(e,t){var r=ho(Tn++,3);!q.__s&&Nh(r.__H,t)&&(r.__=e,r.i=t,Ee.__H.__h.push(r))}function Et(e,t){var r=ho(Tn++,4);!q.__s&&Nh(r.__H,t)&&(r.__=e,r.i=t,Ee.__h.push(r))}function F(e){return Ei=5,ne(function(){return{current:e}},[])}function Ah(e,t,r){Ei=6,Et(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function ne(e,t){var r=ho(Tn++,7);return Nh(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function Y(e,t){return Ei=8,ne(function(){return e},t)}function Q(e){var t=Ee.context[e.__c],r=ho(Tn++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(Ee)),t.props.value):e.__}function go(e,t){q.useDebugValue&&q.useDebugValue(t?t(e):e)}function Rz(e){var t=ho(Tn++,10),r=j();return t.__=e,Ee.componentDidCatch||(Ee.componentDidCatch=function(n,o){t.__&&t.__(n,o),r[1](n)}),[r[0],function(){r[1](void 0)}]}function kh(){var e=ho(Tn++,11);if(!e.__){for(var t=Ee.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function Dz(){for(var e;e=A_.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(dl),e.__H.__h.forEach(Oh),e.__H.__h=[]}catch(t){e.__H.__h=[],q.__e(t,e.__v)}}function Pz(e){var t,r=function(){clearTimeout(n),O_&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);O_&&(t=requestAnimationFrame(r))}function dl(e){var t=Ee,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Ee=t}function Oh(e){var t=Ee;e.__c=e.__(),Ee=t}function Nh(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function k_(e,t){return typeof t=="function"?t(e):t}var Tn,Ee,Th,E_,Ei,A_,pl,S_,I_,__,C_,T_,O_,Rh=$u(()=>{wi();Ei=0,A_=[],pl=[],S_=q.__b,I_=q.__r,__=q.diffed,C_=q.__c,T_=q.unmount;q.__b=function(e){Ee=null,S_&&S_(e)},q.__r=function(e){I_&&I_(e),Tn=0;var t=(Ee=e.__c).__H;t&&(Th===Ee?(t.__h=[],Ee.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=pl,r.__N=r.i=void 0})):(t.__h.forEach(dl),t.__h.forEach(Oh),t.__h=[])),Th=Ee},q.diffed=function(e){__&&__(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(A_.push(t)!==1&&E_===q.requestAnimationFrame||((E_=q.requestAnimationFrame)||Pz)(Dz)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==pl&&(r.__=r.__V),r.i=void 0,r.__V=pl})),Th=Ee=null},q.__c=function(e,t){t.some(function(r){try{r.__h.forEach(dl),r.__h=r.__h.filter(function(n){return!n.__||Oh(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],q.__e(n,r.__v)}}),C_&&C_(e,t)},q.unmount=function(e){T_&&T_(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{dl(n)}catch(o){t=o}}),r.__H=void 0,t&&q.__e(t,r.__v))};O_=typeof requestAnimationFrame=="function"});function L_(e,t){for(var r in t)e[r]=t[r];return e}function Ph(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function Dh(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function ml(e){this.props=e}function st(e,t){function r(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:Ph(this.props,o)}function n(o){return this.shouldComponentUpdate=r,H(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function Z(e){function t(r){var n=L_({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=Fz,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}function q_(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=L_({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return q_(n,t,r)})),e}function B_(e,t,r){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return B_(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=r)),e}function ua(){this.__u=0,this.t=null,this.__b=null}function z_(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function U_(e){var t,r,n;function o(i){if(t||(t=e()).then(function(s){r=s.default||s},function(s){n=s}),n)throw n;if(!r)throw t;return H(r,i)}return o.displayName="Lazy",o.__f=!0,o}function Si(){this.u=null,this.o=null}function Mz(e){return this.getChildContext=function(){return e.context},e.children}function jz(e){var t=this,r=e.i;t.componentWillUnmount=function(){xi(null,t.l),t.l=null,t.i=null},t.i&&t.i!==r&&t.componentWillUnmount(),e.__v?(t.l||(t.i=r,t.l={nodeType:1,parentNode:r,childNodes:[],appendChild:function(n){this.childNodes.push(n),t.i.appendChild(n)},insertBefore:function(n,o){this.childNodes.push(n),t.i.appendChild(n)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),t.i.removeChild(n)}}),xi(H(Mz,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function W_(e,t){var r=H(jz,{__v:e,i:t});return r.containerInfo=t,r}function K_(e,t,r){return t.__k==null&&(t.textContent=""),xi(e,t),typeof r=="function"&&r(),e?e.__c:null}function V_(e,t,r){return Ch(e,t),typeof r=="function"&&r(),e?e.__c:null}function zz(){}function Uz(){return this.cancelBubble}function Wz(){return this.defaultPrevented}function Z_(e){return H.bind(null,e)}function Pt(e){return!!e&&e.$$typeof===H_}function Xt(e){return Pt(e)?w_.apply(null,arguments):e}function Y_(e){return!!e.__k&&(xi(null,e),!0)}function X_(e){return e&&(e.base||e.nodeType===1&&e)||null}function Fh(e){e()}function tC(e){return e}function rC(){return[!1,Fh]}function oC(e,t){var r=t(),n=j({h:{__:r,v:t}}),o=n[0].h,i=n[1];return Et(function(){o.__=r,o.v=t,Dh(o.__,t())||i({h:o})},[e,r,t]),U(function(){return Dh(o.__,o.v())||i({h:o}),e(function(){Dh(o.__,o.v())||i({h:o})})},[e]),r}var N_,Fz,R_,Ve,$z,D_,P_,H_,Lz,qz,Bz,F_,G_,$_,M_,j_,J_,Hz,Q_,Rr,eC,nC,R,$h=$u(()=>{wi();wi();Rh();Rh();(ml.prototype=new Dt).isPureReactComponent=!0,ml.prototype.shouldComponentUpdate=function(e,t){return Ph(this.props,e)||Ph(this.state,t)};N_=q.__b;q.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),N_&&N_(e)};Fz=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;R_=function(e,t){return e==null?null:kr(kr(e).map(t))},Ve={map:R_,forEach:R_,count:function(e){return e?kr(e).length:0},only:function(e){var t=kr(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:kr},$z=q.__e;q.__e=function(e,t,r,n){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}$z(e,t,r,n)};D_=q.unmount;q.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),D_&&D_(e)},(ua.prototype=new Dt).__c=function(e,t){var r=t.__c,n=this;n.t==null&&(n.t=[]),n.t.push(r);var o=z_(n.__v),i=!1,s=function(){i||(i=!0,r.__R=null,o?o(a):a())};r.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=B_(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.t.pop();)c.forceUpdate()}},u=t.__h===!0;n.__u++||u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(s,s)},ua.prototype.componentWillUnmount=function(){this.t=[]},ua.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=q_(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&H($,null,e.fallback);return o&&(o.__h=null),[H($,null,t.__a?null:e.children),o]};P_=function(e,t,r){if(++r[1]===r[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(r=e.u;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.u=r=r[2]}};(Si.prototype=new Dt).__a=function(e){var t=this,r=z_(t.__v),n=t.o.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),P_(t,e,n)):o()};r?r(i):i()}},Si.prototype.render=function(e){this.u=null,this.o=new Map;var t=kr(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.o.set(t[r],this.u=[1,0,this.u]);return e.children},Si.prototype.componentDidUpdate=Si.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,r){P_(e,r,t)})};H_=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Lz=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,qz=typeof document<"u",Bz=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};Dt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Dt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});F_=q.event;q.event=function(e){return F_&&(e=F_(e)),e.persist=zz,e.isPropagationStopped=Uz,e.isDefaultPrevented=Wz,e.nativeEvent=e};$_={configurable:!0,get:function(){return this.class}},M_=q.vnode;q.vnode=function(e){var t=e.type,r=e.props,n=r;if(typeof t=="string"){var o=t.indexOf("-")===-1;for(var i in n={},r){var s=r[i];qz&&i==="children"&&t==="noscript"||i==="value"&&"defaultValue"in r&&s==null||(i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&s===!0?s="":/ondoubleclick/i.test(i)?i="ondblclick":/^onchange(textarea|input)/i.test(i+t)&&!Bz(r.type)?i="oninput":/^onfocus$/i.test(i)?i="onfocusin":/^onblur$/i.test(i)?i="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i)?i=i.toLowerCase():o&&Lz.test(i)?i=i.replace(/[A-Z0-9]/g,"-$&").toLowerCase():s===null&&(s=void 0),/^oninput$/i.test(i)&&(i=i.toLowerCase(),n[i]&&(i="oninputCapture")),n[i]=s)}t=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=kr(r.children).forEach(function(a){a.props.selected=n.value.indexOf(a.props.value)!=-1})),t=="select"&&n.defaultValue!=null&&(n.value=kr(r.children).forEach(function(a){a.props.selected=n.multiple?n.defaultValue.indexOf(a.props.value)!=-1:n.defaultValue==a.props.value})),e.props=n,r.class!=r.className&&($_.enumerable="className"in r,r.className!=null&&(n.class=r.className),Object.defineProperty(n,"className",$_))}e.$$typeof=H_,M_&&M_(e)};j_=q.__r;q.__r=function(e){j_&&j_(e),G_=e.__c};J_={ReactCurrentDispatcher:{current:{readContext:function(e){return G_.__n[e.__c].props.value}}}},Hz="17.0.2";Q_=function(e,t){return e(t)},Rr=function(e,t){return e(t)},eC=$;nC=Et;R={useState:j,useId:kh,useReducer:Nr,useEffect:U,useLayoutEffect:Et,useInsertionEffect:nC,useTransition:rC,useDeferredValue:tC,useSyncExternalStore:oC,startTransition:Fh,useRef:F,useImperativeHandle:Ah,useMemo:ne,useCallback:Y,useContext:Q,useDebugValue:go,version:"17.0.2",Children:Ve,render:K_,hydrate:V_,unmountComponentAtNode:Y_,createPortal:W_,createElement:H,createContext:Le,createFactory:Z_,cloneElement:Xt,createRef:fl,Fragment:$,isValidElement:Pt,findDOMNode:X_,Component:Dt,PureComponent:ml,memo:st,forwardRef:Z,flushSync:Rr,unstable_batchedUpdates:Q_,StrictMode:eC,Suspense:ua,SuspenseList:Si,lazy:U_,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:J_}});var lr={};Av(lr,{Children:()=>Ve,Component:()=>Dt,Fragment:()=>$,PureComponent:()=>ml,StrictMode:()=>eC,Suspense:()=>ua,SuspenseList:()=>Si,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:()=>J_,cloneElement:()=>Xt,createContext:()=>Le,createElement:()=>H,createFactory:()=>Z_,createPortal:()=>W_,createRef:()=>fl,default:()=>R,findDOMNode:()=>X_,flushSync:()=>Rr,forwardRef:()=>Z,hydrate:()=>V_,isValidElement:()=>Pt,lazy:()=>U_,memo:()=>st,render:()=>K_,startTransition:()=>Fh,unmountComponentAtNode:()=>Y_,unstable_batchedUpdates:()=>Q_,useCallback:()=>Y,useContext:()=>Q,useDebugValue:()=>go,useDeferredValue:()=>tC,useEffect:()=>U,useErrorBoundary:()=>Rz,useId:()=>kh,useImperativeHandle:()=>Ah,useInsertionEffect:()=>nC,useLayoutEffect:()=>Et,useMemo:()=>ne,useReducer:()=>Nr,useRef:()=>F,useState:()=>j,useSyncExternalStore:()=>oC,useTransition:()=>rC,version:()=>Hz});var S=$u(()=>{$h();$h()});var er=g((KT,VT)=>{"use strict";var Gl=function(e){return e&&e.Math===Math&&e};VT.exports=Gl(typeof globalThis=="object"&&globalThis)||Gl(typeof window=="object"&&window)||Gl(typeof self=="object"&&self)||Gl(typeof global=="object"&&global)||function(){return this}()||KT||Function("return this")()});var ft=g((Jbe,GT)=>{"use strict";GT.exports=function(e){try{return!!e()}catch{return!0}}});var Ta=g((Zbe,JT)=>{"use strict";var K9=ft();JT.exports=!K9(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")})});var eO=g((Ybe,QT)=>{"use strict";var V9=Ta(),XT=Function.prototype,ZT=XT.apply,YT=XT.call;QT.exports=typeof Reflect=="object"&&Reflect.apply||(V9?YT.bind(ZT):function(){return YT.apply(ZT,arguments)})});var pt=g((Xbe,nO)=>{"use strict";var tO=Ta(),rO=Function.prototype,cg=rO.call,G9=tO&&rO.bind.bind(cg,cg);nO.exports=tO?G9:function(e){return function(){return cg.apply(e,arguments)}}});var wo=g((Qbe,iO)=>{"use strict";var oO=pt(),J9=oO({}.toString),Z9=oO("".slice);iO.exports=function(e){return Z9(J9(e),8,-1)}});var lg=g((eve,sO)=>{"use strict";var Y9=wo(),X9=pt();sO.exports=function(e){if(Y9(e)==="Function")return X9(e)}});var pg=g((tve,aO)=>{"use strict";var fg=typeof document=="object"&&document.all,Q9=typeof fg>"u"&&fg!==void 0;aO.exports={all:fg,IS_HTMLDDA:Q9}});var Je=g((rve,cO)=>{"use strict";var uO=pg(),e4=uO.all;cO.exports=uO.IS_HTMLDDA?function(e){return typeof e=="function"||e===e4}:function(e){return typeof e=="function"}});var tr=g((nve,lO)=>{"use strict";var t4=ft();lO.exports=!t4(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Xr=g((ove,fO)=>{"use strict";var r4=Ta(),Jl=Function.prototype.call;fO.exports=r4?Jl.bind(Jl):function(){return Jl.apply(Jl,arguments)}});var hO=g(mO=>{"use strict";var pO={}.propertyIsEnumerable,dO=Object.getOwnPropertyDescriptor,n4=dO&&!pO.call({1:2},1);mO.f=n4?function(t){var r=dO(this,t);return!!r&&r.enumerable}:pO});var Oa=g((sve,gO)=>{"use strict";gO.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}});var mg=g((ave,yO)=>{"use strict";var o4=pt(),i4=ft(),s4=wo(),dg=Object,a4=o4("".split);yO.exports=i4(function(){return!dg("z").propertyIsEnumerable(0)})?function(e){return s4(e)==="String"?a4(e,""):dg(e)}:dg});var Di=g((uve,bO)=>{"use strict";bO.exports=function(e){return e==null}});var Aa=g((cve,vO)=>{"use strict";var u4=Di(),c4=TypeError;vO.exports=function(e){if(u4(e))throw c4("Can't call method on "+e);return e}});var Pi=g((lve,xO)=>{"use strict";var l4=mg(),f4=Aa();xO.exports=function(e){return l4(f4(e))}});var fr=g((fve,SO)=>{"use strict";var wO=Je(),EO=pg(),p4=EO.all;SO.exports=EO.IS_HTMLDDA?function(e){return typeof e=="object"?e!==null:wO(e)||e===p4}:function(e){return typeof e=="object"?e!==null:wO(e)}});var ka=g((pve,IO)=>{"use strict";IO.exports={}});var Eo=g((dve,CO)=>{"use strict";var hg=ka(),gg=er(),d4=Je(),_O=function(e){return d4(e)?e:void 0};CO.exports=function(e,t){return arguments.length<2?_O(hg[e])||_O(gg[e]):hg[e]&&hg[e][t]||gg[e]&&gg[e][t]}});var Zl=g((mve,TO)=>{"use strict";var m4=pt();TO.exports=m4({}.isPrototypeOf)});var AO=g((hve,OO)=>{"use strict";OO.exports=typeof navigator<"u"&&String(navigator.userAgent)||""});var $O=g((gve,FO)=>{"use strict";var PO=er(),yg=AO(),kO=PO.process,NO=PO.Deno,RO=kO&&kO.versions||NO&&NO.version,DO=RO&&RO.v8,pr,Yl;DO&&(pr=DO.split("."),Yl=pr[0]>0&&pr[0]<4?1:+(pr[0]+pr[1]));!Yl&&yg&&(pr=yg.match(/Edge\/(\d+)/),(!pr||pr[1]>=74)&&(pr=yg.match(/Chrome\/(\d+)/),pr&&(Yl=+pr[1])));FO.exports=Yl});var bg=g((yve,jO)=>{"use strict";var MO=$O(),h4=ft(),g4=er(),y4=g4.String;jO.exports=!!Object.getOwnPropertySymbols&&!h4(function(){var e=Symbol("symbol detection");return!y4(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&MO&&MO<41})});var vg=g((bve,LO)=>{"use strict";var b4=bg();LO.exports=b4&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var xg=g((vve,qO)=>{"use strict";var v4=Eo(),x4=Je(),w4=Zl(),E4=vg(),S4=Object;qO.exports=E4?function(e){return typeof e=="symbol"}:function(e){var t=v4("Symbol");return x4(t)&&w4(t.prototype,S4(e))}});var Xl=g((xve,BO)=>{"use strict";var I4=String;BO.exports=function(e){try{return I4(e)}catch{return"Object"}}});var So=g((wve,zO)=>{"use strict";var _4=Je(),C4=Xl(),T4=TypeError;zO.exports=function(e){if(_4(e))return e;throw T4(C4(e)+" is not a function")}});var Ql=g((Eve,UO)=>{"use strict";var O4=So(),A4=Di();UO.exports=function(e,t){var r=e[t];return A4(r)?void 0:O4(r)}});var HO=g((Sve,WO)=>{"use strict";var wg=Xr(),Eg=Je(),Sg=fr(),k4=TypeError;WO.exports=function(e,t){var r,n;if(t==="string"&&Eg(r=e.toString)&&!Sg(n=wg(r,e))||Eg(r=e.valueOf)&&!Sg(n=wg(r,e))||t!=="string"&&Eg(r=e.toString)&&!Sg(n=wg(r,e)))return n;throw k4("Can't convert object to primitive value")}});var Na=g((Ive,KO)=>{"use strict";KO.exports=!0});var JO=g((_ve,GO)=>{"use strict";var VO=er(),N4=Object.defineProperty;GO.exports=function(e,t){try{N4(VO,e,{value:t,configurable:!0,writable:!0})}catch{VO[e]=t}return t}});var ef=g((Cve,YO)=>{"use strict";var R4=er(),D4=JO(),ZO="__core-js_shared__",P4=R4[ZO]||D4(ZO,{});YO.exports=P4});var Ig=g((Tve,QO)=>{"use strict";var F4=Na(),XO=ef();(QO.exports=function(e,t){return XO[e]||(XO[e]=t!==void 0?t:{})})("versions",[]).push({version:"3.32.1",mode:F4?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"})});var tf=g((Ove,eA)=>{"use strict";var $4=Aa(),M4=Object;eA.exports=function(e){return M4($4(e))}});var Fr=g((Ave,tA)=>{"use strict";var j4=pt(),L4=tf(),q4=j4({}.hasOwnProperty);tA.exports=Object.hasOwn||function(t,r){return q4(L4(t),r)}});var rf=g((kve,rA)=>{"use strict";var B4=pt(),z4=0,U4=Math.random(),W4=B4(1 .toString);rA.exports=function(e){return"Symbol("+(e===void 0?"":e)+")_"+W4(++z4+U4,36)}});var dr=g((Nve,oA)=>{"use strict";var H4=er(),K4=Ig(),nA=Fr(),V4=rf(),G4=bg(),J4=vg(),Fi=H4.Symbol,_g=K4("wks"),Z4=J4?Fi.for||Fi:Fi&&Fi.withoutSetter||V4;oA.exports=function(e){return nA(_g,e)||(_g[e]=G4&&nA(Fi,e)?Fi[e]:Z4("Symbol."+e)),_g[e]}});var uA=g((Rve,aA)=>{"use strict";var Y4=Xr(),iA=fr(),sA=xg(),X4=Ql(),Q4=HO(),e8=dr(),t8=TypeError,r8=e8("toPrimitive");aA.exports=function(e,t){if(!iA(e)||sA(e))return e;var r=X4(e,r8),n;if(r){if(t===void 0&&(t="default"),n=Y4(r,e,t),!iA(n)||sA(n))return n;throw t8("Can't convert object to primitive value")}return t===void 0&&(t="number"),Q4(e,t)}});var Ra=g((Dve,cA)=>{"use strict";var n8=uA(),o8=xg();cA.exports=function(e){var t=n8(e,"string");return o8(t)?t:t+""}});var Tg=g((Pve,fA)=>{"use strict";var i8=er(),lA=fr(),Cg=i8.document,s8=lA(Cg)&&lA(Cg.createElement);fA.exports=function(e){return s8?Cg.createElement(e):{}}});var Og=g((Fve,pA)=>{"use strict";var a8=tr(),u8=ft(),c8=Tg();pA.exports=!a8&&!u8(function(){return Object.defineProperty(c8("div"),"a",{get:function(){return 7}}).a!==7})});var hA=g(mA=>{"use strict";var l8=tr(),f8=Xr(),p8=hO(),d8=Oa(),m8=Pi(),h8=Ra(),g8=Fr(),y8=Og(),dA=Object.getOwnPropertyDescriptor;mA.f=l8?dA:function(t,r){if(t=m8(t),r=h8(r),y8)try{return dA(t,r)}catch{}if(g8(t,r))return d8(!f8(p8.f,t,r),t[r])}});var yA=g((Mve,gA)=>{"use strict";var b8=ft(),v8=Je(),x8=/#|\.prototype\./,Da=function(e,t){var r=E8[w8(e)];return r===I8?!0:r===S8?!1:v8(t)?b8(t):!!t},w8=Da.normalize=function(e){return String(e).replace(x8,".").toLowerCase()},E8=Da.data={},S8=Da.NATIVE="N",I8=Da.POLYFILL="P";gA.exports=Da});var Pa=g((jve,vA)=>{"use strict";var bA=lg(),_8=So(),C8=Ta(),T8=bA(bA.bind);vA.exports=function(e,t){return _8(e),t===void 0?e:C8?T8(e,t):function(){return e.apply(t,arguments)}}});var Ag=g((Lve,xA)=>{"use strict";var O8=tr(),A8=ft();xA.exports=O8&&A8(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Nn=g((qve,wA)=>{"use strict";var k8=fr(),N8=String,R8=TypeError;wA.exports=function(e){if(k8(e))return e;throw R8(N8(e)+" is not an object")}});var Rn=g(SA=>{"use strict";var D8=tr(),P8=Og(),F8=Ag(),nf=Nn(),EA=Ra(),$8=TypeError,kg=Object.defineProperty,M8=Object.getOwnPropertyDescriptor,Ng="enumerable",Rg="configurable",Dg="writable";SA.f=D8?F8?function(t,r,n){if(nf(t),r=EA(r),nf(n),typeof t=="function"&&r==="prototype"&&"value"in n&&Dg in n&&!n[Dg]){var o=M8(t,r);o&&o[Dg]&&(t[r]=n.value,n={configurable:Rg in n?n[Rg]:o[Rg],enumerable:Ng in n?n[Ng]:o[Ng],writable:!1})}return kg(t,r,n)}:kg:function(t,r,n){if(nf(t),r=EA(r),nf(n),P8)try{return kg(t,r,n)}catch{}if("get"in n||"set"in n)throw $8("Accessors not supported");return"value"in n&&(t[r]=n.value),t}});var Io=g((zve,IA)=>{"use strict";var j8=tr(),L8=Rn(),q8=Oa();IA.exports=j8?function(e,t,r){return L8.f(e,t,q8(1,r))}:function(e,t,r){return e[t]=r,e}});var _o=g((Uve,CA)=>{"use strict";var of=er(),B8=eO(),z8=lg(),U8=Je(),W8=hA().f,H8=yA(),$i=ka(),K8=Pa(),Mi=Io(),_A=Fr(),V8=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return B8(e,this,arguments)};return t.prototype=e.prototype,t};CA.exports=function(e,t){var r=e.target,n=e.global,o=e.stat,i=e.proto,s=n?of:o?of[r]:(of[r]||{}).prototype,a=n?$i:$i[r]||Mi($i,r,{})[r],u=a.prototype,l,c,f,p,d,h,b,y,v;for(p in t)l=H8(n?p:r+(o?".":"#")+p,e.forced),c=!l&&s&&_A(s,p),h=a[p],c&&(e.dontCallGetSet?(v=W8(s,p),b=v&&v.value):b=s[p]),d=c&&b?b:t[p],!(c&&typeof h==typeof d)&&(e.bind&&c?y=K8(d,of):e.wrap&&c?y=V8(d):i&&U8(d)?y=z8(d):y=d,(e.sham||d&&d.sham||h&&h.sham)&&Mi(y,"sham",!0),Mi(a,p,y),i&&(f=r+"Prototype",_A($i,f)||Mi($i,f,{}),Mi($i[f],p,d),e.real&&u&&(l||!u[p])&&Mi(u,p,d)))}});var Fa=g((Wve,TA)=>{"use strict";TA.exports={}});var AA=g((Hve,OA)=>{"use strict";var G8=Math.ceil,J8=Math.floor;OA.exports=Math.trunc||function(t){var r=+t;return(r>0?J8:G8)(r)}});var Pg=g((Kve,kA)=>{"use strict";var Z8=AA();kA.exports=function(e){var t=+e;return t!==t||t===0?0:Z8(t)}});var Fg=g((Vve,NA)=>{"use strict";var Y8=Pg(),X8=Math.max,Q8=Math.min;NA.exports=function(e,t){var r=Y8(e);return r<0?X8(r+t,0):Q8(r,t)}});var DA=g((Gve,RA)=>{"use strict";var eU=Pg(),tU=Math.min;RA.exports=function(e){return e>0?tU(eU(e),9007199254740991):0}});var $a=g((Jve,PA)=>{"use strict";var rU=DA();PA.exports=function(e){return rU(e.length)}});var MA=g((Zve,$A)=>{"use strict";var nU=Pi(),oU=Fg(),iU=$a(),FA=function(e){return function(t,r,n){var o=nU(t),i=iU(o),s=oU(n,i),a;if(e&&r!==r){for(;i>s;)if(a=o[s++],a!==a)return!0}else for(;i>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}};$A.exports={includes:FA(!0),indexOf:FA(!1)}});var Mg=g((Yve,LA)=>{"use strict";var sU=pt(),$g=Fr(),aU=Pi(),uU=MA().indexOf,cU=Fa(),jA=sU([].push);LA.exports=function(e,t){var r=aU(e),n=0,o=[],i;for(i in r)!$g(cU,i)&&$g(r,i)&&jA(o,i);for(;t.length>n;)$g(r,i=t[n++])&&(~uU(o,i)||jA(o,i));return o}});var sf=g((Xve,qA)=>{"use strict";qA.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var jg=g(BA=>{"use strict";var lU=Mg(),fU=sf(),pU=fU.concat("length","prototype");BA.f=Object.getOwnPropertyNames||function(t){return lU(t,pU)}});var UA=g((e0e,zA)=>{"use strict";var dU=Ra(),mU=Rn(),hU=Oa();zA.exports=function(e,t,r){var n=dU(t);n in e?mU.f(e,n,hU(0,r)):e[n]=r}});var KA=g((t0e,HA)=>{"use strict";var WA=Fg(),gU=$a(),yU=UA(),bU=Array,vU=Math.max;HA.exports=function(e,t,r){for(var n=gU(e),o=WA(t,n),i=WA(r===void 0?n:r,n),s=bU(vU(i-o,0)),a=0;o<i;o++,a++)yU(s,a,e[o]);return s.length=a,s}});var ZA=g((r0e,JA)=>{"use strict";var xU=wo(),wU=Pi(),VA=jg().f,EU=KA(),GA=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],SU=function(e){try{return VA(e)}catch{return EU(GA)}};JA.exports.f=function(t){return GA&&xU(t)==="Window"?SU(t):VA(wU(t))}});var XA=g((n0e,YA)=>{"use strict";var IU=ft();YA.exports=IU(function(){if(typeof ArrayBuffer=="function"){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})});var tk=g((o0e,ek)=>{"use strict";var _U=ft(),CU=fr(),TU=wo(),QA=XA(),af=Object.isExtensible,OU=_U(function(){af(1)});ek.exports=OU||QA?function(t){return!CU(t)||QA&&TU(t)==="ArrayBuffer"?!1:af?af(t):!0}:af});var nk=g((i0e,rk)=>{"use strict";var AU=ft();rk.exports=!AU(function(){return Object.isExtensible(Object.preventExtensions({}))})});var zg=g((s0e,sk)=>{"use strict";var kU=_o(),NU=pt(),RU=Fa(),DU=fr(),Lg=Fr(),PU=Rn().f,ok=jg(),FU=ZA(),qg=tk(),$U=rf(),MU=nk(),ik=!1,Qr=$U("meta"),jU=0,Bg=function(e){PU(e,Qr,{value:{objectID:"O"+jU++,weakData:{}}})},LU=function(e,t){if(!DU(e))return typeof e=="symbol"?e:(typeof e=="string"?"S":"P")+e;if(!Lg(e,Qr)){if(!qg(e))return"F";if(!t)return"E";Bg(e)}return e[Qr].objectID},qU=function(e,t){if(!Lg(e,Qr)){if(!qg(e))return!0;if(!t)return!1;Bg(e)}return e[Qr].weakData},BU=function(e){return MU&&ik&&qg(e)&&!Lg(e,Qr)&&Bg(e),e},zU=function(){UU.enable=function(){},ik=!0;var e=ok.f,t=NU([].splice),r={};r[Qr]=1,e(r).length&&(ok.f=function(n){for(var o=e(n),i=0,s=o.length;i<s;i++)if(o[i]===Qr){t(o,i,1);break}return o},kU({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:FU.f}))},UU=sk.exports={enable:zU,fastKey:LU,getWeakData:qU,onFreeze:BU};RU[Qr]=!0});var Ma=g((a0e,ak)=>{"use strict";ak.exports={}});var ck=g((u0e,uk)=>{"use strict";var WU=dr(),HU=Ma(),KU=WU("iterator"),VU=Array.prototype;uk.exports=function(e){return e!==void 0&&(HU.Array===e||VU[KU]===e)}});var uf=g((c0e,fk)=>{"use strict";var GU=dr(),JU=GU("toStringTag"),lk={};lk[JU]="z";fk.exports=String(lk)==="[object z]"});var lf=g((l0e,pk)=>{"use strict";var ZU=uf(),YU=Je(),cf=wo(),XU=dr(),QU=XU("toStringTag"),eW=Object,tW=cf(function(){return arguments}())==="Arguments",rW=function(e,t){try{return e[t]}catch{}};pk.exports=ZU?cf:function(e){var t,r,n;return e===void 0?"Undefined":e===null?"Null":typeof(r=rW(t=eW(e),QU))=="string"?r:tW?cf(t):(n=cf(t))==="Object"&&YU(t.callee)?"Arguments":n}});var Ug=g((f0e,mk)=>{"use strict";var nW=lf(),dk=Ql(),oW=Di(),iW=Ma(),sW=dr(),aW=sW("iterator");mk.exports=function(e){if(!oW(e))return dk(e,aW)||dk(e,"@@iterator")||iW[nW(e)]}});var gk=g((p0e,hk)=>{"use strict";var uW=Xr(),cW=So(),lW=Nn(),fW=Xl(),pW=Ug(),dW=TypeError;hk.exports=function(e,t){var r=arguments.length<2?pW(e):t;if(cW(r))return lW(uW(r,e));throw dW(fW(e)+" is not iterable")}});var vk=g((d0e,bk)=>{"use strict";var mW=Xr(),yk=Nn(),hW=Ql();bk.exports=function(e,t,r){var n,o;yk(e);try{if(n=hW(e,"return"),!n){if(t==="throw")throw r;return r}n=mW(n,e)}catch(i){o=!0,n=i}if(t==="throw")throw r;if(o)throw n;return yk(n),r}});var ja=g((m0e,Sk)=>{"use strict";var gW=Pa(),yW=Xr(),bW=Nn(),vW=Xl(),xW=ck(),wW=$a(),xk=Zl(),EW=gk(),SW=Ug(),wk=vk(),IW=TypeError,ff=function(e,t){this.stopped=e,this.result=t},Ek=ff.prototype;Sk.exports=function(e,t,r){var n=r&&r.that,o=!!(r&&r.AS_ENTRIES),i=!!(r&&r.IS_RECORD),s=!!(r&&r.IS_ITERATOR),a=!!(r&&r.INTERRUPTED),u=gW(t,n),l,c,f,p,d,h,b,y=function(w){return l&&wk(l,"normal",w),new ff(!0,w)},v=function(w){return o?(bW(w),a?u(w[0],w[1],y):u(w[0],w[1])):a?u(w,y):u(w)};if(i)l=e.iterator;else if(s)l=e;else{if(c=SW(e),!c)throw IW(vW(e)+" is not iterable");if(xW(c)){for(f=0,p=wW(e);p>f;f++)if(d=v(e[f]),d&&xk(Ek,d))return d;return new ff(!1)}l=EW(e,c)}for(h=i?e.next:l.next;!(b=yW(h,l)).done;){try{d=v(b.value)}catch(w){wk(l,"throw",w)}if(typeof d=="object"&&d&&xk(Ek,d))return d}return new ff(!1)}});var Wg=g((h0e,Ik)=>{"use strict";var _W=Zl(),CW=TypeError;Ik.exports=function(e,t){if(_W(t,e))return e;throw CW("Incorrect invocation")}});var Ck=g((g0e,_k)=>{"use strict";var TW=uf(),OW=lf();_k.exports=TW?{}.toString:function(){return"[object "+OW(this)+"]"}});var pf=g((y0e,Ok)=>{"use strict";var AW=uf(),kW=Rn().f,NW=Io(),RW=Fr(),DW=Ck(),PW=dr(),Tk=PW("toStringTag");Ok.exports=function(e,t,r,n){if(e){var o=r?e:e.prototype;RW(o,Tk)||kW(o,Tk,{configurable:!0,value:t}),n&&!AW&&NW(o,"toString",DW)}}});var kk=g((b0e,Ak)=>{"use strict";var FW=wo();Ak.exports=Array.isArray||function(t){return FW(t)==="Array"}});var Rk=g((v0e,Nk)=>{"use strict";var $W=pt(),MW=Je(),Hg=ef(),jW=$W(Function.toString);MW(Hg.inspectSource)||(Hg.inspectSource=function(e){return jW(e)});Nk.exports=Hg.inspectSource});var jk=g((x0e,Mk)=>{"use strict";var LW=pt(),qW=ft(),Dk=Je(),BW=lf(),zW=Eo(),UW=Rk(),Pk=function(){},WW=[],Fk=zW("Reflect","construct"),Kg=/^\s*(?:class|function)\b/,HW=LW(Kg.exec),KW=!Kg.exec(Pk),La=function(t){if(!Dk(t))return!1;try{return Fk(Pk,WW,t),!0}catch{return!1}},$k=function(t){if(!Dk(t))return!1;switch(BW(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return KW||!!HW(Kg,UW(t))}catch{return!0}};$k.sham=!0;Mk.exports=!Fk||qW(function(){var e;return La(La.call)||!La(Object)||!La(function(){e=!0})||e})?$k:La});var zk=g((w0e,Bk)=>{"use strict";var Lk=kk(),VW=jk(),GW=fr(),JW=dr(),ZW=JW("species"),qk=Array;Bk.exports=function(e){var t;return Lk(e)&&(t=e.constructor,VW(t)&&(t===qk||Lk(t.prototype))?t=void 0:GW(t)&&(t=t[ZW],t===null&&(t=void 0))),t===void 0?qk:t}});var Wk=g((E0e,Uk)=>{"use strict";var YW=zk();Uk.exports=function(e,t){return new(YW(e))(t===0?0:t)}});var Vk=g((S0e,Kk)=>{"use strict";var XW=Pa(),QW=pt(),e7=mg(),t7=tf(),r7=$a(),n7=Wk(),Hk=QW([].push),Dn=function(e){var t=e===1,r=e===2,n=e===3,o=e===4,i=e===6,s=e===7,a=e===5||i;return function(u,l,c,f){for(var p=t7(u),d=e7(p),h=XW(l,c),b=r7(d),y=0,v=f||n7,w=t?v(u,b):r||s?v(u,0):void 0,T,M;b>y;y++)if((a||y in d)&&(T=d[y],M=h(T,y,p),e))if(t)w[y]=M;else if(M)switch(e){case 3:return!0;case 5:return T;case 6:return y;case 2:Hk(w,T)}else switch(e){case 4:return!1;case 7:Hk(w,T)}return i?-1:n||o?o:w}};Kk.exports={forEach:Dn(0),map:Dn(1),filter:Dn(2),some:Dn(3),every:Dn(4),find:Dn(5),findIndex:Dn(6),filterReject:Dn(7)}});var Zk=g((I0e,Jk)=>{"use strict";var o7=er(),i7=Je(),Gk=o7.WeakMap;Jk.exports=i7(Gk)&&/native code/.test(String(Gk))});var df=g((_0e,Xk)=>{"use strict";var s7=Ig(),a7=rf(),Yk=s7("keys");Xk.exports=function(e){return Yk[e]||(Yk[e]=a7(e))}});var Zg=g((C0e,tN)=>{"use strict";var u7=Zk(),eN=er(),c7=fr(),l7=Io(),Vg=Fr(),Gg=ef(),f7=df(),p7=Fa(),Qk="Object already initialized",Jg=eN.TypeError,d7=eN.WeakMap,mf,qa,hf,m7=function(e){return hf(e)?qa(e):mf(e,{})},h7=function(e){return function(t){var r;if(!c7(t)||(r=qa(t)).type!==e)throw Jg("Incompatible receiver, "+e+" required");return r}};u7||Gg.state?(mr=Gg.state||(Gg.state=new d7),mr.get=mr.get,mr.has=mr.has,mr.set=mr.set,mf=function(e,t){if(mr.has(e))throw Jg(Qk);return t.facade=e,mr.set(e,t),t},qa=function(e){return mr.get(e)||{}},hf=function(e){return mr.has(e)}):(Co=f7("state"),p7[Co]=!0,mf=function(e,t){if(Vg(e,Co))throw Jg(Qk);return t.facade=e,l7(e,Co,t),t},qa=function(e){return Vg(e,Co)?e[Co]:{}},hf=function(e){return Vg(e,Co)});var mr,Co;tN.exports={set:mf,get:qa,has:hf,enforce:m7,getterFor:h7}});var oN=g((T0e,nN)=>{"use strict";var g7=_o(),y7=er(),b7=zg(),v7=ft(),x7=Io(),w7=ja(),E7=Wg(),S7=Je(),I7=fr(),_7=Di(),C7=pf(),T7=Rn().f,O7=Vk().forEach,A7=tr(),rN=Zg(),k7=rN.set,N7=rN.getterFor;nN.exports=function(e,t,r){var n=e.indexOf("Map")!==-1,o=e.indexOf("Weak")!==-1,i=n?"set":"add",s=y7[e],a=s&&s.prototype,u={},l;if(!A7||!S7(s)||!(o||a.forEach&&!v7(function(){new s().entries().next()})))l=r.getConstructor(t,e,n,i),b7.enable();else{l=t(function(p,d){k7(E7(p,c),{type:e,collection:new s}),_7(d)||w7(d,p[i],{that:p,AS_ENTRIES:n})});var c=l.prototype,f=N7(e);O7(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(p){var d=p==="add"||p==="set";p in a&&!(o&&p==="clear")&&x7(c,p,function(h,b){var y=f(this).collection;if(!d&&o&&!I7(h))return p==="get"?void 0:!1;var v=y[p](h===0?0:h,b);return d?this:v})}),o||T7(c,"size",{configurable:!0,get:function(){return f(this).collection.size}})}return C7(l,e,!1,!0),u[e]=l,g7({global:!0,forced:!0},u),o||r.setStrong(l,e,n),l}});var sN=g((O0e,iN)=>{"use strict";var R7=Mg(),D7=sf();iN.exports=Object.keys||function(t){return R7(t,D7)}});var uN=g(aN=>{"use strict";var P7=tr(),F7=Ag(),$7=Rn(),M7=Nn(),j7=Pi(),L7=sN();aN.f=P7&&!F7?Object.defineProperties:function(t,r){M7(t);for(var n=j7(r),o=L7(r),i=o.length,s=0,a;i>s;)$7.f(t,a=o[s++],n[a]);return t}});var lN=g((k0e,cN)=>{"use strict";var q7=Eo();cN.exports=q7("document","documentElement")});var Ba=g((N0e,yN)=>{"use strict";var B7=Nn(),z7=uN(),fN=sf(),U7=Fa(),W7=lN(),H7=Tg(),K7=df(),pN=">",dN="<",Xg="prototype",Qg="script",hN=K7("IE_PROTO"),Yg=function(){},gN=function(e){return dN+Qg+pN+e+dN+"/"+Qg+pN},mN=function(e){e.write(gN("")),e.close();var t=e.parentWindow.Object;return e=null,t},V7=function(){var e=H7("iframe"),t="java"+Qg+":",r;return e.style.display="none",W7.appendChild(e),e.src=String(t),r=e.contentWindow.document,r.open(),r.write(gN("document.F=Object")),r.close(),r.F},gf,yf=function(){try{gf=new ActiveXObject("htmlfile")}catch{}yf=typeof document<"u"?document.domain&&gf?mN(gf):V7():mN(gf);for(var e=fN.length;e--;)delete yf[Xg][fN[e]];return yf()};U7[hN]=!0;yN.exports=Object.create||function(t,r){var n;return t!==null?(Yg[Xg]=B7(t),n=new Yg,Yg[Xg]=null,n[hN]=t):n=yf(),r===void 0?n:z7.f(n,r)}});var ey=g((R0e,bN)=>{"use strict";var G7=Rn();bN.exports=function(e,t,r){return G7.f(e,t,r)}});var bf=g((D0e,vN)=>{"use strict";var J7=Io();vN.exports=function(e,t,r,n){return n&&n.enumerable?e[t]=r:J7(e,t,r),e}});var wN=g((P0e,xN)=>{"use strict";var Z7=bf();xN.exports=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:Z7(e,n,t[n],r);return e}});var IN=g((F0e,SN)=>{"use strict";var ty=tr(),Y7=Fr(),EN=Function.prototype,X7=ty&&Object.getOwnPropertyDescriptor,ry=Y7(EN,"name"),Q7=ry&&function(){}.name==="something",eH=ry&&(!ty||ty&&X7(EN,"name").configurable);SN.exports={EXISTS:ry,PROPER:Q7,CONFIGURABLE:eH}});var CN=g(($0e,_N)=>{"use strict";var tH=ft();_N.exports=!tH(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})});var oy=g((M0e,ON)=>{"use strict";var rH=Fr(),nH=Je(),oH=tf(),iH=df(),sH=CN(),TN=iH("IE_PROTO"),ny=Object,aH=ny.prototype;ON.exports=sH?ny.getPrototypeOf:function(e){var t=oH(e);if(rH(t,TN))return t[TN];var r=t.constructor;return nH(r)&&t instanceof r?r.prototype:t instanceof ny?aH:null}});var uy=g((j0e,NN)=>{"use strict";var uH=ft(),cH=Je(),lH=fr(),fH=Ba(),AN=oy(),pH=bf(),dH=dr(),mH=Na(),ay=dH("iterator"),kN=!1,en,iy,sy;[].keys&&(sy=[].keys(),"next"in sy?(iy=AN(AN(sy)),iy!==Object.prototype&&(en=iy)):kN=!0);var hH=!lH(en)||uH(function(){var e={};return en[ay].call(e)!==e});hH?en={}:mH&&(en=fH(en));cH(en[ay])||pH(en,ay,function(){return this});NN.exports={IteratorPrototype:en,BUGGY_SAFARI_ITERATORS:kN}});var DN=g((L0e,RN)=>{"use strict";var gH=uy().IteratorPrototype,yH=Ba(),bH=Oa(),vH=pf(),xH=Ma(),wH=function(){return this};RN.exports=function(e,t,r,n){var o=t+" Iterator";return e.prototype=yH(gH,{next:bH(+!n,r)}),vH(e,o,!1,!0),xH[o]=wH,e}});var FN=g((q0e,PN)=>{"use strict";var EH=pt(),SH=So();PN.exports=function(e,t,r){try{return EH(SH(Object.getOwnPropertyDescriptor(e,t)[r]))}catch{}}});var MN=g((B0e,$N)=>{"use strict";var IH=Je(),_H=String,CH=TypeError;$N.exports=function(e){if(typeof e=="object"||IH(e))return e;throw CH("Can't set "+_H(e)+" as a prototype")}});var LN=g((z0e,jN)=>{"use strict";var TH=FN(),OH=Nn(),AH=MN();jN.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e=!1,t={},r;try{r=TH(Object.prototype,"__proto__","set"),r(t,[]),e=t instanceof Array}catch{}return function(o,i){return OH(o),AH(i),e?r(o,i):o.__proto__=i,o}}():void 0)});var ZN=g((U0e,JN)=>{"use strict";var kH=_o(),NH=Xr(),vf=Na(),VN=IN(),RH=Je(),DH=DN(),qN=oy(),BN=LN(),PH=pf(),FH=Io(),cy=bf(),$H=dr(),zN=Ma(),GN=uy(),MH=VN.PROPER,jH=VN.CONFIGURABLE,UN=GN.IteratorPrototype,xf=GN.BUGGY_SAFARI_ITERATORS,za=$H("iterator"),WN="keys",Ua="values",HN="entries",KN=function(){return this};JN.exports=function(e,t,r,n,o,i,s){DH(r,t,n);var a=function(v){if(v===o&&p)return p;if(!xf&&v in c)return c[v];switch(v){case WN:return function(){return new r(this,v)};case Ua:return function(){return new r(this,v)};case HN:return function(){return new r(this,v)}}return function(){return new r(this)}},u=t+" Iterator",l=!1,c=e.prototype,f=c[za]||c["@@iterator"]||o&&c[o],p=!xf&&f||a(o),d=t==="Array"&&c.entries||f,h,b,y;if(d&&(h=qN(d.call(new e)),h!==Object.prototype&&h.next&&(!vf&&qN(h)!==UN&&(BN?BN(h,UN):RH(h[za])||cy(h,za,KN)),PH(h,u,!0,!0),vf&&(zN[u]=KN))),MH&&o===Ua&&f&&f.name!==Ua&&(!vf&&jH?FH(c,"name",Ua):(l=!0,p=function(){return NH(f,this)})),o)if(b={values:a(Ua),keys:i?p:a(WN),entries:a(HN)},s)for(y in b)(xf||l||!(y in c))&&cy(c,y,b[y]);else kH({target:t,proto:!0,forced:xf||l},b);return(!vf||s)&&c[za]!==p&&cy(c,za,p,{name:o}),zN[t]=p,b}});var XN=g((W0e,YN)=>{"use strict";YN.exports=function(e,t){return{value:e,done:t}}});var tR=g((H0e,eR)=>{"use strict";var LH=Eo(),qH=ey(),BH=dr(),zH=tr(),QN=BH("species");eR.exports=function(e){var t=LH(e);zH&&t&&!t[QN]&&qH(t,QN,{configurable:!0,get:function(){return this}})}});var aR=g((K0e,sR)=>{"use strict";var UH=Ba(),WH=ey(),rR=wN(),HH=Pa(),KH=Wg(),VH=Di(),GH=ja(),JH=ZN(),wf=XN(),ZH=tR(),Wa=tr(),nR=zg().fastKey,iR=Zg(),oR=iR.set,ly=iR.getterFor;sR.exports={getConstructor:function(e,t,r,n){var o=e(function(l,c){KH(l,i),oR(l,{type:t,index:UH(null),first:void 0,last:void 0,size:0}),Wa||(l.size=0),VH(c)||GH(c,l[n],{that:l,AS_ENTRIES:r})}),i=o.prototype,s=ly(t),a=function(l,c,f){var p=s(l),d=u(l,c),h,b;return d?d.value=f:(p.last=d={index:b=nR(c,!0),key:c,value:f,previous:h=p.last,next:void 0,removed:!1},p.first||(p.first=d),h&&(h.next=d),Wa?p.size++:l.size++,b!=="F"&&(p.index[b]=d)),l},u=function(l,c){var f=s(l),p=nR(c),d;if(p!=="F")return f.index[p];for(d=f.first;d;d=d.next)if(d.key===c)return d};return rR(i,{clear:function(){for(var c=this,f=s(c),p=f.index,d=f.first;d;)d.removed=!0,d.previous&&(d.previous=d.previous.next=void 0),delete p[d.index],d=d.next;f.first=f.last=void 0,Wa?f.size=0:c.size=0},delete:function(l){var c=this,f=s(c),p=u(c,l);if(p){var d=p.next,h=p.previous;delete f.index[p.index],p.removed=!0,h&&(h.next=d),d&&(d.previous=h),f.first===p&&(f.first=d),f.last===p&&(f.last=h),Wa?f.size--:c.size--}return!!p},forEach:function(c){for(var f=s(this),p=HH(c,arguments.length>1?arguments[1]:void 0),d;d=d?d.next:f.first;)for(p(d.value,d.key,this);d&&d.removed;)d=d.previous},has:function(c){return!!u(this,c)}}),rR(i,r?{get:function(c){var f=u(this,c);return f&&f.value},set:function(c,f){return a(this,c===0?0:c,f)}}:{add:function(c){return a(this,c=c===0?0:c,c)}}),Wa&&WH(i,"size",{configurable:!0,get:function(){return s(this).size}}),o},setStrong:function(e,t,r){var n=t+" Iterator",o=ly(t),i=ly(n);JH(e,t,function(s,a){oR(this,{type:n,target:s,state:o(s),kind:a,last:void 0})},function(){for(var s=i(this),a=s.kind,u=s.last;u&&u.removed;)u=u.previous;return!s.target||!(s.last=u=u?u.next:s.state.first)?(s.target=void 0,wf(void 0,!0)):wf(a==="keys"?u.key:a==="values"?u.value:[u.key,u.value],!1)},r?"entries":"values",!r,!0),ZH(t)}}});var uR=g(()=>{"use strict";var YH=oN(),XH=aR();YH("Map",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},XH)});var cR=g(()=>{"use strict";uR()});var fR=g((Y0e,lR)=>{"use strict";lR.exports=function(e,t){return t===1?function(r,n){return r[e](n)}:function(r,n,o){return r[e](n,o)}}});var mR=g((X0e,dR)=>{"use strict";var QH=Eo(),Ef=fR(),pR=QH("Map");dR.exports={Map:pR,set:Ef("set",2),get:Ef("get",1),has:Ef("has",1),remove:Ef("delete",1),proto:pR.prototype}});var hR=g(()=>{"use strict";var eK=_o(),tK=pt(),rK=So(),nK=Aa(),oK=ja(),Sf=mR(),iK=Na(),sK=Sf.Map,aK=Sf.has,uK=Sf.get,cK=Sf.set,lK=tK([].push);eK({target:"Map",stat:!0,forced:iK},{groupBy:function(t,r){nK(t),rK(r);var n=new sK,o=0;return oK(t,function(i){var s=r(i,o++);aK(n,s)?lK(uK(n,s),i):cK(n,s,[i])}),n}})});var bR=g((txe,yR)=>{"use strict";cR();hR();var fK=Xr(),pK=Je(),dK=ka(),gR=dK.Map,mK=gR.groupBy;yR.exports=function(t,r,n){return fK(mK,pK(this)?this:gR,t,r,n)}});var xR=g((rxe,vR)=>{"use strict";var hK=bR();vR.exports=hK});var wR=g(()=>{"use strict";var gK=_o(),yK=tr(),bK=Ba();gK({target:"Object",stat:!0,sham:!yK},{create:bK})});var ER=g(()=>{"use strict";var vK=_o(),xK=Eo(),wK=pt(),EK=So(),SK=Aa(),IK=Ra(),_K=ja(),CK=xK("Object","create"),TK=wK([].push);vK({target:"Object",stat:!0},{groupBy:function(t,r){SK(t),EK(r);var n=CK(null),o=0;return _K(t,function(i){var s=IK(r(i,o++));s in n?TK(n[s],i):n[s]=[i]}),n}})});var IR=g((axe,SR)=>{"use strict";wR();ER();var OK=ka();SR.exports=OK.Object.groupBy});var CR=g((uxe,_R)=>{"use strict";var AK=IR();_R.exports=AK});var KR=g(HR=>{"use strict";var qi=(S(),Ed(lr));function KK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var VK=typeof Object.is=="function"?Object.is:KK,GK=qi.useState,JK=qi.useEffect,ZK=qi.useLayoutEffect,YK=qi.useDebugValue;function XK(e,t){var r=t(),n=GK({inst:{value:r,getSnapshot:t}}),o=n[0].inst,i=n[1];return ZK(function(){o.value=r,o.getSnapshot=t,Ay(o)&&i({inst:o})},[e,r,t]),JK(function(){return Ay(o)&&i({inst:o}),e(function(){Ay(o)&&i({inst:o})})},[e]),YK(r),r}function Ay(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!VK(e,r)}catch{return!0}}function QK(e,t){return t()}var eV=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?QK:XK;HR.useSyncExternalStore=qi.useSyncExternalStore!==void 0?qi.useSyncExternalStore:eV});var GR=g((kEe,VR)=>{"use strict";VR.exports=KR()});var ZR=g(JR=>{"use strict";var $f=(S(),Ed(lr)),tV=GR();function rV(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nV=typeof Object.is=="function"?Object.is:rV,oV=tV.useSyncExternalStore,iV=$f.useRef,sV=$f.useEffect,aV=$f.useMemo,uV=$f.useDebugValue;JR.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var i=iV(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=aV(function(){function u(d){if(!l){if(l=!0,c=d,d=n(d),o!==void 0&&s.hasValue){var h=s.value;if(o(h,d))return f=h}return f=d}if(h=f,nV(c,d))return h;var b=n(d);return o!==void 0&&o(h,b)?h:(c=d,f=b)}var l=!1,c,f,p=r===void 0?null:r;return[function(){return u(t())},p===null?void 0:function(){return u(p())}]},[t,r,n,o]);var a=oV(e,i[0],i[1]);return sV(function(){s.hasValue=!0,s.value=a},[a]),uV(a),a}});var XR=g((REe,YR)=>{"use strict";YR.exports=ZR()});var Ln=g((EAe,on)=>{function sb(){return on.exports=sb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},on.exports.__esModule=!0,on.exports.default=on.exports,sb.apply(this,arguments)}on.exports=sb,on.exports.__esModule=!0,on.exports.default=on.exports});var tp=g((eke,sn)=>{function mb(e){return sn.exports=mb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sn.exports.__esModule=!0,sn.exports.default=sn.exports,mb(e)}sn.exports=mb,sn.exports.__esModule=!0,sn.exports.default=sn.exports});var YP=g((tke,cu)=>{var ZP=tp().default;function GJ(e,t){if(ZP(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ZP(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}cu.exports=GJ,cu.exports.__esModule=!0,cu.exports.default=cu.exports});var XP=g((rke,lu)=>{var JJ=tp().default,ZJ=YP();function YJ(e){var t=ZJ(e,"string");return JJ(t)==="symbol"?t:String(t)}lu.exports=YJ,lu.exports.__esModule=!0,lu.exports.default=lu.exports});var QP=g((nke,fu)=>{var XJ=XP();function QJ(e,t,r){return t=XJ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}fu.exports=QJ,fu.exports.__esModule=!0,fu.exports.default=fu.exports});var eF=g((oke,pu)=>{function eZ(e){if(Array.isArray(e))return e}pu.exports=eZ,pu.exports.__esModule=!0,pu.exports.default=pu.exports});var tF=g((ike,du)=>{function tZ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,s,a=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(a.push(n.value),a.length!==t);u=!0);}catch(c){l=!0,o=c}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw o}}return a}}du.exports=tZ,du.exports.__esModule=!0,du.exports.default=du.exports});var rF=g((ske,mu)=>{function rZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}mu.exports=rZ,mu.exports.__esModule=!0,mu.exports.default=mu.exports});var oF=g((ake,hu)=>{var nF=rF();function nZ(e,t){if(e){if(typeof e=="string")return nF(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nF(e,t)}}hu.exports=nZ,hu.exports.__esModule=!0,hu.exports.default=hu.exports});var iF=g((uke,gu)=>{function oZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}gu.exports=oZ,gu.exports.__esModule=!0,gu.exports.default=gu.exports});var sF=g((cke,yu)=>{var iZ=eF(),sZ=tF(),aZ=oF(),uZ=iF();function cZ(e,t){return iZ(e)||sZ(e,t)||aZ(e,t)||uZ()}yu.exports=cZ,yu.exports.__esModule=!0,yu.exports.default=yu.exports});var uF=g((rp,aF)=>{"use strict";rp.__esModule=!0;rp.default={scheme:"threezerotwofour",author:"jan t. sott (http://github.com/idleberg)",base00:"#090300",base01:"#3a3432",base02:"#4a4543",base03:"#5c5855",base04:"#807d7c",base05:"#a5a2a2",base06:"#d6d5d4",base07:"#f7f7f7",base08:"#db2d20",base09:"#e8bbd0",base0A:"#fded02",base0B:"#01a252",base0C:"#b5e4f4",base0D:"#01a0e4",base0E:"#a16a94",base0F:"#cdab53"};aF.exports=rp.default});var lF=g((np,cF)=>{"use strict";np.__esModule=!0;np.default={scheme:"apathy",author:"jannik siebert (https://github.com/janniks)",base00:"#031A16",base01:"#0B342D",base02:"#184E45",base03:"#2B685E",base04:"#5F9C92",base05:"#81B5AC",base06:"#A7CEC8",base07:"#D2E7E4",base08:"#3E9688",base09:"#3E7996",base0A:"#3E4C96",base0B:"#883E96",base0C:"#963E4C",base0D:"#96883E",base0E:"#4C963E",base0F:"#3E965B"};cF.exports=np.default});var pF=g((op,fF)=>{"use strict";op.__esModule=!0;op.default={scheme:"ashes",author:"jannik siebert (https://github.com/janniks)",base00:"#1C2023",base01:"#393F45",base02:"#565E65",base03:"#747C84",base04:"#ADB3BA",base05:"#C7CCD1",base06:"#DFE2E5",base07:"#F3F4F5",base08:"#C7AE95",base09:"#C7C795",base0A:"#AEC795",base0B:"#95C7AE",base0C:"#95AEC7",base0D:"#AE95C7",base0E:"#C795AE",base0F:"#C79595"};fF.exports=op.default});var mF=g((ip,dF)=>{"use strict";ip.__esModule=!0;ip.default={scheme:"atelier dune",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)",base00:"#20201d",base01:"#292824",base02:"#6e6b5e",base03:"#7d7a68",base04:"#999580",base05:"#a6a28c",base06:"#e8e4cf",base07:"#fefbec",base08:"#d73737",base09:"#b65611",base0A:"#cfb017",base0B:"#60ac39",base0C:"#1fad83",base0D:"#6684e1",base0E:"#b854d4",base0F:"#d43552"};dF.exports=ip.default});var gF=g((sp,hF)=>{"use strict";sp.__esModule=!0;sp.default={scheme:"atelier forest",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)",base00:"#1b1918",base01:"#2c2421",base02:"#68615e",base03:"#766e6b",base04:"#9c9491",base05:"#a8a19f",base06:"#e6e2e0",base07:"#f1efee",base08:"#f22c40",base09:"#df5320",base0A:"#d5911a",base0B:"#5ab738",base0C:"#00ad9c",base0D:"#407ee7",base0E:"#6666ea",base0F:"#c33ff3"};hF.exports=sp.default});var bF=g((ap,yF)=>{"use strict";ap.__esModule=!0;ap.default={scheme:"atelier heath",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)",base00:"#1b181b",base01:"#292329",base02:"#695d69",base03:"#776977",base04:"#9e8f9e",base05:"#ab9bab",base06:"#d8cad8",base07:"#f7f3f7",base08:"#ca402b",base09:"#a65926",base0A:"#bb8a35",base0B:"#379a37",base0C:"#159393",base0D:"#516aec",base0E:"#7b59c0",base0F:"#cc33cc"};yF.exports=ap.default});var xF=g((up,vF)=>{"use strict";up.__esModule=!0;up.default={scheme:"atelier lakeside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)",base00:"#161b1d",base01:"#1f292e",base02:"#516d7b",base03:"#5a7b8c",base04:"#7195a8",base05:"#7ea2b4",base06:"#c1e4f6",base07:"#ebf8ff",base08:"#d22d72",base09:"#935c25",base0A:"#8a8a0f",base0B:"#568c3b",base0C:"#2d8f6f",base0D:"#257fad",base0E:"#5d5db1",base0F:"#b72dd2"};vF.exports=up.default});var EF=g((cp,wF)=>{"use strict";cp.__esModule=!0;cp.default={scheme:"atelier seaside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)",base00:"#131513",base01:"#242924",base02:"#5e6e5e",base03:"#687d68",base04:"#809980",base05:"#8ca68c",base06:"#cfe8cf",base07:"#f0fff0",base08:"#e6193c",base09:"#87711d",base0A:"#c3c322",base0B:"#29a329",base0C:"#1999b3",base0D:"#3d62f5",base0E:"#ad2bee",base0F:"#e619c3"};wF.exports=cp.default});var IF=g((lp,SF)=>{"use strict";lp.__esModule=!0;lp.default={scheme:"bespin",author:"jan t. sott",base00:"#28211c",base01:"#36312e",base02:"#5e5d5c",base03:"#666666",base04:"#797977",base05:"#8a8986",base06:"#9d9b97",base07:"#baae9e",base08:"#cf6a4c",base09:"#cf7d34",base0A:"#f9ee98",base0B:"#54be0d",base0C:"#afc4db",base0D:"#5ea6ea",base0E:"#9b859d",base0F:"#937121"};SF.exports=lp.default});var CF=g((fp,_F)=>{"use strict";fp.__esModule=!0;fp.default={scheme:"brewer",author:"timoth\xE9e poisot (http://github.com/tpoisot)",base00:"#0c0d0e",base01:"#2e2f30",base02:"#515253",base03:"#737475",base04:"#959697",base05:"#b7b8b9",base06:"#dadbdc",base07:"#fcfdfe",base08:"#e31a1c",base09:"#e6550d",base0A:"#dca060",base0B:"#31a354",base0C:"#80b1d3",base0D:"#3182bd",base0E:"#756bb1",base0F:"#b15928"};_F.exports=fp.default});var OF=g((pp,TF)=>{"use strict";pp.__esModule=!0;pp.default={scheme:"bright",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#303030",base02:"#505050",base03:"#b0b0b0",base04:"#d0d0d0",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ffffff",base08:"#fb0120",base09:"#fc6d24",base0A:"#fda331",base0B:"#a1c659",base0C:"#76c7b7",base0D:"#6fb3d2",base0E:"#d381c3",base0F:"#be643c"};TF.exports=pp.default});var kF=g((dp,AF)=>{"use strict";dp.__esModule=!0;dp.default={scheme:"chalk",author:"chris kempson (http://chriskempson.com)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#f5f5f5",base08:"#fb9fb1",base09:"#eda987",base0A:"#ddb26f",base0B:"#acc267",base0C:"#12cfc0",base0D:"#6fc2ef",base0E:"#e1a3ee",base0F:"#deaf8f"};AF.exports=dp.default});var RF=g((mp,NF)=>{"use strict";mp.__esModule=!0;mp.default={scheme:"codeschool",author:"brettof86",base00:"#232c31",base01:"#1c3657",base02:"#2a343a",base03:"#3f4944",base04:"#84898c",base05:"#9ea7a6",base06:"#a7cfa3",base07:"#b5d8f6",base08:"#2a5491",base09:"#43820d",base0A:"#a03b1e",base0B:"#237986",base0C:"#b02f30",base0D:"#484d79",base0E:"#c59820",base0F:"#c98344"};NF.exports=mp.default});var PF=g((hp,DF)=>{"use strict";hp.__esModule=!0;hp.default={scheme:"colors",author:"mrmrs (http://clrs.cc)",base00:"#111111",base01:"#333333",base02:"#555555",base03:"#777777",base04:"#999999",base05:"#bbbbbb",base06:"#dddddd",base07:"#ffffff",base08:"#ff4136",base09:"#ff851b",base0A:"#ffdc00",base0B:"#2ecc40",base0C:"#7fdbff",base0D:"#0074d9",base0E:"#b10dc9",base0F:"#85144b"};DF.exports=hp.default});var $F=g((gp,FF)=>{"use strict";gp.__esModule=!0;gp.default={scheme:"default",author:"chris kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"};FF.exports=gp.default});var jF=g((yp,MF)=>{"use strict";yp.__esModule=!0;yp.default={scheme:"eighties",author:"chris kempson (http://chriskempson.com)",base00:"#2d2d2d",base01:"#393939",base02:"#515151",base03:"#747369",base04:"#a09f93",base05:"#d3d0c8",base06:"#e8e6df",base07:"#f2f0ec",base08:"#f2777a",base09:"#f99157",base0A:"#ffcc66",base0B:"#99cc99",base0C:"#66cccc",base0D:"#6699cc",base0E:"#cc99cc",base0F:"#d27b53"};MF.exports=yp.default});var qF=g((bp,LF)=>{"use strict";bp.__esModule=!0;bp.default={scheme:"embers",author:"jannik siebert (https://github.com/janniks)",base00:"#16130F",base01:"#2C2620",base02:"#433B32",base03:"#5A5047",base04:"#8A8075",base05:"#A39A90",base06:"#BEB6AE",base07:"#DBD6D1",base08:"#826D57",base09:"#828257",base0A:"#6D8257",base0B:"#57826D",base0C:"#576D82",base0D:"#6D5782",base0E:"#82576D",base0F:"#825757"};LF.exports=bp.default});var zF=g((vp,BF)=>{"use strict";vp.__esModule=!0;vp.default={scheme:"flat",author:"chris kempson (http://chriskempson.com)",base00:"#2C3E50",base01:"#34495E",base02:"#7F8C8D",base03:"#95A5A6",base04:"#BDC3C7",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ECF0F1",base08:"#E74C3C",base09:"#E67E22",base0A:"#F1C40F",base0B:"#2ECC71",base0C:"#1ABC9C",base0D:"#3498DB",base0E:"#9B59B6",base0F:"#be643c"};BF.exports=vp.default});var WF=g((xp,UF)=>{"use strict";xp.__esModule=!0;xp.default={scheme:"google",author:"seth wright (http://sethawright.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#CC342B",base09:"#F96A38",base0A:"#FBA922",base0B:"#198844",base0C:"#3971ED",base0D:"#3971ED",base0E:"#A36AC7",base0F:"#3971ED"};UF.exports=xp.default});var KF=g((wp,HF)=>{"use strict";wp.__esModule=!0;wp.default={scheme:"grayscale",author:"alexandre gavioli (https://github.com/alexx2/)",base00:"#101010",base01:"#252525",base02:"#464646",base03:"#525252",base04:"#ababab",base05:"#b9b9b9",base06:"#e3e3e3",base07:"#f7f7f7",base08:"#7c7c7c",base09:"#999999",base0A:"#a0a0a0",base0B:"#8e8e8e",base0C:"#868686",base0D:"#686868",base0E:"#747474",base0F:"#5e5e5e"};HF.exports=wp.default});var GF=g((Ep,VF)=>{"use strict";Ep.__esModule=!0;Ep.default={scheme:"green screen",author:"chris kempson (http://chriskempson.com)",base00:"#001100",base01:"#003300",base02:"#005500",base03:"#007700",base04:"#009900",base05:"#00bb00",base06:"#00dd00",base07:"#00ff00",base08:"#007700",base09:"#009900",base0A:"#007700",base0B:"#00bb00",base0C:"#005500",base0D:"#009900",base0E:"#00bb00",base0F:"#005500"};VF.exports=Ep.default});var ZF=g((Sp,JF)=>{"use strict";Sp.__esModule=!0;Sp.default={scheme:"harmonic16",author:"jannik siebert (https://github.com/janniks)",base00:"#0b1c2c",base01:"#223b54",base02:"#405c79",base03:"#627e99",base04:"#aabcce",base05:"#cbd6e2",base06:"#e5ebf1",base07:"#f7f9fb",base08:"#bf8b56",base09:"#bfbf56",base0A:"#8bbf56",base0B:"#56bf8b",base0C:"#568bbf",base0D:"#8b56bf",base0E:"#bf568b",base0F:"#bf5656"};JF.exports=Sp.default});var XF=g((Ip,YF)=>{"use strict";Ip.__esModule=!0;Ip.default={scheme:"hopscotch",author:"jan t. sott",base00:"#322931",base01:"#433b42",base02:"#5c545b",base03:"#797379",base04:"#989498",base05:"#b9b5b8",base06:"#d5d3d5",base07:"#ffffff",base08:"#dd464c",base09:"#fd8b19",base0A:"#fdcc59",base0B:"#8fc13e",base0C:"#149b93",base0D:"#1290bf",base0E:"#c85e7c",base0F:"#b33508"};YF.exports=Ip.default});var e$=g((_p,QF)=>{"use strict";_p.__esModule=!0;_p.default={scheme:"isotope",author:"jan t. sott",base00:"#000000",base01:"#404040",base02:"#606060",base03:"#808080",base04:"#c0c0c0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#ff0000",base09:"#ff9900",base0A:"#ff0099",base0B:"#33ff00",base0C:"#00ffff",base0D:"#0066ff",base0E:"#cc00ff",base0F:"#3300ff"};QF.exports=_p.default});var r$=g((Cp,t$)=>{"use strict";Cp.__esModule=!0;Cp.default={scheme:"marrakesh",author:"alexandre gavioli (http://github.com/alexx2/)",base00:"#201602",base01:"#302e00",base02:"#5f5b17",base03:"#6c6823",base04:"#86813b",base05:"#948e48",base06:"#ccc37a",base07:"#faf0a5",base08:"#c35359",base09:"#b36144",base0A:"#a88339",base0B:"#18974e",base0C:"#75a738",base0D:"#477ca1",base0E:"#8868b3",base0F:"#b3588e"};t$.exports=Cp.default});var o$=g((Tp,n$)=>{"use strict";Tp.__esModule=!0;Tp.default={scheme:"mocha",author:"chris kempson (http://chriskempson.com)",base00:"#3B3228",base01:"#534636",base02:"#645240",base03:"#7e705a",base04:"#b8afad",base05:"#d0c8c6",base06:"#e9e1dd",base07:"#f5eeeb",base08:"#cb6077",base09:"#d28b71",base0A:"#f4bc87",base0B:"#beb55b",base0C:"#7bbda4",base0D:"#8ab3b5",base0E:"#a89bb9",base0F:"#bb9584"};n$.exports=Tp.default});var s$=g((Op,i$)=>{"use strict";Op.__esModule=!0;Op.default={scheme:"monokai",author:"wimer hazenberg (http://www.monokai.nl)",base00:"#272822",base01:"#383830",base02:"#49483e",base03:"#75715e",base04:"#a59f85",base05:"#f8f8f2",base06:"#f5f4f1",base07:"#f9f8f5",base08:"#f92672",base09:"#fd971f",base0A:"#f4bf75",base0B:"#a6e22e",base0C:"#a1efe4",base0D:"#66d9ef",base0E:"#ae81ff",base0F:"#cc6633"};i$.exports=Op.default});var u$=g((Ap,a$)=>{"use strict";Ap.__esModule=!0;Ap.default={scheme:"ocean",author:"chris kempson (http://chriskempson.com)",base00:"#2b303b",base01:"#343d46",base02:"#4f5b66",base03:"#65737e",base04:"#a7adba",base05:"#c0c5ce",base06:"#dfe1e8",base07:"#eff1f5",base08:"#bf616a",base09:"#d08770",base0A:"#ebcb8b",base0B:"#a3be8c",base0C:"#96b5b4",base0D:"#8fa1b3",base0E:"#b48ead",base0F:"#ab7967"};a$.exports=Ap.default});var l$=g((kp,c$)=>{"use strict";kp.__esModule=!0;kp.default={scheme:"paraiso",author:"jan t. sott",base00:"#2f1e2e",base01:"#41323f",base02:"#4f424c",base03:"#776e71",base04:"#8d8687",base05:"#a39e9b",base06:"#b9b6b0",base07:"#e7e9db",base08:"#ef6155",base09:"#f99b15",base0A:"#fec418",base0B:"#48b685",base0C:"#5bc4bf",base0D:"#06b6ef",base0E:"#815ba4",base0F:"#e96ba8"};c$.exports=kp.default});var p$=g((Np,f$)=>{"use strict";Np.__esModule=!0;Np.default={scheme:"pop",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#eb008a",base09:"#f29333",base0A:"#f8ca12",base0B:"#37b349",base0C:"#00aabb",base0D:"#0e5a94",base0E:"#b31e8d",base0F:"#7a2d00"};f$.exports=Np.default});var m$=g((Rp,d$)=>{"use strict";Rp.__esModule=!0;Rp.default={scheme:"railscasts",author:"ryan bates (http://railscasts.com)",base00:"#2b2b2b",base01:"#272935",base02:"#3a4055",base03:"#5a647e",base04:"#d4cfc9",base05:"#e6e1dc",base06:"#f4f1ed",base07:"#f9f7f3",base08:"#da4939",base09:"#cc7833",base0A:"#ffc66d",base0B:"#a5c261",base0C:"#519f50",base0D:"#6d9cbe",base0E:"#b6b3eb",base0F:"#bc9458"};d$.exports=Rp.default});var g$=g((Dp,h$)=>{"use strict";Dp.__esModule=!0;Dp.default={scheme:"shapeshifter",author:"tyler benziger (http://tybenz.com)",base00:"#000000",base01:"#040404",base02:"#102015",base03:"#343434",base04:"#555555",base05:"#ababab",base06:"#e0e0e0",base07:"#f9f9f9",base08:"#e92f2f",base09:"#e09448",base0A:"#dddd13",base0B:"#0ed839",base0C:"#23edda",base0D:"#3b48e3",base0E:"#f996e2",base0F:"#69542d"};h$.exports=Dp.default});var b$=g((Pp,y$)=>{"use strict";Pp.__esModule=!0;Pp.default={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"};y$.exports=Pp.default});var x$=g((Fp,v$)=>{"use strict";Fp.__esModule=!0;Fp.default={scheme:"summerfruit",author:"christopher corley (http://cscorley.github.io/)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#B0B0B0",base05:"#D0D0D0",base06:"#E0E0E0",base07:"#FFFFFF",base08:"#FF0086",base09:"#FD8900",base0A:"#ABA800",base0B:"#00C918",base0C:"#1faaaa",base0D:"#3777E6",base0E:"#AD00A1",base0F:"#cc6633"};v$.exports=Fp.default});var E$=g(($p,w$)=>{"use strict";$p.__esModule=!0;$p.default={scheme:"tomorrow",author:"chris kempson (http://chriskempson.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#cc6666",base09:"#de935f",base0A:"#f0c674",base0B:"#b5bd68",base0C:"#8abeb7",base0D:"#81a2be",base0E:"#b294bb",base0F:"#a3685a"};w$.exports=$p.default});var I$=g((Mp,S$)=>{"use strict";Mp.__esModule=!0;Mp.default={scheme:"london tube",author:"jan t. sott",base00:"#231f20",base01:"#1c3f95",base02:"#5a5758",base03:"#737171",base04:"#959ca1",base05:"#d9d8d8",base06:"#e7e7e8",base07:"#ffffff",base08:"#ee2e24",base09:"#f386a1",base0A:"#ffd204",base0B:"#00853e",base0C:"#85cebc",base0D:"#009ddc",base0E:"#98005d",base0F:"#b06110"};S$.exports=Mp.default});var C$=g((jp,_$)=>{"use strict";jp.__esModule=!0;jp.default={scheme:"twilight",author:"david hart (http://hart-dev.com)",base00:"#1e1e1e",base01:"#323537",base02:"#464b50",base03:"#5f5a60",base04:"#838184",base05:"#a7a7a7",base06:"#c3c3c3",base07:"#ffffff",base08:"#cf6a4c",base09:"#cda869",base0A:"#f9ee98",base0B:"#8f9d6a",base0C:"#afc4db",base0D:"#7587a6",base0E:"#9b859d",base0F:"#9b703f"};_$.exports=jp.default});var T$=g(ie=>{"use strict";ie.__esModule=!0;function se(e){return e&&e.__esModule?e.default:e}var lZ=uF();ie.threezerotwofour=se(lZ);var fZ=lF();ie.apathy=se(fZ);var pZ=pF();ie.ashes=se(pZ);var dZ=mF();ie.atelierDune=se(dZ);var mZ=gF();ie.atelierForest=se(mZ);var hZ=bF();ie.atelierHeath=se(hZ);var gZ=xF();ie.atelierLakeside=se(gZ);var yZ=EF();ie.atelierSeaside=se(yZ);var bZ=IF();ie.bespin=se(bZ);var vZ=CF();ie.brewer=se(vZ);var xZ=OF();ie.bright=se(xZ);var wZ=kF();ie.chalk=se(wZ);var EZ=RF();ie.codeschool=se(EZ);var SZ=PF();ie.colors=se(SZ);var IZ=$F();ie.default=se(IZ);var _Z=jF();ie.eighties=se(_Z);var CZ=qF();ie.embers=se(CZ);var TZ=zF();ie.flat=se(TZ);var OZ=WF();ie.google=se(OZ);var AZ=KF();ie.grayscale=se(AZ);var kZ=GF();ie.greenscreen=se(kZ);var NZ=ZF();ie.harmonic=se(NZ);var RZ=XF();ie.hopscotch=se(RZ);var DZ=e$();ie.isotope=se(DZ);var PZ=r$();ie.marrakesh=se(PZ);var FZ=o$();ie.mocha=se(FZ);var $Z=s$();ie.monokai=se($Z);var MZ=u$();ie.ocean=se(MZ);var jZ=l$();ie.paraiso=se(jZ);var LZ=p$();ie.pop=se(LZ);var qZ=m$();ie.railscasts=se(qZ);var BZ=g$();ie.shapeshifter=se(BZ);var zZ=b$();ie.solarized=se(zZ);var UZ=x$();ie.summerfruit=se(UZ);var WZ=E$();ie.tomorrow=se(WZ);var HZ=I$();ie.tube=se(HZ);var KZ=C$();ie.twilight=se(KZ)});var A$=g((fke,O$)=>{"use strict";O$.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var N$=g((pke,k$)=>{k$.exports=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")}});var P$=g((dke,D$)=>{"use strict";var VZ=N$(),GZ=Array.prototype.concat,JZ=Array.prototype.slice,R$=D$.exports=function(t){for(var r=[],n=0,o=t.length;n<o;n++){var i=t[n];VZ(i)?r=GZ.call(r,JZ.call(i)):r.push(i)}return r};R$.wrap=function(e){return function(){return e(R$(arguments))}}});var j$=g((mke,M$)=>{var bu=A$(),vu=P$(),F$=Object.hasOwnProperty,$$=Object.create(null);for(Lp in bu)F$.call(bu,Lp)&&($$[bu[Lp]]=Lp);var Lp,Mt=M$.exports={to:{},get:{}};Mt.get=function(e){var t=e.substring(0,3).toLowerCase(),r,n;switch(t){case"hsl":r=Mt.get.hsl(e),n="hsl";break;case"hwb":r=Mt.get.hwb(e),n="hwb";break;default:r=Mt.get.rgb(e),n="rgb";break}return r?{model:n,value:r}:null};Mt.get.rgb=function(e){if(!e)return null;var t=/^#([a-f0-9]{3,4})$/i,r=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,o=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,s=[0,0,0,1],a,u,l;if(a=e.match(r)){for(l=a[2],a=a[1],u=0;u<3;u++){var c=u*2;s[u]=parseInt(a.slice(c,c+2),16)}l&&(s[3]=parseInt(l,16)/255)}else if(a=e.match(t)){for(a=a[1],l=a[3],u=0;u<3;u++)s[u]=parseInt(a[u]+a[u],16);l&&(s[3]=parseInt(l+l,16)/255)}else if(a=e.match(n)){for(u=0;u<3;u++)s[u]=parseInt(a[u+1],0);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else if(a=e.match(o)){for(u=0;u<3;u++)s[u]=Math.round(parseFloat(a[u+1])*2.55);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else return(a=e.match(i))?a[1]==="transparent"?[0,0,0,0]:F$.call(bu,a[1])?(s=bu[a[1]],s[3]=1,s):null:null;for(u=0;u<3;u++)s[u]=Bn(s[u],0,255);return s[3]=Bn(s[3],0,1),s};Mt.get.hsl=function(e){if(!e)return null;var t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=Bn(parseFloat(r[2]),0,100),s=Bn(parseFloat(r[3]),0,100),a=Bn(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};Mt.get.hwb=function(e){if(!e)return null;var t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){var n=parseFloat(r[4]),o=(parseFloat(r[1])%360+360)%360,i=Bn(parseFloat(r[2]),0,100),s=Bn(parseFloat(r[3]),0,100),a=Bn(isNaN(n)?1:n,0,1);return[o,i,s,a]}return null};Mt.to.hex=function(){var e=vu(arguments);return"#"+qp(e[0])+qp(e[1])+qp(e[2])+(e[3]<1?qp(Math.round(e[3]*255)):"")};Mt.to.rgb=function(){var e=vu(arguments);return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};Mt.to.rgb.percent=function(){var e=vu(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};Mt.to.hsl=function(){var e=vu(arguments);return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};Mt.to.hwb=function(){var e=vu(arguments),t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};Mt.to.keyword=function(e){return $$[e.slice(0,3)]};function Bn(e,t,r){return Math.min(Math.max(t,e),r)}function qp(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}});var q$=g((hke,L$)=>{"use strict";L$.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var hb=g((gke,W$)=>{var Mo=q$(),U$={};for(Bp in Mo)Mo.hasOwnProperty(Bp)&&(U$[Mo[Bp]]=Bp);var Bp,L=W$.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(mt in L)if(L.hasOwnProperty(mt)){if(!("channels"in L[mt]))throw new Error("missing channels property: "+mt);if(!("labels"in L[mt]))throw new Error("missing channel labels property: "+mt);if(L[mt].labels.length!==L[mt].channels)throw new Error("channel and label counts mismatch: "+mt);B$=L[mt].channels,z$=L[mt].labels,delete L[mt].channels,delete L[mt].labels,Object.defineProperty(L[mt],"channels",{value:B$}),Object.defineProperty(L[mt],"labels",{value:z$})}var B$,z$,mt;L.rgb.hsl=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(t,r,n),i=Math.max(t,r,n),s=i-o,a,u,l;return i===o?a=0:t===i?a=(r-n)/s:r===i?a=2+(n-t)/s:n===i&&(a=4+(t-r)/s),a=Math.min(a*60,360),a<0&&(a+=360),l=(o+i)/2,i===o?u=0:l<=.5?u=s/(i+o):u=s/(2-i-o),[a,u*100,l*100]};L.rgb.hsv=function(e){var t,r,n,o,i,s=e[0]/255,a=e[1]/255,u=e[2]/255,l=Math.max(s,a,u),c=l-Math.min(s,a,u),f=function(p){return(l-p)/6/c+1/2};return c===0?o=i=0:(i=c/l,t=f(s),r=f(a),n=f(u),s===l?o=n-r:a===l?o=1/3+t-n:u===l&&(o=2/3+r-t),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,l*100]};L.rgb.hwb=function(e){var t=e[0],r=e[1],n=e[2],o=L.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[o,i*100,n*100]};L.rgb.cmyk=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,o,i,s,a;return a=Math.min(1-t,1-r,1-n),o=(1-t-a)/(1-a)||0,i=(1-r-a)/(1-a)||0,s=(1-n-a)/(1-a)||0,[o*100,i*100,s*100,a*100]};function ZZ(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2)}L.rgb.keyword=function(e){var t=U$[e];if(t)return t;var r=1/0,n;for(var o in Mo)if(Mo.hasOwnProperty(o)){var i=Mo[o],s=ZZ(e,i);s<r&&(r=s,n=o)}return n};L.keyword.rgb=function(e){return Mo[e]};L.rgb.xyz=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var o=t*.4124+r*.3576+n*.1805,i=t*.2126+r*.7152+n*.0722,s=t*.0193+r*.1192+n*.9505;return[o*100,i*100,s*100]};L.rgb.lab=function(e){var t=L.rgb.xyz(e),r=t[0],n=t[1],o=t[2],i,s,a;return r/=95.047,n/=100,o/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,i=116*n-16,s=500*(r-n),a=200*(n-o),[i,s,a]};L.hsl.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100,o,i,s,a,u;if(r===0)return u=n*255,[u,u,u];n<.5?i=n*(1+r):i=n+r-n*r,o=2*n-i,a=[0,0,0];for(var l=0;l<3;l++)s=t+1/3*-(l-1),s<0&&s++,s>1&&s--,6*s<1?u=o+(i-o)*6*s:2*s<1?u=i:3*s<2?u=o+(i-o)*(2/3-s)*6:u=o,a[l]=u*255;return a};L.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,o=r,i=Math.max(n,.01),s,a;return n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i,a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r),[t,s*100,a*100]};L.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,n=e[2]/100,o=Math.floor(t)%6,i=t-Math.floor(t),s=255*n*(1-r),a=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,s];case 1:return[a,n,s];case 2:return[s,n,u];case 3:return[s,a,n];case 4:return[u,s,n];case 5:return[n,s,a]}};L.hsv.hsl=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,o=Math.max(n,.01),i,s,a;return a=(2-r)*n,i=(2-r)*o,s=r*o,s/=i<=1?i:2-i,s=s||0,a/=2,[t,s*100,a*100]};L.hwb.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100,o=r+n,i,s,a,u;o>1&&(r/=o,n/=o),i=Math.floor(6*t),s=1-n,a=6*t-i,i&1&&(a=1-a),u=r+a*(s-r);var l,c,f;switch(i){default:case 6:case 0:l=s,c=u,f=r;break;case 1:l=u,c=s,f=r;break;case 2:l=r,c=s,f=u;break;case 3:l=r,c=u,f=s;break;case 4:l=u,c=r,f=s;break;case 5:l=s,c=r,f=u;break}return[l*255,c*255,f*255]};L.cmyk.rgb=function(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,o=e[3]/100,i,s,a;return i=1-Math.min(1,t*(1-o)+o),s=1-Math.min(1,r*(1-o)+o),a=1-Math.min(1,n*(1-o)+o),[i*255,s*255,a*255]};L.xyz.rgb=function(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,o,i,s;return o=t*3.2406+r*-1.5372+n*-.4986,i=t*-.9689+r*1.8758+n*.0415,s=t*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),[o*255,i*255,s*255]};L.xyz.lab=function(e){var t=e[0],r=e[1],n=e[2],o,i,s;return t/=95.047,r/=100,n/=108.883,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=116*r-16,i=500*(t-r),s=200*(r-n),[o,i,s]};L.lab.xyz=function(e){var t=e[0],r=e[1],n=e[2],o,i,s;i=(t+16)/116,o=r/500+i,s=i-n/200;var a=Math.pow(i,3),u=Math.pow(o,3),l=Math.pow(s,3);return i=a>.008856?a:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,o*=95.047,i*=100,s*=108.883,[o,i,s]};L.lab.lch=function(e){var t=e[0],r=e[1],n=e[2],o,i,s;return o=Math.atan2(n,r),i=o*360/2/Math.PI,i<0&&(i+=360),s=Math.sqrt(r*r+n*n),[t,s,i]};L.lch.lab=function(e){var t=e[0],r=e[1],n=e[2],o,i,s;return s=n/360*2*Math.PI,o=r*Math.cos(s),i=r*Math.sin(s),[t,o,i]};L.rgb.ansi16=function(e){var t=e[0],r=e[1],n=e[2],o=1 in arguments?arguments[1]:L.rgb.hsv(e)[2];if(o=Math.round(o/50),o===0)return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(t/255));return o===2&&(i+=60),i};L.hsv.ansi16=function(e){return L.rgb.ansi16(L.hsv.rgb(e),e[2])};L.rgb.ansi256=function(e){var t=e[0],r=e[1],n=e[2];if(t===r&&r===n)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;var o=16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5);return o};L.ansi16.rgb=function(e){var t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];var r=(~~(e>50)+1)*.5,n=(t&1)*r*255,o=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,o,i]};L.ansi256.rgb=function(e){if(e>=232){var t=(e-232)*10+8;return[t,t,t]}e-=16;var r,n=Math.floor(e/36)/5*255,o=Math.floor((r=e%36)/6)/5*255,i=r%6/5*255;return[n,o,i]};L.rgb.hex=function(e){var t=((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255),r=t.toString(16).toUpperCase();return"000000".substring(r.length)+r};L.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];t[0].length===3&&(r=r.split("").map(function(a){return a+a}).join(""));var n=parseInt(r,16),o=n>>16&255,i=n>>8&255,s=n&255;return[o,i,s]};L.rgb.hcg=function(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),s=o-i,a,u;return s<1?a=i/(1-s):a=0,s<=0?u=0:o===t?u=(r-n)/s%6:o===r?u=2+(n-t)/s:u=4+(t-r)/s+4,u/=6,u%=1,[u*360,s*100,a*100]};L.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1,o=0;return r<.5?n=2*t*r:n=2*t*(1-r),n<1&&(o=(r-.5*n)/(1-n)),[e[0],n*100,o*100]};L.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],n*100,o*100]};L.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];var o=[0,0,0],i=t%1*6,s=i%1,a=1-s,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};L.hcg.hsv=function(e){var t=e[1]/100,r=e[2]/100,n=t+r*(1-t),o=0;return n>0&&(o=t/n),[e[0],o*100,n*100]};L.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100,n=r*(1-t)+.5*t,o=0;return n>0&&n<.5?o=t/(2*n):n>=.5&&n<1&&(o=t/(2*(1-n))),[e[0],o*100,n*100]};L.hcg.hwb=function(e){var t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};L.hwb.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1-r,o=n-t,i=0;return o<1&&(i=(n-o)/(1-o)),[e[0],o*100,i*100]};L.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};L.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};L.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};L.gray.hsl=L.gray.hsv=function(e){return[0,0,e[0]]};L.gray.hwb=function(e){return[0,100,e[0]]};L.gray.cmyk=function(e){return[0,0,0,e[0]]};L.gray.lab=function(e){return[e[0],0,0]};L.gray.hex=function(e){var t=Math.round(e[0]/100*255)&255,r=(t<<16)+(t<<8)+t,n=r.toString(16).toUpperCase();return"000000".substring(n.length)+n};L.rgb.gray=function(e){var t=(e[0]+e[1]+e[2])/3;return[t/255*100]}});var K$=g((yke,H$)=>{var zp=hb();function YZ(){for(var e={},t=Object.keys(zp),r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function XZ(e){var t=YZ(),r=[e];for(t[e].distance=0;r.length;)for(var n=r.pop(),o=Object.keys(zp[n]),i=o.length,s=0;s<i;s++){var a=o[s],u=t[a];u.distance===-1&&(u.distance=t[n].distance+1,u.parent=n,r.unshift(a))}return t}function QZ(e,t){return function(r){return t(e(r))}}function eY(e,t){for(var r=[t[e].parent,e],n=zp[t[e].parent][e],o=t[e].parent;t[o].parent;)r.unshift(t[o].parent),n=QZ(zp[t[o].parent][o],n),o=t[o].parent;return n.conversion=r,n}H$.exports=function(e){for(var t=XZ(e),r={},n=Object.keys(t),o=n.length,i=0;i<o;i++){var s=n[i],a=t[s];a.parent!==null&&(r[s]=eY(s,t))}return r}});var G$=g((bke,V$)=>{var gb=hb(),tY=K$(),Gi={},rY=Object.keys(gb);function nY(e){var t=function(r){return r==null?r:(arguments.length>1&&(r=Array.prototype.slice.call(arguments)),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function oY(e){var t=function(r){if(r==null)return r;arguments.length>1&&(r=Array.prototype.slice.call(arguments));var n=e(r);if(typeof n=="object")for(var o=n.length,i=0;i<o;i++)n[i]=Math.round(n[i]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}rY.forEach(function(e){Gi[e]={},Object.defineProperty(Gi[e],"channels",{value:gb[e].channels}),Object.defineProperty(Gi[e],"labels",{value:gb[e].labels});var t=tY(e),r=Object.keys(t);r.forEach(function(n){var o=t[n];Gi[e][n]=oY(o),Gi[e][n].raw=nY(o)})});V$.exports=Gi});var Y$=g((vke,Z$)=>{"use strict";var xu=j$(),jt=G$(),vb=[].slice,J$=["keyword","gray","hex"],yb={};Object.keys(jt).forEach(function(e){yb[vb.call(jt[e].labels).sort().join("")]=e});var Up={};function tt(e,t){if(!(this instanceof tt))return new tt(e,t);if(t&&t in J$&&(t=null),t&&!(t in jt))throw new Error("Unknown model: "+t);var r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof tt)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if(typeof e=="string"){var o=xu.get(e);if(o===null)throw new Error("Unable to parse color from string: "+e);this.model=o.model,n=jt[this.model].channels,this.color=o.value.slice(0,n),this.valpha=typeof o.value[n]=="number"?o.value[n]:1}else if(e.length){this.model=t||"rgb",n=jt[this.model].channels;var i=vb.call(e,0,n);this.color=bb(i,n),this.valpha=typeof e[n]=="number"?e[n]:1}else if(typeof e=="number")e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;var s=Object.keys(e);"alpha"in e&&(s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);var a=s.sort().join("");if(!(a in yb))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=yb[a];var u=jt[this.model].labels,l=[];for(r=0;r<u.length;r++)l.push(e[u[r]]);this.color=bb(l)}if(Up[this.model])for(n=jt[this.model].channels,r=0;r<n;r++){var c=Up[this.model][r];c&&(this.color[r]=c(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}tt.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(e){var t=this.model in xu.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);var r=t.valpha===1?t.color:t.color.concat(this.valpha);return xu.to[t.model](r)},percentString:function(e){var t=this.rgb().round(typeof e=="number"?e:1),r=t.valpha===1?t.color:t.color.concat(this.valpha);return xu.to.rgb.percent(r)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var e={},t=jt[this.model].channels,r=jt[this.model].labels,n=0;n<t;n++)e[r[n]]=this.color[n];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray:function(){var e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject:function(){var e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round:function(e){return e=Math.max(e||0,0),new tt(this.color.map(sY(e)).concat(this.valpha),this.model)},alpha:function(e){return arguments.length?new tt(this.color.concat(Math.max(0,Math.min(1,e))),this.model):this.valpha},red:Ne("rgb",0,ze(255)),green:Ne("rgb",1,ze(255)),blue:Ne("rgb",2,ze(255)),hue:Ne(["hsl","hsv","hsl","hwb","hcg"],0,function(e){return(e%360+360)%360}),saturationl:Ne("hsl",1,ze(100)),lightness:Ne("hsl",2,ze(100)),saturationv:Ne("hsv",1,ze(100)),value:Ne("hsv",2,ze(100)),chroma:Ne("hcg",1,ze(100)),gray:Ne("hcg",2,ze(100)),white:Ne("hwb",1,ze(100)),wblack:Ne("hwb",2,ze(100)),cyan:Ne("cmyk",0,ze(100)),magenta:Ne("cmyk",1,ze(100)),yellow:Ne("cmyk",2,ze(100)),black:Ne("cmyk",3,ze(100)),x:Ne("xyz",0,ze(100)),y:Ne("xyz",1,ze(100)),z:Ne("xyz",2,ze(100)),l:Ne("lab",0,ze(100)),a:Ne("lab",1),b:Ne("lab",2),keyword:function(e){return arguments.length?new tt(e):jt[this.model].keyword(this.color)},hex:function(e){return arguments.length?new tt(e):xu.to.hex(this.rgb().round().color)},rgbNumber:function(){var e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity:function(){for(var e=this.rgb().color,t=[],r=0;r<e.length;r++){var n=e[r]/255;t[r]=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast:function(e){var t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color,t=(e[0]*299+e[1]*587+e[2]*114)/1e3;return t<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return tt.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var r=e.rgb(),n=this.rgb(),o=t===void 0?.5:t,i=2*o-1,s=r.alpha()-n.alpha(),a=((i*s===-1?i:(i+s)/(1+i*s))+1)/2,u=1-a;return tt.rgb(a*r.red()+u*n.red(),a*r.green()+u*n.green(),a*r.blue()+u*n.blue(),r.alpha()*o+n.alpha()*(1-o))}};Object.keys(jt).forEach(function(e){if(J$.indexOf(e)===-1){var t=jt[e].channels;tt.prototype[e]=function(){if(this.model===e)return new tt(this);if(arguments.length)return new tt(arguments,e);var r=typeof arguments[t]=="number"?t:this.valpha;return new tt(aY(jt[this.model][e].raw(this.color)).concat(r),e)},tt[e]=function(r){return typeof r=="number"&&(r=bb(vb.call(arguments),t)),new tt(r,e)}}});function iY(e,t){return Number(e.toFixed(t))}function sY(e){return function(t){return iY(t,e)}}function Ne(e,t,r){return e=Array.isArray(e)?e:[e],e.forEach(function(n){(Up[n]||(Up[n]=[]))[t]=r}),e=e[0],function(n){var o;return arguments.length?(r&&(n=r(n)),o=this[e](),o.color[t]=n,o):(o=this[e]().color[t],r&&(o=r(o)),o)}}function ze(e){return function(t){return Math.max(0,Math.min(e,t))}}function aY(e){return Array.isArray(e)?e:[e]}function bb(e,t){for(var r=0;r<t;r++)typeof e[r]!="number"&&(e[r]=0);return e}Z$.exports=tt});var g2=g((xke,h2)=>{var uY="Expected a function",X$="__lodash_placeholder__",Lo=1,Hp=2,cY=4,jo=8,wu=16,Ji=32,Eu=64,i2=128,lY=256,s2=512,Q$=1/0,fY=9007199254740991,pY=17976931348623157e292,e2=0/0,dY=[["ary",i2],["bind",Lo],["bindKey",Hp],["curry",jo],["curryRight",wu],["flip",s2],["partial",Ji],["partialRight",Eu],["rearg",lY]],mY="[object Function]",hY="[object GeneratorFunction]",gY="[object Symbol]",yY=/[\\^$.*+?()[\]{}|]/g,bY=/^\s+|\s+$/g,vY=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xY=/\{\n\/\* \[wrapped with (.+)\] \*/,wY=/,? & /,EY=/^[-+]0x[0-9a-f]+$/i,SY=/^0b[01]+$/i,IY=/^\[object .+?Constructor\]$/,_Y=/^0o[0-7]+$/i,CY=/^(?:0|[1-9]\d*)$/,TY=parseInt,OY=typeof global=="object"&&global&&global.Object===Object&&global,AY=typeof self=="object"&&self&&self.Object===Object&&self,Iu=OY||AY||Function("return this")();function a2(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function kY(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function NY(e,t){var r=e?e.length:0;return!!r&&DY(e,t,0)>-1}function RY(e,t,r,n){for(var o=e.length,i=r+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function DY(e,t,r){if(t!==t)return RY(e,PY,r);for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}function PY(e){return e!==e}function FY(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&n++;return n}function $Y(e,t){return e?.[t]}function MY(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function u2(e,t){for(var r=-1,n=e.length,o=0,i=[];++r<n;){var s=e[r];(s===t||s===X$)&&(e[r]=X$,i[o++]=r)}return i}var jY=Function.prototype,c2=Object.prototype,xb=Iu["__core-js_shared__"],t2=function(){var e=/[^.]+$/.exec(xb&&xb.keys&&xb.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),l2=jY.toString,LY=c2.hasOwnProperty,f2=c2.toString,qY=RegExp("^"+l2.call(LY).replace(yY,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),BY=Object.create,Wp=Math.max,zY=Math.min,r2=function(){var e=n2(Object,"defineProperty"),t=n2.name;return t&&t.length>2?e:void 0}();function UY(e){return Zi(e)?BY(e):{}}function WY(e){if(!Zi(e)||tX(e))return!1;var t=iX(e)||MY(e)?qY:IY;return t.test(nX(e))}function HY(e,t,r,n){for(var o=-1,i=e.length,s=r.length,a=-1,u=t.length,l=Wp(i-s,0),c=Array(u+l),f=!n;++a<u;)c[a]=t[a];for(;++o<s;)(f||o<i)&&(c[r[o]]=e[o]);for(;l--;)c[a++]=e[o++];return c}function KY(e,t,r,n){for(var o=-1,i=e.length,s=-1,a=r.length,u=-1,l=t.length,c=Wp(i-a,0),f=Array(c+l),p=!n;++o<c;)f[o]=e[o];for(var d=o;++u<l;)f[d+u]=t[u];for(;++s<a;)(p||o<i)&&(f[d+r[s]]=e[o++]);return f}function VY(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function GY(e,t,r){var n=t&Lo,o=Su(e);function i(){var s=this&&this!==Iu&&this instanceof i?o:e;return s.apply(n?r:this,arguments)}return i}function Su(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=UY(e.prototype),n=e.apply(r,t);return Zi(n)?n:r}}function JY(e,t,r){var n=Su(e);function o(){for(var i=arguments.length,s=Array(i),a=i,u=d2(o);a--;)s[a]=arguments[a];var l=i<3&&s[0]!==u&&s[i-1]!==u?[]:u2(s,u);if(i-=l.length,i<r)return p2(e,t,wb,o.placeholder,void 0,s,l,void 0,void 0,r-i);var c=this&&this!==Iu&&this instanceof o?n:e;return a2(c,this,s)}return o}function wb(e,t,r,n,o,i,s,a,u,l){var c=t&i2,f=t&Lo,p=t&Hp,d=t&(jo|wu),h=t&s2,b=p?void 0:Su(e);function y(){for(var v=arguments.length,w=Array(v),T=v;T--;)w[T]=arguments[T];if(d)var M=d2(y),V=FY(w,M);if(n&&(w=HY(w,n,o,d)),i&&(w=KY(w,i,s,d)),v-=V,d&&v<l){var J=u2(w,M);return p2(e,t,wb,y.placeholder,r,w,J,a,u,l-v)}var G=f?r:this,K=p?G[e]:e;return v=w.length,a?w=rX(w,a):h&&v>1&&w.reverse(),c&&u<v&&(w.length=u),this&&this!==Iu&&this instanceof y&&(K=b||Su(K)),K.apply(G,w)}return y}function ZY(e,t,r,n){var o=t&Lo,i=Su(e);function s(){for(var a=-1,u=arguments.length,l=-1,c=n.length,f=Array(c+u),p=this&&this!==Iu&&this instanceof s?i:e;++l<c;)f[l]=n[l];for(;u--;)f[l++]=arguments[++a];return a2(p,o?r:this,f)}return s}function p2(e,t,r,n,o,i,s,a,u,l){var c=t&jo,f=c?s:void 0,p=c?void 0:s,d=c?i:void 0,h=c?void 0:i;t|=c?Ji:Eu,t&=~(c?Eu:Ji),t&cY||(t&=~(Lo|Hp));var b=r(e,t,o,d,f,h,p,a,u,l);return b.placeholder=n,m2(b,e,t)}function YY(e,t,r,n,o,i,s,a){var u=t&Hp;if(!u&&typeof e!="function")throw new TypeError(uY);var l=n?n.length:0;if(l||(t&=~(Ji|Eu),n=o=void 0),s=s===void 0?s:Wp(o2(s),0),a=a===void 0?a:o2(a),l-=o?o.length:0,t&Eu){var c=n,f=o;n=o=void 0}var p=[e,t,r,n,o,c,f,i,s,a];if(e=p[0],t=p[1],r=p[2],n=p[3],o=p[4],a=p[9]=p[9]==null?u?0:e.length:Wp(p[9]-l,0),!a&&t&(jo|wu)&&(t&=~(jo|wu)),!t||t==Lo)var d=GY(e,t,r);else t==jo||t==wu?d=JY(e,t,a):(t==Ji||t==(Lo|Ji))&&!o.length?d=ZY(e,t,r,n):d=wb.apply(void 0,p);return m2(d,e,t)}function d2(e){var t=e;return t.placeholder}function n2(e,t){var r=$Y(e,t);return WY(r)?r:void 0}function XY(e){var t=e.match(xY);return t?t[1].split(wY):[]}function QY(e,t){var r=t.length,n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(vY,`{
/* [wrapped with `+t+`] */
`)}function eX(e,t){return t=t??fY,!!t&&(typeof e=="number"||CY.test(e))&&e>-1&&e%1==0&&e<t}function tX(e){return!!t2&&t2 in e}function rX(e,t){for(var r=e.length,n=zY(t.length,r),o=VY(e);n--;){var i=t[n];e[n]=eX(i,r)?o[i]:void 0}return e}var m2=r2?function(e,t,r){var n=t+"";return r2(e,"toString",{configurable:!0,enumerable:!1,value:lX(QY(n,oX(XY(n),r)))})}:fX;function nX(e){if(e!=null){try{return l2.call(e)}catch{}try{return e+""}catch{}}return""}function oX(e,t){return kY(dY,function(r){var n="_."+r[0];t&r[1]&&!NY(e,n)&&e.push(n)}),e.sort()}function Eb(e,t,r){t=r?void 0:t;var n=YY(e,jo,void 0,void 0,void 0,void 0,void 0,t);return n.placeholder=Eb.placeholder,n}function iX(e){var t=Zi(e)?f2.call(e):"";return t==mY||t==hY}function Zi(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function sX(e){return!!e&&typeof e=="object"}function aX(e){return typeof e=="symbol"||sX(e)&&f2.call(e)==gY}function uX(e){if(!e)return e===0?e:0;if(e=cX(e),e===Q$||e===-Q$){var t=e<0?-1:1;return t*pY}return e===e?e:0}function o2(e){var t=uX(e),r=t%1;return t===t?r?t-r:t:0}function cX(e){if(typeof e=="number")return e;if(aX(e))return e2;if(Zi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Zi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(bY,"");var r=SY.test(e);return r||_Y.test(e)?TY(e.slice(2),r?2:8):EY.test(e)?e2:+e}function lX(e){return function(){return e}}function fX(e){return e}Eb.placeholder={};h2.exports=Eb});var mee={};Av(mee,{default:()=>be});module.exports=Ed(mee);function Rv(e){var t=new WeakMap;return r=>t.has(r)?t.get(r):gj(t,r,e(r,t))}function gj(e,t,r){return e.set(t,r),r}function Dv(e){return e&&typeof e=="object"?JSON.parse(JSON.stringify(e)):e}var jr=typeof queueMicrotask=="function"?queueMicrotask:(e=>t=>e.then(t))(Promise.resolve());function Pv(e){let t=Promise.resolve(e);return(r,n)=>r||n?(typeof n>"u"&&(n=console.error),t=t.then(r,n)):t}function Fv(){let e,t,r=new Promise((n,o)=>{e=n,t=o});return{resolve:e,reject:t,promise:r}}var Cee=require("obsidian"),rt;(function(e){Object.assign(e,require("obsidian"))})(rt||(rt={}));var Sd="use.me",Id="use.factory",Ko,ls,_d=function(){return Object.defineProperties(e(),{this:{get(){if(Ko)return Ko;throw new TypeError("No current context")}},me:{value:Sd},factory:{value:Id}});function e(o){let i=new Map;i.prev=o;let s=Object.assign(o?u=>{let l=i.get(u);if(!l){for(let d=i.prev;d;d=d.prev)if(l=d.get(u)){l=Object.assign(Object.assign({},l),{s:l.s||1});break}l=l||{s:2,v:r},i.set(u,l)}let c,f,p;for(;;)switch(l.s){case 0:return Ko===s&&ls&&ls.push(u),l.v;case 1:if(c=l.d,!c||a(()=>c.k.every(d=>s(d)===c.c(d)))){l.s=0;break}l.v=c.f;case 2:l.s=4;try{t(i,u,0,a(f=l.v,u,p=[])),p.length&&(l.d={c:s,f,k:p});break}catch(d){l.s=3,l.v=d,l.d=null}case 3:throw l.v;case 4:throw new Error(`Factory ${String(l.v)} didn't resolve ${String(u)}`)}}:u=>_d.this(u),{def(u,l){return t(i,u,2,l),s},set(u,l){return t(i,u,1,l),s},fork(u){let l=e(i);return u!=null?l(u):l}});return o?s.use=s:s;function a(u,l,c){let f=Ko,p=ls;try{return Ko=s,ls=c,u(l)}finally{Ko=f,ls=p}}}function t(o,i,s,a){if(o.has(i)){let u=o.get(i);if(!u.s)throw new Error(`Already read: ${String(i)}`);u.s=s,u.v=a,u.d=null}else o.set(i,{s,v:a})}function r(o){if(typeof o[Sd]=="function")return o[Sd](o);if(n(o))return typeof o.prototype[Id]=="function"?o.prototype[Id]():new o;throw new ReferenceError(`No config for ${String(o)}`)}function n(o){return typeof o=="function"&&o.prototype!==void 0&&(Object.getPrototypeOf(o.prototype)!==Object.prototype||Object.getOwnPropertyNames(o.prototype).length>1||o.toString().startsWith("class"))}}();var yj,Vo=(e=>(e.service=function(t){return e(Mu).addChild(t),e.this},e.plugin=function(t){if(!Lr)yj=t.app,Lr=e.fork(),Lr.set(rt.Plugin,t),Lr.set(t.constructor,t),t.addChild(Lr.use(Mu));else if(t!==Lr.use(rt.Plugin))throw new TypeError("use.plugin() called on multiple plugins");return Lr},e.def(rt.Plugin,()=>{throw new Error("Plugin not created yet")}),e.def(rt.App,()=>e(rt.Plugin).app),e))(_d),Lr;function Cd(e){if(e?.use)return e.use;if(Lr)return Lr;if(e instanceof rt.Plugin)return e.use=Vo.plugin(e);throw new Error("No context available: did you forget to `use.plugin()`?")}var ue=class extends rt.Component{constructor(){super(...arguments),this.use=Vo.service(this)}},Mu=class extends rt.Component{constructor(){super(...arguments),this.children=new Set([this])}onload(){this.loaded=!0}onunload(){this.loaded=!1,this.children.clear()}addChild(t){return this.children.has(t)||(this.children.add(t),this.loaded?jr(()=>super.addChild(t)):super.addChild(t)),t}};function bj(e,t){jr(()=>e.removeChild(t))}function $v(e,t){let r=new rt.Component;r.onload=()=>{bj(e,r),e=null,t()},e.addChild(r)}function Lu(){throw new Error("Cycle detected")}function qu(){if(ln>1){ln--;return}let e,t=!1;for(;fs!==void 0;){let r=fs;for(fs=void 0,Td++;r!==void 0;){let n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&qv(r))try{r.c()}catch(o){t||(e=o,t=!0)}r=n}}if(Td=0,ln--,t)throw e}function Mv(e){if(ln>0)return e();ln++;try{return e()}finally{qu()}}var Ae,fs;var ln=0,Td=0,ju=0;function jv(e){if(Ae===void 0)return;let t=e.n;if(t===void 0||t.t!==Ae)return t={i:0,S:e,p:Ae.s,n:void 0,t:Ae,e:void 0,x:void 0,r:t},Ae.s!==void 0&&(Ae.s.n=t),Ae.s=t,e.n=t,32&Ae.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Ae.s,t.n=void 0,Ae.s.n=t,Ae.s=t),t}function ht(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}ht.prototype.h=function(){return!0};ht.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};ht.prototype.U=function(e){if(this.t!==void 0){let t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};ht.prototype.subscribe=function(e){let t=this;return Ad(function(){let r=t.value,n=32&this.f;this.f&=-33;try{e(r)}finally{this.f|=n}})};ht.prototype.valueOf=function(){return this.value};ht.prototype.toString=function(){return this.value+""};ht.prototype.toJSON=function(){return this.value};ht.prototype.peek=function(){return this.v};Object.defineProperty(ht.prototype,"value",{get(){let e=jv(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(Ae instanceof fn&&function(){throw new Error("Computed cannot have side-effects")}(),e!==this.v){Td>100&&Lu(),this.v=e,this.i++,ju++,ln++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{qu()}}}});function Lv(e){return new ht(e)}function qv(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Bv(e){for(let t=e.s;t!==void 0;t=t.n){let r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function zv(e){let t,r=e.s;for(;r!==void 0;){let n=r.p;r.i===-1?(r.S.U(r),n!==void 0&&(n.n=r.n),r.n!==void 0&&(r.n.p=n)):t=r,r.S.n=r.r,r.r!==void 0&&(r.r=void 0),r=n}e.s=t}function fn(e){ht.call(this,void 0),this.x=e,this.s=void 0,this.g=ju-1,this.f=4}(fn.prototype=new ht).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ju))return!0;if(this.g=ju,this.f|=1,this.i>0&&!qv(this))return this.f&=-2,!0;let e=Ae;try{Bv(this),Ae=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Ae=e,zv(this),this.f&=-2,!0};fn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}ht.prototype.S.call(this,e)};fn.prototype.U=function(e){if(this.t!==void 0&&(ht.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}};fn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}};fn.prototype.peek=function(){if(this.h()||Lu(),16&this.f)throw this.v;return this.v};Object.defineProperty(fn.prototype,"value",{get(){1&this.f&&Lu();let e=jv(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Bu(e){return new fn(e)}function Uv(e){let t=e.u;if(e.u=void 0,typeof t=="function"){ln++;let r=Ae;Ae=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Od(e),n}finally{Ae=r,qu()}}}function Od(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Uv(e)}function vj(e){if(Ae!==this)throw new Error("Out-of-order effect");zv(this),Ae=e,this.f&=-2,8&this.f&&Od(this),qu()}function ps(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}ps.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};ps.prototype.S=function(){1&this.f&&Lu(),this.f|=1,this.f&=-9,Uv(this),Bv(this),ln++;let e=Ae;return Ae=this,vj.bind(this,e)};ps.prototype.N=function(){2&this.f||(this.f|=2,this.o=fs,fs=this)};ps.prototype.d=function(){this.f|=8,1&this.f||Od(this)};function Ad(e){let t=new ps(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function kd(e){let t=Bu(e);return()=>t.value}function Wv(e){let t=Lv(e);function r(){return t.value,e}return r.set=function(n){e!==n&&(ms.size||jr(xj),ms.set(t,e=n))},r}var ms=new Map;function xj(){ms.size&&Mv(()=>{for(let[e,t]of ms.entries())ms.delete(e),e.value=t})}var wj=Rv(function(e){return{}});function fe(e,t,r){let n=r.get;return{...r,get(){var o,i;return((o=(i=wj(this))[t])!==null&&o!==void 0?o:i[t]=kd(n.bind(this)))()}}}var ds;function qe(e){let t=Ad(function(){let r=ds,n=ds=[];try{let o=e.call(this);if(o&&n.push(o),n.length)return n.length===1?n.pop():function(){for(;n.length;)try{n.shift()()}catch(i){Promise.reject(i)}}}finally{ds=r}});return ds&&ds.push(t),t}function qt(e,t){let r=Object.keys(t).map(n=>Ej(e,n,t[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function Ej(e,t,r){let n=e[t],o=e.hasOwnProperty(t),i=r(n);return n&&Object.setPrototypeOf(i,n),Object.setPrototypeOf(s,i),e[t]=s,a;function s(...u){return i===n&&e[t]===s&&a(),i.apply(this,u)}function a(){e[t]===s&&(o?e[t]=n:delete e[t]),i!==n&&(i=n,Object.setPrototypeOf(s,n||Function))}}var zu=e=>{if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Sj=new Set(["__proto__","prototype","constructor"]),Nd=(e,t)=>{if(!zu(t))return e;e||(e={});for(let[r,n]of Object.entries(t)){if(Sj.has(r))continue;let o=e[r];if(zu(o)&&zu(n))e[r]=Nd(o,n);else{if(n===void 0)continue;zu(n)?e[r]=Nd({},n):Array.isArray(n)?e[r]=[...n]:e[r]=n}}return e};function Uu(e={},t={}){return Nd({...t},{...e})}var Wu=class extends ue{get current(){return this.cloned()}addDefaults(t){this.data=Uu(this.data,t)}constructor(){super(),this.plugin=this.use(rt.Plugin),this.queue=Pv(),this.data={},this.version=Wv(0),this.cloned=kd(()=>this.version()?Dv(this.data):null),this.queue(async()=>{var t;await new Promise(r=>$v(this.plugin,r)),this.data=Uu((t=await this.plugin.loadData())!==null&&t!==void 0?t:{},this.data),this.version.set(this.version()+1)},console.error)}once(t,r){let n=this.each(o=>{n(),t.call(r,o)});return n}each(t,r){return qe(()=>{this.current&&jr(t.bind(r,this.current))})}onChange(t,r){return this.each(t,r)}update(t){return this.queue(async()=>{var r;let n=this.data,o=JSON.stringify(n);try{var i=JSON.parse(o);i=(r=t(i))!==null&&r!==void 0?r:i;let s=JSON.stringify(i);o!==s&&(this.data=i,this.version.set(this.version()+1),await this.plugin.saveData(JSON.parse(s)).catch(console.error))}catch(s){console.error(s)}return this.data})}};function Hv(e,t,r,n){let{resolve:o,promise:i}=Fv(),s=new class extends rt.FuzzySuggestModal{getItemText(a){var u;return(u=t?.(a))!==null&&u!==void 0?u:""+a}getItems(){return e}onChooseItem(a,u){o({item:a,event:u})}onClose(){super.onClose(),jr(()=>o({item:null,event:null}))}}(app);return r&&s.setPlaceholder(r),n?.(s),s.open(),i}var cj=require("obsidian");var Kv=e=>`obsidian-zotero:${e}`;var Bt=({key:e,groupID:t,parentItem:r},n=!1)=>{let o=[e];return!n&&r&&o.push(`a${r}`),typeof t=="number"&&o.push(`g${t}`),o.join("")},Vv=(e,t,r=!0)=>(n,...o)=>{let i="";for(let s=0;s<n.length;s++)s>0&&(i+=e(o[s-1])),i+=(r?n.raw:n)[s];return t(i)},Pd=(e=!0,t)=>Vv(r=>r,r=>new RegExp(e?"^"+r+"$":r,t),!0),Rd=String.raw`[23456789ABCDEFGHIJKLMNPQRSTUVWXYZ]{8}`,Dd=String.raw`\d+`,Gv=e=>{let t={annotKey:Rd,parentKey:Rd,groupID:Dd,page:Dd};if(e)for(let r in t)t[r]=`(${t[r]})`;return Vv(r=>t[r],r=>r)`${"annotKey"}a${"parentKey"}(?:g${"groupID"})?(?:p${"page"})?`},Jv=Pd()`${Rd}(?:g${Dd})?`,Zv=Pd()`${Gv(!0)}`,Yv=Pd()`(?:${Gv(!1)}n?)+`,Go=(e,t)=>{if(e===null)return null;let r;return typeof e=="number"?r=e:r=parseInt(e,10),Number.isInteger(r)?t?r+1:r:null};var Xv=(e,t,{getLogger:r,configure:n})=>{let o=Kv(e);return n({appenders:{out:{type:"console"}},categories:{default:{appenders:["out"],level:t},[o]:{appenders:["out"],level:t}}}),r(o)},Qv={ALL:"ALL",TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",FATAL:"FATAL",MARK:"MARK",OFF:"OFF"};var pn=()=>(...e)=>e;var e0=e=>`better-sqlite3-${e}.node`;var al=ge(xS(),1);var Eh=ge(si(),1),Cn=require("obsidian"),n_=ge(IS(),1);var y1=require("http");var Xq=ge(si(),1),Qq=ge(_m(),1),Cm=ge(_m(),1);var WS=pn()("open","export","update");var US=(e,t)=>{let r=new RegExp(`^${t}\\[(\\d+)\\]$`);return Object.entries(e).filter(([n])=>r.test(n)).sort(([n],[o])=>Number(n.match(r)[1])-Number(o.match(r)[1])).map(([,n])=>JSON.parse(n))},Sc=e=>{if(e.type==="item")return{version:e.version,type:e.type,items:US(e,"items")};if(e.type==="annotation")return{version:e.version,type:e.type,annots:US(e,"annots"),parent:JSON.parse(e.parent)};throw new TypeError("Unrecognized query type: "+e.type)};var Tm=/^<!--merge:(\d+)-->/;var Ic=require("obsidian");var Ms=require("path");var VS=require("path/posix");var Am=require("obsidian");var HS={"103":{darwin:["arm64","x64"],linux:["x64"],win32:["x64","ia32","arm64"]},"109":{darwin:["arm64","x64"],linux:["x64"],win32:["x64","ia32","arm64"]},"110":{darwin:["arm64","x64"],linux:["x64"],win32:["x64","ia32","arm64"]},"114":{darwin:["arm64","x64"],linux:["x64"],win32:["x64","ia32","arm64"]},"116":{darwin:["arm64","x64"],linux:["x64"],win32:["x64","ia32","arm64"]}};var KS=Am.Platform.isDesktopApp?require("@electron/remote").app.getPath("userData"):null,{arch:iie,platform:sie,versions:{modules:tB,electron:aie}}=process,Om=HS,GS=({modules:e})=>{if(e in Om)return 0;let r=Object.keys(Om).map(o=>parseInt(o,10)).sort((o,i)=>o-i);return parseInt(e,10)>r[r.length-1]?1:-1},JS=({platform:e,arch:t})=>!!Om[tB][e]?.includes(t),ZS=()=>Am.Platform.isDesktopApp?{arch:process.arch,platform:process.platform,modules:process.versions.modules,electron:process.versions.electron}:null,km=e=>e.versions?.["better-sqlite3"],ai=e=>{if(!KS)return null;let t=km(e);return t?(0,VS.join)(KS,e0(t)):null};var YS={citationEditorSuggester:!0,showCitekeyInSuggester:!1};var XS={literatureNoteFolder:"LiteratureNotes"};var QS={enableServer:!1,serverPort:9091,serverHostname:"127.0.0.1"};var Nm=require("path/posix");var e1=`[!note] Page <%= it.pageLabel %>
<%= it.imgEmbed %><%= it.text %>
<% if (it.comment) { %>
---
<%= it.comment %>
<% } %>`;var t1=`<% for (const annotation of it) { %>
<%~ include("annotation", annotation) %>
<% } %>`;var r1='[<%= it.map(lit => `@${lit.citekey}`).join("; ") %>]';var n1='<%= it.map(lit => `@${lit.citekey}`).join("; ") %>';var o1=`<mark style="
<%- if (it.color) { _%> color: <%= it.color %>; <%_ } -%>
<%- if (it.bgColor) { _%> background-color: <%= it.bgColor %>; <%_ } -%>
"><%= it.content %></mark>`;var i1=`title: "<%= it.title %>"
citekey: "<%= it.citekey %>"`;var s1=`# <%= it.title %>
[Zotero](<%= it.backlink %>) <%= it.fileLink %>
<%~ include("annots", it.annotations) %>`;var ot={Ejectable:{note:s1,field:i1,annots:t1,annotation:e1,cite:r1,cite2:n1,colored:o1},Embeded:{filename:"<%= it.citekey ?? it.DOI ?? it.title ?? it.key %>.md"}},_r={Ejectable:Object.keys(ot.Ejectable),Embeded:Object.keys(ot.Embeded),All:Object.keys(ot.Ejectable).concat(Object.keys(ot.Embeded))};function Rm(e){return Object.hasOwn(ot.Embeded,e)?`zt-${e}.eta.md`:Object.hasOwn(ot.Ejectable,e)?e==="annotation"?"zt-annot.eta.md":`zt-${e}.eta.md`:null}function io(e,t){return(0,Nm.join)(t,Rm(e))}function ct(e,t){let r=_r.Embeded.find(o=>(0,Nm.join)(t,`zt-${o}.eta.md`)===e);if(r)return{type:"embeded",name:r};let n=_r.Ejectable.find(o=>io(o,t)===e);return n?{type:"ejectable",name:n}:null}var a1={template:{folder:"ZtTemplates",templates:ot.Embeded},updateAnnotBlock:!1,updateOverwrite:!1,autoPairEta:!1,autoTrim:[!1,!1]};var u1={autoRefresh:!0};var c1=require("os"),l1=require("path"),f1=()=>({zoteroDataDir:(0,l1.join)((0,c1.homedir)(),"Zotero"),citationLibrary:1});var p1=require("obsidian"),d1={imgExcerptImport:p1.Platform.isWin?"copy":"symlink",imgExcerptPath:"ZtImgExcerpt"};var m1=()=>({...h1,...YS,...XS,...QS,...a1,...u1,...f1(),...d1});function Qe(e,t,r=!1){let n=0;return(...o)=>{if(t(),n++>(r?1:0))return e(...o)}}var de=class extends Wu{#e=this.use(be);#t;get nativeBinding(){if(this.#t)return this.#t;let t=ai(this.#e.manifest);if(t)return this.#t=t,this.#t;throw new Error("Failed to get native binding path")}get templateDir(){return this.current?.template?.folder}get libId(){return this.current?.citationLibrary}get simpleTemplates(){return this.current?.template?.templates}get zoteroDbPath(){return(0,Ms.join)(this.current?.zoteroDataDir,"zotero.sqlite")}get bbtSearchDbPath(){return(0,Ms.join)(this.current?.zoteroDataDir,"better-bibtex-search.sqlite")}get bbtMainDbPath(){return(0,Ms.join)(this.current?.zoteroDataDir,"better-bibtex.sqlite")}get zoteroCacheDirPath(){return(0,Ms.join)(this.current?.zoteroDataDir,"cache")}get dbConnParams(){return[{zotero:this.zoteroDbPath,bbtSearch:this.bbtSearchDbPath,bbtMain:this.bbtMainDbPath},{nativeBinding:this.nativeBinding}]}};le([fe],de.prototype,"templateDir",1),le([fe],de.prototype,"libId",1),le([fe],de.prototype,"simpleTemplates",1),le([fe],de.prototype,"zoteroDbPath",1),le([fe],de.prototype,"bbtSearchDbPath",1),le([fe],de.prototype,"bbtMainDbPath",1),le([fe],de.prototype,"zoteroCacheDirPath",1),le([fe],de.prototype,"dbConnParams",1);function g1(e){let t=Cd(e)(de);return t.addDefaults(m1()),t}var cB=new Set(["notify"]),lB=new Set([...WS.map(e=>`zotero/${e}`)]),Ur=class extends ue{#e=new Ic.Events;settings=this.use(de);plugin=this.use(be);server=null;get port(){return this.settings.current?.serverPort}get hostname(){return this.settings.current?.serverHostname}get enableServer(){return this.settings.current?.enableServer}onload(){this.register(qe(Qe(()=>{this.enableServer?this.initServer():this.closeServer()},()=>this.enableServer))),this.register(qe(Qe(()=>{this.reloadPort(),new Ic.Notice("Server port is saved and applied.")},()=>(this.port,this.hostname),!0))),this.registerObsidianProtocolHandler()}onunload(){this.closeServer(),this.server=null}registerObsidianProtocolHandler(){let t=r=>{let{action:n,...o}=r;this.trigger(n,o)};for(let r of lB)this.plugin.registerObsidianProtocolHandler(r,t)}#t(){this.server??=(0,y1.createServer)((t,r)=>{this.requestListener(t,r)})}#r(){this.server?.listening||this.server?.listen(this.port,this.hostname,()=>this.listeningListener())}initServer(){this.#t(),this.#r()}closeServer(){this.server?.close()}reloadPort(){this.enableServer&&(this.closeServer(),this.#t(),this.#r())}requestListener(t,r){if(!t.url){W.error("Request without url"),r.statusCode=400,r.end();return}W.trace("server recieved req",t.url,t.rawHeaders);let{pathname:n,searchParams:o}=new URL(t.url,`http://${t.headers.host}`),i=n.substring(1),s=`bg:${n.substring(1)}`;if(cB.has(i)){let a=Object.fromEntries(o.entries());t.headers["content-type"]==="application/json"?new Promise((u,l)=>{let c="";t.on("data",f=>c+=f),t.on("error",f=>l(f)),t.on("end",()=>{try{u(JSON.parse(c))}catch(f){l(f)}})}).then(u=>{this.trigger(s,a,u),r.end()}):(this.trigger(s,a),r.end())}else r.statusCode=404,r.end()}listeningListener(){this.server&&W.info(`Server is listening at ${fB(this.server)}`)}on(t,r,n){return this.#e.on(t,r,n)}off(t,r){return this.#e.off(t,r)}offref(t){return this.#e.offref(t)}trigger(t,...r){return W.trace(`server trigger ${t}`,...r),this.#e.trigger(t,...r)}tryTrigger(t,r){return this.#e.tryTrigger(t,r)}};le([fe],Ur.prototype,"port",1),le([fe],Ur.prototype,"hostname",1),le([fe],Ur.prototype,"enableServer",1);function fB(e){let t=e.address();return t?typeof t=="string"?t:`${t.address}:${t.port}`:"?"}var b1=ge(si(),1),v1=require("obsidian");function x1(e,t={}){return qs({...t,register:r=>e.metadataCache.on("initialized",r),unregister:r=>e.metadataCache.offref(r),escape:()=>e.metadataCache.initialized,timeout:t.timeout??null})}function Dm(e,t={}){return qs({...t,register:r=>e.vault.on("zotero:db-refresh",r),unregister:r=>e.vault.offref(r)})}function ui(e,t={}){return qs({...t,unregister:r=>e.app.vault.offref(r),escape:()=>e.dbWorker.status===2,register:r=>{let n=e.dbWorker.status;if(n===0)return e.app.vault.on("zotero:db-ready",r);if(n===1)return e.app.vault.on("zotero:db-refresh",r);if(n===2)throw new Error("should not be called when db is ready");(0,b1.assertNever)(n)}})}var w1=e=>new Promise(t=>{e.workspace.onLayoutReady(t)}),qs=({register:e,unregister:t,escape:r,timeout:n=1e4,waitAfterEvent:o,debounce:i=1e3})=>{let s=null;return[new Promise((u,l)=>{if(r?.()){u();return}s=function(){t(p),l(new Ls)};function c(){t(p),u()}async function f(){o!==void 0&&await sleep(o),c()}let p=e(i?(0,v1.debounce)(f,i,!0):f);n!==null&&sleep(n).then(()=>{t(p),r?.()?c():l(new js(n))})}),s]},js=class extends Error{constructor(r){super(`Timeout after ${r}ms`);this.timeout=r}},Ls=class extends Error{constructor(){super("Manually cancelled")}};var dB=e=>{let t=new Blob([e],{type:"text/javascript"});return URL.createObjectURL(t)},E1=(e,t)=>{let r=dB(e),n=new Worker(r,t);return URL.revokeObjectURL(r),n};var Pm=class extends Error{},xe=e=>{throw new Pm(e)},Fm=class extends Error{},he=e=>{throw new Fm(e)};var xn=(e,t)=>De(e)===t,De=e=>{let t=typeof e;return t==="object"?e===null?"null":"object":t==="function"?"object":t},$m={bigint:"a bigint",boolean:"boolean",null:"null",number:"a number",object:"an object",string:"a string",symbol:"a symbol",undefined:"undefined"};var Gt=(e,t)=>e in t,S1=e=>Object.entries(e),we=e=>Object.keys(e),so=e=>{let t=[];for(;e!==Object.prototype&&e!==null&&e!==void 0;){for(let r of Object.getOwnPropertyNames(e))t.includes(r)||t.push(r);for(let r of Object.getOwnPropertySymbols(e))t.includes(r)||t.push(r);e=Object.getPrototypeOf(e)}return t},ci=(e,t)=>{let r=e?.[t];return r!=null};var I1=e=>Object.keys(e).length,Bs=e=>xn(e,"object")?Object.keys(e).length!==0:!1,sse=Symbol("id");var Cr=e=>Array.isArray(e)?e:[e];var We=class extends Array{static fromString(t,r="/"){return t===r?new We:new We(...t.split(r))}toString(t="/"){return this.length?this.join(t):t}},_1=(e,t)=>{let r=e;for(let n of t){if(typeof r!="object"||r===null)return;r=r[n]}return r};var Mm=/^(?!^-0$)-?(?:0|[1-9]\d*)(?:\.\d*[1-9])?$/,mB=e=>Mm.test(e),hB=/^-?\d*\.?\d*$/,gB=e=>e.length!==0&&hB.test(e),_c=/^(?:0|(?:-?[1-9]\d*))$/,zs=e=>_c.test(e),Us=/^(?:0|(?:[1-9]\d*))$/,C1=/^-?\d+$/,yB=e=>C1.test(e),T1={number:"a number",bigint:"a bigint",integer:"an integer"},O1=(e,t)=>`'${e}' was parsed as ${T1[t]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,bB=(e,t)=>t==="number"?mB(e):zs(e),vB=(e,t)=>t==="number"?Number(e):Number.parseInt(e),xB=(e,t)=>t==="number"?gB(e):yB(e),Ws=(e,t)=>A1(e,"number",t),Cc=(e,t)=>A1(e,"integer",t),A1=(e,t,r)=>{let n=vB(e,t);if(!Number.isNaN(n)){if(bB(e,t))return n;if(xB(e,t))return he(O1(e,t))}return r?he(r===!0?`Failed to parse ${T1[t]} from '${e}'`:r):void 0},jm=e=>{if(e[e.length-1]!=="n")return;let t=e.slice(0,-1),r;try{r=BigInt(t)}catch{return}if(_c.test(t))return r;if(C1.test(t))return he(O1(e,"bigint"))};var Te=(e,t)=>{switch(De(e)){case"object":return JSON.stringify(Lm(e,Tc,[]),null,t);case"symbol":return Tc.onSymbol(e);default:return qm(e)}},Tc={onCycle:()=>"(cycle)",onSymbol:e=>`(symbol${e.description&&` ${e.description}`})`,onFunction:e=>`(function${e.name&&` ${e.name}`})`},Lm=(e,t,r)=>{switch(De(e)){case"object":if(typeof e=="function")return Tc.onFunction(e);if(r.includes(e))return"(cycle)";let n=[...r,e];if(Array.isArray(e))return e.map(i=>Lm(i,t,n));let o={};for(let i in e)o[i]=Lm(e[i],t,n);return o;case"symbol":return Tc.onSymbol(e);case"bigint":return`${e}n`;case"undefined":return"undefined";default:return e}},qm=e=>typeof e=="string"?`'${e}'`:typeof e=="bigint"?`${e}n`:`${e}`;function wB(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function EB(e,t){return t.get?t.get.call(e):t.value}function SB(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function N1(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function k1(e,t){var r=N1(e,t,"get");return EB(e,r)}function IB(e,t,r){wB(e,t),t.set(e,r)}function _B(e,t,r){var n=N1(e,t,"set");return SB(e,n,r),r}function Oc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Jt=e=>(t,r,n)=>t===void 0?r===void 0?xe(Nc):r:r===void 0?t:e(t,r,n),Nc="Unexpected operation two undefined operands",Bm={domain:({l:e,r:t})=>`${e.join(", ")} and ${t.join(", ")}`,range:({l:e,r:t})=>`${kc(e)} and ${kc(t)}`,class:({l:e,r:t})=>`classes ${typeof e=="string"?e:e.name} and ${typeof t=="string"?t:t.name}`,tupleLength:({l:e,r:t})=>`tuples of length ${e} and ${t}`,value:({l:e,r:t})=>`literal values ${Te(e)} and ${Te(t)}`,leftAssignability:({l:e,r:t})=>`literal value ${Te(e.value)} and ${Te(t)}`,rightAssignability:({l:e,r:t})=>`literal value ${Te(t.value)} and ${Te(e)}`,union:({l:e,r:t})=>`branches ${Te(e)} and branches ${Te(t)}`},kc=e=>"limit"in e?`the range of exactly ${e.limit}`:e.min?e.max?`the range bounded by ${e.min.comparator}${e.min.limit} and ${e.max.comparator}${e.max.limit}`:`${e.min.comparator}${e.min.limit}`:e.max?`${e.max.comparator}${e.max.limit}`:"the unbounded range",Ac=new WeakMap,wn=class{get disjoints(){return k1(this,Ac)}addDisjoint(t,r,n){return k1(this,Ac)[`${this.path}`]={kind:t,l:r,r:n},Rc}constructor(t,r){Oc(this,"type",void 0),Oc(this,"lastOperator",void 0),Oc(this,"path",void 0),Oc(this,"domain",void 0),IB(this,Ac,{writable:!0,value:void 0}),this.type=t,this.lastOperator=r,this.path=new We,_B(this,Ac,{})}},Rc=Symbol("empty"),R1=()=>Rc,ur=e=>e===Rc,D1=Symbol("equal"),He=()=>D1,Zt=e=>e===D1,li=(e,t)=>(r,n,o)=>{let i={},s=we({...r,...n}),a=!0,u=!0;for(let l of s){let c=typeof e=="function"?e(l,r[l],n[l],o):e[l](r[l],n[l],o);if(Zt(c))r[l]!==void 0&&(i[l]=r[l]);else if(ur(c))if(t.onEmpty==="omit")a=!1,u=!1;else return Rc;else c!==void 0&&(i[l]=c),a&&(a=c===r[l]),u&&(u=c===n[l])}return a?u?He():r:u?n:i};var P1=e=>{let t=we(e);if(t.length===1){let n=t[0];return`${n==="/"?"":`At ${n}: `}Intersection of ${Bm[e[n].kind](e[n])} results in an unsatisfiable type`}let r=`
"Intersection results in unsatisfiable types at the following paths:
`;for(let n in e)r+=` ${n}: ${Bm[e[n].kind](e[n])}
`;return r},Dc=(e,t,r)=>`${e.length?`At ${e}: `:""}${t} ${r?`${r} `:""}results in an unsatisfiable type`;var Hs={Array,Date,Error,Function,Map,RegExp,Set,Object,String,Number,Boolean,WeakMap,WeakSet,Promise},fi=(e,t)=>{if(De(e)!=="object")return;let r=t??Hs,n=Object.getPrototypeOf(e);for(;n?.constructor&&(!r[n.constructor.name]||!(e instanceof r[n.constructor.name]));)n=Object.getPrototypeOf(n);return n?.constructor?.name};var En=e=>Array.isArray(e),zm={Object:"an object",Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},Pc=e=>{let t=Object(e).name;return t&&Gt(t,Hs)&&Hs[t]===e?t:void 0};var F1=Jt((e,t,r)=>e===t?He():e instanceof t?e:t instanceof e?t:r.addDisjoint("class",e,t)),$1=(e,t)=>typeof e=="string"?fi(t.data)===e||!t.problems.add("class",e):t.data instanceof e||!t.problems.add("class",e);var Fc=(e,t)=>{if(Array.isArray(e)){if(Array.isArray(t)){let r=CB(e,t);return r.length===e.length?r.length===t.length?He():e:r.length===t.length?t:r}return e.includes(t)?e:[...e,t]}return Array.isArray(t)?t.includes(e)?t:[...t,e]:e===t?He():[e,t]},CB=(e,t)=>{let r=[...e];for(let n of t)e.includes(n)||r.push(n);return r};var M1=Jt((e,t)=>e===t?He():Math.abs(e*t/TB(e,t))),TB=(e,t)=>{let r,n=e,o=t;for(;o!==0;)r=o,o=n%o,n=r;return n},j1=(e,t)=>t.data%e===0||!t.problems.add("divisor",e);var Ks=e=>e[0]==="?",$c=e=>e[0]==="!",Or={index:"[index]"},Sn=e=>Ks(e)||$c(e)?e[1]:e,OB=e=>{if(typeof e.length=="object"&&$c(e.length)&&typeof e.length[1]!="string"&&jc(e.length[1],"number"))return e.length[1].number.value},L1=Jt((e,t,r)=>{let n=AB(e,t,r);if(typeof n=="symbol")return n;let o=OB(n);if(o===void 0||!(Or.index in n))return n;let{[Or.index]:i,...s}=n,a=Sn(i);for(let u=0;u<o;u++){if(!s[u]){s[u]=a;continue}let l=Sn(s[u]);r.path.push(`${u}`);let c=Mc(l,a,r);if(r.path.pop(),ur(c))return c;!Zt(c)&&c!==l&&(s[u]=c)}return s}),AB=li((e,t,r,n)=>{if(t===void 0)return r===void 0?He():r;if(r===void 0)return t;n.path.push(e);let o=Mc(Sn(t),Sn(r),n);n.path.pop();let i=Ks(t)&&Ks(r);return ur(o)&&i?{}:o},{onEmpty:"bubble"}),q1=(e,t,r)=>{let n=r.type.config?.keys??r.type.scope.config.keys;return n==="loose"?kB(e,t,r):NB(n,e,t,r)},kB=(e,t,r)=>{for(let n in t){let o=t[n];r.path.push(n),n===Or.index?e.push(["indexProp",Tr(Sn(o),r)]):Ks(o)?e.push(["optionalProp",[n,Tr(o[1],r)]]):$c(o)?e.push(["prerequisiteProp",[n,Tr(o[1],r)]]):e.push(["requiredProp",[n,Tr(o,r)]]),r.path.pop()}},NB=(e,t,r,n)=>{let o={required:{},optional:{}};for(let i in r){let s=r[i];n.path.push(i),i===Or.index?o.index=Tr(Sn(s),n):Ks(s)?o.optional[i]=Tr(s[1],n):$c(s)?t.push(["prerequisiteProp",[i,Tr(s[1],n)]]):o.required[i]=Tr(s,n),n.path.pop()}t.push([`${e}Props`,o])};function RB(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Um=e=>typeof e=="string"||Array.isArray(e)?e.length:typeof e=="number"?e:0,DB=e=>typeof e=="string"?"characters":Array.isArray(e)?"items long":"",Lc=class{toString(){return Te(this.value)}get domain(){return De(this.value)}get size(){return Um(this.value)}get units(){return DB(this.value)}get className(){return Object(this.value).constructor.name}constructor(t){RB(this,"value",void 0),this.value=t}};var qc={">":!0,">=":!0},Wm={"<":!0,"<=":!0},Vs=e=>"comparator"in e,z1=Jt((e,t,r)=>{if(Vs(e))return Vs(t)?e.limit===t.limit?He():r.addDisjoint("range",e,t):B1(t,e.limit)?e:r.addDisjoint("range",e,t);if(Vs(t))return B1(e,t.limit)?t:r.addDisjoint("range",e,t);let n=pi("min",e.min,t.min),o=pi("max",e.max,t.max);return n==="l"?o==="r"?pi("min",e.min,t.max)==="l"?r.addDisjoint("range",e,t):{min:e.min,max:t.max}:e:n==="r"?o==="l"?pi("max",e.max,t.min)==="l"?r.addDisjoint("range",e,t):{min:t.min,max:e.max}:t:o==="l"?e:o==="r"?t:He()}),B1=(e,t)=>Vs(e)?t===e.limit:PB(e.min,t)&&FB(e.max,t),PB=(e,t)=>!e||t>e.limit||t===e.limit&&!Gs(e.comparator),FB=(e,t)=>!e||t<e.limit||t===e.limit&&!Gs(e.comparator),U1=(e,t,r)=>{let n=r.lastDomain==="string"?"characters":r.lastDomain==="object"?"items long":void 0;if(Vs(t))return e.push(["bound",n?{...t,units:n}:t]);t.min&&e.push(["bound",n?{...t.min,units:n}:t.min]),t.max&&e.push(["bound",n?{...t.max,units:n}:t.max])},W1=(e,t)=>$B[e.comparator](Um(t.data),e.limit)||!t.problems.add("bound",e),$B={"<":(e,t)=>e<t,">":(e,t)=>e>t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e===t},pi=(e,t,r)=>t?r?t.limit===r.limit?Gs(t.comparator)?Gs(r.comparator)?"=":"l":Gs(r.comparator)?"r":"=":e==="min"?t.limit>r.limit?"l":"r":t.limit<r.limit?"l":"r":"l":r?"r":"=",Gs=e=>e.length===1;var Hm={},Km=e=>(Hm[e]||(Hm[e]=new RegExp(e)),Hm[e]),H1=(e,t)=>Km(e).test(t.data)||!t.problems.add("regex",`/${e}/`),K1=Jt(Fc);var G1=(e,t,r)=>"value"in e?"value"in t?e.value===t.value?He():r.addDisjoint("value",e.value,t.value):V1(e.value,t,r)?e:r.addDisjoint("leftAssignability",e,t):"value"in t?V1(t.value,e,r)?t:r.addDisjoint("rightAssignability",e,t):jB(e,t,r),MB=Jt(Fc),jB=li({divisor:M1,regex:K1,props:L1,class:F1,range:z1,narrow:MB},{onEmpty:"bubble"}),Vm=(e,t)=>{let r=[],n;for(n in e)LB[n](r,e[n],t);return r.sort((o,i)=>Js[o[0]]-Js[i[0]])},LB={regex:(e,t)=>{for(let r of Cr(t))e.push(["regex",r])},divisor:(e,t)=>{e.push(["divisor",t])},range:U1,class:(e,t)=>{e.push(["class",t])},props:q1,narrow:(e,t)=>{for(let r of Cr(t))e.push(["narrow",r])},value:(e,t)=>{e.push(["value",t])}},Js={config:-1,domain:0,value:0,domains:0,branches:0,switch:0,alias:0,class:0,regex:1,divisor:1,bound:1,prerequisiteProp:2,distilledProps:3,strictProps:3,requiredProp:3,optionalProp:3,indexProp:3,narrow:4,morph:5},V1=(e,t,r)=>!r.type.scope.type(["node",{[r.domain]:t}])(e).problems;var Gm=e=>e?.lBranches!==void 0,Z1=(e,t,r)=>{let n={lBranches:e,rBranches:t,lExtendsR:[],rExtendsL:[],equalities:[],distinctIntersections:[]},o=t.map(i=>({condition:i,distinct:[]}));return e.forEach((i,s)=>{let a=!1,u=o.map((l,c)=>{if(a||!l.distinct)return null;let f=l.condition,p=Ys(i,f,r);return ur(p)?null:p===i?(n.lExtendsR.push(s),a=!0,null):p===f?(n.rExtendsL.push(c),l.distinct=null,null):Zt(p)?(n.equalities.push([s,c]),a=!0,l.distinct=null,null):xn(p,"object")?p:xe(`Unexpected predicate intersection result of type '${De(p)}'`)});if(!a)for(let l=0;l<o.length;l++)u[l]&&o[l].distinct?.push(u[l])}),n.distinctIntersections=o.flatMap(i=>i.distinct??[]),n},Jm=e=>"rules"in e,Zs=(e,t)=>{if(Jm(e)){let r=Vm(e.rules,t);if(e.morph)if(typeof e.morph=="function")r.push(["morph",e.morph]);else for(let n of e.morph)r.push(["morph",n]);return r}return Vm(e,t)},J1=e=>e.rules??e,Ys=(e,t,r)=>{let n=J1(e),o=J1(t),i=G1(n,o,r);return"morph"in e?"morph"in t?e.morph===t.morph?Zt(i)||ur(i)?i:{rules:i,morph:e.morph}:r.lastOperator==="&"?he(Dc(r.path,"Intersection","of morphs")):{}:ur(i)?i:{rules:Zt(i)?e.rules:i,morph:e.morph}:"morph"in t?ur(i)?i:{rules:Zt(i)?t.rules:i,morph:t.morph}:i};var Y1=e=>`${e==="/"?"A":`At ${e}, a`} union including one or more morphs must be discriminatable`;var Q1=(e,t)=>{let r=BB(e,t),n=e.map((o,i)=>i);return eI(e,n,r,t)},eI=(e,t,r,n)=>{if(t.length===1)return Zs(e[t[0]],n);let o=UB(t,r);if(!o)return[["branches",t.map(s=>Ym(e[s],n.type.scope)?he(Y1(`${n.path}`)):Zs(e[s],n))]];let i={};for(let s in o.indexCases){let a=o.indexCases[s];i[s]=eI(e,a,r,n),s!=="default"&&Xs(i[s],o.path,o,n)}return[["switch",{path:o.path,kind:o.kind,cases:i}]]},Xs=(e,t,r,n)=>{for(let o=0;o<e.length;o++){let[i,s]=e[o];if(t.length){if((i==="requiredProp"||i==="prerequisiteProp"||i==="optionalProp")&&s[0]===t[0]){if(typeof s[1]=="string"){if(r.kind!=="domain")return Zm(r);e.splice(o,1);return}Xs(s[1],t.slice(1),r,n),s[1].length===0&&e.splice(o,1);return}}else if(r.kind==="domain"){if(i==="domain"||i==="domains"){e.splice(o,1);return}else if(i==="class"||i==="value")return}else if(r.kind===i){e.splice(o,1);return}if(i==="domains"){if(I1(s)!==1||!s.object)return Zm(r);Xs(s.object,t,r,n);return}else if(i==="switch"){for(let a in s.cases)Xs(s.cases[a],t,r,n);return}else if(i==="branches"){for(let a of s)Xs(a,t,r,n);return}}return Zm(r)},Zm=e=>xe(`Unexpectedly failed to discriminate ${e.kind} at path '${e.path}'`),qB={domain:!0,class:!0,value:!0},BB=(e,t)=>{let r={disjointsByPair:{},casesByDisjoint:{}};for(let n=0;n<e.length-1;n++)for(let o=n+1;o<e.length;o++){let i=`${n}/${o}`,s=[];r.disjointsByPair[i]=s;let a=new wn(t.type,"|");Ys(e[n],e[o],a);for(let u in a.disjoints){if(u.includes(Or.index))continue;let{l,r:c,kind:f}=a.disjoints[u];if(!Gt(f,qB))continue;let p=X1(f,l),d=X1(f,c);if(p===void 0||d===void 0)continue;let h=u==="/"?f:`${u}/${f}`;if(s.push(h),!r.casesByDisjoint[h]){r.casesByDisjoint[h]={[p]:[n],[d]:[o]};continue}let b=r.casesByDisjoint[h],y=b[p];y?y.includes(n)||y.push(n):b[p]=[n];let v=b[d];v?v.includes(o)||v.push(o):b[d]=[o]}}return r},zB=e=>{let t=We.fromString(e);return[t,t.pop()]},UB=(e,t)=>{let r;for(let n=0;n<e.length-1;n++){let o=e[n];for(let i=n+1;i<e.length;i++){let s=e[i],a=t.disjointsByPair[`${o}/${s}`];for(let u of a){let l=t.casesByDisjoint[u],c={},f=[...e],p=0;for(let h in l){let b=l[h].filter(y=>{let v=e.indexOf(y);if(v!==-1)return delete f[v],!0});b.length!==0&&(c[h]=b,p++)}let d=we(f);if(d.length&&(c.default=d.map(h=>parseInt(h))),!r||p>r.score){let[h,b]=zB(u);if(r={path:h,kind:b,indexCases:c,score:p},p===e.length)return r}}}}return r},X1=(e,t)=>{switch(e){case"value":return tI(t);case"domain":return t;case"class":return Pc(t);default:return}},tI=e=>{let t=De(e);return t==="object"||t==="symbol"?void 0:qm(e)},WB={value:e=>tI(e)??"default",class:e=>fi(e)??"default",domain:De},rI=(e,t)=>WB[e](t),Ym=(e,t)=>"morph"in e?!0:"props"in e?Object.values(e.props).some(r=>HB(Sn(r),t)):!1,HB=(e,t)=>typeof e=="string"?t.resolve(e).includesMorph:Object.values(t.resolveTypeNode(e)).some(r=>r===!0?!1:En(r)?r.some(n=>Ym(n,t)):Ym(r,t));var di=e=>e===!0?{}:e,nI=(e,t,r)=>{if(e===!0&&t===!0)return He();if(!En(e)&&!En(t)){let s=Ys(di(e),di(t),r);return s===e?e:s===t?t:s}let n=Cr(di(e)),o=Cr(di(t)),i=Z1(n,o,r);return i.equalities.length===n.length&&i.equalities.length===o.length?He():i.lExtendsR.length+i.equalities.length===n.length?e:i.rExtendsL.length+i.equalities.length===o.length?t:i},oI=(e,t,r,n)=>{n.domain=e;let o=nI(t,r,n);if(!Gm(o))return o;let i=[...o.distinctIntersections,...o.equalities.map(s=>o.lBranches[s[0]]),...o.lExtendsR.map(s=>o.lBranches[s]),...o.rExtendsL.map(s=>o.rBranches[s])];return i.length===0&&n.addDisjoint("union",o.lBranches,o.rBranches),i.length===1?i[0]:i},iI=(e,t,r,n)=>{let o=new wn(n,"|"),i=nI(t,r,o);if(!Gm(i))return Zt(i)||i===t?r:i===r?t:e==="boolean"?!0:[di(t),di(r)];let s=[...i.lBranches.filter((a,u)=>!i.lExtendsR.includes(u)&&!i.equalities.some(l=>l[0]===u)),...i.rBranches.filter((a,u)=>!i.rExtendsL.includes(u)&&!i.equalities.some(l=>l[1]===u))];return s.length===1?s[0]:s},Xm=(e,t)=>e===!0?[]:En(e)?Q1(e,t):Zs(e,t),sI=e=>typeof e=="object"&&"value"in e;var Qs=e=>"config"in e,Mc=(e,t,r)=>{r.domain=void 0;let n=r.type.scope.resolveTypeNode(e),o=r.type.scope.resolveTypeNode(t),i=KB(n,o,r);return typeof i=="object"&&!Bs(i)?Bs(r.disjoints)?R1():r.addDisjoint("domain",we(n),we(o)):i===n?e:i===o?t:i},KB=li((e,t,r,n)=>{if(t===void 0)return r===void 0?xe(Nc):void 0;if(r!==void 0)return oI(e,t,r,n)},{onEmpty:"omit"}),In=(e,t,r)=>{let n=new wn(r,"&"),o=Mc(e,t,n);return ur(o)?he(P1(n.disjoints)):Zt(o)?e:o},Bc=(e,t,r)=>{let n=r.scope.resolveTypeNode(e),o=r.scope.resolveTypeNode(t),i={},s=we({...n,...o});for(let a of s)i[a]=ci(n,a)?ci(o,a)?iI(a,n[a],o[a],r):n[a]:ci(o,a)?o[a]:xe(Nc);return i},VB=e=>e[0]&&(e[0][0]==="value"||e[0][0]==="class"),Qm=e=>{let t={type:e,path:new We,lastDomain:"undefined"};return Tr(e.node,t)},Tr=(e,t)=>{if(typeof e=="string")return t.type.scope.resolve(e).flat;let r=Qs(e),n=GB(r?e.node:e,t);return r?[["config",{config:S1(e.config),node:n}]]:n},GB=(e,t)=>{let r=we(e);if(r.length===1){let o=r[0],i=e[o];if(i===!0)return o;t.lastDomain=o;let s=Xm(i,t);return VB(s)?s:[["domain",o],...s]}let n={};for(let o of r)t.lastDomain=o,n[o]=Xm(e[o],t);return[["domains",n]]},jc=(e,t)=>JB(e,t)&&sI(e[t]),JB=(e,t)=>{let r=we(e);return r.length===1&&r[0]===t},mi=e=>({object:{class:Array,props:{[Or.index]:e}}});function eh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Oe=class{shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}shiftUntil(t){let r="";for(;this.lookahead;){if(t(this,r))if(r[r.length-1]===Oe.escapeToken)r=r.slice(0,-1);else break;r+=this.shift()}return r}shiftUntilNextTerminator(){return this.shiftUntil(Oe.lookaheadIsNotWhitespace),this.shiftUntil(Oe.lookaheadIsTerminator)}get unscanned(){return this.chars.slice(this.i,this.chars.length).join("")}lookaheadIs(t){return this.lookahead===t}lookaheadIsIn(t){return this.lookahead in t}constructor(t){eh(this,"chars",void 0),eh(this,"i",void 0),eh(this,"finalized",!1),this.chars=[...t],this.i=0}};(function(e){var t=e.lookaheadIsTerminator=p=>p.lookahead in o,r=e.lookaheadIsNotWhitespace=p=>p.lookahead!==f,n=e.comparatorStartChars={"<":!0,">":!0,"=":!0},o=e.terminatingChars={...n,"|":!0,"&":!0,")":!0,"[":!0,"%":!0," ":!0},i=e.comparators={"<":!0,">":!0,"<=":!0,">=":!0,"==":!0},s=e.oneCharComparators={"<":!0,">":!0},a=e.comparatorDescriptions={"<":"less than",">":"more than","<=":"at most",">=":"at least","==":"exactly"},u=e.invertedComparators={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},l=e.branchTokens={"|":!0,"&":!0},c=e.escapeToken="\\",f=e.whiteSpaceToken=" "})(Oe||(Oe={}));function ZB(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function YB(e,t){return t.get?t.get.call(e):t.value}function XB(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function aI(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function zc(e,t){var r=aI(e,t,"get");return YB(e,r)}function QB(e,t,r){ZB(e,t),t.set(e,r)}function e6(e,t,r){var n=aI(e,t,"set");return XB(e,n,r),r}function Wr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rh=class extends TypeError{constructor(t){super(`${t}`),Wr(this,"cause",void 0),this.cause=t}},co=class{toString(){return this.message}get message(){return this.writers.addContext(this.reason,this.path)}get reason(){return this.writers.writeReason(this.mustBe,new Lc(this.data))}get mustBe(){return typeof this.writers.mustBe=="string"?this.writers.mustBe:this.writers.mustBe(this.source)}constructor(t,r,n,o,i){Wr(this,"code",void 0),Wr(this,"path",void 0),Wr(this,"data",void 0),Wr(this,"source",void 0),Wr(this,"writers",void 0),Wr(this,"parts",void 0),this.code=t,this.path=r,this.data=n,this.source=o,this.writers=i,this.code==="multi"&&(this.parts=this.source)}},hi=new WeakMap,nh=class extends Array{mustBe(t,r){return this.add("custom",t,r)}add(t,r,n){let o=We.from(n?.path??zc(this,hi).path),i=n&&"data"in n?n.data:zc(this,hi).data,s=new co(t,o,i,r,zc(this,hi).getProblemConfig(t));return this.addProblem(s),s}addProblem(t){let r=`${t.path}`,n=this.byPath[r];if(n)if(n.parts)n.parts.push(t);else{let o=new co("multi",n.path,n.data,[n,t],zc(this,hi).getProblemConfig("multi")),i=this.indexOf(n);this[i===-1?this.length:i]=o,this.byPath[r]=o}else this.byPath[r]=t,this.push(t);this.count++}get summary(){return`${this}`}toString(){return this.join(`
`)}throw(){throw new rh(this)}constructor(t){super(),Wr(this,"byPath",{}),Wr(this,"count",0),QB(this,hi,{writable:!0,value:void 0}),e6(this,hi,t)}},Uc=nh,t6=e=>e[0].toUpperCase()+e.slice(1),oh=e=>e.map(t=>$m[t]),uI=e=>e.map(t=>zm[t]),th=e=>{if(e.length===0)return"never";if(e.length===1)return e[0];let t="";for(let r=0;r<e.length-1;r++)t+=e[r],r<e.length-2&&(t+=", ");return t+=` or ${e[e.length-1]}`,t},ao=(e,t)=>`must be ${e}${t&&` (was ${t})`}`,cI=(e,t)=>t.length===0?t6(e):t.length===1&&zs(t[0])?`Item at index ${t[0]} ${e}`:`${t} ${e}`,uo={divisor:{mustBe:e=>e===1?"an integer":`a multiple of ${e}`},class:{mustBe:e=>{let t=Pc(e);return t?zm[t]:`an instance of ${e.name}`},writeReason:(e,t)=>ao(e,t.className)},domain:{mustBe:e=>$m[e],writeReason:(e,t)=>ao(e,t.domain)},missing:{mustBe:()=>"defined",writeReason:e=>ao(e,"")},extraneous:{mustBe:()=>"removed",writeReason:e=>ao(e,"")},bound:{mustBe:e=>`${Oe.comparatorDescriptions[e.comparator]} ${e.limit}${e.units?` ${e.units}`:""}`,writeReason:(e,t)=>ao(e,`${t.size}`)},regex:{mustBe:e=>`a string matching ${e}`},value:{mustBe:Te},branches:{mustBe:e=>th(e.map(t=>`${t.path} must be ${t.parts?th(t.parts.map(r=>r.mustBe)):t.mustBe}`)),writeReason:(e,t)=>`${e} (was ${t})`,addContext:(e,t)=>t.length?`At ${t}, ${e}`:e},multi:{mustBe:e=>"\u2022 "+e.map(t=>t.mustBe).join(`
\u2022 `),writeReason:(e,t)=>`${t} must be...
${e}`,addContext:(e,t)=>t.length?`At ${t}, ${e}`:e},custom:{mustBe:e=>e},cases:{mustBe:e=>th(e)}},lI=we(uo),r6=()=>{let e={},t;for(t of lI)e[t]={mustBe:uo[t].mustBe,writeReason:uo[t].writeReason??ao,addContext:uo[t].addContext??cI};return e},n6=r6(),fI=e=>{if(!e)return n6;let t={};for(let r of lI)t[r]={mustBe:e[r]?.mustBe??uo[r].mustBe,writeReason:e[r]?.writeReason??uo[r].writeReason??e.writeReason??ao,addContext:e[r]?.addContext??uo[r].addContext??e.addContext??cI};return t};function o6(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i6(e,t){return t.get?t.get.call(e):t.value}function s6(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function mI(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function ih(e,t){var r=mI(e,t,"get");return i6(e,r)}function a6(e,t,r){o6(e,t),t.set(e,r)}function u6(e,t,r){var n=mI(e,t,"set");return s6(e,n,r),r}function Ar(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c6=()=>({mustBe:[],writeReason:[],addContext:[],keys:[]}),l6=["mustBe","writeReason","addContext"],hI=(e,t)=>{let r=new sh(t,e);Wc(e.flat,r);let n=new gI(r);if(r.problems.count)n.problems=r.problems;else{for(let[o,i]of r.entriesToPrune)delete o[i];n.data=r.data}return n},gI=class{constructor(){Ar(this,"data",void 0),Ar(this,"problems",void 0)}},ea=new WeakMap,sh=class{getProblemConfig(t){let r={};for(let n of l6)r[n]=this.traversalConfig[n][0]??this.rootScope.config.codes[t][n];return r}traverseConfig(t,r){for(let o of t)this.traversalConfig[o[0]].unshift(o[1]);let n=Wc(r,this);for(let o of t)this.traversalConfig[o[0]].shift();return n}traverseKey(t,r){let n=this.data;this.data=this.data[t],this.path.push(t);let o=Wc(r,this);return this.path.pop(),n[t]!==this.data&&(n[t]=this.data),this.data=n,o}traverseResolution(t){let r=this.type.scope.resolve(t),n=r.qualifiedName,o=this.data,i=xn(o,"object");if(i){let u=ih(this,ea)[n];if(u){if(u.includes(o))return!0;u.push(o)}else ih(this,ea)[n]=[o]}let s=this.type;this.type=r;let a=Wc(r.flat,this);return this.type=s,i&&ih(this,ea)[n].pop(),a}traverseBranches(t){let r=this.failFast;this.failFast=!0;let n=this.problems,o=new Uc(this);this.problems=o;let i=this.path,s=this.entriesToPrune,a=!1;for(let u of t)if(this.path=new We,this.entriesToPrune=[],Hc(u,this)){a=!0,s.push(...this.entriesToPrune);break}return this.path=i,this.entriesToPrune=s,this.problems=n,this.failFast=r,a||!this.problems.add("branches",o)}constructor(t,r){Ar(this,"data",void 0),Ar(this,"type",void 0),Ar(this,"path",void 0),Ar(this,"problems",void 0),Ar(this,"entriesToPrune",void 0),Ar(this,"failFast",void 0),Ar(this,"traversalConfig",void 0),Ar(this,"rootScope",void 0),a6(this,ea,{writable:!0,value:void 0}),this.data=t,this.type=r,this.path=new We,this.problems=new Uc(this),this.entriesToPrune=[],this.failFast=!1,this.traversalConfig=c6(),u6(this,ea,{}),this.rootScope=r.scope}},Wc=(e,t)=>typeof e=="string"?De(t.data)===e||!t.problems.add("domain",e):Hc(e,t),Hc=(e,t)=>{let r=!0;for(let n=0;n<e.length;n++){let[o,i]=e[n],s=f6[o](i,t);if(r&&(r=s),!r&&(t.failFast||n<e.length-1&&Js[o]<Js[e[n+1][0]]))return!1}return r},pI=(e,t)=>e[0]in t.data?t.traverseKey(e[0],e[1]):(t.problems.add("missing",void 0,{path:t.path.concat(e[0]),data:void 0}),!1),dI=e=>(t,r)=>{let n=!0,o={...t.required};for(let s in r.data)if(t.required[s]?(n=r.traverseKey(s,t.required[s])&&n,delete o[s]):t.optional[s]?n=r.traverseKey(s,t.optional[s])&&n:t.index&&_c.test(s)?n=r.traverseKey(s,t.index)&&n:e==="distilledProps"?r.failFast?r.entriesToPrune.push([r.data,s]):delete r.data[s]:(n=!1,r.problems.add("extraneous",r.data[s],{path:r.path.concat(s)})),!n&&r.failFast)return!1;let i=Object.keys(o);if(i.length){for(let s of i)r.problems.add("missing",void 0,{path:r.path.concat(s)});return!1}return n},f6={regex:H1,divisor:j1,domains:(e,t)=>{let r=e[De(t.data)];return r?Hc(r,t):!t.problems.add("cases",oh(we(e)))},domain:(e,t)=>De(t.data)===e||!t.problems.add("domain",e),bound:W1,optionalProp:(e,t)=>e[0]in t.data?t.traverseKey(e[0],e[1]):!0,requiredProp:pI,prerequisiteProp:pI,indexProp:(e,t)=>{if(!Array.isArray(t.data))return t.problems.add("class",Array),!1;let r=!0;for(let n=0;n<t.data.length;n++)if(r=t.traverseKey(`${n}`,e)&&r,!r&&t.failFast)return!1;return r},branches:(e,t)=>t.traverseBranches(e),switch:(e,t)=>{let r=_1(t.data,e.path),n=rI(e.kind,r);if(ci(e.cases,n))return Hc(e.cases[n],t);let o=we(e.cases),i=t.path.concat(e.path),s=e.kind==="value"?o:e.kind==="domain"?oh(o):e.kind==="class"?uI(o):xe(`Unexpectedly encountered rule kind '${e.kind}' during traversal`);return t.problems.add("cases",s,{path:i,data:r}),!1},alias:(e,t)=>t.traverseResolution(e),class:$1,narrow:(e,t)=>{let r=t.problems.count,n=e(t.data,t.problems);return!n&&t.problems.count===r&&t.problems.mustBe(e.name?`valid according to ${e.name}`:"valid"),n},config:({config:e,node:t},r)=>r.traverseConfig(e,t),value:(e,t)=>t.data===e||!t.problems.add("value",e),morph:(e,t)=>{let r=e(t.data,t.problems);if(t.problems.length)return!1;if(r instanceof co)return t.problems.addProblem(r),!1;if(r instanceof gI){if(r.problems){for(let n of r.problems)t.problems.addProblem(n);return!1}return t.data=r.data,!0}return t.data=r,!0},distilledProps:dI("distilledProps"),strictProps:dI("strictProps")};var _n=new Proxy(()=>_n,{get:()=>_n});var ah=(e,t,r,n)=>{let o={node:e,flat:[["alias",e]],allows:a=>!i(a).problems,assert:a=>{let u=i(a);return u.problems?u.problems.throw():u.data},infer:_n,inferIn:_n,qualifiedName:p6(e)?n.getAnonymousQualifiedName(e):`${n.name}.${e}`,definition:t,scope:n,includesMorph:!1,config:r},i={[e]:a=>hI(i,a)}[e];return Object.assign(i,o)},uh=e=>e?.infer===_n,p6=e=>e[0]==="\u03BB";var yI=e=>{let t=e.scanner.shiftUntilNextTerminator();e.setRoot(d6(e,t))},d6=(e,t)=>e.ctx.type.scope.addParsedReferenceIfResolvable(t,e.ctx)?t:m6(t)??e.error(t===""?ch(e):h6(t)),m6=e=>{let t=Ws(e);if(t!==void 0)return{number:{value:t}};let r=jm(e);if(r!==void 0)return{bigint:{value:r}}},h6=e=>`'${e}' is unresolvable`,ch=e=>{let t=e.previousOperator();return t?lh(t,e.scanner.unscanned):g6(e.scanner.unscanned)},lh=(e,t)=>`Token '${e}' requires a right operand${t?` before '${t}'`:""}`,g6=e=>`Expected an expression${e?` before '${e}'`:""}`;var fh=(e,t)=>({node:t.type.scope.resolveTypeNode(Ke(e[0],t)),config:e[2]});var Yt=e=>Object.isFrozen(e)?e:Array.isArray(e)?Object.freeze(e.map(Yt)):y6(e),y6=e=>{for(let t in e)Yt(e[t]);return e};var b6=Yt({regex:Us.source}),v6=Yt({range:{min:{comparator:">=",limit:0}},divisor:1}),bI=(e,t)=>{let r=t.type.scope.resolveNode(Ke(e[1],t)),n=we(r).map(c=>w6(c,r[c])),o=vI(n);if(!o.length)return Dc(t.path,"keyof");let i={};for(let c of o){let f=typeof c;if(f==="string"||f==="number"||f==="symbol"){var s,a;(s=i)[a=f]??(s[a]=[]),i[f].push({value:c})}else if(c===Us){var u,l;(u=i).string??(u.string=[]),i.string.push(b6),(l=i).number??(l.number=[]),i.number.push(v6)}else return xe(`Unexpected keyof key '${Te(c)}'`)}return Object.fromEntries(Object.entries(i).map(([c,f])=>[c,f.length===1?f[0]:f]))},x6={bigint:so(0n),boolean:so(!1),null:[],number:so(0),object:[],string:so(""),symbol:so(Symbol()),undefined:[]},w6=(e,t)=>e!=="object"||t===!0?x6[e]:vI(Cr(t).map(r=>E6(r))),vI=e=>{if(!e.length)return[];let t=e[0];for(let r=1;r<e.length;r++)t=t.filter(n=>e[r].includes(n));return t},E6=e=>{let t=[];if("props"in e)for(let r of Object.keys(e.props))r===Or.index?t.push(Us):t.includes(r)||(t.push(r),Us.test(r)&&t.push(Cc(r,`Unexpectedly failed to parse an integer from key '${r}'`)));if("class"in e){let r=typeof e.class=="string"?Hs[e.class]:e.class;for(let n of so(r.prototype))t.includes(n)||t.push(n)}return t};var wI=(e,t)=>{if(typeof e[2]!="function")return he(S6(e[2]));let r=Ke(e[0],t),n=t.type.scope.resolveTypeNode(r),o=e[2];t.type.includesMorph=!0;let i,s={};for(i in n){let a=n[i];a===!0?s[i]={rules:{},morph:o}:typeof a=="object"?s[i]=En(a)?a.map(u=>xI(u,o)):xI(a,o):xe(`Unexpected predicate value for domain '${i}': ${Te(a)}`)}return s},xI=(e,t)=>Jm(e)?{...e,morph:e.morph?Array.isArray(e.morph)?[...e.morph,t]:[e.morph,t]:t}:{rules:e,morph:t},S6=e=>`Morph expression requires a function following '|>' (was ${typeof e})`;var EI=e=>`Expected a Function or Record<Domain, Function> operand (${Te(e)} was invalid)`,SI=(e,t,r,n)=>{let o=we(t);if(!xn(e,"object"))return he(EI(e));let i={};if(typeof e=="function"){let s={[n]:e};for(let a of o)i[a]=s}else for(let s of o){if(e[s]===void 0)continue;let a={[n]:e[s]};if(typeof a[n]!="function")return he(EI(a));i[s]=a}return i};var II=(e,t)=>{let r=Ke(e[0],t),n=t.type.scope.resolveNode(r),o=Qs(n),i=o?n.node:n,s=In(r,SI(e[2],i,t,"narrow"),t.type);return o?{config:n.config,node:s}:s};var CI=(e,t)=>{if(_6(e))return TI[e[1]](e,t);if(C6(e))return OI[e[0]](e,t);let r={length:["!",{number:{value:e.length}}]};for(let n=0;n<e.length;n++)t.path.push(`${n}`),r[n]=Ke(e[n],t),t.path.pop();return{object:{class:Array,props:r}}},_I=(e,t)=>{if(e[2]===void 0)return he(lh(e[1],""));let r=Ke(e[0],t),n=Ke(e[2],t);return e[1]==="&"?In(r,n,t.type):Bc(r,n,t.type)},I6=(e,t)=>mi(Ke(e[0],t));var _6=e=>TI[e[1]]!==void 0,TI={"|":_I,"&":_I,"[]":I6,"=>":II,"|>":wI,":":fh},OI={keyof:bI,instanceof:e=>typeof e[1]!="function"?he(`Expected a constructor following 'instanceof' operator (was ${typeof e[1]}).`):{object:{class:e[1]}},"===":e=>({[De(e[1])]:{value:e[1]}}),node:e=>e[1]},C6=e=>OI[e[0]]!==void 0;var AI=(e,t)=>{let r={};for(let n in e){let o=n,i=!1;n[n.length-1]==="?"&&(n[n.length-2]===Oe.escapeToken?o=`${n.slice(0,-2)}?`:(o=n.slice(0,-1),i=!0)),t.path.push(o);let s=Ke(e[n],t);t.path.pop(),r[o]=i?["?",s]:s}return{object:{props:r}}};var kI=e=>`Unmatched )${e===""?"":` before ${e}`}`,NI="Missing )",RI=(e,t)=>`Left bounds are only valid when paired with right bounds (try ...${t}${e})`,Kc=e=>`Left-bounded expressions must specify their limits using < or <= (was ${e})`,DI=(e,t,r,n)=>`An expression may have at most one left bound (parsed ${e}${Oe.invertedComparators[t]}, ${r}${Oe.invertedComparators[n]})`;function ta(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Vc=class{error(t){return he(t)}hasRoot(){return this.root!==void 0}resolveRoot(){return this.assertHasRoot(),this.ctx.type.scope.resolveTypeNode(this.root)}rootToString(){return this.assertHasRoot(),Te(this.root)}ejectRootIfLimit(){this.assertHasRoot();let t=typeof this.root=="string"?this.ctx.type.scope.resolveNode(this.root):this.root;if(jc(t,"number")){let r=t.number.value;return this.root=void 0,r}}ejectRangeIfOpen(){if(this.branches.range){let t=this.branches.range;return delete this.branches.range,t}}assertHasRoot(){if(this.root===void 0)return xe("Unexpected interaction with unset root")}assertUnsetRoot(){if(this.root!==void 0)return xe("Unexpected attempt to overwrite root")}setRoot(t){this.assertUnsetRoot(),this.root=t}rootToArray(){this.root=mi(this.ejectRoot())}intersect(t){this.root=In(this.ejectRoot(),t,this.ctx.type)}ejectRoot(){this.assertHasRoot();let t=this.root;return this.root=void 0,t}ejectFinalizedRoot(){this.assertHasRoot();let t=this.root;return this.root=T6,t}finalize(){if(this.groups.length)return this.error(NI);this.finalizeBranches(),this.scanner.finalized=!0}reduceLeftBound(t,r){let n=Oe.invertedComparators[r];if(!Gt(n,qc))return this.error(Kc(r));if(this.branches.range)return this.error(DI(`${this.branches.range.limit}`,this.branches.range.comparator,`${t}`,n));this.branches.range={limit:t,comparator:n}}finalizeBranches(){this.assertRangeUnset(),this.branches.union?(this.pushRootToBranch("|"),this.setRoot(this.branches.union)):this.branches.intersection&&this.setRoot(In(this.branches.intersection,this.ejectRoot(),this.ctx.type))}finalizeGroup(){this.finalizeBranches();let t=this.groups.pop();if(!t)return this.error(kI(this.scanner.unscanned));this.branches=t}pushRootToBranch(t){this.assertRangeUnset(),this.branches.intersection=this.branches.intersection?In(this.branches.intersection,this.ejectRoot(),this.ctx.type):this.ejectRoot(),t==="|"&&(this.branches.union=this.branches.union?Bc(this.branches.union,this.branches.intersection,this.ctx.type):this.branches.intersection,delete this.branches.intersection)}assertRangeUnset(){if(this.branches.range)return this.error(RI(`${this.branches.range.limit}`,this.branches.range.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={}}previousOperator(){return this.branches.range?.comparator??this.branches.intersection?"&":this.branches.union?"|":void 0}shiftedByOne(){return this.scanner.shift(),this}constructor(t,r){ta(this,"ctx",void 0),ta(this,"scanner",void 0),ta(this,"root",void 0),ta(this,"branches",void 0),ta(this,"groups",void 0),this.ctx=r,this.branches={},this.groups=[],this.scanner=new Oe(t)}},T6=new Proxy({},{get:()=>xe("Unexpected attempt to access ejected attributes")});var PI=(e,t)=>{let r=e.scanner.shiftUntil(O6[t]);if(e.scanner.lookahead==="")return e.error(k6(r,t));e.scanner.shift()==="/"?(Km(r),e.setRoot({string:{regex:r}})):e.setRoot({string:{value:r}})},FI={"'":1,'"':1,"/":1},O6={"'":e=>e.lookahead==="'",'"':e=>e.lookahead==='"',"/":e=>e.lookahead==="/"},A6={'"':"double-quote","'":"single-quote","/":"forward slash"},k6=(e,t)=>`${t}${e} requires a closing ${A6[t]}`;var Gc=e=>e.scanner.lookahead===""?e.error(ch(e)):e.scanner.lookahead==="("?e.shiftedByOne().reduceGroupOpen():e.scanner.lookaheadIsIn(FI)?PI(e,e.scanner.shift()):e.scanner.lookahead===" "?Gc(e.shiftedByOne()):yI(e);var $I=e=>`Bounded expression ${e} must be a number, string or array`;var MI=(e,t)=>{let r=N6(e,t),n=e.ejectRootIfLimit();return n===void 0?D6(e,r):e.reduceLeftBound(n,r)},N6=(e,t)=>e.scanner.lookaheadIs("=")?`${t}${e.scanner.shift()}`:Gt(t,Oe.oneCharComparators)?t:e.error(R6),R6="= is not a valid comparator. Use == to check for equality",D6=(e,t)=>{let r=e.scanner.shiftUntilNextTerminator(),n=Ws(r,$6(t,r+e.scanner.unscanned)),o=e.ejectRangeIfOpen(),i={comparator:t,limit:n},s=o?ph(i,Wm)?pi("min",o,i)==="l"?e.error(M6({min:o,max:i})):{min:o,max:i}:e.error(Kc(t)):F6(i,"==")?i:ph(i,qc)?{min:i}:ph(i,Wm)?{max:i}:xe(`Unexpected comparator '${i.comparator}'`);e.intersect(P6(s,e))},P6=(e,t)=>{let r=t.resolveRoot(),n=we(r),o={},i={range:e};return n.every(a=>{switch(a){case"string":return o.string=i,!0;case"number":return o.number=i,!0;case"object":return o.object=i,r.object===!0?!1:Cr(r.object).every(u=>"class"in u&&u.class===Array);default:return!1}})||t.error($I(t.rootToString())),o},F6=(e,t)=>e.comparator===t,ph=(e,t)=>e.comparator in t,$6=(e,t)=>`Comparator ${e} must be followed by a number literal (was '${t}')`,M6=e=>`${kc(e)} is empty`;var jI=e=>`Divisibility operand ${e} must be a number`;var qI=e=>{let t=e.scanner.shiftUntilNextTerminator(),r=Cc(t,LI(t));r===0&&e.error(LI(0));let n=we(e.resolveRoot());n.length===1&&n[0]==="number"?e.intersect({number:{divisor:r}}):e.error(jI(e.rootToString()))},LI=e=>`% operator must be followed by a non-zero integer literal (was ${e})`;var dh=e=>{let t=e.scanner.shift();return t===""?e.finalize():t==="["?e.scanner.shift()==="]"?e.rootToArray():e.error(L6):Gt(t,Oe.branchTokens)?e.pushRootToBranch(t):t===")"?e.finalizeGroup():Gt(t,Oe.comparatorStartChars)?MI(e,t):t==="%"?qI(e):t===" "?dh(e):xe(j6(t))},j6=e=>`Unexpected character '${e}'`,L6="Missing expected ']'";var BI=(e,t)=>t.type.scope.parseCache.get(e)??t.type.scope.parseCache.set(e,q6(e,t)??B6(e,t)),q6=(e,t)=>{if(t.type.scope.addParsedReferenceIfResolvable(e,t))return e;if(e.endsWith("[]")){let r=e.slice(0,-2);if(t.type.scope.addParsedReferenceIfResolvable(e,t))return mi(r)}},B6=(e,t)=>{let r=new Vc(e,t);return Gc(r),z6(r)},z6=e=>{for(;!e.scanner.finalized;)U6(e);return e.ejectFinalizedRoot()},U6=e=>e.hasRoot()?dh(e):Gc(e);var Ke=(e,t)=>{let r=De(e);if(r==="string")return BI(e,t);if(r!=="object")return he(mh(r));let n=fi(e);switch(n){case"Object":return AI(e,t);case"Array":return CI(e,t);case"RegExp":return{string:{regex:e.source}};case"Function":if(uh(e))return t.type.scope.addAnonymousTypeReference(e,t);if(W6(e)){let o=e();if(uh(o))return t.type.scope.addAnonymousTypeReference(o,t)}return he(mh("Function"));default:return he(mh(n??Te(e)))}},Wce=Symbol("as"),W6=e=>typeof e=="function"&&e.length===0,mh=e=>`Type definitions must be strings or objects (was ${e})`;function H6(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gi=class{get root(){return this.cache}has(t){return t in this.cache}get(t){return this.cache[t]}set(t,r){return this.cache[t]=r,r}constructor(){H6(this,"cache",{})}},Jc=class extends gi{set(t,r){return this.cache[t]=Yt(r),r}};function KI(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function K6(e,t){return t.get?t.get.call(e):t.value}function V6(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function VI(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function Kr(e,t){var r=VI(e,t,"get");return K6(e,r)}function zI(e,t,r){KI(e,t),t.set(e,r)}function UI(e,t,r){var n=VI(e,t,"set");return V6(e,n,r),r}function Hr(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}function Zc(e,t){KI(e,t),t.add(e)}function xt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var G6=e=>({codes:fI(e.codes),keys:e.keys??"loose"}),J6=0,WI={},hh={};var lo=new WeakMap,yi=new WeakMap,HI=new WeakSet,Yc=new WeakSet,yh=new WeakSet,Xc=new WeakSet,bh=class{getAnonymousQualifiedName(t){let r=0,n=t;for(;this.isResolvable(n);)n=`${t}${r++}`;return`${this.name}.${n}`}addAnonymousTypeReference(t,r){var n;return(n=r.type).includesMorph||(n.includesMorph=t.includesMorph),t.node}get infer(){return _n}compile(){if(!hh[this.name]){for(let t in this.aliases)this.resolve(t);hh[this.name]=Kr(this,yi).root}return Kr(this,yi).root}addParsedReferenceIfResolvable(t,r){var n;let o=Hr(this,Xc,vh).call(this,t,"undefined",[t]);return o?((n=r.type).includesMorph||(n.includesMorph=o.includesMorph),!0):!1}resolve(t){return Hr(this,Xc,vh).call(this,t,"throw",[t])}resolveNode(t){return typeof t=="string"?this.resolveNode(this.resolve(t).node):t}resolveTypeNode(t){let r=this.resolveNode(t);return Qs(r)?r.node:r}isResolvable(t){return Kr(this,lo).has(t)||this.aliases[t]}constructor(t,r={}){Zc(this,HI),Zc(this,Yc),Zc(this,yh),Zc(this,Xc),xt(this,"aliases",void 0),xt(this,"name",void 0),xt(this,"config",void 0),xt(this,"parseCache",void 0),zI(this,lo,{writable:!0,value:void 0}),zI(this,yi,{writable:!0,value:void 0}),xt(this,"expressions",void 0),xt(this,"intersection",void 0),xt(this,"union",void 0),xt(this,"arrayOf",void 0),xt(this,"keyOf",void 0),xt(this,"valueOf",void 0),xt(this,"instanceOf",void 0),xt(this,"narrow",void 0),xt(this,"morph",void 0),xt(this,"type",void 0),this.aliases=t,this.parseCache=new Jc,UI(this,lo,new gi),UI(this,yi,new gi),this.expressions={intersection:(n,o,i)=>this.type([n,"&",o],i),union:(n,o,i)=>this.type([n,"|",o],i),arrayOf:(n,o)=>this.type([n,"[]"],o),keyOf:(n,o)=>this.type(["keyof",n],o),node:(n,o)=>this.type(["node",n],o),instanceOf:(n,o)=>this.type(["instanceof",n],o),valueOf:(n,o)=>this.type(["===",n],o),narrow:(n,o,i)=>this.type([n,"=>",o],i),morph:(n,o,i)=>this.type([n,"|>",o],i)},this.intersection=this.expressions.intersection,this.union=this.expressions.union,this.arrayOf=this.expressions.arrayOf,this.keyOf=this.expressions.keyOf,this.valueOf=this.expressions.valueOf,this.instanceOf=this.expressions.instanceOf,this.narrow=this.expressions.narrow,this.morph=this.expressions.morph,this.type=Object.assign((n,o={})=>{let i=ah("\u03BBtype",n,o,this),s=Hr(this,yh,GI).call(this,i),a=Ke(n,s);return i.node=Yt(Bs(o)?{config:o,node:this.resolveTypeNode(a)}:a),i.flat=Yt(Qm(i)),i},{from:this.expressions.node}),this.name=Hr(this,HI,Z6).call(this,r),r.standard!==!1&&Hr(this,Yc,gh).call(this,[hh.standard],"imports"),r.imports&&Hr(this,Yc,gh).call(this,r.imports,"imports"),r.includes&&Hr(this,Yc,gh).call(this,r.includes,"includes"),this.config=G6(r)}};function Z6(e){let t=e.name?WI[e.name]?he(`A scope named '${e.name}' already exists`):e.name:`scope${++J6}`;return WI[t]=this,t}function gh(e,t){for(let r of e)for(let n in r)(Kr(this,lo).has(n)||n in this.aliases)&&he(X6(n)),Kr(this,lo).set(n,r[n]),t==="includes"&&Kr(this,yi).set(n,r[n])}function GI(e){return{type:e,path:new We}}function vh(e,t,r){let n=Kr(this,lo).get(e);if(n)return n;let o=this.aliases[e];if(!o)return t==="throw"?xe(`Unexpectedly failed to resolve alias '${e}'`):void 0;let i=ah(e,o,{},this),s=Hr(this,yh,GI).call(this,i);Kr(this,lo).set(e,i),Kr(this,yi).set(e,i);let a=Ke(o,s);if(typeof a=="string"){if(r.includes(a))return he(Y6(e,r));r.push(a),a=Hr(this,Xc,vh).call(this,a,"throw",r).node}return i.node=Yt(a),i.flat=Yt(Qm(i)),i}var wt=(e,t={})=>new bh(e,t),xh=wt({},{name:"root",standard:!1}),cr=xh.type,Y6=(e,t)=>`Alias '${e}' has a shallow resolution cycle: ${[...t,e].join("=>")}`,X6=e=>`Alias '${e}' is already defined`;var Qc=wt({Function:["node",{object:{class:Function}}],Date:["node",{object:{class:Date}}],Error:["node",{object:{class:Error}}],Map:["node",{object:{class:Map}}],RegExp:["node",{object:{class:RegExp}}],Set:["node",{object:{class:Set}}],WeakMap:["node",{object:{class:WeakMap}}],WeakSet:["node",{object:{class:WeakSet}}],Promise:["node",{object:{class:Promise}}]},{name:"jsObjects",standard:!1}),JI=Qc.compile();var ZI={bigint:!0,boolean:!0,null:!0,number:!0,object:!0,string:!0,symbol:!0,undefined:!0},el=wt({any:["node",ZI],bigint:["node",{bigint:!0}],boolean:["node",{boolean:!0}],false:["node",{boolean:{value:!1}}],never:["node",{}],null:["node",{null:!0}],number:["node",{number:!0}],object:["node",{object:!0}],string:["node",{string:!0}],symbol:["node",{symbol:!0}],true:["node",{boolean:{value:!0}}],unknown:["node",ZI],void:["node",{undefined:!0}],undefined:["node",{undefined:!0}]},{name:"ts",standard:!1}),fo=el.compile();var Q6=e=>{let t=e.replace(/[- ]+/g,""),r=0,n,o,i;for(let s=t.length-1;s>=0;s--)n=t.substring(s,s+1),o=parseInt(n,10),i?(o*=2,o>=10?r+=o%10+1:r+=o):r+=o,i=!i;return!!(r%10===0&&t)},ez=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,YI=cr([ez,"=>",(e,t)=>Q6(e)||!t.mustBe("a valid credit card number")],{mustBe:"a valid credit card number"});var tz=/^[./-]$/,rz=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,nz=e=>!isNaN(e),tl=e=>`a ${e}-formatted date`,oz=(e,t)=>{if(!t?.format){let a=new Date(e);return nz(a)?a:"a valid date"}if(t.format==="iso8601")return rz.test(e)?new Date(e):tl("iso8601");let r=e.split(tz),n=e[r[0].length],o=n?t.format.split(n):[t.format];if(r.length!==o.length)return tl(t.format);let i={};for(let a=0;a<o.length;a++){if(r[a].length!==o[a].length&&!(o[a].length===1&&r[a].length===2))return tl(t.format);i[o[a][0]]=r[a]}let s=new Date(`${i.m}/${i.d}/${i.y}`);return`${s.getDate()}`===i.d?s:tl(t.format)},XI=cr([fo.string,"|>",(e,t)=>{let r=oz(e);return typeof r=="string"?t.mustBe(r):r}]);var iz=cr([Mm,"|>",e=>parseFloat(e)],{mustBe:"a well-formed numeric string"}),sz=cr([fo.string,"|>",(e,t)=>{if(!zs(e))return t.mustBe("a well-formed integer string");let r=parseInt(e);return Number.isSafeInteger(r)?r:t.mustBe("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")}]),az=cr(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/,{mustBe:"a valid email"}),uz=cr(/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/,{mustBe:"a valid UUID"}),cz=cr(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,{mustBe:"a valid semantic version (see https://semver.org/)"}),lz=cr([fo.string,"|>",e=>JSON.parse(e)],{mustBe:"a JSON-parsable string"}),rl=wt({alpha:[/^[A-Za-z]*$/,":",{mustBe:"only letters"}],alphanumeric:[/^[A-Za-z\d]*$/,":",{mustBe:"only letters and digits"}],lowercase:[/^[a-z]*$/,":",{mustBe:"only lowercase letters"}],uppercase:[/^[A-Z]*$/,":",{mustBe:"only uppercase letters"}],creditCard:YI,email:az,uuid:uz,parsedNumber:iz,parsedInteger:sz,parsedDate:XI,semver:cz,json:lz,integer:["node",{number:{divisor:1}}]},{name:"validation",standard:!1}),QI=rl.compile();var nl=wt({},{name:"standard",includes:[fo,JI,QI],standard:!1}),fz=nl.compile(),Vr={root:xh,tsKeywords:el,jsObjects:Qc,validation:rl,ark:nl};var ra=nl.type;var pz=Vr.ark.intersection,dz=Vr.ark.union,mz=Vr.ark.arrayOf,hz=Vr.ark.keyOf,gz=Vr.ark.instanceOf,yz=Vr.ark.valueOf,bz=Vr.ark.narrow,vz=Vr.ark.morph;var{DataRequest:Mle,DataResponse:e_}=wt({DataRequest:{id:"number",method:"string",params:"any[]"},DataResponse:{id:"number","eventName?":"string",payload:"any",error:"any"}}).compile(),ol="__METHODS__",il="__EVAL__";var t_=()=>({events:{},emit(e,...t){let r=this.events[e]||[];for(let n=0,o=r.length;n<o;n++)r[n](...t)},on(e,t){return this.events[e]?.push(t)||(this.events[e]=[t]),()=>{this.events[e]=this.events[e]?.filter(r=>t!==r)}}});function po(){let e=t_();return e.once=(t,r)=>{let n=(...i)=>{o(),r(...i)},o=e.on(t,n);return o},e}function xz(e){return Object.assign(new Error,e)}var mo=class{pending=new Map;terminateState=!1;terminationHandler=null;lastId=0;worker;constructor(){this.worker=this.setupWorker(),this.worker.onMessage(t=>this.onMessage(t.data)),this.worker.onError(t=>this.onError(t.error))}internal=po();evt=po();task=po();onMessage(t){if(this.terminateState==="finished")return;if(t==="ready"){this.internal.emit("ready");return}let{data:r,problems:n}=e_(t);if(n)throw new Error(n.toString());if(r.eventName){this.evt.emit(r.eventName,r.payload);return}this.task.emit(r.id,r.payload,r.error),this.terminateState==="requested"&&this.terminate()}onError(t){for(let r of this.pending.values())r.abort(t);this.pending.clear(),this.worker.terminate()}methods(){return this.invoke(ol)}eval(t,r,n){let o=[t,...r];return this.invoke(il,o,{transfer:n})}send({id:t,method:r,params:n,transfer:o,timeout:i},s=new AbortController){let a=s.signal;return this.pending.set(t,s),new Promise((u,l)=>{this.worker.send({id:t,method:r,params:n},{transfer:o});let c=-1,f=()=>{l(a?.reason),p(),window.clearTimeout(c)};i!==void 0&&(c=window.setTimeout(()=>{s.abort(new DOMException(`Timeout after ${i}ms`,"TimeoutError"))},i)),a?.addEventListener("abort",f);let p=this.task.once(t,(d,h)=>{a?.removeEventListener("abort",f),h?l(xz(h)):u(d)})}).catch(u=>{if(u instanceof DOMException&&["AbortError","TimeoutError"].includes(u.name))return this.terminate(!0).then(()=>{throw u});throw u}).finally(()=>{this.pending.delete(t)})}async invoke(t,r=[],{controller:n,transfer:o}={}){if(this.terminateState!==!1)throw new Error("Worker is terminated");let i=++this.lastId;return await this.worker.readyPromise,await this.send({id:i,method:t,params:r,transfer:o},n)}busy(){return this.pending.size>0}terminate(t=!1,r){if(t){for(let n of this.pending.values())n.abort(new Error("Worker terminated"));this.pending.clear()}if(this.busy()){this.terminateState="requested";let n=new Promise(o=>{this.internal.once("terminate",o)});return r!==void 0?Promise.race([n,wz(r)]).then():n}return this.worker.terminate(),Promise.resolve()}};function wz(e){return new Promise(t=>setTimeout(()=>t(new DOMException(`Timeout after ${e}ms`,"TimeoutError")),e))}var bi=class extends mo{setupWorker(){let t=this,r=Object.assign(this.initWebWorker(),{readyPromise:new Promise(n=>t.internal.once("ready",()=>n(!0))),killed:!1,send(n,o){r.postMessage(n,o)},onMessage(n){return r.addEventListener("message",n),()=>r.removeEventListener("message",n)},onError(n){return r.addEventListener("error",n),()=>r.removeEventListener("error",n)}});return qt(r,{terminate:n=>function(){r.killed||(n.call(this),r.killed=!0,t.internal.emit("terminate")),t.terminateState="finished"}}),r}};var vi=class{workers=[];tasks=[];pending=new Map;emitter=po();#e=po();maxQueueSize=1/0;maxWorkers=Math.max((this.getMaxConcurrency()||4)-1,1);minWorkers=0;getMaxConcurrency(){return navigator.hardwareConcurrency}constructor(t={}){if(t.maxQueueSize!==void 0&&(this.maxQueueSize=Sz.assert(t.maxQueueSize)),t.maxWorkers!==void 0&&(this.maxWorkers=Ez.assert(t.maxWorkers)),t.minWorkers!==void 0){let o=Iz.assert(t.minWorkers);o==="max"?this.minWorkers=this.maxWorkers:(this.minWorkers=o,this.maxWorkers=Math.max(this.minWorkers,this.maxWorkers)),this.ensureMinWorkers()}let r={},n=o=>r[o]??=(...i)=>this.invoke(o,i);this.proxy=new Proxy(r,{get:(o,i)=>!Reflect.has(o,i)&&typeof i=="string"?n(i):Reflect.get(o,i)}),this.methods().then(o=>o.forEach(n))}eval(t,r,n={}){return this.invoke(il,[typeof t=="string"?t:t.toString(),r],n)}invoke(t,r=[],n={}){if(this.tasks.length>=this.maxQueueSize)throw new Error("Max queue size of "+this.maxQueueSize+" reached");let o={method:t,params:r,transfer:n.transfer};return this.tasks.push(o),this.pending.set(o,n.controller??new AbortController),this.next(),new Promise((i,s)=>{let a=[this.#e.on("complete",(u,l)=>{o===u&&(a.forEach(c=>c()),i(l))}),this.#e.on("error",(u,l)=>{o===u&&(a.forEach(c=>c()),s(l))})]})}methods(){return this.invoke(ol)}proxy;next(){if(this.tasks.length===0)return;let t=this.getWorker();if(!t)return;let r=this.tasks.shift();if(!this.pending.has(r))return this.next();let n=this.pending.get(r);t.invoke(r.method,r.params,{transfer:r.transfer,timeout:r.timeout,controller:n}).then(o=>{this.#e.emit("complete",r,o)}).catch(o=>{this.#e.emit("error",r,o),t.terminateState==="finished"&&this.removeWorker(t)}).finally(()=>{this.pending.delete(r),this.next()})}getWorker(){for(let t of this.workers)if(!t.busy())return t;if(this.workers.length<this.maxWorkers){let t=this.initWorker();return this.workers.push(t),t}return null}async removeWorker(t){return this.removeWorkerFromList(t),this.ensureMinWorkers(),await t.terminate(!1),this.emitter.emit("worker-terminate"),t}removeWorkerFromList(t){let r=this.workers.indexOf(t);r!==-1&&this.workers.splice(r,1)}terminate(t=!1,r){for(let n of this.pending.values())n.abort(new Error("Pool terminated"));return this.tasks.length=0,this.pending.clear(),Promise.all(this.workers.slice().map(async n=>{try{await n.terminate(t,r),this.removeWorkerFromList(n)}finally{this.emitter.emit("worker-terminate")}})).then()}get stats(){let t=this.workers.length,r=this.workers.filter(function(n){return n.busy()}).length;return{totalWorkers:t,busyWorkers:r,idleWorkers:t-r,pendingTasks:this.tasks.length,activeTasks:r}}ensureMinWorkers(){if(this.minWorkers)for(let t=this.workers.length;t<this.minWorkers;t++)this.workers.push(this.initWorker())}initWorker(){let t=this.workerCtor();return this.emitter.emit("worker-create"),t}},Ez=ra("integer>=1"),Sz=ra("integer>=1"),Iz=ra('integer>=0|"max"');var r_='"use strict";var Zg=Object.create;var vu=Object.defineProperty;var Qg=Object.getOwnPropertyDescriptor;var Xg=Object.getOwnPropertyNames;var ey=Object.getPrototypeOf,ty=Object.prototype.hasOwnProperty;var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ry=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xg(t))!ty.call(e,o)&&o!==r&&vu(e,o,{get:()=>t[o],enumerable:!(n=Qg(t,o))||n.enumerable});return e};var $r=(e,t,r)=>(r=e!=null?Zg(ey(e)):{},ry(t||!e||!e.__esModule?vu(r,"default",{value:e,enumerable:!0}):r,e));var Js=D((pl,Hs)=>{(function(e){if(typeof pl=="object"&&typeof Hs<"u")Hs.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(o,i,s){function a(l,d){if(!i[l]){if(!o[l]){var f=typeof require=="function"&&require;if(!d&&f)return f(l,!0);if(u)return u(l,!0);var g=new Error("Cannot find module \'"+l+"\'");throw g.code="MODULE_NOT_FOUND",g}var w=i[l]={exports:{}};o[l][0].call(w.exports,function(x){var S=o[l][1][x];return a(S||x)},w,w.exports,n,o,i,s)}return i[l].exports}for(var u=typeof require=="function"&&require,m=0;m<s.length;m++)a(s[m]);return a}({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,u;if(a){var m=0,l=new a(x),d=s.document.createTextNode("");l.observe(d,{characterData:!0}),u=function(){d.data=m=++m%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=x,u=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?u=function(){var N=s.document.createElement("script");N.onreadystatechange=function(){x(),N.onreadystatechange=null,N.parentNode.removeChild(N),N=null},s.document.documentElement.appendChild(N)}:u=function(){setTimeout(x,0)};var g,w=[];function x(){g=!0;for(var N,M,k=w.length;k;){for(M=w,w=[],N=-1;++N<k;)M[N]();k=w.length}g=!1}o.exports=S;function S(N){w.push(N)===1&&!g&&u()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var u={},m=["REJECTED"],l=["FULFILLED"],d=["PENDING"];o.exports=f;function f(A){if(typeof A!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,A!==a&&S(this,A)}f.prototype.catch=function(A){return this.then(null,A)},f.prototype.then=function(A,B){if(typeof A!="function"&&this.state===l||typeof B!="function"&&this.state===m)return this;var L=new this.constructor(a);if(this.state!==d){var F=this.state===l?A:B;w(L,F,this.outcome)}else this.queue.push(new g(L,A,B));return L};function g(A,B,L){this.promise=A,typeof B=="function"&&(this.onFulfilled=B,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}g.prototype.callFulfilled=function(A){u.resolve(this.promise,A)},g.prototype.otherCallFulfilled=function(A){w(this.promise,this.onFulfilled,A)},g.prototype.callRejected=function(A){u.reject(this.promise,A)},g.prototype.otherCallRejected=function(A){w(this.promise,this.onRejected,A)};function w(A,B,L){s(function(){var F;try{F=B(L)}catch(j){return u.reject(A,j)}F===A?u.reject(A,new TypeError("Cannot resolve promise with itself")):u.resolve(A,F)})}u.resolve=function(A,B){var L=N(x,B);if(L.status==="error")return u.reject(A,L.value);var F=L.value;if(F)S(A,F);else{A.state=l,A.outcome=B;for(var j=-1,O=A.queue.length;++j<O;)A.queue[j].callFulfilled(B)}return A},u.reject=function(A,B){A.state=m,A.outcome=B;for(var L=-1,F=A.queue.length;++L<F;)A.queue[L].callRejected(B);return A};function x(A){var B=A&&A.then;if(A&&(typeof A=="object"||typeof A=="function")&&typeof B=="function")return function(){B.apply(A,arguments)}}function S(A,B){var L=!1;function F(R){L||(L=!0,u.reject(A,R))}function j(R){L||(L=!0,u.resolve(A,R))}function O(){B(j,F)}var $=N(O);$.status==="error"&&F($.value)}function N(A,B){var L={};try{L.value=A(B),L.status="success"}catch(F){L.status="error",L.value=F}return L}f.resolve=M;function M(A){return A instanceof this?A:u.resolve(new this(a),A)}f.reject=k;function k(A){var B=new this(a);return u.reject(B,A)}f.all=ee;function ee(A){var B=this;if(Object.prototype.toString.call(A)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=A.length,F=!1;if(!L)return this.resolve([]);for(var j=new Array(L),O=0,$=-1,R=new this(a);++$<L;)U(A[$],$);return R;function U(q,W){B.resolve(q).then(K,function(X){F||(F=!0,u.reject(R,X))});function K(X){j[W]=X,++O===L&&!F&&(F=!0,u.resolve(R,j))}}}f.race=xe;function xe(A){var B=this;if(Object.prototype.toString.call(A)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=A.length,F=!1;if(!L)return this.resolve([]);for(var j=-1,O=new this(a);++j<L;)$(A[j]);return O;function $(R){B.resolve(R).then(function(U){F||(F=!0,u.resolve(O,U))},function(U){F||(F=!0,u.reject(O,U))})}}},{1:1}],3:[function(n,o,i){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c};function a(c,h){if(!(c instanceof h))throw new TypeError("Cannot call a class as a function")}function u(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var m=u();function l(){try{if(!m||!m.open)return!1;var c=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),h=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!c||h)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(c,h){c=c||[],h=h||{};try{return new Blob(c,h)}catch(y){if(y.name!=="TypeError")throw y;for(var p=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,b=new p,v=0;v<c.length;v+=1)b.append(c[v]);return b.getBlob(h.type)}}typeof Promise>"u"&&n(3);var f=Promise;function g(c,h){h&&c.then(function(p){h(null,p)},function(p){h(p)})}function w(c,h,p){typeof h=="function"&&c.then(h),typeof p=="function"&&c.catch(p)}function x(c){return typeof c!="string"&&(console.warn(c+" used as a key, but it is not a string."),c=String(c)),c}function S(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var N="local-forage-detect-blob-support",M=void 0,k={},ee=Object.prototype.toString,xe="readonly",A="readwrite";function B(c){for(var h=c.length,p=new ArrayBuffer(h),b=new Uint8Array(p),v=0;v<h;v++)b[v]=c.charCodeAt(v);return p}function L(c){return new f(function(h){var p=c.transaction(N,A),b=d([""]);p.objectStore(N).put(b,"key"),p.onabort=function(v){v.preventDefault(),v.stopPropagation(),h(!1)},p.oncomplete=function(){var v=navigator.userAgent.match(/Chrome\\/(\\d+)/),y=navigator.userAgent.match(/Edge\\//);h(y||!v||parseInt(v[1],10)>=43)}}).catch(function(){return!1})}function F(c){return typeof M=="boolean"?f.resolve(M):L(c).then(function(h){return M=h,M})}function j(c){var h=k[c.name],p={};p.promise=new f(function(b,v){p.resolve=b,p.reject=v}),h.deferredOperations.push(p),h.dbReady?h.dbReady=h.dbReady.then(function(){return p.promise}):h.dbReady=p.promise}function O(c){var h=k[c.name],p=h.deferredOperations.pop();if(p)return p.resolve(),p.promise}function $(c,h){var p=k[c.name],b=p.deferredOperations.pop();if(b)return b.reject(h),b.promise}function R(c,h){return new f(function(p,b){if(k[c.name]=k[c.name]||Xa(),c.db)if(h)j(c),c.db.close();else return p(c.db);var v=[c.name];h&&v.push(c.version);var y=m.open.apply(m,v);h&&(y.onupgradeneeded=function(E){var I=y.result;try{I.createObjectStore(c.storeName),E.oldVersion<=1&&I.createObjectStore(N)}catch(_){if(_.name==="ConstraintError")console.warn(\'The database "\'+c.name+\'" has been upgraded from version \'+E.oldVersion+" to version "+E.newVersion+\', but the storage "\'+c.storeName+\'" already exists.\');else throw _}}),y.onerror=function(E){E.preventDefault(),b(y.error)},y.onsuccess=function(){var E=y.result;E.onversionchange=function(I){I.target.close()},p(E),O(c)}})}function U(c){return R(c,!1)}function q(c){return R(c,!0)}function W(c,h){if(!c.db)return!0;var p=!c.db.objectStoreNames.contains(c.storeName),b=c.version<c.db.version,v=c.version>c.db.version;if(b&&(c.version!==h&&console.warn(\'The database "\'+c.name+`" can\'t be downgraded from version `+c.db.version+" to version "+c.version+"."),c.version=c.db.version),v||p){if(p){var y=c.db.version+1;y>c.version&&(c.version=y)}return!0}return!1}function K(c){return new f(function(h,p){var b=new FileReader;b.onerror=p,b.onloadend=function(v){var y=btoa(v.target.result||"");h({__local_forage_encoded_blob:!0,data:y,type:c.type})},b.readAsBinaryString(c)})}function X(c){var h=B(atob(c.data));return d([h],{type:c.type})}function J(c){return c&&c.__local_forage_encoded_blob}function Zn(c){var h=this,p=h._initReady().then(function(){var b=k[h._dbInfo.name];if(b&&b.dbReady)return b.dbReady});return w(p,c,c),p}function Xh(c){j(c);for(var h=k[c.name],p=h.forages,b=0;b<p.length;b++){var v=p[b];v._dbInfo.db&&(v._dbInfo.db.close(),v._dbInfo.db=null)}return c.db=null,U(c).then(function(y){return c.db=y,W(c)?q(c):y}).then(function(y){c.db=h.db=y;for(var E=0;E<p.length;E++)p[E]._dbInfo.db=y}).catch(function(y){throw $(c,y),y})}function ft(c,h,p,b){b===void 0&&(b=1);try{var v=c.db.transaction(c.storeName,h);p(null,v)}catch(y){if(b>0&&(!c.db||y.name==="InvalidStateError"||y.name==="NotFoundError"))return f.resolve().then(function(){if(!c.db||y.name==="NotFoundError"&&!c.db.objectStoreNames.contains(c.storeName)&&c.version<=c.db.version)return c.db&&(c.version=c.db.version+1),q(c)}).then(function(){return Xh(c).then(function(){ft(c,h,p,b-1)})}).catch(p);p(y)}}function Xa(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function eg(c){var h=this,p={db:null};if(c)for(var b in c)p[b]=c[b];var v=k[p.name];v||(v=Xa(),k[p.name]=v),v.forages.push(h),h._initReady||(h._initReady=h.ready,h.ready=Zn);var y=[];function E(){return f.resolve()}for(var I=0;I<v.forages.length;I++){var _=v.forages[I];_!==h&&y.push(_._initReady().catch(E))}var T=v.forages.slice(0);return f.all(y).then(function(){return p.db=v.db,U(p)}).then(function(C){return p.db=C,W(p,h._defaultConfig.version)?q(p):C}).then(function(C){p.db=v.db=C,h._dbInfo=p;for(var P=0;P<T.length;P++){var z=T[P];z!==h&&(z._dbInfo.db=p.db,z._dbInfo.version=p.version)}})}function tg(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){ft(p._dbInfo,xe,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=_.get(c);T.onsuccess=function(){var C=T.result;C===void 0&&(C=null),J(C)&&(C=X(C)),v(C)},T.onerror=function(){y(T.error)}}catch(C){y(C)}})}).catch(y)});return g(b,h),b}function rg(c,h){var p=this,b=new f(function(v,y){p.ready().then(function(){ft(p._dbInfo,xe,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=_.openCursor(),C=1;T.onsuccess=function(){var P=T.result;if(P){var z=P.value;J(z)&&(z=X(z));var V=c(z,P.key,C++);V!==void 0?v(V):P.continue()}else v()},T.onerror=function(){y(T.error)}}catch(P){y(P)}})}).catch(y)});return g(b,h),b}function ng(c,h,p){var b=this;c=x(c);var v=new f(function(y,E){var I;b.ready().then(function(){return I=b._dbInfo,ee.call(h)==="[object Blob]"?F(I.db).then(function(_){return _?h:K(h)}):h}).then(function(_){ft(b._dbInfo,A,function(T,C){if(T)return E(T);try{var P=C.objectStore(b._dbInfo.storeName);_===null&&(_=void 0);var z=P.put(_,c);C.oncomplete=function(){_===void 0&&(_=null),y(_)},C.onabort=C.onerror=function(){var V=z.error?z.error:z.transaction.error;E(V)}}catch(V){E(V)}})}).catch(E)});return g(v,p),v}function og(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){ft(p._dbInfo,A,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=_.delete(c);I.oncomplete=function(){v()},I.onerror=function(){y(T.error)},I.onabort=function(){var C=T.error?T.error:T.transaction.error;y(C)}}catch(C){y(C)}})}).catch(y)});return g(b,h),b}function ig(c){var h=this,p=new f(function(b,v){h.ready().then(function(){ft(h._dbInfo,A,function(y,E){if(y)return v(y);try{var I=E.objectStore(h._dbInfo.storeName),_=I.clear();E.oncomplete=function(){b()},E.onabort=E.onerror=function(){var T=_.error?_.error:_.transaction.error;v(T)}}catch(T){v(T)}})}).catch(v)});return g(p,c),p}function sg(c){var h=this,p=new f(function(b,v){h.ready().then(function(){ft(h._dbInfo,xe,function(y,E){if(y)return v(y);try{var I=E.objectStore(h._dbInfo.storeName),_=I.count();_.onsuccess=function(){b(_.result)},_.onerror=function(){v(_.error)}}catch(T){v(T)}})}).catch(v)});return g(p,c),p}function ag(c,h){var p=this,b=new f(function(v,y){if(c<0){v(null);return}p.ready().then(function(){ft(p._dbInfo,xe,function(E,I){if(E)return y(E);try{var _=I.objectStore(p._dbInfo.storeName),T=!1,C=_.openKeyCursor();C.onsuccess=function(){var P=C.result;if(!P){v(null);return}c===0||T?v(P.key):(T=!0,P.advance(c))},C.onerror=function(){y(C.error)}}catch(P){y(P)}})}).catch(y)});return g(b,h),b}function ug(c){var h=this,p=new f(function(b,v){h.ready().then(function(){ft(h._dbInfo,xe,function(y,E){if(y)return v(y);try{var I=E.objectStore(h._dbInfo.storeName),_=I.openKeyCursor(),T=[];_.onsuccess=function(){var C=_.result;if(!C){b(T);return}T.push(C.key),C.continue()},_.onerror=function(){v(_.error)}}catch(C){v(C)}})}).catch(v)});return g(p,c),p}function cg(c,h){h=S.apply(this,arguments);var p=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||p.name,c.storeName=c.storeName||p.storeName);var b=this,v;if(!c.name)v=f.reject("Invalid arguments");else{var y=c.name===p.name&&b._dbInfo.db,E=y?f.resolve(b._dbInfo.db):U(c).then(function(I){var _=k[c.name],T=_.forages;_.db=I;for(var C=0;C<T.length;C++)T[C]._dbInfo.db=I;return I});c.storeName?v=E.then(function(I){if(I.objectStoreNames.contains(c.storeName)){var _=I.version+1;j(c);var T=k[c.name],C=T.forages;I.close();for(var P=0;P<C.length;P++){var z=C[P];z._dbInfo.db=null,z._dbInfo.version=_}var V=new f(function(Y,pe){var ce=m.open(c.name,_);ce.onerror=function(ke){var Fr=ce.result;Fr.close(),pe(ke)},ce.onupgradeneeded=function(){var ke=ce.result;ke.deleteObjectStore(c.storeName)},ce.onsuccess=function(){var ke=ce.result;ke.close(),Y(ke)}});return V.then(function(Y){T.db=Y;for(var pe=0;pe<C.length;pe++){var ce=C[pe];ce._dbInfo.db=Y,O(ce._dbInfo)}}).catch(function(Y){throw($(c,Y)||f.resolve()).catch(function(){}),Y})}}):v=E.then(function(I){j(c);var _=k[c.name],T=_.forages;I.close();for(var C=0;C<T.length;C++){var P=T[C];P._dbInfo.db=null}var z=new f(function(V,Y){var pe=m.deleteDatabase(c.name);pe.onerror=function(){var ce=pe.result;ce&&ce.close(),Y(pe.error)},pe.onblocked=function(){console.warn(\'dropInstance blocked for database "\'+c.name+\'" until all open connections are closed\')},pe.onsuccess=function(){var ce=pe.result;ce&&ce.close(),V(ce)}});return z.then(function(V){_.db=V;for(var Y=0;Y<T.length;Y++){var pe=T[Y];O(pe._dbInfo)}}).catch(function(V){throw($(c,V)||f.resolve()).catch(function(){}),V})})}return g(v,h),v}var lg={_driver:"asyncStorage",_initStorage:eg,_support:l(),iterate:rg,getItem:tg,setItem:ng,removeItem:og,clear:ig,length:sg,key:ag,keys:ug,dropInstance:cg};function fg(){return typeof openDatabase=="function"}var vt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pg="~~local_forage_type~",eu=/^~~local_forage_type~([^~]+)~/,Qn="__lfsc__:",Ui=Qn.length,zi="arbf",Wi="blob",tu="si08",ru="ui08",nu="uic8",ou="si16",iu="si32",su="ur16",au="ui32",uu="fl32",cu="fl64",lu=Ui+zi.length,fu=Object.prototype.toString;function pu(c){var h=c.length*.75,p=c.length,b,v=0,y,E,I,_;c[c.length-1]==="="&&(h--,c[c.length-2]==="="&&h--);var T=new ArrayBuffer(h),C=new Uint8Array(T);for(b=0;b<p;b+=4)y=vt.indexOf(c[b]),E=vt.indexOf(c[b+1]),I=vt.indexOf(c[b+2]),_=vt.indexOf(c[b+3]),C[v++]=y<<2|E>>4,C[v++]=(E&15)<<4|I>>2,C[v++]=(I&3)<<6|_&63;return T}function Ki(c){var h=new Uint8Array(c),p="",b;for(b=0;b<h.length;b+=3)p+=vt[h[b]>>2],p+=vt[(h[b]&3)<<4|h[b+1]>>4],p+=vt[(h[b+1]&15)<<2|h[b+2]>>6],p+=vt[h[b+2]&63];return h.length%3===2?p=p.substring(0,p.length-1)+"=":h.length%3===1&&(p=p.substring(0,p.length-2)+"=="),p}function mg(c,h){var p="";if(c&&(p=fu.call(c)),c&&(p==="[object ArrayBuffer]"||c.buffer&&fu.call(c.buffer)==="[object ArrayBuffer]")){var b,v=Qn;c instanceof ArrayBuffer?(b=c,v+=zi):(b=c.buffer,p==="[object Int8Array]"?v+=tu:p==="[object Uint8Array]"?v+=ru:p==="[object Uint8ClampedArray]"?v+=nu:p==="[object Int16Array]"?v+=ou:p==="[object Uint16Array]"?v+=su:p==="[object Int32Array]"?v+=iu:p==="[object Uint32Array]"?v+=au:p==="[object Float32Array]"?v+=uu:p==="[object Float64Array]"?v+=cu:h(new Error("Failed to get type for BinaryArray"))),h(v+Ki(b))}else if(p==="[object Blob]"){var y=new FileReader;y.onload=function(){var E=pg+c.type+"~"+Ki(this.result);h(Qn+Wi+E)},y.readAsArrayBuffer(c)}else try{h(JSON.stringify(c))}catch(E){console.error("Couldn\'t convert value into a JSON string: ",c),h(null,E)}}function dg(c){if(c.substring(0,Ui)!==Qn)return JSON.parse(c);var h=c.substring(lu),p=c.substring(Ui,lu),b;if(p===Wi&&eu.test(h)){var v=h.match(eu);b=v[1],h=h.substring(v[0].length)}var y=pu(h);switch(p){case zi:return y;case Wi:return d([y],{type:b});case tu:return new Int8Array(y);case ru:return new Uint8Array(y);case nu:return new Uint8ClampedArray(y);case ou:return new Int16Array(y);case su:return new Uint16Array(y);case iu:return new Int32Array(y);case au:return new Uint32Array(y);case uu:return new Float32Array(y);case cu:return new Float64Array(y);default:throw new Error("Unkown type: "+p)}}var Gi={serialize:mg,deserialize:dg,stringToBuffer:pu,bufferToString:Ki};function mu(c,h,p,b){c.executeSql("CREATE TABLE IF NOT EXISTS "+h.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],p,b)}function hg(c){var h=this,p={db:null};if(c)for(var b in c)p[b]=typeof c[b]!="string"?c[b].toString():c[b];var v=new f(function(y,E){try{p.db=openDatabase(p.name,String(p.version),p.description,p.size)}catch(I){return E(I)}p.db.transaction(function(I){mu(I,p,function(){h._dbInfo=p,y()},function(_,T){E(T)})},E)});return p.serializer=Gi,v}function wt(c,h,p,b,v,y){c.executeSql(p,b,v,function(E,I){I.code===I.SYNTAX_ERR?E.executeSql("SELECT name FROM sqlite_master WHERE type=\'table\' AND name = ?",[h.storeName],function(_,T){T.rows.length?y(_,I):mu(_,h,function(){_.executeSql(p,b,v,y)},y)},y):y(E,I)},y)}function gg(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"SELECT * FROM "+E.storeName+" WHERE key = ? LIMIT 1",[c],function(_,T){var C=T.rows.length?T.rows.item(0).value:null;C&&(C=E.serializer.deserialize(C)),v(C)},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function yg(c,h){var p=this,b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"SELECT * FROM "+E.storeName,[],function(_,T){for(var C=T.rows,P=C.length,z=0;z<P;z++){var V=C.item(z),Y=V.value;if(Y&&(Y=E.serializer.deserialize(Y)),Y=c(Y,V.key,z+1),Y!==void 0){v(Y);return}}v()},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function du(c,h,p,b){var v=this;c=x(c);var y=new f(function(E,I){v.ready().then(function(){h===void 0&&(h=null);var _=h,T=v._dbInfo;T.serializer.serialize(h,function(C,P){P?I(P):T.db.transaction(function(z){wt(z,T,"INSERT OR REPLACE INTO "+T.storeName+" (key, value) VALUES (?, ?)",[c,C],function(){E(_)},function(V,Y){I(Y)})},function(z){if(z.code===z.QUOTA_ERR){if(b>0){E(du.apply(v,[c,_,p,b-1]));return}I(z)}})})}).catch(I)});return g(y,p),y}function bg(c,h,p){return du.apply(this,[c,h,p,1])}function vg(c,h){var p=this;c=x(c);var b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"DELETE FROM "+E.storeName+" WHERE key = ?",[c],function(){v()},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function wg(c){var h=this,p=new f(function(b,v){h.ready().then(function(){var y=h._dbInfo;y.db.transaction(function(E){wt(E,y,"DELETE FROM "+y.storeName,[],function(){b()},function(I,_){v(_)})})}).catch(v)});return g(p,c),p}function xg(c){var h=this,p=new f(function(b,v){h.ready().then(function(){var y=h._dbInfo;y.db.transaction(function(E){wt(E,y,"SELECT COUNT(key) as c FROM "+y.storeName,[],function(I,_){var T=_.rows.item(0).c;b(T)},function(I,_){v(_)})})}).catch(v)});return g(p,c),p}function Eg(c,h){var p=this,b=new f(function(v,y){p.ready().then(function(){var E=p._dbInfo;E.db.transaction(function(I){wt(I,E,"SELECT key FROM "+E.storeName+" WHERE id = ? LIMIT 1",[c+1],function(_,T){var C=T.rows.length?T.rows.item(0).key:null;v(C)},function(_,T){y(T)})})}).catch(y)});return g(b,h),b}function Ig(c){var h=this,p=new f(function(b,v){h.ready().then(function(){var y=h._dbInfo;y.db.transaction(function(E){wt(E,y,"SELECT key FROM "+y.storeName,[],function(I,_){for(var T=[],C=0;C<_.rows.length;C++)T.push(_.rows.item(C).key);b(T)},function(I,_){v(_)})})}).catch(v)});return g(p,c),p}function Sg(c){return new f(function(h,p){c.transaction(function(b){b.executeSql("SELECT name FROM sqlite_master WHERE type=\'table\' AND name <> \'__WebKitDatabaseInfoTable__\'",[],function(v,y){for(var E=[],I=0;I<y.rows.length;I++)E.push(y.rows.item(I).name);h({db:c,storeNames:E})},function(v,y){p(y)})},function(b){p(b)})})}function Og(c,h){h=S.apply(this,arguments);var p=this.config();c=typeof c!="function"&&c||{},c.name||(c.name=c.name||p.name,c.storeName=c.storeName||p.storeName);var b=this,v;return c.name?v=new f(function(y){var E;c.name===p.name?E=b._dbInfo.db:E=openDatabase(c.name,"","",0),c.storeName?y({db:E,storeNames:[c.storeName]}):y(Sg(E))}).then(function(y){return new f(function(E,I){y.db.transaction(function(_){function T(V){return new f(function(Y,pe){_.executeSql("DROP TABLE IF EXISTS "+V,[],function(){Y()},function(ce,ke){pe(ke)})})}for(var C=[],P=0,z=y.storeNames.length;P<z;P++)C.push(T(y.storeNames[P]));f.all(C).then(function(){E()}).catch(function(V){I(V)})},function(_){I(_)})})}):v=f.reject("Invalid arguments"),g(v,h),v}var Dg={_driver:"webSQLStorage",_initStorage:hg,_support:fg(),iterate:yg,getItem:gg,setItem:bg,removeItem:vg,clear:wg,length:xg,key:Eg,keys:Ig,dropInstance:Og};function _g(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function hu(c,h){var p=c.name+"/";return c.storeName!==h.storeName&&(p+=c.storeName+"/"),p}function Tg(){var c="_localforage_support_test";try{return localStorage.setItem(c,!0),localStorage.removeItem(c),!1}catch{return!0}}function Ng(){return!Tg()||localStorage.length>0}function Cg(c){var h=this,p={};if(c)for(var b in c)p[b]=c[b];return p.keyPrefix=hu(c,h._defaultConfig),Ng()?(h._dbInfo=p,p.serializer=Gi,f.resolve()):f.reject()}function Ag(c){var h=this,p=h.ready().then(function(){for(var b=h._dbInfo.keyPrefix,v=localStorage.length-1;v>=0;v--){var y=localStorage.key(v);y.indexOf(b)===0&&localStorage.removeItem(y)}});return g(p,c),p}function Rg(c,h){var p=this;c=x(c);var b=p.ready().then(function(){var v=p._dbInfo,y=localStorage.getItem(v.keyPrefix+c);return y&&(y=v.serializer.deserialize(y)),y});return g(b,h),b}function Fg(c,h){var p=this,b=p.ready().then(function(){for(var v=p._dbInfo,y=v.keyPrefix,E=y.length,I=localStorage.length,_=1,T=0;T<I;T++){var C=localStorage.key(T);if(C.indexOf(y)===0){var P=localStorage.getItem(C);if(P&&(P=v.serializer.deserialize(P)),P=c(P,C.substring(E),_++),P!==void 0)return P}}});return g(b,h),b}function $g(c,h){var p=this,b=p.ready().then(function(){var v=p._dbInfo,y;try{y=localStorage.key(c)}catch{y=null}return y&&(y=y.substring(v.keyPrefix.length)),y});return g(b,h),b}function Pg(c){var h=this,p=h.ready().then(function(){for(var b=h._dbInfo,v=localStorage.length,y=[],E=0;E<v;E++){var I=localStorage.key(E);I.indexOf(b.keyPrefix)===0&&y.push(I.substring(b.keyPrefix.length))}return y});return g(p,c),p}function kg(c){var h=this,p=h.keys().then(function(b){return b.length});return g(p,c),p}function Mg(c,h){var p=this;c=x(c);var b=p.ready().then(function(){var v=p._dbInfo;localStorage.removeItem(v.keyPrefix+c)});return g(b,h),b}function qg(c,h,p){var b=this;c=x(c);var v=b.ready().then(function(){h===void 0&&(h=null);var y=h;return new f(function(E,I){var _=b._dbInfo;_.serializer.serialize(h,function(T,C){if(C)I(C);else try{localStorage.setItem(_.keyPrefix+c,T),E(y)}catch(P){(P.name==="QuotaExceededError"||P.name==="NS_ERROR_DOM_QUOTA_REACHED")&&I(P),I(P)}})})});return g(v,p),v}function jg(c,h){if(h=S.apply(this,arguments),c=typeof c!="function"&&c||{},!c.name){var p=this.config();c.name=c.name||p.name,c.storeName=c.storeName||p.storeName}var b=this,v;return c.name?v=new f(function(y){c.storeName?y(hu(c,b._defaultConfig)):y(c.name+"/")}).then(function(y){for(var E=localStorage.length-1;E>=0;E--){var I=localStorage.key(E);I.indexOf(y)===0&&localStorage.removeItem(I)}}):v=f.reject("Invalid arguments"),g(v,h),v}var Lg={_driver:"localStorageWrapper",_initStorage:Cg,_support:_g(),iterate:Fg,getItem:Rg,setItem:qg,removeItem:Mg,clear:Ag,length:kg,key:$g,keys:Pg,dropInstance:jg},Bg=function(h,p){return h===p||typeof h=="number"&&typeof p=="number"&&isNaN(h)&&isNaN(p)},Ug=function(h,p){for(var b=h.length,v=0;v<b;){if(Bg(h[v],p))return!0;v++}return!1},gu=Array.isArray||function(c){return Object.prototype.toString.call(c)==="[object Array]"},Rr={},yu={},or={INDEXEDDB:lg,WEBSQL:Dg,LOCALSTORAGE:Lg},zg=[or.INDEXEDDB._driver,or.WEBSQL._driver,or.LOCALSTORAGE._driver],Xn=["dropInstance"],Hi=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Xn),Wg={description:"",driver:zg.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Kg(c,h){c[h]=function(){var p=arguments;return c.ready().then(function(){return c[h].apply(c,p)})}}function Ji(){for(var c=1;c<arguments.length;c++){var h=arguments[c];if(h)for(var p in h)h.hasOwnProperty(p)&&(gu(h[p])?arguments[0][p]=h[p].slice():arguments[0][p]=h[p])}return arguments[0]}var Gg=function(){function c(h){a(this,c);for(var p in or)if(or.hasOwnProperty(p)){var b=or[p],v=b._driver;this[p]=v,Rr[v]||this.defineDriver(b)}this._defaultConfig=Ji({},Wg),this._config=Ji({},this._defaultConfig,h),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return c.prototype.config=function(p){if((typeof p>"u"?"undefined":s(p))==="object"){if(this._ready)return new Error("Can\'t call config() after localforage has been used.");for(var b in p){if(b==="storeName"&&(p[b]=p[b].replace(/\\W/g,"_")),b==="version"&&typeof p[b]!="number")return new Error("Database version must be a number.");this._config[b]=p[b]}return"driver"in p&&p.driver?this.setDriver(this._config.driver):!0}else return typeof p=="string"?this._config[p]:this._config},c.prototype.defineDriver=function(p,b,v){var y=new f(function(E,I){try{var _=p._driver,T=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!p._driver){I(T);return}for(var C=Hi.concat("_initStorage"),P=0,z=C.length;P<z;P++){var V=C[P],Y=!Ug(Xn,V);if((Y||p[V])&&typeof p[V]!="function"){I(T);return}}var pe=function(){for(var Fr=function(Vg){return function(){var Yg=new Error("Method "+Vg+" is not implemented by the current driver"),bu=f.reject(Yg);return g(bu,arguments[arguments.length-1]),bu}},Vi=0,Jg=Xn.length;Vi<Jg;Vi++){var Yi=Xn[Vi];p[Yi]||(p[Yi]=Fr(Yi))}};pe();var ce=function(Fr){Rr[_]&&console.info("Redefining LocalForage driver: "+_),Rr[_]=p,yu[_]=Fr,E()};"_support"in p?p._support&&typeof p._support=="function"?p._support().then(ce,I):ce(!!p._support):ce(!0)}catch(ke){I(ke)}});return w(y,b,v),y},c.prototype.driver=function(){return this._driver||null},c.prototype.getDriver=function(p,b,v){var y=Rr[p]?f.resolve(Rr[p]):f.reject(new Error("Driver not found."));return w(y,b,v),y},c.prototype.getSerializer=function(p){var b=f.resolve(Gi);return w(b,p),b},c.prototype.ready=function(p){var b=this,v=b._driverSet.then(function(){return b._ready===null&&(b._ready=b._initDriver()),b._ready});return w(v,p,p),v},c.prototype.setDriver=function(p,b,v){var y=this;gu(p)||(p=[p]);var E=this._getSupportedDrivers(p);function I(){y._config.driver=y.driver()}function _(P){return y._extend(P),I(),y._ready=y._initStorage(y._config),y._ready}function T(P){return function(){var z=0;function V(){for(;z<P.length;){var Y=P[z];return z++,y._dbInfo=null,y._ready=null,y.getDriver(Y).then(_).catch(V)}I();var pe=new Error("No available storage method found.");return y._driverSet=f.reject(pe),y._driverSet}return V()}}var C=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=C.then(function(){var P=E[0];return y._dbInfo=null,y._ready=null,y.getDriver(P).then(function(z){y._driver=z._driver,I(),y._wrapLibraryMethodsWithReady(),y._initDriver=T(E)})}).catch(function(){I();var P=new Error("No available storage method found.");return y._driverSet=f.reject(P),y._driverSet}),w(this._driverSet,b,v),this._driverSet},c.prototype.supports=function(p){return!!yu[p]},c.prototype._extend=function(p){Ji(this,p)},c.prototype._getSupportedDrivers=function(p){for(var b=[],v=0,y=p.length;v<y;v++){var E=p[v];this.supports(E)&&b.push(E)}return b},c.prototype._wrapLibraryMethodsWithReady=function(){for(var p=0,b=Hi.length;p<b;p++)Kg(this,Hi[p])},c.prototype.createInstance=function(p){return new c(p)},c}(),Hg=new Gg;o.exports=Hg},{3:3}]},{},[4])(4)})});var dl=D((eA,ml)=>{var gr=1e3,yr=gr*60,br=yr*60,zt=br*24,Lv=zt*7,Bv=zt*365.25;ml.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Uv(e);if(r==="number"&&isFinite(e))return t.long?Wv(e):zv(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Uv(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Bv;case"weeks":case"week":case"w":return r*Lv;case"days":case"day":case"d":return r*zt;case"hours":case"hour":case"hrs":case"hr":case"h":return r*br;case"minutes":case"minute":case"mins":case"min":case"m":return r*yr;case"seconds":case"second":case"secs":case"sec":case"s":return r*gr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function zv(e){var t=Math.abs(e);return t>=zt?Math.round(e/zt)+"d":t>=br?Math.round(e/br)+"h":t>=yr?Math.round(e/yr)+"m":t>=gr?Math.round(e/gr)+"s":e+"ms"}function Wv(e){var t=Math.abs(e);return t>=zt?Wo(e,t,zt,"day"):t>=br?Wo(e,t,br,"hour"):t>=yr?Wo(e,t,yr,"minute"):t>=gr?Wo(e,t,gr,"second"):e+" ms"}function Wo(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var gl=D((tA,hl)=>{function Kv(e){r.debug=r,r.default=r,r.coerce=u,r.disable=i,r.enable=o,r.enabled=s,r.humanize=dl(),r.destroy=m,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=t;function r(l){let d,f=null,g,w;function x(...S){if(!x.enabled)return;let N=x,M=Number(new Date),k=M-(d||M);N.diff=k,N.prev=d,N.curr=M,d=M,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let ee=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(A,B)=>{if(A==="%%")return"%";ee++;let L=r.formatters[B];if(typeof L=="function"){let F=S[ee];A=L.call(N,F),S.splice(ee,1),ee--}return A}),r.formatArgs.call(N,S),(N.log||r.log).apply(N,S)}return x.namespace=l,x.useColors=r.useColors(),x.color=r.selectColor(l),x.extend=n,x.destroy=r.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(g!==r.namespaces&&(g=r.namespaces,w=r.enabled(l)),w),set:S=>{f=S}}),typeof r.init=="function"&&r.init(x),x}function n(l,d){let f=r(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let d,f=(typeof l=="string"?l:"").split(/[\\s,]+/),g=f.length;for(d=0;d<g;d++)f[d]&&(l=f[d].replace(/\\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function i(){let l=[...r.names.map(a),...r.skips.map(a).map(d=>"-"+d)].join(",");return r.enable(""),l}function s(l){if(l[l.length-1]==="*")return!0;let d,f;for(d=0,f=r.skips.length;d<f;d++)if(r.skips[d].test(l))return!1;for(d=0,f=r.names.length;d<f;d++)if(r.names[d].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\\.\\*\\?$/,"*")}function u(l){return l instanceof Error?l.stack||l.message:l}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}hl.exports=Kv});var we=D((Fe,Ko)=>{Fe.formatArgs=Hv;Fe.save=Jv;Fe.load=Vv;Fe.useColors=Gv;Fe.storage=Yv();Fe.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Fe.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Gv(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)}function Hv(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Ko.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}Fe.log=console.debug||console.log||(()=>{});function Jv(e){try{e?Fe.storage.setItem("debug",e):Fe.storage.removeItem("debug")}catch{}}function Vv(){let e;try{e=Fe.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Yv(){try{return localStorage}catch{}}Ko.exports=gl()(Fe);var{formatters:Zv}=Ko.exports;Zv.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var bl=D((rA,yl)=>{"use strict";yl.exports=Qv;function vr(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Qv(e){if(e=e||{},e.circles)return Xv(e);return e.proto?n:r;function t(o,i){for(var s=Object.keys(o),a=new Array(s.length),u=0;u<s.length;u++){var m=s[u],l=o[m];typeof l!="object"||l===null?a[m]=l:l instanceof Date?a[m]=new Date(l):ArrayBuffer.isView(l)?a[m]=vr(l):a[m]=i(l)}return a}function r(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,r);if(o instanceof Map)return new Map(t(Array.from(o),r));if(o instanceof Set)return new Set(t(Array.from(o),r));var i={};for(var s in o)if(Object.hasOwnProperty.call(o,s)!==!1){var a=o[s];typeof a!="object"||a===null?i[s]=a:a instanceof Date?i[s]=new Date(a):a instanceof Map?i[s]=new Map(t(Array.from(a),r)):a instanceof Set?i[s]=new Set(t(Array.from(a),r)):ArrayBuffer.isView(a)?i[s]=vr(a):i[s]=r(a)}return i}function n(o){if(typeof o!="object"||o===null)return o;if(o instanceof Date)return new Date(o);if(Array.isArray(o))return t(o,n);if(o instanceof Map)return new Map(t(Array.from(o),n));if(o instanceof Set)return new Set(t(Array.from(o),n));var i={};for(var s in o){var a=o[s];typeof a!="object"||a===null?i[s]=a:a instanceof Date?i[s]=new Date(a):a instanceof Map?i[s]=new Map(t(Array.from(a),n)):a instanceof Set?i[s]=new Set(t(Array.from(a),n)):ArrayBuffer.isView(a)?i[s]=vr(a):i[s]=n(a)}return i}}function Xv(e){var t=[],r=[];return e.proto?i:o;function n(s,a){for(var u=Object.keys(s),m=new Array(u.length),l=0;l<u.length;l++){var d=u[l],f=s[d];if(typeof f!="object"||f===null)m[d]=f;else if(f instanceof Date)m[d]=new Date(f);else if(ArrayBuffer.isView(f))m[d]=vr(f);else{var g=t.indexOf(f);g!==-1?m[d]=r[g]:m[d]=a(f)}}return m}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,o);if(s instanceof Map)return new Map(n(Array.from(s),o));if(s instanceof Set)return new Set(n(Array.from(s),o));var a={};t.push(s),r.push(a);for(var u in s)if(Object.hasOwnProperty.call(s,u)!==!1){var m=s[u];if(typeof m!="object"||m===null)a[u]=m;else if(m instanceof Date)a[u]=new Date(m);else if(m instanceof Map)a[u]=new Map(n(Array.from(m),o));else if(m instanceof Set)a[u]=new Set(n(Array.from(m),o));else if(ArrayBuffer.isView(m))a[u]=vr(m);else{var l=t.indexOf(m);l!==-1?a[u]=r[l]:a[u]=o(m)}}return t.pop(),r.pop(),a}function i(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return n(s,i);if(s instanceof Map)return new Map(n(Array.from(s),i));if(s instanceof Set)return new Set(n(Array.from(s),i));var a={};t.push(s),r.push(a);for(var u in s){var m=s[u];if(typeof m!="object"||m===null)a[u]=m;else if(m instanceof Date)a[u]=new Date(m);else if(m instanceof Map)a[u]=new Map(n(Array.from(m),i));else if(m instanceof Set)a[u]=new Set(n(Array.from(m),i));else if(ArrayBuffer.isView(m))a[u]=vr(m);else{var l=t.indexOf(m);l!==-1?a[u]=r[l]:a[u]=i(m)}}return t.pop(),r.pop(),a}}});var Kt=D((nA,El)=>{var ew=require("util"),Wt=we()("log4js:configuration"),Go=[],Ho=[],vl=e=>!e,wl=e=>e&&typeof e=="object"&&!Array.isArray(e),tw=e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),rw=e=>e&&typeof e=="number"&&Number.isInteger(e),nw=e=>{Ho.push(e),Wt(`Added listener, now ${Ho.length} listeners`)},ow=e=>{Go.push(e),Wt(`Added pre-processing listener, now ${Go.length} listeners`)},xl=(e,t,r)=>{(Array.isArray(t)?t:[t]).forEach(o=>{if(o)throw new Error(`Problem with log4js configuration: (${ew.inspect(e,{depth:5})}) - ${r}`)})},iw=e=>{Wt("New configuration to be validated: ",e),xl(e,vl(wl(e)),"must be an object."),Wt(`Calling pre-processing listeners (${Go.length})`),Go.forEach(t=>t(e)),Wt("Configuration pre-processing finished."),Wt(`Calling configuration listeners (${Ho.length})`),Ho.forEach(t=>t(e)),Wt("Configuration finished.")};El.exports={configure:iw,addListener:nw,addPreProcessingListener:ow,throwExceptionIf:xl,anObject:wl,anInteger:rw,validIdentifier:tw,not:vl}});var Jo=D((oA,ze)=>{"use strict";function Il(e,t){for(var r=e.toString();r.length<t;)r="0"+r;return r}function Gt(e){return Il(e,2)}function sw(e){var t=Math.abs(e),r=String(Math.floor(t/60)),n=String(t%60);return r=("0"+r).slice(-2),n=("0"+n).slice(-2),e===0?"Z":(e<0?"+":"-")+r+":"+n}function Sl(e,t){typeof e!="string"&&(t=e,e=ze.exports.ISO8601_FORMAT),t||(t=ze.exports.now());var r=Gt(t.getDate()),n=Gt(t.getMonth()+1),o=Gt(t.getFullYear()),i=Gt(o.substring(2,4)),s=e.indexOf("yyyy")>-1?o:i,a=Gt(t.getHours()),u=Gt(t.getMinutes()),m=Gt(t.getSeconds()),l=Il(t.getMilliseconds(),3),d=sw(t.getTimezoneOffset()),f=e.replace(/dd/g,r).replace(/MM/g,n).replace(/y{1,4}/g,s).replace(/hh/g,a).replace(/mm/g,u).replace(/ss/g,m).replace(/SSS/g,l).replace(/O/g,d);return f}function _t(e,t,r,n){e["set"+(n?"":"UTC")+t](r)}function aw(e,t,r){var n=e.indexOf("O")<0,o=!1,i=[{pattern:/y{1,4}/,regexp:"\\\\d{1,4}",fn:function(d,f){_t(d,"FullYear",f,n)}},{pattern:/MM/,regexp:"\\\\d{1,2}",fn:function(d,f){_t(d,"Month",f-1,n),d.getMonth()!==f-1&&(o=!0)}},{pattern:/dd/,regexp:"\\\\d{1,2}",fn:function(d,f){o&&_t(d,"Month",d.getMonth()-1,n),_t(d,"Date",f,n)}},{pattern:/hh/,regexp:"\\\\d{1,2}",fn:function(d,f){_t(d,"Hours",f,n)}},{pattern:/mm/,regexp:"\\\\d\\\\d",fn:function(d,f){_t(d,"Minutes",f,n)}},{pattern:/ss/,regexp:"\\\\d\\\\d",fn:function(d,f){_t(d,"Seconds",f,n)}},{pattern:/SSS/,regexp:"\\\\d\\\\d\\\\d",fn:function(d,f){_t(d,"Milliseconds",f,n)}},{pattern:/O/,regexp:"[+-]\\\\d{1,2}:?\\\\d{2}?|Z",fn:function(d,f){f==="Z"?f=0:f=f.replace(":","");var g=Math.abs(f),w=(f>0?-1:1)*(g%100+Math.floor(g/100)*60);d.setUTCMinutes(d.getUTCMinutes()+w)}}],s=i.reduce(function(d,f){return f.pattern.test(d.regexp)?(f.index=d.regexp.match(f.pattern).index,d.regexp=d.regexp.replace(f.pattern,"("+f.regexp+")")):f.index=-1,d},{regexp:e,index:[]}),a=i.filter(function(d){return d.index>-1});a.sort(function(d,f){return d.index-f.index});var u=new RegExp(s.regexp),m=u.exec(t);if(m){var l=r||ze.exports.now();return a.forEach(function(d,f){d.fn(l,m[f+1])}),l}throw new Error("String \'"+t+"\' could not be parsed as \'"+e+"\'")}function uw(e,t,r){if(!e)throw new Error("pattern must be supplied");return aw(e,t,r)}function cw(){return new Date}ze.exports=Sl;ze.exports.asString=Sl;ze.exports.parse=uw;ze.exports.now=cw;ze.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS";ze.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO";ze.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS";ze.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"});var Ys=D((iA,kl)=>{var Tt=Jo(),Ol=require("os"),bn=require("util"),yn=require("path"),Dl=require("url"),_l=we()("log4js:layouts"),Tl={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function Nl(e){return e?`\\x1B[${Tl[e][0]}m`:""}function Cl(e){return e?`\\x1B[${Tl[e][1]}m`:""}function lw(e,t){return Nl(t)+e+Cl(t)}function Al(e,t){return lw(bn.format("[%s] [%s] %s - ",Tt.asString(e.startTime),e.level.toString(),e.categoryName),t)}function Rl(e){return Al(e)+bn.format(...e.data)}function Vo(e){return Al(e,e.level.colour)+bn.format(...e.data)}function Fl(e){return bn.format(...e.data)}function $l(e){return e.data[0]}function Pl(e,t){let r="%r %p %c - %m%n",n=/%(-?[0-9]+)?(\\.?-?[0-9]+)?([[\\]cdhmnprzxXyflos%])(\\{([^}]+)\\})?|([^%]+)/;e=e||r;function o(O,$){let R=O.categoryName;if($){let U=parseInt($,10),q=R.split(".");U<q.length&&(R=q.slice(q.length-U).join("."))}return R}function i(O,$){let R=Tt.ISO8601_FORMAT;if($)switch(R=$,R){case"ISO8601":case"ISO8601_FORMAT":R=Tt.ISO8601_FORMAT;break;case"ISO8601_WITH_TZ_OFFSET":case"ISO8601_WITH_TZ_OFFSET_FORMAT":R=Tt.ISO8601_WITH_TZ_OFFSET_FORMAT;break;case"ABSOLUTE":process.emitWarning("Pattern %d{ABSOLUTE} is deprecated in favor of %d{ABSOLUTETIME}. Please use %d{ABSOLUTETIME} instead.","DeprecationWarning","log4js-node-DEP0003"),_l("[log4js-node-DEP0003]","DEPRECATION: Pattern %d{ABSOLUTE} is deprecated and replaced by %d{ABSOLUTETIME}.");case"ABSOLUTETIME":case"ABSOLUTETIME_FORMAT":R=Tt.ABSOLUTETIME_FORMAT;break;case"DATE":process.emitWarning("Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.","DeprecationWarning","log4js-node-DEP0004"),_l("[log4js-node-DEP0004]","DEPRECATION: Pattern %d{DATE} is deprecated and replaced by %d{DATETIME}.");case"DATETIME":case"DATETIME_FORMAT":R=Tt.DATETIME_FORMAT;break}return Tt.asString(R,O.startTime)}function s(){return Ol.hostname().toString()}function a(O){return bn.format(...O.data)}function u(){return Ol.EOL}function m(O){return O.level.toString()}function l(O){return Tt.asString("hh:mm:ss",O.startTime)}function d(O){return Nl(O.level.colour)}function f(O){return Cl(O.level.colour)}function g(){return"%"}function w(O){return O&&O.pid?O.pid.toString():process.pid.toString()}function x(){return w()}function S(O,$){return typeof t[$]<"u"?typeof t[$]=="function"?t[$](O):t[$]:null}function N(O,$){let R=O.context[$];return typeof R<"u"?typeof R=="function"?R(O):R:null}function M(O,$){let R=O.fileName||"";if(R=function(q){let W="file://";return q.startsWith(W)&&(typeof Dl.fileURLToPath=="function"?q=Dl.fileURLToPath(q):(q=yn.normalize(q.replace(new RegExp(`^${W}`),"")),process.platform==="win32"&&(q.startsWith("\\\\")?q=q.slice(1):q=yn.sep+yn.sep+q))),q}(R),$){let q=parseInt($,10),W=R.split(yn.sep);W.length>q&&(R=W.slice(-q).join(yn.sep))}return R}function k(O){return O.lineNumber?`${O.lineNumber}`:""}function ee(O){return O.columnNumber?`${O.columnNumber}`:""}function xe(O){return O.callStack||""}let A={c:o,d:i,h:s,m:a,n:u,p:m,r:l,"[":d,"]":f,y:x,z:w,"%":g,x:S,X:N,f:M,l:k,o:ee,s:xe};function B(O,$,R){return A[O]($,R)}function L(O,$){let R;return O?(R=parseInt(O.slice(1),10),R>0?$.slice(0,R):$.slice(R)):$}function F(O,$){let R;if(O)if(O.charAt(0)==="-")for(R=parseInt(O.slice(1),10);$.length<R;)$+=" ";else for(R=parseInt(O,10);$.length<R;)$=` ${$}`;return $}function j(O,$,R){let U=O;return U=L($,U),U=F(R,U),U}return function(O){let $="",R,U=e;for(;(R=n.exec(U))!==null;){let q=R[1],W=R[2],K=R[3],X=R[5],J=R[6];if(J)$+=J.toString();else{let Zn=B(K,O,X);$+=j(Zn,W,q)}U=U.slice(R.index+R[0].length)}return $}}var Vs={messagePassThrough(){return Fl},basic(){return Rl},colored(){return Vo},coloured(){return Vo},pattern(e){return Pl(e&&e.pattern,e&&e.tokens)},dummy(){return $l}};kl.exports={basicLayout:Rl,messagePassThroughLayout:Fl,patternLayout:Pl,colouredLayout:Vo,coloredLayout:Vo,dummyLayout:$l,addLayout(e,t){Vs[e]=t},layout(e,t){return Vs[e]&&Vs[e](t)}}});var Ht=D((sA,ql)=>{var me=Kt(),Ml=["white","grey","black","blue","cyan","green","magenta","red","yellow"],de=class{constructor(t,r,n){this.level=t,this.levelStr=r,this.colour=n}toString(){return this.levelStr}static getLevel(t,r){return t?t instanceof de?t:(t instanceof Object&&t.levelStr&&(t=t.levelStr),de[t.toString().toUpperCase()]||r):r}static addLevels(t){t&&(Object.keys(t).forEach(n=>{let o=n.toUpperCase();de[o]=new de(t[n].value,o,t[n].colour);let i=de.levels.findIndex(s=>s.levelStr===o);i>-1?de.levels[i]=de[o]:de.levels.push(de[o])}),de.levels.sort((n,o)=>n.level-o.level))}isLessThanOrEqualTo(t){return typeof t=="string"&&(t=de.getLevel(t)),this.level<=t.level}isGreaterThanOrEqualTo(t){return typeof t=="string"&&(t=de.getLevel(t)),this.level>=t.level}isEqualTo(t){return typeof t=="string"&&(t=de.getLevel(t)),this.level===t.level}};de.levels=[];de.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}});me.addListener(e=>{let t=e.levels;t&&(me.throwExceptionIf(e,me.not(me.anObject(t)),"levels must be an object"),Object.keys(t).forEach(n=>{me.throwExceptionIf(e,me.not(me.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),me.throwExceptionIf(e,me.not(me.anObject(t[n])),`level "${n}" must be an object`),me.throwExceptionIf(e,me.not(t[n].value),`level "${n}" must have a \'value\' property`),me.throwExceptionIf(e,me.not(me.anInteger(t[n].value)),`level "${n}".value must have an integer value`),me.throwExceptionIf(e,me.not(t[n].colour),`level "${n}" must have a \'colour\' property`),me.throwExceptionIf(e,me.not(Ml.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Ml.join(", ")}`)}))});me.addListener(e=>{de.addLevels(e.levels)});ql.exports=de});var Jl=D(wn=>{"use strict";var{parse:Bl,stringify:Ul}=JSON,{keys:fw}=Object,vn=String,zl="string",jl={},Yo="object",Wl=(e,t)=>t,pw=e=>e instanceof vn?vn(e):e,mw=(e,t)=>typeof t===zl?new vn(t):t,Kl=(e,t,r,n)=>{let o=[];for(let i=fw(r),{length:s}=i,a=0;a<s;a++){let u=i[a],m=r[u];if(m instanceof vn){let l=e[m];typeof l===Yo&&!t.has(l)?(t.add(l),r[u]=jl,o.push({k:u,a:[e,t,l,n]})):r[u]=n.call(r,u,l)}else r[u]!==jl&&(r[u]=n.call(r,u,m))}for(let{length:i}=o,s=0;s<i;s++){let{k:a,a:u}=o[s];r[a]=n.call(r,a,Kl.apply(null,u))}return r},Ll=(e,t,r)=>{let n=vn(t.push(r)-1);return e.set(r,n),n},Gl=(e,t)=>{let r=Bl(e,mw).map(pw),n=r[0],o=t||Wl,i=typeof n===Yo&&n?Kl(r,new Set,n,o):n;return o.call({"":i},"",i)};wn.parse=Gl;var Hl=(e,t,r)=>{let n=t&&typeof t===Yo?(l,d)=>l===""||-1<t.indexOf(l)?d:void 0:t||Wl,o=new Map,i=[],s=[],a=+Ll(o,i,n.call({"":e},"",e)),u=!a;for(;a<i.length;)u=!0,s[a]=Ul(i[a++],m,r);return"["+s.join(",")+"]";function m(l,d){if(u)return u=!u,d;let f=n.call(this,l,d);switch(typeof f){case Yo:if(f===null)return f;case zl:return o.get(f)||Ll(o,i,f)}return f}};wn.stringify=Hl;var dw=e=>Bl(Hl(e));wn.toJSON=dw;var hw=e=>Gl(Ul(e));wn.fromJSON=hw});var Zs=D((uA,Zl)=>{var Vl=Jl(),Yl=Ht(),wr=class{constructor(t,r,n,o,i){this.startTime=new Date,this.categoryName=t,this.data=n,this.level=r,this.context=Object.assign({},o),this.pid=process.pid,i&&(this.functionName=i.functionName,this.fileName=i.fileName,this.lineNumber=i.lineNumber,this.columnNumber=i.columnNumber,this.callStack=i.callStack)}serialise(){return Vl.stringify(this,(t,r)=>(r&&r.message&&r.stack?r=Object.assign({message:r.message,stack:r.stack},r):typeof r=="number"&&(Number.isNaN(r)||!Number.isFinite(r))?r=r.toString():typeof r>"u"&&(r=typeof r),r))}static deserialise(t){let r;try{let n=Vl.parse(t,(o,i)=>{if(i&&i.message&&i.stack){let s=new Error(i);Object.keys(i).forEach(a=>{s[a]=i[a]}),i=s}return i});n.location={functionName:n.functionName,fileName:n.fileName,lineNumber:n.lineNumber,columnNumber:n.columnNumber,callStack:n.callStack},r=new wr(n.categoryName,Yl.getLevel(n.level.levelStr),n.data,n.context,n.location),r.startTime=new Date(n.startTime),r.pid=n.pid,r.cluster=n.cluster}catch(n){r=new wr("log4js",Yl.ERROR,["Unable to parse log:",t,"because: ",n])}return r}};Zl.exports=wr});var Qo=D((cA,ef)=>{var We=we()("log4js:clustering"),gw=Zs(),yw=Kt(),xr=!1,Ke=null;try{Ke=require("cluster")}catch{We("cluster module not present"),xr=!0}var Xs=[],En=!1,xn="NODE_APP_INSTANCE",Ql=()=>En&&process.env[xn]==="0",Qs=()=>xr||Ke&&Ke.isMaster||Ql(),Xl=e=>{Xs.forEach(t=>t(e))},Zo=(e,t)=>{if(We("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&t.topic==="log4js:message"){We("received message: ",t.data);let r=gw.deserialise(t.data);Xl(r)}};xr||yw.addListener(e=>{Xs.length=0,{pm2:En,disableClustering:xr,pm2InstanceVar:xn="NODE_APP_INSTANCE"}=e,We(`clustering disabled ? ${xr}`),We(`cluster.isMaster ? ${Ke&&Ke.isMaster}`),We(`pm2 enabled ? ${En}`),We(`pm2InstanceVar = ${xn}`),We(`process.env[${xn}] = ${process.env[xn]}`),En&&process.removeListener("message",Zo),Ke&&Ke.removeListener&&Ke.removeListener("message",Zo),xr||e.disableClustering?We("Not listening for cluster messages, because clustering disabled."):Ql()?(We("listening for PM2 broadcast messages"),process.on("message",Zo)):Ke&&Ke.isMaster?(We("listening for cluster messages"),Ke.on("message",Zo)):We("not listening for messages, because we are not a master process")});ef.exports={onlyOnMaster:(e,t)=>Qs()?e():t,isMaster:Qs,send:e=>{Qs()?Xl(e):(En||(e.cluster={workerId:Ke.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{Xs.push(e)}}});var nf=D((lA,rf)=>{function bw(e){if(typeof e=="number"&&Number.isInteger(e))return e;let t={K:1024,M:1024*1024,G:1024*1024*1024},r=Object.keys(t),n=e.slice(-1).toLocaleUpperCase(),o=e.slice(0,-1).trim();if(r.indexOf(n)<0||!Number.isInteger(Number(o)))throw Error(`maxLogSize: "${e}" is invalid`);return o*t[n]}function vw(e,t){let r=Object.assign({},t);return Object.keys(e).forEach(n=>{r[n]&&(r[n]=e[n](t[n]))}),r}function ea(e){return vw({maxLogSize:bw},e)}var tf={dateFile:ea,file:ea,fileSync:ea};rf.exports.modifyConfig=e=>tf[e.type]?tf[e.type](e):e});var sf=D((fA,of)=>{var ww=console.log.bind(console);function xw(e,t){return r=>{ww(e(r,t))}}function Ew(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),xw(r,e.timezoneOffset)}of.exports.configure=Ew});var uf=D(af=>{function Iw(e,t){return r=>{process.stdout.write(`${e(r,t)}\n`)}}function Sw(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),Iw(r,e.timezoneOffset)}af.configure=Sw});var lf=D((mA,cf)=>{function Ow(e,t){return r=>{process.stderr.write(`${e(r,t)}\n`)}}function Dw(e,t){let r=t.colouredLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),Ow(r,e.timezoneOffset)}cf.exports.configure=Dw});var pf=D((dA,ff)=>{function _w(e,t,r,n){let o=n.getLevel(e),i=n.getLevel(t,n.FATAL);return s=>{let a=s.level;o.isLessThanOrEqualTo(a)&&i.isGreaterThanOrEqualTo(a)&&r(s)}}function Tw(e,t,r,n){let o=r(e.appender);return _w(e.level,e.maxLevel,o,n)}ff.exports.configure=Tw});var hf=D((hA,df)=>{var mf=we()("log4js:categoryFilter");function Nw(e,t){return typeof e=="string"&&(e=[e]),r=>{mf(`Checking ${r.categoryName} against ${e}`),e.indexOf(r.categoryName)===-1&&(mf("Not excluded, sending to appender"),t(r))}}function Cw(e,t,r){let n=r(e.appender);return Nw(e.exclude,n)}df.exports.configure=Cw});var bf=D((gA,yf)=>{var gf=we()("log4js:noLogFilter");function Aw(e){return e.filter(r=>r!=null&&r!=="")}function Rw(e,t){return r=>{gf(`Checking data: ${r.data} against filters: ${e}`),typeof e=="string"&&(e=[e]),e=Aw(e);let n=new RegExp(e.join("|"),"i");(e.length===0||r.data.findIndex(o=>n.test(o))<0)&&(gf("Not excluded, sending to appender"),t(r))}}function Fw(e,t,r){let n=r(e.appender);return Rw(e.exclude,n)}yf.exports.configure=Fw});var Ce=D(ta=>{"use strict";ta.fromCallback=function(e){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")e.apply(this,arguments);else return new Promise((t,r)=>{arguments[arguments.length]=(n,o)=>{if(n)return r(n);t(o)},arguments.length++,e.apply(this,arguments)})},"name",{value:e.name})};ta.fromPromise=function(e){return Object.defineProperty(function(){let t=arguments[arguments.length-1];if(typeof t!="function")return e.apply(this,arguments);e.apply(this,arguments).then(r=>t(null,r),t)},"name",{value:e.name})}});var wf=D((bA,vf)=>{var Nt=require("constants"),$w=process.cwd,Xo=null,Pw=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Xo||(Xo=$w.call(process)),Xo};try{process.cwd()}catch{}typeof process.chdir=="function"&&(ra=process.chdir,process.chdir=function(e){Xo=null,ra.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ra));var ra;vf.exports=kw;function kw(e){Nt.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\\.6\\.[0-2]|^v0\\.5\\./)&&t(e),e.lutimes||r(e),e.chown=i(e.chown),e.fchown=i(e.fchown),e.lchown=i(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=o(e.chmodSync),e.fchmodSync=o(e.fchmodSync),e.lchmodSync=o(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(l,d,f){f&&process.nextTick(f)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(l,d,f,g){g&&process.nextTick(g)},e.lchownSync=function(){}),Pw==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(l){function d(f,g,w){var x=Date.now(),S=0;l(f,g,function N(M){if(M&&(M.code==="EACCES"||M.code==="EPERM"||M.code==="EBUSY")&&Date.now()-x<6e4){setTimeout(function(){e.stat(g,function(k,ee){k&&k.code==="ENOENT"?l(f,g,N):w(M)})},S),S<100&&(S+=10);return}w&&w(M)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d}(e.rename)),e.read=typeof e.read!="function"?e.read:function(l){function d(f,g,w,x,S,N){var M;if(N&&typeof N=="function"){var k=0;M=function(ee,xe,A){if(ee&&ee.code==="EAGAIN"&&k<10)return k++,l.call(e,f,g,w,x,S,M);N.apply(this,arguments)}}return l.call(e,f,g,w,x,S,M)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(l){return function(d,f,g,w,x){for(var S=0;;)try{return l.call(e,d,f,g,w,x)}catch(N){if(N.code==="EAGAIN"&&S<10){S++;continue}throw N}}}(e.readSync);function t(l){l.lchmod=function(d,f,g){l.open(d,Nt.O_WRONLY|Nt.O_SYMLINK,f,function(w,x){if(w){g&&g(w);return}l.fchmod(x,f,function(S){l.close(x,function(N){g&&g(S||N)})})})},l.lchmodSync=function(d,f){var g=l.openSync(d,Nt.O_WRONLY|Nt.O_SYMLINK,f),w=!0,x;try{x=l.fchmodSync(g,f),w=!1}finally{if(w)try{l.closeSync(g)}catch{}else l.closeSync(g)}return x}}function r(l){Nt.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(d,f,g,w){l.open(d,Nt.O_SYMLINK,function(x,S){if(x){w&&w(x);return}l.futimes(S,f,g,function(N){l.close(S,function(M){w&&w(N||M)})})})},l.lutimesSync=function(d,f,g){var w=l.openSync(d,Nt.O_SYMLINK),x,S=!0;try{x=l.futimesSync(w,f,g),S=!1}finally{if(S)try{l.closeSync(w)}catch{}else l.closeSync(w)}return x}):l.futimes&&(l.lutimes=function(d,f,g,w){w&&process.nextTick(w)},l.lutimesSync=function(){})}function n(l){return l&&function(d,f,g){return l.call(e,d,f,function(w){m(w)&&(w=null),g&&g.apply(this,arguments)})}}function o(l){return l&&function(d,f){try{return l.call(e,d,f)}catch(g){if(!m(g))throw g}}}function i(l){return l&&function(d,f,g,w){return l.call(e,d,f,g,function(x){m(x)&&(x=null),w&&w.apply(this,arguments)})}}function s(l){return l&&function(d,f,g){try{return l.call(e,d,f,g)}catch(w){if(!m(w))throw w}}}function a(l){return l&&function(d,f,g){typeof f=="function"&&(g=f,f=null);function w(x,S){S&&(S.uid<0&&(S.uid+=4294967296),S.gid<0&&(S.gid+=4294967296)),g&&g.apply(this,arguments)}return f?l.call(e,d,f,w):l.call(e,d,w)}}function u(l){return l&&function(d,f){var g=f?l.call(e,d,f):l.call(e,d);return g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),g}}function m(l){if(!l||l.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var If=D((vA,Ef)=>{var xf=require("stream").Stream;Ef.exports=Mw;function Mw(e){return{ReadStream:t,WriteStream:r};function t(n,o){if(!(this instanceof t))return new t(n,o);xf.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var s=Object.keys(o),a=0,u=s.length;a<u;a++){var m=s[a];this[m]=o[m]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}e.open(this.path,this.flags,this.mode,function(l,d){if(l){i.emit("error",l),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);xf.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),s=0,a=i.length;s<a;s++){var u=i[s];this[u]=o[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Of=D((wA,Sf)=>{"use strict";Sf.exports=jw;var qw=Object.getPrototypeOf||function(e){return e.__proto__};function jw(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:qw(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var he=D((xA,ia)=>{var se=require("fs"),Lw=wf(),Bw=If(),Uw=Of(),ei=require("util"),Ee,ri;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ee=Symbol.for("graceful-fs.queue"),ri=Symbol.for("graceful-fs.previous")):(Ee="___graceful-fs.queue",ri="___graceful-fs.previous");function zw(){}function Tf(e,t){Object.defineProperty(e,Ee,{get:function(){return t}})}var Jt=zw;ei.debuglog?Jt=ei.debuglog("gfs4"):/\\bgfs4\\b/i.test(process.env.NODE_DEBUG||"")&&(Jt=function(){var e=ei.format.apply(ei,arguments);e="GFS4: "+e.split(/\\n/).join(`\nGFS4: `),console.error(e)});se[Ee]||(Df=global[Ee]||[],Tf(se,Df),se.close=function(e){function t(r,n){return e.call(se,r,function(o){o||_f(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,ri,{value:e}),t}(se.close),se.closeSync=function(e){function t(r){e.apply(se,arguments),_f()}return Object.defineProperty(t,ri,{value:e}),t}(se.closeSync),/\\bgfs4\\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Jt(se[Ee]),require("assert").equal(se[Ee].length,0)}));var Df;global[Ee]||Tf(global,se[Ee]);ia.exports=na(Uw(se));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!se.__patched&&(ia.exports=na(se),se.__patched=!0);function na(e){Lw(e),e.gracefulify=na,e.createReadStream=xe,e.createWriteStream=A;var t=e.readFile;e.readFile=r;function r(F,j,O){return typeof j=="function"&&(O=j,j=null),$(F,j,O);function $(R,U,q,W){return t(R,U,function(K){K&&(K.code==="EMFILE"||K.code==="ENFILE")?Er([$,[R,U,q],K,W||Date.now(),Date.now()]):typeof q=="function"&&q.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=o;function o(F,j,O,$){return typeof O=="function"&&($=O,O=null),R(F,j,O,$);function R(U,q,W,K,X){return n(U,q,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var i=e.appendFile;i&&(e.appendFile=s);function s(F,j,O,$){return typeof O=="function"&&($=O,O=null),R(F,j,O,$);function R(U,q,W,K,X){return i(U,q,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=u);function u(F,j,O,$){return typeof O=="function"&&($=O,O=0),R(F,j,O,$);function R(U,q,W,K,X){return a(U,q,W,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}var m=e.readdir;e.readdir=d;var l=/^v[0-5]\\./;function d(F,j,O){typeof j=="function"&&(O=j,j=null);var $=l.test(process.version)?function(q,W,K,X){return m(q,R(q,W,K,X))}:function(q,W,K,X){return m(q,W,R(q,W,K,X))};return $(F,j,O);function R(U,q,W,K){return function(X,J){X&&(X.code==="EMFILE"||X.code==="ENFILE")?Er([$,[U,q,W],X,K||Date.now(),Date.now()]):(J&&J.sort&&J.sort(),typeof W=="function"&&W.call(this,X,J))}}}if(process.version.substr(0,4)==="v0.8"){var f=Bw(e);N=f.ReadStream,k=f.WriteStream}var g=e.ReadStream;g&&(N.prototype=Object.create(g.prototype),N.prototype.open=M);var w=e.WriteStream;w&&(k.prototype=Object.create(w.prototype),k.prototype.open=ee),Object.defineProperty(e,"ReadStream",{get:function(){return N},set:function(F){N=F},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return k},set:function(F){k=F},enumerable:!0,configurable:!0});var x=N;Object.defineProperty(e,"FileReadStream",{get:function(){return x},set:function(F){x=F},enumerable:!0,configurable:!0});var S=k;Object.defineProperty(e,"FileWriteStream",{get:function(){return S},set:function(F){S=F},enumerable:!0,configurable:!0});function N(F,j){return this instanceof N?(g.apply(this,arguments),this):N.apply(Object.create(N.prototype),arguments)}function M(){var F=this;L(F.path,F.flags,F.mode,function(j,O){j?(F.autoClose&&F.destroy(),F.emit("error",j)):(F.fd=O,F.emit("open",O),F.read())})}function k(F,j){return this instanceof k?(w.apply(this,arguments),this):k.apply(Object.create(k.prototype),arguments)}function ee(){var F=this;L(F.path,F.flags,F.mode,function(j,O){j?(F.destroy(),F.emit("error",j)):(F.fd=O,F.emit("open",O))})}function xe(F,j){return new e.ReadStream(F,j)}function A(F,j){return new e.WriteStream(F,j)}var B=e.open;e.open=L;function L(F,j,O,$){return typeof O=="function"&&($=O,O=null),R(F,j,O,$);function R(U,q,W,K,X){return B(U,q,W,function(J,Zn){J&&(J.code==="EMFILE"||J.code==="ENFILE")?Er([R,[U,q,W,K],J,X||Date.now(),Date.now()]):typeof K=="function"&&K.apply(this,arguments)})}}return e}function Er(e){Jt("ENQUEUE",e[0].name,e[1]),se[Ee].push(e),oa()}var ti;function _f(){for(var e=Date.now(),t=0;t<se[Ee].length;++t)se[Ee][t].length>2&&(se[Ee][t][3]=e,se[Ee][t][4]=e);oa()}function oa(){if(clearTimeout(ti),ti=void 0,se[Ee].length!==0){var e=se[Ee].shift(),t=e[0],r=e[1],n=e[2],o=e[3],i=e[4];if(o===void 0)Jt("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-o>=6e4){Jt("TIMEOUT",t.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-i,u=Math.max(i-o,1),m=Math.min(u*1.2,100);a>=m?(Jt("RETRY",t.name,r),t.apply(null,r.concat([o]))):se[Ee].push(e)}ti===void 0&&(ti=setTimeout(oa,0))}}});var sa=D(Vt=>{"use strict";var Nf=Ce().fromCallback,Ge=he(),Ww=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(e=>typeof Ge[e]=="function");Object.keys(Ge).forEach(e=>{e!=="promises"&&(Vt[e]=Ge[e])});Ww.forEach(e=>{Vt[e]=Nf(Ge[e])});Vt.exists=function(e,t){return typeof t=="function"?Ge.exists(e,t):new Promise(r=>Ge.exists(e,r))};Vt.read=function(e,t,r,n,o,i){return typeof i=="function"?Ge.read(e,t,r,n,o,i):new Promise((s,a)=>{Ge.read(e,t,r,n,o,(u,m,l)=>{if(u)return a(u);s({bytesRead:m,buffer:l})})})};Vt.write=function(e,t,...r){return typeof r[r.length-1]=="function"?Ge.write(e,t,...r):new Promise((n,o)=>{Ge.write(e,t,...r,(i,s,a)=>{if(i)return o(i);n({bytesWritten:s,buffer:a})})})};typeof Ge.realpath.native=="function"&&(Vt.realpath.native=Nf(Ge.realpath.native))});var ua=D((IA,Af)=>{"use strict";var aa=require("path");function Cf(e){return e=aa.normalize(aa.resolve(e)).split(aa.sep),e.length>0?e[0]:null}var Kw=/[<>:"|?*]/;function Gw(e){let t=Cf(e);return e=e.replace(t,""),Kw.test(e)}Af.exports={getRootPath:Cf,invalidWin32Path:Gw}});var Ff=D((SA,Rf)=>{"use strict";var Hw=he(),ca=require("path"),Jw=ua().invalidWin32Path,Vw=parseInt("0777",8);function la(e,t,r,n){if(typeof t=="function"?(r=t,t={}):(!t||typeof t!="object")&&(t={mode:t}),process.platform==="win32"&&Jw(e)){let s=new Error(e+" contains invalid WIN32 path characters.");return s.code="EINVAL",r(s)}let o=t.mode,i=t.fs||Hw;o===void 0&&(o=Vw&~process.umask()),n||(n=null),r=r||function(){},e=ca.resolve(e),i.mkdir(e,o,s=>{if(!s)return n=n||e,r(null,n);switch(s.code){case"ENOENT":if(ca.dirname(e)===e)return r(s);la(ca.dirname(e),t,(a,u)=>{a?r(a,u):la(e,t,r,u)});break;default:i.stat(e,(a,u)=>{a||!u.isDirectory()?r(s,n):r(null,n)});break}})}Rf.exports=la});var Pf=D((OA,$f)=>{"use strict";var Yw=he(),fa=require("path"),Zw=ua().invalidWin32Path,Qw=parseInt("0777",8);function pa(e,t,r){(!t||typeof t!="object")&&(t={mode:t});let n=t.mode,o=t.fs||Yw;if(process.platform==="win32"&&Zw(e)){let i=new Error(e+" contains invalid WIN32 path characters.");throw i.code="EINVAL",i}n===void 0&&(n=Qw&~process.umask()),r||(r=null),e=fa.resolve(e);try{o.mkdirSync(e,n),r=r||e}catch(i){if(i.code==="ENOENT"){if(fa.dirname(e)===e)throw i;r=pa(fa.dirname(e),t,r),pa(e,t,r)}else{let s;try{s=o.statSync(e)}catch{throw i}if(!s.isDirectory())throw i}}return r}$f.exports=pa});var $e=D((DA,kf)=>{"use strict";var Xw=Ce().fromCallback,ma=Xw(Ff()),da=Pf();kf.exports={mkdirs:ma,mkdirsSync:da,mkdirp:ma,mkdirpSync:da,ensureDir:ma,ensureDirSync:da}});var ha=D((_A,qf)=>{"use strict";var Se=he(),Mf=require("os"),ni=require("path");function ex(){let e=ni.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));e=ni.join(Mf.tmpdir(),e);let t=new Date(1435410243862);Se.writeFileSync(e,"https://github.com/jprichardson/node-fs-extra/pull/141");let r=Se.openSync(e,"r+");return Se.futimesSync(r,t,t),Se.closeSync(r),Se.statSync(e).mtime>1435410243e3}function tx(e){let t=ni.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));t=ni.join(Mf.tmpdir(),t);let r=new Date(1435410243862);Se.writeFile(t,"https://github.com/jprichardson/node-fs-extra/pull/141",n=>{if(n)return e(n);Se.open(t,"r+",(o,i)=>{if(o)return e(o);Se.futimes(i,r,r,s=>{if(s)return e(s);Se.close(i,a=>{if(a)return e(a);Se.stat(t,(u,m)=>{if(u)return e(u);e(null,m.mtime>1435410243e3)})})})})})}function rx(e){if(typeof e=="number")return Math.floor(e/1e3)*1e3;if(e instanceof Date)return new Date(Math.floor(e.getTime()/1e3)*1e3);throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")}function nx(e,t,r,n){Se.open(e,"r+",(o,i)=>{if(o)return n(o);Se.futimes(i,t,r,s=>{Se.close(i,a=>{n&&n(s||a)})})})}function ox(e,t,r){let n=Se.openSync(e,"r+");return Se.futimesSync(n,t,r),Se.closeSync(n)}qf.exports={hasMillisRes:tx,hasMillisResSync:ex,timeRemoveMillis:rx,utimesMillis:nx,utimesMillisSync:ox}});var On=D((TA,Wf)=>{"use strict";var He=he(),Ae=require("path"),jf=10,Lf=5,ix=0,ya=process.versions.node.split("."),Bf=Number.parseInt(ya[0],10),Uf=Number.parseInt(ya[1],10),sx=Number.parseInt(ya[2],10);function In(){if(Bf>jf)return!0;if(Bf===jf){if(Uf>Lf)return!0;if(Uf===Lf&&sx>=ix)return!0}return!1}function ax(e,t,r){In()?He.stat(e,{bigint:!0},(n,o)=>{if(n)return r(n);He.stat(t,{bigint:!0},(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))}):He.stat(e,(n,o)=>{if(n)return r(n);He.stat(t,(i,s)=>i?i.code==="ENOENT"?r(null,{srcStat:o,destStat:null}):r(i):r(null,{srcStat:o,destStat:s}))})}function ux(e,t){let r,n;In()?r=He.statSync(e,{bigint:!0}):r=He.statSync(e);try{In()?n=He.statSync(t,{bigint:!0}):n=He.statSync(t)}catch(o){if(o.code==="ENOENT")return{srcStat:r,destStat:null};throw o}return{srcStat:r,destStat:n}}function cx(e,t,r,n){ax(e,t,(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;return a&&a.ino&&a.dev&&a.ino===s.ino&&a.dev===s.dev?n(new Error("Source and destination must not be the same.")):s.isDirectory()&&ba(e,t)?n(new Error(Sn(e,t,r))):n(null,{srcStat:s,destStat:a})})}function lx(e,t,r){let{srcStat:n,destStat:o}=ux(e,t);if(o&&o.ino&&o.dev&&o.ino===n.ino&&o.dev===n.dev)throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&ba(e,t))throw new Error(Sn(e,t,r));return{srcStat:n,destStat:o}}function ga(e,t,r,n,o){let i=Ae.resolve(Ae.dirname(e)),s=Ae.resolve(Ae.dirname(r));if(s===i||s===Ae.parse(s).root)return o();In()?He.stat(s,{bigint:!0},(a,u)=>a?a.code==="ENOENT"?o():o(a):u.ino&&u.dev&&u.ino===t.ino&&u.dev===t.dev?o(new Error(Sn(e,r,n))):ga(e,t,s,n,o)):He.stat(s,(a,u)=>a?a.code==="ENOENT"?o():o(a):u.ino&&u.dev&&u.ino===t.ino&&u.dev===t.dev?o(new Error(Sn(e,r,n))):ga(e,t,s,n,o))}function zf(e,t,r,n){let o=Ae.resolve(Ae.dirname(e)),i=Ae.resolve(Ae.dirname(r));if(i===o||i===Ae.parse(i).root)return;let s;try{In()?s=He.statSync(i,{bigint:!0}):s=He.statSync(i)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.ino&&s.dev&&s.ino===t.ino&&s.dev===t.dev)throw new Error(Sn(e,r,n));return zf(e,t,i,n)}function ba(e,t){let r=Ae.resolve(e).split(Ae.sep).filter(o=>o),n=Ae.resolve(t).split(Ae.sep).filter(o=>o);return r.reduce((o,i,s)=>o&&n[s]===i,!0)}function Sn(e,t,r){return`Cannot ${r} \'${e}\' to a subdirectory of itself, \'${t}\'.`}Wf.exports={checkPaths:cx,checkPathsSync:lx,checkParentPaths:ga,checkParentPathsSync:zf,isSrcSubdir:ba}});var Gf=D((NA,Kf)=>{"use strict";Kf.exports=function(e){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(e)}catch{return new Buffer(e)}return new Buffer(e)}});var Zf=D((CA,Yf)=>{"use strict";var ne=he(),Dn=require("path"),fx=$e().mkdirsSync,px=ha().utimesMillisSync,_n=On();function mx(e,t,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:o}=_n.checkPathsSync(e,t,"copy");return _n.checkParentPathsSync(e,n,t,"copy"),dx(o,e,t,r)}function dx(e,t,r,n){if(n.filter&&!n.filter(t,r))return;let o=Dn.dirname(r);return ne.existsSync(o)||fx(o),Hf(e,t,r,n)}function Hf(e,t,r,n){if(!(n.filter&&!n.filter(t,r)))return hx(e,t,r,n)}function hx(e,t,r,n){let i=(n.dereference?ne.statSync:ne.lstatSync)(t);if(i.isDirectory())return vx(i,e,t,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return gx(i,e,t,r,n);if(i.isSymbolicLink())return Ex(e,t,r,n)}function gx(e,t,r,n,o){return t?yx(e,r,n,o):Jf(e,r,n,o)}function yx(e,t,r,n){if(n.overwrite)return ne.unlinkSync(r),Jf(e,t,r,n);if(n.errorOnExist)throw new Error(`\'${r}\' already exists`)}function Jf(e,t,r,n){return typeof ne.copyFileSync=="function"?(ne.copyFileSync(t,r),ne.chmodSync(r,e.mode),n.preserveTimestamps?px(r,e.atime,e.mtime):void 0):bx(e,t,r,n)}function bx(e,t,r,n){let i=Gf()(65536),s=ne.openSync(t,"r"),a=ne.openSync(r,"w",e.mode),u=0;for(;u<e.size;){let m=ne.readSync(s,i,0,65536,u);ne.writeSync(a,i,0,m),u+=m}n.preserveTimestamps&&ne.futimesSync(a,e.atime,e.mtime),ne.closeSync(s),ne.closeSync(a)}function vx(e,t,r,n,o){if(!t)return wx(e,r,n,o);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory \'${n}\' with directory \'${r}\'.`);return Vf(r,n,o)}function wx(e,t,r,n){return ne.mkdirSync(r),Vf(t,r,n),ne.chmodSync(r,e.mode)}function Vf(e,t,r){ne.readdirSync(e).forEach(n=>xx(n,e,t,r))}function xx(e,t,r,n){let o=Dn.join(t,e),i=Dn.join(r,e),{destStat:s}=_n.checkPathsSync(o,i,"copy");return Hf(s,o,i,n)}function Ex(e,t,r,n){let o=ne.readlinkSync(t);if(n.dereference&&(o=Dn.resolve(process.cwd(),o)),e){let i;try{i=ne.readlinkSync(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return ne.symlinkSync(o,r);throw s}if(n.dereference&&(i=Dn.resolve(process.cwd(),i)),_n.isSrcSubdir(o,i))throw new Error(`Cannot copy \'${o}\' to a subdirectory of itself, \'${i}\'.`);if(ne.statSync(r).isDirectory()&&_n.isSrcSubdir(i,o))throw new Error(`Cannot overwrite \'${i}\' with \'${o}\'.`);return Ix(o,r)}else return ne.symlinkSync(o,r)}function Ix(e,t){return ne.unlinkSync(t),ne.symlinkSync(e,t)}Yf.exports=mx});var va=D((AA,Qf)=>{"use strict";Qf.exports={copySync:Zf()}});var it=D((RA,ep)=>{"use strict";var Sx=Ce().fromPromise,Xf=sa();function Ox(e){return Xf.access(e).then(()=>!0).catch(()=>!1)}ep.exports={pathExists:Sx(Ox),pathExistsSync:Xf.existsSync}});var cp=D((FA,up)=>{"use strict";var Ie=he(),Tn=require("path"),Dx=$e().mkdirs,_x=it().pathExists,Tx=ha().utimesMillis,Nn=On();function Nx(e,t,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269`),Nn.checkPaths(e,t,"copy",(o,i)=>{if(o)return n(o);let{srcStat:s,destStat:a}=i;Nn.checkParentPaths(e,s,t,"copy",u=>u?n(u):r.filter?np(tp,a,e,t,r,n):tp(a,e,t,r,n))})}function tp(e,t,r,n,o){let i=Tn.dirname(r);_x(i,(s,a)=>{if(s)return o(s);if(a)return wa(e,t,r,n,o);Dx(i,u=>u?o(u):wa(e,t,r,n,o))})}function np(e,t,r,n,o,i){Promise.resolve(o.filter(r,n)).then(s=>s?e(t,r,n,o,i):i(),s=>i(s))}function wa(e,t,r,n,o){return n.filter?np(rp,e,t,r,n,o):rp(e,t,r,n,o)}function rp(e,t,r,n,o){(n.dereference?Ie.stat:Ie.lstat)(t,(s,a)=>{if(s)return o(s);if(a.isDirectory())return Fx(a,e,t,r,n,o);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Cx(a,e,t,r,n,o);if(a.isSymbolicLink())return kx(e,t,r,n,o)})}function Cx(e,t,r,n,o,i){return t?Ax(e,r,n,o,i):op(e,r,n,o,i)}function Ax(e,t,r,n,o){if(n.overwrite)Ie.unlink(r,i=>i?o(i):op(e,t,r,n,o));else return n.errorOnExist?o(new Error(`\'${r}\' already exists`)):o()}function op(e,t,r,n,o){return typeof Ie.copyFile=="function"?Ie.copyFile(t,r,i=>i?o(i):ip(e,r,n,o)):Rx(e,t,r,n,o)}function Rx(e,t,r,n,o){let i=Ie.createReadStream(t);i.on("error",s=>o(s)).once("open",()=>{let s=Ie.createWriteStream(r,{mode:e.mode});s.on("error",a=>o(a)).on("open",()=>i.pipe(s)).once("close",()=>ip(e,r,n,o))})}function ip(e,t,r,n){Ie.chmod(t,e.mode,o=>o?n(o):r.preserveTimestamps?Tx(t,e.atime,e.mtime,n):n())}function Fx(e,t,r,n,o,i){return t?t&&!t.isDirectory()?i(new Error(`Cannot overwrite non-directory \'${n}\' with directory \'${r}\'.`)):sp(r,n,o,i):$x(e,r,n,o,i)}function $x(e,t,r,n,o){Ie.mkdir(r,i=>{if(i)return o(i);sp(t,r,n,s=>s?o(s):Ie.chmod(r,e.mode,o))})}function sp(e,t,r,n){Ie.readdir(e,(o,i)=>o?n(o):ap(i,e,t,r,n))}function ap(e,t,r,n,o){let i=e.pop();return i?Px(e,i,t,r,n,o):o()}function Px(e,t,r,n,o,i){let s=Tn.join(r,t),a=Tn.join(n,t);Nn.checkPaths(s,a,"copy",(u,m)=>{if(u)return i(u);let{destStat:l}=m;wa(l,s,a,o,d=>d?i(d):ap(e,r,n,o,i))})}function kx(e,t,r,n,o){Ie.readlink(t,(i,s)=>{if(i)return o(i);if(n.dereference&&(s=Tn.resolve(process.cwd(),s)),e)Ie.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Ie.symlink(s,r,o):o(a):(n.dereference&&(u=Tn.resolve(process.cwd(),u)),Nn.isSrcSubdir(s,u)?o(new Error(`Cannot copy \'${s}\' to a subdirectory of itself, \'${u}\'.`)):e.isDirectory()&&Nn.isSrcSubdir(u,s)?o(new Error(`Cannot overwrite \'${u}\' with \'${s}\'.`)):Mx(s,r,o)));else return Ie.symlink(s,r,o)})}function Mx(e,t,r){Ie.unlink(t,n=>n?r(n):Ie.symlink(e,t,r))}up.exports=Nx});var xa=D(($A,lp)=>{"use strict";var qx=Ce().fromCallback;lp.exports={copy:qx(cp())}});var vp=D((PA,bp)=>{"use strict";var fp=he(),hp=require("path"),G=require("assert"),Cn=process.platform==="win32";function gp(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{e[r]=e[r]||fp[r],r=r+"Sync",e[r]=e[r]||fp[r]}),e.maxBusyTries=e.maxBusyTries||3}function Ea(e,t,r){let n=0;typeof t=="function"&&(r=t,t={}),G(e,"rimraf: missing path"),G.strictEqual(typeof e,"string","rimraf: path should be a string"),G.strictEqual(typeof r,"function","rimraf: callback function required"),G(t,"rimraf: invalid options argument provided"),G.strictEqual(typeof t,"object","rimraf: options should be object"),gp(t),pp(e,t,function o(i){if(i){if((i.code==="EBUSY"||i.code==="ENOTEMPTY"||i.code==="EPERM")&&n<t.maxBusyTries){n++;let s=n*100;return setTimeout(()=>pp(e,t,o),s)}i.code==="ENOENT"&&(i=null)}r(i)})}function pp(e,t,r){G(e),G(t),G(typeof r=="function"),t.lstat(e,(n,o)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Cn)return mp(e,t,n,r);if(o&&o.isDirectory())return oi(e,t,n,r);t.unlink(e,i=>{if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return Cn?mp(e,t,i,r):oi(e,t,i,r);if(i.code==="EISDIR")return oi(e,t,i,r)}return r(i)})})}function mp(e,t,r,n){G(e),G(t),G(typeof n=="function"),r&&G(r instanceof Error),t.chmod(e,438,o=>{o?n(o.code==="ENOENT"?null:r):t.stat(e,(i,s)=>{i?n(i.code==="ENOENT"?null:r):s.isDirectory()?oi(e,t,r,n):t.unlink(e,n)})})}function dp(e,t,r){let n;G(e),G(t),r&&G(r instanceof Error);try{t.chmodSync(e,438)}catch(o){if(o.code==="ENOENT")return;throw r}try{n=t.statSync(e)}catch(o){if(o.code==="ENOENT")return;throw r}n.isDirectory()?ii(e,t,r):t.unlinkSync(e)}function oi(e,t,r,n){G(e),G(t),r&&G(r instanceof Error),G(typeof n=="function"),t.rmdir(e,o=>{o&&(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM")?jx(e,t,n):o&&o.code==="ENOTDIR"?n(r):n(o)})}function jx(e,t,r){G(e),G(t),G(typeof r=="function"),t.readdir(e,(n,o)=>{if(n)return r(n);let i=o.length,s;if(i===0)return t.rmdir(e,r);o.forEach(a=>{Ea(hp.join(e,a),t,u=>{if(!s){if(u)return r(s=u);--i===0&&t.rmdir(e,r)}})})})}function yp(e,t){let r;t=t||{},gp(t),G(e,"rimraf: missing path"),G.strictEqual(typeof e,"string","rimraf: path should be a string"),G(t,"rimraf: missing options"),G.strictEqual(typeof t,"object","rimraf: options should be object");try{r=t.lstatSync(e)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Cn&&dp(e,t,n)}try{r&&r.isDirectory()?ii(e,t,null):t.unlinkSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Cn?dp(e,t,n):ii(e,t,n);if(n.code!=="EISDIR")throw n;ii(e,t,n)}}function ii(e,t,r){G(e),G(t),r&&G(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")Lx(e,t);else if(n.code!=="ENOENT")throw n}}function Lx(e,t){if(G(e),G(t),t.readdirSync(e).forEach(r=>yp(hp.join(e,r),t)),Cn){let r=Date.now();do try{return t.rmdirSync(e,t)}catch{}while(Date.now()-r<500)}else return t.rmdirSync(e,t)}bp.exports=Ea;Ea.sync=yp});var An=D((kA,xp)=>{"use strict";var Bx=Ce().fromCallback,wp=vp();xp.exports={remove:Bx(wp),removeSync:wp.sync}});var Np=D((MA,Tp)=>{"use strict";var Ux=Ce().fromCallback,Sp=he(),Op=require("path"),Dp=$e(),_p=An(),Ep=Ux(function(t,r){r=r||function(){},Sp.readdir(t,(n,o)=>{if(n)return Dp.mkdirs(t,r);o=o.map(s=>Op.join(t,s)),i();function i(){let s=o.pop();if(!s)return r();_p.remove(s,a=>{if(a)return r(a);i()})}})});function Ip(e){let t;try{t=Sp.readdirSync(e)}catch{return Dp.mkdirsSync(e)}t.forEach(r=>{r=Op.join(e,r),_p.removeSync(r)})}Tp.exports={emptyDirSync:Ip,emptydirSync:Ip,emptyDir:Ep,emptydir:Ep}});var Fp=D((qA,Rp)=>{"use strict";var zx=Ce().fromCallback,Cp=require("path"),Rn=he(),Ap=$e(),Wx=it().pathExists;function Kx(e,t){function r(){Rn.writeFile(e,"",n=>{if(n)return t(n);t()})}Rn.stat(e,(n,o)=>{if(!n&&o.isFile())return t();let i=Cp.dirname(e);Wx(i,(s,a)=>{if(s)return t(s);if(a)return r();Ap.mkdirs(i,u=>{if(u)return t(u);r()})})})}function Gx(e){let t;try{t=Rn.statSync(e)}catch{}if(t&&t.isFile())return;let r=Cp.dirname(e);Rn.existsSync(r)||Ap.mkdirsSync(r),Rn.writeFileSync(e,"")}Rp.exports={createFile:zx(Kx),createFileSync:Gx}});var qp=D((jA,Mp)=>{"use strict";var Hx=Ce().fromCallback,Pp=require("path"),Yt=he(),kp=$e(),$p=it().pathExists;function Jx(e,t,r){function n(o,i){Yt.link(o,i,s=>{if(s)return r(s);r(null)})}$p(t,(o,i)=>{if(o)return r(o);if(i)return r(null);Yt.lstat(e,s=>{if(s)return s.message=s.message.replace("lstat","ensureLink"),r(s);let a=Pp.dirname(t);$p(a,(u,m)=>{if(u)return r(u);if(m)return n(e,t);kp.mkdirs(a,l=>{if(l)return r(l);n(e,t)})})})})}function Vx(e,t){if(Yt.existsSync(t))return;try{Yt.lstatSync(e)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=Pp.dirname(t);return Yt.existsSync(n)||kp.mkdirsSync(n),Yt.linkSync(e,t)}Mp.exports={createLink:Hx(Jx),createLinkSync:Vx}});var Lp=D((LA,jp)=>{"use strict";var Ct=require("path"),Fn=he(),Yx=it().pathExists;function Zx(e,t,r){if(Ct.isAbsolute(e))return Fn.lstat(e,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:e,toDst:e}));{let n=Ct.dirname(t),o=Ct.join(n,e);return Yx(o,(i,s)=>i?r(i):s?r(null,{toCwd:o,toDst:e}):Fn.lstat(e,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:e,toDst:Ct.relative(n,e)})))}}function Qx(e,t){let r;if(Ct.isAbsolute(e)){if(r=Fn.existsSync(e),!r)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{let n=Ct.dirname(t),o=Ct.join(n,e);if(r=Fn.existsSync(o),r)return{toCwd:o,toDst:e};if(r=Fn.existsSync(e),!r)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Ct.relative(n,e)}}}jp.exports={symlinkPaths:Zx,symlinkPathsSync:Qx}});var zp=D((BA,Up)=>{"use strict";var Bp=he();function Xx(e,t,r){if(r=typeof t=="function"?t:r,t=typeof t=="function"?!1:t,t)return r(null,t);Bp.lstat(e,(n,o)=>{if(n)return r(null,"file");t=o&&o.isDirectory()?"dir":"file",r(null,t)})}function e0(e,t){let r;if(t)return t;try{r=Bp.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}Up.exports={symlinkType:Xx,symlinkTypeSync:e0}});var Yp=D((UA,Vp)=>{"use strict";var t0=Ce().fromCallback,Kp=require("path"),Ir=he(),Gp=$e(),r0=Gp.mkdirs,n0=Gp.mkdirsSync,Hp=Lp(),o0=Hp.symlinkPaths,i0=Hp.symlinkPathsSync,Jp=zp(),s0=Jp.symlinkType,a0=Jp.symlinkTypeSync,Wp=it().pathExists;function u0(e,t,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,Wp(t,(o,i)=>{if(o)return n(o);if(i)return n(null);o0(e,t,(s,a)=>{if(s)return n(s);e=a.toDst,s0(a.toCwd,r,(u,m)=>{if(u)return n(u);let l=Kp.dirname(t);Wp(l,(d,f)=>{if(d)return n(d);if(f)return Ir.symlink(e,t,m,n);r0(l,g=>{if(g)return n(g);Ir.symlink(e,t,m,n)})})})})})}function c0(e,t,r){if(Ir.existsSync(t))return;let o=i0(e,t);e=o.toDst,r=a0(o.toCwd,r);let i=Kp.dirname(t);return Ir.existsSync(i)||n0(i),Ir.symlinkSync(e,t,r)}Vp.exports={createSymlink:t0(u0),createSymlinkSync:c0}});var Qp=D((zA,Zp)=>{"use strict";var si=Fp(),ai=qp(),ui=Yp();Zp.exports={createFile:si.createFile,createFileSync:si.createFileSync,ensureFile:si.createFile,ensureFileSync:si.createFileSync,createLink:ai.createLink,createLinkSync:ai.createLinkSync,ensureLink:ai.createLink,ensureLinkSync:ai.createLinkSync,createSymlink:ui.createSymlink,createSymlinkSync:ui.createSymlinkSync,ensureSymlink:ui.createSymlink,ensureSymlinkSync:ui.createSymlinkSync}});var rm=D((WA,tm)=>{var Sr;try{Sr=he()}catch{Sr=require("fs")}function l0(e,t,r){r==null&&(r=t,t={}),typeof t=="string"&&(t={encoding:t}),t=t||{};var n=t.fs||Sr,o=!0;"throws"in t&&(o=t.throws),n.readFile(e,t,function(i,s){if(i)return r(i);s=em(s);var a;try{a=JSON.parse(s,t?t.reviver:null)}catch(u){return o?(u.message=e+": "+u.message,r(u)):r(null,null)}r(null,a)})}function f0(e,t){t=t||{},typeof t=="string"&&(t={encoding:t});var r=t.fs||Sr,n=!0;"throws"in t&&(n=t.throws);try{var o=r.readFileSync(e,t);return o=em(o),JSON.parse(o,t.reviver)}catch(i){if(n)throw i.message=e+": "+i.message,i;return null}}function Xp(e,t){var r,n=`\n`;typeof t=="object"&&t!==null&&(t.spaces&&(r=t.spaces),t.EOL&&(n=t.EOL));var o=JSON.stringify(e,t?t.replacer:null,r);return o.replace(/\\n/g,n)+n}function p0(e,t,r,n){n==null&&(n=r,r={}),r=r||{};var o=r.fs||Sr,i="";try{i=Xp(t,r)}catch(s){n&&n(s,null);return}o.writeFile(e,i,r,n)}function m0(e,t,r){r=r||{};var n=r.fs||Sr,o=Xp(t,r);return n.writeFileSync(e,o,r)}function em(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\\uFEFF/,""),e}var d0={readFile:l0,readFileSync:f0,writeFile:p0,writeFileSync:m0};tm.exports=d0});var li=D((KA,om)=>{"use strict";var nm=Ce().fromCallback,ci=rm();om.exports={readJson:nm(ci.readFile),readJsonSync:ci.readFileSync,writeJson:nm(ci.writeFile),writeJsonSync:ci.writeFileSync}});var am=D((GA,sm)=>{"use strict";var h0=require("path"),g0=$e(),y0=it().pathExists,im=li();function b0(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=h0.dirname(e);y0(o,(i,s)=>{if(i)return n(i);if(s)return im.writeJson(e,t,r,n);g0.mkdirs(o,a=>{if(a)return n(a);im.writeJson(e,t,r,n)})})}sm.exports=b0});var cm=D((HA,um)=>{"use strict";var v0=he(),w0=require("path"),x0=$e(),E0=li();function I0(e,t,r){let n=w0.dirname(e);v0.existsSync(n)||x0.mkdirsSync(n),E0.writeJsonSync(e,t,r)}um.exports=I0});var fm=D((JA,lm)=>{"use strict";var S0=Ce().fromCallback,De=li();De.outputJson=S0(am());De.outputJsonSync=cm();De.outputJSON=De.outputJson;De.outputJSONSync=De.outputJsonSync;De.writeJSON=De.writeJson;De.writeJSONSync=De.writeJsonSync;De.readJSON=De.readJson;De.readJSONSync=De.readJsonSync;lm.exports=De});var ym=D((VA,gm)=>{"use strict";var dm=he(),O0=require("path"),D0=va().copySync,hm=An().removeSync,_0=$e().mkdirpSync,pm=On();function T0(e,t,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o}=pm.checkPathsSync(e,t,"move");return pm.checkParentPathsSync(e,o,t,"move"),_0(O0.dirname(t)),N0(e,t,n)}function N0(e,t,r){if(r)return hm(t),mm(e,t,r);if(dm.existsSync(t))throw new Error("dest already exists.");return mm(e,t,r)}function mm(e,t,r){try{dm.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return C0(e,t,r)}}function C0(e,t,r){return D0(e,t,{overwrite:r,errorOnExist:!0}),hm(e)}gm.exports=T0});var vm=D((YA,bm)=>{"use strict";bm.exports={moveSync:ym()}});var Sm=D((ZA,Im)=>{"use strict";var A0=he(),R0=require("path"),F0=xa().copy,Em=An().remove,$0=$e().mkdirp,P0=it().pathExists,wm=On();function k0(e,t,r,n){typeof r=="function"&&(n=r,r={});let o=r.overwrite||r.clobber||!1;wm.checkPaths(e,t,"move",(i,s)=>{if(i)return n(i);let{srcStat:a}=s;wm.checkParentPaths(e,a,t,"move",u=>{if(u)return n(u);$0(R0.dirname(t),m=>m?n(m):M0(e,t,o,n))})})}function M0(e,t,r,n){if(r)return Em(t,o=>o?n(o):xm(e,t,r,n));P0(t,(o,i)=>o?n(o):i?n(new Error("dest already exists.")):xm(e,t,r,n))}function xm(e,t,r,n){A0.rename(e,t,o=>o?o.code!=="EXDEV"?n(o):q0(e,t,r,n):n())}function q0(e,t,r,n){F0(e,t,{overwrite:r,errorOnExist:!0},i=>i?n(i):Em(e,n))}Im.exports=k0});var Dm=D((QA,Om)=>{"use strict";var j0=Ce().fromCallback;Om.exports={move:j0(Sm())}});var Cm=D((XA,Nm)=>{"use strict";var L0=Ce().fromCallback,$n=he(),_m=require("path"),Tm=$e(),B0=it().pathExists;function U0(e,t,r,n){typeof r=="function"&&(n=r,r="utf8");let o=_m.dirname(e);B0(o,(i,s)=>{if(i)return n(i);if(s)return $n.writeFile(e,t,r,n);Tm.mkdirs(o,a=>{if(a)return n(a);$n.writeFile(e,t,r,n)})})}function z0(e,...t){let r=_m.dirname(e);if($n.existsSync(r))return $n.writeFileSync(e,...t);Tm.mkdirsSync(r),$n.writeFileSync(e,...t)}Nm.exports={outputFile:L0(U0),outputFileSync:z0}});var Sa=D((eR,Ia)=>{"use strict";Ia.exports=Object.assign({},sa(),va(),xa(),Np(),Qp(),fm(),$e(),vm(),Dm(),Cm(),it(),An());var Am=require("fs");Object.getOwnPropertyDescriptor(Am,"promises")&&Object.defineProperty(Ia.exports,"promises",{get(){return Am.promises}})});var Fm=D((tR,Rm)=>{Rm.exports=()=>new Date});var Pm=D((rR,$m)=>{var W0=we()("streamroller:fileNameFormatter"),K0=require("path"),G0=".gz",H0=".";$m.exports=({file:e,keepFileExt:t,needsIndex:r,alwaysIncludeDate:n,compress:o,fileNameSep:i})=>{let s=i||H0,a=K0.join(e.dir,e.name),u=g=>g+e.ext,m=(g,w,x)=>(r||!x)&&w?g+s+w:g,l=(g,w,x)=>(w>0||n)&&x?g+s+x:g,d=(g,w)=>w&&o?g+G0:g,f=t?[l,m,u,d]:[u,l,m,d];return({date:g,index:w})=>(W0(`_formatFileName: date=${g}, index=${w}`),f.reduce((x,S)=>S(x,w,g),a))}});var jm=D((nR,qm)=>{var Zt=we()("streamroller:fileNameParser"),km=".gz",Mm=Jo(),J0=".";qm.exports=({file:e,keepFileExt:t,pattern:r,fileNameSep:n})=>{let o=n||J0,i=(f,g)=>f.endsWith(km)?(Zt("it is gzipped"),g.isCompressed=!0,f.slice(0,-1*km.length)):f,s="__NOT_MATCHING__",d=[i,t?f=>f.startsWith(e.name)&&f.endsWith(e.ext)?(Zt("it starts and ends with the right things"),f.slice(e.name.length+1,-1*e.ext.length)):s:f=>f.startsWith(e.base)?(Zt("it starts with the right things"),f.slice(e.base.length+1)):s,r?(f,g)=>{let w=f.split(o),x=w[w.length-1];Zt("items: ",w,", indexStr: ",x);let S=f;x!==void 0&&x.match(/^\\d+$/)?(S=f.slice(0,-1*(x.length+1)),Zt(`dateStr is ${S}`),r&&!S&&(S=x,x="0")):x="0";try{let N=Mm.parse(r,S,new Date(0,0));return Mm.asString(r,N)!==S?f:(g.index=parseInt(x,10),g.date=S,g.timestamp=N.getTime(),"")}catch(N){return Zt(`Problem parsing ${S} as ${r}, error was: `,N),f}}:(f,g)=>f.match(/^\\d+$/)?(Zt("it has an index"),g.index=parseInt(f,10),""):f];return f=>{let g={filename:f,index:0,isCompressed:!1};return d.reduce((x,S)=>S(x,g),f)?null:g}}});var Bm=D((oR,Lm)=>{var Re=we()("streamroller:moveAndMaybeCompressFile"),gt=Sa(),V0=require("zlib"),Y0=function(e){let t={mode:parseInt("0600",8),compress:!1},r=Object.assign({},t,e);return Re(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(r)}`),r},Z0=async(e,t,r)=>{if(r=Y0(r),e===t){Re("moveAndMaybeCompressFile: source and target are the same, not doing anything");return}if(await gt.pathExists(e))if(Re(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${r.compress?"with":"without"} compress`),r.compress)await new Promise((n,o)=>{let i=!1,s=gt.createWriteStream(t,{mode:r.mode,flags:"wx"}).on("open",()=>{i=!0;let a=gt.createReadStream(e).on("open",()=>{a.pipe(V0.createGzip()).pipe(s)}).on("error",u=>{Re(`moveAndMaybeCompressFile: error reading ${e}`,u),s.destroy(u)})}).on("finish",()=>{Re(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),gt.unlink(e).then(n).catch(a=>{Re(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,a),gt.truncate(e).then(n).catch(u=>{Re(`moveAndMaybeCompressFile: error truncating ${e}`,u),o(u)})})}).on("error",a=>{i?(Re(`moveAndMaybeCompressFile: error writing ${t}, deleting`,a),gt.unlink(t).then(()=>{o(a)}).catch(u=>{Re(`moveAndMaybeCompressFile: error deleting ${t}`,u),o(u)})):(Re(`moveAndMaybeCompressFile: error creating ${t}`,a),o(a))})}).catch(()=>{});else{Re(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await gt.move(e,t,{overwrite:!0})}catch(n){if(Re(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),n.code!=="ENOENT"){Re("moveAndMaybeCompressFile: trying copy+truncate instead");try{await gt.copy(e,t,{overwrite:!0}),await gt.truncate(e)}catch(o){Re("moveAndMaybeCompressFile: error copy+truncate",o)}}}}};Lm.exports=Z0});var mi=D((iR,Um)=>{var Pe=we()("streamroller:RollingFileWriteStream"),Xt=Sa(),Qt=require("path"),Q0=require("os"),fi=Fm(),pi=Jo(),{Writable:X0}=require("stream"),eE=Pm(),tE=jm(),rE=Bm(),nE=e=>(Pe(`deleteFiles: files to delete: ${e}`),Promise.all(e.map(t=>Xt.unlink(t).catch(r=>{Pe(`deleteFiles: error when unlinking ${t}, ignoring. Error was ${r}`)})))),Oa=class extends X0{constructor(t,r){if(Pe(`constructor: creating RollingFileWriteStream. path=${t}`),typeof t!="string"||t.length===0)throw new Error(`Invalid filename: ${t}`);if(t.endsWith(Qt.sep))throw new Error(`Filename is a directory: ${t}`);t.indexOf(`~${Qt.sep}`)===0&&(t=t.replace("~",Q0.homedir())),super(r),this.options=this._parseOption(r),this.fileObject=Qt.parse(t),this.fileObject.dir===""&&(this.fileObject=Qt.parse(Qt.join(process.cwd(),t))),this.fileFormatter=eE({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize<Number.MAX_SAFE_INTEGER,compress:this.options.compress,keepFileExt:this.options.keepFileExt,fileNameSep:this.options.fileNameSep}),this.fileNameParser=tE({file:this.fileObject,keepFileExt:this.options.keepFileExt,pattern:this.options.pattern,fileNameSep:this.options.fileNameSep}),this.state={currentSize:0},this.options.pattern&&(this.state.currentDate=pi(this.options.pattern,fi())),this.filename=this.fileFormatter({index:0,date:this.state.currentDate}),["a","a+","as","as+"].includes(this.options.flags)&&this._setExistingSizeAndDate(),Pe(`constructor: create new file ${this.filename}, state=${JSON.stringify(this.state)}`),this._renewWriteStream()}_setExistingSizeAndDate(){try{let t=Xt.statSync(this.filename);this.state.currentSize=t.size,this.options.pattern&&(this.state.currentDate=pi(this.options.pattern,t.mtime))}catch{return}}_parseOption(t){let r={maxSize:0,numToKeep:Number.MAX_SAFE_INTEGER,encoding:"utf8",mode:parseInt("0600",8),flags:"a",compress:!1,keepFileExt:!1,alwaysIncludePattern:!1},n=Object.assign({},r,t);if(!n.maxSize)delete n.maxSize;else if(n.maxSize<=0)throw new Error(`options.maxSize (${n.maxSize}) should be > 0`);if(n.numBackups||n.numBackups===0){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return Pe(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(t){this.currentFileStream.end("",this.options.encoding,t)}_write(t,r,n){this._shouldRoll().then(()=>{Pe(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${t}`),this.currentFileStream.write(t,r,o=>{this.state.currentSize+=t.length,n(o)})})}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(Pe(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==pi(this.options.pattern,fi())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return Pe("_roll: closing the current stream"),new Promise((t,r)=>{this.currentFileStream.end("",this.options.encoding,()=>{this._moveOldFiles().then(t).catch(r)})})}async _moveOldFiles(){let t=await this._getExistingFiles(),r=this.state.currentDate?t.filter(n=>n.date===this.state.currentDate):t;for(let n=r.length;n>=0;n--){Pe(`_moveOldFiles: i = ${n}`);let o=this.fileFormatter({date:this.state.currentDate,index:n}),i=this.fileFormatter({date:this.state.currentDate,index:n+1}),s={compress:this.options.compress&&n===0,mode:this.options.mode};await rE(o,i,s)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?pi(this.options.pattern,fi()):null,Pe(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise((n,o)=>{this.currentFileStream.write("","utf8",()=>{this._clean().then(n).catch(o)})})}async _getExistingFiles(){let t=await Xt.readdir(this.fileObject.dir).catch(()=>[]);Pe(`_getExistingFiles: files=${t}`);let r=t.map(o=>this.fileNameParser(o)).filter(o=>o),n=o=>(o.timestamp?o.timestamp:fi().getTime())-o.index;return r.sort((o,i)=>n(o)-n(i)),r}_renewWriteStream(){let t=this.fileFormatter({date:this.state.currentDate,index:0}),r=i=>{try{return Xt.mkdirSync(i,{recursive:!0})}catch(s){if(s.code==="ENOENT")return r(Qt.dirname(i)),r(i);if(s.code!=="EEXIST"&&s.code!=="EROFS")throw s;try{if(Xt.statSync(i).isDirectory())return i;throw s}catch{throw s}}};r(this.fileObject.dir);let n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode},o=function(i,s,a){return i[a]=i[s],delete i[s],i};Xt.appendFileSync(t,"",o({...n},"flags","flag")),this.currentFileStream=Xt.createWriteStream(t,n),this.currentFileStream.on("error",i=>{this.emit("error",i)})}async _clean(){let t=await this._getExistingFiles();if(Pe(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${t.length}`),Pe("_clean: existing files are: ",t),this._tooManyFiles(t.length)){let r=t.slice(0,t.length-this.options.numToKeep).map(n=>Qt.format({dir:this.fileObject.dir,base:n.filename}));await nE(r)}}_tooManyFiles(t){return this.options.numToKeep>0&&t>this.options.numToKeep}};Um.exports=Oa});var Wm=D((sR,zm)=>{var oE=mi(),Da=class extends oE{constructor(t,r,n,o){o||(o={}),r&&(o.maxSize=r),!o.numBackups&&o.numBackups!==0&&(!n&&n!==0&&(n=1),o.numBackups=n),super(t,o),this.backups=o.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};zm.exports=Da});var Gm=D((aR,Km)=>{var iE=mi(),_a=class extends iE{constructor(t,r,n){r&&typeof r=="object"&&(n=r,r=null),n||(n={}),r||(r="yyyy-MM-dd"),n.pattern=r,!n.numBackups&&n.numBackups!==0?(!n.daysToKeep&&n.daysToKeep!==0?n.daysToKeep=1:process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"),n.numBackups=n.daysToKeep):n.daysToKeep=n.numBackups,super(t,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}};Km.exports=_a});var Ta=D((uR,Hm)=>{Hm.exports={RollingFileWriteStream:mi(),RollingFileStream:Wm(),DateRollingFileStream:Gm()}});var Qm=D((cR,Zm)=>{var Jm=we()("log4js:file"),Na=require("path"),sE=Ta(),Ym=require("os"),aE=Ym.EOL,di=!1,hi=new Set;function Vm(){hi.forEach(e=>{e.sighupHandler()})}function uE(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Na.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${Na.sep}.+)`),Ym.homedir()),e=Na.normalize(e),n=!n&&n!==0?5:n,Jm("Creating file appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(m,l,d,f){let g=new sE.RollingFileStream(m,l,d,f);return g.on("error",w=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",m,w)}),g.on("drain",()=>{process.emit("log4js:pause",!1)}),g}let a=s(e,r,n,o),u=function(m){if(a.writable){if(o.removeColor===!0){let l=/\\x1b[[0-9;]*m/g;m.data=m.data.map(d=>typeof d=="string"?d.replace(l,""):d)}a.write(t(m,i)+aE,"utf8")||process.emit("log4js:pause",!0)}};return u.reopen=function(){a.end(()=>{a=s(e,r,n,o)})},u.sighupHandler=function(){Jm("SIGHUP handler called."),u.reopen()},u.shutdown=function(m){hi.delete(u),hi.size===0&&di&&(process.removeListener("SIGHUP",Vm),di=!1),a.end("","utf-8",m)},hi.add(u),di||(process.on("SIGHUP",Vm),di=!0),u}function cE(e,t){let r=t.basicLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,uE(e.filename,r,e.maxLogSize,e.backups,e,e.timezoneOffset)}Zm.exports.configure=cE});var ed=D((lR,Xm)=>{var lE=Ta(),fE=require("os"),pE=fE.EOL;function mE(e,t,r){let n=new lE.DateRollingFileStream(e,t,r);return n.on("error",o=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,o)}),n.on("drain",()=>{process.emit("log4js:pause",!1)}),n}function dE(e,t,r,n,o){n.maxSize=n.maxLogSize;let i=mE(e,t,n),s=function(a){i.writable&&(i.write(r(a,o)+pE,"utf8")||process.emit("log4js:pause",!0))};return s.shutdown=function(a){i.end("","utf-8",a)},s}function hE(e,t){let r=t.basicLayout;return e.layout&&(r=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,dE(e.filename,e.pattern,r,e,e.timezoneOffset)}Xm.exports.configure=hE});var od=D((fR,nd)=>{var yt=we()("log4js:fileSync"),at=require("path"),st=require("fs"),td=require("os"),gE=td.EOL;function rd(e,t){let r=n=>{try{return st.mkdirSync(n,{recursive:!0})}catch(o){if(o.code==="ENOENT")return r(at.dirname(n)),r(n);if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(st.statSync(n).isDirectory())return n;throw o}catch{throw o}}};r(at.dirname(e)),st.appendFileSync(e,"",{mode:t.mode,flag:t.flags})}var Ca=class{constructor(t,r,n,o){if(yt("In RollingFileStream"),r<0)throw new Error(`maxLogSize (${r}) should be > 0`);this.filename=t,this.size=r,this.backups=n,this.options=o,this.currentSize=0;function i(s){let a=0;try{a=st.statSync(s).size}catch{rd(s,o)}return a}this.currentSize=i(this.filename)}shouldRoll(){return yt("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(t){let r=this,n=new RegExp(`^${at.basename(t)}`);function o(m){return n.test(m)}function i(m){return parseInt(m.slice(`${at.basename(t)}.`.length),10)||0}function s(m,l){return i(m)-i(l)}function a(m){let l=i(m);if(yt(`Index of ${m} is ${l}`),r.backups===0)st.truncateSync(t,0);else if(l<r.backups){try{st.unlinkSync(`${t}.${l+1}`)}catch{}yt(`Renaming ${m} -> ${t}.${l+1}`),st.renameSync(at.join(at.dirname(t),m),`${t}.${l+1}`)}}function u(){yt("Renaming the old files"),st.readdirSync(at.dirname(t)).filter(o).sort(s).reverse().forEach(a)}yt("Rolling, rolling, rolling"),u()}write(t,r){let n=this;function o(){yt("writing the chunk to the file"),n.currentSize+=t.length,st.appendFileSync(n.filename,t)}yt("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),o()}};function yE(e,t,r,n,o,i){if(typeof e!="string"||e.length===0)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(at.sep))throw new Error(`Filename is a directory: ${e}`);e=e.replace(new RegExp(`^~(?=${at.sep}.+)`),td.homedir()),e=at.normalize(e),n=!n&&n!==0?5:n,yt("Creating fileSync appender (",e,", ",r,", ",n,", ",o,", ",i,")");function s(u,m,l){let d;return m?d=new Ca(u,m,l,o):d=(f=>(rd(f,o),{write(g){st.appendFileSync(f,g)}}))(u),d}let a=s(e,r,n);return u=>{a.write(t(u,i)+gE)}}function bE(e,t){let r=t.basicLayout;e.layout&&(r=t.layout(e.layout.type,e.layout));let n={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return yE(e.filename,r,e.maxLogSize,e.backups,n,e.timezoneOffset)}nd.exports.configure=bE});var sd=D((pR,id)=>{var ut=we()("log4js:tcp"),vE=require("net");function wE(e,t){let r=!1,n=[],o,i=3,s="__LOG4JS__";function a(d){ut("Writing log event to socket"),r=o.write(`${t(d)}${s}`,"utf8")}function u(){let d;for(ut("emptying buffer");d=n.shift();)a(d)}function m(){ut(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),s=`${e.endMsg||"__LOG4JS__"}`,o=vE.createConnection(e.port||5e3,e.host||"localhost"),o.on("connect",()=>{ut("socket connected"),u(),r=!0}),o.on("drain",()=>{ut("drain event received, emptying buffer"),r=!0,u()}),o.on("timeout",o.end.bind(o)),o.on("error",d=>{ut("connection error",d),r=!1,u()}),o.on("close",m)}m();function l(d){r?a(d):(ut("buffering log event because it cannot write at the moment"),n.push(d))}return l.shutdown=function(d){ut("shutdown called"),n.length&&i?(ut("buffer has items, waiting 100ms to empty"),i-=1,setTimeout(()=>{l.shutdown(d)},100)):(o.removeAllListeners("close"),o.end(d))},l}function xE(e,t){ut(`configure with config = ${e}`);let r=function(n){return n.serialise()};return e.layout&&(r=t.layout(e.layout.type,e.layout)),wE(e,r)}id.exports.configure=xE});var Fa=D((mR,Ra)=>{var Aa=require("path"),At=we()("log4js:appenders"),Je=Kt(),ad=Qo(),EE=Ht(),IE=Ys(),SE=nf(),Qe=new Map;Qe.set("console",sf());Qe.set("stdout",uf());Qe.set("stderr",lf());Qe.set("logLevelFilter",pf());Qe.set("categoryFilter",hf());Qe.set("noLogFilter",bf());Qe.set("file",Qm());Qe.set("dateFile",ed());Qe.set("fileSync",od());Qe.set("tcp",sd());var Pn=new Map,gi=(e,t)=>{let r;try{let n=`${e}.cjs`;r=require.resolve(n),At("Loading module from ",n)}catch{r=e,At("Loading module from ",e)}try{return require(r)}catch(n){Je.throwExceptionIf(t,n.code!=="MODULE_NOT_FOUND",`appender "${e}" could not be loaded (error was: ${n})`);return}},OE=(e,t)=>Qe.get(e)||gi(`./${e}`,t)||gi(e,t)||require.main&&require.main.filename&&gi(Aa.join(Aa.dirname(require.main.filename),e),t)||gi(Aa.join(process.cwd(),e),t),yi=new Set,ud=(e,t)=>{if(Pn.has(e))return Pn.get(e);if(!t.appenders[e])return!1;if(yi.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);yi.add(e),At(`Creating appender ${e}`);let r=DE(e,t);return yi.delete(e),Pn.set(e,r),r},DE=(e,t)=>{let r=t.appenders[e],n=r.type.configure?r.type:OE(r.type,t);return Je.throwExceptionIf(t,Je.not(n),`appender "${e}" is not valid (type "${r.type}" could not be found)`),n.appender&&(process.emitWarning(`Appender ${r.type} exports an appender function.`,"DeprecationWarning","log4js-node-DEP0001"),At("[log4js-node-DEP0001]",`DEPRECATION: Appender ${r.type} exports an appender function.`)),n.shutdown&&(process.emitWarning(`Appender ${r.type} exports a shutdown function.`,"DeprecationWarning","log4js-node-DEP0002"),At("[log4js-node-DEP0002]",`DEPRECATION: Appender ${r.type} exports a shutdown function.`)),At(`${e}: clustering.isMaster ? ${ad.isMaster()}`),At(`${e}: appenderModule is ${require("util").inspect(n)}`),ad.onlyOnMaster(()=>(At(`calling appenderModule.configure for ${e} / ${r.type}`),n.configure(SE.modifyConfig(r),IE,o=>ud(o,t),EE)),()=>{})},cd=e=>{if(Pn.clear(),yi.clear(),!e)return;let t=[];Object.values(e.categories).forEach(r=>{t.push(...r.appenders)}),Object.keys(e.appenders).forEach(r=>{(t.includes(r)||e.appenders[r].type==="tcp-server"||e.appenders[r].type==="multiprocess")&&ud(r,e)})},ld=()=>{cd()};ld();Je.addListener(e=>{Je.throwExceptionIf(e,Je.not(Je.anObject(e.appenders)),\'must have a property "appenders" of type object.\');let t=Object.keys(e.appenders);Je.throwExceptionIf(e,Je.not(t.length),"must define at least one appender."),t.forEach(r=>{Je.throwExceptionIf(e,Je.not(e.appenders[r].type),`appender "${r}" is not valid (must be an object with property "type")`)})});Je.addListener(cd);Ra.exports=Pn;Ra.exports.init=ld});var ka=D((dR,bi)=>{var kn=we()("log4js:categories"),ue=Kt(),$a=Ht(),fd=Fa(),Rt=new Map;function pd(e,t,r){if(t.inherit===!1)return;let n=r.lastIndexOf(".");if(n<0)return;let o=r.slice(0,n),i=e.categories[o];i||(i={inherit:!0,appenders:[]}),pd(e,i,o),!e.categories[o]&&i.appenders&&i.appenders.length&&i.level&&(e.categories[o]=i),t.appenders=t.appenders||[],t.level=t.level||i.level,i.appenders.forEach(s=>{t.appenders.includes(s)||t.appenders.push(s)}),t.parent=i}function _E(e){if(!e.categories)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r];pd(e,n,r)})}ue.addPreProcessingListener(e=>_E(e));ue.addListener(e=>{ue.throwExceptionIf(e,ue.not(ue.anObject(e.categories)),\'must have a property "categories" of type object.\');let t=Object.keys(e.categories);ue.throwExceptionIf(e,ue.not(t.length),"must define at least one category."),t.forEach(r=>{let n=e.categories[r];ue.throwExceptionIf(e,[ue.not(n.appenders),ue.not(n.level)],`category "${r}" is not valid (must be an object with properties "appenders" and "level")`),ue.throwExceptionIf(e,ue.not(Array.isArray(n.appenders)),`category "${r}" is not valid (appenders must be an array of appender names)`),ue.throwExceptionIf(e,ue.not(n.appenders.length),`category "${r}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(n,"enableCallStack")&&ue.throwExceptionIf(e,typeof n.enableCallStack!="boolean",`category "${r}" is not valid (enableCallStack must be boolean type)`),n.appenders.forEach(o=>{ue.throwExceptionIf(e,ue.not(fd.get(o)),`category "${r}" is not valid (appender "${o}" is not defined)`)}),ue.throwExceptionIf(e,ue.not($a.getLevel(n.level)),`category "${r}" is not valid (level "${n.level}" not recognised; valid levels are ${$a.levels.join(", ")})`)}),ue.throwExceptionIf(e,ue.not(e.categories.default),\'must define a "default" category.\')});var Pa=e=>{if(Rt.clear(),!e)return;Object.keys(e.categories).forEach(r=>{let n=e.categories[r],o=[];n.appenders.forEach(i=>{o.push(fd.get(i)),kn(`Creating category ${r}`),Rt.set(r,{appenders:o,level:$a.getLevel(n.level),enableCallStack:n.enableCallStack||!1})})})},md=()=>{Pa()};md();ue.addListener(Pa);var Or=e=>{if(kn(`configForCategory: searching for config for ${e}`),Rt.has(e))return kn(`configForCategory: ${e} exists in config, returning it`),Rt.get(e);let t;return e.indexOf(".")>0?(kn(`configForCategory: ${e} has hierarchy, cloning from parents`),t={...Or(e.slice(0,e.lastIndexOf(".")))}):(Rt.has("default")||Pa({categories:{default:{appenders:["out"],level:"OFF"}}}),kn("configForCategory: cloning default category"),t={...Rt.get("default")}),Rt.set(e,t),t},TE=e=>Or(e).appenders,NE=e=>Or(e).level,CE=(e,t)=>{Or(e).level=t},AE=e=>Or(e).enableCallStack===!0,RE=(e,t)=>{Or(e).enableCallStack=t};bi.exports=Rt;bi.exports=Object.assign(bi.exports,{appendersForCategory:TE,getLevelForCategory:NE,setLevelForCategory:CE,getEnableCallStackForCategory:AE,setEnableCallStackForCategory:RE,init:md})});var bd=D((hR,yd)=>{var dd=we()("log4js:logger"),FE=Zs(),ct=Ht(),$E=Qo(),vi=ka(),hd=Kt(),PE=/at (?:(.+)\\s+\\()?(?:(.+?):(\\d+)(?::(\\d+))?|([^)]+))\\)?/;function kE(e,t=4){try{let r=e.stack.split(`\n`).slice(t),n=PE.exec(r[0]);if(n&&n.length===6)return{functionName:n[1],fileName:n[2],lineNumber:parseInt(n[3],10),columnNumber:parseInt(n[4],10),callStack:r.join(`\n`)};console.error("log4js.logger - defaultParseCallStack error")}catch(r){console.error("log4js.logger - defaultParseCallStack error",r)}return null}var Mn=class{constructor(t){if(!t)throw new Error("No category provided.");this.category=t,this.context={},this.parseCallStack=kE,dd(`Logger created (${this.category}, ${this.level})`)}get level(){return ct.getLevel(vi.getLevelForCategory(this.category),ct.OFF)}set level(t){vi.setLevelForCategory(this.category,ct.getLevel(t,this.level))}get useCallStack(){return vi.getEnableCallStackForCategory(this.category)}set useCallStack(t){vi.setEnableCallStackForCategory(this.category,t===!0)}log(t,...r){let n=ct.getLevel(t);n?this.isLevelEnabled(n)&&this._log(n,r):hd.validIdentifier(t)&&r.length>0?(this.log(ct.WARN,"log4js:logger.log: valid log-level not found as first parameter given:",t),this.log(ct.INFO,`[${t}]`,...r)):this.log(ct.INFO,t,...r)}isLevelEnabled(t){return this.level.isLessThanOrEqualTo(t)}_log(t,r){dd(`sending log data (${t}) to appenders`);let n=new FE(this.category,t,r,this.context,this.useCallStack&&this.parseCallStack(new Error));$E.send(n)}addContext(t,r){this.context[t]=r}removeContext(t){delete this.context[t]}clearContext(){this.context={}}setParseCallStackFunction(t){this.parseCallStack=t}};function gd(e){let t=ct.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,i=>i[1].toUpperCase()),o=n[0].toUpperCase()+n.slice(1);Mn.prototype[`is${o}Enabled`]=function(){return this.isLevelEnabled(t)},Mn.prototype[n]=function(...i){this.log(t,...i)}}ct.levels.forEach(gd);hd.addListener(()=>{ct.levels.forEach(gd)});yd.exports=Mn});var xd=D((gR,wd)=>{var Dr=Ht(),ME=\':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"\';function qE(e){return e.originalUrl||e.url}function jE(e,t,r){let n=i=>{let s=i.concat();for(let a=0;a<s.length;++a)for(let u=a+1;u<s.length;++u)s[a].token==s[u].token&&s.splice(u--,1);return s},o=[];return o.push({token:":url",replacement:qE(e)}),o.push({token:":protocol",replacement:e.protocol}),o.push({token:":hostname",replacement:e.hostname}),o.push({token:":method",replacement:e.method}),o.push({token:":status",replacement:t.__statusCode||t.statusCode}),o.push({token:":response-time",replacement:t.responseTime}),o.push({token:":date",replacement:new Date().toUTCString()}),o.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),o.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),o.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),o.push({token:":user-agent",replacement:e.headers["user-agent"]}),o.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),o.push({token:/:req\\[([^\\]]+)]/g,replacement(i,s){return e.headers[s.toLowerCase()]}}),o.push({token:/:res\\[([^\\]]+)]/g,replacement(i,s){return t.getHeader(s.toLowerCase())||t.__headers&&t.__headers[s]}}),n(r.concat(o))}function vd(e,t){for(let r=0;r<t.length;r++)e=e.replace(t[r].token,t[r].replacement);return e}function LE(e){let t=null;if(e instanceof RegExp&&(t=e),typeof e=="string"&&(t=new RegExp(e)),Array.isArray(e)){let r=e.map(n=>n.source?n.source:n);t=new RegExp(r.join("|"))}return t}function BE(e,t,r){let n=t;if(r){let o=r.find(i=>{let s=!1;return i.from&&i.to?s=e>=i.from&&e<=i.to:s=i.codes.indexOf(e)!==-1,s});o&&(n=Dr.getLevel(o.level,n))}return n}wd.exports=function(t,r){typeof r=="string"||typeof r=="function"?r={format:r}:r=r||{};let n=t,o=Dr.getLevel(r.level,Dr.INFO),i=r.format||ME;return(s,a,u)=>{if(s._logging!==void 0)return u();if(typeof r.nolog!="function"){let m=LE(r.nolog);if(m&&m.test(s.originalUrl))return u()}if(n.isLevelEnabled(o)||r.level==="auto"){let m=new Date,{writeHead:l}=a;s._logging=!0,a.writeHead=(g,w)=>{a.writeHead=l,a.writeHead(g,w),a.__statusCode=g,a.__headers=w||{}};let d=!1,f=()=>{if(d)return;if(d=!0,typeof r.nolog=="function"&&r.nolog(s,a)===!0){s._logging=!1;return}a.responseTime=new Date-m,a.statusCode&&r.level==="auto"&&(o=Dr.INFO,a.statusCode>=300&&(o=Dr.WARN),a.statusCode>=400&&(o=Dr.ERROR)),o=BE(a.statusCode,o,r.statusRules);let g=jE(s,a,r.tokens||[]);if(r.context&&n.addContext("res",a),typeof i=="function"){let w=i(s,a,x=>vd(x,g));w&&n.log(o,w)}else n.log(o,vd(i,g));r.context&&n.removeContext("res")};a.on("end",f),a.on("finish",f),a.on("error",f),a.on("close",f)}return u()}}});var Dd=D((yR,Od)=>{var Ed=we()("log4js:recording"),wi=[];function UE(){return function(e){Ed(`received logEvent, number of events now ${wi.length+1}`),Ed("log event was ",e),wi.push(e)}}function Id(){return wi.slice()}function Sd(){wi.length=0}Od.exports={configure:UE,replay:Id,playback:Id,reset:Sd,erase:Sd}});var Fd=D((bR,Rd)=>{var Ft=we()("log4js:main"),zE=require("fs"),WE=bl()({proto:!0}),KE=Kt(),GE=Ys(),HE=Ht(),_d=Fa(),Td=ka(),JE=bd(),VE=Qo(),YE=xd(),ZE=Dd(),qn=!1;function QE(e){if(!qn)return;Ft("Received log event ",e),Td.appendersForCategory(e.categoryName).forEach(r=>{r(e)})}function XE(e){Ft(`Loading configuration from ${e}`);try{return JSON.parse(zE.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}function Nd(e){qn&&Cd();let t=e;return typeof t=="string"&&(t=XE(e)),Ft(`Configuration is ${t}`),KE.configure(WE(t)),VE.onMessage(QE),qn=!0,Ad}function eI(){return ZE}function Cd(e){Ft("Shutdown called. Disabling all log writing."),qn=!1;let t=Array.from(_d.values());_d.init(),Td.init();let r=t.reduceRight((s,a)=>a.shutdown?s+1:s,0);if(r===0)return Ft("No appenders with shutdown functions found."),e!==void 0&&e();let n=0,o;Ft(`Found ${r} appenders with shutdown functions.`);function i(s){o=o||s,n+=1,Ft(`Appender shutdowns complete: ${n} / ${r}`),n>=r&&(Ft("All shutdown functions completed."),e&&e(o))}return t.filter(s=>s.shutdown).forEach(s=>s.shutdown(i)),null}function tI(e){return qn||Nd(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new JE(e||"default")}var Ad={getLogger:tI,configure:Nd,shutdown:Cd,connectLogger:YE,levels:HE,addLayout:GE.addLayout,recording:eI};Rd.exports=Ad});var lt=D(Ei=>{"use strict";Ei.getBooleanOption=(e,t)=>{let r=!1;if(t in e&&typeof(r=e[t])!="boolean")throw new TypeError(`Expected the "${t}" option to be a boolean`);return r};Ei.cppdb=Symbol();Ei.inspect=Symbol.for("nodejs.util.inspect.custom")});var ja=D((ER,kd)=>{"use strict";var qa={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function er(e,t){if(new.target!==er)return new er(e,t);if(typeof t!="string")throw new TypeError("Expected second argument to be a string");Error.call(this,e),qa.value=""+e,Object.defineProperty(this,"message",qa),Error.captureStackTrace(this,er),this.code=t}Object.setPrototypeOf(er,Error);Object.setPrototypeOf(er.prototype,Error.prototype);Object.defineProperty(er.prototype,"name",qa);kd.exports=er});var qd=D((IR,Md)=>{var Ii=require("path").sep||"/";Md.exports=nI;function nI(e){if(typeof e!="string"||e.length<=7||e.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(e.substring(7)),r=t.indexOf("/"),n=t.substring(0,r),o=t.substring(r+1);return n=="localhost"&&(n=""),n&&(n=Ii+Ii+n),o=o.replace(/^(.+)\\|/,"$1:"),Ii=="\\\\"&&(o=o.replace(/\\//g,"\\\\")),/^.+\\:/.test(o)||(o=Ii+o),n+o}});var Ud=D((_r,Bd)=>{var La=require("fs"),Oi=require("path"),oI=qd(),Si=Oi.join,iI=Oi.dirname,jd=La.accessSync&&function(e){try{La.accessSync(e)}catch{return!1}return!0}||La.existsSync||Oi.existsSync,Ld={arrow:process.env.NODE_BINDINGS_ARROW||" \\u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function sI(e){typeof e=="string"?e={bindings:e}:e||(e={}),Object.keys(Ld).map(function(u){u in e||(e[u]=Ld[u])}),e.module_root||(e.module_root=_r.getRoot(_r.getFileName())),Oi.extname(e.bindings)!=".node"&&(e.bindings+=".node");for(var t=typeof __webpack_require__=="function"?__non_webpack_require__:require,r=[],n=0,o=e.try.length,i,s,a;n<o;n++){i=Si.apply(null,e.try[n].map(function(u){return e[u]||u})),r.push(i);try{return s=e.path?t.resolve(i):t(i),e.path||(s.path=i),s}catch(u){if(u.code!=="MODULE_NOT_FOUND"&&u.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(u.message))throw u}}throw a=new Error(`Could not locate the bindings file. Tried:\n`+r.map(function(u){return e.arrow+u}).join(`\n`)),a.tries=r,a}Bd.exports=_r=sI;_r.getFileName=function(t){var r=Error.prepareStackTrace,n=Error.stackTraceLimit,o={},i;Error.stackTraceLimit=10,Error.prepareStackTrace=function(a,u){for(var m=0,l=u.length;m<l;m++)if(i=u[m].getFileName(),i!==__filename)if(t){if(i!==t)return}else return},Error.captureStackTrace(o),o.stack,Error.prepareStackTrace=r,Error.stackTraceLimit=n;var s="file://";return i.indexOf(s)===0&&(i=oI(i)),i};_r.getRoot=function(t){for(var r=iI(t),n;;){if(r==="."&&(r=process.cwd()),jd(Si(r,"package.json"))||jd(Si(r,"node_modules")))return r;if(n===r)throw new Error(\'Could not find module root given file: "\'+t+\'". Do you have a `package.json` file? \');n=r,r=Si(r,"..")}}});var zd=D($t=>{"use strict";var{cppdb:Xe}=lt();$t.prepare=function(t){return this[Xe].prepare(t,this,!1)};$t.exec=function(t){return this[Xe].exec(t),this};$t.close=function(){return this[Xe].close(),this};$t.loadExtension=function(...t){return this[Xe].loadExtension(...t),this};$t.defaultSafeIntegers=function(...t){return this[Xe].defaultSafeIntegers(...t),this};$t.unsafeMode=function(...t){return this[Xe].unsafeMode(...t),this};$t.getters={name:{get:function(){return this[Xe].name},enumerable:!0},open:{get:function(){return this[Xe].open},enumerable:!0},inTransaction:{get:function(){return this[Xe].inTransaction},enumerable:!0},readonly:{get:function(){return this[Xe].readonly},enumerable:!0},memory:{get:function(){return this[Xe].memory},enumerable:!0}}});var Gd=D((OR,Kd)=>{"use strict";var{cppdb:aI}=lt(),Wd=new WeakMap;Kd.exports=function(t){if(typeof t!="function")throw new TypeError("Expected first argument to be a function");let r=this[aI],n=uI(r,this),{apply:o}=Function.prototype,i={default:{value:Di(o,t,r,n.default)},deferred:{value:Di(o,t,r,n.deferred)},immediate:{value:Di(o,t,r,n.immediate)},exclusive:{value:Di(o,t,r,n.exclusive)},database:{value:this,enumerable:!0}};return Object.defineProperties(i.default.value,i),Object.defineProperties(i.deferred.value,i),Object.defineProperties(i.immediate.value,i),Object.defineProperties(i.exclusive.value,i),i.default.value};var uI=(e,t)=>{let r=Wd.get(e);if(!r){let n={commit:e.prepare("COMMIT",t,!1),rollback:e.prepare("ROLLBACK",t,!1),savepoint:e.prepare("SAVEPOINT ` _bs3. `",t,!1),release:e.prepare("RELEASE ` _bs3. `",t,!1),rollbackTo:e.prepare("ROLLBACK TO ` _bs3. `",t,!1)};Wd.set(e,r={default:Object.assign({begin:e.prepare("BEGIN",t,!1)},n),deferred:Object.assign({begin:e.prepare("BEGIN DEFERRED",t,!1)},n),immediate:Object.assign({begin:e.prepare("BEGIN IMMEDIATE",t,!1)},n),exclusive:Object.assign({begin:e.prepare("BEGIN EXCLUSIVE",t,!1)},n)})}return r},Di=(e,t,r,{begin:n,commit:o,rollback:i,savepoint:s,release:a,rollbackTo:u})=>function(){let l,d,f;r.inTransaction?(l=s,d=a,f=u):(l=n,d=o,f=i),l.run();try{let g=e.call(t,this,arguments);return d.run(),g}catch(g){throw r.inTransaction&&(f.run(),f!==i&&d.run()),g}}});var Jd=D((DR,Hd)=>{"use strict";var{getBooleanOption:cI,cppdb:lI}=lt();Hd.exports=function(t,r){if(r==null&&(r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");let n=cI(r,"simple"),o=this[lI].prepare(`PRAGMA ${t}`,this,!0);return n?o.pluck().get():o.all()}});var Zd=D((_R,Yd)=>{"use strict";var fI=require("fs"),pI=require("path"),{promisify:mI}=require("util"),{cppdb:dI}=lt(),Vd=mI(fI.access);Yd.exports=async function(t,r){if(r==null&&(r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");t=t.trim();let n="attached"in r?r.attached:"main",o="progress"in r?r.progress:null;if(!t)throw new TypeError("Backup filename cannot be an empty string");if(t===":memory:")throw new TypeError(\'Invalid backup filename ":memory:"\');if(typeof n!="string")throw new TypeError(\'Expected the "attached" option to be a string\');if(!n)throw new TypeError(\'The "attached" option cannot be an empty string\');if(o!=null&&typeof o!="function")throw new TypeError(\'Expected the "progress" option to be a function\');await Vd(pI.dirname(t)).catch(()=>{throw new TypeError("Cannot save backup because the directory does not exist")});let i=await Vd(t).then(()=>!1,()=>!0);return hI(this[dI].backup(this,n,t,i),o||null)};var hI=(e,t)=>{let r=0,n=!0;return new Promise((o,i)=>{setImmediate(function s(){try{let a=e.transfer(r);if(!a.remainingPages){e.close(),o(a);return}if(n&&(n=!1,r=100),t){let u=t(a);if(u!==void 0)if(typeof u=="number"&&u===u)r=Math.max(0,Math.min(2147483647,Math.round(u)));else throw new TypeError("Expected progress callback to return a number or undefined")}setImmediate(s)}catch(a){e.close(),i(a)}})})}});var Xd=D((TR,Qd)=>{"use strict";var{cppdb:gI}=lt();Qd.exports=function(t){if(t==null&&(t={}),typeof t!="object")throw new TypeError("Expected first argument to be an options object");let r="attached"in t?t.attached:"main";if(typeof r!="string")throw new TypeError(\'Expected the "attached" option to be a string\');if(!r)throw new TypeError(\'The "attached" option cannot be an empty string\');return this[gI].serialize(r)}});var th=D((NR,eh)=>{"use strict";var{getBooleanOption:_i,cppdb:yI}=lt();eh.exports=function(t,r,n){if(r==null&&(r={}),typeof r=="function"&&(n=r,r={}),typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof n!="function")throw new TypeError("Expected last argument to be a function");if(typeof r!="object")throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let o="safeIntegers"in r?+_i(r,"safeIntegers"):2,i=_i(r,"deterministic"),s=_i(r,"directOnly"),a=_i(r,"varargs"),u=-1;if(!a){if(u=n.length,!Number.isInteger(u)||u<0)throw new TypeError("Expected function.length to be a positive integer");if(u>100)throw new RangeError("User-defined functions cannot have more than 100 arguments")}return this[yI].function(n,t,u,o,i,s),this}});var oh=D((CR,nh)=>{"use strict";var{getBooleanOption:Ti,cppdb:bI}=lt();nh.exports=function(t,r){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(typeof r!="object"||r===null)throw new TypeError("Expected second argument to be an options object");if(!t)throw new TypeError("User-defined function name cannot be an empty string");let n="start"in r?r.start:null,o=Ba(r,"step",!0),i=Ba(r,"inverse",!1),s=Ba(r,"result",!1),a="safeIntegers"in r?+Ti(r,"safeIntegers"):2,u=Ti(r,"deterministic"),m=Ti(r,"directOnly"),l=Ti(r,"varargs"),d=-1;if(!l&&(d=Math.max(rh(o),i?rh(i):0),d>0&&(d-=1),d>100))throw new RangeError("User-defined functions cannot have more than 100 arguments");return this[bI].aggregate(n,o,i,s,t,d,a,u,m),this};var Ba=(e,t,r)=>{let n=t in e?e[t]:null;if(typeof n=="function")return n;if(n!=null)throw new TypeError(`Expected the "${t}" option to be a function`);if(r)throw new TypeError(`Missing required option "${t}"`);return null},rh=({length:e})=>{if(Number.isInteger(e)&&e>=0)return e;throw new TypeError("Expected function.length to be a positive integer")}});var uh=D((AR,ah)=>{"use strict";var{cppdb:vI}=lt();ah.exports=function(t,r){if(typeof t!="string")throw new TypeError("Expected first argument to be a string");if(!t)throw new TypeError("Virtual table module name cannot be an empty string");let n=!1;if(typeof r=="object"&&r!==null)n=!0,r=_I(sh(r,"used",t));else{if(typeof r!="function")throw new TypeError("Expected second argument to be a function or a table definition object");r=wI(r)}return this[vI].table(r,t,n),this};function wI(e){return function(r,n,o,...i){let s={module:r,database:n,table:o},a=OI.call(e,s,i);if(typeof a!="object"||a===null)throw new TypeError(`Virtual table module "${r}" did not return a table definition object`);return sh(a,"returned",r)}}function sh(e,t,r){if(!jn.call(e,"rows"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition without a "rows" property`);if(!jn.call(e,"columns"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition without a "columns" property`);let n=e.rows;if(typeof n!="function"||Object.getPrototypeOf(n)!==DI)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "rows" property (should be a generator function)`);let o=e.columns;if(!Array.isArray(o)||!(o=[...o]).every(m=>typeof m=="string"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "columns" property (should be an array of strings)`);if(o.length!==new Set(o).size)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate column names`);if(!o.length)throw new RangeError(`Virtual table module "${r}" ${t} a table definition with zero columns`);let i;if(jn.call(e,"parameters")){if(i=e.parameters,!Array.isArray(i)||!(i=[...i]).every(m=>typeof m=="string"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "parameters" property (should be an array of strings)`)}else i=SI(n);if(i.length!==new Set(i).size)throw new TypeError(`Virtual table module "${r}" ${t} a table definition with duplicate parameter names`);if(i.length>32)throw new RangeError(`Virtual table module "${r}" ${t} a table definition with more than the maximum number of 32 parameters`);for(let m of i)if(o.includes(m))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with column "${m}" which was ambiguously defined as both a column and parameter`);let s=2;if(jn.call(e,"safeIntegers")){let m=e.safeIntegers;if(typeof m!="boolean")throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "safeIntegers" property (should be a boolean)`);s=+m}let a=!1;if(jn.call(e,"directOnly")&&(a=e.directOnly,typeof a!="boolean"))throw new TypeError(`Virtual table module "${r}" ${t} a table definition with an invalid "directOnly" property (should be a boolean)`);return[`CREATE TABLE x(${[...i.map(ih).map(m=>`${m} HIDDEN`),...o.map(ih)].join(", ")});`,xI(n,new Map(o.map((m,l)=>[m,i.length+l])),r),i,s,a]}function xI(e,t,r){return function*(...o){let i=o.map(s=>Buffer.isBuffer(s)?Buffer.from(s):s);for(let s=0;s<t.size;++s)i.push(null);for(let s of e(...o))if(Array.isArray(s))EI(s,i,t.size,r),yield i;else if(typeof s=="object"&&s!==null)II(s,i,t,r),yield i;else throw new TypeError(`Virtual table module "${r}" yielded something that isn\'t a valid row object`)}}function EI(e,t,r,n){if(e.length!==r)throw new TypeError(`Virtual table module "${n}" yielded a row with an incorrect number of columns`);let o=t.length-r;for(let i=0;i<r;++i)t[i+o]=e[i]}function II(e,t,r,n){let o=0;for(let i of Object.keys(e)){let s=r.get(i);if(s===void 0)throw new TypeError(`Virtual table module "${n}" yielded a row with an undeclared column "${i}"`);t[s]=e[i],o+=1}if(o!==r.size)throw new TypeError(`Virtual table module "${n}" yielded a row with missing columns`)}function SI({length:e}){if(!Number.isInteger(e)||e<0)throw new TypeError("Expected function.length to be a positive integer");let t=[];for(let r=0;r<e;++r)t.push(`$${r+1}`);return t}var{hasOwnProperty:jn}=Object.prototype,{apply:OI}=Function.prototype,DI=Object.getPrototypeOf(function*(){}),ih=e=>`"${e.replace(/"/g,\'""\')}"`,_I=e=>()=>e});var lh=D((RR,ch)=>{"use strict";var TI=function(){};ch.exports=function(t,r){return Object.assign(new TI,this)}});var dh=D((FR,mh)=>{"use strict";var NI=require("fs"),fh=require("path"),Ln=lt(),CI=ja(),ph;function Oe(e,t){if(new.target==null)return new Oe(e,t);let r;if(Buffer.isBuffer(e)&&(r=e,e=":memory:"),e==null&&(e=""),t==null&&(t={}),typeof e!="string")throw new TypeError("Expected first argument to be a string");if(typeof t!="object")throw new TypeError("Expected second argument to be an options object");if("readOnly"in t)throw new TypeError(\'Misspelled option "readOnly" should be "readonly"\');if("memory"in t)throw new TypeError(\'Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)\');let n=e.trim(),o=n===""||n===":memory:",i=Ln.getBooleanOption(t,"readonly"),s=Ln.getBooleanOption(t,"fileMustExist"),a=Ln.getBooleanOption(t,"uriPath"),u="timeout"in t?t.timeout:5e3,m="verbose"in t?t.verbose:null,l="nativeBinding"in t?t.nativeBinding:null;if(i&&o&&!r)throw new TypeError("In-memory/temporary databases cannot be readonly");if(!Number.isInteger(u)||u<0)throw new TypeError(\'Expected the "timeout" option to be a positive integer\');if(u>2147483647)throw new RangeError(\'Option "timeout" cannot be greater than 2147483647\');if(m!=null&&typeof m!="function")throw new TypeError(\'Expected the "verbose" option to be a function\');if(l!=null&&typeof l!="string")throw new TypeError(\'Expected the "nativeBinding" option to be a string\');let d;if(l==null?d=ph||(ph=Ud()("better_sqlite3.node")):d=require(fh.resolve(l).replace(/(\\.node)?$/,".node")),d.isInitialized||(d.setErrorConstructor(CI),d.isInitialized=!0),!o&&!a&&!NI.existsSync(fh.dirname(n)))throw new TypeError("Cannot open database because the directory does not exist");Object.defineProperties(this,{[Ln.cppdb]:{value:new d.Database(n,e,o,i,s,a,u,m||null,r||null)},...tr.getters})}var tr=zd();Oe.prototype.prepare=tr.prepare;Oe.prototype.transaction=Gd();Oe.prototype.pragma=Jd();Oe.prototype.backup=Zd();Oe.prototype.serialize=Xd();Oe.prototype.function=th();Oe.prototype.aggregate=oh();Oe.prototype.table=uh();Oe.prototype.loadExtension=tr.loadExtension;Oe.prototype.exec=tr.exec;Oe.prototype.close=tr.close;Oe.prototype.defaultSafeIntegers=tr.defaultSafeIntegers;Oe.prototype.unsafeMode=tr.unsafeMode;Oe.prototype[Ln.inspect]=lh();mh.exports=Oe});var hh=D(($R,Ua)=>{"use strict";Ua.exports=dh();Ua.exports.SqliteError=ja()});var wh=D(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});function vh(e,t){if(t)return e;throw new Error("Unhandled discriminated union member: "+JSON.stringify(e))}Ni.assertNever=vh;Ni.default=vh});var Zi=class extends Error{},te=e=>{throw new Zi(e)},Qi=class extends Error{},Q=e=>{throw new Qi(e)};var xt=(e,t)=>le(e)===t,le=e=>{let t=typeof e;return t==="object"?e===null?"null":"object":t==="function"?"object":t},Xi={bigint:"a bigint",boolean:"boolean",null:"null",number:"a number",object:"an object",string:"a string",symbol:"a symbol",undefined:"undefined"};var Me=(e,t)=>e in t,wu=e=>Object.entries(e),re=e=>Object.keys(e),Pt=e=>{let t=[];for(;e!==Object.prototype&&e!==null&&e!==void 0;){for(let r of Object.getOwnPropertyNames(e))t.includes(r)||t.push(r);for(let r of Object.getOwnPropertySymbols(e))t.includes(r)||t.push(r);e=Object.getPrototypeOf(e)}return t},ir=(e,t)=>{let r=e?.[t];return r!=null};var xu=e=>Object.keys(e).length,Pr=e=>xt(e,"object")?Object.keys(e).length!==0:!1,tS=Symbol("id");var et=e=>Array.isArray(e)?e:[e];var ge=class extends Array{static fromString(t,r="/"){return t===r?new ge:new ge(...t.split(r))}toString(t="/"){return this.length?this.join(t):t}},Eu=(e,t)=>{let r=e;for(let n of t){if(typeof r!="object"||r===null)return;r=r[n]}return r};var es=/^(?!^-0$)-?(?:0|[1-9]\\d*)(?:\\.\\d*[1-9])?$/,ny=e=>es.test(e),oy=/^-?\\d*\\.?\\d*$/,iy=e=>e.length!==0&&oy.test(e),eo=/^(?:0|(?:-?[1-9]\\d*))$/,kr=e=>eo.test(e),Mr=/^(?:0|(?:[1-9]\\d*))$/,Iu=/^-?\\d+$/,sy=e=>Iu.test(e),Su={number:"a number",bigint:"a bigint",integer:"an integer"},Ou=(e,t)=>`\'${e}\' was parsed as ${Su[t]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,ay=(e,t)=>t==="number"?ny(e):kr(e),uy=(e,t)=>t==="number"?Number(e):Number.parseInt(e),cy=(e,t)=>t==="number"?iy(e):sy(e),qr=(e,t)=>Du(e,"number",t),to=(e,t)=>Du(e,"integer",t),Du=(e,t,r)=>{let n=uy(e,t);if(!Number.isNaN(n)){if(ay(e,t))return n;if(cy(e,t))return Q(Ou(e,t))}return r?Q(r===!0?`Failed to parse ${Su[t]} from \'${e}\'`:r):void 0},ts=e=>{if(e[e.length-1]!=="n")return;let t=e.slice(0,-1),r;try{r=BigInt(t)}catch{return}if(eo.test(t))return r;if(Iu.test(t))return Q(Ou(e,"bigint"))};var oe=(e,t)=>{switch(le(e)){case"object":return JSON.stringify(rs(e,ro,[]),null,t);case"symbol":return ro.onSymbol(e);default:return ns(e)}},ro={onCycle:()=>"(cycle)",onSymbol:e=>`(symbol${e.description&&` ${e.description}`})`,onFunction:e=>`(function${e.name&&` ${e.name}`})`},rs=(e,t,r)=>{switch(le(e)){case"object":if(typeof e=="function")return ro.onFunction(e);if(r.includes(e))return"(cycle)";let n=[...r,e];if(Array.isArray(e))return e.map(i=>rs(i,t,n));let o={};for(let i in e)o[i]=rs(e[i],t,n);return o;case"symbol":return ro.onSymbol(e);case"bigint":return`${e}n`;case"undefined":return"undefined";default:return e}},ns=e=>typeof e=="string"?`\'${e}\'`:typeof e=="bigint"?`${e}n`:`${e}`;function ly(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function fy(e,t){return t.get?t.get.call(e):t.value}function py(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function Tu(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function _u(e,t){var r=Tu(e,t,"get");return fy(e,r)}function my(e,t,r){ly(e,t),t.set(e,r)}function dy(e,t,r){var n=Tu(e,t,"set");return py(e,n,r),r}function no(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var qe=e=>(t,r,n)=>t===void 0?r===void 0?te(so):r:r===void 0?t:e(t,r,n),so="Unexpected operation two undefined operands",os={domain:({l:e,r:t})=>`${e.join(", ")} and ${t.join(", ")}`,range:({l:e,r:t})=>`${io(e)} and ${io(t)}`,class:({l:e,r:t})=>`classes ${typeof e=="string"?e:e.name} and ${typeof t=="string"?t:t.name}`,tupleLength:({l:e,r:t})=>`tuples of length ${e} and ${t}`,value:({l:e,r:t})=>`literal values ${oe(e)} and ${oe(t)}`,leftAssignability:({l:e,r:t})=>`literal value ${oe(e.value)} and ${oe(t)}`,rightAssignability:({l:e,r:t})=>`literal value ${oe(t.value)} and ${oe(e)}`,union:({l:e,r:t})=>`branches ${oe(e)} and branches ${oe(t)}`},io=e=>"limit"in e?`the range of exactly ${e.limit}`:e.min?e.max?`the range bounded by ${e.min.comparator}${e.min.limit} and ${e.max.comparator}${e.max.limit}`:`${e.min.comparator}${e.min.limit}`:e.max?`${e.max.comparator}${e.max.limit}`:"the unbounded range",oo=new WeakMap,Et=class{get disjoints(){return _u(this,oo)}addDisjoint(t,r,n){return _u(this,oo)[`${this.path}`]={kind:t,l:r,r:n},ao}constructor(t,r){no(this,"type",void 0),no(this,"lastOperator",void 0),no(this,"path",void 0),no(this,"domain",void 0),my(this,oo,{writable:!0,value:void 0}),this.type=t,this.lastOperator=r,this.path=new ge,dy(this,oo,{})}},ao=Symbol("empty"),Nu=()=>ao,Ye=e=>e===ao,Cu=Symbol("equal"),ye=()=>Cu,je=e=>e===Cu,sr=(e,t)=>(r,n,o)=>{let i={},s=re({...r,...n}),a=!0,u=!0;for(let m of s){let l=typeof e=="function"?e(m,r[m],n[m],o):e[m](r[m],n[m],o);if(je(l))r[m]!==void 0&&(i[m]=r[m]);else if(Ye(l))if(t.onEmpty==="omit")a=!1,u=!1;else return ao;else l!==void 0&&(i[m]=l),a&&(a=l===r[m]),u&&(u=l===n[m])}return a?u?ye():r:u?n:i};var Au=e=>{let t=re(e);if(t.length===1){let n=t[0];return`${n==="/"?"":`At ${n}: `}Intersection of ${os[e[n].kind](e[n])} results in an unsatisfiable type`}let r=`\n "Intersection results in unsatisfiable types at the following paths:\n`;for(let n in e)r+=` ${n}: ${os[e[n].kind](e[n])}\n`;return r},uo=(e,t,r)=>`${e.length?`At ${e}: `:""}${t} ${r?`${r} `:""}results in an unsatisfiable type`;var jr={Array,Date,Error,Function,Map,RegExp,Set,Object,String,Number,Boolean,WeakMap,WeakSet,Promise},ar=(e,t)=>{if(le(e)!=="object")return;let r=t??jr,n=Object.getPrototypeOf(e);for(;n?.constructor&&(!r[n.constructor.name]||!(e instanceof r[n.constructor.name]));)n=Object.getPrototypeOf(n);return n?.constructor?.name};var It=e=>Array.isArray(e),is={Object:"an object",Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},co=e=>{let t=Object(e).name;return t&&Me(t,jr)&&jr[t]===e?t:void 0};var Ru=qe((e,t,r)=>e===t?ye():e instanceof t?e:t instanceof e?t:r.addDisjoint("class",e,t)),Fu=(e,t)=>typeof e=="string"?ar(t.data)===e||!t.problems.add("class",e):t.data instanceof e||!t.problems.add("class",e);var lo=(e,t)=>{if(Array.isArray(e)){if(Array.isArray(t)){let r=hy(e,t);return r.length===e.length?r.length===t.length?ye():e:r.length===t.length?t:r}return e.includes(t)?e:[...e,t]}return Array.isArray(t)?t.includes(e)?t:[...t,e]:e===t?ye():[e,t]},hy=(e,t)=>{let r=[...e];for(let n of t)e.includes(n)||r.push(n);return r};var $u=qe((e,t)=>e===t?ye():Math.abs(e*t/gy(e,t))),gy=(e,t)=>{let r,n=e,o=t;for(;o!==0;)r=o,o=n%o,n=r;return n},Pu=(e,t)=>t.data%e===0||!t.problems.add("divisor",e);var Lr=e=>e[0]==="?",fo=e=>e[0]==="!",rt={index:"[index]"},St=e=>Lr(e)||fo(e)?e[1]:e,yy=e=>{if(typeof e.length=="object"&&fo(e.length)&&typeof e.length[1]!="string"&&mo(e.length[1],"number"))return e.length[1].number.value},ku=qe((e,t,r)=>{let n=by(e,t,r);if(typeof n=="symbol")return n;let o=yy(n);if(o===void 0||!(rt.index in n))return n;let{[rt.index]:i,...s}=n,a=St(i);for(let u=0;u<o;u++){if(!s[u]){s[u]=a;continue}let m=St(s[u]);r.path.push(`${u}`);let l=po(m,a,r);if(r.path.pop(),Ye(l))return l;!je(l)&&l!==m&&(s[u]=l)}return s}),by=sr((e,t,r,n)=>{if(t===void 0)return r===void 0?ye():r;if(r===void 0)return t;n.path.push(e);let o=po(St(t),St(r),n);n.path.pop();let i=Lr(t)&&Lr(r);return Ye(o)&&i?{}:o},{onEmpty:"bubble"}),Mu=(e,t,r)=>{let n=r.type.config?.keys??r.type.scope.config.keys;return n==="loose"?vy(e,t,r):wy(n,e,t,r)},vy=(e,t,r)=>{for(let n in t){let o=t[n];r.path.push(n),n===rt.index?e.push(["indexProp",tt(St(o),r)]):Lr(o)?e.push(["optionalProp",[n,tt(o[1],r)]]):fo(o)?e.push(["prerequisiteProp",[n,tt(o[1],r)]]):e.push(["requiredProp",[n,tt(o,r)]]),r.path.pop()}},wy=(e,t,r,n)=>{let o={required:{},optional:{}};for(let i in r){let s=r[i];n.path.push(i),i===rt.index?o.index=tt(St(s),n):Lr(s)?o.optional[i]=tt(s[1],n):fo(s)?t.push(["prerequisiteProp",[i,tt(s[1],n)]]):o.required[i]=tt(s,n),n.path.pop()}t.push([`${e}Props`,o])};function xy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ss=e=>typeof e=="string"||Array.isArray(e)?e.length:typeof e=="number"?e:0,Ey=e=>typeof e=="string"?"characters":Array.isArray(e)?"items long":"",ho=class{toString(){return oe(this.value)}get domain(){return le(this.value)}get size(){return ss(this.value)}get units(){return Ey(this.value)}get className(){return Object(this.value).constructor.name}constructor(t){xy(this,"value",void 0),this.value=t}};var go={">":!0,">=":!0},as={"<":!0,"<=":!0},Br=e=>"comparator"in e,ju=qe((e,t,r)=>{if(Br(e))return Br(t)?e.limit===t.limit?ye():r.addDisjoint("range",e,t):qu(t,e.limit)?e:r.addDisjoint("range",e,t);if(Br(t))return qu(e,t.limit)?t:r.addDisjoint("range",e,t);let n=ur("min",e.min,t.min),o=ur("max",e.max,t.max);return n==="l"?o==="r"?ur("min",e.min,t.max)==="l"?r.addDisjoint("range",e,t):{min:e.min,max:t.max}:e:n==="r"?o==="l"?ur("max",e.max,t.min)==="l"?r.addDisjoint("range",e,t):{min:t.min,max:e.max}:t:o==="l"?e:o==="r"?t:ye()}),qu=(e,t)=>Br(e)?t===e.limit:Iy(e.min,t)&&Sy(e.max,t),Iy=(e,t)=>!e||t>e.limit||t===e.limit&&!Ur(e.comparator),Sy=(e,t)=>!e||t<e.limit||t===e.limit&&!Ur(e.comparator),Lu=(e,t,r)=>{let n=r.lastDomain==="string"?"characters":r.lastDomain==="object"?"items long":void 0;if(Br(t))return e.push(["bound",n?{...t,units:n}:t]);t.min&&e.push(["bound",n?{...t.min,units:n}:t.min]),t.max&&e.push(["bound",n?{...t.max,units:n}:t.max])},Bu=(e,t)=>Oy[e.comparator](ss(t.data),e.limit)||!t.problems.add("bound",e),Oy={"<":(e,t)=>e<t,">":(e,t)=>e>t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e===t},ur=(e,t,r)=>t?r?t.limit===r.limit?Ur(t.comparator)?Ur(r.comparator)?"=":"l":Ur(r.comparator)?"r":"=":e==="min"?t.limit>r.limit?"l":"r":t.limit<r.limit?"l":"r":"l":r?"r":"=",Ur=e=>e.length===1;var us={},cs=e=>(us[e]||(us[e]=new RegExp(e)),us[e]),Uu=(e,t)=>cs(e).test(t.data)||!t.problems.add("regex",`/${e}/`),zu=qe(lo);var Ku=(e,t,r)=>"value"in e?"value"in t?e.value===t.value?ye():r.addDisjoint("value",e.value,t.value):Wu(e.value,t,r)?e:r.addDisjoint("leftAssignability",e,t):"value"in t?Wu(t.value,e,r)?t:r.addDisjoint("rightAssignability",e,t):_y(e,t,r),Dy=qe(lo),_y=sr({divisor:$u,regex:zu,props:ku,class:Ru,range:ju,narrow:Dy},{onEmpty:"bubble"}),ls=(e,t)=>{let r=[],n;for(n in e)Ty[n](r,e[n],t);return r.sort((o,i)=>zr[o[0]]-zr[i[0]])},Ty={regex:(e,t)=>{for(let r of et(t))e.push(["regex",r])},divisor:(e,t)=>{e.push(["divisor",t])},range:Lu,class:(e,t)=>{e.push(["class",t])},props:Mu,narrow:(e,t)=>{for(let r of et(t))e.push(["narrow",r])},value:(e,t)=>{e.push(["value",t])}},zr={config:-1,domain:0,value:0,domains:0,branches:0,switch:0,alias:0,class:0,regex:1,divisor:1,bound:1,prerequisiteProp:2,distilledProps:3,strictProps:3,requiredProp:3,optionalProp:3,indexProp:3,narrow:4,morph:5},Wu=(e,t,r)=>!r.type.scope.type(["node",{[r.domain]:t}])(e).problems;var fs=e=>e?.lBranches!==void 0,Hu=(e,t,r)=>{let n={lBranches:e,rBranches:t,lExtendsR:[],rExtendsL:[],equalities:[],distinctIntersections:[]},o=t.map(i=>({condition:i,distinct:[]}));return e.forEach((i,s)=>{let a=!1,u=o.map((m,l)=>{if(a||!m.distinct)return null;let d=m.condition,f=Kr(i,d,r);return Ye(f)?null:f===i?(n.lExtendsR.push(s),a=!0,null):f===d?(n.rExtendsL.push(l),m.distinct=null,null):je(f)?(n.equalities.push([s,l]),a=!0,m.distinct=null,null):xt(f,"object")?f:te(`Unexpected predicate intersection result of type \'${le(f)}\'`)});if(!a)for(let m=0;m<o.length;m++)u[m]&&o[m].distinct?.push(u[m])}),n.distinctIntersections=o.flatMap(i=>i.distinct??[]),n},ps=e=>"rules"in e,Wr=(e,t)=>{if(ps(e)){let r=ls(e.rules,t);if(e.morph)if(typeof e.morph=="function")r.push(["morph",e.morph]);else for(let n of e.morph)r.push(["morph",n]);return r}return ls(e,t)},Gu=e=>e.rules??e,Kr=(e,t,r)=>{let n=Gu(e),o=Gu(t),i=Ku(n,o,r);return"morph"in e?"morph"in t?e.morph===t.morph?je(i)||Ye(i)?i:{rules:i,morph:e.morph}:r.lastOperator==="&"?Q(uo(r.path,"Intersection","of morphs")):{}:Ye(i)?i:{rules:je(i)?e.rules:i,morph:e.morph}:"morph"in t?Ye(i)?i:{rules:je(i)?t.rules:i,morph:t.morph}:i};var Ju=e=>`${e==="/"?"A":`At ${e}, a`} union including one or more morphs must be discriminatable`;var Yu=(e,t)=>{let r=Cy(e,t),n=e.map((o,i)=>i);return Zu(e,n,r,t)},Zu=(e,t,r,n)=>{if(t.length===1)return Wr(e[t[0]],n);let o=Ry(t,r);if(!o)return[["branches",t.map(s=>ds(e[s],n.type.scope)?Q(Ju(`${n.path}`)):Wr(e[s],n))]];let i={};for(let s in o.indexCases){let a=o.indexCases[s];i[s]=Zu(e,a,r,n),s!=="default"&&Gr(i[s],o.path,o,n)}return[["switch",{path:o.path,kind:o.kind,cases:i}]]},Gr=(e,t,r,n)=>{for(let o=0;o<e.length;o++){let[i,s]=e[o];if(t.length){if((i==="requiredProp"||i==="prerequisiteProp"||i==="optionalProp")&&s[0]===t[0]){if(typeof s[1]=="string"){if(r.kind!=="domain")return ms(r);e.splice(o,1);return}Gr(s[1],t.slice(1),r,n),s[1].length===0&&e.splice(o,1);return}}else if(r.kind==="domain"){if(i==="domain"||i==="domains"){e.splice(o,1);return}else if(i==="class"||i==="value")return}else if(r.kind===i){e.splice(o,1);return}if(i==="domains"){if(xu(s)!==1||!s.object)return ms(r);Gr(s.object,t,r,n);return}else if(i==="switch"){for(let a in s.cases)Gr(s.cases[a],t,r,n);return}else if(i==="branches"){for(let a of s)Gr(a,t,r,n);return}}return ms(r)},ms=e=>te(`Unexpectedly failed to discriminate ${e.kind} at path \'${e.path}\'`),Ny={domain:!0,class:!0,value:!0},Cy=(e,t)=>{let r={disjointsByPair:{},casesByDisjoint:{}};for(let n=0;n<e.length-1;n++)for(let o=n+1;o<e.length;o++){let i=`${n}/${o}`,s=[];r.disjointsByPair[i]=s;let a=new Et(t.type,"|");Kr(e[n],e[o],a);for(let u in a.disjoints){if(u.includes(rt.index))continue;let{l:m,r:l,kind:d}=a.disjoints[u];if(!Me(d,Ny))continue;let f=Vu(d,m),g=Vu(d,l);if(f===void 0||g===void 0)continue;let w=u==="/"?d:`${u}/${d}`;if(s.push(w),!r.casesByDisjoint[w]){r.casesByDisjoint[w]={[f]:[n],[g]:[o]};continue}let x=r.casesByDisjoint[w],S=x[f];S?S.includes(n)||S.push(n):x[f]=[n];let N=x[g];N?N.includes(o)||N.push(o):x[g]=[o]}}return r},Ay=e=>{let t=ge.fromString(e);return[t,t.pop()]},Ry=(e,t)=>{let r;for(let n=0;n<e.length-1;n++){let o=e[n];for(let i=n+1;i<e.length;i++){let s=e[i],a=t.disjointsByPair[`${o}/${s}`];for(let u of a){let m=t.casesByDisjoint[u],l={},d=[...e],f=0;for(let w in m){let x=m[w].filter(S=>{let N=e.indexOf(S);if(N!==-1)return delete d[N],!0});x.length!==0&&(l[w]=x,f++)}let g=re(d);if(g.length&&(l.default=g.map(w=>parseInt(w))),!r||f>r.score){let[w,x]=Ay(u);if(r={path:w,kind:x,indexCases:l,score:f},f===e.length)return r}}}}return r},Vu=(e,t)=>{switch(e){case"value":return Qu(t);case"domain":return t;case"class":return co(t);default:return}},Qu=e=>{let t=le(e);return t==="object"||t==="symbol"?void 0:ns(e)},Fy={value:e=>Qu(e)??"default",class:e=>ar(e)??"default",domain:le},Xu=(e,t)=>Fy[e](t),ds=(e,t)=>"morph"in e?!0:"props"in e?Object.values(e.props).some(r=>$y(St(r),t)):!1,$y=(e,t)=>typeof e=="string"?t.resolve(e).includesMorph:Object.values(t.resolveTypeNode(e)).some(r=>r===!0?!1:It(r)?r.some(n=>ds(n,t)):ds(r,t));var cr=e=>e===!0?{}:e,ec=(e,t,r)=>{if(e===!0&&t===!0)return ye();if(!It(e)&&!It(t)){let s=Kr(cr(e),cr(t),r);return s===e?e:s===t?t:s}let n=et(cr(e)),o=et(cr(t)),i=Hu(n,o,r);return i.equalities.length===n.length&&i.equalities.length===o.length?ye():i.lExtendsR.length+i.equalities.length===n.length?e:i.rExtendsL.length+i.equalities.length===o.length?t:i},tc=(e,t,r,n)=>{n.domain=e;let o=ec(t,r,n);if(!fs(o))return o;let i=[...o.distinctIntersections,...o.equalities.map(s=>o.lBranches[s[0]]),...o.lExtendsR.map(s=>o.lBranches[s]),...o.rExtendsL.map(s=>o.rBranches[s])];return i.length===0&&n.addDisjoint("union",o.lBranches,o.rBranches),i.length===1?i[0]:i},rc=(e,t,r,n)=>{let o=new Et(n,"|"),i=ec(t,r,o);if(!fs(i))return je(i)||i===t?r:i===r?t:e==="boolean"?!0:[cr(t),cr(r)];let s=[...i.lBranches.filter((a,u)=>!i.lExtendsR.includes(u)&&!i.equalities.some(m=>m[0]===u)),...i.rBranches.filter((a,u)=>!i.rExtendsL.includes(u)&&!i.equalities.some(m=>m[1]===u))];return s.length===1?s[0]:s},hs=(e,t)=>e===!0?[]:It(e)?Yu(e,t):Wr(e,t),nc=e=>typeof e=="object"&&"value"in e;var Hr=e=>"config"in e,po=(e,t,r)=>{r.domain=void 0;let n=r.type.scope.resolveTypeNode(e),o=r.type.scope.resolveTypeNode(t),i=Py(n,o,r);return typeof i=="object"&&!Pr(i)?Pr(r.disjoints)?Nu():r.addDisjoint("domain",re(n),re(o)):i===n?e:i===o?t:i},Py=sr((e,t,r,n)=>{if(t===void 0)return r===void 0?te(so):void 0;if(r!==void 0)return tc(e,t,r,n)},{onEmpty:"omit"}),Ot=(e,t,r)=>{let n=new Et(r,"&"),o=po(e,t,n);return Ye(o)?Q(Au(n.disjoints)):je(o)?e:o},yo=(e,t,r)=>{let n=r.scope.resolveTypeNode(e),o=r.scope.resolveTypeNode(t),i={},s=re({...n,...o});for(let a of s)i[a]=ir(n,a)?ir(o,a)?rc(a,n[a],o[a],r):n[a]:ir(o,a)?o[a]:te(so);return i},ky=e=>e[0]&&(e[0][0]==="value"||e[0][0]==="class"),gs=e=>{let t={type:e,path:new ge,lastDomain:"undefined"};return tt(e.node,t)},tt=(e,t)=>{if(typeof e=="string")return t.type.scope.resolve(e).flat;let r=Hr(e),n=My(r?e.node:e,t);return r?[["config",{config:wu(e.config),node:n}]]:n},My=(e,t)=>{let r=re(e);if(r.length===1){let o=r[0],i=e[o];if(i===!0)return o;t.lastDomain=o;let s=hs(i,t);return ky(s)?s:[["domain",o],...s]}let n={};for(let o of r)t.lastDomain=o,n[o]=hs(e[o],t);return[["domains",n]]},mo=(e,t)=>qy(e,t)&&nc(e[t]),qy=(e,t)=>{let r=re(e);return r.length===1&&r[0]===t},lr=e=>({object:{class:Array,props:{[rt.index]:e}}});function ys(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ie=class{shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}shiftUntil(t){let r="";for(;this.lookahead;){if(t(this,r))if(r[r.length-1]===ie.escapeToken)r=r.slice(0,-1);else break;r+=this.shift()}return r}shiftUntilNextTerminator(){return this.shiftUntil(ie.lookaheadIsNotWhitespace),this.shiftUntil(ie.lookaheadIsTerminator)}get unscanned(){return this.chars.slice(this.i,this.chars.length).join("")}lookaheadIs(t){return this.lookahead===t}lookaheadIsIn(t){return this.lookahead in t}constructor(t){ys(this,"chars",void 0),ys(this,"i",void 0),ys(this,"finalized",!1),this.chars=[...t],this.i=0}};(function(e){var t=e.lookaheadIsTerminator=f=>f.lookahead in o,r=e.lookaheadIsNotWhitespace=f=>f.lookahead!==d,n=e.comparatorStartChars={"<":!0,">":!0,"=":!0},o=e.terminatingChars={...n,"|":!0,"&":!0,")":!0,"[":!0,"%":!0," ":!0},i=e.comparators={"<":!0,">":!0,"<=":!0,">=":!0,"==":!0},s=e.oneCharComparators={"<":!0,">":!0},a=e.comparatorDescriptions={"<":"less than",">":"more than","<=":"at most",">=":"at least","==":"exactly"},u=e.invertedComparators={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},m=e.branchTokens={"|":!0,"&":!0},l=e.escapeToken="\\\\",d=e.whiteSpaceToken=" "})(ie||(ie={}));function jy(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ly(e,t){return t.get?t.get.call(e):t.value}function By(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function oc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function bo(e,t){var r=oc(e,t,"get");return Ly(e,r)}function Uy(e,t,r){jy(e,t),t.set(e,r)}function zy(e,t,r){var n=oc(e,t,"set");return By(e,n,r),r}function pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vs=class extends TypeError{constructor(t){super(`${t}`),pt(this,"cause",void 0),this.cause=t}},qt=class{toString(){return this.message}get message(){return this.writers.addContext(this.reason,this.path)}get reason(){return this.writers.writeReason(this.mustBe,new ho(this.data))}get mustBe(){return typeof this.writers.mustBe=="string"?this.writers.mustBe:this.writers.mustBe(this.source)}constructor(t,r,n,o,i){pt(this,"code",void 0),pt(this,"path",void 0),pt(this,"data",void 0),pt(this,"source",void 0),pt(this,"writers",void 0),pt(this,"parts",void 0),this.code=t,this.path=r,this.data=n,this.source=o,this.writers=i,this.code==="multi"&&(this.parts=this.source)}},fr=new WeakMap,ws=class extends Array{mustBe(t,r){return this.add("custom",t,r)}add(t,r,n){let o=ge.from(n?.path??bo(this,fr).path),i=n&&"data"in n?n.data:bo(this,fr).data,s=new qt(t,o,i,r,bo(this,fr).getProblemConfig(t));return this.addProblem(s),s}addProblem(t){let r=`${t.path}`,n=this.byPath[r];if(n)if(n.parts)n.parts.push(t);else{let o=new qt("multi",n.path,n.data,[n,t],bo(this,fr).getProblemConfig("multi")),i=this.indexOf(n);this[i===-1?this.length:i]=o,this.byPath[r]=o}else this.byPath[r]=t,this.push(t);this.count++}get summary(){return`${this}`}toString(){return this.join(`\n`)}throw(){throw new vs(this)}constructor(t){super(),pt(this,"byPath",{}),pt(this,"count",0),Uy(this,fr,{writable:!0,value:void 0}),zy(this,fr,t)}},vo=ws,Wy=e=>e[0].toUpperCase()+e.slice(1),xs=e=>e.map(t=>Xi[t]),ic=e=>e.map(t=>is[t]),bs=e=>{if(e.length===0)return"never";if(e.length===1)return e[0];let t="";for(let r=0;r<e.length-1;r++)t+=e[r],r<e.length-2&&(t+=", ");return t+=` or ${e[e.length-1]}`,t},kt=(e,t)=>`must be ${e}${t&&` (was ${t})`}`,sc=(e,t)=>t.length===0?Wy(e):t.length===1&&kr(t[0])?`Item at index ${t[0]} ${e}`:`${t} ${e}`,Mt={divisor:{mustBe:e=>e===1?"an integer":`a multiple of ${e}`},class:{mustBe:e=>{let t=co(e);return t?is[t]:`an instance of ${e.name}`},writeReason:(e,t)=>kt(e,t.className)},domain:{mustBe:e=>Xi[e],writeReason:(e,t)=>kt(e,t.domain)},missing:{mustBe:()=>"defined",writeReason:e=>kt(e,"")},extraneous:{mustBe:()=>"removed",writeReason:e=>kt(e,"")},bound:{mustBe:e=>`${ie.comparatorDescriptions[e.comparator]} ${e.limit}${e.units?` ${e.units}`:""}`,writeReason:(e,t)=>kt(e,`${t.size}`)},regex:{mustBe:e=>`a string matching ${e}`},value:{mustBe:oe},branches:{mustBe:e=>bs(e.map(t=>`${t.path} must be ${t.parts?bs(t.parts.map(r=>r.mustBe)):t.mustBe}`)),writeReason:(e,t)=>`${e} (was ${t})`,addContext:(e,t)=>t.length?`At ${t}, ${e}`:e},multi:{mustBe:e=>"\\u2022 "+e.map(t=>t.mustBe).join(`\n\\u2022 `),writeReason:(e,t)=>`${t} must be...\n${e}`,addContext:(e,t)=>t.length?`At ${t}, ${e}`:e},custom:{mustBe:e=>e},cases:{mustBe:e=>bs(e)}},ac=re(Mt),Ky=()=>{let e={},t;for(t of ac)e[t]={mustBe:Mt[t].mustBe,writeReason:Mt[t].writeReason??kt,addContext:Mt[t].addContext??sc};return e},Gy=Ky(),uc=e=>{if(!e)return Gy;let t={};for(let r of ac)t[r]={mustBe:e[r]?.mustBe??Mt[r].mustBe,writeReason:e[r]?.writeReason??Mt[r].writeReason??e.writeReason??kt,addContext:e[r]?.addContext??Mt[r].addContext??e.addContext??sc};return t};function Hy(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Jy(e,t){return t.get?t.get.call(e):t.value}function Vy(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function fc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function Es(e,t){var r=fc(e,t,"get");return Jy(e,r)}function Yy(e,t,r){Hy(e,t),t.set(e,r)}function Zy(e,t,r){var n=fc(e,t,"set");return Vy(e,n,r),r}function nt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Qy=()=>({mustBe:[],writeReason:[],addContext:[],keys:[]}),Xy=["mustBe","writeReason","addContext"],pc=(e,t)=>{let r=new Is(t,e);wo(e.flat,r);let n=new mc(r);if(r.problems.count)n.problems=r.problems;else{for(let[o,i]of r.entriesToPrune)delete o[i];n.data=r.data}return n},mc=class{constructor(){nt(this,"data",void 0),nt(this,"problems",void 0)}},Jr=new WeakMap,Is=class{getProblemConfig(t){let r={};for(let n of Xy)r[n]=this.traversalConfig[n][0]??this.rootScope.config.codes[t][n];return r}traverseConfig(t,r){for(let o of t)this.traversalConfig[o[0]].unshift(o[1]);let n=wo(r,this);for(let o of t)this.traversalConfig[o[0]].shift();return n}traverseKey(t,r){let n=this.data;this.data=this.data[t],this.path.push(t);let o=wo(r,this);return this.path.pop(),n[t]!==this.data&&(n[t]=this.data),this.data=n,o}traverseResolution(t){let r=this.type.scope.resolve(t),n=r.qualifiedName,o=this.data,i=xt(o,"object");if(i){let u=Es(this,Jr)[n];if(u){if(u.includes(o))return!0;u.push(o)}else Es(this,Jr)[n]=[o]}let s=this.type;this.type=r;let a=wo(r.flat,this);return this.type=s,i&&Es(this,Jr)[n].pop(),a}traverseBranches(t){let r=this.failFast;this.failFast=!0;let n=this.problems,o=new vo(this);this.problems=o;let i=this.path,s=this.entriesToPrune,a=!1;for(let u of t)if(this.path=new ge,this.entriesToPrune=[],xo(u,this)){a=!0,s.push(...this.entriesToPrune);break}return this.path=i,this.entriesToPrune=s,this.problems=n,this.failFast=r,a||!this.problems.add("branches",o)}constructor(t,r){nt(this,"data",void 0),nt(this,"type",void 0),nt(this,"path",void 0),nt(this,"problems",void 0),nt(this,"entriesToPrune",void 0),nt(this,"failFast",void 0),nt(this,"traversalConfig",void 0),nt(this,"rootScope",void 0),Yy(this,Jr,{writable:!0,value:void 0}),this.data=t,this.type=r,this.path=new ge,this.problems=new vo(this),this.entriesToPrune=[],this.failFast=!1,this.traversalConfig=Qy(),Zy(this,Jr,{}),this.rootScope=r.scope}},wo=(e,t)=>typeof e=="string"?le(t.data)===e||!t.problems.add("domain",e):xo(e,t),xo=(e,t)=>{let r=!0;for(let n=0;n<e.length;n++){let[o,i]=e[n],s=eb[o](i,t);if(r&&(r=s),!r&&(t.failFast||n<e.length-1&&zr[o]<zr[e[n+1][0]]))return!1}return r},cc=(e,t)=>e[0]in t.data?t.traverseKey(e[0],e[1]):(t.problems.add("missing",void 0,{path:t.path.concat(e[0]),data:void 0}),!1),lc=e=>(t,r)=>{let n=!0,o={...t.required};for(let s in r.data)if(t.required[s]?(n=r.traverseKey(s,t.required[s])&&n,delete o[s]):t.optional[s]?n=r.traverseKey(s,t.optional[s])&&n:t.index&&eo.test(s)?n=r.traverseKey(s,t.index)&&n:e==="distilledProps"?r.failFast?r.entriesToPrune.push([r.data,s]):delete r.data[s]:(n=!1,r.problems.add("extraneous",r.data[s],{path:r.path.concat(s)})),!n&&r.failFast)return!1;let i=Object.keys(o);if(i.length){for(let s of i)r.problems.add("missing",void 0,{path:r.path.concat(s)});return!1}return n},eb={regex:Uu,divisor:Pu,domains:(e,t)=>{let r=e[le(t.data)];return r?xo(r,t):!t.problems.add("cases",xs(re(e)))},domain:(e,t)=>le(t.data)===e||!t.problems.add("domain",e),bound:Bu,optionalProp:(e,t)=>e[0]in t.data?t.traverseKey(e[0],e[1]):!0,requiredProp:cc,prerequisiteProp:cc,indexProp:(e,t)=>{if(!Array.isArray(t.data))return t.problems.add("class",Array),!1;let r=!0;for(let n=0;n<t.data.length;n++)if(r=t.traverseKey(`${n}`,e)&&r,!r&&t.failFast)return!1;return r},branches:(e,t)=>t.traverseBranches(e),switch:(e,t)=>{let r=Eu(t.data,e.path),n=Xu(e.kind,r);if(ir(e.cases,n))return xo(e.cases[n],t);let o=re(e.cases),i=t.path.concat(e.path),s=e.kind==="value"?o:e.kind==="domain"?xs(o):e.kind==="class"?ic(o):te(`Unexpectedly encountered rule kind \'${e.kind}\' during traversal`);return t.problems.add("cases",s,{path:i,data:r}),!1},alias:(e,t)=>t.traverseResolution(e),class:Fu,narrow:(e,t)=>{let r=t.problems.count,n=e(t.data,t.problems);return!n&&t.problems.count===r&&t.problems.mustBe(e.name?`valid according to ${e.name}`:"valid"),n},config:({config:e,node:t},r)=>r.traverseConfig(e,t),value:(e,t)=>t.data===e||!t.problems.add("value",e),morph:(e,t)=>{let r=e(t.data,t.problems);if(t.problems.length)return!1;if(r instanceof qt)return t.problems.addProblem(r),!1;if(r instanceof mc){if(r.problems){for(let n of r.problems)t.problems.addProblem(n);return!1}return t.data=r.data,!0}return t.data=r,!0},distilledProps:lc("distilledProps"),strictProps:lc("strictProps")};var Dt=new Proxy(()=>Dt,{get:()=>Dt});var Ss=(e,t,r,n)=>{let o={node:e,flat:[["alias",e]],allows:a=>!i(a).problems,assert:a=>{let u=i(a);return u.problems?u.problems.throw():u.data},infer:Dt,inferIn:Dt,qualifiedName:tb(e)?n.getAnonymousQualifiedName(e):`${n.name}.${e}`,definition:t,scope:n,includesMorph:!1,config:r},i={[e]:a=>pc(i,a)}[e];return Object.assign(i,o)},Os=e=>e?.infer===Dt,tb=e=>e[0]==="\\u03BB";var dc=e=>{let t=e.scanner.shiftUntilNextTerminator();e.setRoot(rb(e,t))},rb=(e,t)=>e.ctx.type.scope.addParsedReferenceIfResolvable(t,e.ctx)?t:nb(t)??e.error(t===""?Ds(e):ob(t)),nb=e=>{let t=qr(e);if(t!==void 0)return{number:{value:t}};let r=ts(e);if(r!==void 0)return{bigint:{value:r}}},ob=e=>`\'${e}\' is unresolvable`,Ds=e=>{let t=e.previousOperator();return t?_s(t,e.scanner.unscanned):ib(e.scanner.unscanned)},_s=(e,t)=>`Token \'${e}\' requires a right operand${t?` before \'${t}\'`:""}`,ib=e=>`Expected an expression${e?` before \'${e}\'`:""}`;var Ts=(e,t)=>({node:t.type.scope.resolveTypeNode(be(e[0],t)),config:e[2]});var Le=e=>Object.isFrozen(e)?e:Array.isArray(e)?Object.freeze(e.map(Le)):sb(e),sb=e=>{for(let t in e)Le(e[t]);return e};var ab=Le({regex:Mr.source}),ub=Le({range:{min:{comparator:">=",limit:0}},divisor:1}),hc=(e,t)=>{let r=t.type.scope.resolveNode(be(e[1],t)),n=re(r).map(l=>lb(l,r[l])),o=gc(n);if(!o.length)return uo(t.path,"keyof");let i={};for(let l of o){let d=typeof l;if(d==="string"||d==="number"||d==="symbol"){var s,a;(s=i)[a=d]??(s[a]=[]),i[d].push({value:l})}else if(l===Mr){var u,m;(u=i).string??(u.string=[]),i.string.push(ab),(m=i).number??(m.number=[]),i.number.push(ub)}else return te(`Unexpected keyof key \'${oe(l)}\'`)}return Object.fromEntries(Object.entries(i).map(([l,d])=>[l,d.length===1?d[0]:d]))},cb={bigint:Pt(0n),boolean:Pt(!1),null:[],number:Pt(0),object:[],string:Pt(""),symbol:Pt(Symbol()),undefined:[]},lb=(e,t)=>e!=="object"||t===!0?cb[e]:gc(et(t).map(r=>fb(r))),gc=e=>{if(!e.length)return[];let t=e[0];for(let r=1;r<e.length;r++)t=t.filter(n=>e[r].includes(n));return t},fb=e=>{let t=[];if("props"in e)for(let r of Object.keys(e.props))r===rt.index?t.push(Mr):t.includes(r)||(t.push(r),Mr.test(r)&&t.push(to(r,`Unexpectedly failed to parse an integer from key \'${r}\'`)));if("class"in e){let r=typeof e.class=="string"?jr[e.class]:e.class;for(let n of Pt(r.prototype))t.includes(n)||t.push(n)}return t};var bc=(e,t)=>{if(typeof e[2]!="function")return Q(pb(e[2]));let r=be(e[0],t),n=t.type.scope.resolveTypeNode(r),o=e[2];t.type.includesMorph=!0;let i,s={};for(i in n){let a=n[i];a===!0?s[i]={rules:{},morph:o}:typeof a=="object"?s[i]=It(a)?a.map(u=>yc(u,o)):yc(a,o):te(`Unexpected predicate value for domain \'${i}\': ${oe(a)}`)}return s},yc=(e,t)=>ps(e)?{...e,morph:e.morph?Array.isArray(e.morph)?[...e.morph,t]:[e.morph,t]:t}:{rules:e,morph:t},pb=e=>`Morph expression requires a function following \'|>\' (was ${typeof e})`;var vc=e=>`Expected a Function or Record<Domain, Function> operand (${oe(e)} was invalid)`,wc=(e,t,r,n)=>{let o=re(t);if(!xt(e,"object"))return Q(vc(e));let i={};if(typeof e=="function"){let s={[n]:e};for(let a of o)i[a]=s}else for(let s of o){if(e[s]===void 0)continue;let a={[n]:e[s]};if(typeof a[n]!="function")return Q(vc(a));i[s]=a}return i};var xc=(e,t)=>{let r=be(e[0],t),n=t.type.scope.resolveNode(r),o=Hr(n),i=o?n.node:n,s=Ot(r,wc(e[2],i,t,"narrow"),t.type);return o?{config:n.config,node:s}:s};var Ic=(e,t)=>{if(db(e))return Sc[e[1]](e,t);if(hb(e))return Oc[e[0]](e,t);let r={length:["!",{number:{value:e.length}}]};for(let n=0;n<e.length;n++)t.path.push(`${n}`),r[n]=be(e[n],t),t.path.pop();return{object:{class:Array,props:r}}},Ec=(e,t)=>{if(e[2]===void 0)return Q(_s(e[1],""));let r=be(e[0],t),n=be(e[2],t);return e[1]==="&"?Ot(r,n,t.type):yo(r,n,t.type)},mb=(e,t)=>lr(be(e[0],t));var db=e=>Sc[e[1]]!==void 0,Sc={"|":Ec,"&":Ec,"[]":mb,"=>":xc,"|>":bc,":":Ts},Oc={keyof:hc,instanceof:e=>typeof e[1]!="function"?Q(`Expected a constructor following \'instanceof\' operator (was ${typeof e[1]}).`):{object:{class:e[1]}},"===":e=>({[le(e[1])]:{value:e[1]}}),node:e=>e[1]},hb=e=>Oc[e[0]]!==void 0;var Dc=(e,t)=>{let r={};for(let n in e){let o=n,i=!1;n[n.length-1]==="?"&&(n[n.length-2]===ie.escapeToken?o=`${n.slice(0,-2)}?`:(o=n.slice(0,-1),i=!0)),t.path.push(o);let s=be(e[n],t);t.path.pop(),r[o]=i?["?",s]:s}return{object:{props:r}}};var _c=e=>`Unmatched )${e===""?"":` before ${e}`}`,Tc="Missing )",Nc=(e,t)=>`Left bounds are only valid when paired with right bounds (try ...${t}${e})`,Eo=e=>`Left-bounded expressions must specify their limits using < or <= (was ${e})`,Cc=(e,t,r,n)=>`An expression may have at most one left bound (parsed ${e}${ie.invertedComparators[t]}, ${r}${ie.invertedComparators[n]})`;function Vr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Io=class{error(t){return Q(t)}hasRoot(){return this.root!==void 0}resolveRoot(){return this.assertHasRoot(),this.ctx.type.scope.resolveTypeNode(this.root)}rootToString(){return this.assertHasRoot(),oe(this.root)}ejectRootIfLimit(){this.assertHasRoot();let t=typeof this.root=="string"?this.ctx.type.scope.resolveNode(this.root):this.root;if(mo(t,"number")){let r=t.number.value;return this.root=void 0,r}}ejectRangeIfOpen(){if(this.branches.range){let t=this.branches.range;return delete this.branches.range,t}}assertHasRoot(){if(this.root===void 0)return te("Unexpected interaction with unset root")}assertUnsetRoot(){if(this.root!==void 0)return te("Unexpected attempt to overwrite root")}setRoot(t){this.assertUnsetRoot(),this.root=t}rootToArray(){this.root=lr(this.ejectRoot())}intersect(t){this.root=Ot(this.ejectRoot(),t,this.ctx.type)}ejectRoot(){this.assertHasRoot();let t=this.root;return this.root=void 0,t}ejectFinalizedRoot(){this.assertHasRoot();let t=this.root;return this.root=gb,t}finalize(){if(this.groups.length)return this.error(Tc);this.finalizeBranches(),this.scanner.finalized=!0}reduceLeftBound(t,r){let n=ie.invertedComparators[r];if(!Me(n,go))return this.error(Eo(r));if(this.branches.range)return this.error(Cc(`${this.branches.range.limit}`,this.branches.range.comparator,`${t}`,n));this.branches.range={limit:t,comparator:n}}finalizeBranches(){this.assertRangeUnset(),this.branches.union?(this.pushRootToBranch("|"),this.setRoot(this.branches.union)):this.branches.intersection&&this.setRoot(Ot(this.branches.intersection,this.ejectRoot(),this.ctx.type))}finalizeGroup(){this.finalizeBranches();let t=this.groups.pop();if(!t)return this.error(_c(this.scanner.unscanned));this.branches=t}pushRootToBranch(t){this.assertRangeUnset(),this.branches.intersection=this.branches.intersection?Ot(this.branches.intersection,this.ejectRoot(),this.ctx.type):this.ejectRoot(),t==="|"&&(this.branches.union=this.branches.union?yo(this.branches.union,this.branches.intersection,this.ctx.type):this.branches.intersection,delete this.branches.intersection)}assertRangeUnset(){if(this.branches.range)return this.error(Nc(`${this.branches.range.limit}`,this.branches.range.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={}}previousOperator(){return this.branches.range?.comparator??this.branches.intersection?"&":this.branches.union?"|":void 0}shiftedByOne(){return this.scanner.shift(),this}constructor(t,r){Vr(this,"ctx",void 0),Vr(this,"scanner",void 0),Vr(this,"root",void 0),Vr(this,"branches",void 0),Vr(this,"groups",void 0),this.ctx=r,this.branches={},this.groups=[],this.scanner=new ie(t)}},gb=new Proxy({},{get:()=>te("Unexpected attempt to access ejected attributes")});var Ac=(e,t)=>{let r=e.scanner.shiftUntil(yb[t]);if(e.scanner.lookahead==="")return e.error(vb(r,t));e.scanner.shift()==="/"?(cs(r),e.setRoot({string:{regex:r}})):e.setRoot({string:{value:r}})},Rc={"\'":1,\'"\':1,"/":1},yb={"\'":e=>e.lookahead==="\'",\'"\':e=>e.lookahead===\'"\',"/":e=>e.lookahead==="/"},bb={\'"\':"double-quote","\'":"single-quote","/":"forward slash"},vb=(e,t)=>`${t}${e} requires a closing ${bb[t]}`;var So=e=>e.scanner.lookahead===""?e.error(Ds(e)):e.scanner.lookahead==="("?e.shiftedByOne().reduceGroupOpen():e.scanner.lookaheadIsIn(Rc)?Ac(e,e.scanner.shift()):e.scanner.lookahead===" "?So(e.shiftedByOne()):dc(e);var Fc=e=>`Bounded expression ${e} must be a number, string or array`;var $c=(e,t)=>{let r=wb(e,t),n=e.ejectRootIfLimit();return n===void 0?Eb(e,r):e.reduceLeftBound(n,r)},wb=(e,t)=>e.scanner.lookaheadIs("=")?`${t}${e.scanner.shift()}`:Me(t,ie.oneCharComparators)?t:e.error(xb),xb="= is not a valid comparator. Use == to check for equality",Eb=(e,t)=>{let r=e.scanner.shiftUntilNextTerminator(),n=qr(r,Ob(t,r+e.scanner.unscanned)),o=e.ejectRangeIfOpen(),i={comparator:t,limit:n},s=o?Ns(i,as)?ur("min",o,i)==="l"?e.error(Db({min:o,max:i})):{min:o,max:i}:e.error(Eo(t)):Sb(i,"==")?i:Ns(i,go)?{min:i}:Ns(i,as)?{max:i}:te(`Unexpected comparator \'${i.comparator}\'`);e.intersect(Ib(s,e))},Ib=(e,t)=>{let r=t.resolveRoot(),n=re(r),o={},i={range:e};return n.every(a=>{switch(a){case"string":return o.string=i,!0;case"number":return o.number=i,!0;case"object":return o.object=i,r.object===!0?!1:et(r.object).every(u=>"class"in u&&u.class===Array);default:return!1}})||t.error(Fc(t.rootToString())),o},Sb=(e,t)=>e.comparator===t,Ns=(e,t)=>e.comparator in t,Ob=(e,t)=>`Comparator ${e} must be followed by a number literal (was \'${t}\')`,Db=e=>`${io(e)} is empty`;var Pc=e=>`Divisibility operand ${e} must be a number`;var Mc=e=>{let t=e.scanner.shiftUntilNextTerminator(),r=to(t,kc(t));r===0&&e.error(kc(0));let n=re(e.resolveRoot());n.length===1&&n[0]==="number"?e.intersect({number:{divisor:r}}):e.error(Pc(e.rootToString()))},kc=e=>`% operator must be followed by a non-zero integer literal (was ${e})`;var Cs=e=>{let t=e.scanner.shift();return t===""?e.finalize():t==="["?e.scanner.shift()==="]"?e.rootToArray():e.error(Tb):Me(t,ie.branchTokens)?e.pushRootToBranch(t):t===")"?e.finalizeGroup():Me(t,ie.comparatorStartChars)?$c(e,t):t==="%"?Mc(e):t===" "?Cs(e):te(_b(t))},_b=e=>`Unexpected character \'${e}\'`,Tb="Missing expected \']\'";var qc=(e,t)=>t.type.scope.parseCache.get(e)??t.type.scope.parseCache.set(e,Nb(e,t)??Cb(e,t)),Nb=(e,t)=>{if(t.type.scope.addParsedReferenceIfResolvable(e,t))return e;if(e.endsWith("[]")){let r=e.slice(0,-2);if(t.type.scope.addParsedReferenceIfResolvable(e,t))return lr(r)}},Cb=(e,t)=>{let r=new Io(e,t);return So(r),Ab(r)},Ab=e=>{for(;!e.scanner.finalized;)Rb(e);return e.ejectFinalizedRoot()},Rb=e=>e.hasRoot()?Cs(e):So(e);var be=(e,t)=>{let r=le(e);if(r==="string")return qc(e,t);if(r!=="object")return Q(As(r));let n=ar(e);switch(n){case"Object":return Dc(e,t);case"Array":return Ic(e,t);case"RegExp":return{string:{regex:e.source}};case"Function":if(Os(e))return t.type.scope.addAnonymousTypeReference(e,t);if(Fb(e)){let o=e();if(Os(o))return t.type.scope.addAnonymousTypeReference(o,t)}return Q(As("Function"));default:return Q(As(n??oe(e)))}},j_=Symbol("as"),Fb=e=>typeof e=="function"&&e.length===0,As=e=>`Type definitions must be strings or objects (was ${e})`;function $b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pr=class{get root(){return this.cache}has(t){return t in this.cache}get(t){return this.cache[t]}set(t,r){return this.cache[t]=r,r}constructor(){$b(this,"cache",{})}},Oo=class extends pr{set(t,r){return this.cache[t]=Le(r),r}};function zc(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Pb(e,t){return t.get?t.get.call(e):t.value}function kb(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}function Wc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function dt(e,t){var r=Wc(e,t,"get");return Pb(e,r)}function jc(e,t,r){zc(e,t),t.set(e,r)}function Lc(e,t,r){var n=Wc(e,t,"set");return kb(e,n,r),r}function mt(e,t,r){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return r}function Do(e,t){zc(e,t),t.add(e)}function Ne(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Mb=e=>({codes:uc(e.codes),keys:e.keys??"loose"}),qb=0,Bc={},Rs={};var jt=new WeakMap,mr=new WeakMap,Uc=new WeakSet,_o=new WeakSet,$s=new WeakSet,To=new WeakSet,Ps=class{getAnonymousQualifiedName(t){let r=0,n=t;for(;this.isResolvable(n);)n=`${t}${r++}`;return`${this.name}.${n}`}addAnonymousTypeReference(t,r){var n;return(n=r.type).includesMorph||(n.includesMorph=t.includesMorph),t.node}get infer(){return Dt}compile(){if(!Rs[this.name]){for(let t in this.aliases)this.resolve(t);Rs[this.name]=dt(this,mr).root}return dt(this,mr).root}addParsedReferenceIfResolvable(t,r){var n;let o=mt(this,To,ks).call(this,t,"undefined",[t]);return o?((n=r.type).includesMorph||(n.includesMorph=o.includesMorph),!0):!1}resolve(t){return mt(this,To,ks).call(this,t,"throw",[t])}resolveNode(t){return typeof t=="string"?this.resolveNode(this.resolve(t).node):t}resolveTypeNode(t){let r=this.resolveNode(t);return Hr(r)?r.node:r}isResolvable(t){return dt(this,jt).has(t)||this.aliases[t]}constructor(t,r={}){Do(this,Uc),Do(this,_o),Do(this,$s),Do(this,To),Ne(this,"aliases",void 0),Ne(this,"name",void 0),Ne(this,"config",void 0),Ne(this,"parseCache",void 0),jc(this,jt,{writable:!0,value:void 0}),jc(this,mr,{writable:!0,value:void 0}),Ne(this,"expressions",void 0),Ne(this,"intersection",void 0),Ne(this,"union",void 0),Ne(this,"arrayOf",void 0),Ne(this,"keyOf",void 0),Ne(this,"valueOf",void 0),Ne(this,"instanceOf",void 0),Ne(this,"narrow",void 0),Ne(this,"morph",void 0),Ne(this,"type",void 0),this.aliases=t,this.parseCache=new Oo,Lc(this,jt,new pr),Lc(this,mr,new pr),this.expressions={intersection:(n,o,i)=>this.type([n,"&",o],i),union:(n,o,i)=>this.type([n,"|",o],i),arrayOf:(n,o)=>this.type([n,"[]"],o),keyOf:(n,o)=>this.type(["keyof",n],o),node:(n,o)=>this.type(["node",n],o),instanceOf:(n,o)=>this.type(["instanceof",n],o),valueOf:(n,o)=>this.type(["===",n],o),narrow:(n,o,i)=>this.type([n,"=>",o],i),morph:(n,o,i)=>this.type([n,"|>",o],i)},this.intersection=this.expressions.intersection,this.union=this.expressions.union,this.arrayOf=this.expressions.arrayOf,this.keyOf=this.expressions.keyOf,this.valueOf=this.expressions.valueOf,this.instanceOf=this.expressions.instanceOf,this.narrow=this.expressions.narrow,this.morph=this.expressions.morph,this.type=Object.assign((n,o={})=>{let i=Ss("\\u03BBtype",n,o,this),s=mt(this,$s,Kc).call(this,i),a=be(n,s);return i.node=Le(Pr(o)?{config:o,node:this.resolveTypeNode(a)}:a),i.flat=Le(gs(i)),i},{from:this.expressions.node}),this.name=mt(this,Uc,jb).call(this,r),r.standard!==!1&&mt(this,_o,Fs).call(this,[Rs.standard],"imports"),r.imports&&mt(this,_o,Fs).call(this,r.imports,"imports"),r.includes&&mt(this,_o,Fs).call(this,r.includes,"includes"),this.config=Mb(r)}};function jb(e){let t=e.name?Bc[e.name]?Q(`A scope named \'${e.name}\' already exists`):e.name:`scope${++qb}`;return Bc[t]=this,t}function Fs(e,t){for(let r of e)for(let n in r)(dt(this,jt).has(n)||n in this.aliases)&&Q(Bb(n)),dt(this,jt).set(n,r[n]),t==="includes"&&dt(this,mr).set(n,r[n])}function Kc(e){return{type:e,path:new ge}}function ks(e,t,r){let n=dt(this,jt).get(e);if(n)return n;let o=this.aliases[e];if(!o)return t==="throw"?te(`Unexpectedly failed to resolve alias \'${e}\'`):void 0;let i=Ss(e,o,{},this),s=mt(this,$s,Kc).call(this,i);dt(this,jt).set(e,i),dt(this,mr).set(e,i);let a=be(o,s);if(typeof a=="string"){if(r.includes(a))return Q(Lb(e,r));r.push(a),a=mt(this,To,ks).call(this,a,"throw",r).node}return i.node=Le(a),i.flat=Le(gs(i)),i}var Be=(e,t={})=>new Ps(e,t),Ms=Be({},{name:"root",standard:!1}),Ze=Ms.type,Lb=(e,t)=>`Alias \'${e}\' has a shallow resolution cycle: ${[...t,e].join("=>")}`,Bb=e=>`Alias \'${e}\' is already defined`;var No=Be({Function:["node",{object:{class:Function}}],Date:["node",{object:{class:Date}}],Error:["node",{object:{class:Error}}],Map:["node",{object:{class:Map}}],RegExp:["node",{object:{class:RegExp}}],Set:["node",{object:{class:Set}}],WeakMap:["node",{object:{class:WeakMap}}],WeakSet:["node",{object:{class:WeakSet}}],Promise:["node",{object:{class:Promise}}]},{name:"jsObjects",standard:!1}),Gc=No.compile();var Hc={bigint:!0,boolean:!0,null:!0,number:!0,object:!0,string:!0,symbol:!0,undefined:!0},Co=Be({any:["node",Hc],bigint:["node",{bigint:!0}],boolean:["node",{boolean:!0}],false:["node",{boolean:{value:!1}}],never:["node",{}],null:["node",{null:!0}],number:["node",{number:!0}],object:["node",{object:!0}],string:["node",{string:!0}],symbol:["node",{symbol:!0}],true:["node",{boolean:{value:!0}}],unknown:["node",Hc],void:["node",{undefined:!0}],undefined:["node",{undefined:!0}]},{name:"ts",standard:!1}),Lt=Co.compile();var Ub=e=>{let t=e.replace(/[- ]+/g,""),r=0,n,o,i;for(let s=t.length-1;s>=0;s--)n=t.substring(s,s+1),o=parseInt(n,10),i?(o*=2,o>=10?r+=o%10+1:r+=o):r+=o,i=!i;return!!(r%10===0&&t)},zb=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,Jc=Ze([zb,"=>",(e,t)=>Ub(e)||!t.mustBe("a valid credit card number")],{mustBe:"a valid credit card number"});var Wb=/^[./-]$/,Kb=/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/,Gb=e=>!isNaN(e),Ao=e=>`a ${e}-formatted date`,Hb=(e,t)=>{if(!t?.format){let a=new Date(e);return Gb(a)?a:"a valid date"}if(t.format==="iso8601")return Kb.test(e)?new Date(e):Ao("iso8601");let r=e.split(Wb),n=e[r[0].length],o=n?t.format.split(n):[t.format];if(r.length!==o.length)return Ao(t.format);let i={};for(let a=0;a<o.length;a++){if(r[a].length!==o[a].length&&!(o[a].length===1&&r[a].length===2))return Ao(t.format);i[o[a][0]]=r[a]}let s=new Date(`${i.m}/${i.d}/${i.y}`);return`${s.getDate()}`===i.d?s:Ao(t.format)},Vc=Ze([Lt.string,"|>",(e,t)=>{let r=Hb(e);return typeof r=="string"?t.mustBe(r):r}]);var Jb=Ze([es,"|>",e=>parseFloat(e)],{mustBe:"a well-formed numeric string"}),Vb=Ze([Lt.string,"|>",(e,t)=>{if(!kr(e))return t.mustBe("a well-formed integer string");let r=parseInt(e);return Number.isSafeInteger(r)?r:t.mustBe("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")}]),Yb=Ze(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/,{mustBe:"a valid email"}),Zb=Ze(/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/,{mustBe:"a valid UUID"}),Qb=Ze(/^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/,{mustBe:"a valid semantic version (see https://semver.org/)"}),Xb=Ze([Lt.string,"|>",e=>JSON.parse(e)],{mustBe:"a JSON-parsable string"}),Ro=Be({alpha:[/^[A-Za-z]*$/,":",{mustBe:"only letters"}],alphanumeric:[/^[A-Za-z\\d]*$/,":",{mustBe:"only letters and digits"}],lowercase:[/^[a-z]*$/,":",{mustBe:"only lowercase letters"}],uppercase:[/^[A-Z]*$/,":",{mustBe:"only uppercase letters"}],creditCard:Jc,email:Yb,uuid:Zb,parsedNumber:Jb,parsedInteger:Vb,parsedDate:Vc,semver:Qb,json:Xb,integer:["node",{number:{divisor:1}}]},{name:"validation",standard:!1}),Yc=Ro.compile();var Fo=Be({},{name:"standard",includes:[Lt,Gc,Yc],standard:!1}),ev=Fo.compile(),ht={root:Ms,tsKeywords:Co,jsObjects:No,validation:Ro,ark:Fo};var tv=Fo.type;var rv=ht.ark.intersection,nv=ht.ark.union,ov=ht.ark.arrayOf,iv=ht.ark.keyOf,sv=ht.ark.instanceOf,av=ht.ark.valueOf,uv=ht.ark.narrow,cv=ht.ark.morph;var{DataRequest:Zc,DataResponse:R1}=Be({DataRequest:{id:"number",method:"string",params:"any[]"},DataResponse:{id:"number","eventName?":"string",payload:"any",error:"any"}}).compile(),Qc="__METHODS__",Xc="__EVAL__";var lv=typeof parent<"u"&&typeof window<"u"&&window!==parent?parent.postMessage:postMessage,Yr=class{methods;constructor(t){if(!(typeof self<"u"&&typeof postMessage=="function"&&typeof addEventListener=="function"))throw new Error("Script must be executed as a worker");this.methods={...t,[Qc]:()=>Object.keys(t),[Xc]:(r,...n)=>new Function(`return (${r})`)()(...n)},addEventListener("message",r=>this.onMessage(r.data)),this.send("ready")}send(t,r){lv(t,r)}async onMessage(t){let{data:r,problems:n}=Zc(t);if(n)return this.send({id:-1,payload:null,error:n.toString()});try{let o=this.methods[r.method];if(!o)throw new Error(\'Unknown method "\'+r.method+\'"\');let i=await o.apply(o,r.params);this.send({id:r.id,payload:i,error:null})}catch(o){console.error(o),this.send({id:r.id,payload:null,error:fv(o)})}}emit(t,r){this.send({eventName:t,payload:r,id:-1,error:null})}};function fv(e){return Object.getOwnPropertyNames(e).reduce((t,r)=>Object.defineProperty(t,r,{value:e[r],enumerable:!0}),{})}var el=e=>`obsidian-zotero:${e}`;var Ls=({key:e,groupID:t,parentItem:r},n=!1)=>{let o=[e];return!n&&r&&o.push(`a${r}`),typeof t=="number"&&o.push(`g${t}`),o.join("")},tl=(e,t,r=!0)=>(n,...o)=>{let i="";for(let s=0;s<n.length;s++)s>0&&(i+=e(o[s-1])),i+=(r?n.raw:n)[s];return t(i)},Bs=(e=!0,t)=>tl(r=>r,r=>new RegExp(e?"^"+r+"$":r,t),!0),qs=String.raw`[23456789ABCDEFGHIJKLMNPQRSTUVWXYZ]{8}`,js=String.raw`\\d+`,rl=e=>{let t={annotKey:qs,parentKey:qs,groupID:js,page:js};if(e)for(let r in t)t[r]=`(${t[r]})`;return tl(r=>t[r],r=>r)`${"annotKey"}a${"parentKey"}(?:g${"groupID"})?(?:p${"page"})?`},k1=Bs()`${qs}(?:g${js})?`,M1=Bs()`${rl(!0)}`,q1=Bs()`(?:${rl(!1)}n?)+`;var mv=/^[0-9]{4}\\-(0[0-9]|10|11|12)\\-(0[0-9]|[1-2][0-9]|30|31) /;var dv=/^\\-?[0-9]{4}\\-(0[1-9]|10|11|12)\\-(0[1-9]|[1-2][0-9]|30|31) ([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9])$/,hv=/^\\-?[0-9]{4}\\-(0[1-9]|10|11|12)\\-(0[1-9]|[1-2][0-9]|30|31) ([0-1][0-9]|[2][0-3]):([0-5][0-9])$/,gv=e=>yv(e)||bv(e)?!1:mv.test(e),nl=e=>e?gv(e)?e.substring(0,10):"0000-00-00":"";var yv=e=>dv.test(e),bv=e=>hv.test(e);var ol=(e,t,{getLogger:r,configure:n})=>{let o=el(e);return n({appenders:{out:{type:"console"}},categories:{default:{appenders:["out"],level:t},[o]:{appenders:["out"],level:t}}}),r(o)};var il=()=>(...e)=>e;function sl(e,t){let r=Object.keys(t).map(n=>vv(e,n,t[n]));return r.length===1?r[0]:function(){r.forEach(n=>n())}}function vv(e,t,r){let n=e[t],o=e.hasOwnProperty(t),i=r(n);return n&&Object.setPrototypeOf(i,n),Object.setPrototypeOf(s,i),e[t]=s,a;function s(...u){return i===n&&e[t]===s&&a(),i.apply(this,u)}function a(){e[t]===s&&(o?e[t]=n:delete e[t]),i!==n&&(i=n,Object.setPrototypeOf(s,n||Function))}}var al=e=>{let t=r=>async(...n)=>{try{return await r(...n)}catch(o){throw console.error(o),o}};return sl(e,Object.fromEntries(Object.keys(e).map(r=>[r,t]))),e};var ul;(function(e){e[e.highlight=1]="highlight",e[e.note=2]="note",e[e.image=3]="image",e[e.ink=4]="ink",e[e.underline=5]="underline",e[e.text=6]="text"})(ul||(ul={}));var cl;(function(e){e[e.manual=0]="manual",e[e.auto=1]="auto"})(cl||(cl={}));var ll;(function(e){e[e.importedFile=0]="importedFile",e[e.importedUrl=1]="importedUrl",e[e.linkedFile=2]="linkedFile",e[e.linkedUrl=3]="linkedUrl",e[e.embeddedImage=4]="embeddedImage"})(ll||(ll={}));var Us;(function(e){e[e.fullName=0]="fullName",e[e.nameOnly=1]="nameOnly"})(Us||(Us={}));var zs=["attachment","note","annotation"];var $o=zs.map(e=>`\'${e}\'`).join(",");var ve=(e="itemID")=>`--sql\n ${e} IS NOT NULL\n ${e==="itemID"?`AND ${e} NOT IN (SELECT itemID FROM deletedItems)`:""}\n`,Ue=(e,t="$itemId")=>typeof e=="boolean"?"":`AND ${e} = ${t}`;var Z=class{statement;constructor(t){this.statement=t.prepare(this.sql())}get database(){return this.statement.database}get(t){return this.statement.get(t)}all(t){return t===void 0?this.statement.all():this.statement.all(t)}},dr=class extends Z{query(t){return this.all(t)}},Po=class extends Z{query(){return this.all(void 0)}},hr=class extends Z{query(t){return this.all(t).map(r=>this.parse(r,t))}};var Ws=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]-t[r];return 0};var Ks=e=>e?.split("|").map(t=>parseInt(t,10))??[];var ko=`--sql\n items.itemID,\n items.key,\n items.clientDateModified,\n items.dateAdded,\n items.dateModified,\n annots.type,\n annots.authorName,\n annots.text,\n annots.comment,\n annots.color,\n annots.pageLabel,\n annots.sortIndex,\n annots.position,\n annots.isExternal\n`,Mo=`--sql\n itemAnnotations annots\n JOIN items USING (itemID)\n`,qo=(e,t,r)=>Object.assign(e,{sortIndex:Ks(e.sortIndex),position:JSON.parse(e.position),libraryID:t,groupID:r,itemType:"annotation"});var wv=`--sql\nSELECT\n ${ko},\n annots.parentItemID,\n parentItems.key as parentItem\nFROM\n ${Mo}\n JOIN items as parentItems ON annots.parentItemID = parentItems.itemID\nWHERE\n items.key = $annotKey\n AND items.libraryID = $libId\n AND ${ve("items.itemID")}\n`,Zr=class extends Z{trxCache={};sql(){return wv}parse(t,r){return qo(t,r.libId,r.groupID)}query(t){let{annotKeys:r,libId:n}=t,o=s=>s.reduce((a,u)=>{let m=this.get({annotKey:u,libId:n});return m&&(a[u]=this.parse(m,t)),a},{});return(this.trxCache[n]??=this.database.transaction(o))(r)}};var xv=`--sql\nSELECT\n ${ko}\nFROM\n ${Mo}\nWHERE\n parentItemID = $attachmentId\n AND items.libraryID = $libId\n AND ${ve()}\n`,Qr=class extends hr{sql(){return xv}getKeyStatement=this.database.prepare("SELECT key FROM items WHERE itemID = $attachmentId AND libraryID = $libId");parse(t,r,n){return Object.assign(qo(t,r.libId,r.groupID),{parentItem:n,parentItemID:r.attachmentId})}query(t){let r=this.getKeyStatement.get(t)?.key;if(r===void 0)throw new Error("Parent item not found");return this.all(t).map(n=>this.parse(n,t,r)).sort((n,o)=>Ws(n.sortIndex,o.sortIndex))}};var jo=`--sql\n items.itemID,\n items.key,\n items.clientDateModified,\n items.dateAdded,\n items.dateModified,\n notes.note,\n notes.title\n`,Lo=`--sql\n itemNotes notes\n JOIN items USING (itemID)\n`,Bo=(e,t,r)=>Object.assign(e,{libraryID:t,groupID:r,itemType:"note"});var Ev=`--sql\nSELECT\n ${jo},\n notes.parentItemID,\n parentItems.key as parentItem\nFROM\n ${Lo}\n JOIN items as parentItems ON notes.parentItemID = parentItems.itemID\nWHERE\n items.key = $noteKey\n AND items.libraryID = $libId\n AND ${ve("items.itemID")}\n`,Xr=class extends Z{trxCache={};sql(){return Ev}parse(t,r){return Bo(t,r.libId,r.groupID)}query(t){let{noteKeys:r,libId:n}=t,o=s=>s.reduce((a,u)=>{let m=this.get({noteKey:u,libId:n});return m&&(a[u]=this.parse(m,t)),a},{});return(this.trxCache[n]??=this.database.transaction(o))(r)}};var Iv=`--sql\nSELECT\n ${jo}\nFROM\n ${Lo}\nWHERE\n parentItemID = $itemID\n AND items.libraryID = $libId\n AND ${ve()}\n`,en=class extends hr{sql(){return Iv}getKeyStatement=this.database.prepare("SELECT key FROM items WHERE itemID = $itemID AND libraryID = $libId");parse(t,r,n){return Object.assign(Bo(t,r.libId,r.groupID),{parentItem:n,parentItemID:r.itemID})}query(t){let r=this.getKeyStatement.get(t)?.key;if(r===void 0)throw new Error("Parent item not found");return this.all(t).map(n=>this.parse(n,t,r))}};var Sv=`--sql\nSELECT\n atchs.itemID,\n atchs.path,\n atchs.contentType,\n atchs.linkMode,\n charsets.charset,\n items.key,\n COUNT(atchs.itemID) as annotCount\nFROM\n itemAttachments atchs\n JOIN items USING (itemID)\n LEFT JOIN charsets USING (charsetID)\n LEFT JOIN itemAnnotations annots ON atchs.itemID = annots.parentItemID\nWHERE\n atchs.parentItemID = $itemId\n AND libraryID = $libId\n AND ${ve("atchs.itemID")}\nGROUP BY atchs.itemID\n`,tn=class extends dr{sql(){return Sv}};var ot="betterbibtex",Bt="bbts";var Ov=`--sql\nSELECT\n citationkey as citekey\nFROM\n ${ot}.citationkey\nWHERE\n itemID = $itemID\n AND (libraryID IS NULL OR libraryID = $libId)\n`,Dv=`--sql\nSELECT\n citekey\nFROM\n ${Bt}.citekeys\nWHERE\n itemID = $itemID\n AND (libraryID IS NULL OR libraryID = $libId)\n`,rn=class extends Z{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({itemID:n,libId:o});return i&&(r[n]=i.citekey),r},{});trx=this.database.transaction(this.trxFunc);sql(){return Ov}query(t){return this.trx(t.items)}},nn=class extends Z{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({itemID:n,libId:o});return i&&(r[n]=i.citekey),r},{});trx=this.database.transaction(this.trxFunc);sql(){return Dv}query(t){return this.trx(t.items)}};var _v=`--sql\nSELECT\n itemID\nFROM\n ${ot}.citationkey\nWHERE\n citationkey = $citekey\n`,Tv=`--sql\nSELECT\n itemID\nFROM\n ${Bt}.citekeys\nWHERE\n citekey = $citekey\n`,on=class extends Z{trxFunc=t=>t.reduce((r,n)=>{let o=this.get({citekey:n});return r[n]=o?.itemID??-1,r},{});trx=this.database.transaction(this.trxFunc);sql(){return _v}query(t){return this.trx(t.citekeys)}},sn=class extends Z{trxFunc=t=>t.reduce((r,n)=>{let o=this.get({citekey:n});return r[n]=o?.itemID??-1,r},{});trx=this.database.transaction(this.trxFunc);sql(){return Tv}query(t){return this.trx(t.citekeys)}};var Uo=e=>`--sql\nSELECT\n itemID,\n creators.firstName,\n creators.lastName,\n creators.fieldMode,\n creatorTypes.creatorType,\n orderIndex\nFROM\n items\n LEFT JOIN itemCreators USING (itemID)\n JOIN creators USING (creatorID)\n JOIN creatorTypes USING (creatorTypeID)\nWHERE\n libraryID = $libId\n ${Ue(e||"itemID")}\n AND ${ve()}\nORDER BY\n itemID,\n orderIndex\n`;var KT=Uo(!0);function fl(e){for(var t={},r=e.length,n=0;n<r;++n){var o=e[n];t[o[0]]=o[1]}return t}var Ut=fl;var Nv=Uo(!1),an=class extends Z{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return Nv}query(t){return Ut(this.trx(t))}};var zo=e=>`--sql\nSELECT\n items.itemID,\n fieldsCombined.fieldName,\n itemDataValues.value\nFROM\n items\n JOIN itemData USING (itemID)\n JOIN itemDataValues USING (valueID)\n JOIN fieldsCombined USING (fieldID)\n JOIN itemTypesCombined USING (itemTypeID)\nWHERE\n libraryID = $libId\n ${Ue(e||"items.itemID")}\n AND itemTypesCombined.typeName NOT IN (${$o})\n AND ${ve()}\n`;var FN=zo(!0);var Cv=zo(!1),un=class extends Z{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return Cv}query(t){return Ut(this.trx(t))}};var cn=e=>`--sql\nSELECT\n items.libraryID,\n items.itemID,\n items.key,\n items.clientDateModified,\n items.dateAdded,\n items.dateModified,\n itemTypesCombined.typeName as itemType,\n json_group_array(collectionID) filter (where collectionID is not null) as collectionIDs\nFROM \n items\n JOIN itemTypesCombined USING (itemTypeID)\n LEFT JOIN collectionItems USING (itemID)\nWHERE \n libraryID = $libId\n ${e==="full"?Ue(!1):e==="id"?Ue("items.itemID"):Ue("items.key","$key")}\n AND ${ve()}\n AND itemType NOT IN (${$o})\nGROUP BY itemID\n`;var Av=cn("full"),ln=class extends Z{sql(){return Av}query(t){return this.all(t).map(({collectionIDs:n,...o})=>({...o,collectionIDs:JSON.parse(n)}))}};var Rv=cn("id"),Fv=cn("key"),fn=class extends Z{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({itemId:n,libId:o});return i&&(r[n]={...i,collectionIDs:JSON.parse(i.collectionIDs)}),r},{});trx=this.database.transaction(this.trxFunc);sql(){return Rv}query(t){return this.trx(t)}},pn=class extends Z{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({key:n,libId:o});return i&&(r[n]={...i,collectionIDs:JSON.parse(i.collectionIDs)}),r},{});trx=this.database.transaction(this.trxFunc);sql(){return Fv}query(t){return this.trx(t)}};var mn=e=>`--sql\nWITH\n RECURSIVE CollectionPath AS (\n -- Base case: collections without a parent\n SELECT\n collectionID,\n parentCollectionID,\n collectionName AS path\n FROM\n collections\n WHERE\n libraryID = $libId\n ${e==="full"?Ue(!1):e==="id"?Ue("collectionID","$collectionID"):Ue("key","$key")}\n AND ${ve("collectionID")}\n UNION ALL\n -- Recursive case: join with parent collections\n SELECT\n prev.collectionID,\n c.parentCollectionID,\n c.collectionName\n FROM\n collections c\n JOIN CollectionPath prev ON c.collectionID = prev.parentCollectionID\n )\nSELECT\n p.collectionID,\n json_group_array(p.path) path,\n c.key,\n c.collectionName,\n c.libraryID\nFROM\n CollectionPath p\n JOIN collections c USING (collectionID)\nGROUP BY\n collectionID\nORDER BY\n collectionID;\n`;function Gs({collectionID:e,collectionName:t,path:r,...n}){return{...n,id:e,name:t,path:JSON.parse(r)}}var ZN=mn("full");var $v=mn("id"),tC=mn("key"),dn=class extends Z{trxFunc=t=>t.reduce((r,[n,o])=>{let i=this.get({collectionID:n,libId:o});return i&&r.set(n,Gs(i)),r},new Map);trx=this.database.transaction(this.trxFunc);sql(){return $v}query(t){return this.trx(t)}};var Pv=`--sql\nSELECT\n libraries.libraryID,\n groups.groupID,\n CASE\n libraries.type\n WHEN \'user\' THEN \'My Library\'\n WHEN \'group\' THEN groups.name\n ELSE NULL\n END AS name\nFROM\n libraries\n LEFT JOIN groups USING (libraryID)\nWHERE\n libraries.libraryID IS NOT NULL\nORDER BY\n libraryID\n`,hn=class extends Po{sql(){return Pv}};var kv=`--sql\nSELECT\n tagID,\n type,\n name\nFROM\n itemTags\n JOIN items USING (itemID)\n JOIN tags USING (tagID)\nWHERE\n itemID = $itemId\n AND tagID IS NOT NULL\n AND libraryID = $libId\n`,gn=class extends Z{trxFunc=t=>t.map(([r,n])=>[r,this.all({itemId:r,libId:n})]);trx=this.database.transaction(this.trxFunc);sql(){return kv}query(t){return Ut(this.trx(t))}};var Mv=new Set(il()("creators","itemID","itemType","key","libraryID","collections"));var Qh=$r(Js(),1);var $d=$r(Js(),1),xi=$r(Fd(),1),rI="INFO",Pd=ol("db-worker",rI,xi.default),Ma="log4js_loglevel";$d.default.getItem(Ma).then(e=>{typeof e=="string"&&e in xi.levels&&(Pd.level=e,console.debug(`Read from localforage: loglevel ${e}`))});var ae=Pd;var yh=require("fs"),bh=$r(hh(),1);var bt=class extends Error{constructor(){super("Database not set")}},gh=e=>(0,yh.statSync)(e).mtimeMs,Bn=class{database=null;get instance(){return this.database?.instance}get databaseList(){return this.instance?.pragma("database_list")??[]}tableExists(t,r=""){if(!this.database)throw new bt;let n=r||"main",{exist:o}=(this.database.existStatements[n]??=this.database.instance.prepare(`SELECT count(*) AS exist FROM ${r?`${r}.`:""}sqlite_master WHERE type = \'table\' AND name = $tableName`)).get({tableName:t});return!!o}attachDatabase(t,r){if(!this.instance)throw new bt;this.instance.prepare(`ATTACH DATABASE $path AS ${r}`).run({path:t})}detachDatabase(t){if(!this.instance)throw new bt;this.instance.prepare(`DETACH DATABASE ${t}`).run()}isUpToDate(){return this.database?this.database.mtime===gh(this.database.file):null}opened=!1;open(t,r){try{return this.database?.instance&&(ae.debug("Database opened before, closing: ",this.database.instance.name),this.close()),this.database={mtime:gh(t),instance:AI(t,r),file:t,existStatements:{},prepared:new Map},ae.debug("Database opened: ",t),this.opened=!0,!0}catch(n){if(n.code!=="ENOENT")throw console.error("Failed to open database",t),n;return this.opened=!1,!1}}close(){this.opened=!1,this.instance?.close(),this.database=null}prepare(t){if(!this.database)throw new bt;let r=this.database.prepared.get(t);if(r)return r;let n=new t(this.database.instance);return this.database.prepared.set(t,n),n}};function AI(e,t){return new bh.default(`file:${e}?mode=ro&immutable=1`,{nativeBinding:t.nativeBinding,uriPath:!0,verbose:void 0})}function RI(e){return e.tableExists("citationkey",ot)}var Un=class{#e=null;get instance(){return this.status==="READY"?this.#e:null}get zotero(){if(!this.#e)throw new Error("database not ready");return this.#e.zotero}status="NOT_INITIALIZED";get loadStatus(){if(this.#e?.zotero.opened!==!0)return{main:!1,bbtMain:!1,bbtSearch:null};let t=this.#e.zotero.databaseList;return t.some(o=>o.name===ot)?this.#e.bbtAfterMigration?{main:!0,bbtMain:!0,bbtSearch:null}:{main:!0,bbtMain:!0,bbtSearch:t.some(o=>o.name===Bt)}:{main:!0,bbtMain:!1,bbtSearch:null}}get bbtLoadStatus(){let t=this.loadStatus;return t.bbtMain?t.bbtSearch!==!1:!1}getItemIDsFromCitekey(t){if(!this.#e)throw new bt;let r=this.#e.bbtAfterMigration?on:sn;return this.#e.zotero.prepare(r).query({citekeys:t})}getCitekeys(t){if(!this.#e)throw new bt;let r=this.#e.bbtAfterMigration?rn:nn;return this.#e.zotero.prepare(r).query({items:t})}load(t,r){let n={zotero:this.#e?.zotero??new Bn};try{let o=n.zotero.open(t.zotero,r);if(!o)throw new Error(`Failed to open main database, no database found at ${t.zotero}`);let i=FI(t,n.zotero),s=n.zotero.prepare(hn).query().reduce((a,u)=>(a[u.libraryID]=u,a),{});return this.#e={...n,bbtAfterMigration:i.bbtSearch===null,libraries:s},this.status="READY",{main:o,...i}}catch(o){throw this.status="ERROR",o}}groupOf(t){if(!this.#e)throw new Error("Library info not loaded");return this.#e.libraries[t].groupID}get libraries(){if(!this.#e)throw new Error("Library info not loaded");return Object.values(this.#e.libraries)}};function FI(e,t){try{t.attachDatabase(`file:${e.bbtMain}?mode=ro&immutable=1`,ot)}catch(n){let{code:o}=n;return o==="SQLITE_CANTOPEN"?ae.debug(`Unable to open bbt main database, no database found at ${e.bbtMain}`):ae.debug(`Unable to open bbt main database, ${o} @ ${e.bbtMain}`),{bbtMain:!1,bbtSearch:null}}if(RI(t))return{bbtMain:!0,bbtSearch:null};try{t.attachDatabase(`file:${e.bbtSearch}?mode=ro&immutable=1`,ot)}catch(n){let{code:o}=n;return o==="SQLITE_CANTOPEN"?ae.debug(`Unable to open bbt search database, no database found at ${e.bbtSearch}`):ae.debug(`Unable to open bbt search database, ${o} @ ${e.bbtSearch}`),{bbtMain:!0,bbtSearch:!1}}return{bbtMain:!0,bbtSearch:!0}}var xh=$r(wh(),1);var $I=e=>typeof e[0][0]=="string";function Eh(e){return[...new Set(e)]}var zn=class{#e=Ci;async get(t,r){if(t.length===0)return[];if(!r)return await Promise.all(t.map(([i,s])=>this.#t(i,s)));let n=$I(t)?this.#e.readItemByKey(t):this.#e.readItemById(t);return await this.#e.updateIndex(n),Object.values(n)}async#t(t,r){let n=await this.#e.getItemsCache(r);return typeof t=="number"?n.byId.get(t)??null:typeof t=="string"?n.byKey.get(t)??null:((0,xh.assertNever)(t),null)}};function Wn(){this.cache=null,this.matcher=null,this.stemmer=null,this.filter=null}Wn.prototype.add;Wn.prototype.append;Wn.prototype.search;Wn.prototype.update;Wn.prototype.remove;function Tr(e,t){return typeof e<"u"?e:t}function za(e){let t=new Array(e);for(let r=0;r<e;r++)t[r]=H();return t}function Ih(e){return Object.keys(e)}function H(){return Object.create(null)}function Sh(e){return[].concat.apply([],e)}function Oh(e,t){return t.length-e.length}function rr(e){return e.constructor===Array}function fe(e){return typeof e=="string"}function Ve(e){return typeof e=="object"}function Kn(e){return typeof e=="function"}function _h(e,t,r,n){if(e&&(t&&(e=Wa(e,t)),this.matcher&&(e=Wa(e,this.matcher)),this.stemmer&&e.length>1&&(e=Wa(e,this.stemmer)),n&&e.length>1&&(e=PI(e)),r||r==="")){let o=e.split(r);return this.filter?kI(o,this.filter):o}return e}var Th=/[\\p{Z}\\p{S}\\p{P}\\p{C}]+/u;function Nh(e){let t=H();for(let r=0,n=e.length;r<n;r++)t[e[r]]=1;return t}function Ka(e,t){let r=Ih(e),n=r.length,o=[],i="",s=0;for(let a=0,u,m;a<n;a++)u=r[a],m=e[u],m?(o[s++]=Dh(t?"(?!\\\\b)"+u+"(\\\\b|_)":u),o[s++]=m):i+=(i?"|":"")+u;return i&&(o[s++]=Dh(t?"(?!\\\\b)("+i+")(\\\\b|_)":"("+i+")"),o[s]=""),o}function Wa(e,t){for(let r=0,n=t.length;r<n&&(e=e.replace(t[r],t[r+1]),!!e);r+=2);return e}function Dh(e){return new RegExp(e,"g")}function PI(e){let t="",r="";for(let n=0,o=e.length,i;n<o;n++)(i=e[n])!==r&&(t+=r=i);return t}function kI(e,t){let r=e.length,n=[];for(let o=0,i=0;o<r;o++){let s=e[o];s&&!t[s]&&(n[i++]=s)}return n}var MI=!1,qI="",Ch={encode:Ga,rtl:MI,tokenize:qI};function Ga(e){return _h.call(this,(""+e).toLowerCase(),!1,Th,!1)}var Ah={},Rh={};function Ai(e){Gn(e,"add"),Gn(e,"append"),Gn(e,"search"),Gn(e,"update"),Gn(e,"remove")}function Gn(e,t){e[t+"Async"]=function(){let r=this,n=arguments,o=n[n.length-1],i;Kn(o)&&(i=o,delete n[n.length-1]);let s=new Promise(function(a){setTimeout(function(){r.async=!0;let u=r[t].apply(r,n);r.async=!1,a(u)})});return i?(s.then(i),this):s}}function Ri(e,t,r,n){let o=e.length,i=[],s,a,u=0;n&&(n=[]);for(let m=o-1;m>=0;m--){let l=e[m],d=l.length,f=H(),g=!s;for(let w=0;w<d;w++){let x=l[w],S=x.length;if(S)for(let N=0,M,k;N<S;N++)if(k=x[N],s){if(s[k]){if(!m){if(r)r--;else if(i[u++]=k,u===t)return i}(m||n)&&(f[k]=1),g=!0}if(n&&(M=(a[k]||0)+1,a[k]=M,M<o)){let ee=n[M-2]||(n[M-2]=[]);ee[ee.length]=k}}else f[k]=1}if(n)s||(a=f);else if(!g)return[];s=f}if(n)for(let m=n.length-1,l,d;m>=0;m--){l=n[m],d=l.length;for(let f=0,g;f<d;f++)if(g=l[f],!s[g]){if(r)r--;else if(i[u++]=g,u===t)return i;s[g]=1}}return i}function Fh(e,t){let r=H(),n=H(),o=[];for(let i=0;i<e.length;i++)r[e[i]]=1;for(let i=0,s;i<t.length;i++){s=t[i];for(let a=0,u;a<s.length;a++)u=s[a],r[u]&&(n[u]||(n[u]=1,o[o.length]=u))}return o}function Fi(e){this.limit=e!==!0&&e,this.cache=H(),this.queue=[]}var $i=Fi;function Pi(e,t,r){Ve(e)&&(e=e.query);let n=this.cache.get(e);return n||(n=this.search(e,t,r),this.cache.set(e,n)),n}Fi.prototype.set=function(e,t){if(!this.cache[e]){let r=this.queue.length;r===this.limit?delete this.cache[this.queue[r-1]]:r++;for(let n=r-1;n>0;n--)this.queue[n]=this.queue[n-1];this.queue[0]=e}this.cache[e]=t};Fi.prototype.get=function(e){let t=this.cache[e];if(this.limit&&t){let r=this.queue.indexOf(e);if(r){let n=this.queue[r-1];this.queue[r-1]=this.queue[r],this.queue[r]=n}}return t};Fi.prototype.del=function(e){for(let t=0,r,n;t<this.queue.length;t++)n=this.queue[t],r=this.cache[n],r.includes(e)&&(this.queue.splice(t--,1),delete this.cache[n])};var Ph={memory:{charset:"latin:extra",resolution:3,minlength:4,fastupdate:!1},performance:{resolution:3,minlength:3,optimize:!1,context:{depth:2,resolution:1}},match:{charset:"latin:extra",tokenize:"reverse"},score:{charset:"latin:advanced",resolution:20,minlength:3,context:{depth:3,resolution:9}},default:{}};function Ha(e){if(fe(e))!1&&!Ph[e]&&console.warn("Preset not found: "+e),e=Ph[e];else{let t=e.preset;t&&(!1&&!t[t]&&console.warn("Preset not found: "+t),e=Object.assign({},t[t],e))}return e}function kh(e,t,r,n,o,i,s){setTimeout(function(){let a=e(r?r+"."+n:n,JSON.stringify(s));a&&a.then?a.then(function(){t.export(e,t,r,o,i+1)}):t.export(e,t,r,o,i+1)})}function Mh(e,t,r,n,o){let i,s;switch(o||(o=0)){case 0:if(i="reg",this.fastupdate){s=H();for(let a in this.register)s[a]=1}else s=this.register;break;case 1:i="cfg",s={doc:0,opt:this.optimize?1:0};break;case 2:i="map",s=this.map;break;case 3:i="ctx",s=this.ctx;break;default:return}return kh(e,t||this,r,i,n,o,s),!0}function qh(e,t){if(t)switch(fe(t)&&(t=JSON.parse(t)),e){case"cfg":this.optimize=!!t.opt;break;case"reg":this.fastupdate=!1,this.register=t;break;case"map":this.map=t;break;case"ctx":this.ctx=t;break}}function jh(e,t,r,n,o){if(o||(o=0),n||(n=0),n<this.field.length){let i=this.field[n],s=this.index[i];t=this,setTimeout(function(){s.export(e,t,o?i:"",n,o++)||(n++,o=1,t.export(e,t,i,n,o))})}else{let i,s;switch(o){case 1:i="tag",s=this.tagindex;break;case 2:i="store",s=this.store;break;default:return}kh(e,this,r,i,n,o,s)}}function Lh(e,t){if(t)switch(fe(t)&&(t=JSON.parse(t)),e){case"tag":this.tagindex=t;break;case"reg":this.fastupdate=!1,this.register=t;for(let n=0,o;n<this.field.length;n++)o=this.index[this.field[n]],o.register=t,o.fastupdate=!1;break;case"store":this.store=t;break;default:e=e.split(".");let r=e[0];e=e[1],r&&e&&this.index[r].import(e,t)}}function _e(e,t){if(!(this instanceof _e))return new _e(e);let r,n,o;e?(!0&&(e=Ha(e)),r=e.charset,n=e.lang,fe(r)&&(r.indexOf(":")===-1&&(r+=":default"),r=Rh[r]),fe(n)&&(n=Ah[n])):e={};let i,s,a=e.context||{};this.encode=e.encode||r&&r.encode||Ga,this.register=t||H(),this.resolution=i=e.resolution||9,this.tokenize=o=r&&r.tokenize||e.tokenize||"strict",this.depth=o==="strict"&&a.depth,this.bidirectional=Tr(a.bidirectional,!0),this.optimize=s=Tr(e.optimize,!0),this.fastupdate=Tr(e.fastupdate,!0),this.minlength=e.minlength||1,this.boost=e.boost,this.map=s?za(i):H(),this.resolution_ctx=i=a.resolution||1,this.ctx=s?za(i):H(),this.rtl=r&&r.rtl||e.rtl,this.matcher=(o=e.matcher||n&&n.matcher)&&Ka(o,!1),this.stemmer=(o=e.stemmer||n&&n.stemmer)&&Ka(o,!0),this.filter=(o=e.filter||n&&n.filter)&&Nh(o),!0&&(this.cache=(o=e.cache)&&new $i(o))}var ji=_e;_e.prototype.append=function(e,t){return this.add(e,t,!0)};_e.prototype.add=function(e,t,r,n){if(t&&(e||e===0)){if(!n&&!r&&this.register[e])return this.update(e,t);t=this.encode(""+t);let o=t.length;if(o){let i=H(),s=H(),a=this.depth,u=this.resolution;for(let m=0;m<o;m++){let l=t[this.rtl?o-1-m:m],d=l.length;if(l&&d>=this.minlength&&(a||!s[l])){let f=ki(u,o,m),g="";switch(this.tokenize){case"full":if(d>2){for(let w=0;w<d;w++)for(let x=d;x>w;x--)if(x-w>=this.minlength){let S=ki(u,o,m,d,w);g=l.substring(w,x),this.push_index(s,g,S,e,r)}break}case"reverse":if(d>1){for(let w=d-1;w>0;w--)if(g=l[w]+g,g.length>=this.minlength){let x=ki(u,o,m,d,w);this.push_index(s,g,x,e,r)}g=""}case"forward":if(d>1){for(let w=0;w<d;w++)g+=l[w],g.length>=this.minlength&&this.push_index(s,g,f,e,r);break}default:if(this.boost&&(f=Math.min(f/this.boost(t,l,m)|0,u-1)),this.push_index(s,l,f,e,r),a&&o>1&&m<o-1){let w=H(),x=this.resolution_ctx,S=l,N=Math.min(a+1,o-m);w[S]=1;for(let M=1;M<N;M++)if(l=t[this.rtl?o-1-m-M:m+M],l&&l.length>=this.minlength&&!w[l]){w[l]=1;let k=ki(x+(o/2>x?0:1),o,m,N-1,M-1),ee=this.bidirectional&&l>S;this.push_index(i,ee?S:l,k,e,r,ee?l:S)}}}}}this.fastupdate||(this.register[e]=1)}}return this};function ki(e,t,r,n,o){return r&&e>1?t+(n||0)<=e?r+(o||0):(e-1)/(t+(n||0))*(r+(o||0))+1|0:0}_e.prototype.push_index=function(e,t,r,n,o,i){let s=i?this.ctx:this.map;if((!e[t]||i&&!e[t][i])&&(this.optimize&&(s=s[r]),i?(e=e[t]||(e[t]=H()),e[i]=1,s=s[i]||(s[i]=H())):e[t]=1,s=s[t]||(s[t]=[]),this.optimize||(s=s[r]||(s[r]=[])),(!o||!s.includes(n))&&(s[s.length]=n,this.fastupdate))){let a=this.register[n]||(this.register[n]=[]);a[a.length]=s}};_e.prototype.search=function(e,t,r){r||(!t&&Ve(e)?(r=e,e=r.query):Ve(t)&&(r=t));let n=[],o,i,s,a=0;if(r&&(e=r.query||e,t=r.limit,a=r.offset||0,i=r.context,s=!0&&r.suggest),e&&(e=this.encode(""+e),o=e.length,o>1)){let d=H(),f=[];for(let g=0,w=0,x;g<o;g++)if(x=e[g],x&&x.length>=this.minlength&&!d[x]){if(!this.optimize&&!s&&!this.map[x])return n;f[w++]=x,d[x]=1}e=f,o=e.length}if(!o)return n;t||(t=100);let u=this.depth&&o>1&&i!==!1,m=0,l;u?(l=e[0],m=1):o>1&&e.sort(Oh);for(let d,f;m<o;m++){if(f=e[m],u?(d=this.add_result(n,s,t,a,o===2,f,l),(!s||d!==!1||!n.length)&&(l=f)):d=this.add_result(n,s,t,a,o===1,f),d)return d;if(s&&m===o-1){let g=n.length;if(g){if(g===1)return Uh(n[0],t,a)}else{if(u){u=0,m=-1;continue}return n}}}return Ri(n,t,a,s)};_e.prototype.add_result=function(e,t,r,n,o,i,s){let a=[],u=s?this.ctx:this.map;if(this.optimize||(u=Bh(u,i,s,this.bidirectional)),u){let m=0,l=Math.min(u.length,s?this.resolution_ctx:this.resolution);for(let d=0,f=0,g,w;d<l&&(g=u[d],!(g&&(this.optimize&&(g=Bh(g,i,s,this.bidirectional)),n&&g&&o&&(w=g.length,w<=n?(n-=w,g=null):(g=g.slice(n),n=0)),g&&(a[m++]=g,o&&(f+=g.length,f>=r)))));d++);if(m){if(o)return Uh(a,r,0);e[e.length]=a;return}}return!t&&a};function Uh(e,t,r){return e.length===1?e=e[0]:e=Sh(e),r||e.length>t?e.slice(r,r+t):e}function Bh(e,t,r,n){if(r){let o=n&&t>r;e=e[o?t:r],e=e&&e[o?r:t]}else e=e[t];return e}_e.prototype.contain=function(e){return!!this.register[e]};_e.prototype.update=function(e,t){return this.remove(e).add(e,t)};_e.prototype.remove=function(e,t){let r=this.register[e];if(r){if(this.fastupdate)for(let n=0,o;n<r.length;n++)o=r[n],o.splice(o.indexOf(e),1);else Mi(this.map,e,this.resolution,this.optimize),this.depth&&Mi(this.ctx,e,this.resolution_ctx,this.optimize);t||delete this.register[e],!0&&this.cache&&this.cache.del(e)}return this};function Mi(e,t,r,n,o){let i=0;if(rr(e))if(o){let s=e.indexOf(t);s!==-1?e.length>1&&(e.splice(s,1),i++):i++}else{o=Math.min(e.length,r);for(let s=0,a;s<o;s++)a=e[s],a&&(i=Mi(a,t,r,n,o),!n&&!i&&delete e[s])}else for(let s in e)i=Mi(e[s],t,r,n,o),i||delete e[s];return i}!0&&(_e.prototype.searchCache=Pi);!0&&(_e.prototype.export=Mh,_e.prototype.import=qh);!0&&Ai(_e.prototype);function zh(e){e=e.data;let t=self._index,r=e.args,n=e.task;switch(n){case"init":let o=e.options||{},i=e.factory,s=o.encode;o.cache=!1,s&&s.indexOf("function")===0&&(o.encode=Function("return "+s)()),i?(Function("return "+i)()(self),self._index=new self.FlexSearch.Index(o),delete self.FlexSearch):self._index=new ji(o);break;default:let a=e.id,u=t[n].apply(t,r);postMessage(n==="search"?{id:a,msg:u}:{id:a})}}var Wh=0;function Hn(e){if(!(this instanceof Hn))return new Hn(e);let t;e?Kn(t=e.encode)&&(e.encode=t.toString()):e={};let r=(self||window)._factory;r&&(r=r.toString());let n=typeof window>"u"&&self.exports,o=this;this.worker=BI(r,n,e.worker),this.resolver=H(),this.worker&&(n?this.worker.on("message",function(i){o.resolver[i.id](i.msg),delete o.resolver[i.id]}):this.worker.onmessage=function(i){i=i.data,o.resolver[i.id](i.msg),delete o.resolver[i.id]},this.worker.postMessage({task:"init",factory:r,options:e}))}var Kh=Hn;Jn("add");Jn("append");Jn("search");Jn("update");Jn("remove");function Jn(e){Hn.prototype[e]=Hn.prototype[e+"Async"]=function(){let t=this,r=[].slice.call(arguments),n=r[r.length-1],o;Kn(n)&&(o=n,r.splice(r.length-1,1));let i=new Promise(function(s){setTimeout(function(){t.resolver[++Wh]=s,t.worker.postMessage({task:e,id:Wh,args:r})})});return o?(i.then(o),this):i}}function BI(factory,is_node_js,worker_path){let worker;try{worker=is_node_js?eval(\'new (require("worker_threads")["Worker"])("../dist/node/node.js")\'):factory?new Worker(URL.createObjectURL(new Blob(["onmessage="+zh.toString()],{type:"text/javascript"}))):new Worker(fe(worker_path)?worker_path:"worker/worker.js",{type:"module"})}catch(e){}return worker}function Te(e){if(!(this instanceof Te))return new Te(e);let t=e.document||e.doc||e,r;this.tree=[],this.field=[],this.marker=[],this.register=H(),this.key=(r=t.key||t.id)&&Li(r,this.marker)||"id",this.fastupdate=Tr(e.fastupdate,!0),!0&&(this.storetree=(r=t.store)&&r!==!0&&[],this.store=r&&H()),!0&&(this.tag=(r=t.tag)&&Li(r,this.marker),this.tagindex=r&&H()),!0&&(this.cache=(r=e.cache)&&new $i(r),e.cache=!1),!0&&(this.worker=e.worker),!0&&(this.async=!1),this.index=UI.call(this,e,t)}var Hh=Te;function UI(e,t){let r=H(),n=t.index||t.field||t;fe(n)&&(n=[n]);for(let o=0,i,s;o<n.length;o++)i=n[o],fe(i)||(s=i,i=i.field),s=Ve(s)?Object.assign({},e,s):e,!0&&this.worker&&(r[i]=new Kh(s),r[i].worker||(this.worker=!1)),this.worker||(r[i]=new ji(s,this.register)),this.tree[o]=Li(i,this.marker),this.field[o]=i;if(!0&&this.storetree){let o=t.store;fe(o)&&(o=[o]);for(let i=0;i<o.length;i++)this.storetree[i]=Li(o[i],this.marker)}return r}function Li(e,t){let r=e.split(":"),n=0;for(let o=0;o<r.length;o++)e=r[o],e.indexOf("[]")>=0&&(e=e.substring(0,e.length-2),e&&(t[n]=!0)),e&&(r[n++]=e);return n<r.length&&(r.length=n),n>1?r:r[0]}function Va(e,t){if(fe(t))e=e[t];else for(let r=0;e&&r<t.length;r++)e=e[t[r]];return e}function Ya(e,t,r,n,o){if(e=e[o],n===r.length-1)t[o]=e;else if(e)if(rr(e)){t=t[o]=new Array(e.length);for(let i=0;i<e.length;i++)Ya(e,t,r,n,i)}else t=t[o]||(t[o]=H()),o=r[++n],Ya(e,t,r,n,o)}function Za(e,t,r,n,o,i,s,a){if(e=e[s],e)if(n===t.length-1){if(rr(e)){if(r[n]){for(let u=0;u<e.length;u++)o.add(i,e[u],!0,!0);return}e=e.join(" ")}o.add(i,e,a,!0)}else if(rr(e))for(let u=0;u<e.length;u++)Za(e,t,r,n,o,i,u,a);else s=t[++n],Za(e,t,r,n,o,i,s,a)}Te.prototype.add=function(e,t,r){if(Ve(e)&&(t=e,e=Va(t,this.key)),t&&(e||e===0)){if(!r&&this.register[e])return this.update(e,t);for(let n=0,o,i;n<this.field.length;n++)i=this.field[n],o=this.tree[n],fe(o)&&(o=[o]),Za(t,o,this.marker,0,this.index[i],e,o[0],r);if(!0&&this.tag){let n=Va(t,this.tag),o=H();fe(n)&&(n=[n]);for(let i=0,s,a;i<n.length;i++)if(s=n[i],!o[s]&&(o[s]=1,a=this.tagindex[s]||(this.tagindex[s]=[]),(!r||!a.includes(e))&&(a[a.length]=e,this.fastupdate))){let u=this.register[e]||(this.register[e]=[]);u[u.length]=a}}if(!0&&this.store&&(!r||!this.store[e])){let n;if(this.storetree){n=H();for(let o=0,i;o<this.storetree.length;o++)i=this.storetree[o],fe(i)?n[i]=t[i]:Ya(t,n,i,0,i[0])}this.store[e]=n||t}}return this};Te.prototype.append=function(e,t){return this.add(e,t,!0)};Te.prototype.update=function(e,t){return this.remove(e).add(e,t)};Te.prototype.remove=function(e){if(Ve(e)&&(e=Va(e,this.key)),this.register[e]){for(let t=0;t<this.field.length&&(this.index[this.field[t]].remove(e,!this.worker),!this.fastupdate);t++);if(!0&&this.tag&&!this.fastupdate)for(let t in this.tagindex){let r=this.tagindex[t],n=r.indexOf(e);n!==-1&&(r.length>1?r.splice(n,1):delete this.tagindex[t])}!0&&this.store&&delete this.store[e],delete this.register[e]}return this};Te.prototype.search=function(e,t,r,n){r||(!t&&Ve(e)?(r=e,e=""):Ve(t)&&(r=t,t=0));let o=[],i=[],s,a,u,m,l,d,f=0;if(r)if(rr(r))u=r,r=null;else{if(e=r.query||e,s=r.pluck,u=s||r.index||r.field,m=!0&&r.tag,a=!0&&this.store&&r.enrich,l=r.bool==="and",t=r.limit||t||100,d=r.offset||0,m&&(fe(m)&&(m=[m]),!e)){for(let w=0,x;w<m.length;w++)x=zI.call(this,m[w],t,d,a),x&&(o[o.length]=x,f++);return f?o:[]}fe(u)&&(u=[u])}u||(u=this.field),l=l&&(u.length>1||m&&m.length>1);let g=!n&&(this.worker||this.async)&&[];for(let w=0,x,S,N;w<u.length;w++){let M;if(S=u[w],fe(S)||(M=S,S=M.field,e=M.query||e,t=M.limit||t),g){g[w]=this.index[S].searchAsync(e,t,M||r);continue}else n?x=n[w]:x=this.index[S].search(e,t,M||r);if(N=x&&x.length,m&&N){let k=[],ee=0;l&&(k[0]=[x]);for(let xe=0,A,B;xe<m.length;xe++)A=m[xe],B=this.tagindex[A],N=B&&B.length,N&&(ee++,k[k.length]=l?[B]:B);ee&&(l?x=Ri(k,t||100,d||0):x=Fh(x,k),N=x.length)}if(N)i[f]=S,o[f++]=x;else if(l)return[]}if(g){let w=this;return new Promise(function(x){Promise.all(g).then(function(S){x(w.search(e,t,r,S))})})}if(!f)return[];if(s&&(!a||!this.store))return o[0];for(let w=0,x;w<i.length;w++){if(x=o[w],x.length&&a&&(x=Jh.call(this,x)),s)return x;o[w]={field:i[w],result:x}}return o};function zI(e,t,r,n){let o=this.tagindex[e],i=o&&o.length-r;if(i&&i>0)return(i>t||r)&&(o=o.slice(r,r+t)),n&&(o=Jh.call(this,o)),{tag:e,result:o}}function Jh(e){let t=new Array(e.length);for(let r=0,n;r<e.length;r++)n=e[r],t[r]={id:n,doc:this.store[n]};return t}Te.prototype.contain=function(e){return!!this.register[e]};!0&&(Te.prototype.get=function(e){return this.store[e]},Te.prototype.set=function(e,t){return this.store[e]=t,this});!0&&(Te.prototype.searchCache=Pi);!0&&(Te.prototype.export=jh,Te.prototype.import=Lh);!0&&Ai(Te.prototype);var WI=["a","about","above","after","again","against","all","also","am","an","and","any","are","aren\'t","as","at","be","because","been","before","being","below","both","but","by","can","cannot","can\'t","come","could","couldn\'t","did","didn\'t","do","does","doesn\'t","doing","dont","down","during","each","even","few","first","for","from","further","get","go","had","hadn\'t","has","hasn\'t","have","haven\'t","having","he","hed","her","here","here\'s","hers","herself","hes","him","himself","his","how","how\'s","i","id","if","ill","im","in","into","is","isn\'t","it","it\'s","itself","i\'ve","just","know","let\'s","like","make","me","more","most","mustn\'t","my","myself","new","no","nor","not","now","of","off","on","once","only","or","other","ought","our","our\'s","ourselves","out","over","own","same","say","see","shan\'t","she","she\'d","shell","shes","should","shouldn\'t","so","some","such","than","that","that\'s","the","their","theirs","them","themselves","then","there","there\'s","these","they","they\'d","they\'ll","they\'re","they\'ve","this","those","through","time","to","too","until","up","us","very","want","was","wasn\'t","way","we","wed","well","were","weren\'t","we\'ve","what","what\'s","when","when\'s","where","where\'s","which","while","who","whom","who\'s","why","why\'s","will","with","won\'t","would","wouldn\'t","you","you\'d","you\'ll","your","you\'re","your\'s","yourself","yourselves","you\'ve"],KI={ational:"ate",iveness:"ive",fulness:"ful",ousness:"ous",ization:"ize",tional:"tion",biliti:"ble",icate:"ic",ative:"",alize:"al",iciti:"ic",entli:"ent",ousli:"ous",alism:"al",ation:"ate",aliti:"al",iviti:"ive",ement:"",enci:"ence",anci:"ance",izer:"ize",alli:"al",ator:"ate",logi:"log",ical:"ic",ance:"",ence:"",ness:"",able:"",ible:"",ment:"",eli:"e",bli:"ble",ful:"",ant:"",ent:"",ism:"",ate:"",iti:"",ous:"",ive:"",ize:"",al:"",ou:"",er:"",ic:""},GI={},Vh={filter:WI,stemmer:KI,matcher:GI};function Yh(){let e,t,r=new Promise((n,o)=>{e=n,t=o});return{resolve:e,reject:t,promise:r}}var Vn=class{#e=Ar;readCitekeys(t){if(ae.debug("Reading Better BibTex database"),!this.#e.bbtLoadStatus)return ae.info("Better BibTex database not enabled, skipping..."),[];let r=this.#e.getCitekeys(t);return ae.info("Finished reading Better BibTex"),r}toItemObjects(t,r){let n=this.readCitekeys(r),o=this.#e.zotero.prepare(un).query(r),i=this.#e.zotero.prepare(an).query(r),s=Eh(r.flatMap(([u])=>t[u]?.collectionIDs?.map(m=>`${m}-${t[u].libraryID}`)??[])).filter(u=>u!==null),a=this.#e.zotero.prepare(dn).query(s.map(u=>u.split("-").map(m=>+m)));return r.reduce((u,[m,l])=>{if(!m)return u;let d=n[m];d||ae.warn(`Citekey: No item found for itemID ${m}`,d);let f=o[m].reduce((N,M)=>{let{value:k}=M;return M.fieldName==="date"&&(k=nl(k).split("-")[0]),(N[M.fieldName]??=[]).push(k),N},{}),{collectionIDs:g,...w}=t[m],x=g.map(N=>a.get(N)).filter(N=>N!==void 0),S={...w,libraryID:l,groupID:this.#e.groupOf(l),itemID:m,creators:i[m],collections:x,citekey:n[m],...f,dateAccessed:HI(f)?JI(f.accessDate[0]):null};return u[m]=S,u},{})}};function HI(e){let t=e;return Array.isArray(t.accessDate)&&t.accessDate.length===1&&typeof t.accessDate[0]=="string"}function JI(e){let t=e.replace(" ","T")+"Z";try{return new Date(t)}catch{return null}}var Yn=class{#e=Ar;#t=new Vn;#r=new Hh({worker:!0,charset:Ch,language:Vh,document:{id:"itemID",index:["title","creators[]:firstName","creators[]:lastName","date"]},tokenize:"full",suggest:!0});#o=new Map;#n=new Map;getStatus(t){if(!this.#n.has(t)){let n=Yh();return this.#n.set(t,n),n.promise}let r=this.#n.get(t);return r instanceof Promise||typeof r=="string"?r:r.promise}load(t){let r=this.#n.get(t);if(r instanceof Promise)return r;let n=this.#a(t),o=this.#u(t,n).then(()=>{this.#n.set(t,"READY")}).catch(i=>{throw this.#n.set(t,"ERROR"),i});return typeof r=="string"||!r||o.then(r.resolve,r.reject),this.#n.set(t,o),o}async searchItems(t,r){return await this.#i(t),await this.#r.searchAsync(r)}async getCachedItems(t,r){await this.#i(r);let n=this.#o.get(r);if(!n)throw new Error("Cache not initialized");let o=[...n.byId.values()].sort((i,s)=>s.dateAccessed&&i.dateAccessed?s.dateAccessed.getTime()-i.dateAccessed.getTime():0);return t<=0?o:o.slice(0,t)}async getItemsCache(t){await this.#i(t);let r=this.#o.get(t);if(!r)throw new Error("Cache not initialized");return r}async#i(t){let r=this.getStatus(t);if(r==="ERROR")throw new Error("Indexing failed");r instanceof Promise&&await r}#a(t){ae.debug("Reading main Zotero database for index");let{zotero:r}=this.#e,n=this.#s(r.prepare(ln).query({libId:t}));return ae.info("Finished reading main Zotero database for index"),n}readItemByKey(t){let{zotero:r}=this.#e,n=r.prepare(pn).query(t);return this.#s(t.map(([i])=>n[i]))}readItemById(t){let{zotero:r}=this.#e,n=r.prepare(fn).query(t);return this.#s(t.map(([i])=>n[i]))}#s(t){let r=t.reduce((o,i)=>(o[i.itemID]=i,o),{}),n=t.map(o=>[o.itemID,o.libraryID]);return this.#t.toItemObjects(r,n)}async#u(t,r){ae.trace("Start flexsearch indexing");let n=Object.values(r),o=this.#o.get(t);if(this.#o.set(t,{byId:new Map(n.map(i=>[i.itemID,i])),byKey:new Map(n.map(i=>[Ls(i,!0),i]))}),!o)await Promise.all([...n.map(i=>this.#r.addAsync(i.itemID,i))]);else{let i=new Set(n.map(a=>a.itemID)),s=[...o.byId.keys()].filter(a=>!i.has(a));o.byId.clear(),o.byKey.clear(),await Promise.all([...n.map(a=>this.#r.addAsync(a.itemID,a)),...s.map(a=>this.#r.removeAsync(a))])}ae.info("Library citation index done: "+t)}async updateIndex(t){await Promise.all(Object.values(t).map(async r=>{let n=this.#o.get(r.libraryID);if(!n)throw new Error("Cannot update index for library not initialized");n.byId.set(r.itemID,r),n.byKey.set(Ls(r,!0),r),await this.#r.updateAsync(r.itemID,r)}))}};var Ar=new Un,Ci=new Yn,Zh=new zn;function nr(e,t){return(...r)=>{ae.debug(`Reading Zotero database for ${typeof t=="string"?t:t(null,...r)}`);let n=e.apply(null,r);return Promise.resolve(n).then(o=>ae.debug(`Finished reading Zotero database for ${typeof t=="string"?t:t(o,...r)}`)),n}}var Qa=class{#e=Ar;#t=Ci;#r=Zh;api={getLibs:()=>this.#e.libraries,initIndex:async t=>{await this.#t.load(t)},openDb:(...t)=>this.#e.load(...t),search:async(t,r)=>await this.#t.searchItems(t,r),getItems:async(t,r)=>await this.#r.get(t,r),getTags:nr(t=>this.#e.zotero.prepare(gn).query(t),"tags"),getItemIDsFromCitekey:t=>this.#e.getItemIDsFromCitekey(t),getItemsFromCache:(t,r)=>this.#t.getCachedItems(t,r),getAttachments:nr((t,r)=>this.#e.zotero.prepare(tn).query({itemId:t,libId:r}),(t,r)=>`attachments of item ${r}`+(t?`, count: ${t.length}`:"")),getAnnotations:nr((t,r)=>this.#e.zotero.prepare(Qr).query({attachmentId:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`annotations of attachment ${r}`+(t?`, count: ${t.length}`:"")),getAnnotFromKey:nr((t,r)=>this.#e.zotero.prepare(Zr).query({annotKeys:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`annotations with keys: ${r.join(",")}`+(t?`, count: ${t.length}`:"")),getNotes:nr((t,r)=>this.#e.zotero.prepare(en).query({itemID:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`notes of literature ${r}`+(t?`, count: ${t.length}`:"")),getNoteFromKey:nr((t,r)=>this.#e.zotero.prepare(Xr).query({noteKeys:t,libId:r,groupID:this.#e.groupOf(r)}),(t,r)=>`notes with keys: ${r.join(",")}`+(t?`, count: ${t.length}`:"")),isUpToDate:()=>this.#e.zotero.isUpToDate(),getLoadStatus:()=>{let t=this.#e.loadStatus;return{main:t.main,bbt:this.#e.bbtLoadStatus,bbtVersion:t.bbtSearch===null?"v1":"v0"}},raw:(t,r,n)=>{let{zotero:{instance:o}}=this.#e;if(!o)throw new Error("failed to query raw: no main database opened");return o.prepare(r)[t](...n)},setLoglevel:t=>{ae.level=t,Qh.default.setItem(Ma,t)}};toAPI(){return al(this.api)}},VI=new Qa;new Yr(VI.toAPI());\n/*! Bundled license information:\n\nlocalforage/dist/localforage.js:\n (*!\n localForage -- Offline Storage, Improved\n Version 1.10.0\n https://localforage.github.io/localForage\n (c) 2013-2017 Mozilla, Apache License 2.0\n *)\n\nflatted/cjs/index.js:\n (*! (c) 2020 Andrea Giammarchi *)\n*/\n';var wh=class extends bi{initWebWorker(){return E1(r_,{name:"zotlit database worker"})}},sl=class extends vi{workerCtor(){return new wh}};var Rt=class extends ue{settings=this.use(de);app=this.use(Cn.App);plugin=this.use(be);server=this.use(Ur);get zoteroDataDir(){return this.settings.current?.zoteroDataDir}onload(){W.debug("loading DatabaseWorker"),this.settings.once(async()=>{let t=(0,Cn.debounce)(()=>this.refresh({task:"dbConn"}),500,!0);this.registerEvent(this.app.vault.on("zotero:db-updated",()=>t()));let r=process.hrtime();await this.initialize(),W.debug(`ZoteroDB Initialization complete. Took ${(0,n_.default)(process.hrtime(r))}`);let n=this.genAutoRefresh(this.plugin);this.registerEvent(this.server.on("bg:notify",async(o,i)=>{i.event==="regular-item/update"&&n(i)})),this.plugin.addCommand({id:"refresh-zotero-data",name:"Refresh Zotero data",callback:async()=>{await this.refresh({task:"full"})}}),this.plugin.addCommand({id:"refresh-zotero-search-index",name:"Refresh Zotero search index",callback:async()=>{await this.refresh({task:"searchIndex"})}})}),this.register(qe(Qe(async()=>{this.status===0?await this.initialize():await this.refresh({task:"full"})},()=>this.zoteroDataDir))),this.register(qe(Qe(async()=>{await this.refresh({task:"searchIndex",force:!0}),new Cn.Notice("Zotero search index updated.")},()=>this.settings.libId,!0)))}genAutoRefresh(t){let r=!1,n=null,o=()=>{n&&(W.debug("unregistering db refresh watcher"),n(),n=null)},i=(0,Cn.debounce)(async()=>{if(o(),W.debug("Auto Refreshing Zotero Search Index"),!r){r=!1;try{W.debug("Db not refreshed, waiting before auto refresh");let[s]=Dm(t.app,{timeout:1e4});await s}catch(s){if(s instanceof js){W.warn("no db refreshed event received in 10s, skip refresh search index");return}else{console.error("error while waiting for db refresh during execute",s);return}}}await this.refresh({task:"searchIndex",force:!0}),W.debug("Auto Refreshing Zotero Search Index Success")},5e3,!0);return s=>{if(W.debug(`Request to auto refresh search index: (refreshed ${r})`,s),i(),o(),r)return;W.debug("watching db refresh while waiting for search index auto refresh");let[a,u]=Dm(t.app,{timeout:null});n=u,a.then(()=>{W.debug("db refresh while requesting auto refresh search index"),r=!0,n=null}).catch(l=>{l instanceof Ls||console.error("error while waiting for db refresh during request",l)})}}async onunload(){await this.#e.terminate(),this.#t=0,this.#o=null}#e=new sl({minWorkers:1,maxWorkers:1});get api(){return this.#e.proxy}#t=0;get status(){return this.#t}#r=null;async#n(t){let r=this.settings.libId;return!t&&this.#r===r?(W.debug(`Skipping search index init, lib ${r} already indexed`),!1):(await this.api.initIndex(r),this.#r=r,W.debug(`Search index init complete for lib ${r}`),!0)}async#i(){let[t,r]=this.settings.dbConnParams,{main:n,bbtMain:o,bbtSearch:i}=await this.api.openDb(t,r);if((!o||i===!1)&&W.debug("Failed to open Better BibTeX database, skipping..."),!n)throw new Error("Failed to init ZoteroDB")}async initialize(){if(this.#t!==0)throw new Error("Calling init on already initialized db, use refresh instead");await this.#i(),this.app.vault.trigger("zotero:db-ready"),await this.#n(!0),this.app.metadataCache.trigger("zotero:search-ready"),W.info("ZoteroDB Initialization complete."),this.#t=2}#s=null;#o=null;refresh(t){if(this.#t===0)return Promise.reject(new Error("Calling refresh on uninitialized database"));if(this.#t===2){this.#t=1;let r=(async()=>{t.task==="dbConn"?await this.#a():t.task==="searchIndex"?await this.#u(t.force):t.task==="full"?await this.#c():(0,Eh.assertNever)(t),this.#t=2;let n=this.#o;n&&(this.#o=null,await this.refresh(n))})();return this.#s=r}else{if(this.#t===1)return this.#s?(this.#o=this.#l(t),this.#s):Promise.reject(new Error("Other task in pending state"));(0,Eh.assertNever)(this.#t)}}async#a(){await this.#i(),this.app.vault.trigger("zotero:db-refresh")}async#u(t=!1){await this.#n(t)&&this.app.metadataCache.trigger("zotero:search-refresh")}async#c(){await this.#a(),await this.#u(!0),new Cn.Notice("ZoteroDB Refresh complete.")}#l(t){if(!this.#o)return t;let r=this.#o;return r.task==="full"?r:r.task===t.task?r.task==="searchIndex"?{...r,force:r.force||t.force}:r:{task:"full"}}};le([fe],Rt.prototype,"zoteroDataDir",1);var o_="INFO",i_="log4js_loglevel",Cz=()=>{let e=localStorage.getItem(i_);return typeof e=="string"&&e in al.levels?(console.debug(`Read from localstorage: loglevel ${e}`),e):o_},Sh=Xv("main",Cz(),al.default),W=Sh,it=(e,t,...r)=>{if(!t){Sh.error(e,...r);return}Sh.error(e,t instanceof Error?t.message:String(t),...r),console.error(t)},h1={logLevel:o_},na=class extends ue{settings=this.use(de);get level(){return this.settings.current?.logLevel}async applyLogLevel(){localStorage.setItem(i_,this.level),await this.use(Rt).api.setLoglevel(this.level)}onload(){this.register(qe(Qe(()=>this.applyLogLevel(),()=>this.level)))}};le([fe],na.prototype,"level",1);var qC=require("fs"),Jr=require("obsidian");S();var ve={},Ii=Symbol(),uC=e=>!!e[Ii],iC=e=>!e[Ii].c,ca=e=>{var t;let{b:r,c:n}=e[Ii];n&&(n(),(t=Kz.get(r))==null||t())},gl=(e,t)=>{let r=e[Ii].o,n=t[Ii].o;return r===n||e===n||uC(r)&&gl(r,t)},sC=(e,t)=>{let r={b:e,o:t,c:null},n=new Promise(o=>{r.c=()=>{r.c=null,o()},t.finally(r.c)});return n[Ii]=r,n},Kz=new WeakMap;var hl=e=>"init"in e,jh="r",Lh="w",la="c",qh="s",aC="h",Vz="n",Gz="l",Jz="a",Zz="m",Yz=e=>{let t=new WeakMap,r=new WeakMap,n=new Map,o,i;if((ve.env&&ve.env.MODE)!=="production"&&(o=new Set,i=new Set),e)for(let[E,x]of e){let O={v:x,r:0,y:!0,d:new Map};(ve.env&&ve.env.MODE)!=="production"&&(Object.freeze(O),hl(E)||console.warn("Found initial value for derived atom which can cause unexpected behavior",E)),t.set(E,O)}let s=new WeakMap,a=(E,x,O)=>{let A=s.get(x);A||(A=new Map,s.set(x,A)),O.then(()=>{A.get(E)===O&&(A.delete(E),A.size||s.delete(x))}),A.set(E,O)},u=E=>{let x=new Set,O=s.get(E);return O&&(s.delete(E),O.forEach((A,k)=>{ca(A),x.add(k)})),x},l=new WeakMap,c=E=>{let x=l.get(E);return x||(x=new Map,l.set(E,x)),x},f=(E,x)=>{if(E){let O=c(E),A=O.get(x);return A||(A=f(E.p,x),A&&"p"in A&&iC(A.p)&&(A=void 0),A&&O.set(x,A)),A}return t.get(x)},p=(E,x,O)=>{if((ve.env&&ve.env.MODE)!=="production"&&Object.freeze(O),E)c(E).set(x,O);else{let A=t.get(x);t.set(x,O),n.has(x)||n.set(x,A)}},d=(E,x=new Map,O)=>{if(!O)return x;let A=new Map,k=!1;return O.forEach(N=>{var z;let te=((z=f(E,N))==null?void 0:z.r)||0;A.set(N,te),x.get(N)!==te&&(k=!0)}),x.size===A.size&&!k?x:A},h=(E,x,O,A,k)=>{let N=f(E,x);if(N){if(k&&(!("p"in N)||!gl(N.p,k)))return N;"p"in N&&ca(N.p)}let z={v:O,r:N?.r||0,y:!0,d:d(E,N?.d,A)},te=!N?.y;return!N||!("v"in N)||!Object.is(N.v,O)?(te=!0,++z.r,z.d.has(x)&&(z.d=new Map(z.d).set(x,z.r))):z.d!==N.d&&(z.d.size!==N.d.size||!Array.from(z.d.keys()).every(vr=>N.d.has(vr)))&&(te=!0,Promise.resolve().then(()=>{D(E)})),N&&!te?N:(p(E,x,z),z)},b=(E,x,O,A,k)=>{let N=f(E,x);if(N){if(k&&(!("p"in N)||!gl(N.p,k)))return N;"p"in N&&ca(N.p)}let z={e:O,r:(N?.r||0)+1,y:!0,d:d(E,N?.d,A)};return p(E,x,z),z},y=(E,x,O,A)=>{let k=f(E,x);if(k&&"p"in k){if(gl(k.p,O))return k.y?k:{...k,y:!0};ca(k.p)}a(E,x,O);let N={p:O,r:(k?.r||0)+1,y:!0,d:d(E,k?.d,A)};return p(E,x,N),N},v=(E,x,O,A)=>{if(O instanceof Promise){let k=sC(O,O.then(N=>{h(E,x,N,A,k)}).catch(N=>{if(N instanceof Promise)return uC(N)?N.then(()=>{T(E,x,!0)}):N;b(E,x,N,A,k)}));return y(E,x,k,A)}return h(E,x,O,A)},w=(E,x)=>{let O=f(E,x);if(O){let A={...O,y:!1};p(E,x,A)}else(ve.env&&ve.env.MODE)!=="production"&&console.warn("[Bug] could not invalidate non existing atom",x)},T=(E,x,O)=>{if(!O){let k=f(E,x);if(k){if(k.y&&"p"in k&&!iC(k.p))return k;if(k.d.forEach((N,z)=>{if(z!==x)if(!r.has(z))T(E,z);else{let te=f(E,z);te&&!te.y&&T(E,z)}}),Array.from(k.d).every(([N,z])=>{let te=f(E,N);return te&&!("p"in te)&&te.r===z}))return k.y?k:{...k,y:!0}}}let A=new Set;try{let k=x.read(N=>{A.add(N);let z=N===x?f(E,N):T(E,N);if(z){if("e"in z)throw z.e;if("p"in z)throw z.p;return z.v}if(hl(N))return N.init;throw new Error("no atom init")});return v(E,x,k,A)}catch(k){if(k instanceof Promise){let N=sC(k,k);return y(E,x,N,A)}return b(E,x,k,A)}},M=(E,x)=>T(x,E),V=(E,x)=>{let O=r.get(x);return O||(O=_(E,x)),O},J=(E,x)=>!x.l.size&&(!x.t.size||x.t.size===1&&x.t.has(E)),G=(E,x)=>{let O=r.get(x);O&&J(x,O)&&I(E,x)},K=(E,x)=>{let O=r.get(x);O?.t.forEach(A=>{A!==x&&(w(E,A),K(E,A))})},P=(E,x,O)=>{let A=!0,k=(te,vr)=>{let sr=T(E,te);if("e"in sr)throw sr.e;if("p"in sr){if(vr?.unstable_promise)return sr.p.then(()=>{let Fu=f(E,te);return Fu&&"p"in Fu&&Fu.p===sr.p?new Promise(wd=>setTimeout(wd)).then(()=>k(te,vr)):k(te,vr)});throw(ve.env&&ve.env.MODE)!=="production"&&console.info("Reading pending atom state in write operation. We throw a promise for now.",te),sr.p}if("v"in sr)return sr.v;throw(ve.env&&ve.env.MODE)!=="production"&&console.warn("[Bug] no value found while reading atom in write operation. This is probably a bug.",te),new Error("no value found")},N=(te,vr)=>{let sr;if(te===x){if(!hl(te))throw new Error("atom not writable");u(te).forEach(Tv=>{Tv!==E&&v(Tv,te,vr)});let wd=f(E,te),lj=v(E,te,vr);wd!==lj&&K(E,te)}else sr=P(E,te,vr);return A||D(E),sr},z=x.write(k,N,O);return A=!1,z},X=(E,x,O)=>{let A=P(O,E,x);return D(O),A},C=E=>!!E.write,_=(E,x,O)=>{let A={t:new Set(O&&[O]),l:new Set};if(r.set(x,A),(ve.env&&ve.env.MODE)!=="production"&&i.add(x),T(void 0,x).d.forEach((N,z)=>{let te=r.get(z);te?te.t.add(x):z!==x&&_(E,z,x)}),C(x)&&x.onMount){let N=te=>X(x,te,E),z=x.onMount(N);E=void 0,z&&(A.u=z)}return A},I=(E,x)=>{var O;let A=(O=r.get(x))==null?void 0:O.u;A&&A(),r.delete(x),(ve.env&&ve.env.MODE)!=="production"&&i.delete(x);let k=f(E,x);k?("p"in k&&ca(k.p),k.d.forEach((N,z)=>{if(z!==x){let te=r.get(z);te&&(te.t.delete(x),J(z,te)&&I(E,z))}})):(ve.env&&ve.env.MODE)!=="production"&&console.warn("[Bug] could not find atom state to unmount",x)},B=(E,x,O,A)=>{let k=new Set(O.d.keys());A?.forEach((N,z)=>{if(k.has(z)){k.delete(z);return}let te=r.get(z);te&&(te.t.delete(x),J(z,te)&&I(E,z))}),k.forEach(N=>{let z=r.get(N);z?z.t.add(x):r.has(x)&&_(E,N,x)})},D=E=>{if(E){c(E).forEach((O,A)=>{let k=t.get(A);if(O!==k){let N=r.get(A);N?.l.forEach(z=>z(E))}});return}for(;n.size;){let x=Array.from(n);n.clear(),x.forEach(([O,A])=>{let k=f(void 0,O);if(k&&k.d!==A?.d&&B(void 0,O,k,A?.d),A&&!A.y&&k?.y)return;let N=r.get(O);N?.l.forEach(z=>z())})}(ve.env&&ve.env.MODE)!=="production"&&o.forEach(x=>x())},re=E=>{c(E).forEach((O,A)=>{let k=t.get(A);(!k||O.r>k.r||O.y!==k.y||O.r===k.r&&O.d!==k.d)&&(t.set(A,O),O.d!==k?.d&&B(E,A,O,k?.d))})},oe=(E,x)=>{x&&re(x),D(void 0)},me=(E,x,O)=>{let k=V(O,E).l;return k.add(x),()=>{k.delete(x),G(O,E)}},ae=(E,x)=>{for(let[O,A]of E)hl(O)&&(v(x,O,A),K(x,O));D(x)};return(ve.env&&ve.env.MODE)!=="production"?{[jh]:M,[Lh]:X,[la]:oe,[qh]:me,[aC]:ae,[Vz]:E=>(o.add(E),()=>{o.delete(E)}),[Gz]:()=>i.values(),[Jz]:E=>t.get(E),[Zz]:E=>r.get(E)}:{[jh]:M,[Lh]:X,[la]:oe,[qh]:me,[aC]:ae}};var cC=(e,t)=>({s:t?t(e).SECRET_INTERNAL_store:Yz(e)}),Mh=new Map,Bh=e=>(Mh.has(e)||Mh.set(e,Le(cC())),Mh.get(e)),lC=({children:e,initialValues:t,scope:r,unstable_createStore:n,unstable_enableVersionedWrite:o})=>{let[i,s]=j({});U(()=>{let l=a.current;l.w&&(l.s[la](null,i),delete i.p,l.v=i)},[i]);let a=F();if(!a.current){let l=cC(t,n);if(o){let c=0;l.w=f=>{s(p=>{let d=c?p:{p};return f(d),d})},l.v=i,l.r=f=>{++c,f(),--c}}a.current=l}let u=Bh(r);return H(u.Provider,{value:a.current},e)},Xz=0;function Ft(e,t){let r=`atom${++Xz}`,n={toString:()=>r};return typeof e=="function"?n.read=e:(n.init=e,n.read=o=>o(n),n.write=(o,i,s)=>i(n,typeof s=="function"?s(o(n)):s)),t&&(n.write=t),n}function lt(e,t){let r=Bh(t),n=Q(r),{s:o,v:i}=n,s=p=>{let d=o[jh](e,p);if((ve.env&&ve.env.MODE)!=="production"&&!d.y)throw new Error("should not be invalidated");if("e"in d)throw d.e;if("p"in d)throw d.p;if("v"in d)return d.v;throw new Error("no atom value")},[[a,u,l],c]=Nr((p,d)=>{let h=s(d);return Object.is(p[1],h)&&p[2]===e?p:[d,h,e]},i,p=>{let d=s(p);return[p,d,e]}),f=u;return l!==e&&(c(a),f=s(a)),U(()=>{let{v:p}=n;p&&o[la](e,p);let d=o[qh](e,c,p);return c(p),d},[o,e,n]),U(()=>{o[la](e,a)}),go(f),f}function zh(e,t){let r=Bh(t),{s:n,w:o}=Q(r);return Y(s=>{if((ve.env&&ve.env.MODE)!=="production"&&!("write"in e))throw new Error("not writable atom");let a=u=>n[Lh](e,s,u);return o?o(a):a()},[n,o,e])}var jC=require("obsidian");S();var fC=()=>{let e=[];return{get:()=>e,set:(n,o)=>{e.push([n,o])}}};var Dr=Ft(null),Uh=Ft(e=>{let{arch:t,platform:r,modules:n}=e(Dr).platform;return`${r}-${t}-${n}.node.gz`}),fa=Ft(e=>`https://github.com/aidenlx/better-sqlite3/releases/download/${e(Dr).binaryVersion}/${e(Uh)}`),Bfe=Ft(e=>e(fa).replace("github.com","download.fastgit.org")),yl=Ft(e=>ai(e(Dr).manifest)),pC=Ft(e=>e(Dr).mode);var $C=ge(si(),1);S();var dC=function(e){return function(t,r){var n=F(!1);e(function(){return function(){n.current=!1}},[]),e(function(){if(!n.current)n.current=!0;else return t()},r)}};function On(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}S();var pa=function(e){return typeof e=="function"};var mC=function(e){return typeof e>"u"};var Qz=!1,hC=Qz;function e9(e){hC&&(pa(e)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof e)));var t=F(e);t.current=ne(function(){return e},[e]);var r=F();return r.current||(r.current=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return t.current.apply(this,n)}),r.current}var $t=e9;S();var gC=dC(U);var t9=!!(typeof window<"u"&&window.document&&window.document.createElement),yC=t9;S();function bC(e){function t(r,n){var o;try{o=e()}catch(p){console.error(p)}var i=function(p){return n?.serializer?n?.serializer(p):JSON.stringify(p)},s=function(p){return n?.deserializer?n?.deserializer(p):JSON.parse(p)};function a(){try{var p=o?.getItem(r);if(p)return s(p)}catch(d){console.error(d)}return pa(n?.defaultValue)?n?.defaultValue():n?.defaultValue}var u=On(j(function(){return a()}),2),l=u[0],c=u[1];gC(function(){c(a())},[r]);var f=function(p){var d=pa(p)?p(l):p;if(c(d),mC(d))o?.removeItem(r);else try{o?.setItem(r,i(d))}catch(h){console.error(h)}};return[l,$t(f)]}return t}var r9=bC(function(){return yC?localStorage:void 0}),Wh=r9;function vC(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=vC(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Hh(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=vC(e))&&(n&&(n+=" "),n+=t);return n}var _i=Hh;var xC=require("obsidian");S();var St=e=>{let t=F(null);return[Y(n=>{t.current&&t.current.empty(),n&&(0,xC.setIcon)(n,e),t.current=n},[e])]};wi();wi();var n9=0;function m(e,t,r,n,o){var i,s,a={};for(s in t)s=="ref"?i=t[s]:a[s]=t[s];var u={type:e,props:a,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--n9,__source:o,__self:n};if(typeof e=="function"&&(i=e.defaultProps))for(s in i)a[s]===void 0&&(a[s]=i[s]);return q.vnode&&q.vnode(u),u}var da=({name:e,desc:t,button:r,onClick:n,icon:o,className:i,...s})=>m("div",{className:_i("setting-item",i),...s,children:[o&&m("div",{className:"setting-icon",children:o}),m("div",{className:"setting-item-info",children:[m("div",{className:"setting-item-name",children:e}),m("div",{className:"setting-item-description",children:t})]}),m("div",{className:"setting-item-control",children:r&&m("button",{className:"mod-cta",onClick:n,children:r})})]});S();var o9=()=>m("svg",{className:"icon-blank svg-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",height:"32",width:"32"}),i9=()=>m("svg",{className:"icon-spin svg-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",height:"32",width:"32",children:[m("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),m("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z",children:m("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"0.8s",repeatCount:"indefinite"})})]}),wC=({color:e="var(--icon-color, black)",delay:t=0,height:r=16,width:n=16,style:o,...i})=>{let[s,a]=j(t>0);return U(()=>{let u=-1;return s&&(u=window.setTimeout(()=>{a(!1)},t)),()=>{window.clearTimeout(u)}},[]),m("div",{style:{...o,fill:e,height:Number(r)||r,width:Number(n)||n},...i,children:s?m(o9,{}):m(i9,{})})};var SC=require("fs"),IC=require("fs/promises"),_C=require("stream"),Gh=require("stream/promises"),CC=require("zlib"),f9=require("@electron/remote");var bl=class extends Error{},Kh=class extends bl{},Vh=class extends bl{},s9=(e,t=",")=>e.join(t),a9={accept:"*",multiple:!1,strict:!1},EC=e=>{let{accept:t,multiple:r,strict:n}={...a9,...e},o=l9({multiple:r,accept:Array.isArray(t)?s9(t):t});return new Promise(i=>{o.onchange=()=>{i(u9(o.files,r,n)),o.remove()},o.click()})},u9=(e,t,r)=>new Promise((n,o)=>{if(!e)return o(new Kh);let i=c9(e,t,r);if(!i)return o(new Vh);n(i)}),c9=(e,t,r)=>!t&&r?e.length===1?e[0]:null:e.length?e:null,l9=({accept:e,multiple:t})=>{let r=document.createElement("input");return r.type="file",r.multiple=t,r.accept=e,r};var TC=require("obsidian"),vl=async(e,t,r)=>{let n=_C.Readable.from(Buffer.from(e)),o=(0,SC.createWriteStream)(t);try{r?await(0,Gh.pipeline)(n,o):await(0,Gh.pipeline)(n,(0,CC.createGunzip)(),o)}catch(i){throw o.destroy(),await(0,IC.rm)(t,{force:!0}),i}},OC=async()=>{let e=await EC({multiple:!1,accept:[".gz",".node"],strict:!0});return e?{decompressed:!e.name.endsWith(".gz"),arrayBuffer:await e.arrayBuffer()}:null},AC=async e=>(await fetch(e,{method:"HEAD"})).status,kC=async e=>(await(0,TC.requestUrl)({url:e})).arrayBuffer;var NC=(i=>(i[i.Idle=0]="Idle",i[i.Downloading=1]="Downloading",i[i.Importing=2]="Importing",i[i.Success=3]="Success",i[i.Failed=4]="Failed",i))(NC||{}),Ci=Ft(0),p9=Ft(e=>e(Ci)===4),RC=Ft(null),d9=Ft(e=>{switch(e(Ci)){case 0:return null;case 1:return"Downloading...";case 2:return"Importing...";case 3:return"Module successfully installed";case 4:return`Module install failed: ${e(RC)}`;default:break}}),m9=Ft(null,(e,t,[r,n])=>{t(Ci,4);let o="Failed to install module when "+NC[r];it(o,n),t(RC,o+": "+(n instanceof Error?n.message:`${n}`))}),h9=()=>{let e=zh(Ci),t=zh(m9),r=lt(fa),n=lt(yl);return $t(async()=>{if(!n){t([0,new Error("Cannot find binary version")]);return}e(1);let o;try{if(await AC(r)===404)throw new Error(`Requested module not available (${r}), please open an issue on GitHub`);o=await kC(r)}catch(i){t([1,i]);return}e(2);try{await vl(o,n,!1)}catch(i){t([2,i]);return}e(3)})},DC=()=>{let e=lt(Ci),t=lt(d9),r=lt(Dr),n=h9();return m("div",{className:"zt-auto-install",children:[m(da,{name:"Auto Install",desc:"Recommended",button:e===0?"Install":void 0,onClick:n}),e!==0&&m(da,{className:_i("zt-auto-install-status",{"mod-warning":e===4,"mod-success":e===3}),icon:m(y9,{}),name:t,button:e===3?"Reload Plugin":void 0,onClick:()=>r.reloadPlugin()})]})},g9=()=>{let e=lt(p9),[t]=St(e?"slash":"check");return m("div",{className:"zt-install-done-icon",style:{display:"contents"},ref:t})},y9=()=>{switch(lt(Ci)){case 0:return null;case 1:case 2:return m(wC,{className:"zt-install-spin-icon",style:{display:"contents"}});case 3:case 4:return m(g9,{})}};var PC=require("obsidian");S();var b9=async e=>{try{let t=await OC();return t?(await vl(t.arrayBuffer,e,t.decompressed),!0):(W.info("No file selected, skip import module"),!1)}catch(t){return new PC.Notice(`Failed to import module from ${e}: ${t}`),it("import module "+e,t),!1}},v9=()=>{let[e,t]=j(!1),r=lt(yl),n=async()=>{if(!r)return;await b9(r)&&t(!0)},o=lt(fa),i=lt(Uh),s=lt(Dr);return m("ol",{children:[m("li",{children:["Download ",m("code",{children:".node.gz"})," file from"," ",m("a",{href:o,children:"GitHub"}),"."]}),m("li",{children:["Select downloaded ",m("code",{children:i})," or uncompressed"," ",m("code",{children:"better-sqlite3.node"}),"to install:",m(x9,{onClick:n,done:e})]}),m("li",{children:["Reload ZotLit:",m(w9,{onClick:()=>s.reloadPlugin()})]})]})},FC=()=>{let[e,t]=j(!1);return m("div",{className:"zt-manual-install",children:[m(da,{name:"Manual Install",desc:"Use this option if you have trouble downloading the module with auto install.",button:`${e?"Hide":"Show"} Guide`,onClick:()=>t(r=>!r)}),m("div",{hidden:!e,children:m(v9,{})})]})},x9=({done:e,onClick:t})=>m("button",{className:_i({"zt-import-done":e}),onClick:t,children:e?"Library file imported":"Select"}),w9=({disabled:e,onClick:t})=>m("button",{disabled:e,onClick:t,children:"Reload Plugin"});var E9=()=>{let e=lt(pC);switch(e){case"install":return m($,{children:["ZotLit requires latest version of ",m("code",{children:"better-sqlite3"})," to be installed. Use one of the method below to install or update it."]});case"reset":return m($,{children:[m("code",{children:"better-sqlite3"})," seems to be broken and failed to load. you can try to use one of the method below to reinstall it."]});default:(0,$C.default)(e)}},MC=()=>m($,{children:[m("style",{children:`
.modal.mod-zt-install-guide .modal-content {
display: flex;
flex-direction: column;
}
.zt-install-methods {
display: flex;
flex-direction: column;
gap: var(--size-4-4);
flex-grow: 1;
padding: var(--size-4-4);
padding-bottom: var(--size-4-2);
}
.zt-install-methods .setting-item {
padding: 0;
}
.zt-auto-install {
display: flex;
flex-direction: column;
gap: var(--size-4-4);
}
.modal.mod-zt-install-guide button:disabled {
background-color: var(--background-modifier-cover);
}
.modal.mod-zt-install-guide button:disabled:hover {
box-shadow: var(--input-shadow);
}
.modal.mod-zt-install-guide button.zt-import-done {
background-color: var(--background-modifier-success);
}
.zt-auto-install-status {
border-top: none;
}
.zt-auto-install-status.mod-success .setting-icon ,
.zt-auto-install-status.mod-success .setting-item-name {
color: var(--text-success);
}
.zt-auto-install-status.mod-warning .setting-icon ,
.zt-auto-install-status.mod-warning .setting-item-name {
color: var(--text-error);
}
.zt-auto-install-status .setting-icon ,
.zt-auto-install-status .setting-item-name {
color: var(--text-muted);
}
`}),m("div",{className:"zt-install-desc",children:m(E9,{})}),m("div",{className:"zt-install-methods",children:[m(DC,{}),m(FC,{})]})]});var ma=class extends jC.Modal{constructor(r,n,o,i,s){super(s);this.manifest=r;this.platform=n;this.binaryVersion=o;this.mode=i;this.app=s;this.titleEl.setText("Setup ZotLit"),this.modalEl.addClass("mod-zt-install-guide")}onOpen(){let r=fC();r.set(Dr,this),R.render(m(lC,{initialValues:r.get(),children:m(MC,{})}),this.contentEl)}onClose(){R.unmountComponentAtNode(this.contentEl)}async reloadPlugin(){await this.app.plugins.disablePlugin(this.manifest.id),this.close(),await this.app.plugins.enablePlugin(this.manifest.id)}};var LC=(e,t,r,n)=>{let o=ZS();if(!o)throw new Error("Not in desktop app");let i=GS(o);if(i<0)new Jr.Notice(`The electron (electron: ${o.electron}, module version: ${o.modules}) in current version of obsidian is not supported by zotlit, please reinstall using latest obsidian installer from official website`);else if(i>0)new Jr.Notice(`The electron (electron: ${o.electron}, module version: ${o.modules}) in current version of obsidian is newer than the one supported by installed zotlit, please update zotlit to the latest version`);else if(!JS(o))new Jr.Notice(`Your device (${o.arch}-${o.platform}) is not supported by zotlit`);else{let s=km(t);if(!s)throw new Error(`Cannot find binary version for ${t.name} v${t.version}`);try{(0,qC.statSync)(e).isFile()?r==="reset"&&new ma(t,o,s,r,n).open():new Jr.Notice("Path to database library occupied, please check the location manually: "+e,2e3)}catch(a){let u=a;u.code==="ENOENT"?new ma(t,o,s,r,n).open():(new Jr.Notice(`Unexpected error while checking path of better-sqlite3, please check the location manually: ${e}, error: ${u}`,2e3),it("checking better-sqlite3 path:"+e,u))}}},S9=(e,t)=>{if(!Jr.Platform.isDesktopApp)throw new Error("Not in desktop app");let r=ai(e);if(!r)throw new Error(`Cannot find binary version for ${e.name} v${e.version}`);try{return require(r),!0}catch(n){return n?.code==="MODULE_NOT_FOUND"?LC(r,e,"install",t):(new Jr.Notice(`Failed to load database library: ${n}`),it("Failed to load database library",n),LC(r,e,"reset",t)),!1}},BC=S9;var lM=require("path/posix");var un=require("obsidian");var _e;(function(e){e[e.highlight=1]="highlight",e[e.note=2]="note",e[e.image=3]="image",e[e.ink=4]="ink",e[e.underline=5]="underline",e[e.text=6]="text"})(_e||(_e={}));var yo;(function(e){e[e.manual=0]="manual",e[e.auto=1]="auto"})(yo||(yo={}));var xl;(function(e){e[e.importedFile=0]="importedFile",e[e.importedUrl=1]="importedUrl",e[e.linkedFile=2]="linkedFile",e[e.linkedUrl=3]="linkedUrl",e[e.embeddedImage=4]="embeddedImage"})(xl||(xl={}));var ha;(function(e){e[e.fullName=0]="fullName",e[e.nameOnly=1]="nameOnly"})(ha||(ha={}));var wl=["attachment","note","annotation"];var El=wl.map(e=>`'${e}'`).join(",");var Ge=(e="itemID")=>`--sql
${e} IS NOT NULL
${e==="itemID"?`AND ${e} NOT IN (SELECT itemID FROM deletedItems)`:""}
`,Qt=(e,t="$itemId")=>typeof e=="boolean"?"":`AND ${e} = ${t}`;var Sl=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]-t[r];return 0},I9=new Set(["application/pdf","text/html","application/epub+zip"]),Jh=e=>!!e.path,ga=e=>Jh(e)&&!!e.contentType&&I9.has(e.contentType),zC=e=>`obzt-active-atch-${e.itemID}-${e.libraryID}`,Zh=(e,t)=>{let r=e.getItem(zC(t));if(!r)return null;let n=parseInt(r,10);return n>0?n:null},Ti=(e,t,r)=>e.setItem(zC(t),r.toString());var Il=`--sql
items.itemID,
items.key,
items.clientDateModified,
items.dateAdded,
items.dateModified,
annots.type,
annots.authorName,
annots.text,
annots.comment,
annots.color,
annots.pageLabel,
annots.sortIndex,
annots.position,
annots.isExternal
`,_l=`--sql
itemAnnotations annots
JOIN items USING (itemID)
`;var Dde=`--sql
SELECT
${Il},
annots.parentItemID,
parentItems.key as parentItem
FROM
${_l}
JOIN items as parentItems ON annots.parentItemID = parentItems.itemID
WHERE
items.key = $annotKey
AND items.libraryID = $libId
AND ${Ge("items.itemID")}
`;var jde=`--sql
SELECT
${Il}
FROM
${_l}
WHERE
parentItemID = $attachmentId
AND items.libraryID = $libId
AND ${Ge()}
`;var Cl=`--sql
items.itemID,
items.key,
items.clientDateModified,
items.dateAdded,
items.dateModified,
notes.note,
notes.title
`,Tl=`--sql
itemNotes notes
JOIN items USING (itemID)
`;var Ude=`--sql
SELECT
${Cl},
notes.parentItemID,
parentItems.key as parentItem
FROM
${Tl}
JOIN items as parentItems ON notes.parentItemID = parentItems.itemID
WHERE
items.key = $noteKey
AND items.libraryID = $libId
AND ${Ge("items.itemID")}
`;var Vde=`--sql
SELECT
${Cl}
FROM
${Tl}
WHERE
parentItemID = $itemID
AND items.libraryID = $libId
AND ${Ge()}
`;var Zde=`--sql
SELECT
atchs.itemID,
atchs.path,
atchs.contentType,
atchs.linkMode,
charsets.charset,
items.key,
COUNT(atchs.itemID) as annotCount
FROM
itemAttachments atchs
JOIN items USING (itemID)
LEFT JOIN charsets USING (charsetID)
LEFT JOIN itemAnnotations annots ON atchs.itemID = annots.parentItemID
WHERE
atchs.parentItemID = $itemId
AND libraryID = $libId
AND ${Ge("atchs.itemID")}
GROUP BY atchs.itemID
`;var ya="betterbibtex",ba="bbts";var tme=`--sql
SELECT
citationkey as citekey
FROM
${ya}.citationkey
WHERE
itemID = $itemID
AND (libraryID IS NULL OR libraryID = $libId)
`,rme=`--sql
SELECT
citekey
FROM
${ba}.citekeys
WHERE
itemID = $itemID
AND (libraryID IS NULL OR libraryID = $libId)
`;var sme=`--sql
SELECT
itemID
FROM
${ya}.citationkey
WHERE
citationkey = $citekey
`,ame=`--sql
SELECT
itemID
FROM
${ba}.citekeys
WHERE
citekey = $citekey
`;var Ol=e=>`--sql
SELECT
itemID,
creators.firstName,
creators.lastName,
creators.fieldMode,
creatorTypes.creatorType,
orderIndex
FROM
items
LEFT JOIN itemCreators USING (itemID)
JOIN creators USING (creatorID)
JOIN creatorTypes USING (creatorTypeID)
WHERE
libraryID = $libId
${Qt(e||"itemID")}
AND ${Ge()}
ORDER BY
itemID,
orderIndex
`;var dme=Ol(!0);function WC(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function HC(e,t){for(var r=e.length,n=t.length,o=new Array(r+n|0),i=0;i<r;++i)o[i]=e[i];for(var s=0;s<n;++s)o[r+s|0]=t[s];return o}function Yh(e,t){for(var r=0,n=e.length;r<n;++r)t(e[r])}function Al(e,t){for(var r=e.length,n=new Array(r),o=0;o<r;++o)n[o]=t(e[o]);return n}function va(e,t,r){for(var n=t,o=0,i=e.length;o<i;++o)n=r(n,e[o]);return n}var KC=function(e,t){for(var r in e)t(r)};function xa(e,t){if(e===t)return!0;var r=typeof e;if(r==="string"||r==="number"||r==="boolean"||r==="undefined"||e===null)return!1;var n=typeof t;if(r==="function"||n==="function")throw{RE_EXN_ID:"Invalid_argument",_1:"equal: functional value",Error:new Error};if(n==="number"||n==="undefined"||t===null)return!1;var o=0|e.TAG,i=0|t.TAG;if(o===248)return e[1]===t[1];if(o===251)throw{RE_EXN_ID:"Invalid_argument",_1:"equal: abstract value",Error:new Error};if(o!==i)return!1;var s=0|e.length;if(s===(0|t.length))if(Array.isArray(e))for(var a=0;;){var u=a;if(u===s)return!0;if(!xa(e[u],t[u]))return!1;a=u+1|0}else{if(e instanceof Date&&t instanceof Date)return!(e>t||e<t);var l={contents:!0};return KC(e,function(c){if(!Object.prototype.hasOwnProperty.call(t,c)){l.contents=!1;return}}),l.contents&&KC(t,function(c){if(!Object.prototype.hasOwnProperty.call(e,c)||!xa(t[c],e[c])){l.contents=!1;return}}),l.contents}else return!1}function kl(e,t){if(t in e)return WC(e[t])}var Xh=function(e,t){delete e[t]};function JC(e){for(var t=Object.keys(e),r=t.length,n=new Array(r),o=0;o<r;++o)n[o]=e[t[o]];return n}function Oi(e){for(var t={},r=e.length,n=0;n<r;++n){var o=e[n];t[o[0]]=o[1]}return t}function VC(e,t){return HC(e,[t])}function Nl(){if(arguments.length===1){let e=arguments;return function(r){return VC(r,e[0])}}return VC(arguments[0],arguments[1])}function GC(e,t){return va(e,{},function(r,n){var o=t(n),i=kl(r,o);return i!==void 0?i.push(n):r[o]=[n],r})}function bo(){if(arguments.length===1){let e=arguments;return function(r){return GC(r,e[0])}}return GC(arguments[0],arguments[1])}function pT(e){}function dT(e){return{}}function ZC(e,t){return e[t]}function mT(){if(arguments.length===1){let e=arguments;return function(r){return ZC(r,e[0])}}return ZC(arguments[0],arguments[1])}var YC=kl;function hT(){if(arguments.length===1){let e=arguments;return function(r){return YC(r,e[0])}}return YC(arguments[0],arguments[1])}function XC(e,t){return e[t]}function gT(){if(arguments.length===1){let e=arguments;return function(r){return XC(r,e[0])}}return XC(arguments[0],arguments[1])}function yT(e){return Object.entries(e)}var Rl=JC;function bT(e){return Object.keys(e)}var vT=Oi;function QC(e,t){return Object.assign({},e,t)}function vo(){if(arguments.length===1){let e=arguments;return function(r){return QC(r,e[0])}}return QC(arguments[0],arguments[1])}function eT(e,t,r){var n=vo({},e);return n[t]=r,n}function Dl(){if(arguments.length===2){let e=arguments;return function(r){return eT(r,e[0],e[1])}}return eT(arguments[0],arguments[1],arguments[2])}function tT(e,t,r){return Dl(e,t,r(kl(e,t)))}function xT(){if(arguments.length===2){let e=arguments;return function(r){return tT(r,e[0],e[1])}}return tT(arguments[0],arguments[1],arguments[2])}function rT(e,t,r){return Dl(e,t,r(e[t]))}function wT(){if(arguments.length===2){let e=arguments;return function(r){return rT(r,e[0],e[1])}}return rT(arguments[0],arguments[1],arguments[2])}function nT(e,t){var r=vo({},e);return Xh(r,t),r}function ET(){if(arguments.length===1){let e=arguments;return function(r){return nT(r,e[0])}}return nT(arguments[0],arguments[1])}function oT(e,t){var r=vo({},e);return Yh(t,function(n){Xh(r,n)}),r}function ST(){if(arguments.length===1){let e=arguments;return function(r){return oT(r,e[0])}}return oT(arguments[0],arguments[1])}function iT(e,t){return Oi(Al(Object.keys(e),function(r){return[r,t(e[r])]}))}function Ai(){if(arguments.length===1){let e=arguments;return function(r){return iT(r,e[0])}}return iT(arguments[0],arguments[1])}function sT(e,t){return Oi(Al(Object.keys(e),function(r){return[r,t(r,e[r])]}))}function ki(){if(arguments.length===1){let e=arguments;return function(r){return sT(r,e[0])}}return sT(arguments[0],arguments[1])}function aT(e,t){return Oi(va(Object.keys(e),[],function(r,n){var o=e[n];return t(o)?Nl(r,[n,o]):r}))}function wa(){if(arguments.length===1){let e=arguments;return function(r){return aT(r,e[0])}}return aT(arguments[0],arguments[1])}function uT(e,t){return Oi(va(Object.keys(e),[],function(r,n){var o=e[n];return t(n,o)?Nl(r,[n,o]):r}))}function Pl(){if(arguments.length===1){let e=arguments;return function(r){return uT(r,e[0])}}return uT(arguments[0],arguments[1])}function cT(e,t){return wa(e,function(r){return!t(r)})}function IT(){if(arguments.length===1){let e=arguments;return function(r){return cT(r,e[0])}}return cT(arguments[0],arguments[1])}function lT(e,t){return Pl(e,function(r,n){return!t(r,n)})}function _T(){if(arguments.length===1){let e=arguments;return function(r){return lT(r,e[0])}}return lT(arguments[0],arguments[1])}function fT(e,t){return Pl(e,function(r,n){return function(i,s){return s.includes(i)}(r,t)})}function Fl(){if(arguments.length===1){let e=arguments;return function(r){return fT(r,e[0])}}return fT(arguments[0],arguments[1])}function CT(e){return xa(e,{})}function TT(e){return!xa(e,{})}var Qh={__proto__:null,placeholder:pT,makeEmpty:dT,getUnsafe:mT,get:hT,prop:gT,toPairs:yT,values:Rl,keys:bT,fromPairs:vT,merge:vo,set:Dl,update:xT,updateUnsafe:wT,deleteKey:ET,deleteKeys:ST,map:Ai,mapWithKey:ki,filter:wa,filterWithKey:Pl,reject:IT,rejectWithKey:_T,selectKeys:Fl,isEmpty:CT,isNotEmpty:TT};var nhe=Ol(!1);var $l=e=>`--sql
SELECT
items.itemID,
fieldsCombined.fieldName,
itemDataValues.value
FROM
items
JOIN itemData USING (itemID)
JOIN itemDataValues USING (valueID)
JOIN fieldsCombined USING (fieldID)
JOIN itemTypesCombined USING (itemTypeID)
WHERE
libraryID = $libId
${Qt(e||"items.itemID")}
AND itemTypesCombined.typeName NOT IN (${El})
AND ${Ge()}
`;var che=$l(!0);var dhe=$l(!1);var Ea=e=>`--sql
SELECT
items.libraryID,
items.itemID,
items.key,
items.clientDateModified,
items.dateAdded,
items.dateModified,
itemTypesCombined.typeName as itemType,
json_group_array(collectionID) filter (where collectionID is not null) as collectionIDs
FROM
items
JOIN itemTypesCombined USING (itemTypeID)
LEFT JOIN collectionItems USING (itemID)
WHERE
libraryID = $libId
${e==="full"?Qt(!1):e==="id"?Qt("items.itemID"):Qt("items.key","$key")}
AND ${Ge()}
AND itemType NOT IN (${El})
GROUP BY itemID
`;var vhe=Ea("full");var She=Ea("id"),Ihe=Ea("key");var Sa=e=>`--sql
WITH
RECURSIVE CollectionPath AS (
-- Base case: collections without a parent
SELECT
collectionID,
parentCollectionID,
collectionName AS path
FROM
collections
WHERE
libraryID = $libId
${e==="full"?Qt(!1):e==="id"?Qt("collectionID","$collectionID"):Qt("key","$key")}
AND ${Ge("collectionID")}
UNION ALL
-- Recursive case: join with parent collections
SELECT
prev.collectionID,
c.parentCollectionID,
c.collectionName
FROM
collections c
JOIN CollectionPath prev ON c.collectionID = prev.parentCollectionID
)
SELECT
p.collectionID,
json_group_array(p.path) path,
c.key,
c.collectionName,
c.libraryID
FROM
CollectionPath p
JOIN collections c USING (collectionID)
GROUP BY
collectionID
ORDER BY
collectionID;
`;var khe=Sa("full");var Phe=Sa("id"),Fhe=Sa("key");var OT=require("path"),An=({groupID:e,key:t},r)=>{let n=[r,"cache"];return e?n.push("groups",e.toString()):n.push("library"),(0,OT.join)(...n,t+".png")};var Ia=e=>Ml(e)?[e.firstName,e.lastName].join(" "):jl(e)?e.lastName:null,Ml=e=>{let t=e;return t.fieldMode===ha.fullName&&t.firstName!==null&&t.lastName!==null},jl=e=>{let t=e;return t.fieldMode===ha.nameOnly&&t.lastName!==null},eg=new Set(pn()("creators","itemID","itemType","key","libraryID","collections")),tg=e=>!wl.includes(e.itemType)&&typeof e.key=="string",_a=e=>e.itemType==="annotation"&&!!e.parentItem;var AT=e=>typeof e.groupID=="number"?`groups/${e.groupID}`:"library",kn=e=>{let t;if(tg(e))t=new URL(`zotero://select/${AT(e)}/items/${e.key}`);else if(_a(e)){t=new URL(`zotero://open-pdf/${AT(e)}/items/${e.parentItem}`);let r;try{r=Go(e.position.pageIndex,!0)}catch(n){console.warn(n),r=null}typeof r=="number"&&t.searchParams.append("page",r.toString()),e.key&&t.searchParams.append("annotation",e.key)}else return"";return t.toString()};var NT=require("obsidian");var ql=require("obsidian");async function kT(e){let t=await xo(e);if(!t)return null;let{value:r,evt:n}=t;return{value:r.item,evt:n}}function xo(e){let t,r=new Promise((o,i)=>{t=o}),n=qt(e,{selectSuggestion:o=>function(s,a,...u){return t(s!==null?{value:s,evt:a}:null),o.call(this,s,a,...u)},onClose:o=>function(...s){return t(null),o.call(this,...s)}});return r.finally(n),e.open(),r}var Ll=class extends ql.SuggestModal{initial=!0;async#e(){let t=this.inputEl.value,r=await this.getSuggestions(t);if(r.length!==0){let n=this.limit;n&&n>0&&(r=r.slice(0,n)),this.chooser.setSuggestions(r)}else t?this.onNoSuggestion():this.chooser.setSuggestions(null)}#t=(0,ql.debounce)(this.#e.bind(this),250,!0);updateSuggestions(){this.initial?(this.#e(),this.initial=!1):this.#t()}};var rg=class extends NT.FuzzySuggestModal{constructor(r,n){super(n);this.attachments=r}getItems(){return this.attachments}renderSuggestion(r,n){n.addClass("mod-complex");let o=n.createDiv("suggestion-content").createDiv("suggestion-title").createSpan(),i=n.createDiv("suggestion-aux");super.renderSuggestion(r,o),i.createEl("kbd","suggestion-hotkey").setText((r.item.annotCount??0).toString())}getItemText(r){return r.path?.replace(/^storage:/,"")??r.key}onChooseItem(){}};async function k9(e,t){return e.length===1?e[0]:e.length?(await kT(new rg(e,t)))?.value??null:null}function Ni(e,t){Ti(window.localStorage,t,e.itemID)}async function Zr(e,t){let r=e.filter(ga);return await k9(r,t)}var Cy=require("obsidian");var dt=require("obsidian");var Ri=require("obsidian"),RT=()=>`Press ${Ri.Platform.isMacOS?"\u2318 Cmd":"Ctrl"} + ${Ri.Platform.isMacOS?"\u2325 Option":"Shift"} + I, then go to the "Console" tab to see the log.`;var at=e=>e instanceof Ri.TFile&&e.extension==="md",DT=e=>typeof e=="string"?e:e.path;function ng(e){let t=bo(e,o=>o.comment?.match(Tm)?.[1]??-1),r=t[-1]??[],n=new Map(r.map(o=>[o.itemID,[o]]));delete t[-1];for(let[o,i]of Object.entries(t)){let s=n.get(+o);i.forEach(a=>{a.comment&&=a.comment.replace(Tm,"")??null}),s?s.push(...i.sort((a,u)=>Sl(a.sortIndex,u.sortIndex))):i.forEach(a=>{n.set(a.itemID,[a])})}for(let[o,...i]of n.values())if(!(i.length<=0)){for(let s of i)s.comment&&(o.comment=(o.comment??"")+`
`+s.comment),s.text&&(o.text?o.text.endsWith("-")&&!o.text.endsWith("--")?o.text.substring(0,o.text.length-1)+s.text.trimStart():o.text.match(/[a-zA-Z\d]\s*$/)&&s.text.match(/^\s*[a-zA-Z\d]/)?o.text=o.text.trimEnd()+" "+s.text.trimStart():o.text=o.text.trimEnd()+s.text.trimStart():o.text=s.text);o.comment=o.comment?.replace(/\n+/,`
`).replace(/^\s+|\s+$/g,"")??null}return[...n.values()]}function og(e){return e.map(t=>t[0])}function ig(e,t){let r=e.map(([n,...o])=>{if(o.length===0)return[n.itemID,t[n.itemID]];let i=new Map(t[n.itemID].map(s=>[s.tagID,s]));return o.forEach(s=>{t[s.itemID].forEach(a=>{i.set(a.tagID,a)})}),[n.itemID,Array.from(i.values())]});return Object.fromEntries(r)}function PT(e,t){let r=ng(e);return{annotations:og(r),tags:ig(r,t)}}var Hl=class{constructor(t){this.cache=void 0,this.cache=t}define(t,r){this.cache[t]=r}get(t){return this.cache[t]}remove(t){delete this.cache[t]}reset(){this.cache={}}load(t){this.cache={...this.cache,...t}}},et=class extends Error{constructor(t){super(t),this.name="Eta Error"}};function Ca(e,t,r){let n=t.slice(0,r).split(/\n/),o=n.length,i=n[o-1].length+1;throw e+=" at line "+o+" col "+i+`:
`+t.split(/\n/)[o-1]+`
`+Array(i).join(" ")+"^",new et(e)}function N9(e,t,r,n){let o=t.split(`
`),i=Math.max(r-3,0),s=Math.min(o.length,r+3),a=n,u=o.slice(i,s).map(function(f,p){let d=p+i+1;return(d==r?" >> ":" ")+d+"| "+f}).join(`
`),l=a?a+":"+r+`
`:"line "+r+`
`,c=new et(l+u+`
`+e.message);throw c.name=e.name,c}var R9=async function(){}.constructor;function D9(e,t){let r=this.config,n=t&&t.async?R9:Function;try{let o=new n(r.varName,"options",this.compileToString.call(this,e,t));return o.mtime=t?.mtime,o}catch(o){throw o instanceof SyntaxError?new et(`Bad template syntax
`+o.message+`
`+Array(o.message.length+1).join("=")+`
`+this.compileToString.call(this,e,t)+`
`):o}}function P9(e,t){let r=this.config,n=t&&t.async,o=this.compileBody,i=this.parse.call(this,e),s=`${r.functionHeader}
let include = (template, data) => this.render(template, data, options);
let includeAsync = (template, data) => this.renderAsync(template, data, options);
let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${r.debug?', line: 1, templateStr: "'+e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};
function layout(path, data) {
__eta.layout = path;
__eta.layoutData = data;
}${r.debug?"try {":""}${r.useWith?"with("+r.varName+"||{}){":""}
${o.call(this,i)}
if (__eta.layout) {
__eta.res = ${n?"await includeAsync":"include"} (__eta.layout, {...${r.varName}, body: __eta.res, ...__eta.layoutData});
}
${r.useWith?"}":""}${r.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}
return __eta.res;
`;if(r.plugins)for(let a=0;a<r.plugins.length;a++){let u=r.plugins[a];u.processFnString&&(s=u.processFnString(s,r))}return s}function F9(e){let t=this.config,r=0,n=e.length,o="";for(r;r<n;r++){let i=e[r];if(typeof i=="string")o+="__eta.res+='"+i+`'
`;else{let s=i.t,a=i.val||"";t.debug&&(o+="__eta.line="+i.lineNo+`
`),s==="r"?(t.autoFilter&&(a="__eta.f("+a+")"),o+="__eta.res+="+a+`
`):s==="i"?(t.autoFilter&&(a="__eta.f("+a+")"),t.autoEscape&&(a="__eta.e("+a+")"),o+="__eta.res+="+a+`
`):s==="e"&&(o+=a+`
`)}}return o}function $9(e,t,r,n){let o,i;return Array.isArray(t.autoTrim)?(o=t.autoTrim[1],i=t.autoTrim[0]):o=i=t.autoTrim,(r||r===!1)&&(o=r),(n||n===!1)&&(i=n),!i&&!o?e:o==="slurp"&&i==="slurp"?e.trim():(o==="_"||o==="slurp"?e=e.trimStart():(o==="-"||o==="nl")&&(e=e.replace(/^(?:\r\n|\n|\r)/,"")),i==="_"||i==="slurp"?e=e.trimEnd():(i==="-"||i==="nl")&&(e=e.replace(/(?:\r\n|\n|\r)$/,"")),e)}var M9={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function j9(e){return M9[e]}function L9(e){let t=String(e);return/[&<>"']/.test(t)?t.replace(/[&<>"']/g,j9):t}var FT={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:L9,filterFunction:e=>String(e),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it"},Bl=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,zl=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,Ul=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function Wl(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function q9(e,t){return e.slice(0,t).split(`
`).length}function B9(e){let t=this.config,r=[],n=!1,o=0,i=t.parse;if(t.plugins)for(let f=0;f<t.plugins.length;f++){let p=t.plugins[f];p.processTemplate&&(e=p.processTemplate(e,t))}t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,`
`).replace(/^\s+|\s+$/gm,"")),Bl.lastIndex=0,zl.lastIndex=0,Ul.lastIndex=0;function s(f,p){f&&(f=$9(f,t,n,p),f&&(f=f.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),r.push(f)))}let a=[i.exec,i.interpolate,i.raw].reduce(function(f,p){return f&&p?f+"|"+Wl(p):p?Wl(p):f},""),u=new RegExp(Wl(t.tags[0])+"(-|_)?\\s*("+a+")?\\s*","g"),l=new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?"+Wl(t.tags[1])+")","g"),c;for(;c=u.exec(e);){let f=e.slice(o,c.index);o=c[0].length+c.index;let p=c[1],d=c[2]||"";s(f,p),l.lastIndex=o;let h,b=!1;for(;h=l.exec(e);)if(h[1]){let y=e.slice(o,h.index);u.lastIndex=o=l.lastIndex,n=h[2],b={t:d===i.exec?"e":d===i.raw?"r":d===i.interpolate?"i":"",val:y};break}else{let y=h[0];if(y==="/*"){let v=e.indexOf("*/",l.lastIndex);v===-1&&Ca("unclosed comment",e,h.index),l.lastIndex=v}else y==="'"?(zl.lastIndex=h.index,zl.exec(e)?l.lastIndex=zl.lastIndex:Ca("unclosed string",e,h.index)):y==='"'?(Ul.lastIndex=h.index,Ul.exec(e)?l.lastIndex=Ul.lastIndex:Ca("unclosed string",e,h.index)):y==="`"&&(Bl.lastIndex=h.index,Bl.exec(e)?l.lastIndex=Bl.lastIndex:Ca("unclosed string",e,h.index))}b?(t.debug&&(b.lineNo=q9(e,c.index)),r.push(b)):Ca("unclosed tag",e,c.index)}if(s(e.slice(o,e.length),!1),t.plugins)for(let f=0;f<t.plugins.length;f++){let p=t.plugins[f];p.processAST&&(r=p.processAST(r,t))}return r}function $T(e,t){let r=t&&t.async?this.templatesAsync:this.templatesSync;if(this.resolvePath&&this.readFile&&!e.startsWith("@")){let n=t.filepath,o=r.get(n);if(this.config.cache&&o)return o;{let i=this.readFile(n),s=this.compile(i,t);return this.config.cache&&r.define(n,s),s}}else{let n=r.get(e);if(n)return n;throw new et("Failed to get template '"+e+"'")}}function MT(e,t,r){let n,o={...r,async:!1};return typeof e=="string"?(this.resolvePath&&this.readFile&&!e.startsWith("@")&&(o.filepath=this.resolvePath(e,o)),n=$T.call(this,e,o)):n=e,n.call(this,t,o)}function jT(e,t,r){let n,o={...r,async:!0};typeof e=="string"?(this.resolvePath&&this.readFile&&!e.startsWith("@")&&(o.filepath=this.resolvePath(e,o)),n=$T.call(this,e,o)):n=e;let i=n.call(this,t,o);return Promise.resolve(i)}function z9(e,t){let r=this.compile(e,{async:!1});return MT.call(this,r,t)}function U9(e,t){let r=this.compile(e,{async:!0});return jT.call(this,r,t)}var Kl=class{constructor(t){this.config=void 0,this.RuntimeErr=N9,this.compile=D9,this.compileToString=P9,this.compileBody=F9,this.parse=B9,this.render=MT,this.renderAsync=jT,this.renderString=z9,this.renderStringAsync=U9,this.filepathCache={},this.templatesSync=new Hl({}),this.templatesAsync=new Hl({}),this.resolvePath=null,this.readFile=null,t?this.config={...FT,...t}:this.config={...FT}}configure(t){this.config={...this.config,...t}}withConfig(t){return{...this,config:{...this.config,...t}}}loadTemplate(t,r,n){if(typeof r=="string")(n&&n.async?this.templatesAsync:this.templatesSync).define(t,this.compile(r,n));else{let o=this.templatesSync;(r.constructor.name==="AsyncFunction"||n&&n.async)&&(o=this.templatesAsync),o.define(t,r)}}};var HT=require("obsidian");var Yr=require("node:path/posix");var sg=require("obsidian");function W9(e){if(!e)return"";let t=Rm(e);return t||(e.endsWith(".eta.md")?e:e.endsWith(".eta")?e+".md":e+".eta.md")}function LT(e){let t=ct(e,this.settings.templateDir);if(t?.type==="embeded")return this.settings.simpleTemplates[t.name];let r=this.getFile(e);if(typeof r=="string"){if(!t)throw new et(`File '${e}' not found`);return ot.Ejectable[t.name]}if(!this.tplFileCache.has(r))throw new et(`File '${e}' not loaded`);return this.tplFileCache.get(r)}function qT(e){let t=ct(e,this.settings.templateDir);if(t?.type==="embeded")return-1;let r=this.getFile(e);if(typeof r=="string"){if(!t)throw new et(`File '${e}' not found`);return}if(!this.tplFileCache.has(r))throw new et(`File '${e}' not loaded`);return r.stat.mtime}function BT(e,t){let r="",n=this.config.views;if(!n)throw new et("Views directory is not defined");let o=t&&t.filepath,i=JSON.stringify({filename:o,path:e,views:this.config.views});if(e=W9(e),o){if(this.config.cacheFilepaths&&this.filepathCache[i])return this.filepathCache[i];(0,Yr.isAbsolute)(e)?r=(0,Yr.join)(n,(0,sg.normalizePath)(e)):r=(0,Yr.join)(o,"..",(0,sg.normalizePath)(e))}else r=(0,Yr.join)(n,e);if(H9(n,r))return o&&this.config.cacheFilepaths&&(this.filepathCache[i]=r),r;throw new et(`Template '${e}' is not in the views directory`)}function H9(e,t){let r=(0,Yr.relative)(e,t);return r&&!r.startsWith("..")&&!(0,Yr.isAbsolute)(r)}function zT(e,t){let r=t&&t.async?this.templatesAsync:this.templatesSync;if(e.startsWith("@")){let n=r.get(e);if(n)return n;throw new et("Failed to get template '"+e+"'")}else{let n=t.filepath,o=r.get(n),i=this.readModTime(n),s=o?.mtime;if(this.config.cache&&o&&(i===void 0||i>0&&s!==void 0&&i<=s))return o;let a=this.readFile(n),u=this.compile(a,t);return this.config.cache&&r.define(n,u),u}}function ag(e,t,r){let n,o={...r,async:!1};return typeof e=="string"?(e.startsWith("@")||(o.filepath=this.resolvePath(e,o)),n=zT.call(this,e,o)):n=e,n.call(this,t,o)}function ug(e,t,r){let n,o={...r,async:!0};typeof e=="string"?(e.startsWith("@")||(o.filepath=this.resolvePath(e,o)),n=zT.call(this,e,o)):n=e;let i=n.call(this,t,o);return Promise.resolve(i)}function UT(e,t){let r=this.compile(e,{async:!1});return ag.call(this,r,t)}function WT(e,t){let r=this.compile(e,{async:!0});return ug.call(this,r,t)}var Vl=class extends Kl{use=Vo.this;settings=this.use(de);app=this.use(HT.App);tplFileCache=new WeakMap;constructor(){super();let t=this;this.config={...this.config,cache:!0,autoEscape:!1,autoFilter:!0,filterFunction:r=>r==null?"":r instanceof Date?r.toISOString():r,plugins:[],get autoTrim(){return t.settings.current?.autoTrim},get views(){return t.settings.templateDir}}}resolvePath=BT;readFile=LT;readModTime=qT;render=ag;renderAsync=ug;renderString=UT;renderStringAsync=WT;getFile(t){let r=this.app.vault.getAbstractFileByPath(t);if(!r)return t;if(!at(r))throw new et(`'${t}' is not a markdown file`);return r}};var kR=ge(xR(),1),NR=ge(CR(),1);var kf=require("obsidian");var kK="\\ufeff?",NK=typeof process<"u"?process.platform:"",RK="^("+kK+"(= yaml =|---)$([\\s\\S]*?)^(?:\\2|\\.\\.\\.)\\s*$"+(NK==="win32"?"\\r?":"")+"(?:\\n)?)",DK=new RegExp(RK,"m");function If(e){e=e||"";let t=e.split(/(\r?\n)/);return t[0]&&/= yaml =|---/.test(t[0])?FK(e):{yaml:null,body:e,bodyBegin:1}}function PK(e,t){let r=1,n=t.indexOf(`
`),o=e.index+e[0].length;for(;n!==-1;){if(n>=o)return r;r++,n=t.indexOf(`
`,n+1)}return r}function FK(e){let t=DK.exec(e);if(!t)return{yaml:null,body:e,bodyBegin:1};let r=t[t.length-1].replace(/^\s+|\s+$/g,""),n=e.replace(t[0],""),o=PK(t,e);return{yaml:r,body:n,bodyBegin:o}}var Cf=require("path"),my=require("url");function fy(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function py(e,t){if(typeof e!="string"||typeof t!="string")throw new TypeError("Expected a string");let r=new RegExp(`(?:${fy(t)}){2,}`,"g");return e.replace(r,t)}function _f(){return/[<>:"/\\|?*\u0000-\u001F]/g}function TR(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}function dy(e,t){if(typeof e!="string"||typeof t!="string")throw new TypeError("Expected a string");return e.startsWith(t)&&(e=e.slice(t.length)),e.endsWith(t)&&(e=e.slice(0,-t.length)),e}var $K=100,OR=/[\u0000-\u001F\u0080-\u009F]/g,MK=/^\.+(\\|\/)|^\.+$/,jK=/\.+$/;function To(e,t={}){if(typeof e!="string")throw new TypeError("Expected a string");let r=t.replacement===void 0?"!":t.replacement;if(_f().test(r)&&OR.test(r))throw new Error("Replacement string cannot contain reserved filename characters");if(e=e.normalize("NFD"),e=e.replace(MK,r),e=e.replace(_f(),r),e=e.replace(OR,r),e=e.replace(jK,""),r.length>0){let o=e[0]===".";e=py(e,r),e=e.length>1?dy(e,r):e,!o&&e[0]==="."&&(e=r+e),e[e.length-1]==="."&&(e+=r)}e=TR().test(e)?e+r:e;let n=typeof t.maxLength=="number"?t.maxLength:$K;if(e.length>n){let o=e.lastIndexOf(".");if(o===-1)e=e.slice(0,n);else{let i=e.slice(0,o),s=e.slice(o);e=i.slice(0,Math.max(1,n-s.length))+s}}return e}var hy=e=>encodeURI(e)===e?e:`<${e}>`,Tf=e=>e.name.endsWith(".eta.md"),gy=(e,t)=>t.path?t.path.startsWith("storage:")?(0,Cf.join)(e,"storage",t.key,t.path.replace(/^storage:/,"")):t.path:"",Of=(e,t,r,n=null,o=null)=>{if(!n?.path)return"";let i=o?`#page=${o}`:void 0,s=t.vault.adapter.getBasePath(),a=gy(e,n),u=(0,Cf.relative)(s,a);if(u.startsWith(".."))return`[attachment](${hy((0,my.pathToFileURL)(a).href+(i??""))})`;{let l=t.metadataCache.getFirstLinkpathDest(u,"");return l?t.fileManager.generateMarkdownLink(l,r??"",i).replace(/^!/,""):(W.warn("fileLink: file not found",u,a),"")}},AR=e=>To(e,{replacement:"_"}),Af=e=>_a(e)&&e.type===_e.image,LK=(e,t,r)=>t?`[${r??""}](${hy(e)})`:`[[${e}${r?"|"+r:""}]]`,yy=(e,t)=>{if(Af(e)){let r=t.imgCacheImporter.import(e);if(r)return LK(r,t.app.vault.getConfig("useMarkdownLinks"));{let n=t.imgCacheImporter.getCachePath(e);return`[Annotation ${e.key}](${hy((0,my.pathToFileURL)(n).href)})`}}else return""};function RR(e){qt(e,{compile:t=>function(n,o){let i=this,s=t.call(this,n,o);if(!o?.filepath)return s;let a=o.filepath,u=ct(a,i.settings.templateDir);if(!u)return s;let l=s;switch(u.name){case"filename":l=(c,f)=>AR(s.call(this,c,f));break;case"annotation":l=(c,f)=>{let p=s.call(this,c,f),d=!0,{yaml:h,body:b}=If(p);if(h)try{(0,kf.parseYaml)(h).callout===!1&&(d=!1)}catch(v){new kf.Notice(`Error parsing frontmatter, ${v}`)}if(!d)return b;let y=b.trim().split(`
`);return y.push(`^${c.blockID}`),y.map(v=>`> ${v}`).join(`
`)};break;default:break}return Object.groupBy&&Map.groupBy?l:(c,f)=>{let p=qK(),d=l.call(this,c,f);return p(),d}}})}function qK(){let e=[];return Object.groupBy||(Object.groupBy=NR.default,e.push(()=>delete Object.groupBy)),Map.groupBy||(Map.groupBy=kR.default,e.push(()=>delete Map.groupBy)),()=>e.forEach(t=>t())}var Oo="zotero-key",ji="zt-attachments";var DR=require("url");var PR=require("obsidian");var Pn=e=>e.plugin.settings.current?.zoteroDataDir,Ha=Symbol("proxied"),Nf=e=>!!e[Ha];var Rf={"#FF6666":"red","#FF8C19":"orange","#F19837":"orange","#FFD400":"yellow","#999999":"gray","#AAAAAA":"gray","#5FB236":"green","#009980":"cyan","#2EA8E5":"blue","#576DD9":"navy","#A28AE5":"purple","#A6507B":"brown","#E56EEE":"magenta"};var by=new Set(pn()("attachment","tags")),vy=(e,t,r)=>new Proxy({get page(){return Go(e.position.pageIndex,!0)??NaN},get backlink(){return kn(e)},get blockID(){let n=Bt(e),o=Go(e.position.pageIndex,!0);return typeof o=="number"&&(n+=`p${o}`),n},get commentMd(){return e.comment?(0,PR.htmlToMarkdown)(e.comment):""},get imgPath(){return Af(this)?An(this,Pn(r)):""},get imgUrl(){if(Af(this)){let n=An(this,Pn(r));return(0,DR.pathToFileURL)(n).href}else return""},get imgLink(){return yy(this,r.plugin)},get imgEmbed(){let n=yy(this,r.plugin);return n?`!${n}`:""},get fileLink(){return Of(Pn(r),r.plugin.app,r.sourcePath,t.attachment,Go(e.position.pageIndex,!0))},get textBlock(){return e.text?`\`\`\`zotero-annot
> ${e.text} [zotero](${kn(e)})
\`\`\``:""},get colorName(){let n=e.color?.toUpperCase();return Rf[n]||this.color},docItem:"not-loaded"},{get(n,o,i){if(o==="tags"){if(!t.tags[e.itemID])throw console.error(t,e.itemID),new Error("No tags loaded for item "+e.itemID);return t.tags[e.itemID]}if(o==="docItem"){if(n.docItem==="not-loaded")throw new Error("Doc Item not loaded for item "+e.itemID);return n.docItem}return by.has(o)?Reflect.get(t,o,i):Reflect.get(e,o,i)??Reflect.get(n,o,i)},ownKeys(n){return[...Reflect.ownKeys(e),...by,...Reflect.ownKeys(n)]},getOwnPropertyDescriptor(n,o){return Object.prototype.hasOwnProperty.call(e,o)?Reflect.getOwnPropertyDescriptor(e,o):by.has(o)?Reflect.getOwnPropertyDescriptor(t,o):Reflect.getOwnPropertyDescriptor(n,o)}});function xy(e,t){return!e||Nf(e)?e:new Proxy({get filePath(){return gy(Pn(t),e)}},{get(r,n,o){return n===Ha?!0:Reflect.get(e,n,o)??Reflect.get(r,n,o)},ownKeys(r){return[...Reflect.ownKeys(e),...Reflect.ownKeys(r)]},getOwnPropertyDescriptor(r,n){return Object.prototype.hasOwnProperty.call(e,n)?Reflect.getOwnPropertyDescriptor(e,n):Reflect.getOwnPropertyDescriptor(r,n)}})}var wy=class extends Array{toString(){return this.join(" > ")}},Ey=({path:e,...t})=>{let r={path:wy.from(e),toString(){return t.name}};return new Proxy(r,{get(n,o,i){return Reflect.get(n,o,i)??Reflect.get(t,o,i)},ownKeys(n){return[...Reflect.ownKeys(t),...Reflect.ownKeys(n).filter(o=>!(o==="toJSON"||o==="toString"))]},getOwnPropertyDescriptor(n,o){return Object.prototype.hasOwnProperty.call(t,o)?Reflect.getOwnPropertyDescriptor(t,o):Reflect.getOwnPropertyDescriptor(n,o)}})};var Sy=e=>{let t={get fullname(){return Ia(e)??""},toString(){return this.fullname},toJSON(){return this.fullname}};return new Proxy(t,{get(r,n,o){return Reflect.get(r,n,o)??Reflect.get(e,n,o)},ownKeys(r){return[...Reflect.ownKeys(e),...Reflect.ownKeys(r).filter(n=>!(n==="toJSON"||n==="toString"))]},getOwnPropertyDescriptor(r,n){return Object.prototype.hasOwnProperty.call(e,n)?Reflect.getOwnPropertyDescriptor(e,n):Reflect.getOwnPropertyDescriptor(r,n)}})};var Iy=new Set(pn()("attachment","allAttachments","tags","notes")),_y=({creators:e,collections:t,...r},n,o)=>{let i=e.map(s=>Sy(s));return new Proxy({get backlink(){return kn(r)},get fileLink(){return Of(Pn(o),o.plugin.app,o.sourcePath,n.attachment)},get authorsShort(){let s=this.authors;if(!s.length)return"";let a=s[0],u=a.lastName??a.fullname;return s.length===1?u:`${u} et al.`},annotations:"not-loaded",creators:i,collections:t.map(s=>Ey(s)),get authors(){return i.filter(s=>s.creatorType==="author")}},{get(s,a,u){if(a==="tags"){if(!n.tags[r.itemID])throw new Error("No tags loaded for item "+r.itemID);return n.tags[r.itemID]}return Iy.has(a)?n[a]:a==="annotations"?s.annotations:Reflect.get(r,a,u)??Reflect.get(s,a,u)},ownKeys(s){return[...Reflect.ownKeys(r),...Iy,...Reflect.ownKeys(s)]},getOwnPropertyDescriptor(s,a){return Object.prototype.hasOwnProperty.call(r,a)?Reflect.getOwnPropertyDescriptor(r,a):Iy.has(a)?Reflect.getOwnPropertyDescriptor(n,a):Reflect.getOwnPropertyDescriptor(s,a)}})};function FR(e){return!e||Nf(e)?e:new Proxy({toString(){return e.name},toJSON(){return e.name}},{get(t,r,n){return r===Ha?!0:Reflect.get(t,r,n)??Reflect.get(e,r,n)},ownKeys(t){return[...Reflect.ownKeys(e),...Reflect.ownKeys(t).filter(r=>!(r==="toJSON"||r==="toString"))]},getOwnPropertyDescriptor(t,r){return Object.prototype.hasOwnProperty.call(e,r)?Reflect.getOwnPropertyDescriptor(e,r):Reflect.getOwnPropertyDescriptor(t,r)}})}function It(e,t,r){let n={...e,attachement:xy(e.attachment,t),allAttachments:e.allAttachments.map(a=>xy(a,t)),tags:Ai(e.tags,a=>a.map(u=>FR(u)))},o=_y(e.docItem,n,t),i=e.annotations.map(a=>{let u=vy(a,n,t);return u.docItem=o,u}),s=r?i[e.annotations.findIndex(a=>a.itemID===r.itemID)]:void 0;return o.annotations=i,{annotation:s,annotations:i,docItem:o}}var Fn=class extends ue{eta=this.use(Vl);plugin=this.use(be);settings=this.use(de);app=this.use(dt.App);get vault(){return this.app.vault}get folder(){return this.settings.templateDir}get filenameTemplate(){return this.settings.simpleTemplates?.filename}get autoTrim(){return this.settings.current?.autoTrim}async loadTemplates(){let t=this.vault.getAbstractFileByPath(this.folder);if(!t)return;if(!(t instanceof dt.TFolder)){W.warn("Template folder is occupied by a file");return}let r=[];dt.Vault.recurseChildren(t,async n=>{!at(n)||!n.path.endsWith(".eta.md")||r.push(n)}),await Promise.all(r.map(async n=>this.eta.tplFileCache.set(n,await this.vault.cachedRead(n))))}onload(){RR(this.eta),this.settings.once(async()=>{await this.loadTemplates()}),this.register(qe(Qe(()=>this.plugin.app.vault.trigger("zotero:template-updated","filename"),()=>this.filenameTemplate,!0))),this.register(qe(Qe(async()=>_r.All.forEach(t=>this.plugin.app.vault.trigger("zotero:template-updated",t)),()=>this.autoTrim,!0))),this.registerEvent(this.vault.on("create",this.onFileChange,this)),this.registerEvent(this.vault.on("modify",this.onFileChange,this)),this.registerEvent(this.vault.on("delete",async t=>{if(!at(t))return;let r=this.fromPath(t.path);r&&(this.eta.tplFileCache.delete(t),this.vault.trigger("zotero:template-updated",r))})),this.registerEvent(this.vault.on("rename",async(t,r)=>{await this.onFileChange(t);let n=this.fromPath(r);n&&this.vault.trigger("zotero:template-updated",n)}))}async onFileChange(t){if(!at(t))return;let r=this.fromPath(t.path);this.eta.tplFileCache.set(t,await this.vault.cachedRead(t)),this.vault.trigger("zotero:template-updated",r)}fromPath(t){let r=ct(t,this.folder);return r?.type==="ejectable"?r.name:null}onFileUpdate(t){at(t)&&this.fromPath(t.path)}onFileRename(t,r){at(t)&&this.fromPath(t.path),this.fromPath(r)}mergeAnnotTags(t){if(t.annotations.length===0)return t;let r=PT(t.annotations,t.tags);return t.annotations=r.annotations,t.tags={...t.tags,...r.tags},t}render(t,r){try{let n=this.eta.render(t,r);return this.plugin.imgCacheImporter.flush(),n}catch(n){throw console.error("Error while rendering",t,n),n}}renderAnnot(t,r,n){n.merge!==!1&&(r=this.mergeAnnotTags(r));let o=It(r,n,t);return this.render("annotation",o.annotation)}renderNote(t,r,n){r.merge!==!1&&(t=this.mergeAnnotTags(t));let o=It(t,r),i=this.#e(o.docItem,n),s=this.render("note",o.docItem);return["",i,s].join(`---
`)}renderAnnots(t,r){r.merge!==!1&&(t=this.mergeAnnotTags(t));let n=It(t,r);return this.render("annots",n.annotations)}renderCitations(t,r,n=!1){let o=t.map(i=>It(i,r));return this.render(n?"cite2":"cite",o.map(i=>i.docItem))}renderColored(t){return this.render("colored",t)}renderFilename(t,r){let n=It(t,r);return this.render("filename",n.docItem)}toFrontmatterRecord(t){let r=this.render("field",t),n=!1,{yaml:o,body:i}=If(r);if(o)try{(0,dt.parseYaml)(o).raw===!0&&(n=!0)}catch(f){new dt.Notice(`Error parsing frontmatter, ${f}`)}let s=Bt(t,!0),a=t.attachment?[t.attachment.itemID.toString()]:void 0,{[Oo]:u,[ji]:l,...c}=(0,dt.parseYaml)(i);return{mode:n?"raw":"parsed",yaml:[`${Oo}: ${s}`,`${ji}: ${l??a}`,i.trim(),""].join(`
`),data:{[Oo]:s,[ji]:a,...wa(c,f=>!(f===""||f===null||f===void 0))}}}renderFrontmatter(t,r,n){let o=It(t,r);return this.#e(o.docItem,n)}#e(t,r){try{let n=this.toFrontmatterRecord(t);return n.mode==="raw"?n.yaml:(0,dt.stringifyYaml)(r!==void 0?vo(n.data,r):n.data)}catch(n){throw it("Failed to renderYaml",n,t),new dt.Notice("Failed to renderYaml"),n}}async setFrontmatterTo(t,r){try{let n=this.toFrontmatterRecord(r).data;await this.plugin.app.fileManager.processFrontMatter(t,o=>Object.assign(o,n))}catch(n){it("Failed to set frontmatter to file "+t.path,n,r),new dt.Notice("Failed to set frontmatter to file "+t.path)}}};le([fe],Fn.prototype,"folder",1),le([fe],Fn.prototype,"filenameTemplate",1),le([fe],Fn.prototype,"autoTrim",1);var Df=require("@codemirror/state"),$R=require("obsidian");var MR=e=>Df.Prec.highest(Df.EditorState.languageData.of(t=>{let r=[],n=e.getConfig("autoPairBrackets"),o=e.getConfig("autoPairMarkdown");n&&r.push("(","[","{","'",'"'),o&&r.push("*","_","`","```");let i=t.field($R.editorInfoField);return i?.file&&Tf(i?.file)&&r.push("<","%"),[{closeBrackets:{brackets:r}}]}));var LR=require("obsidian");var jR=[{prefix:"=",name:"interpolate tag",description:"An interpolation outputs data into the template"},{prefix:" ",name:"evaluation tag",description:"An evaluate tag inserts its contents into the template function."}],Pf=class extends LR.EditorSuggest{onTrigger(t,r,n){if(!n||!Tf(n))return null;let o=r.getLine(t.line),s=o.substring(0,t.ch).match(/<%([ =]?)$/);if(!s)return null;let[a,u]=s,l=o.substring(t.ch).match(/^([\w ]*)%>/),c;if(!l)c={...t};else{let[,f]=l;if(u===" "&&f.length===1)return null;c={...t,ch:t.ch+f.length}}return{end:c,start:{ch:s.index+a.length-u.length,line:t.line},query:s[1]}}getSuggestions(t){return t.query?jR.filter(r=>r.prefix===t.query):jR}renderSuggestion({prefix:t,name:r,description:n},o){t===" "?o.createSpan({text:"No Prefix"}):o.createEl("code",{text:t}),o.createDiv({text:r}),o.createDiv({text:n})}selectSuggestion({prefix:t},r){if(!this.context)return;let{editor:n,end:o,start:i}=this.context,s=t===" "?" ":"= it. ";n.transaction({changes:[{from:i,to:o,text:s}],selection:{from:{...i,ch:i.ch+s.length-1}}})}};var Li=class extends ue{#e=null;plugin=this.use(be);settings=this.use(de);#t(){this.plugin.registerEditorSuggest(new Pf(this.plugin.app))}get etaBracketPairing(){return this.settings.current?.autoPairEta}#r(t){let r=this.#e!==null;this.#e===null?(this.#e=[],this.plugin.registerEditorExtension(this.#e)):this.#e.length=0,t&&this.#e.push(MR(this.plugin.app.vault)),r&&this.plugin.app.workspace.updateOptions()}onload(){this.#t(),this.register(qe(Qe(()=>this.#r(this.etaBracketPairing),()=>this.etaBracketPairing)))}};le([fe],Li.prototype,"etaBracketPairing",1);var Ty=e=>{let t=e?.frontmatter?.[Oo];return t&&typeof t=="string"&&Jv.test(t)?t:null},Ao=(e,t)=>{if(!e)return null;let r=typeof e=="string"?t.getCache(e):e instanceof Cy.TFile?t.getFileCache(e):null;return Ty(r)},ko=(e,t)=>{if(!e)return null;let n=(typeof e=="string"?t.getCache(e):e instanceof Cy.TFile?t.getFileCache(e):null)?.frontmatter?.[ji];if(n&&Array.isArray(n)&&n.length>0){let o=[];for(let i of n)if(typeof i=="string"){let s=Number(i);if(!(s>0&&Number.isInteger(s)))return null;o.push(s)}else if(typeof i=="number"){if(!(i>0&&Number.isInteger(i)))return null;o.push(i)}return o}return null},Ka=({id:e})=>!!e&&Yv.test(e),Va=e=>e.split("n").map(t=>{let[,r,,n]=t.split("p")[0].match(Zv);return Bt({key:r,groupID:n?+n:void 0},!0)});function Ga(e,t){let r=DT(e);return!!Ao(r,t.metadataCache)}var sM=require("url");S();var $n=Le({});S();var Be=Le({});S();var qR=function(e){return typeof e=="function"};var zK=!1,BR=zK;function UK(e){BR&&(qR(e)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof e)));var t=F(e);t.current=ne(function(){return e},[e]);var r=F();return r.current||(r.current=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return t.current.apply(this,n)}),r.current}var hr=UK;S();S();function WK(e,t){e===void 0&&(e=!1);var r=On(j(e),2),n=r[0],o=r[1],i=ne(function(){var s=t===void 0?!e:t,a=function(){return o(function(f){return f===e?s:e})},u=function(f){return o(f)},l=function(){return o(e)},c=function(){return o(s)};return{toggle:a,set:u,setLeft:l,setRight:c}},[]);return[n,i]}var zR=WK;function Ff(e){e===void 0&&(e=!1);var t=On(zR(!!e),2),r=t[0],n=t[1],o=n.toggle,i=n.set,s=ne(function(){var a=function(){return i(!0)},u=function(){return i(!1)};return{toggle:o,set:function(l){return i(!!l)},setTrue:a,setFalse:u}},[]);return[r,s]}S();function HK(e){var t=function(){return new Set(e)},r=On(j(t),2),n=r[0],o=r[1],i=function(u){n.has(u)||o(function(l){var c=new Set(l);return c.add(u),c})},s=function(u){n.has(u)&&o(function(l){var c=new Set(l);return c.delete(u),c})},a=function(){return o(t())};return[n,{add:hr(i),remove:hr(s),reset:hr(a)}]}var Oy=HK;S();var WR={},UR=e=>{let t,r=new Set,n=(u,l)=>{let c=typeof u=="function"?u(t):u;if(!Object.is(c,t)){let f=t;t=l??typeof c!="object"?c:Object.assign({},t,c),r.forEach(p=>p(t,f))}},o=()=>t,a={setState:n,getState:o,subscribe:u=>(r.add(u),()=>r.delete(u)),destroy:()=>{(WR.env&&WR.env.MODE)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return t=e(n,o,a),a},Ja=e=>e?UR(e):UR;S();var QR=ge(XR(),1);var{useSyncExternalStoreWithSelector:cV}=QR.default;function _t(e,t=e.getState,r){let n=cV(e.subscribe,e.getState,e.getServerState||e.getState,t,r);return go(n),n}function Bi(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(t,r[n])||!Object.is(e[r[n]],t[r[n]]))return!1;return!0}S();function eD(){for(var e=0,t,r,n="";e<arguments.length;)(t=arguments[e++])&&(r=tD(t))&&(n&&(n+=" "),n+=r);return n}function tD(e){if(typeof e=="string")return e;for(var t,r="",n=0;n<e.length;n++)e[n]&&(t=tD(e[n]))&&(r&&(r+=" "),r+=t);return r}var Ny="-";function oD(e){var t=fV(e);function r(o){var i=o.split(Ny);return i[0]===""&&i.length!==1&&i.shift(),iD(i,t)||lV(o)}function n(o){return e.conflictingClassGroups[o]||[]}return{getClassGroupId:r,getConflictingClassGroupIds:n}}function iD(e,t){if(e.length===0)return t.classGroupId;var r=e[0],n=t.nextPart.get(r),o=n?iD(e.slice(1),n):void 0;if(o)return o;if(t.validators.length!==0){var i=e.join(Ny);return t.validators.find(function(s){var a=s.validator;return a(i)})?.classGroupId}}var rD=/^\[(.+)\]$/;function lV(e){if(rD.test(e)){var t=rD.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}}function fV(e){var t=e.theme,r=e.prefix,n={nextPart:new Map,validators:[]},o=dV(Object.entries(e.classGroups),r);return o.forEach(function(i){var s=i[0],a=i[1];ky(a,n,s,t)}),n}function ky(e,t,r,n){e.forEach(function(o){if(typeof o=="string"){var i=o===""?t:nD(t,o);i.classGroupId=r;return}if(typeof o=="function"){if(pV(o)){ky(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(function(s){var a=s[0],u=s[1];ky(u,nD(t,a),r,n)})})}function nD(e,t){var r=e;return t.split(Ny).forEach(function(n){r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r}function pV(e){return e.isThemeGetter}function dV(e,t){return t?e.map(function(r){var n=r[0],o=r[1],i=o.map(function(s){return typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(function(a){var u=a[0],l=a[1];return[t+u,l]})):s});return[n,i]}):e}function sD(e){if(e<1)return{get:function(){},set:function(){}};var t=0,r=new Map,n=new Map;function o(i,s){r.set(i,s),t++,t>e&&(t=0,n=r,r=new Map)}return{get:function(s){var a=r.get(s);if(a!==void 0)return a;if((a=n.get(s))!==void 0)return o(s,a),a},set:function(s,a){r.has(s)?r.set(s,a):o(s,a)}}}var Ry="!";function aD(e){var t=e.separator||":";return function(n){for(var o=0,i=[],s=0,a=0;a<n.length;a++){var u=n[a];o===0&&u===t[0]&&(t.length===1||n.slice(a,a+t.length)===t)&&(i.push(n.slice(s,a)),s=a+t.length),u==="["?o++:u==="]"&&o--}var l=i.length===0?n:n.substring(s),c=l.startsWith(Ry),f=c?l.substring(1):l;return{modifiers:i,hasImportantModifier:c,baseClassName:f}}}function uD(e){if(e.length<=1)return e;var t=[],r=[];return e.forEach(function(n){var o=n[0]==="[";o?(t.push.apply(t,r.sort().concat([n])),r=[]):r.push(n)}),t.push.apply(t,r.sort()),t}function cD(e){return{cache:sD(e.cacheSize),splitModifiers:aD(e),...oD(e)}}var mV=/\s+/;function lD(e,t){var r=t.splitModifiers,n=t.getClassGroupId,o=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(mV).map(function(s){var a=r(s),u=a.modifiers,l=a.hasImportantModifier,c=a.baseClassName,f=n(c);if(!f)return{isTailwindClass:!1,originalClassName:s};var p=uD(u).join(":"),d=l?p+Ry:p;return{isTailwindClass:!0,modifierId:d,classGroupId:f,originalClassName:s}}).reverse().filter(function(s){if(!s.isTailwindClass)return!0;var a=s.modifierId,u=s.classGroupId,l=a+u;return i.has(l)?!1:(i.add(l),o(u).forEach(function(c){return i.add(a+c)}),!0)}).reverse().map(function(s){return s.originalClassName}).join(" ")}function fD(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,o,i,s=a;function a(l){var c=t[0],f=t.slice(1),p=f.reduce(function(d,h){return h(d)},c());return n=cD(p),o=n.cache.get,i=n.cache.set,s=u,u(l)}function u(l){var c=o(l);if(c)return c;var f=lD(l,n);return i(l,f),f}return function(){return s(eD.apply(null,arguments))}}function Se(e){var t=function(n){return n[e]||[]};return t.isThemeGetter=!0,t}var dD=/^\[(?:([a-z-]+):)?(.+)\]$/i,hV=/^\d+\/\d+$/,gV=new Set(["px","full","screen"]),yV=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bV=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh)/,vV=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function rr(e){return zi(e)||gV.has(e)||hV.test(e)||Mn(e)}function Mn(e){return No(e,"length",xV)}function mD(e){return No(e,"size",bD)}function hD(e){return No(e,"position",bD)}function gD(e){return No(e,"url",wV)}function Mf(e){return No(e,"number",zi)}function zi(e){return!Number.isNaN(Number(e))}function Ui(e){return pD(e)||No(e,"number",pD)}function Pe(e){return dD.test(e)}function Wi(){return!0}function tn(e){return yV.test(e)}function yD(e){return No(e,"",EV)}function No(e,t,r){var n=dD.exec(e);return n?n[1]?n[1]===t:r(n[2]):!1}function xV(e){return bV.test(e)}function bD(){return!1}function wV(e){return e.startsWith("url(")}function pD(e){return Number.isInteger(Number(e))}function EV(e){return vV.test(e)}function vD(){var e=Se("colors"),t=Se("spacing"),r=Se("blur"),n=Se("brightness"),o=Se("borderColor"),i=Se("borderRadius"),s=Se("borderSpacing"),a=Se("borderWidth"),u=Se("contrast"),l=Se("grayscale"),c=Se("hueRotate"),f=Se("invert"),p=Se("gap"),d=Se("gradientColorStops"),h=Se("inset"),b=Se("margin"),y=Se("opacity"),v=Se("padding"),w=Se("saturate"),T=Se("scale"),M=Se("sepia"),V=Se("skew"),J=Se("space"),G=Se("translate"),K=function(){return["auto","contain","none"]},P=function(){return["auto","hidden","clip","visible","scroll"]},X=function(){return["auto",t]},C=function(){return["",rr]},_=function(){return["auto",zi,Pe]},I=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},B=function(){return["solid","dashed","dotted","double","none"]},D=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},re=function(){return["start","end","center","between","around","evenly"]},oe=function(){return["","0",Pe]},me=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},ae=function(){return[zi,Mf]},E=function(){return[zi,Pe]};return{cacheSize:500,theme:{colors:[Wi],spacing:[rr],blur:["none","",tn,Mn],brightness:ae(),borderColor:[e],borderRadius:["none","","full",tn,Mn],borderSpacing:[t],borderWidth:C(),contrast:ae(),grayscale:oe(),hueRotate:E(),invert:oe(),gap:[t],gradientColorStops:[e],inset:X(),margin:X(),opacity:ae(),padding:[t],saturate:ae(),scale:ae(),sepia:oe(),skew:E(),space:[t],translate:[t]},classGroups:{aspect:[{aspect:["auto","square","video",Pe]}],container:["container"],columns:[{columns:[tn]}],"break-after":[{"break-after":me()}],"break-before":[{"break-before":me()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(I(),[Pe])}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:K()}],"overscroll-x":[{"overscroll-x":K()}],"overscroll-y":[{"overscroll-y":K()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ui]}],basis:[{basis:[t]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Pe]}],grow:[{grow:oe()}],shrink:[{shrink:oe()}],order:[{order:["first","last","none",Ui]}],"grid-cols":[{"grid-cols":[Wi]}],"col-start-end":[{col:["auto",{span:[Ui]},Pe]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[Wi]}],"row-start-end":[{row:["auto",{span:[Ui]},Pe]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Pe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Pe]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:re()}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:[].concat(re(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(re(),["baseline","stretch"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[J]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[J]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",t]}],"min-w":[{"min-w":["min","max","fit",rr]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[tn]},tn,Mn]}],h:[{h:[t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",rr]}],"max-h":[{"max-h":[t,"min","max","fit"]}],"font-size":[{text:["base",tn,Mn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mf]}],"font-family":[{font:[Wi]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Mn]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",rr]}],"list-style-type":[{list:["none","disc","decimal",Pe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(B(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",rr]}],"underline-offset":[{"underline-offset":["auto",rr]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:[t]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Mn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap"]}],break:[{break:["normal","words","all","keep"]}],content:[{content:["none",Pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(I(),[hD])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",mD]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},gD]}],"bg-color":[{bg:[e]}],"gradient-from":[{from:[d]}],"gradient-via":[{via:[d]}],"gradient-to":[{to:[d]}],rounded:[{rounded:[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[].concat(B(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:B()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:[""].concat(B())}],"outline-offset":[{"outline-offset":[rr]}],"outline-w":[{outline:[rr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:C()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[rr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",tn,yD]}],"shadow-color":[{shadow:[Wi]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":D()}],"bg-blend":[{"bg-blend":D()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",tn,Pe]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Pe]}],duration:[{duration:E()}],ease:[{ease:["linear","in","out","in-out",Pe]}],delay:[{delay:E()}],animate:[{animate:["none","spin","ping","pulse","bounce",Pe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Ui,Pe]}],"translate-x":[{"translate-x":[G]}],"translate-y":[{"translate-y":[G]}],"skew-x":[{"skew-x":[V]}],"skew-y":[{"skew-y":[V]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Pe]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Pe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":[t]}],"scroll-mx":[{"scroll-mx":[t]}],"scroll-my":[{"scroll-my":[t]}],"scroll-mt":[{"scroll-mt":[t]}],"scroll-mr":[{"scroll-mr":[t]}],"scroll-mb":[{"scroll-mb":[t]}],"scroll-ml":[{"scroll-ml":[t]}],"scroll-p":[{"scroll-p":[t]}],"scroll-px":[{"scroll-px":[t]}],"scroll-py":[{"scroll-py":[t]}],"scroll-pt":[{"scroll-pt":[t]}],"scroll-pr":[{"scroll-pr":[t]}],"scroll-pb":[{"scroll-pb":[t]}],"scroll-pl":[{"scroll-pl":[t]}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Pe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[rr,Mf]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]}}}var Dy=fD(vD);function ee(...e){return Dy(Hh(e))}S();S();function jf(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Lf=(e,t)=>{let{setIcon:r}=Q($n),n=F(null);return Y(i=>{n.current&&SV.call(n.current),i&&(r(i,e),t&&i.firstElementChild instanceof SVGSVGElement&&i.firstElementChild.style.setProperty("--icon-size",typeof t=="number"||!Number.isNaN(Number(t))?`${t}px`:t)),n.current=i},[e,t,r])};function SV(){for(;this.lastChild;)this.removeChild(this.lastChild)}var jn=st(Z(function({icon:t,size:r,className:n,...o},i){let s=Lf(t,r),a=jf(s,i);return m("div",{ref:a,className:ee("zt-icon",n),...o})}));S();var Ro=Z(function({onClick:t,onKeyDown:r,className:n,...o},i){return m(jn,{onClick:t,onKeyDown:r??t,className:ee("clickable-icon",n),...o,ref:i,role:"button",tabIndex:0})});S();S();var xD=st(Z(function({icon:t,...r},n){let o=Lf(t);return m("button",{ref:jf(o,n),...r})}));var Do=Z(function({className:t,active:r=!1,...n},o){return m(xD,{...n,ref:o,className:ee("clickable-icon",{"is-active":r},t)})});function Za(e){return m(Ro,{size:16,icon:"info","aria-label":"Show details",...e})}function Ya(){let e=arguments[0];for(let t=1,r=arguments.length;t<r;t++)e=arguments[t](e);return e}S();S();var wD=st(function({content:t,className:r,...n}){let{sanitize:o,renderMarkdown:i}=Q($n),s=ne(()=>o(t).replace(/<\/?b>/g,"**").replace(/<\/?i>/g,"*"),[t,o]);return m("div",{className:ee("annot-comment select-text overflow-x-auto break-words px-2 py-1",r),...n,children:i(s)})});S();var ED=Z(function({className:t,...r},n){return m("div",{ref:n,className:ee("annot-excerpt",t),...r})});S();function Py({text:e,pageLabel:t,className:r,collapsed:n=!1,...o}){let i=e??`Area Excerpt for Page ${t??"?"}`;return m("img",{className:ee("w-full",n?"max-h-20 object-cover object-left-top":"object-scale-down",r),alt:i,...o})}var SD=st(function({type:t,text:r,pageLabel:n,imgSrc:o,collapsed:i}){switch(t){case _e.highlight:case _e.underline:case _e.text:return m("p",{className:"select-text",children:r});case _e.image:if(!o)throw new Error("imgSrc is required for image annotation");return m(Py,{collapsed:i,src:o,pageLabel:n,text:r});default:return m($,{children:["Unsupported Type: ",_e[t]??t]})}});function Fy({checkbox:e,drag:t,buttons:r,onMoreOptions:n,className:o,children:i,onContextMenu:s,...a}){return m("div",{className:ee("annot-header flex cursor-context-menu items-center gap-1",o),onContextMenu:s??n,...a,children:[e,m("div",{className:"annot-header-drag-container flex flex-row items-center gap-1",children:t}),m("div",{className:"annot-header-buttons-container flex flex-row items-center gap-1 opacity-0 transition-opacity hover:opacity-100",children:r}),m("div",{className:"annot-header-space flex-1"}),i]})}var IV=typeof global=="object"&&global&&global.Object===Object&&global,ID=IV;var _V=typeof self=="object"&&self&&self.Object===Object&&self,CV=ID||_V||Function("return this")(),_D=CV;var TV=_D.Symbol,rn=TV;var CD=Object.prototype,OV=CD.hasOwnProperty,AV=CD.toString,Xa=rn?rn.toStringTag:void 0;function kV(e){var t=OV.call(e,Xa),r=e[Xa];try{e[Xa]=void 0;var n=!0}catch{}var o=AV.call(e);return n&&(t?e[Xa]=r:delete e[Xa]),o}var TD=kV;var NV=Object.prototype,RV=NV.toString;function DV(e){return RV.call(e)}var OD=DV;var PV="[object Null]",FV="[object Undefined]",AD=rn?rn.toStringTag:void 0;function $V(e){return e==null?e===void 0?FV:PV:AD&&AD in Object(e)?TD(e):OD(e)}var kD=$V;function MV(e){return e!=null&&typeof e=="object"}var ND=MV;var jV="[object Symbol]";function LV(e){return typeof e=="symbol"||ND(e)&&kD(e)==jV}var RD=LV;function qV(e,t){for(var r=-1,n=e==null?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var DD=qV;var BV=Array.isArray,PD=BV;var zV=1/0,FD=rn?rn.prototype:void 0,$D=FD?FD.toString:void 0;function MD(e){if(typeof e=="string")return e;if(PD(e))return DD(e,MD)+"";if(RD(e))return $D?$D.call(e):"";var t=e+"";return t=="0"&&1/e==-zV?"-0":t}var jD=MD;function UV(e){return e==null?"":jD(e)}var Hi=UV;function WV(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),r=r>o?o:r,r<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(o);++n<o;)i[n]=e[n+t];return i}var LD=WV;function HV(e,t,r){var n=e.length;return r=r===void 0?n:r,!t&&r>=n?e:LD(e,t,r)}var qD=HV;var KV="\\ud800-\\udfff",VV="\\u0300-\\u036f",GV="\\ufe20-\\ufe2f",JV="\\u20d0-\\u20ff",ZV=VV+GV+JV,YV="\\ufe0e\\ufe0f",XV="\\u200d",QV=RegExp("["+XV+KV+ZV+YV+"]");function eG(e){return QV.test(e)}var qf=eG;function tG(e){return e.split("")}var BD=tG;var zD="\\ud800-\\udfff",rG="\\u0300-\\u036f",nG="\\ufe20-\\ufe2f",oG="\\u20d0-\\u20ff",iG=rG+nG+oG,sG="\\ufe0e\\ufe0f",aG="["+zD+"]",$y="["+iG+"]",My="\\ud83c[\\udffb-\\udfff]",uG="(?:"+$y+"|"+My+")",UD="[^"+zD+"]",WD="(?:\\ud83c[\\udde6-\\uddff]){2}",HD="[\\ud800-\\udbff][\\udc00-\\udfff]",cG="\\u200d",KD=uG+"?",VD="["+sG+"]?",lG="(?:"+cG+"(?:"+[UD,WD,HD].join("|")+")"+VD+KD+")*",fG=VD+KD+lG,pG="(?:"+[UD+$y+"?",$y,WD,HD,aG].join("|")+")",dG=RegExp(My+"(?="+My+")|"+pG+fG,"g");function mG(e){return e.match(dG)||[]}var GD=mG;function hG(e){return qf(e)?GD(e):BD(e)}var JD=hG;function gG(e){return function(t){t=Hi(t);var r=qf(t)?JD(t):void 0,n=r?r[0]:t.charAt(0),o=r?qD(r,1).join(""):t.slice(1);return n[e]()+o}}var ZD=gG;var yG=ZD("toUpperCase"),YD=yG;function bG(e,t,r,n){var o=-1,i=e==null?0:e.length;for(n&&i&&(r=e[++o]);++o<i;)r=t(r,e[o],o,e);return r}var XD=bG;function vG(e){return function(t){return e?.[t]}}var QD=vG;var xG={\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:"s"},wG=QD(xG),eP=wG;var EG=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,SG="\\u0300-\\u036f",IG="\\ufe20-\\ufe2f",_G="\\u20d0-\\u20ff",CG=SG+IG+_G,TG="["+CG+"]",OG=RegExp(TG,"g");function AG(e){return e=Hi(e),e&&e.replace(EG,eP).replace(OG,"")}var tP=AG;var kG=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function NG(e){return e.match(kG)||[]}var rP=NG;var RG=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function DG(e){return RG.test(e)}var nP=DG;var uP="\\ud800-\\udfff",PG="\\u0300-\\u036f",FG="\\ufe20-\\ufe2f",$G="\\u20d0-\\u20ff",MG=PG+FG+$G,cP="\\u2700-\\u27bf",lP="a-z\\xdf-\\xf6\\xf8-\\xff",jG="\\xac\\xb1\\xd7\\xf7",LG="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qG="\\u2000-\\u206f",BG=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",fP="A-Z\\xc0-\\xd6\\xd8-\\xde",zG="\\ufe0e\\ufe0f",pP=jG+LG+qG+BG,dP="['\u2019]",oP="["+pP+"]",UG="["+MG+"]",mP="\\d+",WG="["+cP+"]",hP="["+lP+"]",gP="[^"+uP+pP+mP+cP+lP+fP+"]",HG="\\ud83c[\\udffb-\\udfff]",KG="(?:"+UG+"|"+HG+")",VG="[^"+uP+"]",yP="(?:\\ud83c[\\udde6-\\uddff]){2}",bP="[\\ud800-\\udbff][\\udc00-\\udfff]",Ki="["+fP+"]",GG="\\u200d",iP="(?:"+hP+"|"+gP+")",JG="(?:"+Ki+"|"+gP+")",sP="(?:"+dP+"(?:d|ll|m|re|s|t|ve))?",aP="(?:"+dP+"(?:D|LL|M|RE|S|T|VE))?",vP=KG+"?",xP="["+zG+"]?",ZG="(?:"+GG+"(?:"+[VG,yP,bP].join("|")+")"+xP+vP+")*",YG="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",XG="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",QG=xP+vP+ZG,eJ="(?:"+[WG,yP,bP].join("|")+")"+QG,tJ=RegExp([Ki+"?"+hP+"+"+sP+"(?="+[oP,Ki,"$"].join("|")+")",JG+"+"+aP+"(?="+[oP,Ki+iP,"$"].join("|")+")",Ki+"?"+iP+"+"+sP,Ki+"+"+aP,XG,YG,mP,eJ].join("|"),"g");function rJ(e){return e.match(tJ)||[]}var wP=rJ;function nJ(e,t,r){return e=Hi(e),t=r?void 0:t,t===void 0?nP(e)?wP(e):rP(e):e.match(t)||[]}var EP=nJ;var oJ="['\u2019]",iJ=RegExp(oJ,"g");function sJ(e){return function(t){return XD(EP(tP(t).replace(iJ,"")),e,"")}}var SP=sJ;var aJ=SP(function(e,t,r){return e+(r?" ":"")+YD(t)}),jy=aJ;S();var IP=st(function({icon:t,color:r,type:n,className:o,...i}){let s=jy(_e[n]);return m(jn,{icon:t,style:{color:r??void 0},className:ee(o,"annot-type-icon","flex h-auto cursor-grab items-center justify-center opacity-[var(--icon-opacity)]"),"aria-label":s,"aria-label-delay":"500",...i})});var _P=e=>{switch(e){case _e.highlight:return"align-left";case _e.underline:return"underline";case _e.image:return"frame";case _e.text:return"text-select";case _e.note:case _e.ink:default:return"file-question"}};S();var CP=e=>{let{annotRenderer:t,store:r}=Q(Be),n=_t(r,t.storeSelector,Bi);return t.get(e,n)};S();var TP=e=>{let{getImgSrc:t}=Q(Be);return ne(()=>t(e),[e,t])};function Ly({className:e,...t}){return m(Ro,{icon:"more-vertical",className:ee("annot-header-more-options",e),"aria-label":"More options",size:"0.9rem","aria-label-delay":"50",...t})}S();var OP=st(function({pageLabel:t,backlink:r,className:n,...o}){let i=t?`Page ${t}`:"";return r?m("a",{className:ee("annot-page","external-link","bg-[length:12px] bg-[center_right_3px] pr-[18px] text-xs",n),href:r,"aria-label":`Open annotation in Zotero at page ${t}`,"aria-label-delay":"500",...o,children:i}):m("span",{className:ee("annot-page",n),children:i})});S();function qy({tags:e}){return e.length===0?null:m("div",{className:"annot-tags-container",children:e.map(t=>m(uJ,{...t},t.tagID))})}var uJ=st(function({name:t}){return m("a",{className:ee("tag","annot-tag"),children:t})});function By({collapsed:e=!1,annotation:t,checkbox:r,tags:n,className:o,...i}){let s=F(null),{onMoreOptions:a,onDragStart:u,onShowDetails:l}=Q(Be),c=Qh.selectKeys(t,["type","text","pageLabel"]),f=CP(t),p=hr(h=>a(h,t)),d=hr(()=>l("annot",t.itemID));return m("div",{className:ee("annot-preview","bg-primary shadow-border col-span-1 flex flex-col divide-y overflow-auto rounded-sm transition-colors",o),"data-id":t.itemID,...i,children:[m(Fy,{className:"bg-primary-alt py-1 pl-2 pr-1",checkbox:r,drag:m(IP,{type:t.type,color:t.color,icon:_P(t.type),draggable:f!==null,onDragStart:hr(h=>f&&u(h,f,s.current)),size:16}),buttons:m($,{children:[m(Za,{className:"p-0.5",size:14,onClick:d}),m(Ly,{className:"p-0",onClick:p})]}),onMoreOptions:p,children:m(OP,{pageLabel:t.pageLabel,backlink:kn(t)})}),m(ED,{ref:s,className:"px-2 py-1",children:m("blockquote",{className:ee("border-l-blockquote pl-2 leading-tight",{"line-clamp-3":e}),style:{borderColor:t.color??"var(--interactive-accent)"},children:m(SD,{...c,collapsed:e,imgSrc:TP(t)})})}),t.comment&&m(wD,{content:t.comment}),n&&m(qy,{tags:n})]})}function zy({selectable:e=!1,collapsed:t,annotations:r,getTags:n}){let[o,{add:i,remove:s}]=Oy();return m("div",{role:"list",className:"@md:grid-cols-2 @md:gap-3 @3xl:grid-cols-4 grid grid-cols-1 gap-2",children:r.map(a=>m(By,{checkbox:e&&m(cJ,{checked:o.has(a.itemID),onChange:u=>u?i(a.itemID):s(a.itemID)}),collapsed:t,role:"listitem",annotation:a,tags:n(a.itemID)},a.itemID))})}function cJ({checked:e,onChange:t}){return m("div",{className:"flex h-5 items-center",children:m("input",{type:"checkbox",className:"m-0 h-4 w-4",checked:e,onChange:r=>t(r.target.checked)})})}S();var lJ=()=>_t(Q(Be).store,e=>({attachments:e.allAttachments,onChange:e.setActiveAtch,value:e.attachmentID}),Bi);function Uy(){let{attachments:e,onChange:t,value:r}=lJ();return e?e.length===1?null:e.length<=0?m("span",{className:"atch-select-empty",children:"No attachments available"}):m("select",{className:"atch-select",onChange:n=>t(parseInt(n.target.value,10)),value:r??void 0,children:e.map(({itemID:n,path:o,annotCount:i})=>m("option",{value:n,children:["(",i,") ",o?.replace(/^storage:/,"")]},n))}):m($,{children:"Loading"})}function Wy({isCollapsed:e,...t}){return m(Do,{...t,icon:e?"chevrons-up-down":"chevrons-down-up","aria-label":e?"Expand":"Collapse"})}S();function Bf(e){let{store:t,onSetFollow:r}=Q(Be),n=_t(t,s=>s.follow),o=n===null?"not following":n==="ob-note"?"active literature note":"active literature in Zotero reader";return m($,{children:[m(Do,{...e,onClick:r,icon:n===null?"unlink":"link","aria-label":"Choose follow mode"+(n===null?" (Currently linked with literature)":""),"aria-label-delay":"50"}),n!==null&&m("span",{className:"ml-1","aria-label":`Following ${o}`,children:n==="ob-note"?"ob":"zt"})]})}function zf({children:e,buttons:t}){return m("div",{className:"nav-header",children:[m("div",{className:"nav-buttons-container",children:t}),e]})}function Hy(e){return m(Do,{...e,icon:"refresh-ccw","aria-label":"Refresh annotation list","aria-label-delay":"50"})}var fJ=()=>{let{registerDbUpdate:e,store:t}=Q(Be),r=_t(t,n=>n.refresh);U(()=>e(r),[e,r])};function Qa(){fJ();let{store:e}=Q(Be),t=_t(e,r=>r.doc);return t?m(pJ,{docItem:t.docItem}):m($,{children:[m(zf,{buttons:m(Bf,{})}),m("div",{className:"pane-empty p-2",children:"Active file not literature note"})]})}function pJ({docItem:e}){let{refreshConn:t,onShowDetails:r}=Q(Be),[n,{toggle:o}]=Ff(!1),i=dJ();return m($,{children:[m(zf,{buttons:m($,{children:[m(Za,{className:"nav-action-button",onClick:hr(()=>r("doc-item",e.itemID))}),m(Wy,{className:"nav-action-button",isCollapsed:n,onClick:o}),m(Hy,{className:"nav-action-button",onClick:t}),m(Bf,{})]}),children:m(Uy,{})}),m("div",{className:ee("annots-container @container","overflow-auto px-3 pt-1 pb-8 text-xs"),children:i?m(zy,{collapsed:n,...i}):m($,{children:"Loading"})})]})}var dJ=()=>_t(Q(Be).store,e=>!e.doc||!e.annotations||!e.attachment?null:{annotations:e.annotations,getTags:t=>e.tags[t]??[]},Bi);S();function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ce.apply(this,arguments)}function Ky(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i<n.length;i++)o=n[i],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Uf(e,t=166){let r;function n(...o){let i=()=>{e.apply(this,o)};clearTimeout(r),r=setTimeout(i,t)}return n.clear=()=>{clearTimeout(r)},n}function Vy(e){return e&&e.ownerDocument||document}function eu(e){return Vy(e).defaultView||window}function Gy(e,t){typeof e=="function"?e(t):e&&(e.current=t)}S();var mJ=typeof window<"u"?Et:U,Jy=mJ;S();function Wf(...e){return ne(()=>e.every(t=>t==null)?null:t=>{e.forEach(r=>{Gy(r,t)})},e)}S();S();var hJ=["onChange","maxRows","minRows","style","value"];function Hf(e){return parseInt(e,10)||0}var gJ={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function AP(e){return e==null||Object.keys(e).length===0||e.outerHeightStyle===0&&!e.overflow}var yJ=Z(function(t,r){let{onChange:n,maxRows:o,minRows:i=1,style:s,value:a}=t,u=Ky(t,hJ),{current:l}=F(a!=null),c=F(null),f=Wf(r,c),p=F(null),d=F(0),[h,b]=j({outerHeightStyle:0}),y=Y(()=>{let V=c.current,G=eu(V).getComputedStyle(V);if(G.width==="0px")return{outerHeightStyle:0};let K=p.current;K.style.width=G.width,K.value=V.value||t.placeholder||"x",K.value.slice(-1)===`
`&&(K.value+=" ");let P=G.boxSizing,X=Hf(G.paddingBottom)+Hf(G.paddingTop),C=Hf(G.borderBottomWidth)+Hf(G.borderTopWidth),_=K.scrollHeight;K.value="x";let I=K.scrollHeight,B=_;i&&(B=Math.max(Number(i)*I,B)),o&&(B=Math.min(Number(o)*I,B)),B=Math.max(B,I);let D=B+(P==="border-box"?X+C:0),re=Math.abs(B-_)<=1;return{outerHeightStyle:D,overflow:re}},[o,i,t.placeholder]),v=(V,J)=>{let{outerHeightStyle:G,overflow:K}=J;return d.current<20&&(G>0&&Math.abs((V.outerHeightStyle||0)-G)>1||V.overflow!==K)?(d.current+=1,{overflow:K,outerHeightStyle:G}):V},w=Y(()=>{let V=y();AP(V)||b(J=>v(J,V))},[y]),T=()=>{let V=y();AP(V)||Rr(()=>{b(J=>v(J,V))})};return U(()=>{let V=Uf(()=>{d.current=0,c.current&&T()}),J,G=c.current,K=eu(G);return K.addEventListener("resize",V),typeof ResizeObserver<"u"&&(J=new ResizeObserver(V),J.observe(G)),()=>{V.clear(),K.removeEventListener("resize",V),J&&J.disconnect()}}),Jy(()=>{w()}),U(()=>{d.current=0},[a]),m($,{children:[m("textarea",ce({value:a,onChange:V=>{d.current=0,l||w(),n&&n(V)},ref:f,rows:i,style:ce({height:h.outerHeightStyle,overflow:h.overflow?"hidden":void 0},s)},u)),m("textarea",{"aria-hidden":!0,className:t.className,readOnly:!0,ref:p,tabIndex:-1,style:ce({},gJ.shadow,s,{padding:0})})]})}),tu=yJ;S();S();S();S();function bJ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Zy(...e){return t=>e.forEach(r=>bJ(r,t))}function Kf(...e){return Y(Zy(...e),e)}S();function kP(e,t=[]){let r=[];function n(i,s){let a=Le(s),u=r.length;r=[...r,s];function l(f){let{scope:p,children:d,...h}=f,b=p?.[e][u]||a,y=ne(()=>h,Object.values(h));return H(b.Provider,{value:y},d)}function c(f,p){let d=p?.[e][u]||a,h=Q(d);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(s=>Le(s));return function(a){let u=a?.[e]||i;return ne(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[n,vJ(o,...t)]}function vJ(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let s=n.reduce((a,{useScope:u,scopeName:l})=>{let f=u(i)[`__scope${l}`];return{...a,...f}},{});return ne(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function Ct(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}S();S();function Yy(e){let t=F(e);return U(()=>{t.current=e}),ne(()=>(...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function NP({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,o]=xJ({defaultProp:t,onChange:r}),i=e!==void 0,s=i?e:n,a=Yy(r),u=Y(l=>{if(i){let f=typeof l=="function"?l(e):l;f!==e&&a(f)}else o(l)},[i,e,o,a]);return[s,u]}function xJ({defaultProp:e,onChange:t}){let r=j(e),[n]=r,o=F(n),i=Yy(t);return U(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}S();function RP(e){let t=F({value:e,previous:e});return ne(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}S();S();var ru=globalThis?.document?Et:()=>{};function DP(e){let[t,r]=j(void 0);return ru(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let i=o[0],s,a;if("borderBoxSize"in i){let u=i.borderBoxSize,l=Array.isArray(u)?u[0]:u;s=l.inlineSize,a=l.blockSize}else s=e.offsetWidth,a=e.offsetHeight;r({width:s,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}S();S();function wJ(e,t){return Nr((r,n)=>{let o=t[r][n];return o??r},e)}var Xy=e=>{let{present:t,children:r}=e,n=EJ(t),o=typeof r=="function"?r({present:n.isPresent}):Ve.only(r),i=Kf(n.ref,o.ref);return typeof r=="function"||n.isPresent?Xt(o,{ref:i}):null};Xy.displayName="Presence";function EJ(e){let[t,r]=j(),n=F({}),o=F(e),i=F("none"),s=e?"mounted":"unmounted",[a,u]=wJ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U(()=>{let l=Vf(n.current);i.current=a==="mounted"?l:"none"},[a]),ru(()=>{let l=n.current,c=o.current;if(c!==e){let p=i.current,d=Vf(l);e?u("MOUNT"):d==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&p!==d?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),ru(()=>{if(t){let l=f=>{let d=Vf(n.current).includes(f.animationName);f.target===t&&d&&Rr(()=>u("ANIMATION_END"))},c=f=>{f.target===t&&(i.current=Vf(n.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:Y(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Vf(e){return e?.animationName||"none"}S();S();S();var eb=Z((e,t)=>{let{children:r,...n}=e,o=Ve.toArray(r),i=o.find(IJ);if(i){let s=i.props.children,a=o.map(u=>u===i?Ve.count(s)>1?Ve.only(null):Pt(s)?s.props.children:null:u);return H(Qy,ce({},n,{ref:t}),Pt(s)?Xt(s,void 0,a):null)}return H(Qy,ce({},n,{ref:t}),r)});eb.displayName="Slot";var Qy=Z((e,t)=>{let{children:r,...n}=e;return Pt(r)?Xt(r,{..._J(n,r.props),ref:Zy(t,r.ref)}):Ve.count(r)>1?Ve.only(null):null});Qy.displayName="SlotClone";var SJ=({children:e})=>H($,null,e);function IJ(e){return Pt(e)&&e.type===SJ}function _J(e,t){let r={...t};for(let n in t){let o=e[n],i=t[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...a)=>{i(...a),o(...a)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...e,...r}}var CJ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],tb=CJ.reduce((e,t)=>{let r=Z((n,o)=>{let{asChild:i,...s}=n,a=i?eb:t;return U(()=>{window[Symbol.for("radix-ui")]=!0},[]),H(a,ce({},s,{ref:o}))});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});var PP="Checkbox",[TJ,bOe]=kP(PP),[OJ,AJ]=TJ(PP),kJ=Z((e,t)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:s,disabled:a,value:u="on",onCheckedChange:l,...c}=e,[f,p]=j(null),d=Kf(t,T=>p(T)),h=F(!1),b=f?!!f.closest("form"):!0,[y=!1,v]=NP({prop:o,defaultProp:i,onChange:l}),w=F(y);return U(()=>{let T=f?.form;if(T){let M=()=>v(w.current);return T.addEventListener("reset",M),()=>T.removeEventListener("reset",M)}},[f,v]),H(OJ,{scope:r,state:y,disabled:a},H(tb.button,ce({type:"button",role:"checkbox","aria-checked":Po(y)?"mixed":y,"aria-required":s,"data-state":FP(y),"data-disabled":a?"":void 0,disabled:a,value:u},c,{ref:d,onKeyDown:Ct(e.onKeyDown,T=>{T.key==="Enter"&&T.preventDefault()}),onClick:Ct(e.onClick,T=>{v(M=>Po(M)?!0:!M),b&&(h.current=T.isPropagationStopped(),h.current||T.stopPropagation())})})),b&&H(DJ,{control:f,bubbles:!h.current,name:n,value:u,checked:y,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),NJ="CheckboxIndicator",RJ=Z((e,t)=>{let{__scopeCheckbox:r,forceMount:n,...o}=e,i=AJ(NJ,r);return H(Xy,{present:n||Po(i.state)||i.state===!0},H(tb.span,ce({"data-state":FP(i.state),"data-disabled":i.disabled?"":void 0},o,{ref:t,style:{pointerEvents:"none",...e.style}})))}),DJ=e=>{let{control:t,checked:r,bubbles:n=!0,...o}=e,i=F(null),s=RP(r),a=DP(t);return U(()=>{let u=i.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(s!==r&&f){let p=new Event("click",{bubbles:n});u.indeterminate=Po(r),f.call(u,Po(r)?!1:r),u.dispatchEvent(p)}},[s,r,n]),H("input",ce({type:"checkbox","aria-hidden":!0,defaultChecked:Po(r)?!1:r},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Po(e){return e==="indeterminate"}function FP(e){return Po(e)?"indeterminate":e?"checked":"unchecked"}var rb=kJ,$P=RJ;S();var nb=Z(({className:e,checked:t,...r},n)=>m(rb,{ref:n,className:ee("data-[state=checked]:text-mod-error peer h-3 w-3 shrink-0 rounded-sm border disabled:cursor-not-allowed disabled:opacity-50 bg-primary obzt-btn-reset",e),checked:t,...r,children:m($P,{className:ee("flex items-center justify-center"),children:m(jn,{icon:"chevrons-down",size:"0.75rem",className:"contents"})})}));nb.displayName=rb.displayName;var MP=Z(({id:e,checked:t,onCheckChange:r,title:n,disabled:o,className:i,...s},a)=>m("div",{className:ee("flex items-center gap-x-1","rounded-sm focus-within:outline-none focus-within:ring-2 focus-within:ring-mod-border-focus focus-within:ring-offset-2",t&&"animate-pulse",i),ref:a,...s,children:[m(nb,{className:ee("h-3 w-3",o&&"hidden"),id:e,checked:t,disabled:o,onCheckedChange:r}),m("label",{htmlFor:e,className:"peer-[[data-state=checked]]:text-mod-error text-status-bar text-txt-status-bar leading-none peer-disabled:cursor-not-allowed",children:n})]}));MP.displayName="ImportingStatus";var Qp=require("obsidian");S();var Vi=require("obsidian");S();var jP={sanitize:DOMPurify.sanitize.bind(DOMPurify),setIcon:Vi.setIcon,renderMarkdown(e){return m(FJ,{content:e})}};function FJ({content:e}){let t=F(null);return m("div",{className:"contents",ref:n=>{n?(n.empty(),t.current&&t.current.unload(),t.current=new Vi.Component,Vi.MarkdownRenderer.renderMarkdown(e,n,"",t.current)):t.current&&(t.current.unload(),t.current=null)}})}var Fo=require("obsidian"),Gf=class extends Fo.FileView{constructor(t){super(t),this.navigation=!1,this.allowNoFile=!0,this.requestUpdate=(0,Fo.debounce)(()=>this.update(),10)}load(){super.load(),this.registerEvent(this.app.workspace.on("file-open",this.onFileOpen,this))}async setState(t,r){if(!Object.hasOwn(t,"file")&&!Object.hasOwn(t,"group")){let n=this.leaf.workspace.getActiveFile();n&&(t.file=n?.path)}await super.setState(t,r)}onLoadFile(t){return this.requestUpdate()}onUnloadFile(t){return this.requestUpdate()}onFileOpen(t){this.leaf.group||this.leaf.pinned||(t instanceof Fo.TFile?this.loadFile(t):this.loadFile(null),this.requestUpdate())}onGroupChange(){if(super.onGroupChange(),this.leaf.group)for(let t=0,r=this.leaf.workspace.getGroupLeaves(this.leaf.group);t<r.length;t++){let n=r[t];if(n!==this.leaf&&n.view instanceof Fo.FileView){let o=n.view.getSyncViewState();this.leaf.openFile(n.view.file,o)}}else{let t=this.leaf.workspace.getActiveFile();this.loadFile(t)}}};var LP=require("obsidian");var Jf=require("obsidian"),Zf="zt-citations",Yf=async(e,t)=>typeof e=="string"&&e.trim().length>0?await t.database.search(e):await t.database.getItemsOf(50);function Xf({item:e,fields:t},r){r.addClass("mod-complex");let n=r.createDiv("suggestion-content").createDiv("suggestion-title").createSpan(),o=r.createDiv("suggestion-aux");for(let a of t){let u=o.createEl("kbd","suggestion-hotkey");switch(u.setAttribute("aria-label",a),a){case"title":(0,Jf.setIcon)(u,"type");break;case"creators":(0,Jf.setIcon)(u,"user");break;case"date":(0,Jf.setIcon)(u,"calendar");break;default:u.setText(a);break}}let[i]=e.title??[],s=n.createDiv({cls:"title"});typeof i=="string"&&i?s.setText(i):s.setText("Title missing"),this.plugin.settings.current?.showCitekeyInSuggester&&e.citekey&&n.createDiv({cls:"citekey",text:e.citekey}),$J(e)&&n.append(MJ(e))}var $J=e=>e.itemType==="journalArticle",MJ=e=>{let{creators:t,date:r,publicationTitle:n,volume:o,issue:i,pages:s}=e,a={creators:jJ(t),date:r,publication:n,volume:o,issue:i,pages:s},u=(l,c,f)=>a[c]&&l.createSpan({cls:f??c,text:a[c]??void 0});return createDiv({cls:"meta"},l=>{(a.creators||a.date)&&l.createSpan({cls:"author-year"},c=>{u(c,"creators"),u(c,"date")}),u(l,"publication"),(a.volume||a.issue)&&l.createSpan({cls:"vol-issue"},c=>{u(c,"volume"),u(c,"issue")}),u(l,"pages")})},jJ=e=>{if(!e||!e[0])return"";let t=e[0],r=Ml(t)||jl(t)?t.lastName:"";return e.length>1&&(r=r.trim()+" et al."),r};var nu=class extends LP.EditorSuggest{constructor(r){super(r.app);this.plugin=r;this.suggestEl.addClass(Zf)}getSuggestions(r){return Yf(r.query,this.plugin)}renderSuggestion=Xf.bind(this)};var nn=class extends Ll{constructor(r){super(r.app);this.plugin=r;this.modalEl.addClass(Zf)}getSuggestions(r){return Yf(r,this.plugin)}renderSuggestion=Xf.bind(this);onChooseSuggestion(){}};var zP=require("obsidian");var qP=require("@codemirror/state");async function BP(e,t,r=t.settings.current?.updateOverwrite){let{app:n,noteIndex:o,templateRenderer:i}=t,s=o.getNotesFor(e);if(s.length===0)return null;let a=t.settings.libId,u=await t.databaseAPI.getAttachments(e.itemID,a),l=new Set(s.flatMap(y=>ko(y,t.app.metadataCache))),c=u.filter(y=>l.has(y.itemID)),f;c.length===0&&(f=await Zr(u,t.app),f&&(Ni(f,e),c.push(f)));let p=await t.databaseAPI.getNotes(e.itemID,a).then(y=>t.noteParser.normalizeNotes(y)),d=await ou(e,{all:u,selected:c,notes:p},t),h=Object.values(d)[0],b={notes:s.length,addedAnnots:0,updatedAnnots:0};for(let y of s){let v=n.metadataCache.getCache(y);if(!v)continue;let w=ko(y,t.app.metadataCache);w||(f===void 0&&(f=await Zr(c,t.app)),f?w=[f.itemID]:w=[]);let T=n.vault.getAbstractFileByPath(y),M={plugin:t,sourcePath:y};if(r){let _=await i.renderNote(d[w[0]],M);await n.vault.modify(T,_);continue}let V=Ya((v.sections?.filter(Ka)??[]).flatMap(_=>Va(_.id).map(I=>[I,_.position])),bo(([_])=>_),ki((_,I)=>({key:_,blocks:I.map(([B,D])=>D)}))),J=new Set(Object.values(v.blocks??{})?.filter(Ka).flatMap(_=>Va(_.id).map(I=>I))),G=new Map(w.map(_=>[d[_],[]])),K=[];if(await Promise.all(w.map(async _=>{let I=d[_];if(!(!I.annotations||I.annotations.length===0))return await Promise.all(I.annotations.map(async B=>{let D=Bt(B,!0),re=V[D];if(re){if(!t.settings.current?.updateAnnotBlock)return;let oe=await i.renderAnnot(B,I,M);K.push(...re.blocks.map(me=>({from:me.start.offset,to:me.end.offset,insert:oe})))}else J.has(D)||G.get(I).push(B)})??[])})),K.length>0){let _=qP.EditorState.create({doc:await n.vault.read(T)}).update({changes:K}).state.doc.toString();await n.vault.modify(T,_)}await i.setFrontmatterTo(T,It(h,M).docItem);let P=[...G].reduce((_,[I,B])=>{if(B.length===0)return _;let D=i.renderAnnots({...I,annotations:B},M);return(_&&_+`
`)+D},"");P&&await n.vault.append(T,P);let X=K.length,C=[...G.values()].reduce((_,I)=>_+I.length,0);b.updatedAnnots+=X,b.addedAnnots+=C}return b}async function ou(e,{all:t,selected:r,notes:n},o){let i=o.settings.libId,s=await o.databaseAPI.getTags([[e.itemID,i]]);if(r.length===0)return{[-1]:{docItem:e,attachment:null,tags:s,allAttachments:t,annotations:[],notes:n}};let a={};for(let u of r){let l=u?await o.databaseAPI.getAnnotations(u.itemID,i):[];a[u.itemID]={docItem:e,attachment:u,tags:{...s,...await o.databaseAPI.getTags(l.map(c=>[c.itemID,i]))},allAttachments:t,annotations:l,notes:n}}return a}async function Qf({alt:e,item:t},{start:r,end:n,editor:o,file:i},s){let{plugin:a}=s,u=a.settings.libId,l=await a.databaseAPI.getAttachments(t.itemID,u),c=new Set(ko(i,a.app.metadataCache)),f=l.filter(y=>c.has(y.itemID)),p;f.length===0&&(p=await Zr(l,a.app),p&&(Ni(p,t),f.push(p)));let d=await a.databaseAPI.getNotes(t.itemID,u).then(y=>a.noteParser.normalizeNotes(y)),h=await ou(t,{all:l,selected:f,notes:d},s.plugin),b=s.renderCitations(Object.values(h),{plugin:s.plugin},e);o.replaceRange(b,r,n),o.setCursor(o.offsetToPos(o.posToOffset(r)+b.length))}var UP=e=>zP.Keymap.isModifier(e,"Shift");var LJ=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to insert primary Markdown citation"},{command:"\u21B5 (end with /)",purpose:"Insert secondary Markdown citation"}],iu=class extends nu{constructor(r){super(r);this.plugin=r;this.setInstructions(LJ)}onTrigger(r,n){if(!this.plugin.settings.current?.citationEditorSuggester)return null;let o=n.getLine(r.line),s=o.substring(0,r.ch).match(/[[【]@([^\]】]*)$/);if(!s)return null;let a={...r};return(o[r.ch]==="]"||o[r.ch]==="\u3011")&&(a.ch+=1),{end:a,start:{ch:s.index,line:r.line,alt:!!s[0]?.endsWith("/")},query:s[1].replaceAll(/\/$/g,"")}}selectSuggestion(r){this.context&&Qf({item:r.item,alt:this.context.start.alt??!1},this.context,this.plugin.templateRenderer)}};var qJ=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to insert Markdown citation"},{command:"shift \u21B5",purpose:"to insert secondary Markdown citation"},{command:"esc",purpose:"to dismiss"}],ob=class extends nn{constructor(r){super(r);this.plugin=r;this.setInstructions(qJ)}};async function ib(e,t,r){let n=await ep(r);if(!n)return!1;let o=e.getCursor();return await Qf({item:n.value.item,alt:UP(n.evt)},{start:o,end:o,editor:e,file:t},r.templateRenderer),!0}async function ep(e){return await xo(new ob(e))}var qo=require("obsidian");S();S();S();S();var qn=ge(Ln());S();function ab(e){let t=Object.prototype.toString.call(e).slice(8,-1);return t==="Object"&&typeof e[Symbol.iterator]=="function"?"Iterable":t==="Custom"&&e.constructor!==Object&&e instanceof Object?"Object":t}var VP=ge(Ln());S();var au=ge(Ln());S();var WP=ge(Ln());S();function su(e){let{styling:t,arrowStyle:r="single",expanded:n,nodeType:o,onClick:i}=e;return R.createElement("div",(0,WP.default)({},t("arrowContainer",r),{onClick:i}),R.createElement("div",t(["arrow","arrowSign"],o,n,r),"\u25B6",r==="double"&&R.createElement("div",t(["arrowSign","arrowSignInner"]),"\u25B6")))}function BJ(e,t){return e==="Object"?Object.keys(t).length:e==="Array"?t.length:1/0}function zJ(e){return typeof e.set=="function"}function UJ(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1/0,i;if(e==="Object"){let s=Object.getOwnPropertyNames(t);r&&s.sort(r===!0?void 0:r),s=s.slice(n,o+1),i={entries:s.map(a=>({key:a,value:t[a]}))}}else if(e==="Array")i={entries:t.slice(n,o+1).map((s,a)=>({key:a+n,value:s}))};else{let s=0,a=[],u=!0,l=zJ(t);for(let c of t){if(s>o){u=!1;break}n<=s&&(l&&Array.isArray(c)?typeof c[0]=="string"||typeof c[0]=="number"?a.push({key:c[0],value:c[1]}):a.push({key:`[entry ${s}]`,value:{"[key]":c[0],"[value]":c[1]}}):a.push({key:s,value:c})),s++}i={hasMore:!u,entries:a}}return i}function ub(e,t,r){let n=[];for(;t-e>r*r;)r=r*r;for(let o=e;o<=t;o+=r)n.push({from:o,to:Math.min(t,o+r-1)});return n}function cb(e,t,r,n){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:1/0,s=UJ.bind(null,e,t,r);if(!n)return s().entries;let a=i<1/0,u=Math.min(i-o,BJ(e,t));if(e!=="Iterable"){if(u<=n||n<7)return s(o,i).entries}else if(u<=n&&!a)return s(o,i).entries;let l;if(e==="Iterable"){let{hasMore:c,entries:f}=s(o,o+n-1);l=c?[...f,...ub(o+n,o+2*n-1,n)]:f}else l=a?ub(o,i,n):[...s(0,n-5).entries,...ub(n-4,u-5,n),...s(u-4,u-1).entries];return l}var HP=ge(Ln());S();function lb(e){let{styling:t,from:r,to:n,renderChildNodes:o,nodeType:i}=e,[s,a]=j(!1),u=Y(()=>{a(!s)},[s]);return s?R.createElement("div",t("itemRange",s),o(e,r,n)):R.createElement("div",(0,HP.default)({},t("itemRange",s),{onClick:u}),R.createElement(su,{nodeType:i,styling:t,expanded:!1,onClick:u,arrowStyle:"double"}),`${r} ... ${n}`)}function WJ(e){return e.to!==void 0}function KP(e,t,r){let{nodeType:n,data:o,collectionLimit:i,circularCache:s,keyPath:a,postprocessValue:u,sortObjectKeys:l}=e,c=[];return cb(n,o,l,i,t,r).forEach(f=>{if(WJ(f))c.push(R.createElement(lb,(0,au.default)({},e,{key:`ItemRange--${f.from}-${f.to}`,from:f.from,to:f.to,renderChildNodes:KP})));else{let{key:p,value:d}=f,h=s.indexOf(d)!==-1;c.push(R.createElement(uu,(0,au.default)({},e,{postprocessValue:u,collectionLimit:i,key:`Node--${p}`,keyPath:[p,...a],value:u(d),circularCache:[...s,d],isCircular:h,hideRoot:!1})))}}),c}function $o(e){let{circularCache:t=[],collectionLimit:r,createItemString:n,data:o,expandable:i,getItemString:s,hideRoot:a,isCircular:u,keyPath:l,labelRenderer:c,level:f=0,nodeType:p,nodeTypeIndicator:d,shouldExpandNodeInitially:h,styling:b}=e,[y,v]=j(u?!1:h(l,o,f)),w=Y(()=>{i&&v(!y)},[i,y]),T=y||a&&f===0?KP({...e,circularCache:t,level:f+1}):null,M=R.createElement("span",b("nestedNodeItemType",y),d),V=s(p,o,M,n(o,r),l),J=[l,p,y,i];return a?R.createElement("li",b("rootNode",...J),R.createElement("ul",b("rootNodeChildren",...J),T)):R.createElement("li",b("nestedNode",...J),i&&R.createElement(su,{styling:b,nodeType:p,expanded:y,onClick:w}),R.createElement("label",(0,au.default)({},b(["label","nestedNodeLabel"],...J),{onClick:w}),c(...J)),R.createElement("span",(0,au.default)({},b("nestedNodeItemString",...J),{onClick:w}),V),R.createElement("ul",b("nestedNodeChildren",...J),T))}function HJ(e){let t=Object.getOwnPropertyNames(e).length;return`${t} ${t!==1?"keys":"key"}`}function fb(e){let{data:t,...r}=e;return R.createElement($o,(0,VP.default)({},r,{data:t,nodeType:"Object",nodeTypeIndicator:r.nodeType==="Error"?"Error()":"{}",createItemString:HJ,expandable:Object.getOwnPropertyNames(t).length>0}))}var GP=ge(Ln());S();function KJ(e){return`${e.length} ${e.length!==1?"items":"item"}`}function pb(e){let{data:t,...r}=e;return R.createElement($o,(0,GP.default)({},r,{data:t,nodeType:"Array",nodeTypeIndicator:"[]",createItemString:KJ,expandable:t.length>0}))}var JP=ge(Ln());S();function VJ(e,t){let r=0,n=!1;if(Number.isSafeInteger(e.size))r=e.size;else for(let o of e){if(t&&r+1>t){n=!0;break}r+=1}return`${n?">":""}${r} ${r!==1?"entries":"entry"}`}function db(e){return R.createElement($o,(0,JP.default)({},e,{nodeType:"Iterable",nodeTypeIndicator:"()",createItemString:VJ,expandable:!0}))}S();function gr(e){let{nodeType:t,styling:r,labelRenderer:n,keyPath:o,valueRenderer:i,value:s,valueGetter:a=u=>u}=e;return R.createElement("li",r("value",t,o),R.createElement("label",r(["label","valueLabel"],t,o),n(o,t,!1,!1)),R.createElement("span",r("valueText",t,o),i(a(s),s,...o)))}function uu(e){let{getItemString:t,keyPath:r,labelRenderer:n,styling:o,value:i,valueRenderer:s,isCustomNode:a,...u}=e,l=a(i)?"Custom":ab(i),c={getItemString:t,key:r[0],keyPath:r,labelRenderer:n,nodeType:l,styling:o,value:i,valueRenderer:s},f={...u,...c,data:i,isCustomNode:a};switch(l){case"Object":case"Error":case"WeakMap":case"WeakSet":return R.createElement(fb,f);case"Array":return R.createElement(pb,f);case"Iterable":case"Map":case"Set":return R.createElement(db,f);case"String":return R.createElement(gr,(0,qn.default)({},c,{valueGetter:p=>`"${p}"`}));case"Number":return R.createElement(gr,c);case"Boolean":return R.createElement(gr,(0,qn.default)({},c,{valueGetter:p=>p?"true":"false"}));case"Date":return R.createElement(gr,(0,qn.default)({},c,{valueGetter:p=>p.toISOString()}));case"Null":return R.createElement(gr,(0,qn.default)({},c,{valueGetter:()=>"null"}));case"Undefined":return R.createElement(gr,(0,qn.default)({},c,{valueGetter:()=>"undefined"}));case"Function":case"Symbol":return R.createElement(gr,(0,qn.default)({},c,{valueGetter:p=>p.toString()}));case"Custom":return R.createElement(gr,c);default:return R.createElement(gr,(0,qn.default)({},c,{valueGetter:()=>`<${l}>`}))}}var Kp=ge(tp()),w2=ge(QP()),Cb=ge(sF()),Tb=ge(T$()),Sb=ge(Y$()),Ib=ge(g2());function y2(e){var t=e[0],r=e[1],n=e[2],o,i,s;return o=t*1+r*0+n*1.13983,i=t*1+r*-.39465+n*-.5806,s=t*1+r*2.02311+n*0,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),[o*255,i*255,s*255]}function b2(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,o=t*.299+r*.587+n*.114,i=t*-.14713+r*-.28886+n*.436,s=t*.615+r*-.51499+n*-.10001;return[o,i,s]}function v2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Tt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?v2(Object(r),!0).forEach(function(n){(0,w2.default)(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v2(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var E2=Tb.default,x2=Object.keys(E2),pX=function(t){return t<.25?1:t<.5?.9-t:1.1-t},dX=function(t){var r=(0,Sb.default)(t),n=b2(r.array()),o=(0,Cb.default)(n,3),i=o[0],s=o[1],a=o[2],u=[pX(i),s,a],l=y2(u);return Sb.default.rgb(l).hex()},Yi=function(t){return function(r){return{className:[r.className,t.className].filter(Boolean).join(" "),style:Tt(Tt({},r.style||{}),t.style||{})}}},mX=function(t,r){if(t===void 0)return r;if(r===void 0)return t;var n=(0,Kp.default)(t),o=(0,Kp.default)(r);switch(n){case"string":switch(o){case"string":return[r,t].filter(Boolean).join(" ");case"object":return Yi({className:t,style:r});case"function":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),u=1;u<s;u++)a[u-1]=arguments[u];return Yi({className:t})(r.apply(void 0,[i].concat(a)))}}break;case"object":switch(o){case"string":return Yi({className:r,style:t});case"object":return Tt(Tt({},r),t);case"function":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),u=1;u<s;u++)a[u-1]=arguments[u];return Yi({style:t})(r.apply(void 0,[i].concat(a)))}}break;case"function":switch(o){case"string":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),u=1;u<s;u++)a[u-1]=arguments[u];return t.apply(void 0,[Yi(i)({className:r})].concat(a))};case"object":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),u=1;u<s;u++)a[u-1]=arguments[u];return t.apply(void 0,[Yi(i)({style:r})].concat(a))};case"function":return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),u=1;u<s;u++)a[u-1]=arguments[u];return t.apply(void 0,[r.apply(void 0,[i].concat(a))].concat(a))}}}},hX=function(t,r){var n=Object.keys(r);for(var o in t)n.indexOf(o)===-1&&n.push(o);return n.reduce(function(i,s){return i[s]=mX(t[s],r[s]),i},{})},gX=function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];if(r===null)return t;Array.isArray(r)||(r=[r]);var s=r.map(function(u){return t[u]}).filter(Boolean),a=s.reduce(function(u,l){return typeof l=="string"?u.className=[u.className,l].filter(Boolean).join(" "):(0,Kp.default)(l)==="object"?u.style=Tt(Tt({},u.style),l):typeof l=="function"&&(u=Tt(Tt({},u),l.apply(void 0,[u].concat(o)))),u},{className:"",style:{}});return a.className||delete a.className,Object.keys(a.style).length===0&&delete a.style,a},_b=function(t){return Object.keys(t).reduce(function(r,n){return r[n]=/^base/.test(n)?dX(t[n]):n==="scheme"?t[n]+":inverted":t[n],r},{})},S2=(0,Ib.default)(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=t.defaultBase16,o=n===void 0?E2:n,i=t.base16Themes,s=i===void 0?null:i,a=yX(r,s);a&&(r=Tt(Tt({},a),r));for(var u=x2.reduce(function(b,y){return b[y]=r[y]||o[y],b},{}),l=Object.keys(r).reduce(function(b,y){return x2.indexOf(y)===-1&&(b[y]=r[y]),b},{}),c=e(u),f=hX(l,c),p=arguments.length,d=new Array(p>3?p-3:0),h=3;h<p;h++)d[h-3]=arguments[h];return(0,Ib.default)(gX,2).apply(void 0,[f].concat(d))},3),I2=function(t){return!!t.extend},yX=function(t,r){if(t&&I2(t)&&t.extend&&(t=t.extend),typeof t=="string"){var n=t.split(":"),o=(0,Cb.default)(n,2),i=o[0],s=o[1];r?t=r[i]:t=Tb[i],s==="inverted"&&(t=_b(t))}return t&&Object.prototype.hasOwnProperty.call(t,"base00")?t:void 0},_2=function(t){return typeof t=="string"?"".concat(t,":inverted"):t&&I2(t)&&t.extend?typeof t.extend=="string"?Tt(Tt({},t),{},{extend:"".concat(t.extend,":inverted")}):Tt(Tt({},t),{},{extend:_b(t.extend)}):t&&_b(t)};var C2={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"};var bX=e=>({BACKGROUND_COLOR:e.base00,TEXT_COLOR:e.base07,STRING_COLOR:e.base0B,DATE_COLOR:e.base0B,NUMBER_COLOR:e.base09,BOOLEAN_COLOR:e.base09,NULL_COLOR:e.base08,UNDEFINED_COLOR:e.base08,FUNCTION_COLOR:e.base08,SYMBOL_COLOR:e.base08,LABEL_COLOR:e.base0D,ARROW_COLOR:e.base0D,ITEM_STRING_COLOR:e.base0B,ITEM_STRING_EXPANDED_COLOR:e.base03}),vX=e=>({String:e.STRING_COLOR,Date:e.DATE_COLOR,Number:e.NUMBER_COLOR,Boolean:e.BOOLEAN_COLOR,Null:e.NULL_COLOR,Undefined:e.UNDEFINED_COLOR,Function:e.FUNCTION_COLOR,Symbol:e.SYMBOL_COLOR}),xX=e=>{let t=bX(e);return{tree:{border:0,padding:0,marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"0.125em",marginRight:0,listStyle:"none",MozUserSelect:"none",WebkitUserSelect:"none",backgroundColor:t.BACKGROUND_COLOR},value:(r,n,o)=>{let{style:i}=r;return{style:{...i,paddingTop:"0.25em",paddingRight:0,marginLeft:"0.875em",WebkitUserSelect:"text",MozUserSelect:"text",wordWrap:"break-word",paddingLeft:o.length>1?"2.125em":"1.25em",textIndent:"-0.5em",wordBreak:"break-all"}}},label:{display:"inline-block",color:t.LABEL_COLOR},valueLabel:{margin:"0 0.5em 0 0"},valueText:(r,n)=>{let{style:o}=r;return{style:{...o,color:vX(t)[n]}}},itemRange:(r,n)=>({style:{paddingTop:n?0:"0.25em",cursor:"pointer",color:t.LABEL_COLOR}}),arrow:(r,n,o)=>{let{style:i}=r;return{style:{...i,marginLeft:0,transition:"150ms",WebkitTransition:"150ms",MozTransition:"150ms",WebkitTransform:o?"rotateZ(90deg)":"rotateZ(0deg)",MozTransform:o?"rotateZ(90deg)":"rotateZ(0deg)",transform:o?"rotateZ(90deg)":"rotateZ(0deg)",transformOrigin:"45% 50%",WebkitTransformOrigin:"45% 50%",MozTransformOrigin:"45% 50%",position:"relative",lineHeight:"1.1em",fontSize:"0.75em"}}},arrowContainer:(r,n)=>{let{style:o}=r;return{style:{...o,display:"inline-block",paddingRight:"0.5em",paddingLeft:n==="double"?"1em":0,cursor:"pointer"}}},arrowSign:{color:t.ARROW_COLOR},arrowSignInner:{position:"absolute",top:0,left:"-0.4em"},nestedNode:(r,n,o,i,s)=>{let{style:a}=r;return{style:{...a,position:"relative",paddingTop:"0.25em",marginLeft:n.length>1?"0.875em":0,paddingLeft:s?0:"1.125em"}}},rootNode:{padding:0,margin:0},nestedNodeLabel:(r,n,o,i,s)=>{let{style:a}=r;return{style:{...a,margin:0,padding:0,WebkitUserSelect:s?"inherit":"text",MozUserSelect:s?"inherit":"text",cursor:s?"pointer":"default"}}},nestedNodeItemString:(r,n,o,i)=>{let{style:s}=r;return{style:{...s,paddingLeft:"0.5em",cursor:"default",color:i?t.ITEM_STRING_EXPANDED_COLOR:t.ITEM_STRING_COLOR}}},nestedNodeItemType:{marginLeft:"0.3em",marginRight:"0.3em"},nestedNodeChildren:(r,n,o)=>{let{style:i}=r;return{style:{...i,padding:0,margin:0,listStyle:"none",display:o?"block":"none"}}},rootNodeChildren:{padding:0,margin:0,listStyle:"none"}}},wX=S2(xX,{defaultBase16:C2}),T2=wX;var O2=e=>e,EX=(e,t,r)=>r===0,SX=(e,t,r,n)=>R.createElement("span",null,r," ",n),IX=e=>{let[t]=e;return R.createElement("span",null,t,":")},_X=()=>!1;function A2(e){let{data:t,theme:r,invertTheme:n,keyPath:o=["root"],labelRenderer:i=IX,valueRenderer:s=O2,shouldExpandNodeInitially:a=EX,hideRoot:u=!1,getItemString:l=SX,postprocessValue:c=O2,isCustomNode:f=_X,collectionLimit:p=50,sortObjectKeys:d=!1}=e,h=ne(()=>T2(n?_2(r):r),[r,n]);return R.createElement("ul",h("tree"),R.createElement(uu,{keyPath:u?[]:o,value:c(t),isCustomNode:f,styling:h,labelRenderer:i,valueRenderer:s,shouldExpandNodeInitially:a,hideRoot:u,getItemString:l,postprocessValue:c,collectionLimit:p,sortObjectKeys:d}))}var k2=require("obsidian");var CX=()=>{let[e]=St("clipboard-copy");return m("span",{ref:e})},N2=(e,t,r,n,o)=>{if(o.length===1){let i=async s=>{s.preventDefault(),s.stopPropagation(),await navigator.clipboard.writeText("```json\n"+JSON.stringify(t,null,2)+"\n```"),new k2.Notice("Copied JSON code block to clipboard")};return m("span",{role:"button",tabIndex:0,onClick:i,onKeyDown:i,"aria-label":"Copy item details in JSON",children:[n," ",m(CX,{})]})}if(o[1]==="creators"&&o.length===3){let i=Ia(t);if(i)return m("span",{children:i})}if(o[1]==="tags"&&o.length===3){let i=t;return m("span",{children:['"',i.name,'"" (',yo[i.type],")"]})}if(o[0]==="sortIndex"&&o.length===2)return m("span",{children:["[",t.join(", "),"]"]});if(o.length===2&&Array.isArray(t)&&t.length===1){let i=JSON.stringify(t[0]);return m("span",{children:[r," ",i.length>100?i.slice(0,100)+"...":i]})}return m("span",{children:[r," ",n]})};var D2=require("obsidian");var P2=(e,t,r,n)=>{let o=e.length===1,i=e.slice(0,-1),s=R2(i);return m("span",{...o?void 0:{onContextMenu:l=>{let c=new D2.Menu().addItem(f=>f.setTitle("Copy template").onClick(()=>{navigator.clipboard.writeText(`<%= ${s} %>`)}));n&&t!=="Array"&&c.addItem(f=>f.setTitle("Copy template (using with)").onClick(()=>{let[p,...d]=i,h=typeof p=="string"&&F2.test(p)?p:`'${p}'`,b=R2(d);navigator.clipboard.writeText(`<% { const { ${h}: $it } = ${b}; %>
<%= $it %>
<% } %>`)})),t==="Array"&&c.addItem(f=>f.setTitle("Copy template (using for-of loop)").onClick(()=>{navigator.clipboard.writeText(`<% for (const $it of ${s}) { %>
<%= $it %>
<% } %>`)})).addItem(f=>f.setTitle("Copy template (using forEach)").onClick(()=>{navigator.clipboard.writeText(`<% ${s}.forEach(($it, i) => { %>
<%= $it %>
<% }) %>`)})).addItem(f=>f.setTitle("Copy template (pick first element)").onClick(()=>{navigator.clipboard.writeText(`<%= ${s}.first() %>`)})).addItem(f=>f.setTitle("Copy template (pick last element)").onClick(()=>{navigator.clipboard.writeText(`<%= ${s}.last() %>`)})),eg.has(i[0])||c.addItem(f=>f.setTitle("Copy template (render when present)").onClick(()=>{navigator.clipboard.writeText(`<% if (${s}) { %>
<%= ${s} %>
<% } %>`)})),l.preventDefault(),c.showAtMouseEvent(l.nativeEvent)},style:{cursor:"context-menu"}},children:[e[0],": "]})},R2=e=>"it"+e.map(TX).reverse().join(""),F2=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u,TX=e=>typeof e=="number"?`[${e}]`:F2.test(e)?`.${e}`:`[${JSON.stringify(e)}]`;var OX=new Set(["sortIndex"]),AX=new Set(["creators","tags"]),kX=new Set(["position"]),$2=(e,t,r)=>{let n=e[0];return OX.has(n)||AX.has(n)&&Array.isArray(t)&&t.length>6?!1:!!(kX.has(n)||r<1||r<2&&Array.isArray(t)&&t.length>1)};var NX={grad:.9,turn:360,rad:360/(2*Math.PI)},an=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Ze=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=Math.pow(10,t)),Math.round(r*e)/r+0},nr=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=1),e>r?r:e>t?e:t},H2=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},M2=function(e){return{r:nr(e.r,0,255),g:nr(e.g,0,255),b:nr(e.b,0,255),a:nr(e.a)}},Ob=function(e){return{r:Ze(e.r),g:Ze(e.g),b:Ze(e.b),a:Ze(e.a,3)}},RX=/^#([0-9a-f]{3,8})$/i,Vp=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},K2=function(e){var t=e.r,r=e.g,n=e.b,o=e.a,i=Math.max(t,r,n),s=i-Math.min(t,r,n),a=s?i===t?(r-n)/s:i===r?2+(n-t)/s:4+(t-r)/s:0;return{h:60*(a<0?a+6:a),s:i?s/i*100:0,v:i/255*100,a:o}},V2=function(e){var t=e.h,r=e.s,n=e.v,o=e.a;t=t/360*6,r/=100,n/=100;var i=Math.floor(t),s=n*(1-r),a=n*(1-(t-i)*r),u=n*(1-(1-t+i)*r),l=i%6;return{r:255*[n,a,s,s,u,n][l],g:255*[u,n,n,a,s,s][l],b:255*[s,s,u,n,n,a][l],a:o}},j2=function(e){return{h:H2(e.h),s:nr(e.s,0,100),l:nr(e.l,0,100),a:nr(e.a)}},L2=function(e){return{h:Ze(e.h),s:Ze(e.s),l:Ze(e.l),a:Ze(e.a,3)}},q2=function(e){return V2((r=(t=e).s,{h:t.h,s:(r*=((n=t.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:t.a}));var t,r,n},_u=function(e){return{h:(t=K2(e)).h,s:(o=(200-(r=t.s))*(n=t.v)/100)>0&&o<200?r*n/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,r,n,o},DX=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,PX=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,FX=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$X=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,B2={string:[[function(e){var t=RX.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Ze(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?Ze(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=FX.exec(e)||$X.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:M2({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=DX.exec(e)||PX.exec(e);if(!t)return null;var r,n,o=j2({h:(r=t[1],n=t[2],n===void 0&&(n="deg"),Number(r)*(NX[n]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return q2(o)},"hsl"]],object:[[function(e){var t=e.r,r=e.g,n=e.b,o=e.a,i=o===void 0?1:o;return an(t)&&an(r)&&an(n)?M2({r:Number(t),g:Number(r),b:Number(n),a:Number(i)}):null},"rgb"],[function(e){var t=e.h,r=e.s,n=e.l,o=e.a,i=o===void 0?1:o;if(!an(t)||!an(r)||!an(n))return null;var s=j2({h:Number(t),s:Number(r),l:Number(n),a:Number(i)});return q2(s)},"hsl"],[function(e){var t=e.h,r=e.s,n=e.v,o=e.a,i=o===void 0?1:o;if(!an(t)||!an(r)||!an(n))return null;var s=function(a){return{h:H2(a.h),s:nr(a.s,0,100),v:nr(a.v,0,100),a:nr(a.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(i)});return V2(s)},"hsv"]]},z2=function(e,t){for(var r=0;r<t.length;r++){var n=t[r][0](e);if(n)return[n,t[r][1]]}return[null,void 0]},MX=function(e){return typeof e=="string"?z2(e.trim(),B2.string):typeof e=="object"&&e!==null?z2(e,B2.object):[null,void 0]};var Ab=function(e,t){var r=_u(e);return{h:r.h,s:nr(r.s+100*t,0,100),l:r.l,a:r.a}},kb=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},U2=function(e,t){var r=_u(e);return{h:r.h,s:r.s,l:nr(r.l+100*t,0,100),a:r.a}},W2=function(){function e(t){this.parsed=MX(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return Ze(kb(this.rgba),2)},e.prototype.isDark=function(){return kb(this.rgba)<.5},e.prototype.isLight=function(){return kb(this.rgba)>=.5},e.prototype.toHex=function(){return t=Ob(this.rgba),r=t.r,n=t.g,o=t.b,s=(i=t.a)<1?Vp(Ze(255*i)):"","#"+Vp(r)+Vp(n)+Vp(o)+s;var t,r,n,o,i,s},e.prototype.toRgb=function(){return Ob(this.rgba)},e.prototype.toRgbString=function(){return t=Ob(this.rgba),r=t.r,n=t.g,o=t.b,(i=t.a)<1?"rgba("+r+", "+n+", "+o+", "+i+")":"rgb("+r+", "+n+", "+o+")";var t,r,n,o,i},e.prototype.toHsl=function(){return L2(_u(this.rgba))},e.prototype.toHslString=function(){return t=L2(_u(this.rgba)),r=t.h,n=t.s,o=t.l,(i=t.a)<1?"hsla("+r+", "+n+"%, "+o+"%, "+i+")":"hsl("+r+", "+n+"%, "+o+"%)";var t,r,n,o,i},e.prototype.toHsv=function(){return t=K2(this.rgba),{h:Ze(t.h),s:Ze(t.s),v:Ze(t.v),a:Ze(t.a,3)};var t},e.prototype.invert=function(){return Lt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),Lt(Ab(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),Lt(Ab(this.rgba,-t))},e.prototype.grayscale=function(){return Lt(Ab(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),Lt(U2(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),Lt(U2(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?Lt({r:(r=this.rgba).r,g:r.g,b:r.b,a:t}):Ze(this.rgba.a,3);var r},e.prototype.hue=function(t){var r=_u(this.rgba);return typeof t=="number"?Lt({h:t,s:r.s,l:r.l,a:r.a}):Ze(r.h)},e.prototype.isEqual=function(t){return this.toHex()===Lt(t).toHex()},e}(),Lt=function(e){return e instanceof W2?e:new W2(e)};var jX=/^#(?:[\dA-F]{3}){1,2}$|^#(?:[\dA-F]{4}){1,2}$/i,LX=e=>{let t=Lt(e),{r,g:n,b:o}=t.rgba;return r*.299+n*.587+o*.114>186},G2=(e,t,...r)=>{if(typeof t=="string"&&jX.test(t))return m("span",{style:{backgroundColor:t,padding:"0 0.5em",color:LX(t)?"black":"white"},children:t});let n;return r[0]==="linkMode"&&typeof t=="number"&&(n=xl[t]),r[0]==="type"&&typeof t=="number"&&(r.length===2&&_e[t]?n=_e[t]:r.length===4&&typeof r[1]=="number"&&r[2]==="tags"&&yo[t]&&(n=yo[t])),n?m($,{children:[e," ",m("span",{children:["(",n,")"]})]}):e};var J2=()=>document.body.classList.contains("theme-dark"),qX={scheme:"Solarized Light",author:"Ethan Schoonover (modified by aramisgithub)",base00:"transparent",base01:"#eee8d5",base02:"#93a1a1",base03:"#839496",base04:"#657b83",base05:"#586e75",base06:"#073642",base07:"#002b36",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"},BX={scheme:"Solarized Dark",author:"Ethan Schoonover (modified by aramisgithub)",base00:"transparent",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"};function Nb({item:e,registerCssChange:t}){let[r,n]=j(()=>J2());return U(()=>t?.(()=>n(J2())),[t]),e?m(A2,{data:e,theme:r?BX:qX,invertTheme:!1,keyPath:["Zotero Item Data"],shouldExpandNodeInitially:$2,valueRenderer:G2,labelRenderer:P2,getItemString:N2}):m("div",{children:"No Details Available"})}var Z2=require("obsidian");var Gp=e=>({plugin:e,sourcePath:""});function zX(){return Ja((e,t)=>({preview:null,templateType:null,setTemplateType(r){e(n=>({...n,templateType:r||void 0}))},setPreview(r){e(({...n})=>({...n,preview:r??null}))},async setPreviewFromState(r,n){let o=t().preview;if(o?.docItem.itemID===r?.docItem&&o?.attachment?.itemID===r?.attachment&&o?.annot?.itemID===r?.annot)return!1;let i=n.database.settings.libId;if(!r.docItem)return console.error("TemplatePreview: no docItem provided"),!1;let[s]=await n.databaseAPI.getItems([[r.docItem,i]]);if(!s)return console.error("TemplatePreview: no docItem found for id "+r.docItem),!1;let a=await n.databaseAPI.getAttachments(r.docItem,i),u=a.find(d=>d.itemID===r.attachment)??null;r.attachment&&!u&&console.error("TemplatePreview: no attachment found for id "+r.attachment);let l=u?await n.databaseAPI.getAnnotations(u.itemID,i):[],c=l.find(d=>d.itemID===r.annot);r.annot&&!c&&console.error("TemplatePreview: no annotation found for id "+r.annot);let f=await n.databaseAPI.getTags([[r.docItem,i],...l.map(d=>[d.itemID,i])]),p;try{p=await n.databaseAPI.getNotes(s.itemID,i).then(d=>n.noteParser.normalizeNotes(d))}catch(d){console.error(d),p=[]}return e(()=>({preview:{docItem:s,allAttachments:a,annotations:l,attachment:u,tags:f,annot:l.find(d=>d.itemID===r.annot),notes:p}})),!0}}))}function Y2(e,t){let r=null,n=null,o=null;return function(...i){if(r&&window.clearTimeout(r),n){o=i;return}r=window.setTimeout(()=>{r=null,n=e(...i).then(()=>{o?n=e(...o):n=null}).catch(s=>{console.error(s),n=null})},t)}}var Xi=class extends Z2.FileView{constructor(r,n){super(r);this.plugin=n;this.store=zX()}store;canAcceptExtension(r){return r==="md"}getTemplateType(r){if(!r)return!1;let n=ct(r.path,this.plugin.settings.templateDir);return n?.type!=="ejectable"?!1:n.name}setTemplateType(r){this.store.getState().setTemplateType(r)}async onLoadFile(r){await super.onLoadFile(r),this.setTemplateType(this.getTemplateType(r))}getState(){let r=super.getState(),{preview:n}=this.store.getState(),o;if(!n)o={preview:null};else{let{docItem:i,attachment:s,annot:a}=n;o={preview:{docItem:i.itemID,attachment:s?.itemID,annot:a?.itemID}}}return{...r,...o}}async setState(r,n){if(await super.setState(r,n),r.preview===void 0)return;let o=this.store.getState();r.preview===null?o.setPreview(null):await o.setPreviewFromState(r.preview,this.plugin)}setPreview(r){this.store.getState().setPreview(r)}async onOpen(){await super.onOpen();let[r,n]=ui(this.plugin);n&&this.register(n),await r}};var Qi="zotero-item-details",X2=({templateType:e})=>e==="annotation"?e:"note",Jp=class extends Xi{getViewType(){return Qi}getDisplayText(){let t=this.store.getState();return t.templateType?"Zotero Item Details: "+X2(t):"Zotero Item Details"}async onOpen(){await super.onOpen();let[t,r]=ui(this.plugin);r&&this.register(r),await t,R.render(m(UX,{store:this.store,plugin:this.plugin}),this.contentEl)}async onClose(){R.unmountComponentAtNode(this.contentEl),await super.onClose()}};function UX({store:e,plugin:t}){let r=_t(e,X2),n=_t(e,i=>i.preview),o=ne(()=>{let i=Gp(t);if(!n)return null;switch(r){case"note":{let s=It(n,i);return s.docItem.annotations=void 0,s.docItem}case"annotation":{let s=It(n,i),a=n.annot?s.annotations.find(u=>u.itemID===n.annot?.itemID):s.annotations[0];return a?(a.docItem=void 0,a):null}default:throw new Error("Unsupported template type")}},[t,n,r]);return o?m(Nb,{item:o,registerCssChange:i=>(t.app.workspace.on("css-change",i),()=>t.app.workspace.off("css-change",i))}):m("div",{})}var Q2=ge(si(),1),or=require("obsidian");var es="zotero-template-preview",Zp=class extends Xi{getViewType(){return es}getDisplayText(){let t=this.store.getState().templateType;return t?"Zotero Template Preview: "+t:"Zotero Template Preview"}async switchToTemplate(t){if(!this.leaf.group)return!1;let r=eM(this.leaf.group,this.plugin);if(!r)return!1;let n=Db(t,this.plugin.settings.templateDir,this.app);if(!n||!(n instanceof or.TFile)){new or.Notice("Template file not found: "+t);return}return await r.openFile(n),!0}onload(){let t={annots:this.addAction("list-ordered","Open Template for Annotations",async()=>await this.switchToTemplate("annots")||new or.Notice("Cannot switch to template")),note:this.addAction("file-input","Open Note Template",async()=>await this.switchToTemplate("note")||new or.Notice("Cannot switch to template")),annotation:this.addAction("highlighter","Open Template for Single Annotation",async()=>await this.switchToTemplate("annotation")||new or.Notice("Cannot switch to template")),field:this.addAction("info","Open Template for Note Properties",async()=>await this.switchToTemplate("field")||new or.Notice("Cannot switch to template"))};Object.values(t).forEach(r=>r.hide()),this.register(this.store.subscribe((r,n)=>{if(r.templateType!==n.templateType)for(let[o,i]of Object.entries(t))i.toggle(o!==r.templateType)})),this.registerEvent(this.app.vault.on("zotero:template-updated",r=>{let n=this.getTemplateType(this.file);n&&r===n&&(this.setTemplateType(n),this.requestRender())}))}content=null;async render(){let{preview:t,templateType:r}=this.store.getState();if(!r){this.contentEl.empty(),this.contentEl.setText("No template preview available");return}if(!t){this.contentEl.empty(),this.contentEl.setText("No preview data available");return}let n="",o=Gp(this.plugin),i=this.plugin.templateRenderer;try{switch(r){case"annotation":{let u=t.annot??t.annotations[0];if(!u){this.contentEl.setText("No annotation data available");return}n=i.renderAnnot(u,t,o);break}case"annots":n=i.renderAnnots(t,o);break;case"note":n=i.renderNote(t,o);break;case"field":n=i.renderFrontmatter(t,o);break;case"cite":n=i.renderCitations([t],o);break;case"cite2":n=i.renderCitations([t],o,!0);break;case"colored":n=i.renderColored({content:"I'm Highlight",color:"#FF000080",colorName:"red",bgColor:"#FF000080",bgColorName:"red"});break;default:(0,Q2.assertNever)(r)}if(n===this.content?.markdown)return;this.content?.unload(),this.contentEl.empty();let s=await(0,or.loadPrism)(),a=s.highlight(n,s.languages.markdown,"markdown");this.content=new Rb(n),this.contentEl.createEl("pre").createEl("code",{cls:"language-markdown"}).innerHTML=a}catch(s){this.content?.unload(),this.contentEl.empty();let a=s instanceof Error?s.message:String(s);this.contentEl.createEl("h1",{text:`Error while rendering ${r}`,cls:["mod-error","message"]}),this.contentEl.createEl("pre",{text:a})}}requestRender=Y2(()=>this.render(),200);async onOpen(){await super.onOpen(),this.register(this.store.subscribe((t,r)=>{t.templateType!==r.templateType?this.requestRender():t.preview!==r.preview&&this.requestRender()}))}},Rb=class extends or.Component{constructor(r){super();this.markdown=r}};async function Bo(e,t,{app:r,settings:n}){let{workspace:o}=r,i=Db(e,n.templateDir,r);if(!i||!(i instanceof qo.TFile)){new qo.Notice("Template file not found: "+e);return}let s=o.getLeavesOfType("markdown").filter(c=>{let f=c.view;return f.file?ct(f.file.path,n.templateDir)?.type==="ejectable"&&c.getRoot().type==="floating":!1});if(s.length>0){let c=s[0];if(await c.openFile(i),!c.group)return;let f=o.getGroupLeaves(c.group);for(let p of f){let d=p.view.getViewType();if(d===es||d===Qi){let h=p.view.getState();await p.view.setState({...h,preview:t},{})}}return}let a=o.openPopoutLeaf(),u=o.createLeafBySplit(a,"vertical"),l=o.createLeafBySplit(u,"vertical");await Promise.all([a.openFile(i,{active:!0}),u.setViewState({type:es,state:{file:i.path,preview:t},group:a}),l.setViewState({type:Qi,state:{file:i.path,preview:t},group:a})])}function Db(e,t,r){let n=io(e,t),o=r.vault.getAbstractFileByPath(n);return o instanceof qo.TFile?o:null}function eM(e,t){return t.app.workspace.getGroupLeaves(e).find(n=>n.view instanceof qo.MarkdownView&&n.view.file&&ct(n.view.file.path,t.settings.templateDir)?.type==="ejectable")}var tM=e=>(t,r,n)=>{let{imgCacheImporter:o}=e,i=String(t.timeStamp),s="drag-source";t.dataTransfer.setData("text/plain",r()),t.dataTransfer.setData(s,i),t.dataTransfer.dropEffect="copy";let a=t.target.win,{workspace:u}=e.app,l=p=>{p.dataTransfer?.getData(s)===i&&o.flush(),u.off("editor-drop",l),a.removeEventListener("dragend",c)},c=()=>{o.cancel(),u.off("editor-drop",l)},f=u.on("editor-drop",p=>{p.dataTransfer?.getData("drag-source")===i&&o.flush(),u.offref(f)});a.addEventListener("dragend",c,{once:!0}),n&&t.dataTransfer.setDragImage(n,0,0)},rM=e=>({storeSelector:t=>Fl(t,["doc","attachment","allAttachments","tags","annotations"]),get:(t,{allAttachments:r,attachment:n,doc:o,tags:i,annotations:s})=>!r||!n||!o||!i[t.itemID]||!s?null:()=>{let a=e.app.workspace.getActiveFile(),u=a&&at(a)?a.path:null;return e.templateRenderer.renderAnnot(t,{tags:i,attachment:n,allAttachments:r,annotations:s,docItem:o.docItem,notes:[]},{plugin:e,sourcePath:u,merge:!1})}});var ts=require("obsidian");var nM=e=>(t,r)=>{let n=new ts.Menu;if(n.addItem(o=>o.setTitle("Jump to note").setIcon("links-going-out").onClick(WX(r,e))),e.app.workspace.trigger("zotero:open-annot-menu",r,n),t.nativeEvent instanceof MouseEvent)n.showAtMouseEvent(t.nativeEvent);else{let o=t.currentTarget.getBoundingClientRect();n.showAtPosition({x:o.left,y:o.bottom})}},WX=(e,t)=>async()=>{let r=t.app.workspace.getActiveFile(),n=r&&at(r)?r.path:void 0,o=t.plugin.noteIndex.getBlocksFor({item:e,file:n}).shift();if(!o){new ts.Notice("No embed for this annotation in current note");return}let i=o.blocks.sort((p,d)=>{let h=p.start.offset-d.start.offset;return h!==0?h:p.end.offset-d.end.offset})[0];await sleep(10);let{leaf:s}=t,{workspace:a,vault:u}=t.app,l;if(s.group)l=a.getGroupLeaves(s.group);else{l=[];let p=a.getActiveFileView();p&&l.push(p.leaf)}let c=!1,f=i.end.line+1;for(let p of l)p&&p.view instanceof ts.MarkdownView&&p.view.file?.path===o.file&&(p.view.setEphemeralState({line:f}),c=!0);if(!c){let p=u.getAbstractFileByPath(o.file);if(!p||!at(p))throw new Error("File from block info not found: "+o.file);a.getLeaf().openFile(p,{eState:{line:f}})}};var oM=(e,t)=>t.length===0?null:e?t.find(r=>r.itemID===e)??t[0]:t[0],Yp=()=>({doc:null,allAttachments:null,attachmentID:null,annotations:null,attachment:null,tags:{}}),HX=()=>({follow:"zt-reader",doc:null,allAttachments:null,attachmentID:null,annotations:null,attachment:null,tags:{}}),Cu=e=>e.databaseAPI,iM=e=>Ja((t,r)=>{let n=async(s,a)=>{let u=(await Cu(e).getAttachments(s,a)).filter(ga);t(l=>({...l,allAttachments:u,attachment:oM(l.attachmentID,u)}))},o=async(s,a)=>{let u=await Cu(e).getTags([[s,a]]);return t(l=>({...l,tags:u})),u},i=async s=>{let{attachment:a}=r();if(!a)return;let u=await Cu(e).getAnnotations(a.itemID,s),l=ng(u);t(p=>({...p,annotations:og(l),attachment:a}));let c=await Cu(e).getTags(u.map(p=>[p.itemID,s])),f=ig(l,c);t(p=>({...p,tags:{...p.tags,...f}}))};return{...HX(),loadDocItem:async(s,a,u,l=!1)=>{if(s<0)return t(Yp());if(r().doc?.docItem.itemID===s&&!l)return;let c=(await Cu(e).getItems([[s,u]]))[0];if(!c)return t(Yp());let f={docItem:c,lib:u};if(a<0){let p=Zh(window.localStorage,c);t({...Yp(),doc:f,attachmentID:p})}else Ti(window.localStorage,c,a),t({...Yp(),doc:f,attachmentID:a});await n(c.itemID,u),await o(c.itemID,u),await i(u)},refresh:async()=>{let{doc:s,attachment:a}=r();if(!s)return;let{docItem:u,lib:l}=s;await n(u.itemID,l),await o(u.itemID,l),a&&await i(l)},setActiveAtch:s=>{let{doc:a,allAttachments:u}=r();if(a)if(Ti(window.localStorage,a.docItem,s),!u)t(l=>({...l,attachment:null,attachmentID:s}));else{let l=oM(s,u);t(c=>({...c,attachment:l,attachmentID:s}))}},setFollow:s=>t({follow:s})}});var ed="zotero-annotation-view",Xp=class extends Gf{constructor(r,n){super(r);this.plugin=n;this.store=iM(n)}update(){if(this.follow!=="ob-note")return;let r=this.plugin.settings.libId;(async()=>{if(this.file?.extension!=="md")return!1;let n=Ao(this.file,this.app.metadataCache),o=ko(this.file,this.app.metadataCache);if(!n)return!1;let[i]=await this.plugin.databaseAPI.getItems([[n,r]]);return i?(this.setStatePrev(s=>({...s,follow:"ob-note",itemId:i.itemID,attachmentId:o?.[0]??void 0})),!0):!1})().then(n=>{n||this.setStatePrev(o=>({...o,follow:"ob-note",itemId:-1}))})}getViewType(){return ed}#e=null;onload(){super.onload(),this.contentEl.addClass("obzt");let r=null,n=!1,o=i=>{if(n)r=i;else{n=!0;let{itemId:s,attachmentId:a}=i;this.setStatePrev(u=>({...u,itemId:s,attachmentId:a})).then(()=>{if(n=!1,r===null)return;let u=r;r=null,o(u)})}};this.registerEvent(this.plugin.server.on("bg:notify",(i,s)=>{s.event==="reader/active"&&(this.#e=s.itemId,!(this.follow!=="zt-reader"||s.itemId<0||s.attachmentId<0)&&o(s))}))}getDisplayText(){return this.follow!=="ob-note"||!this.file?.basename?"Zotero Annotations":`Zotero Annotations for ${this.file.basename}`}getIcon(){return"highlighter"}get lib(){return this.plugin.settings.libId}store;get follow(){return this.store.getState().follow}getState(){let r=super.getState(),n=this.store.getState(),o={itemId:n.doc?.docItem.itemID??-1,attachmentId:n.attachment?.itemID??-1,follow:n.follow};return{...r&&typeof r=="object"?r:{},...o}}async setState(r,n){await super.setState(r,n??{});let{itemId:o=-1,attachmentId:i=-1,follow:s="zt-reader"}=r;this.store.getState().setFollow(s),await this.store.getState().loadDocItem(o,i,this.lib)}async setStatePrev(r){await this.setState(r(this.getState()))}onSetFollowZt=async()=>{this.setStatePrev(r=>({...r,follow:"zt-reader"})),await this.setStatePrev(({attachmentId:r,...n})=>({...n,follow:"zt-reader",...this.#e===null?{attachmentId:r}:{itemId:this.#e}}))};onSetFollowOb=()=>{this.store.getState().setFollow("ob-note"),this.update()};onSetFollowNull=async()=>{let{plugin:r}=this,n=await ep(r);if(!n)return;let{itemID:o}=n.value.item,i=r.settings.libId,s=await r.databaseAPI.getAttachments(o,i),a=await Zr(s,this.app);await this.setStatePrev(({attachmentId:u,...l})=>({...l,follow:null,itemId:o,attachmentId:a?.itemID}))};getContext(){let r=this,{plugin:n,store:o,app:i}=r;return{store:o,registerDbUpdate(s){return i.vault.on("zotero:db-refresh",s),()=>i.vault.off("zotero:db-refresh",s)},refreshConn:async()=>{await n.dbWorker.refresh({task:"dbConn"})},getImgSrc:s=>{let a=An(s,n.settings.current?.zoteroDataDir);return KX(a)},onShowDetails:async(s,a)=>{let u=o.getState(),l=u.attachmentID??void 0;if(s==="doc-item")await Bo("note",{docItem:a,attachment:l},n);else{let c=u.doc?.docItem.itemID;if(!c)throw new Error("Missing doc item when showing annotation details");await Bo("annotation",{docItem:c,attachment:l,annot:a},n)}},onDragStart:tM(n),onMoreOptions:nM(r),annotRenderer:rM(n),onSetFollow(s){let a=new Qp.Menu,u=o.getState().follow;if(u!=="zt-reader"&&a.addItem(l=>l.setIcon("book").setTitle("Follow active literature in Zotero reader").onClick(r.onSetFollowZt)),u!=="ob-note"&&a.addItem(l=>l.setIcon("file-edit").setTitle("Follow active literature note").onClick(r.onSetFollowOb)),a.addItem(l=>l.setIcon("file-lock-2").setTitle("Link with selected literature").onClick(async()=>{s.target.blur(),await r.onSetFollowNull()})),s.nativeEvent instanceof MouseEvent)a.showAtMouseEvent(s.nativeEvent);else{let c=s.target.getBoundingClientRect();a.showAtPosition({x:c.x,y:c.y})}}}}async onOpen(){await super.onOpen();let[r,n]=ui(this.plugin);n&&this.register(n),this.contentEl.empty(),this.contentEl.createDiv({cls:"pane-empty p-2",text:"Loading..."}),r.then(()=>{this.contentEl.empty(),R.render(m($n.Provider,{value:jP,children:m(Be.Provider,{value:this.getContext(),children:m(Qa,{})})}),this.contentEl)}).catch(o=>{this.contentEl.empty(),console.error("Failed to load annot view: ",o),this.contentEl.createDiv({cls:"pane-empty p-2",text:"Failed to load, Check console for details"})}),this.registerEvent(this.plugin.server.on("bg:notify",(o,i)=>{if(i.event!=="reader/annot-select")return;let s=i.updates.filter(([,u])=>u).pop();if(!s)return;let[a]=s;this.highlightAnnot(a)}))}async onClose(){R.unmountComponentAtNode(this.contentEl),await super.onClose()}async highlightAnnot(r){let n=this.contentEl.querySelector(`.annot-preview[data-id="${r}"]`);n instanceof HTMLElement&&(n.addClass("select-flashing"),n.scrollIntoView({behavior:"smooth",block:"center"}),await sleep(1500),n.removeClass("select-flashing"))}};function KX(e){return(Qp.Platform.resourcePathPrefix??"app://local/")+(0,sM.pathToFileURL)(e).pathname.substring(1)+`?${Date.now()}`}var aM=require("path/posix");var td=require("obsidian");var VX=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to continue select note to import"},{command:"esc",purpose:"to dismiss"}],Pb=class extends nn{constructor(r){super(r);this.plugin=r;this.setInstructions(VX)}};async function uM(e){let t=await xo(new Pb(e));if(!t)return!1;let{value:{item:r}}=t,n=await e.databaseAPI.getNotes(r.itemID,e.settings.libId);if(n.length===0)return new td.Notice("No note found for selected literature"),!1;let o=await Hv(n,c=>c.title??c.note?.substring(0,20)??`No title (Key ${c.key})`);if(!o.item)return!1;let i=o.item;if(!i.note)return new td.Notice("Selected note is empty"),!1;let s=await e.noteParser.turndown(i.note),a=e.settings.current?.literatureNoteFolder,u=(0,aM.join)(a,"zt-import",To(i.title??[i.note.substring(0,10),i.key].join("_"),{replacement:"_"})),l=await e.app.fileManager.createNewMarkdownFile(e.app.vault.getRoot(),u,s);return await e.app.workspace.openLinkText(l.path,"",!0),new td.Notice(`Note imported: ${i.title??i.key}`),!0}var $r=require("obsidian");var rd=class extends ue{plugin=this.use(be);onload(){this.registerEvent(this.plugin.server.on("zotero/open",t=>this.onZtOpen(Sc(t)))),this.registerEvent(this.plugin.server.on("zotero/export",t=>this.onZtExport(Sc(t)))),this.registerEvent(this.plugin.server.on("zotero/update",t=>this.onZtExport(Sc(t))))}async onZtOpen(t){if(t.type==="annotation"){new $r.Notice("Not implemented yet");return}if(t.items.length<1){new $r.Notice("No items to open");return}await this.plugin.noteFeatures.openNote(t.items[0])}async onZtUpdate(t){if(t.type==="annotation"){new $r.Notice("Single annotation update not yet supported");return}if(t.items.length<1){new $r.Notice("No items to open");return}if(t.items.length>1){new $r.Notice("Multiple literature note update not yet supported");return}await this.plugin.noteFeatures.updateNoteFromId(t.items[0])}async onZtExport(t){if(t.type==="annotation"){new $r.Notice("Not implemented yet");return}t.items.length<1?new $r.Notice("No items to open"):t.items.length>1&&new $r.Notice("Multiple items not yet supported");let{libraryID:r,id:n}=t.items[0],[o]=await this.plugin.databaseAPI.getItems([[n,r]]);if(!o){new $r.Notice("Item not found: "+n);return}let i=await this.plugin.noteFeatures.createNoteForDocItemFull(o);await this.plugin.app.workspace.openLinkText(i,"",!1,{active:!0})}};var cM=require("obsidian");var GX=[{command:"\u2191\u2193",purpose:"to navigate"},{command:"\u21B5",purpose:"to open/create literature note"},{command:"esc",purpose:"to dismiss"}],Fb=class extends nn{constructor(r){super(r);this.plugin=r;this.setInstructions(GX)}};async function $b(e){let t=await xo(new Fb(e));if(!t)return!1;let{value:{item:r},evt:n}=t;if(await e.noteFeatures.openNote(r,!0))return!0;let o=await e.noteFeatures.createNoteForDocItemFull(r);return await e.app.workspace.openLinkText(o,"",cM.Keymap.isModEvent(n),{active:!0}),!0}var Mb=class extends ue{plugin=this.use(be);protocol=this.use(rd);onload(){let{plugin:t}=this,{app:r}=t;t.addCommand({id:"note-quick-switcher",name:"Open quick switcher for literature notes",callback:()=>$b(t)}),t.registerView(ed,o=>new Xp(o,t)),t.registerView(es,o=>new Zp(o,t)),t.registerView(Qi,o=>new Jp(o,t)),t.registerEvent(t.app.workspace.on("file-menu",(o,i)=>{let s=ct(i.path,t.settings.templateDir);s?.type==="ejectable"&&o.addItem(a=>a.setIcon("edit").setTitle("Open template preview").onClick(()=>{Bo(s.name,null,t)}))})),t.addCommand({id:"zotero-annot-view",name:"Open Zotero annotation view in side panel",callback:()=>{r.workspace.ensureSideLeaf(ed,"right",{active:!0,state:{file:r.workspace.getActiveFile()?.path}})}}),t.addCommand({id:"insert-markdown-citation",name:"Insert Markdown citation",editorCallback:(o,i)=>ib(o,i.file,t)}),t.registerEditorSuggest(new iu(t));let n=async(o,i)=>{let s=t.settings.libId,a=Ao(o,r.metadataCache);if(!a)return new un.Notice("Cannot get zotero item key from file name"),!1;let[u]=await t.databaseAPI.getItems([[a,s]]);if(!u)return new un.Notice("Cannot find zotero item with key "+a),!1;await this.updateNote(u,i)};t.addCommand({id:"update-literature-note",name:"Update literature note",editorCheckCallback(o,i,s){let a=s.file&&Ga(s.file,r);if(o)return!!a;a&&n(s.file)}}),t.addCommand({id:"overwrite-update-literature-note",name:"Force update literature note by overwriting",editorCheckCallback(o,i,s){let a=s.file&&Ga(s.file,r);if(o)return!!a;a&&n(s.file,!0)}}),t.addCommand({id:"import-note",name:"Import note",callback:()=>uM(t)}),t.registerEvent(t.app.workspace.on("file-menu",(o,i)=>{Ga(i,r)&&(o.addItem(s=>s.setTitle("Update literature note").setIcon("sync").onClick(()=>n(i))),t.settings.current?.updateOverwrite||o.addItem(s=>s.setTitle("Force update by overwriting").setIcon("sync").onClick(()=>n(i,!0))))})),t.registerEvent(t.app.workspace.on("file-menu",(o,i)=>{let s=ct(i.path,t.settings.templateDir);s?.type==="ejectable"&&o.addItem(a=>a.setTitle("Reset to default").setIcon("reset").onClick(async()=>{activeWindow.confirm("Reset template to default?")&&await t.app.vault.modify(i,ot.Ejectable[s.name])}))}))}async openNote(t,r=!1){let{workspace:n}=this.plugin.app,{noteIndex:o}=this.plugin,i=o.getNotesFor(t);if(!i.length)return!r&&new un.Notice(`No literature note found for zotero item with key ${t.key}`),!1;let s=i.sort().shift();return await n.openLinkText(s,"",!1,{active:!0}),!0}async createNoteForDocItem(t,r){let{noteIndex:n}=this.plugin,o=n.getNotesFor(t);if(o.length)throw new nd(o,t.key);let{vault:i,fileManager:s}=this.plugin.app,{literatureNoteFolder:a}=this.plugin.settings.current,u=this.plugin.templateRenderer,l=(0,lM.join)(a,r.filename(u,{plugin:this.plugin})),c=i.getAbstractFileByPath(l);if(c&&Ao(c,this.plugin.app.metadataCache))throw new nd([l],t.key);return await s.createNewMarkdownFile(i.getRoot(),l,r.note(u,{plugin:this.plugin,sourcePath:l}))}async createNoteForDocItemFull(t){let r=this.plugin.settings.libId,n=await this.plugin.databaseAPI.getAttachments(t.itemID,r),o=await Zr(n,this.plugin.app);o&&Ni(o,t);let i=await this.plugin.databaseAPI.getNotes(t.itemID,r).then(l=>this.plugin.noteParser.normalizeNotes(l)),s=await ou(t,{all:n,selected:o?[o]:[],notes:i},this.plugin),a=Object.values(s)[0];return(await this.createNoteForDocItem(t,{note:(l,c)=>l.renderNote(a,c),filename:(l,c)=>l.renderFilename(a,c)})).path}async updateNoteFromId(t){let{noteIndex:r,databaseAPI:n}=this.plugin;if(!r.getNotesFor(t).length){new un.Notice(`No literature note found for zotero item with key ${t.key}`);return}let[i]=await n.getItems([[t.key,t.libraryID]]);if(!i){new un.Notice(`Cannot find zotero item with key ${t.key}`);return}await this.updateNote(i)}async updateNote(t,r){let n=await BP(t,this.plugin,r);n?n.addedAnnots>0||n.updatedAnnots>0?new un.Notice(`Affected ${n.notes} notes, annotations: ${n.addedAnnots} added, ${n.updatedAnnots} updated`):new un.Notice(`Affected ${n.notes} notes, no annotation updated`):new un.Notice("No note found for this literature")}},fM=Mb,nd=class extends Error{constructor(r,n){super(`Note linked to ${n} already exists: ${r.join(",")}`);this.targets=r;this.key=n;this.name="NoteExistsError"}};var id=require("@codemirror/language");var jb=require("obsidian");var od=class extends ue{plugin=this.use(be);onload(){this.patchEditorClick()}async patchEditorClick(){let{workspace:t}=this.plugin.app,{noteIndex:r,database:n,settings:o,noteFeatures:i}=this.plugin;await w1(this.plugin.app);let s=()=>t.getLeavesOfType("markdown").length>0,[a,u]=qs({register:c=>t.on("layout-change",()=>{s()&&c()}),unregister:c=>t.offref(c),escape:s,timeout:null});u&&this.register(u),await a;let l=t.getLeavesOfType("markdown")[0].view;this.register(qt(l.editor.constructor.prototype,{getClickableTokenAt:c=>function(f,...p){let d=c.call(this,f,...p);return d||JX.call(this,f,r)}})),this.register(qt(l.editMode.constructor.prototype,{triggerClickableToken:c=>function(f,p){if(f.type==="internal-link"&&f.citekey==="zotero")(async()=>{let d=f.text,{[d]:h}=await n.api.getItemIDsFromCitekey([f.text]);if(h<0){new jb.Notice(`Citekey ${d} not found in Zotero`);return}let[b]=await n.api.getItems([[h,o.libId]]);if(!b){new jb.Notice(`Item not found for citekey ${d}`);return}let y=await i.createNoteForDocItemFull(b);await t.openLinkText(y,"",!0,{active:!0})})();else return c.call(this,f,p)}}))}};function JX(e,t){let r=this.cm,n=r.state.doc,o=[],i=n.line(e.line+1),s=(0,id.syntaxTree)(r.state),a=i.from;s.iterate({from:i.from,to:i.to,enter:b=>{let y=b.type,v=b.from,w=b.to,T=y.prop(id.tokenClassNodeProp);T&&(a<v&&o.push({type:"",from:a,to:v}),o.push({type:T,from:v,to:w}),a=w)}}),a<i.to&&o.push({type:"",from:a,to:i.to});let u=this.posToOffset(e),l=-1;for(let b=0;b<o.length;b++){let y=o[b];if(y.from<=u&&y.to>=u){l=b;break}}if(l<0)return null;let c=o[l];if(!c.type.split(" ").includes("hmd-barelink"))return null;let p=n.sliceString(c.from,c.to);if(!p.startsWith("@"))return null;let d=p.slice(1),h={start:this.offsetToPos(c.from),end:this.offsetToPos(c.to)};if(t.citekeyCache.has(d)){let[b]=t.citekeyCache.get(d);return{type:"internal-link",text:b,...h}}else return{type:"internal-link",text:d,citekey:"zotero",...h}}var sd=require("obsidian");var rs=class extends ue{plugin=this.use(be);settings=this.use(de);app=this.use(sd.App);get meta(){return this.app.metadataCache}get vault(){return this.app.vault}get literatureNoteFolder(){return this.settings.current?.literatureNoteFolder}get joinPath(){return ZX(this.literatureNoteFolder)}noteCache=new Map;blockCache={byFile:new Map,byKey:new Map};citekeyCache=new Map;#e(t,r){let n=Ty(r);if(n){if(!this.noteCache.has(n))return this.noteCache.set(n,new Set([t])),!0;let i=this.noteCache.get(n),s=i.size;return i.add(t).size!==s}let o=!1;for(let[i,s]of this.noteCache.entries()){let a=s.delete(t);o||=a,a&&s.size===0&&this.noteCache.delete(i)}return o}#t(t,r){let n=u=>{let l=this.blockCache.byFile.get(u);if(!l)return!1;this.blockCache.byFile.delete(u);for(let c of l){let f=this.blockCache.byKey.get(c.key);f.delete(c),f.size===0&&this.blockCache.byKey.delete(c.key)}return!0};if(!r)return n(t);let{blocks:o,sections:i}=r;if(!i||!o)return n(t);let s=i.filter(Ka);if(s.length===0)return n(t);n(t);let a=Ya(s.flatMap(u=>Va(u.id).map(l=>[l,u.position])),bo(([u])=>u),ki((u,l)=>({file:t,key:u,blocks:l.map(([c,f])=>f)})),Rl);this.blockCache.byFile.set(t,a);for(let u of a){let l=this.blockCache.byKey.get(u.key);l?l.add(u):this.blockCache.byKey.set(u.key,new Set([u]))}return!0}#r(t,r){let n=r?.frontmatter?.citekey;if(n){if(!this.citekeyCache.has(n))return this.citekeyCache.set(n,new Set([t])),!0;let i=this.citekeyCache.get(n),s=i.size;return i.add(t).size!==s}let o=!1;for(let[i,s]of this.citekeyCache.entries()){let a=s.delete(t);o||=a,a&&s.size===0&&this.citekeyCache.delete(i)}return o}getNotesFor(t){let r=this.noteCache.get(Bt(t,!0));return r?[...r]:[]}getBlocksFor({file:t,item:r}){if(!t&&!r)throw new Error("no file or item provided");let n=r?this.blockCache.byKey.get(Bt(r,!0)):null,o=t?this.blockCache.byFile.get(t):null;return t&&r?!o||!n?[]:o.filter(i=>n.has(i)):t?o?[...o]:[]:r?n?[...n]:[]:[]}getBlocksIn(t){let r=this.blockCache.byFile.get(t);return r?[...r]:null}#n(t,r){r===void 0&&(r=this.meta.getCache(t)),[this.#e(t,r),this.#t(t,r),this.#r(t,r)].some(o=>o)&&this.meta.trigger("zotero:index-update",t)}#i(t){this.#n(t,null)}#s(){this.noteCache.clear(),this.blockCache.byFile.clear(),this.blockCache.byKey.clear(),this.meta.trigger("zotero:index-clear")}onload(){this.settings.once(()=>{[this.meta.on("changed",this.onMetaChanged,this),this.vault.on("rename",this.onFileRenamed,this),this.vault.on("delete",this.onFileRemoved,this)].forEach(this.registerEvent.bind(this));let[t,r]=x1(this.plugin.app,{});r&&this.register(r),t.then(()=>{this.onMetaBuilt(),this.plugin.addCommand({id:"refresh-note-index",name:"Refresh literature notes index",callback:()=>{this.reload(),new sd.Notice("Literature notes re-indexed")}})})}),this.register(qe(Qe(()=>this.reload(),()=>this.literatureNoteFolder,!0)))}onMetaBuilt(){for(let t of this.vault.getMarkdownFiles())this.#n(t.path)}onMetaChanged(t,r,n){this.#n(t.path,n)}onFileRemoved(t){at(t)&&this.#i(t.path)}onFileRenamed(t,r){this.#i(r),at(t)&&this.#n(t.path)}reload(){this.#s(),this.onMetaBuilt(),W.info("Note Index: Reloaded")}};le([fe],rs.prototype,"literatureNoteFolder",1);var ZX=e=>e==="/"?"":e+"/";var Lb=require("crypto");var pM="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var YX=128,zo,ns,XX=e=>{!zo||zo.length<e?(zo=Buffer.allocUnsafe(e*YX),(0,Lb.randomFillSync)(zo),ns=0):ns+e>zo.length&&((0,Lb.randomFillSync)(zo),ns=0),ns+=e};var ad=(e=21)=>{XX(e-=0);let t="";for(let r=ns-e;r<ns;r++)t+=pM[zo[r]&63];return t};var bM=require("obsidian");var qb=/^https?:\/\/zotero\.org\/.*\/items\/([A-Z\d]+)$/;function os(e){let t=e.match(qb);return t?t[1]:null}var{DataCitation:dM,DataAnnotation:mM}=wt({CitationItem:{uris:[qb]},DataCitation:{citationItems:"CitationItem[]","properties?":"any","locator?":"string"},DataAnnotation:{attachmentURI:qb,annotationKey:"string",citationItem:"CitationItem"}}).compile();var hM=e=>({filter:(t,r)=>t.nodeName==="SPAN"&&!!t.style.color,replacement:(t,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let{color:o,colorName:i}=Bb(r.style.color),s=r.firstChild,a={bgColor:null,bgColorName:null};if(s===r.lastChild&&s?.nodeName==="SPAN"&&s.style.backgroundColor){let{color:u,colorName:l}=Bb(s.style.backgroundColor);a={bgColor:u,bgColorName:l}}return e.renderColored({content:t,color:o,colorName:i,...a})}}),gM=e=>({filter:(t,r)=>t.nodeName==="SPAN"&&!!t.style.backgroundColor,replacement:(t,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let{color:o,colorName:i}=Bb(r.style.backgroundColor),s=r.parentElement;return s?.nodeName==="SPAN"&&s.style.color&&!r.nextSibling?t:e.renderColored({content:t,color:null,colorName:null,bgColor:o,bgColorName:i})}});function Bb(e){if(!e)return{colorName:null,color:null};let t=Lt(e).toHex().toUpperCase();return{colorName:Rf[t.substring(0,7)]??t,color:t}}var Tu={cite:{pattern:/%%ZTNOTE\.CITE:([\w-]{10})%%/g,create:e=>`%%ZTNOTE.CITE:${e}%%`},annot:{pattern:/%%ZTNOTE\.ANNOT:([\w-]{10})%%/g,create:e=>`%%ZTNOTE.ANNOT:${e}%%`}},zb=class{constructor(t){Object.assign(this,t)}toString(){return this.content}},ud=class extends ue{plugin=this.use(be);citations=new Map;annotations=new Map;tdService=new globalThis.TurndownService({headingStyle:"atx"}).addRule("color",hM(this.plugin.templateRenderer)).addRule("bg-color",gM(this.plugin.templateRenderer)).addRule("highlight-imported",{filter:(t,r)=>{if(t.tagName!=="P")return!1;let[n,o,i]=t.childNodes;return n instanceof HTMLElement&&n.classList.contains("highlight")?o instanceof HTMLElement?o.classList.contains("citation"):o instanceof Text&&o.textContent?.trim()===""?i instanceof HTMLElement&&i.classList.contains("citation"):!1:!1},replacement:(t,r,n)=>{let[o,i]=r.children;for(;r.firstChild!==i;)r.removeChild(r.firstChild);r.removeChild(i);let s=yM(o.dataset.annotation),a=r,u=ad(10);return this.annotations.set(u,{annotationKey:s.annotationKey,citationKey:os(s.citationItem.uris[0]),attachementKey:os(s.attachmentURI),commentHTML:a.textContent?.trim()?a.innerHTML:null,inline:!1}),Tu.annot.create(u)}}).addRule("citation",{filter:(t,r)=>t.classList.contains("citation")&&!!t.dataset.citation,replacement:(t,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let o=QX(r.dataset.citation),i=ad(10);return this.citations.set(i,{text:t,itemKeys:o.citationItems.map(({uris:[s]})=>os(s))}),Tu.cite.create(i)}}).addRule("highlight",{filter:(t,r)=>t.classList.contains("highlight")&&!!t.dataset.annotation,replacement:(t,r,n)=>{if(!(r instanceof HTMLElement))throw new Error("Unexpected node");let o=yM(r.dataset.annotation),i=ad(10);return this.annotations.set(i,{annotationKey:o.annotationKey,citationKey:os(o.citationItem.uris[0]),attachementKey:os(o.attachmentURI),commentHTML:null,inline:!0}),Tu.annot.create(i)}});onload(){}async normalizeNotes(t){let r=[];for(let{note:n,...o}of t)r.push(new zb({...o,content:n?await this.turndown(n):"",note:n}));return r}async turndown(t){this.citations.clear(),this.annotations.clear();let r=this.tdService.turndown(t),n={citations:[...this.citations.values()].flatMap(c=>c.itemKeys),annotations:[...this.annotations.values()].map(c=>c.citationKey)},o=new Set([...this.annotations.values()].map(c=>c.attachementKey)),i=this.plugin.settings.libId,s=eQ([...n.citations,...n.annotations]),a=await this.plugin.databaseAPI.getItems(s.map(c=>[c,i])).then(async c=>{let f=new Map;for(let p=0;p<s.length;p++){let d=s[p],h=c[p];if(h===null){f.set(d,null);continue}let b=await this.plugin.databaseAPI.getAttachments(h.itemID,i),y=new Map;for(let v of b){if(!o.has(v.key))continue;let w=await this.plugin.databaseAPI.getAnnotations(v.itemID,i);for(let T of w)y.set(T.key,T)}f.set(d,{item:h,attachments:b,annotations:y})}return f}),u=await this.plugin.databaseAPI.getTags([...a.values()].flatMap(c=>c?[c.item.itemID,...[...c.annotations.values()].map(f=>f.itemID)]:[]).map(c=>[c,i])),l=r.replaceAll(Tu.cite.pattern,(c,f)=>{let p=this.citations.get(f),d=p.itemKeys.map(b=>{let y=a.get(b);if(!y)throw W.error("citation not found, key: ",b,p),new Error(`citation not found: key ${b}`);return{allAttachments:y.attachments,annotations:[],docItem:y.item,attachment:null,tags:u,notes:[]}});return this.plugin.templateRenderer.renderCitations(d,{plugin:this.plugin})}).replaceAll(Tu.annot.pattern,(c,f)=>{let p=this.annotations.get(f),d=a.get(p.citationKey);if(!d)throw W.error("citation not found, key:",f,p),new Error(`citation key not found: ${f}`);let h=d.annotations.get(p.annotationKey);if(!h)throw W.error("annotation not found, key: ",p.annotationKey,p),new Error(`annotation key not found: ${p.annotationKey}`);let b=this.plugin.templateRenderer.renderAnnot({...h,ztnote:{comment:p.commentHTML,get commentMd(){return p.commentHTML?(0,bM.htmlToMarkdown)(p.commentHTML):""},inline:p.inline}},{allAttachments:d.attachments,annotations:[...d.annotations.values()],attachment:d.attachments.find(y=>y.itemID===h.parentItemID),docItem:d.item,notes:[],tags:u},{plugin:this.plugin});return p.inline?b:`
`+b+`
`}).replace(/\n{3,}/g,`
`);return this.citations.clear(),this.annotations.clear(),l}};function QX(e){let t=JSON.parse(decodeURIComponent(e)),{data:r,problems:n}=dM(t);if(n)throw W.error("Unexpected citation data",t,n),new Error("Unexpected citation data: "+n.summary);return r}function yM(e){let t=JSON.parse(decodeURIComponent(e)),{data:r,problems:n}=mM(t);if(n)throw W.error("Unexpected annotation data",t,n),new Error("Unexpected annotation data: "+n.summary);return r}function eQ(e){return[...new Set(e)]}var fd=require("fs/promises");var tQ=(e,t)=>t.some(r=>e instanceof r),vM,xM;function rQ(){return vM||(vM=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function nQ(){return xM||(xM=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var wM=new WeakMap,Wb=new WeakMap,EM=new WeakMap,Ub=new WeakMap,Kb=new WeakMap;function oQ(e){let t=new Promise((r,n)=>{let o=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{r(Mr(e.result)),o()},s=()=>{n(e.error),o()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(r=>{r instanceof IDBCursor&&wM.set(r,e)}).catch(()=>{}),Kb.set(t,e),t}function iQ(e){if(Wb.has(e))return;let t=new Promise((r,n)=>{let o=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{r(),o()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});Wb.set(e,t)}var Hb={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return Wb.get(e);if(t==="objectStoreNames")return e.objectStoreNames||EM.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Mr(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function SM(e){Hb=e(Hb)}function sQ(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){let n=e.call(cd(this),t,...r);return EM.set(n,t.sort?t.sort():[t]),Mr(n)}:nQ().includes(e)?function(...t){return e.apply(cd(this),t),Mr(wM.get(this))}:function(...t){return Mr(e.apply(cd(this),t))}}function aQ(e){return typeof e=="function"?sQ(e):(e instanceof IDBTransaction&&iQ(e),tQ(e,rQ())?new Proxy(e,Hb):e)}function Mr(e){if(e instanceof IDBRequest)return oQ(e);if(Ub.has(e))return Ub.get(e);let t=aQ(e);return t!==e&&(Ub.set(e,t),Kb.set(t,e)),t}var cd=e=>Kb.get(e);function _M(e,t,{blocked:r,upgrade:n,blocking:o,terminated:i}={}){let s=indexedDB.open(e,t),a=Mr(s);return n&&s.addEventListener("upgradeneeded",u=>{n(Mr(s.result),u.oldVersion,u.newVersion,Mr(s.transaction),u)}),r&&s.addEventListener("blocked",u=>r(u.oldVersion,u.newVersion,u)),a.then(u=>{i&&u.addEventListener("close",()=>i()),o&&u.addEventListener("versionchange",l=>o(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}var uQ=["get","getKey","getAll","getAllKeys","count"],cQ=["put","add","delete","clear"],Vb=new Map;function IM(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Vb.get(t))return Vb.get(t);let r=t.replace(/FromIndex$/,""),n=t!==r,o=cQ.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||uQ.includes(r)))return;let i=async function(s,...a){let u=this.transaction(s,o?"readwrite":"readonly"),l=u.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),o&&u.done]))[0]};return Vb.set(t,i),i}SM(e=>({...e,get:(t,r,n)=>IM(t,r)||e.get(t,r,n),has:(t,r)=>!!IM(t,r)||e.has(t,r)}));var pd=require("obsidian");var lQ="zotlit",ld="pdf-outline",Ou=class extends ue{constructor(r){super();this.plugin=r}db=_M(lQ,1,{upgrade(r){r.createObjectStore(ld,{keyPath:"path"})}});async getCachedOutlineKeys(){return await(await this.db).getAllKeys(ld)}async getPDFOutline(r,n=!1){let o=await this.db,i=await o.get(ld,r),s;try{s=await(0,fd.stat)(r)}catch(u){if(u.code==="ENOENT")return new pd.Notice("PDF file not found"),null;throw u}if(i&&s.mtimeMs===i.mtime&&!n)return W.debug("PDF outline cache hit",r),i.outline;let a=await this.#e(r);return a?(await o.put(ld,{path:r,mtime:s.mtimeMs,outline:a,created:Date.now()}),W.debug("PDF outline cache miss and updated",r),a):null}pdfjs;async#e(r){this.pdfjs??=await(0,pd.loadPdfJs)();let n=this.pdfjs.getDocument(await(0,fd.readFile)(r)),o=await n.promise,i=CM(await o.getOutline(),0),s=await Promise.all(i.map(async({dest:a,...u})=>{if(!Array.isArray(a))return{...u,page:null};let[l]=a,c=await o.getPageIndex(l);return{...u,page:c}}));return await o.cleanup(),await n.destroy(),s}},CM=(e,t)=>e.flatMap(({title:r,dest:n,items:o})=>[{title:r,dest:n,level:t},...CM(o,t+1)]);var Gb=require("fs");var TM=require("obsidian");var cn=class extends ue{settings=this.use(de);api=this.use(Rt).api;app=this.use(TM.App);get autoRefresh(){return this.settings.current?.autoRefresh}onDatabaseUpdate(t){return()=>this.app.vault.trigger("zotero:db-updated",t)}onload(){this.register(qe(Qe(()=>this.setAutoRefresh(this.autoRefresh),()=>this.autoRefresh))),W.debug("loading DatabaseWatcher")}onunload(){this.#e()}#e(){this.#r=!1,this.#t=Ai(this.#t,t=>(t?.close(),null))}#t={main:null,bbt:null};#r=!1;async setAutoRefresh(t,r=!1){if(!(t===this.#r&&!r)&&(W.debug("Auto refresh set to "+t),this.#r=t,this.#e(),t)){this.#t.main=(0,Gb.watch)(this.settings.zoteroDbPath,this.onDatabaseUpdate("main"));let n=await this.api.getLoadStatus();n.bbt&&(this.#t.bbt=(0,Gb.watch)(n.bbtVersion==="v0"?this.settings.bbtSearchDbPath:this.settings.bbtMainDbPath,this.onDatabaseUpdate("bbt")))}}};le([fe],cn.prototype,"autoRefresh",1);var Au=class extends ue{onunload(){W.info("ZoteroDB unloaded")}get defaultLibId(){return this.settings.libId}settings=this.use(de);#e=this.use(Rt);watcher=this.use(cn);get api(){return this.#e.api}async search(t){let n=this.defaultLibId;if(this.#e.status!==2)throw new Error("Search index not ready");let o=await this.api.search(n,{query:t,limit:50,index:fQ});if(o.length===0)return[];let i=pQ(o);return i.length===0?[]:(await this.api.getItems(i.map(a=>[a.id,n]))).map((a,u)=>{let{id:l,fields:c,score:f}=i[u];if(!a)throw new Error("Item not found: "+l);return{item:a,score:f,fields:[...c]}})}async getItemsOf(t=50,r=this.defaultLibId){if(this.#e.status!==2)throw new Error("Search index not ready");return(await this.api.getItemsFromCache(t,r)).map(o=>({item:o,score:-1,fields:[]}))}},fQ=["title","creators[]:firstName","creators[]:lastName","date"];function pQ(e){let{size:t}=new Set(e.flatMap(n=>n.result)),r=e.reduce((n,{field:o,result:i})=>(o.startsWith("creators[]")&&(o="creators"),i.forEach((s,a)=>{let u=t-a;switch(o){case"title":u*=100;break;case"creators":case"date":u*=5;break;default:throw new Error("Unknown field: "+o)}if(!n.has(+s))n.set(+s,{id:+s,score:u,fields:new Set([o])});else{let l=n.get(+s);l.fields.add(o),l.score+=u}}),n),new Map);return Array.from(r.values()).sort((n,o)=>o.score-n.score)}var yr=require("fs/promises"),OM=require("path"),AM=require("path/posix");var ir=require("obsidian");var zn=class extends ue{onload(){W.debug("loading ImgCacheImporter")}async onunload(){await this.flush()}get app(){return this.use(be).app}settings=this.use(de);queue=new Map;getCachePath(t){return An(t,this.settings.current?.zoteroDataDir)}get mode(){return this.settings.current?.imgExcerptImport}get path(){return this.settings.current?.imgExcerptPath}get imgExcerptDir(){return this.mode?this.path:null}getInVaultPath(t){if(!this.imgExcerptDir||t.type!==_e.image)return null;let r=this.getCachePath(t);return mQ(t,r,this.imgExcerptDir)}import(t){let r=this.getCachePath(t),n=this.getInVaultPath(t);if(!n)return null;let o;return this.queue.has(n)?o=this.queue.get(n):(o=async()=>{let i=await this.linkToVault(n,r);return this.queue.delete(n),i},this.queue.set(n,o)),n}async flush(){return await Promise.all([...this.queue.values()].map(r=>r()))}cancel(){this.queue.clear()}async linkToVault(t,r){let n=await(0,yr.stat)(r).then(s=>{if(!s.isFile()&&!s.isSymbolicLink()){let a=`failed to link image excerpt cache to vault: given path not file ${r}`;return new ir.Notice(a),it(a,null),-1}return s.mtimeMs}).catch(s=>{if(s.code==="ENOENT"){let a=`failed to link image excerpt cache to vault: file not found ${r}`;return new ir.Notice(a),it(a,s),-1}throw s});if(n===-1)return!1;let o=this.mode;if(o===!1)return W.trace("import mode disabled"),!1;let i=(0,AM.dirname)(t);if(i!=="."&&i!==".."&&await this.app.vault.createFolder(i).catch(()=>{}),this.app.vault.adapter instanceof ir.FileSystemAdapter){let s=this.app.vault.adapter.getFullPath(t),a=await(0,yr.lstat)(s).catch(u=>{if(u.code!=="ENOENT")throw u;return null});if(o==="copy"){let u=-1;if(a)if(a.isSymbolicLink())W.trace(s+" is symlink, unlinking"),await(0,yr.rm)(s);else if(a.isFile())u=a.mtimeMs;else{let l="Failed to import image excerpt cache: cannot overwrite non-file "+s;return new ir.Notice(l),it(l,null),!1}if(u<0||n>u)return W.trace(s+" is file, "+(u<0?"creating":"overwritting")),await(0,yr.copyFile)(r,s),new ir.Notice(`Copied image excerpt cache to vault: ${t}`),!0;W.trace("mtime check pass, skipping")}else{if(a){if(a.isSymbolicLink())return W.trace(s+" is symlink, skipping"),!1;if(a.isFile())W.trace(s+" is file, remove before symlinking"),await(0,yr.rm)(s);else{let u="Failed to import image excerpt cache: cannot overwrite non-file "+s;return new ir.Notice(u),it(u,null),!1}}try{await(0,yr.symlink)(r,s,"file")}catch(u){if(u.code==="EPERM")return new ir.Notice(`Failed to symlink image excerpt cache to vault: permission denied ${r}, check directory permission or change import mode to copy. If you are using FAT32 drive, symlink is not supported.`),it(`Failed to symlink image excerpt cache to vault: permission denied ${r}`,u),!1;throw u}return new ir.Notice(`linked image excerpt cache to vault: ${t}`),!0}return!1}else throw new Error("Mobile not supported")}};le([fe],zn.prototype,"mode",1),le([fe],zn.prototype,"path",1),le([fe],zn.prototype,"imgExcerptDir",1);var dQ=(e,t)=>(t??"")+(0,OM.basename)(e),mQ=(e,t,r)=>{let n=dQ(t,e.groupID);return[(0,ir.normalizePath)(r),n].join("/")};S();S();S();function is(e,t=[]){let r=[];function n(i,s){let a=Le(s),u=r.length;r=[...r,s];function l(f){let{scope:p,children:d,...h}=f,b=p?.[e][u]||a,y=ne(()=>h,Object.values(h));return H(b.Provider,{value:y},d)}function c(f,p){let d=p?.[e][u]||a,h=Q(d);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(s=>Le(s));return function(a){let u=a?.[e]||i;return ne(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[n,hQ(o,...t)]}function hQ(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let s=n.reduce((a,{useScope:u,scopeName:l})=>{let f=u(i)[`__scope${l}`];return{...a,...f}},{});return ne(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}S();S();S();function gQ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Jb(...e){return t=>e.forEach(r=>gQ(r,t))}function Uo(...e){return Y(Jb(...e),e)}S();var ss=Z((e,t)=>{let{children:r,...n}=e,o=Ve.toArray(r),i=o.find(bQ);if(i){let s=i.props.children,a=o.map(u=>u===i?Ve.count(s)>1?Ve.only(null):Pt(s)?s.props.children:null:u);return H(Zb,ce({},n,{ref:t}),Pt(s)?Xt(s,void 0,a):null)}return H(Zb,ce({},n,{ref:t}),r)});ss.displayName="Slot";var Zb=Z((e,t)=>{let{children:r,...n}=e;return Pt(r)?Xt(r,{...vQ(n,r.props),ref:Jb(t,r.ref)}):Ve.count(r)>1?Ve.only(null):null});Zb.displayName="SlotClone";var yQ=({children:e})=>H($,null,e);function bQ(e){return Pt(e)&&e.type===yQ}function vQ(e,t){let r={...t};for(let n in t){let o=e[n],i=t[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...a)=>{i(...a),o(...a)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...e,...r}}function kM(e){let t=e+"CollectionProvider",[r,n]=is(t),[o,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=d=>{let{scope:h,children:b}=d,y=R.useRef(null),v=R.useRef(new Map).current;return R.createElement(o,{scope:h,itemMap:v,collectionRef:y},b)},a=e+"CollectionSlot",u=R.forwardRef((d,h)=>{let{scope:b,children:y}=d,v=i(a,b),w=Uo(h,v.collectionRef);return R.createElement(ss,{ref:w},y)}),l=e+"CollectionItemSlot",c="data-radix-collection-item",f=R.forwardRef((d,h)=>{let{scope:b,children:y,...v}=d,w=R.useRef(null),T=Uo(h,w),M=i(l,b);return R.useEffect(()=>(M.itemMap.set(w,{ref:w,...v}),()=>void M.itemMap.delete(w))),R.createElement(ss,{[c]:"",ref:T},y)});function p(d){let h=i(e+"CollectionConsumer",d);return R.useCallback(()=>{let y=h.collectionRef.current;if(!y)return[];let v=Array.from(y.querySelectorAll(`[${c}]`));return Array.from(h.itemMap.values()).sort((M,V)=>v.indexOf(M.ref.current)-v.indexOf(V.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:s,Slot:u,ItemSlot:f},p,n]}S();S();var ku=globalThis?.document?Et:()=>{};var xQ=lr["useId".toString()]||(()=>{}),wQ=0;function dd(e){let[t,r]=j(xQ());return ku(()=>{e||r(n=>n??String(wQ++))},[e]),e||(t?`radix-${t}`:"")}S();S();var EQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Un=EQ.reduce((e,t)=>{let r=Z((n,o)=>{let{asChild:i,...s}=n,a=i?ss:t;return U(()=>{window[Symbol.for("radix-ui")]=!0},[]),H(a,ce({},s,{ref:o}))});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});S();function Nu(e){let t=F(e);return U(()=>{t.current=e}),ne(()=>(...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}S();function md({prop:e,defaultProp:t,onChange:r=()=>{}}){let[n,o]=SQ({defaultProp:t,onChange:r}),i=e!==void 0,s=i?e:n,a=Nu(r),u=Y(l=>{if(i){let f=typeof l=="function"?l(e):l;f!==e&&a(f)}else o(l)},[i,e,o,a]);return[s,u]}function SQ({defaultProp:e,onChange:t}){let r=j(e),[n]=r,o=F(n),i=Nu(t);return U(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}S();var IQ=Le(void 0);function hd(e){let t=Q(IQ);return e||t||"ltr"}var Yb="rovingFocusGroup.onEntryFocus",_Q={bubbles:!1,cancelable:!0},Qb="RovingFocusGroup",[Xb,NM,CQ]=kM(Qb),[TQ,ev]=is(Qb,[CQ]),[OQ,AQ]=TQ(Qb),kQ=Z((e,t)=>H(Xb.Provider,{scope:e.__scopeRovingFocusGroup},H(Xb.Slot,{scope:e.__scopeRovingFocusGroup},H(NQ,ce({},e,{ref:t}))))),NQ=Z((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:l,...c}=e,f=F(null),p=Uo(t,f),d=hd(i),[h=null,b]=md({prop:s,defaultProp:a,onChange:u}),[y,v]=j(!1),w=Nu(l),T=NM(r),M=F(!1),[V,J]=j(0);return U(()=>{let G=f.current;if(G)return G.addEventListener(Yb,w),()=>G.removeEventListener(Yb,w)},[w]),H(OQ,{scope:r,orientation:n,dir:d,loop:o,currentTabStopId:h,onItemFocus:Y(G=>b(G),[b]),onItemShiftTab:Y(()=>v(!0),[]),onFocusableItemAdd:Y(()=>J(G=>G+1),[]),onFocusableItemRemove:Y(()=>J(G=>G-1),[])},H(Un.div,ce({tabIndex:y||V===0?-1:0,"data-orientation":n},c,{ref:p,style:{outline:"none",...e.style},onMouseDown:Ct(e.onMouseDown,()=>{M.current=!0}),onFocus:Ct(e.onFocus,G=>{let K=!M.current;if(G.target===G.currentTarget&&K&&!y){let P=new CustomEvent(Yb,_Q);if(G.currentTarget.dispatchEvent(P),!P.defaultPrevented){let X=T().filter(D=>D.focusable),C=X.find(D=>D.active),_=X.find(D=>D.id===h),B=[C,_,...X].filter(Boolean).map(D=>D.ref.current);RM(B)}}M.current=!1}),onBlur:Ct(e.onBlur,()=>v(!1))})))}),RQ="RovingFocusGroupItem",DQ=Z((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...s}=e,a=dd(),u=i||a,l=AQ(RQ,r),c=l.currentTabStopId===u,f=NM(r),{onFocusableItemAdd:p,onFocusableItemRemove:d}=l;return U(()=>{if(n)return p(),()=>d()},[n,p,d]),H(Xb.ItemSlot,{scope:r,id:u,focusable:n,active:o},H(Un.span,ce({tabIndex:c?0:-1,"data-orientation":l.orientation},s,{ref:t,onMouseDown:Ct(e.onMouseDown,h=>{n?l.onItemFocus(u):h.preventDefault()}),onFocus:Ct(e.onFocus,()=>l.onItemFocus(u)),onKeyDown:Ct(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;let b=$Q(h,l.orientation,l.dir);if(b!==void 0){h.preventDefault();let v=f().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")v.reverse();else if(b==="prev"||b==="next"){b==="prev"&&v.reverse();let w=v.indexOf(h.currentTarget);v=l.loop?MQ(v,w+1):v.slice(w+1)}setTimeout(()=>RM(v))}})})))}),PQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FQ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function $Q(e,t,r){let n=FQ(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return PQ[n]}function RM(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function MQ(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var DM=kQ,PM=DQ;S();S();function jQ(e,t){return Nr((r,n)=>{let o=t[r][n];return o??r},e)}var tv=e=>{let{present:t,children:r}=e,n=LQ(t),o=typeof r=="function"?r({present:n.isPresent}):Ve.only(r),i=Uo(n.ref,o.ref);return typeof r=="function"||n.isPresent?Xt(o,{ref:i}):null};tv.displayName="Presence";function LQ(e){let[t,r]=j(),n=F({}),o=F(e),i=F("none"),s=e?"mounted":"unmounted",[a,u]=jQ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U(()=>{let l=gd(n.current);i.current=a==="mounted"?l:"none"},[a]),ku(()=>{let l=n.current,c=o.current;if(c!==e){let p=i.current,d=gd(l);e?u("MOUNT"):d==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&p!==d?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),ku(()=>{if(t){let l=f=>{let d=gd(n.current).includes(f.animationName);f.target===t&&d&&Rr(()=>u("ANIMATION_END"))},c=f=>{f.target===t&&(i.current=gd(n.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:Y(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function gd(e){return e?.animationName||"none"}var FM="Tabs",[qQ,qPe]=is(FM,[ev]),$M=ev(),[BQ,rv]=qQ(FM),zQ=Z((e,t)=>{let{__scopeTabs:r,value:n,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:u="automatic",...l}=e,c=hd(a),[f,p]=md({prop:n,onChange:o,defaultProp:i});return H(BQ,{scope:r,baseId:dd(),value:f,onValueChange:p,orientation:s,dir:c,activationMode:u},H(Un.div,ce({dir:c,"data-orientation":s},l,{ref:t})))}),UQ="TabsList",WQ=Z((e,t)=>{let{__scopeTabs:r,loop:n=!0,...o}=e,i=rv(UQ,r),s=$M(r);return H(DM,ce({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:n}),H(Un.div,ce({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),HQ="TabsTrigger",KQ=Z((e,t)=>{let{__scopeTabs:r,value:n,disabled:o=!1,...i}=e,s=rv(HQ,r),a=$M(r),u=MM(s.baseId,n),l=jM(s.baseId,n),c=n===s.value;return H(PM,ce({asChild:!0},a,{focusable:!o,active:c}),H(Un.button,ce({type:"button",role:"tab","aria-selected":c,"aria-controls":l,"data-state":c?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u},i,{ref:t,onMouseDown:Ct(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(n):f.preventDefault()}),onKeyDown:Ct(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(n)}),onFocus:Ct(e.onFocus,()=>{let f=s.activationMode!=="manual";!c&&!o&&f&&s.onValueChange(n)})})))}),VQ="TabsContent",GQ=Z((e,t)=>{let{__scopeTabs:r,value:n,forceMount:o,children:i,...s}=e,a=rv(VQ,r),u=MM(a.baseId,n),l=jM(a.baseId,n),c=n===a.value,f=F(c);return U(()=>{let p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),H(tv,{present:o||c},({present:p})=>H(Un.div,ce({"data-state":c?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!p,id:l,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),p&&i))});function MM(e,t){return`${e}-trigger-${t}`}function jM(e,t){return`${e}-content-${t}`}var LM=zQ,nv=WQ,ov=KQ,iv=GQ;S();var qM=LM,sv=Z(({className:e,...t},r)=>m(nv,{ref:r,className:ee("inline-flex items-center justify-center rounded-md bg-secondary p-1",e),...t}));sv.displayName=nv.displayName;var Wn=Z(({className:e,...t},r)=>m(ov,{className:ee("obzt-btn-reset","inline-flex min-w-[100px] items-center justify-center rounded-[0.185rem] px-3 py-1.5 text-sm font-medium text-txt-muted transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary data-[state=active]:text-txt-normal data-[state=active]:shadow-sm",e),...t,ref:r}));Wn.displayName=ov.displayName;var Hn=Z(({className:e,...t},r)=>m(iv,{className:ee("mt-2 rounded-md border p-6",e),...t,ref:r}));Hn.displayName=iv.displayName;S();S();function as(){return as=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},as.apply(this,arguments)}var HPe=typeof Symbol<"u"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator",KPe=typeof Symbol<"u"?Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")):"@@asyncIterator";var ZQ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Et:U,YQ=function(t){var r=F(t);return ZQ(function(){r.current=t}),Y(function(){return r.current},[r])},XQ={status:"not-requested",loading:!1,result:void 0,error:void 0},zM={status:"loading",loading:!0,result:void 0,error:void 0},QQ=function(t){return zM},eee=function(t,r){return{status:"success",loading:!1,result:t,error:void 0}},tee=function(t,r){return{status:"error",loading:!1,result:void 0,error:t}},BM=function(){},ree={initialState:function(t){return t&&t.executeOnMount?zM:XQ},executeOnMount:!0,executeOnUpdate:!0,setLoading:QQ,setResult:eee,setError:tee,onSuccess:BM,onError:BM},nee=function(t){return as({},ree,{},t)},oee=function(t){var r=j(function(){return t.initialState(t)}),n=r[0],o=r[1],i=Y(function(){return o(t.initialState(t))},[o,t]),s=Y(function(){return o(t.setLoading(n))},[n,o]),a=Y(function(c){return o(t.setResult(c,n))},[n,o]),u=Y(function(c){return o(t.setError(c,n))},[n,o]),l=Y(function(c){return o(as({},n,{},c))},[n,o]);return{value:n,set:o,merge:l,reset:i,setLoading:s,setResult:a,setError:u}},iee=function(){var t=F(!1);return U(function(){return t.current=!0,function(){t.current=!1}},[]),function(){return t.current}},see=function(){var t=F(null);return{set:function(n){return t.current=n},get:function(){return t.current},is:function(n){return t.current===n}}},UM=function(t,r,n){!r&&(r=[]);var o=nee(n),i=j(null),s=i[0],a=i[1],u=oee(o),l=iee(),c=see(),f=function(v){return l()&&c.is(v)},p=function(){for(var v=arguments.length,w=new Array(v),T=0;T<v;T++)w[T]=arguments[T];var M=function(){try{return Promise.resolve(t.apply(void 0,w))}catch(V){return Promise.reject(V)}}();return a(w),c.set(M),u.setLoading(),M.then(function(V){f(M)&&u.setResult(V),o.onSuccess(V,{isCurrent:function(){return c.is(M)}})},function(V){f(M)&&u.setError(V),o.onError(V,{isCurrent:function(){return c.is(M)}})}),M},d=YQ(p),h=Y(function(){return d().apply(void 0,arguments)},[d]),b=!l();return U(function(){var y=function(){return d().apply(void 0,r)};b&&o.executeOnMount&&y(),!b&&o.executeOnUpdate&&y()},r),as({},u.value,{set:u.set,merge:u.merge,reset:u.reset,execute:h,currentPromise:c.get(),currentParams:s})};function WM(e,t,r){return UM(e,t,r)}var HM=function(t,r){return UM(t,[],as({},r,{executeOnMount:!1,executeOnUpdate:!1}))};var KM=require("obsidian");var yd=class{constructor(t){this.path=t??yd.defaultPath}vaildPath;get path(){return this.vaildPath}set path(t){t?this.vaildPath=(0,KM.normalizePath)(t):this.vaildPath=yd.defaultPath}getFile(t){return t.getAbstractFileByPath(this.vaildPath)}fromJSON(t){return t&&(this.vaildPath=t),this}toJSON(){return this.path}toString(){return this.path}},Ru=yd;Nv(Ru,"defaultPath","/");var Ot=Le({});function us(e){return new Ru(e).path}function bd(e,t,r){let[n,o]=j(!1);return[WM(e,[...t,n],r),Y(()=>o(i=>!i),[])]}var VM=require("obsidian");S();S();var ye=Z(function({name:t,description:r,heading:n,children:o,className:i},s){return m("div",{className:ee("setting-item",n&&"setting-item-heading border-none",i),children:[m("div",{className:"setting-item-info",children:[m("div",{className:"setting-item-name",children:t}),r&&m("div",{className:"setting-item-description",children:r})]}),m("div",{className:"setting-item-control",ref:s,children:o})]})});function aee(e){let t=F(e);return t.current=e,ne(()=>Bu(()=>t.current()),[])}function Fe(e,t){let r=Q(Ot).settings,n=aee(()=>e(r.current)).value,o=$t(function(s){r.update(a=>t(s,a))});return[n,o]}function av(e,t){let r=$t(t),n=F(null);return U(()=>{n.current?.setValue(e)},[e]),Y(o=>{if(!o)n.current?.toggleEl.remove(),n.current=null;else{let i=new VM.ToggleComponent(o);i.setValue(e),i.onChange(r),n.current=i}},[])}function br({name:e,children:t,get:r,set:n}){let o=av(...Fe(r,n));return m(uv,{ref:o,name:e,children:t})}var uv=Z(function({name:t,children:r},n){return m(ye,{className:"mod-toggle",ref:n,name:t,description:r})});var ZM=ge(require("node:net"),1),YM=ge(require("node:os"),1),xd=class extends Error{constructor(t){super(`${t} is locked`)}},cs={old:new Set,young:new Set},uee=1e3*15;var vd,cee=()=>{let e=YM.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},GM=e=>new Promise((t,r)=>{let n=ZM.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:o}=n.address();n.close(()=>{t(o)})})}),JM=async(e,t)=>{if(e.host||e.port===0)return GM(e);for(let r of t)try{await GM({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},lee=function*(e){e&&(yield*e),yield 0};async function cv(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let o=e.exclude;if(typeof o[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let i of o){if(typeof i!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(i))throw new TypeError(`Number ${i} in the exclude option is not a safe integer and can't be used`)}r=new Set(o)}vd===void 0&&(vd=setInterval(()=>{cs.old=cs.young,cs.young=new Set},uee),vd.unref&&vd.unref());let n=cee();for(let o of lee(t))try{if(r.has(o))continue;let i=await JM({...e,port:o},n);for(;cs.old.has(i)||cs.young.has(i);){if(o!==0)throw new xd(o);i=await JM({...e,port:o},n)}return cs.young.add(i),i}catch(i){if(!["EADDRINUSE","EACCES"].includes(i.code)&&!(i instanceof xd))throw i}throw new Error("No available ports found")}var lv=require("obsidian");S();function XM(){let[e,t]=Fe(n=>n.enableServer,(n,o)=>({...o,enableServer:n})),r=av(e,t);return m($,{children:[m(ye,{heading:!0,name:"Background connect",description:"Allow Zotero to send status in the background, which is required for some features like focus annotation on selection in Zotero"}),m(uv,{ref:r,name:"Enable",children:"Remember to enable the server in Zotero as well"}),e&&m(fee,{})]})}function fee(){let[e,t]=Fe(a=>a.serverPort,(a,u)=>({...u,serverPort:a})),[r]=Fe(a=>a.serverHostname,(a,u)=>({...u,serverHostname:a})),[n,o]=j(e),[i]=St("check");async function s(){if(isNaN(n)||n<0||n>65535)return new lv.Notice("Invalid port number: "+n),o(e),!1;if(n===e)return!1;let a=await cv({host:r,port:[n]});return a!==n?(new lv.Notice(`Port is currently occupied, a different port is provided: ${a}, confirm again to apply the change.`),o(a),!1):(t(a),!0)}return m(ye,{name:"Port number",description:`Default to ${e}`,children:[m("input",{type:"number",value:n,min:0,max:65535,onChange:a=>o(Number.parseInt(a.target.value,10))}),m("button",{"aria-label":"Apply",ref:i,onClick:s})]})}var ej=require("@electron/remote"),tj=require("obsidian");S();function fv({children:e,path:t,state:r}){return m("div",{children:[e,": ",r==="failed"&&"(Failed to load)",m(pv,{path:t,state:r})]})}function pv({path:e,state:t}){return m("code",{"data-state":t,className:ee("data-[state=success]:text-txt-success","data-[state=failed]:text-txt-error","data-[state=disabled]:text-txt-muted"),children:e})}S();function dv(e){let{database:t}=Q(Ot),[r,n]=bd(()=>t.api.getLoadStatus().then(i=>e==="zotero"?i.main:i.bbt),[e]),o;return r.loading?o="disabled":r.error?o="failed":o=r.result?"success":"failed",[o,n]}function mv(){let e=QM("main"),t=QM("bbt"),[r,n]=dv("zotero"),[o,i]=dv("bbt"),[s,a,u]=pee(()=>{n(),i()});return m(ye,{name:"Zotero data directory",description:m($,{children:[m(fv,{path:e,state:r,children:"Zotero"}),m(fv,{path:t,state:o,children:"Better BibTeX"})]}),children:[m(pv,{path:s,state:a}),m("button",{onClick:u,children:"Select"})]})}function pee(e){let[t,r]=Fe(s=>s.zoteroDataDir,(s,a)=>({...a,zoteroDataDir:s})),{app:n}=Q(Ot),o=HM(async()=>{try{let{filePaths:[s]}=await ej.dialog.showOpenDialog({defaultPath:t,properties:["openDirectory"]});s&&t!==s&&(r(s),await new Promise((a,u)=>{function l(){a(),n.vault.off("zotero:db-refresh",l)}n.vault.on("zotero:db-refresh",l),setTimeout(()=>{u(new DOMException("Timeout after 5s","TimeoutError")),n.vault.off("zotero:db-refresh",l)},5e3)}),e())}catch(s){throw console.error("Failed to set data directory",s),new tj.Notice(`Failed to set data directory: ${s}`),s}}),i;return o.loading?i="disabled":o.error?i="failed":i="success",[t,i,o.execute]}function QM(e){let t=Q(Ot).settings;return e==="main"?t.zoteroDbPath:t.bbtMainDbPath}function hv(){return m($,{children:[m(mv,{}),m(br,{name:"Refresh automatically when Zotero updates database",get:e=>e.autoRefresh,set:(e,t)=>({...t,autoRefresh:e})}),m(XM,{})]})}S();function Wo({name:e,children:t,normalize:r,get:n,set:o}){let[i,s]=Fe(n,o),[a,u]=j(i);return m(gv,{name:e,value:a,onChange:l=>u(l.target.value),onSubmit:()=>{let l=r?.(a)??a;l!==a&&u(l),s(l)},children:t})}function gv({name:e,children:t,value:r,onChange:n,onSubmit:o}){let[i]=St("check");return m(ye,{name:e,description:t,children:[m(tu,{className:"border",value:r,onChange:n}),m("button",{"aria-label":"Apply",ref:i,onClick:o})]})}function rj(){let[e,t]=Fe(r=>r.imgExcerptImport===!1?"false":r.imgExcerptImport,(r,n)=>({...n,imgExcerptImport:r==="false"?!1:r}));return m($,{children:[m(ye,{heading:!0,name:"Image excerpt",description:"Controls how to import images in annotaion excerpts."}),m(ye,{name:"Mode",description:m("dl",{className:"mt-2 grid grid-cols-3 gap-1",children:[m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Direct link"}),m("dd",{className:"mt-1",children:["Use image embed linked directly to the original image in Zotero cache using ",m("code",{children:"file://"})," url"]})]}),m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Symlink"}),m("dd",{className:"mt-1",children:["Create a symlink to the original image in Zotero cache within the specified folder",m("p",{className:"text-txt-error",children:"Don't use this option if your file system doesn't support symlink."})]})]}),m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Copy"}),m("dd",{className:"mt-1",children:"Copy the original image to the specified folder."})]})]}),children:m("select",{className:"dropdown",onChange:r=>t(r.target.value),value:e,children:[m("option",{value:"false",children:"direct link"},0),m("option",{value:"symlink",children:"symlink"},1),m("option",{value:"copy",children:"copy"},2)]})}),e!=="false"&&m($,{children:m(Wo,{name:"Default location",get:r=>r.imgExcerptPath,set:(r,n)=>({...n,imgExcerptPath:r}),normalize:us,children:"The folder to store image excerpts."})})]})}S();function yv(){let{database:e}=Q(Ot),[t,r]=Fe(a=>a.citationLibrary,(a,u)=>({...u,citationLibrary:a})),[n,o]=bd(()=>e.api.getLibs(),[]),i=n.result??[{groupID:null,libraryID:1,name:"My Library"}],[s]=St("switch");return m(ye,{name:"Citation library",children:[m("select",{className:"dropdown",onChange:a=>r(Number.parseInt(a.target.value,10)),value:t,children:i.map(({groupID:a,libraryID:u,name:l})=>m("option",{value:u,children:l?a?`${l} (Group)`:l:`Library ${u}`},u))}),m("button",{"aria-label":"Refresh",ref:s,onClick:async()=>{await e.refresh({task:"full"}),o()}})]})}function bv(){return m($,{children:[m(Wo,{name:"Default location for new literature notes",get:e=>e.literatureNoteFolder,set:(e,t)=>({...t,literatureNoteFolder:e}),normalize:us}),m(yv,{}),m(rj,{})]})}function vv(){let[e,t]=Fe(r=>r.logLevel,(r,n)=>({...n,logLevel:r}));return m($,{children:[m(ye,{heading:!0,name:"Debug"}),m(ye,{name:"Log Level",description:m($,{children:["Change level of logs output to the console.",m("br",{}),"Set to DEBUG if you need to report a issue",m("br",{}),"To check console, ",RT()]}),children:m("select",{className:"dropdown",onChange:r=>{let n=r.target.value;t(n)},value:e,children:Object.entries(Qv).map(([r,n])=>m("option",{value:n,children:r},n))})})]})}function xv(){return m($,{children:m(vv,{})})}var nj=require("obsidian");var Du=class extends nj.PluginSettingTab{#e(){let t=this.containerEl.parentElement;if(!t)throw new Error("Setting tab is not mounted");if(!t.classList.contains("vertical-tab-content-container"))return W.error("Failed to patch unload, unexpected tabContentContainer"),console.error(t),!1;let r=this,n=qt(t,{empty:o=>function(){r.unload(),o.call(this),n()}});return W.debug("Setting tab unload patched"),!0}#t=[];register(t){this.#t.push(t)}unload(){for(;this.#t.length>0;)this.#t.pop()()}display(){this.containerEl.empty(),this.#e()}};function wv(){return m($,{children:[m(br,{name:"Citation editor suggester",get:e=>e.citationEditorSuggester,set:(e,t)=>({...t,citationEditorSuggester:e})}),m(br,{name:"Show BibTex citekey in suggester",get:e=>e.showCitekeyInSuggester,set:(e,t)=>({...t,showCitekeyInSuggester:e})})]})}S();function Ev(){let[e,t]=Fe(l=>l.autoTrim[0],(l,c)=>({...c,autoTrim:[l,c.autoTrim[1]]})),[r,n]=Fe(l=>l.autoTrim[1],(l,c)=>({...c,autoTrim:[c.autoTrim[0],l]})),[o,i]=j(e),[s,a]=j(r),u=$t(async function(c,f){let p=c==="false"?!1:c;f===0?(i(p),t(p)):(a(p),n(p))});return m(ye,{name:"Auto trim",description:m($,{children:[m("p",{className:"text-sm",children:["Controls default whitespace/new line trimming before/after a ejs"," ",m("code",{className:"whitespace-nowrap",children:"<% Tag %>"})]}),m("dl",{className:"mt-2",children:m("div",{className:"grid grid-cols-2 gap-1",children:[m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Newline slurp"}),m("dd",{className:"mt-1",children:"Removes the following newline before and after the tag."})]}),m("div",{children:[m("dt",{className:"text-xs font-medium text-txt-normal",children:"Whitespace slurp:"}),m("dd",{className:"mt-1",children:"Removes all whitespace before and after the tag."})]})]})})]}),children:m("div",{className:"flex flex-col gap-2",children:[0,1].map(l=>m("div",{className:"flex flex-col items-start gap-1 text-sm",children:[m("span",{children:l===0?"Leading":"Ending"}),m("select",{className:"dropdown",onChange:c=>u(c.target.value,l),value:String(l===0?o:s),children:[m("option",{value:"false",children:"Disable"},0),m("option",{value:"nl",children:"Newline slurp (-)"},1),m("option",{value:"slurp",children:"Whitespace slurp (_)"},2)]})]},l))})})}var Vn=require("obsidian");S();var oj=require("obsidian");S();function Sv(e,{icon:t,desc:r,disable:n}){let o=$t(e),i=F(null);return U(()=>{i.current?.setIcon(t??"")},[t]),U(()=>{i.current?.setTooltip(r??"")},[r]),U(()=>{i.current?.setDisabled(n??!1)},[n]),Y(s=>{if(!s)i.current?.extraSettingsEl.remove(),i.current=null;else{let a=new oj.ExtraButtonComponent(s);a.onClick(o),i.current=a}},[])}var Kn={filename:{title:"Note filename",desc:"Used to render filename for each imported literature note"},cite:{title:"Primary Markdown citation",desc:"Used to render citation in literature note"},cite2:{title:"Secondary Markdown citation",desc:"Used to render alternative citation in literature note"},field:{title:"Note properties",desc:"Used to render Properties in literature note"},note:{title:"Note content",desc:"Used to render created literature note"},annotation:{title:"Single annotaion",desc:"Used to render single annotation"},annots:{title:"Annotations",desc:"Used to render annotation list when batch importing"},colored:{title:"Colored highlight",desc:"Used to render highlights with color in imported Zotero note"}};function ij({type:e}){let{app:t,settings:r}=Q(Ot),[n]=St("arrow-up-right"),[o]=St("folder-input"),[i]=St("reset"),[s,a]=j(()=>Iv(e,{app:t,folder:r.templateDir})),u=io(e,r.templateDir);return U(()=>{let l=[t.vault.on("delete",c=>{c.path===u&&a(!1)}),t.vault.on("create",c=>{c.path===u&&a(!0)}),t.vault.on("rename",(c,f)=>{c.path===u&&a(!0),f===u&&a(!1)})];return()=>l.forEach(c=>t.vault.offref(c))},[u]),s?m(ye,{name:Kn[e].title,description:Kn[e].desc,children:[m("code",{children:u}),m("button",{"aria-label":"Open template file",ref:n,onClick:async()=>{await Bo(e,null,{app:t,settings:r})}}),m("button",{"aria-label":"Reset to default",ref:i,onClick:async()=>{if(!activeWindow.confirm("Reset template to default?"))return;let l=t.vault.getAbstractFileByPath(u);l instanceof Vn.TFile?(await t.vault.modify(l,ot.Ejectable[e]),new Vn.Notice(`Template '${u}' reset`)):a(!0)}})]}):m(ye,{name:Kn[e].title,description:Kn[e].desc,children:[m("pre",{className:"text-left max-w-xs overflow-scroll rounded border p-4",children:ot.Ejectable[e]}),m("button",{"aria-label":"Save to template folder",ref:o,onClick:async()=>{let l=await sj(e,{app:t,folder:r.templateDir});a(l)}})]})}async function sj(e,{app:t,folder:r}){let n=io(e,r),o=t.vault.getAbstractFileByPath(n);return o instanceof Vn.TFile?!0:o?(new Vn.Notice(`The path '${n}' is occupied by a folder`),!1):(await t.fileManager.createNewMarkdownFile(t.vault.getRoot(),n,ot.Ejectable[e]),new Vn.Notice(`Template '${n}' created`),!0)}function Iv(e,{app:t,folder:r}){let n=io(e,r);return t.vault.getAbstractFileByPath(n)instanceof Vn.TFile}function aj(){let{app:e,settings:t}=Q(Ot),[r,n]=j(()=>_r.Ejectable.every(i=>Iv(i,{app:e,folder:t.templateDir}))),o=Sv(async()=>{let i=_r.Ejectable.filter(s=>!Iv(s,{app:e,folder:t.templateDir}));await Promise.all(i.map(s=>sj(s,{app:e,folder:t.templateDir}))),n(!0)},{icon:r?"":"folder-input",desc:r?"":"Save template files to template folder",disable:r});return[r,o]}S();function uj({type:e}){let[t,r]=Fe(i=>i.template.templates[e],(i,s)=>({...s,template:{...s.template,templates:{...s.template.templates,[e]:i}}})),[n,o]=j(t);return m(gv,{name:Kn[e].title,value:n,onChange:i=>o(i.target.value),onSubmit:()=>{r(n)},children:Kn[e].desc})}function _v(){let[e,t]=aj();return m($,{children:[m(Wo,{name:"Template location",get:r=>r.template.folder,set:(r,n)=>({...n,template:{...n.template,folder:r}}),normalize:us,children:"The folder which templates are ejected into and stored"}),m(br,{name:"Auto pair for Eta",get:r=>r.autoPairEta,set:(r,n)=>({...n,autoPairEta:r}),children:["Pair `<` and `%` automatically in eta templates.",m("br",{}),"If you have issue with native auto pair features, you can disable this option and report the bug in GitHub"]}),m(Ev,{}),m(ye,{heading:!0,name:"Simple"}),_r.Embeded.map(r=>m(uj,{type:r},r)),m(ye,{heading:!0,name:"Ejectable",ref:t,description:"These templates can be customized once saved to the template folder",children:e||m("div",{children:"Eject"})}),_r.Ejectable.map(r=>m(ij,{type:r},r))]})}function Cv(){return m($,{children:[m(ye,{heading:!0,name:"Update note",description:m($,{children:["You can find update note option in ",m("code",{children:"More Options"})," menu and command pallette inside a literature note. When update, all literature notes with the same ",m("code",{children:"zotero-key"})," will be updated."]})}),m(br,{name:"Overwrite existing note",get:e=>e.updateOverwrite,set:(e,t)=>({...t,updateOverwrite:e}),children:m("div",{className:"space-y-2",children:m("div",{className:"text-txt-error",children:"\u26A0 WARNING: This will overwrite the whole note content with latest one when update literature note, make sure you didn't add any custom content in the note before enable this option."})})}),m(br,{name:"In-place update of existing annotations",get:e=>e.updateAnnotBlock,set:(e,t)=>({...t,updateAnnotBlock:e}),children:m("div",{className:"space-y-2",children:[m("div",{children:"(Experimental)"}),m("div",{className:"text-txt-error",children:"\u26A0 WARNING: When enable, the plugin will try to update existing annotaion callouts marked with block-id in addition to appped newly-added ones, which may cause unexpected behavior. Make sure you have backup of your notes before enable this option."}),m("div",{className:"text-txt-accent",children:"\u24D8 Note: If you disable callout warpping in annotation template, you need to make sure the block-id is added properly in the template."}),m("div",{className:"text-txt-accent",children:"\u24D8 Note: This won't work on annotations imported before this feature is available, unless every annotation is inside a block with proper block-id"})]})})]})}var Pu=class extends Du{constructor(r){super(r.app,r);this.plugin=r;this.containerEl.addClass("obzt")}display(){super.display(),R.render(m(Ot.Provider,{value:{settings:this.plugin.settings,app:this.app,database:this.plugin.dbWorker,closeTab:()=>this.setting.close()},children:m(dee,{})}),this.containerEl),this.register(()=>R.unmountComponentAtNode(this.containerEl))}};function dee(){let[e,t]=Wh("obzt-setting-tab",{defaultValue:"general"});return m(qM,{value:e,onValueChange:t,className:"flex h-full flex-col",children:[m(sv,{className:"self-start max-w-full",children:[m(Wn,{value:"general",children:"General"}),m(Wn,{value:"connect",children:"Connect"}),m(Wn,{value:"suggester",children:"Suggester"}),m(Wn,{value:"template",children:"Template"}),m(Wn,{value:"update",children:"Note update"}),m(Wn,{value:"misc",children:"Misc"})]}),m(Hn,{value:"general",className:"divide-y flex-grow overflow-y-scroll",children:m(bv,{})}),m(Hn,{value:"connect",className:"divide-y flex-grow overflow-y-scroll",children:m(hv,{})}),m(Hn,{value:"suggester",className:"divide-y flex-grow overflow-y-scroll",children:m(wv,{})}),m(Hn,{value:"template",className:"divide-y flex-grow overflow-y-scroll",children:m(_v,{})}),m(Hn,{value:"update",className:"divide-y flex-grow overflow-y-scroll",children:m(Cv,{})}),m(Hn,{value:"misc",className:"divide-y flex-grow overflow-y-scroll",children:m(xv,{})})]})}var be=class extends cj.Plugin{use=Vo.plugin(this);constructor(t,r){if(super(t,r),!BC(r,t))throw new Error("Library check failed")}settings=g1(this);services={_log:this.use(na)};noteIndex=this.use(rs);server=this.use(Ur);citekeyClick=this.use(od);templateEditor=this.use(Li);noteFeatures=this.use(fM);noteParser=this.use(ud);get databaseAPI(){return this.dbWorker.api}dbWorker=this.use(Rt);imgCacheImporter=this.use(zn);dbWatcher=this.use(cn);database=this.use(Au);templateRenderer=this.use(Fn);pdfParser=this.use(Ou);onload(){W.info("loading ZotLit"),this.addSettingTab(new Pu(this)),globalThis.zoteroAPI={version:this.manifest.version,getDocItems:t=>this.databaseAPI.getItems(t),getItemIDsFromCitekey:(...t)=>this.databaseAPI.getItemIDsFromCitekey(...t),getAnnotsFromKeys:(...t)=>this.databaseAPI.getAnnotFromKey(...t),getAnnotsOfAtch:(...t)=>this.databaseAPI.getAnnotations(...t),getAttachments:(...t)=>this.databaseAPI.getAttachments(...t),getLibs:()=>this.databaseAPI.getLibs()},this.register(()=>{delete globalThis.zoteroAPI})}onunload(){W.info("unloading ZotLit")}};0&&(module.exports={});
/*! Bundled license information:
flatted/cjs/index.js:
(*! (c) 2020 Andrea Giammarchi *)
use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js:
(**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js:
(**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
lodash-es/lodash.js:
(**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
@mui/base/index.js:
(**
* @mui/base v5.0.0-alpha.122
*
* @license MIT
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
*/