@budibase/server 3.27.1 → 3.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ attempted value: ${s}
4
4
  `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(t,r){let n=t===void 0?t:this.transforms.reduce((i,s)=>s.call(this,i,t,this),t);return n===void 0&&(n=this.getDefault()),n}_validate(t,r={},n){let{sync:i,path:s,from:a=[],originalValue:u=t,strict:c=this.spec.strict,abortEarly:l=this.spec.abortEarly}=r,f=t;c||(f=this._cast(f,nu({assert:!1},r)));let d={value:f,path:s,options:r,originalValue:u,schema:this,label:this.spec.label,sync:i,from:a},p=[];this._typeError&&p.push(this._typeError),this._whitelistError&&p.push(this._whitelistError),this._blacklistError&&p.push(this._blacklistError),(0,vwe.default)({args:d,value:f,path:s,sync:i,tests:p,endEarly:l},m=>{if(m)return void n(m,f);(0,vwe.default)({tests:this.tests,args:d,path:s,sync:i,value:f,endEarly:l},n)})}validate(t,r,n){let i=this.resolve(nu({},r,{value:t}));return typeof n=="function"?i._validate(t,r,n):new Promise((s,a)=>i._validate(t,r,(u,c)=>{u?a(u):s(c)}))}validateSync(t,r){let n=this.resolve(nu({},r,{value:t})),i;return n._validate(t,nu({},r,{sync:!0}),(s,a)=>{if(s)throw s;i=a}),i}isValid(t,r){return this.validate(t,r).then(()=>!0,n=>{if(Twe.default.isError(n))return!1;throw n})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(n){if(Twe.default.isError(n))return!1;throw n}}_getDefault(){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this):(0,Ewe.default)(t)}getDefault(t){return this.resolve(t||{})._getDefault()}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){var r=this.clone();return r.spec.strict=t,r}_isPresent(t){return t!=null}defined(t=P_.mixed.defined){return this.test({message:t,name:"defined",exclusive:!0,test(r){return r!==void 0}})}required(t=P_.mixed.required){return this.clone({presence:"required"}).withMutation(r=>r.test({message:t,name:"required",exclusive:!0,test(n){return this.schema._isPresent(n)}}))}notRequired(){var t=this.clone({presence:"optional"});return t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t}nullable(t=!0){var r=this.clone({nullable:t!==!1});return r}transform(t){var r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=P_.mixed.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),i=(0,sk.default)(r),s=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(a=>!(a.OPTIONS.name===r.name&&(s||a.OPTIONS.test===i.OPTIONS.test))),n.tests.push(i),n}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let n=this.clone(),i=(0,hPt.default)(t).map(s=>new pPt.default(s));return i.forEach(s=>{s.isSibling&&n.deps.push(s.key)}),n.conditions.push(new dPt.default(i,r)),n}typeError(t){var r=this.clone();return r._typeError=(0,sk.default)({message:t,name:"typeError",test(n){return n!==void 0&&!this.schema.isType(n)?this.createError({params:{type:this.schema._type}}):!0}}),r}oneOf(t,r=P_.mixed.oneOf){var n=this.clone();return t.forEach(i=>{n._whitelist.add(i),n._blacklist.delete(i)}),n._whitelistError=(0,sk.default)({message:r,name:"oneOf",test(i){if(i===void 0)return!0;let s=this.schema._whitelist;return s.has(i,this.resolve)?!0:this.createError({params:{values:s.toArray().join(", ")}})}}),n}notOneOf(t,r=P_.mixed.notOneOf){var n=this.clone();return t.forEach(i=>{n._blacklist.add(i),n._whitelist.delete(i)}),n._blacklistError=(0,sk.default)({message:r,name:"notOneOf",test(i){let s=this.schema._blacklist;return s.has(i,this.resolve)?this.createError({params:{values:s.toArray().join(", ")}}):!0}}),n}strip(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(){let t=this.clone(),{label:r,meta:n}=t.spec;return{meta:n,label:r,type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(s=>({name:s.OPTIONS.name,params:s.OPTIONS.params})).filter((s,a,u)=>u.findIndex(c=>c.name===s.name)===a)}}};ak.default=nc;nc.prototype.__isYupSchema__=!0;for(let e of["validate","validateSync"])nc.prototype[`${e}At`]=function(t,r,n={}){let{parent:i,parentPath:s,schema:a}=(0,mPt.getIn)(this,t,r,n.context);return a[e](i&&i[s],nu({},n,{parent:i,path:t}))};for(let e of["equals","is"])nc.prototype[e]=nc.prototype.oneOf;for(let e of["not","nope"])nc.prototype[e]=nc.prototype.notOneOf;nc.prototype.optional=nc.prototype.notRequired});var Iwe=R(nA=>{"use strict";Object.defineProperty(nA,"__esModule",{value:!0});nA.create=Rwe;nA.default=void 0;var gPt=yPt(Uf());function yPt(e){return e&&e.__esModule?e:{default:e}}o(yPt,"_interopRequireDefault");var YG=gPt.default,bPt=YG;nA.default=bPt;function Rwe(){return new YG}o(Rwe,"create");Rwe.prototype=YG.prototype});var k_=R(uk=>{"use strict";Object.defineProperty(uk,"__esModule",{value:!0});uk.default=void 0;var _Pt=o(e=>e==null,"_default");uk.default=_Pt});var Pwe=R(oA=>{"use strict";Object.defineProperty(oA,"__esModule",{value:!0});oA.create=Dwe;oA.default=void 0;var wPt=Cwe(Uf()),Owe=Nf(),xwe=Cwe(k_());function Cwe(e){return e&&e.__esModule?e:{default:e}}o(Cwe,"_interopRequireDefault");function Dwe(){return new iA}o(Dwe,"create");var iA=class extends wPt.default{static{o(this,"BooleanSchema")}constructor(){super({type:"boolean"}),this.withMutation(()=>{this.transform(function(t){if(!this.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}_typeCheck(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}isTrue(t=Owe.boolean.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return(0,xwe.default)(r)||r===!0}})}isFalse(t=Owe.boolean.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return(0,xwe.default)(r)||r===!1}})}};oA.default=iA;Dwe.prototype=iA.prototype});var Lwe=R(aA=>{"use strict";Object.defineProperty(aA,"__esModule",{value:!0});aA.create=Nwe;aA.default=void 0;var ul=Nf(),Mf=kwe(k_()),EPt=kwe(Uf());function kwe(e){return e&&e.__esModule?e:{default:e}}o(kwe,"_interopRequireDefault");var vPt=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,SPt=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,TPt=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,APt=o(e=>(0,Mf.default)(e)||e===e.trim(),"isTrimmed"),RPt={}.toString();function Nwe(){return new sA}o(Nwe,"create");var sA=class extends EPt.default{static{o(this,"StringSchema")}constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(t){if(this.isType(t)||Array.isArray(t))return t;let r=t!=null&&t.toString?t.toString():t;return r===RPt?t:r})})}_typeCheck(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}_isPresent(t){return super._isPresent(t)&&!!t.length}length(t,r=ul.string.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},test(n){return(0,Mf.default)(n)||n.length===this.resolve(t)}})}min(t,r=ul.string.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},test(n){return(0,Mf.default)(n)||n.length>=this.resolve(t)}})}max(t,r=ul.string.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},test(n){return(0,Mf.default)(n)||n.length<=this.resolve(t)}})}matches(t,r){let n=!1,i,s;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:i,name:s}=r:i=r),this.test({name:s||"matches",message:i||ul.string.matches,params:{regex:t},test:a=>(0,Mf.default)(a)||a===""&&n||a.search(t)!==-1})}email(t=ul.string.email){return this.matches(vPt,{name:"email",message:t,excludeEmptyString:!0})}url(t=ul.string.url){return this.matches(SPt,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=ul.string.uuid){return this.matches(TPt,{name:"uuid",message:t,excludeEmptyString:!1})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=ul.string.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:APt})}lowercase(t=ul.string.lowercase){return this.transform(r=>(0,Mf.default)(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,test:r=>(0,Mf.default)(r)||r===r.toLowerCase()})}uppercase(t=ul.string.uppercase){return this.transform(r=>(0,Mf.default)(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,test:r=>(0,Mf.default)(r)||r===r.toUpperCase()})}};aA.default=sA;Nwe.prototype=sA.prototype});var Fwe=R(cA=>{"use strict";Object.defineProperty(cA,"__esModule",{value:!0});cA.create=Mwe;cA.default=void 0;var ng=Nf(),ig=Uwe(k_()),IPt=Uwe(Uf());function Uwe(e){return e&&e.__esModule?e:{default:e}}o(Uwe,"_interopRequireDefault");var OPt=o(e=>e!=+e,"isNaN");function Mwe(){return new uA}o(Mwe,"create");var uA=class extends IPt.default{static{o(this,"NumberSchema")}constructor(){super({type:"number"}),this.withMutation(()=>{this.transform(function(t){let r=t;if(typeof r=="string"){if(r=r.replace(/\s/g,""),r==="")return NaN;r=+r}return this.isType(r)?r:parseFloat(r)})})}_typeCheck(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!OPt(t)}min(t,r=ng.number.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},test(n){return(0,ig.default)(n)||n>=this.resolve(t)}})}max(t,r=ng.number.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},test(n){return(0,ig.default)(n)||n<=this.resolve(t)}})}lessThan(t,r=ng.number.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},test(n){return(0,ig.default)(n)||n<this.resolve(t)}})}moreThan(t,r=ng.number.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},test(n){return(0,ig.default)(n)||n>this.resolve(t)}})}positive(t=ng.number.positive){return this.moreThan(0,t)}negative(t=ng.number.negative){return this.lessThan(0,t)}integer(t=ng.number.integer){return this.test({name:"integer",message:t,test:r=>(0,ig.default)(r)||Number.isInteger(r)})}truncate(){return this.transform(t=>(0,ig.default)(t)?t:t|0)}round(t){var r,n=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(n.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(i=>(0,ig.default)(i)?i:Math[t](i))}};cA.default=uA;Mwe.prototype=uA.prototype});var Bwe=R(JG=>{"use strict";Object.defineProperty(JG,"__esModule",{value:!0});JG.default=CPt;var xPt=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function CPt(e){var t=[1,4,5,6,7,10,11],r=0,n,i;if(i=xPt.exec(e)){for(var s=0,a;a=t[s];++s)i[a]=+i[a]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,i[7]=i[7]?String(i[7]).substr(0,3):0,(i[8]===void 0||i[8]==="")&&(i[9]===void 0||i[9]==="")?n=+new Date(i[1],i[2],i[3],i[4],i[5],i[6],i[7]):(i[8]!=="Z"&&i[9]!==void 0&&(r=i[10]*60+i[11],i[9]==="+"&&(r=0-r)),n=Date.UTC(i[1],i[2],i[3],i[4],i[5]+r,i[6],i[7]))}else n=Date.parse?Date.parse(e):NaN;return n}o(CPt,"parseIsoDate")});var jwe=R(lA=>{"use strict";Object.defineProperty(lA,"__esModule",{value:!0});lA.create=ZG;lA.default=void 0;var DPt=ck(Bwe()),qwe=Nf(),Wwe=ck(k_()),PPt=ck(rg()),kPt=ck(Uf());function ck(e){return e&&e.__esModule?e:{default:e}}o(ck,"_interopRequireDefault");var XG=new Date(""),NPt=o(e=>Object.prototype.toString.call(e)==="[object Date]","isDate");function ZG(){return new N_}o(ZG,"create");var N_=class extends kPt.default{static{o(this,"DateSchema")}constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(t){return this.isType(t)?t:(t=(0,DPt.default)(t),isNaN(t)?XG:new Date(t))})})}_typeCheck(t){return NPt(t)&&!isNaN(t.getTime())}prepareParam(t,r){let n;if(PPt.default.isRef(t))n=t;else{let i=this.cast(t);if(!this._typeCheck(i))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(t,r=qwe.date.min){let n=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},test(i){return(0,Wwe.default)(i)||i>=this.resolve(n)}})}max(t,r=qwe.date.max){var n=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},test(i){return(0,Wwe.default)(i)||i<=this.resolve(n)}})}};lA.default=N_;N_.INVALID_DATE=XG;ZG.prototype=N_.prototype;ZG.INVALID_DATE=XG});var Vwe=R((jZr,eH)=>{"use strict";eH.exports=function(e){return $we(LPt(e),e)};eH.exports.array=$we;function $we(e,t){var r=e.length,n=new Array(r),i={},s=r,a=UPt(t),u=MPt(e);for(t.forEach(function(l){if(!u.has(l[0])||!u.has(l[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});s--;)i[s]||c(e[s],s,new Set);return n;function c(l,f,d){if(d.has(l)){var p;try{p=", node was:"+JSON.stringify(l)}catch{p=""}throw new Error("Cyclic dependency"+p)}if(!u.has(l))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(l));if(!i[f]){i[f]=!0;var m=a.get(l)||new Set;if(m=Array.from(m),f=m.length){d.add(l);do{var h=m[--f];c(h,u.get(h),d)}while(f);d.delete(l)}n[--r]=l}}}o($we,"toposort");function LPt(e){for(var t=new Set,r=0,n=e.length;r<n;r++){var i=e[r];t.add(i[0]),t.add(i[1])}return Array.from(t)}o(LPt,"uniqueNodes");function UPt(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var i=e[r];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}o(UPt,"makeOutgoingEdges");function MPt(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}o(MPt,"makeNodesHash")});var Gwe=R(tH=>{"use strict";Object.defineProperty(tH,"__esModule",{value:!0});tH.default=$Pt;var FPt=lk(require("lodash/has")),BPt=lk(Vwe()),qPt=ZT(),WPt=lk(rg()),jPt=lk(D_());function lk(e){return e&&e.__esModule?e:{default:e}}o(lk,"_interopRequireDefault");function $Pt(e,t=[]){let r=[],n=[];function i(s,a){var u=(0,qPt.split)(s)[0];~n.indexOf(u)||n.push(u),~t.indexOf(`${a}-${u}`)||r.push([a,u])}o(i,"addNode");for(let s in e)if((0,FPt.default)(e,s)){let a=e[s];~n.indexOf(s)||n.push(s),WPt.default.isRef(a)&&a.isSibling?i(a.path,s):(0,jPt.default)(a)&&"deps"in a&&a.deps.forEach(u=>i(u,s))}return BPt.default.array(n,r).reverse()}o($Pt,"sortFields")});var Kwe=R(rH=>{"use strict";Object.defineProperty(rH,"__esModule",{value:!0});rH.default=VPt;function Hwe(e,t){let r=1/0;return e.some((n,i)=>{var s;if(((s=t.path)==null?void 0:s.indexOf(n))!==-1)return r=i,!0}),r}o(Hwe,"findIndex");function VPt(e){return(t,r)=>Hwe(e,t)-Hwe(e,r)}o(VPt,"sortByKeyOrder")});var eEe=R(dA=>{"use strict";Object.defineProperty(dA,"__esModule",{value:!0});dA.create=Zwe;dA.default=void 0;var Qwe=cl(require("lodash/has")),zwe=cl(require("lodash/snakeCase")),GPt=cl(require("lodash/camelCase")),HPt=cl(require("lodash/mapKeys")),KPt=cl(require("lodash/mapValues")),QPt=ZT(),Ywe=Nf(),zPt=cl(Gwe()),Xwe=cl(Kwe()),YPt=cl(tk()),JPt=cl(eg()),nH=cl(Uf());function cl(e){return e&&e.__esModule?e:{default:e}}o(cl,"_interopRequireDefault");function L_(){return L_=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},L_.apply(this,arguments)}o(L_,"_extends");var Jwe=o(e=>Object.prototype.toString.call(e)==="[object Object]","isObject");function XPt(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(n=>r.indexOf(n)===-1)}o(XPt,"unknown");var ZPt=(0,Xwe.default)([]),fA=class extends nH.default{static{o(this,"ObjectSchema")}constructor(t){super({type:"object"}),this.fields=Object.create(null),this._sortErrors=ZPt,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{this.transform(o(function(n){if(typeof n=="string")try{n=JSON.parse(n)}catch{n=null}return this.isType(n)?n:null},"coerce")),t&&this.shape(t)})}_typeCheck(t){return Jwe(t)||typeof t=="function"}_cast(t,r={}){var n;let i=super._cast(t,r);if(i===void 0)return this.getDefault();if(!this._typeCheck(i))return i;let s=this.fields,a=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,u=this._nodes.concat(Object.keys(i).filter(d=>this._nodes.indexOf(d)===-1)),c={},l=L_({},r,{parent:c,__validating:r.__validating||!1}),f=!1;for(let d of u){let p=s[d],m=(0,Qwe.default)(i,d);if(p){let h,g=i[d];l.path=(r.path?`${r.path}.`:"")+d,p=p.resolve({value:g,context:r.context,parent:c});let b="spec"in p?p.spec:void 0,w=b?.strict;if(b?.strip){f=f||d in i;continue}h=!r.__validating||!w?p.cast(i[d],l):i[d],h!==void 0&&(c[d]=h)}else m&&!a&&(c[d]=i[d]);c[d]!==i[d]&&(f=!0)}return f?c:i}_validate(t,r={},n){let i=[],{sync:s,from:a=[],originalValue:u=t,abortEarly:c=this.spec.abortEarly,recursive:l=this.spec.recursive}=r;a=[{schema:this,value:u},...a],r.__validating=!0,r.originalValue=u,r.from=a,super._validate(t,r,(f,d)=>{if(f){if(!JPt.default.isError(f)||c)return void n(f,d);i.push(f)}if(!l||!Jwe(d)){n(i[0]||null,d);return}u=u||d;let p=this._nodes.map(m=>(h,g)=>{let b=m.indexOf(".")===-1?(r.path?`${r.path}.`:"")+m:`${r.path||""}["${m}"]`,w=this.fields[m];if(w&&"validate"in w){w.validate(d[m],L_({},r,{path:b,from:a,strict:!0,parent:d,originalValue:u[m]}),g);return}g(null)});(0,YPt.default)({sync:s,tests:p,value:d,errors:i,endEarly:c,sort:this._sortErrors,path:r.path},n)})}clone(t){let r=super.clone(t);return r.fields=L_({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),n=r.fields;for(let[i,s]of Object.entries(this.fields)){let a=n[i];a===void 0?n[i]=s:a instanceof nH.default&&s instanceof nH.default&&(n[i]=s.concat(a))}return r.withMutation(()=>r.shape(n))}getDefaultFromShape(){let t={};return this._nodes.forEach(r=>{let n=this.fields[r];t[r]="default"in n?n.getDefault():void 0}),t}_getDefault(){if("default"in this.spec)return super._getDefault();if(this._nodes.length)return this.getDefaultFromShape()}shape(t,r=[]){let n=this.clone(),i=Object.assign(n.fields,t);if(n.fields=i,n._sortErrors=(0,Xwe.default)(Object.keys(i)),r.length){Array.isArray(r[0])||(r=[r]);let s=r.map(([a,u])=>`${a}-${u}`);n._excludedEdges=n._excludedEdges.concat(s)}return n._nodes=(0,zPt.default)(i,n._excludedEdges),n}pick(t){let r={};for(let n of t)this.fields[n]&&(r[n]=this.fields[n]);return this.clone().withMutation(n=>(n.fields={},n.shape(r)))}omit(t){let r=this.clone(),n=r.fields;r.fields={};for(let i of t)delete n[i];return r.withMutation(()=>r.shape(n))}from(t,r,n){let i=(0,QPt.getter)(t,!0);return this.transform(s=>{if(s==null)return s;let a=s;return(0,Qwe.default)(s,t)&&(a=L_({},s),n||delete a[t],a[r]=i(s)),a})}noUnknown(t=!0,r=Ywe.object.noUnknown){typeof t=="string"&&(r=t,t=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(i){if(i==null)return!0;let s=XPt(this.schema,i);return!t||s.length===0||this.createError({params:{unknown:s.join(", ")}})}});return n.spec.noUnknown=t,n}unknown(t=!0,r=Ywe.object.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>r&&(0,HPt.default)(r,(n,i)=>t(i)))}camelCase(){return this.transformKeys(GPt.default)}snakeCase(){return this.transformKeys(zwe.default)}constantCase(){return this.transformKeys(t=>(0,zwe.default)(t).toUpperCase())}describe(){let t=super.describe();return t.fields=(0,KPt.default)(this.fields,r=>r.describe()),t}};dA.default=fA;function Zwe(e){return new fA(e)}o(Zwe,"create");Zwe.prototype=fA.prototype});var rEe=R(mA=>{"use strict";Object.defineProperty(mA,"__esModule",{value:!0});mA.create=tEe;mA.default=void 0;var iH=U_(k_()),ekt=U_(D_()),tkt=U_(XT()),oH=Nf(),rkt=U_(tk()),nkt=U_(eg()),ikt=U_(Uf());function U_(e){return e&&e.__esModule?e:{default:e}}o(U_,"_interopRequireDefault");function fk(){return fk=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},fk.apply(this,arguments)}o(fk,"_extends");function tEe(e){return new pA(e)}o(tEe,"create");var pA=class extends ikt.default{static{o(this,"ArraySchema")}constructor(t){super({type:"array"}),this.innerType=t,this.withMutation(()=>{this.transform(function(r){if(typeof r=="string")try{r=JSON.parse(r)}catch{r=null}return this.isType(r)?r:null})})}_typeCheck(t){return Array.isArray(t)}get _subType(){return this.innerType}_cast(t,r){let n=super._cast(t,r);if(!this._typeCheck(n)||!this.innerType)return n;let i=!1,s=n.map((a,u)=>{let c=this.innerType.cast(a,fk({},r,{path:`${r.path||""}[${u}]`}));return c!==a&&(i=!0),c});return i?s:n}_validate(t,r={},n){var i,s;let a=[],u=r.sync,c=r.path,l=this.innerType,f=(i=r.abortEarly)!=null?i:this.spec.abortEarly,d=(s=r.recursive)!=null?s:this.spec.recursive,p=r.originalValue!=null?r.originalValue:t;super._validate(t,r,(m,h)=>{if(m){if(!nkt.default.isError(m)||f)return void n(m,h);a.push(m)}if(!d||!l||!this._typeCheck(h)){n(a[0]||null,h);return}p=p||h;let g=new Array(h.length);for(let b=0;b<h.length;b++){let w=h[b],E=`${r.path||""}[${b}]`,v=fk({},r,{path:E,strict:!0,parent:h,index:b,originalValue:p[b]});g[b]=(S,T)=>l.validate(w,v,T)}(0,rkt.default)({sync:u,path:c,value:h,errors:a,endEarly:f,tests:g},n)})}clone(t){let r=super.clone(t);return r.innerType=this.innerType,r}concat(t){let r=super.concat(t);return r.innerType=this.innerType,t.innerType&&(r.innerType=r.innerType?r.innerType.concat(t.innerType):t.innerType),r}of(t){let r=this.clone();if(!(0,ekt.default)(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+(0,tkt.default)(t));return r.innerType=t,r}length(t,r=oH.array.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},test(n){return(0,iH.default)(n)||n.length===this.resolve(t)}})}min(t,r){return r=r||oH.array.min,this.test({message:r,name:"min",exclusive:!0,params:{min:t},test(n){return(0,iH.default)(n)||n.length>=this.resolve(t)}})}max(t,r){return r=r||oH.array.max,this.test({message:r,name:"max",exclusive:!0,params:{max:t},test(n){return(0,iH.default)(n)||n.length<=this.resolve(t)}})}ensure(){return this.default(()=>[]).transform((t,r)=>this._typeCheck(t)?t:r==null?[]:[].concat(r))}compact(t){let r=t?(n,i,s)=>!t(n,i,s):n=>!!n;return this.transform(n=>n!=null?n.filter(r):n)}describe(){let t=super.describe();return this.innerType&&(t.innerType=this.innerType.describe()),t}nullable(t=!0){return super.nullable(t)}defined(){return super.defined()}required(t){return super.required(t)}};mA.default=pA;tEe.prototype=pA.prototype});var nEe=R(hA=>{"use strict";Object.defineProperty(hA,"__esModule",{value:!0});hA.create=akt;hA.default=void 0;var okt=skt(D_());function skt(e){return e&&e.__esModule?e:{default:e}}o(skt,"_interopRequireDefault");function akt(e){return new dk(e)}o(akt,"create");var dk=class{static{o(this,"Lazy")}constructor(t){this.type="lazy",this.__isYupSchema__=!0,this._resolve=(r,n={})=>{let i=this.builder(r,n);if(!(0,okt.default)(i))throw new TypeError("lazy() functions must return a valid schema");return i.resolve(n)},this.builder=t}resolve(t){return this._resolve(t.value,t)}cast(t,r){return this._resolve(t,r).cast(t,r)}validate(t,r,n){return this._resolve(t,r).validate(t,r,n)}validateSync(t,r){return this._resolve(t,r).validateSync(t,r)}validateAt(t,r,n){return this._resolve(r,n).validateAt(t,r,n)}validateSyncAt(t,r,n){return this._resolve(r,n).validateSyncAt(t,r,n)}describe(){return null}isValid(t,r){return this._resolve(t,r).isValid(t,r)}isValidSync(t,r){return this._resolve(t,r).isValidSync(t,r)}},ukt=dk;hA.default=ukt});var iEe=R(sH=>{"use strict";Object.defineProperty(sH,"__esModule",{value:!0});sH.default=fkt;var ckt=lkt(Nf());function lkt(e){return e&&e.__esModule?e:{default:e}}o(lkt,"_interopRequireDefault");function fkt(e){Object.keys(e).forEach(t=>{Object.keys(e[t]).forEach(r=>{ckt.default[t][r]=e[t][r]})})}o(fkt,"setLocale")});var uH=R(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.addMethod=bkt;Object.defineProperty(Jr,"MixedSchema",{enumerable:!0,get:function(){return oEe.default}});Object.defineProperty(Jr,"mixed",{enumerable:!0,get:function(){return oEe.create}});Object.defineProperty(Jr,"BooleanSchema",{enumerable:!0,get:function(){return aH.default}});Object.defineProperty(Jr,"bool",{enumerable:!0,get:function(){return aH.create}});Object.defineProperty(Jr,"boolean",{enumerable:!0,get:function(){return aH.create}});Object.defineProperty(Jr,"StringSchema",{enumerable:!0,get:function(){return sEe.default}});Object.defineProperty(Jr,"string",{enumerable:!0,get:function(){return sEe.create}});Object.defineProperty(Jr,"NumberSchema",{enumerable:!0,get:function(){return aEe.default}});Object.defineProperty(Jr,"number",{enumerable:!0,get:function(){return aEe.create}});Object.defineProperty(Jr,"DateSchema",{enumerable:!0,get:function(){return uEe.default}});Object.defineProperty(Jr,"date",{enumerable:!0,get:function(){return uEe.create}});Object.defineProperty(Jr,"ObjectSchema",{enumerable:!0,get:function(){return cEe.default}});Object.defineProperty(Jr,"object",{enumerable:!0,get:function(){return cEe.create}});Object.defineProperty(Jr,"ArraySchema",{enumerable:!0,get:function(){return lEe.default}});Object.defineProperty(Jr,"array",{enumerable:!0,get:function(){return lEe.create}});Object.defineProperty(Jr,"ref",{enumerable:!0,get:function(){return dkt.create}});Object.defineProperty(Jr,"lazy",{enumerable:!0,get:function(){return pkt.create}});Object.defineProperty(Jr,"ValidationError",{enumerable:!0,get:function(){return mkt.default}});Object.defineProperty(Jr,"reach",{enumerable:!0,get:function(){return hkt.default}});Object.defineProperty(Jr,"isSchema",{enumerable:!0,get:function(){return fEe.default}});Object.defineProperty(Jr,"setLocale",{enumerable:!0,get:function(){return gkt.default}});Object.defineProperty(Jr,"BaseSchema",{enumerable:!0,get:function(){return ykt.default}});var oEe=og(Iwe()),aH=og(Pwe()),sEe=og(Lwe()),aEe=og(Fwe()),uEe=og(jwe()),cEe=og(eEe()),lEe=og(rEe()),dkt=rg(),pkt=nEe(),mkt=gA(eg()),hkt=gA(QG()),fEe=gA(D_()),gkt=gA(iEe()),ykt=gA(Uf());function gA(e){return e&&e.__esModule?e:{default:e}}o(gA,"_interopRequireDefault");function dEe(){if(typeof WeakMap!="function")return null;var e=new WeakMap;return dEe=o(function(){return e},"_getRequireWildcardCache"),e}o(dEe,"_getRequireWildcardCache");function og(e){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var t=dEe();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var s=n?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,t&&t.set(e,r),r}o(og,"_interopRequireWildcard");function bkt(e,t,r){if(!e||!(0,fEe.default)(e.prototype))throw new TypeError("You must provide a yup schema constructor function");if(typeof t!="string")throw new TypeError("A Method name must be provided");if(typeof r!="function")throw new TypeError("Method function must be provided");e.prototype[t]=r}o(bkt,"addMethod")});var pEe=R(lH=>{"use strict";Object.defineProperty(lH,"__esModule",{value:!0});var cH=fH();lH.default=()=>{(0,cH.registerOptionPreset)("npm-node-cron",{presetId:"npm-node-cron",useSeconds:!0,useYears:!1,useAliases:!0,useBlankDay:!1,allowOnlyOneBlankDayField:!1,mustHaveBlankDayField:!1,useLastDayOfMonth:!1,useLastDayOfWeek:!1,useNearestWeekday:!1,useNthWeekdayOfMonth:!1,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:1,maxValue:31},months:{minValue:0,maxValue:11},daysOfWeek:{minValue:0,maxValue:6},years:{minValue:1970,maxValue:2099}}),(0,cH.registerOptionPreset)("aws-cloud-watch",{presetId:"aws-cloud-watch",useSeconds:!1,useYears:!0,useAliases:!0,useBlankDay:!0,allowOnlyOneBlankDayField:!0,mustHaveBlankDayField:!0,useLastDayOfMonth:!0,useLastDayOfWeek:!0,useNearestWeekday:!0,useNthWeekdayOfMonth:!0,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:1,maxValue:31},months:{minValue:1,maxValue:12},daysOfWeek:{minValue:1,maxValue:7},years:{minValue:1970,maxValue:2199}}),(0,cH.registerOptionPreset)("npm-cron-schedule",{presetId:"npm-cron-schedule",useSeconds:!0,useYears:!1,useAliases:!0,useBlankDay:!1,allowOnlyOneBlankDayField:!1,mustHaveBlankDayField:!1,useLastDayOfMonth:!1,useLastDayOfWeek:!1,useNearestWeekday:!1,useNthWeekdayOfMonth:!1,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:1,maxValue:31},months:{minValue:1,maxValue:12},daysOfWeek:{minValue:0,maxValue:7},years:{minValue:1970,maxValue:2099}})}});var fH=R(qi=>{"use strict";var _kt=qi&&qi.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),wkt=qi&&qi.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ekt=qi&&qi.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_kt(t,e,r);return wkt(t,e),t},vkt=qi&&qi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qi,"__esModule",{value:!0});qi.validateOptions=qi.registerOptionPreset=qi.getOptionPresets=qi.getOptionPreset=void 0;var Ie=Ekt(uH());uH();var yA=tc(),Skt=vkt(pEe());rc();var sg={default:{presetId:"default",useSeconds:!1,useYears:!1,useAliases:!1,useBlankDay:!1,allowOnlyOneBlankDayField:!1,mustHaveBlankDayField:!1,useLastDayOfMonth:!1,useLastDayOfWeek:!1,useNearestWeekday:!1,useNthWeekdayOfMonth:!1,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:0,maxValue:31},months:{minValue:0,maxValue:12},daysOfWeek:{minValue:0,maxValue:7},years:{minValue:1970,maxValue:2099}}},mEe=Ie.object({presetId:Ie.string().required(),useSeconds:Ie.boolean().required(),useYears:Ie.boolean().required(),useAliases:Ie.boolean(),useBlankDay:Ie.boolean().required(),allowOnlyOneBlankDayField:Ie.boolean().required(),mustHaveBlankDayField:Ie.boolean(),useLastDayOfMonth:Ie.boolean(),useLastDayOfWeek:Ie.boolean(),useNearestWeekday:Ie.boolean(),useNthWeekdayOfMonth:Ie.boolean(),seconds:Ie.object({minValue:Ie.number().min(0).required(),maxValue:Ie.number().min(0).required(),lowerLimit:Ie.number().min(0),upperLimit:Ie.number().min(0)}).required(),minutes:Ie.object({minValue:Ie.number().min(0).required(),maxValue:Ie.number().min(0).required(),lowerLimit:Ie.number().min(0),upperLimit:Ie.number().min(0)}).required(),hours:Ie.object({minValue:Ie.number().min(0).required(),maxValue:Ie.number().min(0).required(),lowerLimit:Ie.number().min(0),upperLimit:Ie.number().min(0)}).required(),daysOfMonth:Ie.object({minValue:Ie.number().min(0).required(),maxValue:Ie.number().min(0).required(),lowerLimit:Ie.number().min(0),upperLimit:Ie.number().min(0)}).required(),months:Ie.object({minValue:Ie.number().min(0).required(),maxValue:Ie.number().min(0).required(),lowerLimit:Ie.number().min(0),upperLimit:Ie.number().min(0)}).required(),daysOfWeek:Ie.object({minValue:Ie.number().min(0).required(),maxValue:Ie.number().min(0).required(),lowerLimit:Ie.number().min(0),upperLimit:Ie.number().min(0)}).required(),years:Ie.object({minValue:Ie.number().min(0).required(),maxValue:Ie.number().min(0).required(),lowerLimit:Ie.number().min(0),upperLimit:Ie.number().min(0)}).required()}).required(),Tkt=o(e=>sg[e]?(0,yA.valid)(sg[e]):(0,yA.err)(`Option preset '${e}' not found.`),"getOptionPreset");qi.getOptionPreset=Tkt;var Akt=o(()=>sg,"getOptionPresets");qi.getOptionPresets=Akt;var Rkt=o((e,t)=>{sg[e]=mEe.validateSync(t,{strict:!1,abortEarly:!1,stripUnknown:!0,recursive:!0})},"registerOptionPreset");qi.registerOptionPreset=Rkt;var Ikt=o(e=>{var t,r,n,i,s,a,u,c,l,f,d,p,m,h,g,b,w,E,v,S;try{(0,Skt.default)();let T;if(e.preset)if(typeof e.preset=="string"){if(!sg[e.preset])return(0,yA.err)([`Option preset ${e.preset} does not exist.`]);T=sg[e.preset]}else T=e.preset;else T=sg.default;let x=Object.assign(Object.assign({presetId:T.presetId,preset:T},{useSeconds:T.useSeconds,useYears:T.useYears,useAliases:(t=T.useAliases)!==null&&t!==void 0?t:!1,useBlankDay:T.useBlankDay,allowOnlyOneBlankDayField:T.allowOnlyOneBlankDayField,mustHaveBlankDayField:(r=T.mustHaveBlankDayField)!==null&&r!==void 0?r:!1,useLastDayOfMonth:(n=T.useLastDayOfMonth)!==null&&n!==void 0?n:!1,useLastDayOfWeek:(i=T.useLastDayOfWeek)!==null&&i!==void 0?i:!1,useNearestWeekday:(s=T.useNearestWeekday)!==null&&s!==void 0?s:!1,useNthWeekdayOfMonth:(a=T.useNthWeekdayOfMonth)!==null&&a!==void 0?a:!1,seconds:{lowerLimit:(u=T.seconds.lowerLimit)!==null&&u!==void 0?u:T.seconds.minValue,upperLimit:(c=T.seconds.upperLimit)!==null&&c!==void 0?c:T.seconds.maxValue},minutes:{lowerLimit:(l=T.minutes.lowerLimit)!==null&&l!==void 0?l:T.minutes.minValue,upperLimit:(f=T.minutes.upperLimit)!==null&&f!==void 0?f:T.minutes.maxValue},hours:{lowerLimit:(d=T.hours.lowerLimit)!==null&&d!==void 0?d:T.hours.minValue,upperLimit:(p=T.hours.upperLimit)!==null&&p!==void 0?p:T.hours.maxValue},daysOfMonth:{lowerLimit:(m=T.daysOfMonth.lowerLimit)!==null&&m!==void 0?m:T.daysOfMonth.minValue,upperLimit:(h=T.daysOfMonth.upperLimit)!==null&&h!==void 0?h:T.daysOfMonth.maxValue},months:{lowerLimit:(g=T.months.lowerLimit)!==null&&g!==void 0?g:T.months.minValue,upperLimit:(b=T.months.upperLimit)!==null&&b!==void 0?b:T.months.maxValue},daysOfWeek:{lowerLimit:(w=T.daysOfWeek.lowerLimit)!==null&&w!==void 0?w:T.daysOfWeek.minValue,upperLimit:(E=T.daysOfWeek.upperLimit)!==null&&E!==void 0?E:T.daysOfWeek.maxValue},years:{lowerLimit:(v=T.years.lowerLimit)!==null&&v!==void 0?v:T.years.minValue,upperLimit:(S=T.years.upperLimit)!==null&&S!==void 0?S:T.years.maxValue}}),e.override),C=Ie.object({presetId:Ie.string().required(),preset:mEe.required(),useSeconds:Ie.boolean().required(),useYears:Ie.boolean().required(),useAliases:Ie.boolean(),useBlankDay:Ie.boolean().required(),allowOnlyOneBlankDayField:Ie.boolean().required(),mustHaveBlankDayField:Ie.boolean(),useLastDayOfMonth:Ie.boolean(),useLastDayOfWeek:Ie.boolean(),useNearestWeekday:Ie.boolean(),useNthWeekdayOfMonth:Ie.boolean(),seconds:Ie.object({lowerLimit:Ie.number().min(T.seconds.minValue).max(T.seconds.maxValue),upperLimit:Ie.number().min(T.seconds.minValue).max(T.seconds.maxValue)}).required(),minutes:Ie.object({lowerLimit:Ie.number().min(T.minutes.minValue).max(T.minutes.maxValue),upperLimit:Ie.number().min(T.minutes.minValue).max(T.minutes.maxValue)}).required(),hours:Ie.object({lowerLimit:Ie.number().min(T.hours.minValue).max(T.hours.maxValue),upperLimit:Ie.number().min(T.hours.minValue).max(T.hours.maxValue)}).required(),daysOfMonth:Ie.object({lowerLimit:Ie.number().min(T.daysOfMonth.minValue).max(T.daysOfMonth.maxValue),upperLimit:Ie.number().min(T.daysOfMonth.minValue).max(T.daysOfMonth.maxValue)}).required(),months:Ie.object({lowerLimit:Ie.number().min(T.months.minValue).max(T.months.maxValue),upperLimit:Ie.number().min(T.months.minValue).max(T.months.maxValue)}).required(),daysOfWeek:Ie.object({lowerLimit:Ie.number().min(T.daysOfWeek.minValue).max(T.daysOfWeek.maxValue),upperLimit:Ie.number().min(T.daysOfWeek.minValue).max(T.daysOfWeek.maxValue)}).required(),years:Ie.object({lowerLimit:Ie.number().min(T.years.minValue).max(T.years.maxValue),upperLimit:Ie.number().min(T.years.minValue).max(T.years.maxValue)}).required()}).required().validateSync(x,{strict:!1,abortEarly:!1,stripUnknown:!0,recursive:!0});return(0,yA.valid)(C)}catch(T){return(0,yA.err)(T.errors)}},"validateOptions");qi.validateOptions=Ikt});var al=R((bA,pH)=>{"use strict";var ug=bA&&bA.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(bA,"__esModule",{value:!0});var ag=tc(),Okt=ug($_e()),xkt=ug(V_e()),Ckt=ug(G_e()),Dkt=ug(H_e()),Pkt=ug(K_e()),kkt=ug(Q_e()),Nkt=ug(z_e()),Lkt=fH();rc();var Ukt=o((e,t)=>{let r=e.trim().split(" ");if(t.useSeconds&&t.useYears&&r.length!==7)return(0,ag.err)(`Expected 7 values, but got ${r.length}.`);if((t.useSeconds&&!t.useYears||t.useYears&&!t.useSeconds)&&r.length!==6)return(0,ag.err)(`Expected 6 values, but got ${r.length}.`);if(!t.useSeconds&&!t.useYears&&r.length!==5)return(0,ag.err)(`Expected 5 values, but got ${r.length}.`);let n={seconds:t.useSeconds?r[0]:void 0,minutes:r[t.useSeconds?1:0],hours:r[t.useSeconds?2:1],daysOfMonth:r[t.useSeconds?3:2],months:r[t.useSeconds?4:3],daysOfWeek:r[t.useSeconds?5:4],years:t.useYears?r[t.useSeconds?6:5]:void 0};return(0,ag.valid)(n)},"splitCronString"),dH=o((e,t={})=>{let r=(0,Lkt.validateOptions)(t);if(r.isError())return r;let n=r.getValue(),i=Ukt(e,n);if(i.isError())return(0,ag.err)([`${i.getError()} (Input cron: '${e}')`]);let s=i.getValue(),a=[];if(n.useSeconds&&a.push((0,Okt.default)(s,n)),a.push((0,xkt.default)(s,n)),a.push((0,Ckt.default)(s,n)),a.push((0,Dkt.default)(s,n)),a.push((0,Pkt.default)(s,n)),a.push((0,kkt.default)(s,n)),n.useYears&&a.push((0,Nkt.default)(s,n)),a.every(c=>c.isValid()))return(0,ag.valid)(s);let u=[];return a.forEach(c=>{c.isError()&&c.getError().forEach(l=>{u.push(l)})}),u.forEach((c,l)=>{u[l]=`${c} (Input cron: '${e}')`}),(0,ag.err)(u)},"cron");bA.default=dH;pH.exports=dH;pH.exports.default=dH});var Vve=R(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var Bf=class extends Error{static{o(this,"LuxonError")}},SH=class extends Bf{static{o(this,"InvalidDateTimeError")}constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}},TH=class extends Bf{static{o(this,"InvalidIntervalError")}constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}},AH=class extends Bf{static{o(this,"InvalidDurationError")}constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}},Dp=class extends Bf{static{o(this,"ConflictingSpecificationError")}},wk=class extends Bf{static{o(this,"InvalidUnitError")}constructor(t){super(`Invalid unit ${t}`)}},Wi=class extends Bf{static{o(this,"InvalidArgumentError")}},ll=class extends Bf{static{o(this,"ZoneIsAbstractError")}constructor(){super("Zone is an abstract class")}},ke="numeric",ac="short",la="long",Ek={year:ke,month:ke,day:ke},GEe={year:ke,month:ac,day:ke},Mkt={year:ke,month:ac,day:ke,weekday:ac},HEe={year:ke,month:la,day:ke},KEe={year:ke,month:la,day:ke,weekday:la},QEe={hour:ke,minute:ke},zEe={hour:ke,minute:ke,second:ke},YEe={hour:ke,minute:ke,second:ke,timeZoneName:ac},JEe={hour:ke,minute:ke,second:ke,timeZoneName:la},XEe={hour:ke,minute:ke,hourCycle:"h23"},ZEe={hour:ke,minute:ke,second:ke,hourCycle:"h23"},eve={hour:ke,minute:ke,second:ke,hourCycle:"h23",timeZoneName:ac},tve={hour:ke,minute:ke,second:ke,hourCycle:"h23",timeZoneName:la},rve={year:ke,month:ke,day:ke,hour:ke,minute:ke},nve={year:ke,month:ke,day:ke,hour:ke,minute:ke,second:ke},ive={year:ke,month:ac,day:ke,hour:ke,minute:ke},ove={year:ke,month:ac,day:ke,hour:ke,minute:ke,second:ke},Fkt={year:ke,month:ac,day:ke,weekday:ac,hour:ke,minute:ke},sve={year:ke,month:la,day:ke,hour:ke,minute:ke,timeZoneName:ac},ave={year:ke,month:la,day:ke,hour:ke,minute:ke,second:ke,timeZoneName:ac},uve={year:ke,month:la,day:ke,weekday:la,hour:ke,minute:ke,timeZoneName:la},cve={year:ke,month:la,day:ke,weekday:la,hour:ke,minute:ke,second:ke,timeZoneName:la},kp=class{static{o(this,"Zone")}get type(){throw new ll}get name(){throw new ll}get ianaName(){return this.name}get isUniversal(){throw new ll}offsetName(t,r){throw new ll}formatOffset(t,r){throw new ll}offset(t){throw new ll}equals(t){throw new ll}get isValid(){throw new ll}},mH=null,TA=class e extends kp{static{o(this,"SystemZone")}static get instance(){return mH===null&&(mH=new e),mH}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return wve(t,r,n)}formatOffset(t,r){return SA(this.offset(t),r)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}},RH=new Map;function Bkt(e){let t=RH.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),RH.set(e,t)),t}o(Bkt,"makeDTF");var qkt={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Wkt(e,t){let r=e.format(t).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,i,s,a,u,c,l,f]=n;return[a,i,s,u,c,l,f]}o(Wkt,"hackyOffset");function jkt(e,t){let r=e.formatToParts(t),n=[];for(let i=0;i<r.length;i++){let{type:s,value:a}=r[i],u=qkt[s];s==="era"?n[u]=a:lt(u)||(n[u]=parseInt(a,10))}return n}o(jkt,"partsOffset");var hH=new Map,qf=class e extends kp{static{o(this,"IANAZone")}static create(t){let r=hH.get(t);return r===void 0&&hH.set(t,r=new e(t)),r}static resetCache(){hH.clear(),RH.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:r,locale:n}){return wve(t,r,n,this.name)}formatOffset(t,r){return SA(this.offset(t),r)}offset(t){if(!this.valid)return NaN;let r=new Date(t);if(isNaN(r))return NaN;let n=Bkt(this.name),[i,s,a,u,c,l,f]=n.formatToParts?jkt(n,r):Wkt(n,r);u==="BC"&&(i=-Math.abs(i)+1);let p=Ok({year:i,month:s,day:a,hour:c===24?0:c,minute:l,second:f,millisecond:0}),m=+r,h=m%1e3;return m-=h>=0?h:1e3+h,(p-m)/(60*1e3)}equals(t){return t.type==="iana"&&t.name===this.name}get isValid(){return this.valid}},hEe={};function $kt(e,t={}){let r=JSON.stringify([e,t]),n=hEe[r];return n||(n=new Intl.ListFormat(e,t),hEe[r]=n),n}o($kt,"getCachedLF");var IH=new Map;function OH(e,t={}){let r=JSON.stringify([e,t]),n=IH.get(r);return n===void 0&&(n=new Intl.DateTimeFormat(e,t),IH.set(r,n)),n}o(OH,"getCachedDTF");var xH=new Map;function Vkt(e,t={}){let r=JSON.stringify([e,t]),n=xH.get(r);return n===void 0&&(n=new Intl.NumberFormat(e,t),xH.set(r,n)),n}o(Vkt,"getCachedINF");var CH=new Map;function Gkt(e,t={}){let{base:r,...n}=t,i=JSON.stringify([e,n]),s=CH.get(i);return s===void 0&&(s=new Intl.RelativeTimeFormat(e,t),CH.set(i,s)),s}o(Gkt,"getCachedRTF");var wA=null;function Hkt(){return wA||(wA=new Intl.DateTimeFormat().resolvedOptions().locale,wA)}o(Hkt,"systemLocale");var DH=new Map;function lve(e){let t=DH.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),DH.set(e,t)),t}o(lve,"getCachedIntResolvedOptions");var PH=new Map;function Kkt(e){let t=PH.get(e);if(!t){let r=new Intl.Locale(e);t="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,"minimalDays"in t||(t={...fve,...t}),PH.set(e,t)}return t}o(Kkt,"getCachedWeekInfo");function Qkt(e){let t=e.indexOf("-x-");t!==-1&&(e=e.substring(0,t));let r=e.indexOf("-u-");if(r===-1)return[e];{let n,i;try{n=OH(e).resolvedOptions(),i=e}catch{let c=e.substring(0,r);n=OH(c).resolvedOptions(),i=c}let{numberingSystem:s,calendar:a}=n;return[i,s,a]}}o(Qkt,"parseLocaleString");function zkt(e,t,r){return(r||t)&&(e.includes("-u-")||(e+="-u"),r&&(e+=`-ca-${r}`),t&&(e+=`-nu-${t}`)),e}o(zkt,"intlConfigString");function Ykt(e){let t=[];for(let r=1;r<=12;r++){let n=pn.utc(2009,r,1);t.push(e(n))}return t}o(Ykt,"mapMonths");function Jkt(e){let t=[];for(let r=1;r<=7;r++){let n=pn.utc(2016,11,13+r);t.push(e(n))}return t}o(Jkt,"mapWeekdays");function pk(e,t,r,n){let i=e.listingMode();return i==="error"?null:i==="en"?r(t):n(t)}o(pk,"listStuff");function Xkt(e){return e.numberingSystem&&e.numberingSystem!=="latn"?!1:e.numberingSystem==="latn"||!e.locale||e.locale.startsWith("en")||lve(e.locale).numberingSystem==="latn"}o(Xkt,"supportsFastNumbers");var kH=class{static{o(this,"PolyNumberFormatter")}constructor(t,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:i,floor:s,...a}=n;if(!r||Object.keys(a).length>0){let u={useGrouping:!1,...n};n.padTo>0&&(u.minimumIntegerDigits=n.padTo),this.inf=Vkt(t,u)}}format(t){if(this.inf){let r=this.floor?Math.floor(t):t;return this.inf.format(r)}else{let r=this.floor?Math.floor(t):VH(t,3);return ui(r,this.padTo)}}},NH=class{static{o(this,"PolyDateFormatter")}constructor(t,r,n){this.opts=n,this.originalZone=void 0;let i;if(this.opts.timeZone)this.dt=t;else if(t.zone.type==="fixed"){let a=-1*(t.offset/60),u=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;t.offset!==0&&qf.create(u).valid?(i=u,this.dt=t):(i="UTC",this.dt=t.offset===0?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else t.zone.type==="system"?this.dt=t:t.zone.type==="iana"?(this.dt=t,i=t.zone.name):(i="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);let s={...this.opts};s.timeZone=s.timeZone||i,this.dtf=OH(r,s)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):t}resolvedOptions(){return this.dtf.resolvedOptions()}},LH=class{static{o(this,"PolyRelFormatter")}constructor(t,r,n){this.opts={style:"long",...n},!r&&bve()&&(this.rtf=Gkt(t,n))}format(t,r){return this.rtf?this.rtf.format(t,r):_Nt(r,t,this.opts.numeric,this.opts.style!=="long")}formatToParts(t,r){return this.rtf?this.rtf.formatToParts(t,r):[]}},fve={firstDay:1,minimalDays:4,weekend:[6,7]},Nr=class e{static{o(this,"Locale")}static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,r,n,i,s=!1){let a=t||Xr.defaultLocale,u=a||(s?"en-US":Hkt()),c=r||Xr.defaultNumberingSystem,l=n||Xr.defaultOutputCalendar,f=MH(i)||Xr.defaultWeekSettings;return new e(u,c,l,f,a)}static resetCache(){wA=null,IH.clear(),xH.clear(),CH.clear(),DH.clear(),PH.clear()}static fromObject({locale:t,numberingSystem:r,outputCalendar:n,weekSettings:i}={}){return e.create(t,r,n,i)}constructor(t,r,n,i,s){let[a,u,c]=Qkt(t);this.locale=a,this.numberingSystem=r||u||null,this.outputCalendar=n||c||null,this.weekSettings=i,this.intl=zkt(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Xkt(this)),this.fastNumbersCached}listingMode(){let t=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return t&&r?"en":"intl"}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,MH(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,r=!1){return pk(this,t,Sve,()=>{let n=this.intl==="ja"||this.intl.startsWith("ja-");r&=!n;let i=r?{month:t,day:"numeric"}:{month:t},s=r?"format":"standalone";if(!this.monthsCache[s][t]){let a=n?u=>this.dtFormatter(u,i).format():u=>this.extract(u,i,"month");this.monthsCache[s][t]=Ykt(a)}return this.monthsCache[s][t]})}weekdays(t,r=!1){return pk(this,t,Rve,()=>{let n=r?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},i=r?"format":"standalone";return this.weekdaysCache[i][t]||(this.weekdaysCache[i][t]=Jkt(s=>this.extract(s,n,"weekday"))),this.weekdaysCache[i][t]})}meridiems(){return pk(this,void 0,()=>Ive,()=>{if(!this.meridiemCache){let t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[pn.utc(2016,11,13,9),pn.utc(2016,11,13,19)].map(r=>this.extract(r,t,"dayperiod"))}return this.meridiemCache})}eras(t){return pk(this,t,Ove,()=>{let r={era:t};return this.eraCache[t]||(this.eraCache[t]=[pn.utc(-40,1,1),pn.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[t]})}extract(t,r,n){let i=this.dtFormatter(t,r),s=i.formatToParts(),a=s.find(u=>u.type.toLowerCase()===n);return a?a.value:null}numberFormatter(t={}){return new kH(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,r={}){return new NH(t,this.intl,r)}relFormatter(t={}){return new LH(this.intl,this.isEnglish(),t)}listFormatter(t={}){return $kt(this.intl,t)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||lve(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:_ve()?Kkt(this.locale):fve}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},gH=null,fa=class e extends kp{static{o(this,"FixedOffsetZone")}static get utcInstance(){return gH===null&&(gH=new e(0)),gH}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let r=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new e(xk(r[1],r[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${SA(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${SA(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,r){return SA(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return t.type==="fixed"&&t.fixed===this.fixed}get isValid(){return!0}},vk=class extends kp{static{o(this,"InvalidZone")}constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Cp(e,t){if(lt(e)||e===null)return t;if(e instanceof kp)return e;if(iNt(e)){let r=e.toLowerCase();return r==="default"?t:r==="local"||r==="system"?TA.instance:r==="utc"||r==="gmt"?fa.utcInstance:fa.parseSpecifier(r)||qf.create(e)}else return Pp(e)?fa.instance(e):typeof e=="object"&&"offset"in e&&typeof e.offset=="function"?e:new vk(e)}o(Cp,"normalizeZone");var qH={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},gEe={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Zkt=qH.hanidec.replace(/[\[|\]]/g,"").split("");function eNt(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(e[r].search(qH.hanidec)!==-1)t+=Zkt.indexOf(e[r]);else for(let i in gEe){let[s,a]=gEe[i];n>=s&&n<=a&&(t+=n-s)}}return parseInt(t,10)}else return t}o(eNt,"parseDigits");var UH=new Map;function tNt(){UH.clear()}o(tNt,"resetDigitRegexCache");function oc({numberingSystem:e},t=""){let r=e||"latn",n=UH.get(r);n===void 0&&(n=new Map,UH.set(r,n));let i=n.get(t);return i===void 0&&(i=new RegExp(`${qH[r]}${t}`),n.set(t,i)),i}o(oc,"digitRegex");var yEe=o(()=>Date.now(),"now"),bEe="system",_Ee=null,wEe=null,EEe=null,vEe=60,SEe,TEe=null,Xr=class{static{o(this,"Settings")}static get now(){return yEe}static set now(t){yEe=t}static set defaultZone(t){bEe=t}static get defaultZone(){return Cp(bEe,TA.instance)}static get defaultLocale(){return _Ee}static set defaultLocale(t){_Ee=t}static get defaultNumberingSystem(){return wEe}static set defaultNumberingSystem(t){wEe=t}static get defaultOutputCalendar(){return EEe}static set defaultOutputCalendar(t){EEe=t}static get defaultWeekSettings(){return TEe}static set defaultWeekSettings(t){TEe=MH(t)}static get twoDigitCutoffYear(){return vEe}static set twoDigitCutoffYear(t){vEe=t%100}static get throwOnInvalid(){return SEe}static set throwOnInvalid(t){SEe=t}static resetCaches(){Nr.resetCache(),qf.resetCache(),pn.resetCache(),tNt()}},ca=class{static{o(this,"Invalid")}constructor(t,r){this.reason=t,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},dve=[0,31,59,90,120,151,181,212,243,273,304,334],pve=[0,31,60,91,121,152,182,213,244,274,305,335];function ou(e,t){return new ca("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}o(ou,"unitOutOfRange");function WH(e,t,r){let n=new Date(Date.UTC(e,t-1,r));e<100&&e>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let i=n.getUTCDay();return i===0?7:i}o(WH,"dayOfWeek");function mve(e,t,r){return r+(RA(e)?pve:dve)[t-1]}o(mve,"computeOrdinal");function hve(e,t){let r=RA(e)?pve:dve,n=r.findIndex(s=>s<t),i=t-r[n];return{month:n+1,day:i}}o(hve,"uncomputeOrdinal");function jH(e,t){return(e-t+7)%7+1}o(jH,"isoWeekdayToLocal");function Sk(e,t=4,r=1){let{year:n,month:i,day:s}=e,a=mve(n,i,s),u=jH(WH(n,i,s),r),c=Math.floor((a-u+14-t)/7),l;return c<1?(l=n-1,c=AA(l,t,r)):c>AA(n,t,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:u,...Ck(e)}}o(Sk,"gregorianToWeek");function AEe(e,t=4,r=1){let{weekYear:n,weekNumber:i,weekday:s}=e,a=jH(WH(n,1,t),r),u=q_(n),c=i*7+s-a-7+t,l;c<1?(l=n-1,c+=q_(l)):c>u?(l=n+1,c-=q_(n)):l=n;let{month:f,day:d}=hve(l,c);return{year:l,month:f,day:d,...Ck(e)}}o(AEe,"weekToGregorian");function yH(e){let{year:t,month:r,day:n}=e,i=mve(t,r,n);return{year:t,ordinal:i,...Ck(e)}}o(yH,"gregorianToOrdinal");function REe(e){let{year:t,ordinal:r}=e,{month:n,day:i}=hve(t,r);return{year:t,month:n,day:i,...Ck(e)}}o(REe,"ordinalToGregorian");function IEe(e,t){if(!lt(e.localWeekday)||!lt(e.localWeekNumber)||!lt(e.localWeekYear)){if(!lt(e.weekday)||!lt(e.weekNumber)||!lt(e.weekYear))throw new Dp("Cannot mix locale-based week fields with ISO-based week fields");return lt(e.localWeekday)||(e.weekday=e.localWeekday),lt(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),lt(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}o(IEe,"usesLocalWeekValues");function rNt(e,t=4,r=1){let n=Ik(e.weekYear),i=su(e.weekNumber,1,AA(e.weekYear,t,r)),s=su(e.weekday,1,7);return n?i?s?!1:ou("weekday",e.weekday):ou("week",e.weekNumber):ou("weekYear",e.weekYear)}o(rNt,"hasInvalidWeekData");function nNt(e){let t=Ik(e.year),r=su(e.ordinal,1,q_(e.year));return t?r?!1:ou("ordinal",e.ordinal):ou("year",e.year)}o(nNt,"hasInvalidOrdinalData");function gve(e){let t=Ik(e.year),r=su(e.month,1,12),n=su(e.day,1,Tk(e.year,e.month));return t?r?n?!1:ou("day",e.day):ou("month",e.month):ou("year",e.year)}o(gve,"hasInvalidGregorianData");function yve(e){let{hour:t,minute:r,second:n,millisecond:i}=e,s=su(t,0,23)||t===24&&r===0&&n===0&&i===0,a=su(r,0,59),u=su(n,0,59),c=su(i,0,999);return s?a?u?c?!1:ou("millisecond",i):ou("second",n):ou("minute",r):ou("hour",t)}o(yve,"hasInvalidTimeData");function lt(e){return typeof e>"u"}o(lt,"isUndefined");function Pp(e){return typeof e=="number"}o(Pp,"isNumber");function Ik(e){return typeof e=="number"&&e%1===0}o(Ik,"isInteger");function iNt(e){return typeof e=="string"}o(iNt,"isString");function oNt(e){return Object.prototype.toString.call(e)==="[object Date]"}o(oNt,"isDate");function bve(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}o(bve,"hasRelative");function _ve(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}o(_ve,"hasLocaleWeekInfo");function sNt(e){return Array.isArray(e)?e:[e]}o(sNt,"maybeArray");function OEe(e,t,r){if(e.length!==0)return e.reduce((n,i)=>{let s=[t(i),i];return n&&r(n[0],s[0])===n[0]?n:s},null)[1]}o(OEe,"bestBy");function aNt(e,t){return t.reduce((r,n)=>(r[n]=e[n],r),{})}o(aNt,"pick");function j_(e,t){return Object.prototype.hasOwnProperty.call(e,t)}o(j_,"hasOwnProperty");function MH(e){if(e==null)return null;if(typeof e!="object")throw new Wi("Week settings must be an object");if(!su(e.firstDay,1,7)||!su(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(t=>!su(t,1,7)))throw new Wi("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}o(MH,"validateWeekSettings");function su(e,t,r){return Ik(e)&&e>=t&&e<=r}o(su,"integerBetween");function uNt(e,t){return e-t*Math.floor(e/t)}o(uNt,"floorMod");function ui(e,t=2){let r=e<0,n;return r?n="-"+(""+-e).padStart(t,"0"):n=(""+e).padStart(t,"0"),n}o(ui,"padStart");function xp(e){if(!(lt(e)||e===null||e===""))return parseInt(e,10)}o(xp,"parseInteger");function cg(e){if(!(lt(e)||e===null||e===""))return parseFloat(e)}o(cg,"parseFloating");function $H(e){if(!(lt(e)||e===null||e==="")){let t=parseFloat("0."+e)*1e3;return Math.floor(t)}}o($H,"parseMillis");function VH(e,t,r="round"){let n=10**t;switch(r){case"expand":return e>0?Math.ceil(e*n)/n:Math.floor(e*n)/n;case"trunc":return Math.trunc(e*n)/n;case"round":return Math.round(e*n)/n;case"floor":return Math.floor(e*n)/n;case"ceil":return Math.ceil(e*n)/n;default:throw new RangeError(`Value rounding ${r} is out of range`)}}o(VH,"roundTo");function RA(e){return e%4===0&&(e%100!==0||e%400===0)}o(RA,"isLeapYear");function q_(e){return RA(e)?366:365}o(q_,"daysInYear");function Tk(e,t){let r=uNt(t-1,12)+1,n=e+(t-r)/12;return r===2?RA(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}o(Tk,"daysInMonth");function Ok(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}o(Ok,"objToLocalTS");function xEe(e,t,r){return-jH(WH(e,1,t),r)+t-1}o(xEe,"firstWeekOffset");function AA(e,t=4,r=1){let n=xEe(e,t,r),i=xEe(e+1,t,r);return(q_(e)-n+i)/7}o(AA,"weeksInWeekYear");function FH(e){return e>99?e:e>Xr.twoDigitCutoffYear?1900+e:2e3+e}o(FH,"untruncateYear");function wve(e,t,r,n=null){let i=new Date(e),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(s.timeZone=n);let a={timeZoneName:t,...s},u=new Intl.DateTimeFormat(r,a).formatToParts(i).find(c=>c.type.toLowerCase()==="timezonename");return u?u.value:null}o(wve,"parseZoneInfo");function xk(e,t){let r=parseInt(e,10);Number.isNaN(r)&&(r=0);let n=parseInt(t,10)||0,i=r<0||Object.is(r,-0)?-n:n;return r*60+i}o(xk,"signedOffset");function Eve(e){let t=Number(e);if(typeof e=="boolean"||e===""||!Number.isFinite(t))throw new Wi(`Invalid unit value ${e}`);return t}o(Eve,"asNumber");function Ak(e,t){let r={};for(let n in e)if(j_(e,n)){let i=e[n];if(i==null)continue;r[t(n)]=Eve(i)}return r}o(Ak,"normalizeObject");function SA(e,t){let r=Math.trunc(Math.abs(e/60)),n=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${ui(r,2)}:${ui(n,2)}`;case"narrow":return`${i}${r}${n>0?`:${n}`:""}`;case"techie":return`${i}${ui(r,2)}${ui(n,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}o(SA,"formatOffset");function Ck(e){return aNt(e,["hour","minute","second","millisecond"])}o(Ck,"timeObject");var cNt=["January","February","March","April","May","June","July","August","September","October","November","December"],vve=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],lNt=["J","F","M","A","M","J","J","A","S","O","N","D"];function Sve(e){switch(e){case"narrow":return[...lNt];case"short":return[...vve];case"long":return[...cNt];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}o(Sve,"months");var Tve=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ave=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],fNt=["M","T","W","T","F","S","S"];function Rve(e){switch(e){case"narrow":return[...fNt];case"short":return[...Ave];case"long":return[...Tve];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}o(Rve,"weekdays");var Ive=["AM","PM"],dNt=["Before Christ","Anno Domini"],pNt=["BC","AD"],mNt=["B","A"];function Ove(e){switch(e){case"narrow":return[...mNt];case"short":return[...pNt];case"long":return[...dNt];default:return null}}o(Ove,"eras");function hNt(e){return Ive[e.hour<12?0:1]}o(hNt,"meridiemForDateTime");function gNt(e,t){return Rve(t)[e.weekday-1]}o(gNt,"weekdayForDateTime");function yNt(e,t){return Sve(t)[e.month-1]}o(yNt,"monthForDateTime");function bNt(e,t){return Ove(t)[e.year<0?0:1]}o(bNt,"eraForDateTime");function _Nt(e,t,r="always",n=!1){let i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(e)===-1;if(r==="auto"&&s){let d=e==="days";switch(t){case 1:return d?"tomorrow":`next ${i[e][0]}`;case-1:return d?"yesterday":`last ${i[e][0]}`;case 0:return d?"today":`this ${i[e][0]}`}}let a=Object.is(t,-0)||t<0,u=Math.abs(t),c=u===1,l=i[e],f=n?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return a?`${u} ${f} ago`:`in ${u} ${f}`}o(_Nt,"formatRelativeTime");function CEe(e,t){let r="";for(let n of e)n.literal?r+=n.val:r+=t(n.val);return r}o(CEe,"stringifyTokens");var wNt={D:Ek,DD:GEe,DDD:HEe,DDDD:KEe,t:QEe,tt:zEe,ttt:YEe,tttt:JEe,T:XEe,TT:ZEe,TTT:eve,TTTT:tve,f:rve,ff:ive,fff:sve,ffff:uve,F:nve,FF:ove,FFF:ave,FFFF:cve},ua=class e{static{o(this,"Formatter")}static create(t,r={}){return new e(t,r)}static parseFormat(t){let r=null,n="",i=!1,s=[];for(let a=0;a<t.length;a++){let u=t.charAt(a);u==="'"?((n.length>0||i)&&s.push({literal:i||/^\s+$/.test(n),val:n===""?"'":n}),r=null,n="",i=!i):i||u===r?n+=u:(n.length>0&&s.push({literal:/^\s+$/.test(n),val:n}),n=u,r=u)}return n.length>0&&s.push({literal:i||/^\s+$/.test(n),val:n}),s}static macroTokenToFormatOpts(t){return wNt[t]}constructor(t,r){this.opts=r,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...r}).format()}dtFormatter(t,r={}){return this.loc.dtFormatter(t,{...this.opts,...r})}formatDateTime(t,r){return this.dtFormatter(t,r).format()}formatDateTimeParts(t,r){return this.dtFormatter(t,r).formatToParts()}formatInterval(t,r){return this.dtFormatter(t.start,r).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,r){return this.dtFormatter(t,r).resolvedOptions()}num(t,r=0,n=void 0){if(this.opts.forceSimple)return ui(t,r);let i={...this.opts};return r>0&&(i.padTo=r),n&&(i.signDisplay=n),this.loc.numberFormatter(i).format(t)}formatDateTimeFromString(t,r){let n=this.loc.listingMode()==="en",i=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=o((m,h)=>this.loc.extract(t,m,h),"string"),a=o(m=>t.isOffsetFixed&&t.offset===0&&m.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,m.format):"","formatOffset"),u=o(()=>n?hNt(t):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),"meridiem"),c=o((m,h)=>n?yNt(t,m):s(h?{month:m}:{month:m,day:"numeric"},"month"),"month"),l=o((m,h)=>n?gNt(t,m):s(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),"weekday"),f=o(m=>{let h=e.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(t,h):m},"maybeMacro"),d=o(m=>n?bNt(t,m):s({era:m},"era"),"era"),p=o(m=>{switch(m){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12===0?12:t.hour%12);case"hh":return this.num(t.hour%12===0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return u();case"d":return i?s({day:"numeric"},"day"):this.num(t.day);case"dd":return i?s({day:"2-digit"},"day"):this.num(t.day,2);case"c":return this.num(t.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(t.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return i?s({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return i?s({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return i?s({month:"numeric"},"month"):this.num(t.month);case"MM":return i?s({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return i?s({year:"numeric"},"year"):this.num(t.year);case"yy":return i?s({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return i?s({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return i?s({year:"numeric"},"year"):this.num(t.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return f(m)}},"tokenToString");return CEe(e.parseFormat(r),p)}formatDurationFromString(t,r){let n=this.opts.signMode==="negativeLargestOnly"?-1:1,i=o(f=>{switch(f[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},"tokenToField"),s=o((f,d)=>p=>{let m=i(p);if(m){let h=d.isNegativeDuration&&m!==d.largestUnit?n:1,g;return this.opts.signMode==="negativeLargestOnly"&&m!==d.largestUnit?g="never":this.opts.signMode==="all"?g="always":g="auto",this.num(f.get(m)*h,p.length,g)}else return p},"tokenToString"),a=e.parseFormat(r),u=a.reduce((f,{literal:d,val:p})=>d?f:f.concat(p),[]),c=t.shiftTo(...u.map(i).filter(f=>f)),l={isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]};return CEe(a,s(c,l))}},xve=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function $_(...e){let t=e.reduce((r,n)=>r+n.source,"");return RegExp(`^${t}$`)}o($_,"combineRegexes");function V_(...e){return t=>e.reduce(([r,n,i],s)=>{let[a,u,c]=s(t,i);return[{...r,...a},u||n,c]},[{},null,1]).slice(0,2)}o(V_,"combineExtractors");function G_(e,...t){if(e==null)return[null,null];for(let[r,n]of t){let i=r.exec(e);if(i)return n(i)}return[null,null]}o(G_,"parse");function Cve(...e){return(t,r)=>{let n={},i;for(i=0;i<e.length;i++)n[e[i]]=xp(t[r+i]);return[n,null,r+i]}}o(Cve,"simpleParse");var Dve=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ENt=`(?:${Dve.source}?(?:\\[(${xve.source})\\])?)?`,GH=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Pve=RegExp(`${GH.source}${ENt}`),HH=RegExp(`(?:[Tt]${Pve.source})?`),vNt=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,SNt=/(\d{4})-?W(\d\d)(?:-?(\d))?/,TNt=/(\d{4})-?(\d{3})/,ANt=Cve("weekYear","weekNumber","weekDay"),RNt=Cve("year","ordinal"),INt=/(\d{4})-(\d\d)-(\d\d)/,kve=RegExp(`${GH.source} ?(?:${Dve.source}|(${xve.source}))?`),ONt=RegExp(`(?: ${kve.source})?`);function W_(e,t,r){let n=e[t];return lt(n)?r:xp(n)}o(W_,"int");function xNt(e,t){return[{year:W_(e,t),month:W_(e,t+1,1),day:W_(e,t+2,1)},null,t+3]}o(xNt,"extractISOYmd");function H_(e,t){return[{hours:W_(e,t,0),minutes:W_(e,t+1,0),seconds:W_(e,t+2,0),milliseconds:$H(e[t+3])},null,t+4]}o(H_,"extractISOTime");function IA(e,t){let r=!e[t]&&!e[t+1],n=xk(e[t+1],e[t+2]),i=r?null:fa.instance(n);return[{},i,t+3]}o(IA,"extractISOOffset");function OA(e,t){let r=e[t]?qf.create(e[t]):null;return[{},r,t+1]}o(OA,"extractIANAZone");var CNt=RegExp(`^T?${GH.source}$`),DNt=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function PNt(e){let[t,r,n,i,s,a,u,c,l]=e,f=t[0]==="-",d=c&&c[0]==="-",p=o((m,h=!1)=>m!==void 0&&(h||m&&f)?-m:m,"maybeNegate");return[{years:p(cg(r)),months:p(cg(n)),weeks:p(cg(i)),days:p(cg(s)),hours:p(cg(a)),minutes:p(cg(u)),seconds:p(cg(c),c==="-0"),milliseconds:p($H(l),d)}]}o(PNt,"extractISODuration");var kNt={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function KH(e,t,r,n,i,s,a){let u={year:t.length===2?FH(xp(t)):xp(t),month:vve.indexOf(r)+1,day:xp(n),hour:xp(i),minute:xp(s)};return a&&(u.second=xp(a)),e&&(u.weekday=e.length>3?Tve.indexOf(e)+1:Ave.indexOf(e)+1),u}o(KH,"fromStrings");var NNt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function LNt(e){let[,t,r,n,i,s,a,u,c,l,f,d]=e,p=KH(t,i,n,r,s,a,u),m;return c?m=kNt[c]:l?m=0:m=xk(f,d),[p,new fa(m)]}o(LNt,"extractRFC2822");function UNt(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}o(UNt,"preprocessRFC2822");var MNt=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,FNt=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,BNt=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function DEe(e){let[,t,r,n,i,s,a,u]=e;return[KH(t,i,n,r,s,a,u),fa.utcInstance]}o(DEe,"extractRFC1123Or850");function qNt(e){let[,t,r,n,i,s,a,u]=e;return[KH(t,u,r,n,i,s,a),fa.utcInstance]}o(qNt,"extractASCII");var WNt=$_(vNt,HH),jNt=$_(SNt,HH),$Nt=$_(TNt,HH),VNt=$_(Pve),Nve=V_(xNt,H_,IA,OA),GNt=V_(ANt,H_,IA,OA),HNt=V_(RNt,H_,IA,OA),KNt=V_(H_,IA,OA);function QNt(e){return G_(e,[WNt,Nve],[jNt,GNt],[$Nt,HNt],[VNt,KNt])}o(QNt,"parseISODate");function zNt(e){return G_(UNt(e),[NNt,LNt])}o(zNt,"parseRFC2822Date");function YNt(e){return G_(e,[MNt,DEe],[FNt,DEe],[BNt,qNt])}o(YNt,"parseHTTPDate");function JNt(e){return G_(e,[DNt,PNt])}o(JNt,"parseISODuration");var XNt=V_(H_);function ZNt(e){return G_(e,[CNt,XNt])}o(ZNt,"parseISOTimeOnly");var eLt=$_(INt,ONt),tLt=$_(kve),rLt=V_(H_,IA,OA);function nLt(e){return G_(e,[eLt,Nve],[tLt,rLt])}o(nLt,"parseSQL");var PEe="Invalid Duration",Lve={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},iLt={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Lve},iu=146097/400,M_=146097/4800,oLt={years:{quarters:4,months:12,weeks:iu/7,days:iu,hours:iu*24,minutes:iu*24*60,seconds:iu*24*60*60,milliseconds:iu*24*60*60*1e3},quarters:{months:3,weeks:iu/28,days:iu/4,hours:iu*24/4,minutes:iu*24*60/4,seconds:iu*24*60*60/4,milliseconds:iu*24*60*60*1e3/4},months:{weeks:M_/7,days:M_,hours:M_*24,minutes:M_*24*60,seconds:M_*24*60*60,milliseconds:M_*24*60*60*1e3},...Lve},fg=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],sLt=fg.slice(0).reverse();function Ff(e,t,r=!1){let n={values:r?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new wi(n)}o(Ff,"clone$1");function Uve(e,t){var r;let n=(r=t.milliseconds)!=null?r:0;for(let i of sLt.slice(1))t[i]&&(n+=t[i]*e[i].milliseconds);return n}o(Uve,"durationToMillis");function kEe(e,t){let r=Uve(e,t)<0?-1:1;fg.reduceRight((n,i)=>{if(lt(t[i]))return n;if(n){let s=t[n]*r,a=e[i][n],u=Math.floor(s/a);t[i]+=u*r,t[n]-=u*a*r}return i},null),fg.reduce((n,i)=>{if(lt(t[i]))return n;if(n){let s=t[n]%1;t[n]-=s,t[i]+=s*e[n][i]}return i},null)}o(kEe,"normalizeValues");function NEe(e){let t={};for(let[r,n]of Object.entries(e))n!==0&&(t[r]=n);return t}o(NEe,"removeZeroes");var wi=class e{static{o(this,"Duration")}constructor(t){let r=t.conversionAccuracy==="longterm"||!1,n=r?oLt:iLt;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||Nr.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,r){return e.fromObject({milliseconds:t},r)}static fromObject(t,r={}){if(t==null||typeof t!="object")throw new Wi(`Duration.fromObject: argument expected to be an object, got ${t===null?"null":typeof t}`);return new e({values:Ak(t,e.normalizeUnit),loc:Nr.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(t){if(Pp(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t=="object")return e.fromObject(t);throw new Wi(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,r){let[n]=JNt(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,r){let[n]=ZNt(t);return n?e.fromObject(n,r):e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,r=null){if(!t)throw new Wi("need to specify a reason the Duration is invalid");let n=t instanceof ca?t:new ca(t,r);if(Xr.throwOnInvalid)throw new AH(n);return new e({invalid:n})}static normalizeUnit(t){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t&&t.toLowerCase()];if(!r)throw new wk(t);return r}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?ua.create(this.loc,n).formatDurationFromString(this,t):PEe}toHuman(t={}){if(!this.isValid)return PEe;let r=t.showZeros!==!1,n=fg.map(i=>{let s=this.values[i];return lt(s)||s===0&&!r?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return this.years!==0&&(t+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(t+=this.months+this.quarters*3+"M"),this.weeks!==0&&(t+=this.weeks+"W"),this.days!==0&&(t+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(t+="T"),this.hours!==0&&(t+=this.hours+"H"),this.minutes!==0&&(t+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(t+=VH(this.seconds+this.milliseconds/1e3,3)+"S"),t==="P"&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},pn.fromMillis(r,{zone:"UTC"}).toISOTime(t))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Uve(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t),n={};for(let i of fg)(j_(r.values,i)||j_(this.values,i))&&(n[i]=r.get(i)+this.get(i));return Ff(this,{values:n},!0)}minus(t){if(!this.isValid)return this;let r=e.fromDurationLike(t);return this.plus(r.negate())}mapUnits(t){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=Eve(t(this.values[n],n));return Ff(this,{values:r},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let r={...this.values,...Ak(t,e.normalizeUnit)};return Ff(this,{values:r})}reconfigure({locale:t,numberingSystem:r,conversionAccuracy:n,matrix:i}={}){let a={loc:this.loc.clone({locale:t,numberingSystem:r}),matrix:i,conversionAccuracy:n};return Ff(this,a)}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;let t=this.toObject();return kEe(this.matrix,t),Ff(this,{values:t},!0)}rescale(){if(!this.isValid)return this;let t=NEe(this.normalize().shiftToAll().toObject());return Ff(this,{values:t},!0)}shiftTo(...t){if(!this.isValid)return this;if(t.length===0)return this;t=t.map(a=>e.normalizeUnit(a));let r={},n={},i=this.toObject(),s;for(let a of fg)if(t.indexOf(a)>=0){s=a;let u=0;for(let l in n)u+=this.matrix[l][a]*n[l],n[l]=0;Pp(i[a])&&(u+=i[a]);let c=Math.trunc(u);r[a]=c,n[a]=(u*1e3-c*1e3)/1e3}else Pp(i[a])&&(n[a]=i[a]);for(let a in n)n[a]!==0&&(r[s]+=a===s?n[a]:n[a]/this.matrix[s][a]);return kEe(this.matrix,r),Ff(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let t={};for(let r of Object.keys(this.values))t[r]=this.values[r]===0?0:-this.values[r];return Ff(this,{values:t},!0)}removeZeros(){if(!this.isValid)return this;let t=NEe(this.values);return Ff(this,{values:t},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid||!this.loc.equals(t.loc))return!1;function r(n,i){return n===void 0||n===0?i===void 0||i===0:n===i}o(r,"eq");for(let n of fg)if(!r(this.values[n],t.values[n]))return!1;return!0}},F_="Invalid Interval";function aLt(e,t){return!e||!e.isValid?pg.invalid("missing or invalid start"):!t||!t.isValid?pg.invalid("missing or invalid end"):t<e?pg.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}o(aLt,"validateStartEnd");var pg=class e{static{o(this,"Interval")}constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,r=null){if(!t)throw new Wi("need to specify a reason the Interval is invalid");let n=t instanceof ca?t:new ca(t,r);if(Xr.throwOnInvalid)throw new TH(n);return new e({invalid:n})}static fromDateTimes(t,r){let n=_A(t),i=_A(r),s=aLt(n,i);return s??new e({start:n,end:i})}static after(t,r){let n=wi.fromDurationLike(r),i=_A(t);return e.fromDateTimes(i,i.plus(n))}static before(t,r){let n=wi.fromDurationLike(r),i=_A(t);return e.fromDateTimes(i.minus(n),i)}static fromISO(t,r){let[n,i]=(t||"").split("/",2);if(n&&i){let s,a;try{s=pn.fromISO(n,r),a=s.isValid}catch{a=!1}let u,c;try{u=pn.fromISO(i,r),c=u.isValid}catch{c=!1}if(a&&c)return e.fromDateTimes(s,u);if(a){let l=wi.fromISO(i,r);if(l.isValid)return e.after(s,l)}else if(c){let l=wi.fromISO(n,r);if(l.isValid)return e.before(u,l)}}return e.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(t,r),i;return r!=null&&r.useLocaleWeeks?i=this.end.reconfigure({locale:n.locale}):i=this.end,i=i.startOf(t,r),Math.floor(i.diff(n,t).get(t))+(i.valueOf()!==this.end.valueOf())}hasSame(t){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,t):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return this.isValid?this.s>t:!1}isBefore(t){return this.isValid?this.e<=t:!1}contains(t){return this.isValid?this.s<=t&&this.e>t:!1}set({start:t,end:r}={}){return this.isValid?e.fromDateTimes(t||this.s,r||this.e):this}splitAt(...t){if(!this.isValid)return[];let r=t.map(_A).filter(a=>this.contains(a)).sort((a,u)=>a.toMillis()-u.toMillis()),n=[],{s:i}=this,s=0;for(;i<this.e;){let a=r[s]||this.e,u=+a>+this.e?this.e:a;n.push(e.fromDateTimes(i,u)),i=u,s+=1}return n}splitBy(t){let r=wi.fromDurationLike(t);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,i=1,s,a=[];for(;n<this.e;){let u=this.start.plus(r.mapUnits(c=>c*i));s=+u>+this.e?this.e:u,a.push(e.fromDateTimes(n,s)),n=s,i+=1}return a}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return this.isValid?+this.e==+t.s:!1}abutsEnd(t){return this.isValid?+t.e==+this.s:!1}engulfs(t){return this.isValid?this.s<=t.s&&this.e>=t.e:!1}equals(t){return!this.isValid||!t.isValid?!1:this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;let r=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return r>=n?null:e.fromDateTimes(r,n)}union(t){if(!this.isValid)return this;let r=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return e.fromDateTimes(r,n)}static merge(t){let[r,n]=t.sort((i,s)=>i.s-s.s).reduce(([i,s],a)=>s?s.overlaps(a)||s.abutsStart(a)?[i,s.union(a)]:[i.concat([s]),a]:[i,a],[[],null]);return n&&r.push(n),r}static xor(t){let r=null,n=0,i=[],s=t.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),a=Array.prototype.concat(...s),u=a.sort((c,l)=>c.time-l.time);for(let c of u)n+=c.type==="s"?1:-1,n===1?r=c.time:(r&&+r!=+c.time&&i.push(e.fromDateTimes(r,c.time)),r=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:F_}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=Ek,r={}){return this.isValid?ua.create(this.s.loc.clone(r),t).formatInterval(this):F_}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:F_}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:F_}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:F_}toFormat(t,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(t)}${r}${this.e.toFormat(t)}`:F_}toDuration(t,r){return this.isValid?this.e.diff(this.s,t,r):wi.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},dg=class{static{o(this,"Info")}static hasDST(t=Xr.defaultZone){let r=pn.now().setZone(t).set({month:12});return!t.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(t){return qf.isValidZone(t)}static normalizeZone(t){return Cp(t,Xr.defaultZone)}static getStartOfWeek({locale:t=null,locObj:r=null}={}){return(r||Nr.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:r=null}={}){return(r||Nr.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:r=null}={}){return(r||Nr.create(t)).getWeekendDays().slice()}static months(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Nr.create(r,n,s)).months(t)}static monthsFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null,outputCalendar:s="gregory"}={}){return(i||Nr.create(r,n,s)).months(t,!0)}static weekdays(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Nr.create(r,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:r=null,numberingSystem:n=null,locObj:i=null}={}){return(i||Nr.create(r,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return Nr.create(t).meridiems()}static eras(t="short",{locale:r=null}={}){return Nr.create(r,null,"gregory").eras(t)}static features(){return{relative:bve(),localeWeek:_ve()}}};function LEe(e,t){let r=o(i=>i.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),"utcDayStart"),n=r(t)-r(e);return Math.floor(wi.fromMillis(n).as("days"))}o(LEe,"dayDiff");function uLt(e,t,r){let n=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{let f=LEe(c,l);return(f-f%7)/7}],["days",LEe]],i={},s=e,a,u;for(let[c,l]of n)r.indexOf(c)>=0&&(a=c,i[c]=l(e,t),u=s.plus(i),u>t?(i[c]--,e=s.plus(i),e>t&&(u=e,i[c]--,e=s.plus(i))):e=u);return[e,i,u,a]}o(uLt,"highOrderDiffs");function cLt(e,t,r,n){let[i,s,a,u]=uLt(e,t,r),c=t-i,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a<t&&(a=i.plus({[u]:1})),a!==i&&(s[u]=(s[u]||0)+c/(a-i)));let f=wi.fromObject(s,n);return l.length>0?wi.fromMillis(c,n).shiftTo(...l).plus(f):f}o(cLt,"diff");var lLt="missing Intl.DateTimeFormat.formatToParts support";function dr(e,t=r=>r){return{regex:e,deser:([r])=>t(eNt(r))}}o(dr,"intUnit");var fLt=String.fromCharCode(160),Mve=`[ ${fLt}]`,Fve=new RegExp(Mve,"g");function dLt(e){return e.replace(/\./g,"\\.?").replace(Fve,Mve)}o(dLt,"fixListRegex");function UEe(e){return e.replace(/\./g,"").replace(Fve," ").toLowerCase()}o(UEe,"stripInsensitivities");function sc(e,t){return e===null?null:{regex:RegExp(e.map(dLt).join("|")),deser:([r])=>e.findIndex(n=>UEe(r)===UEe(n))+t}}o(sc,"oneOf");function MEe(e,t){return{regex:e,deser:([,r,n])=>xk(r,n),groups:t}}o(MEe,"offset");function mk(e){return{regex:e,deser:([t])=>t}}o(mk,"simple");function pLt(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}o(pLt,"escapeToken");function mLt(e,t){let r=oc(t),n=oc(t,"{2}"),i=oc(t,"{3}"),s=oc(t,"{4}"),a=oc(t,"{6}"),u=oc(t,"{1,2}"),c=oc(t,"{1,3}"),l=oc(t,"{1,6}"),f=oc(t,"{1,9}"),d=oc(t,"{2,4}"),p=oc(t,"{4,6}"),m=o(b=>({regex:RegExp(pLt(b.val)),deser:([w])=>w,literal:!0}),"literal"),g=o(b=>{if(e.literal)return m(b);switch(b.val){case"G":return sc(t.eras("short"),0);case"GG":return sc(t.eras("long"),0);case"y":return dr(l);case"yy":return dr(d,FH);case"yyyy":return dr(s);case"yyyyy":return dr(p);case"yyyyyy":return dr(a);case"M":return dr(u);case"MM":return dr(n);case"MMM":return sc(t.months("short",!0),1);case"MMMM":return sc(t.months("long",!0),1);case"L":return dr(u);case"LL":return dr(n);case"LLL":return sc(t.months("short",!1),1);case"LLLL":return sc(t.months("long",!1),1);case"d":return dr(u);case"dd":return dr(n);case"o":return dr(c);case"ooo":return dr(i);case"HH":return dr(n);case"H":return dr(u);case"hh":return dr(n);case"h":return dr(u);case"mm":return dr(n);case"m":return dr(u);case"q":return dr(u);case"qq":return dr(n);case"s":return dr(u);case"ss":return dr(n);case"S":return dr(c);case"SSS":return dr(i);case"u":return mk(f);case"uu":return mk(u);case"uuu":return dr(r);case"a":return sc(t.meridiems(),0);case"kkkk":return dr(s);case"kk":return dr(d,FH);case"W":return dr(u);case"WW":return dr(n);case"E":case"c":return dr(r);case"EEE":return sc(t.weekdays("short",!1),1);case"EEEE":return sc(t.weekdays("long",!1),1);case"ccc":return sc(t.weekdays("short",!0),1);case"cccc":return sc(t.weekdays("long",!0),1);case"Z":case"ZZ":return MEe(new RegExp(`([+-]${u.source})(?::(${n.source}))?`),2);case"ZZZ":return MEe(new RegExp(`([+-]${u.source})(${n.source})?`),2);case"z":return mk(/[a-z_+-/]{1,256}?/i);case" ":return mk(/[^\S\n\r]/);default:return m(b)}},"unitate")(e)||{invalidReason:lLt};return g.token=e,g}o(mLt,"unitForToken");var hLt={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function gLt(e,t,r){let{type:n,value:i}=e;if(n==="literal"){let c=/^\s+$/.test(i);return{literal:!c,val:c?" ":i}}let s=t[n],a=n;n==="hour"&&(t.hour12!=null?a=t.hour12?"hour12":"hour24":t.hourCycle!=null?t.hourCycle==="h11"||t.hourCycle==="h12"?a="hour12":a="hour24":a=r.hour12?"hour12":"hour24");let u=hLt[a];if(typeof u=="object"&&(u=u[s]),u)return{literal:!1,val:u}}o(gLt,"tokenForPart");function yLt(e){return[`^${e.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,e]}o(yLt,"buildRegex");function bLt(e,t,r){let n=e.match(t);if(n){let i={},s=1;for(let a in r)if(j_(r,a)){let u=r[a],c=u.groups?u.groups+1:1;!u.literal&&u.token&&(i[u.token.val[0]]=u.deser(n.slice(s,s+c))),s+=c}return[n,i]}else return[n,{}]}o(bLt,"match");function _Lt(e){let t=o(s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},"toField"),r=null,n;return lt(e.z)||(r=qf.create(e.z)),lt(e.Z)||(r||(r=new fa(e.Z)),n=e.Z),lt(e.q)||(e.M=(e.q-1)*3+1),lt(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),lt(e.u)||(e.S=$H(e.u)),[Object.keys(e).reduce((s,a)=>{let u=t(a);return u&&(s[u]=e[a]),s},{}),r,n]}o(_Lt,"dateTimeFromMatches");var bH=null;function wLt(){return bH||(bH=pn.fromMillis(1555555555555)),bH}o(wLt,"getDummyDateTime");function ELt(e,t){if(e.literal)return e;let r=ua.macroTokenToFormatOpts(e.val),n=Wve(r,t);return n==null||n.includes(void 0)?e:n}o(ELt,"maybeExpandMacroToken");function Bve(e,t){return Array.prototype.concat(...e.map(r=>ELt(r,t)))}o(Bve,"expandMacroTokens");var Rk=class{static{o(this,"TokenParser")}constructor(t,r){if(this.locale=t,this.format=r,this.tokens=Bve(ua.parseFormat(r),t),this.units=this.tokens.map(n=>mLt(n,t)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,i]=yLt(this.units);this.regex=RegExp(n,"i"),this.handlers=i}}explainFromTokens(t){if(this.isValid){let[r,n]=bLt(t,this.regex,this.handlers),[i,s,a]=n?_Lt(n):[null,null,void 0];if(j_(n,"a")&&j_(n,"H"))throw new Dp("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:r,matches:n,result:i,zone:s,specificOffset:a}}else return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function qve(e,t,r){return new Rk(e,r).explainFromTokens(t)}o(qve,"explainFromTokens");function vLt(e,t,r){let{result:n,zone:i,specificOffset:s,invalidReason:a}=qve(e,t,r);return[n,i,s,a]}o(vLt,"parseFromTokens");function Wve(e,t){if(!e)return null;let n=ua.create(t,e).dtFormatter(wLt()),i=n.formatToParts(),s=n.resolvedOptions();return i.map(a=>gLt(a,e,s))}o(Wve,"formatOptsToTokens");var _H="Invalid DateTime",FEe=864e13;function EA(e){return new ca("unsupported zone",`the zone "${e.name}" is not supported`)}o(EA,"unsupportedZone");function wH(e){return e.weekData===null&&(e.weekData=Sk(e.c)),e.weekData}o(wH,"possiblyCachedWeekData");function EH(e){return e.localWeekData===null&&(e.localWeekData=Sk(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}o(EH,"possiblyCachedLocalWeekData");function lg(e,t){let r={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new pn({...r,...t,old:r})}o(lg,"clone");function jve(e,t,r){let n=e-t*60*1e3,i=r.offset(n);if(t===i)return[n,t];n-=(i-t)*60*1e3;let s=r.offset(n);return i===s?[n,i]:[e-Math.min(i,s)*60*1e3,Math.max(i,s)]}o(jve,"fixOffset");function hk(e,t){e+=t*60*1e3;let r=new Date(e);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}o(hk,"tsToObj");function yk(e,t,r){return jve(Ok(e),t,r)}o(yk,"objToTS");function BEe(e,t){let r=e.o,n=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,s={...e.c,year:n,month:i,day:Math.min(e.c.day,Tk(n,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},a=wi.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),u=Ok(s),[c,l]=jve(u,r,e.zone);return a!==0&&(c+=a,l=e.zone.offset(c)),{ts:c,o:l}}o(BEe,"adjustTime");function B_(e,t,r,n,i,s){let{setZone:a,zone:u}=r;if(e&&Object.keys(e).length!==0||t){let c=t||u,l=pn.fromObject(e,{...r,zone:c,specificOffset:s});return a?l:l.setZone(u)}else return pn.invalid(new ca("unparsable",`the input "${i}" can't be parsed as ${n}`))}o(B_,"parseDataToDateTime");function gk(e,t,r=!0){return e.isValid?ua.create(Nr.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(e,t):null}o(gk,"toTechFormat");function vH(e,t,r){let n=e.c.year>9999||e.c.year<0,i="";if(n&&e.c.year>=0&&(i+="+"),i+=ui(e.c.year,n?6:4),r==="year")return i;if(t){if(i+="-",i+=ui(e.c.month),r==="month")return i;i+="-"}else if(i+=ui(e.c.month),r==="month")return i;return i+=ui(e.c.day),i}o(vH,"toISODate");function qEe(e,t,r,n,i,s,a){let u=!r||e.c.millisecond!==0||e.c.second!==0,c="";switch(a){case"day":case"month":case"year":break;default:if(c+=ui(e.c.hour),a==="hour")break;if(t){if(c+=":",c+=ui(e.c.minute),a==="minute")break;u&&(c+=":",c+=ui(e.c.second))}else{if(c+=ui(e.c.minute),a==="minute")break;u&&(c+=ui(e.c.second))}if(a==="second")break;u&&(!n||e.c.millisecond!==0)&&(c+=".",c+=ui(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!s?c+="Z":e.o<0?(c+="-",c+=ui(Math.trunc(-e.o/60)),c+=":",c+=ui(Math.trunc(-e.o%60))):(c+="+",c+=ui(Math.trunc(e.o/60)),c+=":",c+=ui(Math.trunc(e.o%60)))),s&&(c+="["+e.zone.ianaName+"]"),c}o(qEe,"toISOTime");var $ve={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},SLt={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},TLt={ordinal:1,hour:0,minute:0,second:0,millisecond:0},bk=["year","month","day","hour","minute","second","millisecond"],ALt=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],RLt=["year","ordinal","hour","minute","second","millisecond"];function _k(e){let t={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[e.toLowerCase()];if(!t)throw new wk(e);return t}o(_k,"normalizeUnit");function WEe(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return _k(e)}}o(WEe,"normalizeUnitWithLocalWeeks");function ILt(e){if(vA===void 0&&(vA=Xr.now()),e.type!=="iana")return e.offset(vA);let t=e.name,r=BH.get(t);return r===void 0&&(r=e.offset(vA),BH.set(t,r)),r}o(ILt,"guessOffsetForZone");function jEe(e,t){let r=Cp(t.zone,Xr.defaultZone);if(!r.isValid)return pn.invalid(EA(r));let n=Nr.fromObject(t),i,s;if(lt(e.year))i=Xr.now();else{for(let c of bk)lt(e[c])&&(e[c]=$ve[c]);let a=gve(e)||yve(e);if(a)return pn.invalid(a);let u=ILt(r);[i,s]=yk(e,u,r)}return new pn({ts:i,zone:r,loc:n,o:s})}o(jEe,"quickDT");function $Ee(e,t,r){let n=lt(r.round)?!0:r.round,i=lt(r.rounding)?"trunc":r.rounding,s=o((u,c)=>(u=VH(u,n||r.calendary?0:2,r.calendary?"round":i),t.loc.clone(r).relFormatter(r).format(u,c)),"format"),a=o(u=>r.calendary?t.hasSame(e,u)?0:t.startOf(u).diff(e.startOf(u),u).get(u):t.diff(e,u).get(u),"differ");if(r.unit)return s(a(r.unit),r.unit);for(let u of r.units){let c=a(u);if(Math.abs(c)>=1)return s(c,u)}return s(e>t?-0:0,r.units[r.units.length-1])}o($Ee,"diffRelative");function VEe(e){let t={},r;return e.length>0&&typeof e[e.length-1]=="object"?(t=e[e.length-1],r=Array.from(e).slice(0,e.length-1)):r=Array.from(e),[t,r]}o(VEe,"lastOpts");var vA,BH=new Map,pn=class e{static{o(this,"DateTime")}constructor(t){let r=t.zone||Xr.defaultZone,n=t.invalid||(Number.isNaN(t.ts)?new ca("invalid input"):null)||(r.isValid?null:EA(r));this.ts=lt(t.ts)?Xr.now():t.ts;let i=null,s=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(r))[i,s]=[t.old.c,t.old.o];else{let u=Pp(t.o)&&!t.old?t.o:r.offset(this.ts);i=hk(this.ts,u),n=Number.isNaN(i.year)?new ca("invalid input"):null,i=n?null:i,s=n?null:u}this._zone=r,this.loc=t.loc||Nr.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=i,this.o=s,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[t,r]=VEe(arguments),[n,i,s,a,u,c,l]=r;return jEe({year:n,month:i,day:s,hour:a,minute:u,second:c,millisecond:l},t)}static utc(){let[t,r]=VEe(arguments),[n,i,s,a,u,c,l]=r;return t.zone=fa.utcInstance,jEe({year:n,month:i,day:s,hour:a,minute:u,second:c,millisecond:l},t)}static fromJSDate(t,r={}){let n=oNt(t)?t.valueOf():NaN;if(Number.isNaN(n))return e.invalid("invalid input");let i=Cp(r.zone,Xr.defaultZone);return i.isValid?new e({ts:n,zone:i,loc:Nr.fromObject(r)}):e.invalid(EA(i))}static fromMillis(t,r={}){if(Pp(t))return t<-FEe||t>FEe?e.invalid("Timestamp out of range"):new e({ts:t,zone:Cp(r.zone,Xr.defaultZone),loc:Nr.fromObject(r)});throw new Wi(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,r={}){if(Pp(t))return new e({ts:t*1e3,zone:Cp(r.zone,Xr.defaultZone),loc:Nr.fromObject(r)});throw new Wi("fromSeconds requires a numerical input")}static fromObject(t,r={}){t=t||{};let n=Cp(r.zone,Xr.defaultZone);if(!n.isValid)return e.invalid(EA(n));let i=Nr.fromObject(r),s=Ak(t,WEe),{minDaysInFirstWeek:a,startOfWeek:u}=IEe(s,i),c=Xr.now(),l=lt(r.specificOffset)?n.offset(c):r.specificOffset,f=!lt(s.ordinal),d=!lt(s.year),p=!lt(s.month)||!lt(s.day),m=d||p,h=s.weekYear||s.weekNumber;if((m||f)&&h)throw new Dp("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&f)throw new Dp("Can't mix ordinal dates with month/day");let g=h||s.weekday&&!m,b,w,E=hk(c,l);g?(b=ALt,w=SLt,E=Sk(E,a,u)):f?(b=RLt,w=TLt,E=yH(E)):(b=bk,w=$ve);let v=!1;for(let N of b){let k=s[N];lt(k)?v?s[N]=w[N]:s[N]=E[N]:v=!0}let S=g?rNt(s,a,u):f?nNt(s):gve(s),T=S||yve(s);if(T)return e.invalid(T);let x=g?AEe(s,a,u):f?REe(s):s,[O,C]=yk(x,l,n),D=new e({ts:O,zone:n,o:C,loc:i});return s.weekday&&m&&t.weekday!==D.weekday?e.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${D.toISO()}`):D.isValid?D:e.invalid(D.invalid)}static fromISO(t,r={}){let[n,i]=QNt(t);return B_(n,i,r,"ISO 8601",t)}static fromRFC2822(t,r={}){let[n,i]=zNt(t);return B_(n,i,r,"RFC 2822",t)}static fromHTTP(t,r={}){let[n,i]=YNt(t);return B_(n,i,r,"HTTP",r)}static fromFormat(t,r,n={}){if(lt(t)||lt(r))throw new Wi("fromFormat requires an input string and a format");let{locale:i=null,numberingSystem:s=null}=n,a=Nr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0}),[u,c,l,f]=vLt(a,t,r);return f?e.invalid(f):B_(u,c,n,`format ${r}`,t,l)}static fromString(t,r,n={}){return e.fromFormat(t,r,n)}static fromSQL(t,r={}){let[n,i]=nLt(t);return B_(n,i,r,"SQL",t)}static invalid(t,r=null){if(!t)throw new Wi("need to specify a reason the DateTime is invalid");let n=t instanceof ca?t:new ca(t,r);if(Xr.throwOnInvalid)throw new SH(n);return new e({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,r={}){let n=Wve(t,Nr.fromObject(r));return n?n.map(i=>i?i.val:null).join(""):null}static expandFormat(t,r={}){return Bve(ua.parseFormat(t),Nr.fromObject(r)).map(i=>i.val).join("")}static resetCache(){vA=void 0,BH.clear()}get(t){return this[t]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?wH(this).weekYear:NaN}get weekNumber(){return this.isValid?wH(this).weekNumber:NaN}get weekday(){return this.isValid?wH(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?EH(this).weekday:NaN}get localWeekNumber(){return this.isValid?EH(this).weekNumber:NaN}get localWeekYear(){return this.isValid?EH(this).weekYear:NaN}get ordinal(){return this.isValid?yH(this.c).ordinal:NaN}get monthShort(){return this.isValid?dg.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?dg.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?dg.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?dg.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let t=864e5,r=6e4,n=Ok(this.c),i=this.zone.offset(n-t),s=this.zone.offset(n+t),a=this.zone.offset(n-i*r),u=this.zone.offset(n-s*r);if(a===u)return[this];let c=n-a*r,l=n-u*r,f=hk(c,a),d=hk(l,u);return f.hour===d.hour&&f.minute===d.minute&&f.second===d.second&&f.millisecond===d.millisecond?[lg(this,{ts:c}),lg(this,{ts:l})]:[this]}get isInLeapYear(){return RA(this.year)}get daysInMonth(){return Tk(this.year,this.month)}get daysInYear(){return this.isValid?q_(this.year):NaN}get weeksInWeekYear(){return this.isValid?AA(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?AA(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){let{locale:r,numberingSystem:n,calendar:i}=ua.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:i}}toUTC(t=0,r={}){return this.setZone(fa.instance(t),r)}toLocal(){return this.setZone(Xr.defaultZone)}setZone(t,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(t=Cp(t,Xr.defaultZone),t.equals(this.zone))return this;if(t.isValid){let i=this.ts;if(r||n){let s=t.offset(this.ts),a=this.toObject();[i]=yk(a,s,t)}return lg(this,{ts:i,zone:t})}else return e.invalid(EA(t))}reconfigure({locale:t,numberingSystem:r,outputCalendar:n}={}){let i=this.loc.clone({locale:t,numberingSystem:r,outputCalendar:n});return lg(this,{loc:i})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;let r=Ak(t,WEe),{minDaysInFirstWeek:n,startOfWeek:i}=IEe(r,this.loc),s=!lt(r.weekYear)||!lt(r.weekNumber)||!lt(r.weekday),a=!lt(r.ordinal),u=!lt(r.year),c=!lt(r.month)||!lt(r.day),l=u||c,f=r.weekYear||r.weekNumber;if((l||a)&&f)throw new Dp("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&a)throw new Dp("Can't mix ordinal dates with month/day");let d;s?d=AEe({...Sk(this.c,n,i),...r},n,i):lt(r.ordinal)?(d={...this.toObject(),...r},lt(r.day)&&(d.day=Math.min(Tk(d.year,d.month),d.day))):d=REe({...yH(this.c),...r});let[p,m]=yk(d,this.o,this.zone);return lg(this,{ts:p,o:m})}plus(t){if(!this.isValid)return this;let r=wi.fromDurationLike(t);return lg(this,BEe(this,r))}minus(t){if(!this.isValid)return this;let r=wi.fromDurationLike(t).negate();return lg(this,BEe(this,r))}startOf(t,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},i=wi.normalizeUnit(t);switch(i){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(i==="weeks")if(r){let s=this.loc.getStartOfWeek(),{weekday:a}=this;a<s&&(n.weekNumber=this.weekNumber-1),n.weekday=s}else n.weekday=1;if(i==="quarters"){let s=Math.ceil(this.month/3);n.month=(s-1)*3+1}return this.set(n)}endOf(t,r){return this.isValid?this.plus({[t]:1}).startOf(t,r).minus(1):this}toFormat(t,r={}){return this.isValid?ua.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,t):_H}toLocaleString(t=Ek,r={}){return this.isValid?ua.create(this.loc.clone(r),t).formatDateTime(this):_H}toLocaleParts(t={}){return this.isValid?ua.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:i=!0,extendedZone:s=!1,precision:a="milliseconds"}={}){if(!this.isValid)return null;a=_k(a);let u=t==="extended",c=vH(this,u,a);return bk.indexOf(a)>=3&&(c+="T"),c+=qEe(this,u,r,n,i,s,a),c}toISODate({format:t="extended",precision:r="day"}={}){return this.isValid?vH(this,t==="extended",_k(r)):null}toISOWeekDate(){return gk(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:i=!1,extendedZone:s=!1,format:a="extended",precision:u="milliseconds"}={}){return this.isValid?(u=_k(u),(i&&bk.indexOf(u)>=3?"T":"")+qEe(this,a==="extended",r,t,n,s,u)):null}toRFC2822(){return gk(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return gk(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?vH(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let i="HH:mm:ss.SSS";return(r||t)&&(n&&(i+=" "),r?i+="z":t&&(i+="ZZ")),gk(this,i,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():_H}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};let r={...this.c};return t.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,r="milliseconds",n={}){if(!this.isValid||!t.isValid)return wi.invalid("created by diffing an invalid DateTime");let i={locale:this.locale,numberingSystem:this.numberingSystem,...n},s=sNt(r).map(wi.normalizeUnit),a=t.valueOf()>this.valueOf(),u=a?this:t,c=a?t:this,l=cLt(u,c,s,i);return a?l.negate():l}diffNow(t="milliseconds",r={}){return this.diff(e.now(),t,r)}until(t){return this.isValid?pg.fromDateTimes(this,t):this}hasSame(t,r,n){if(!this.isValid)return!1;let i=t.valueOf(),s=this.setZone(t.zone,{keepLocalTime:!0});return s.startOf(r,n)<=i&&i<=s.endOf(r,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;let r=t.base||e.fromObject({},{zone:this.zone}),n=t.padding?this<r?-t.padding:t.padding:0,i=["years","months","days","hours","minutes","seconds"],s=t.unit;return Array.isArray(t.unit)&&(i=t.unit,s=void 0),$Ee(r,this.plus(n),{...t,numeric:"always",units:i,unit:s})}toRelativeCalendar(t={}){return this.isValid?$Ee(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new Wi("min requires all arguments be DateTimes");return OEe(t,r=>r.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new Wi("max requires all arguments be DateTimes");return OEe(t,r=>r.valueOf(),Math.max)}static fromFormatExplain(t,r,n={}){let{locale:i=null,numberingSystem:s=null}=n,a=Nr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});return qve(a,t,r)}static fromStringExplain(t,r,n={}){return e.fromFormatExplain(t,r,n)}static buildFormatParser(t,r={}){let{locale:n=null,numberingSystem:i=null}=r,s=Nr.fromOpts({locale:n,numberingSystem:i,defaultToEN:!0});return new Rk(s,t)}static fromFormatParser(t,r,n={}){if(lt(t)||lt(r))throw new Wi("fromFormatParser requires an input string and a format parser");let{locale:i=null,numberingSystem:s=null}=n,a=Nr.fromOpts({locale:i,numberingSystem:s,defaultToEN:!0});if(!a.equals(r.locale))throw new Wi(`fromFormatParser called with a locale of ${a}, but the format parser was created for ${r.locale}`);let{result:u,zone:c,specificOffset:l,invalidReason:f}=r.explainFromTokens(t);return f?e.invalid(f):B_(u,c,n,`format ${r.format}`,t,l)}static get DATE_SHORT(){return Ek}static get DATE_MED(){return GEe}static get DATE_MED_WITH_WEEKDAY(){return Mkt}static get DATE_FULL(){return HEe}static get DATE_HUGE(){return KEe}static get TIME_SIMPLE(){return QEe}static get TIME_WITH_SECONDS(){return zEe}static get TIME_WITH_SHORT_OFFSET(){return YEe}static get TIME_WITH_LONG_OFFSET(){return JEe}static get TIME_24_SIMPLE(){return XEe}static get TIME_24_WITH_SECONDS(){return ZEe}static get TIME_24_WITH_SHORT_OFFSET(){return eve}static get TIME_24_WITH_LONG_OFFSET(){return tve}static get DATETIME_SHORT(){return rve}static get DATETIME_SHORT_WITH_SECONDS(){return nve}static get DATETIME_MED(){return ive}static get DATETIME_MED_WITH_SECONDS(){return ove}static get DATETIME_MED_WITH_WEEKDAY(){return Fkt}static get DATETIME_FULL(){return sve}static get DATETIME_FULL_WITH_SECONDS(){return ave}static get DATETIME_HUGE(){return uve}static get DATETIME_HUGE_WITH_SECONDS(){return cve}};function _A(e){if(pn.isDateTime(e))return e;if(e&&e.valueOf&&Pp(e.valueOf()))return pn.fromJSDate(e);if(e&&typeof e=="object")return pn.fromObject(e);throw new Wi(`Unknown datetime argument: ${e}, of type ${typeof e}`)}o(_A,"friendlyDateTime");var OLt="3.7.1";da.DateTime=pn;da.Duration=wi;da.FixedOffsetZone=fa;da.IANAZone=qf;da.Info=dg;da.Interval=pg;da.InvalidZone=vk;da.Settings=Xr;da.SystemZone=TA;da.VERSION=OLt;da.Zone=kp});var Hve=R((len,Gve)=>{"use strict";var mg=Vve();mt.prototype.addYear=function(){this._date=this._date.plus({years:1})};mt.prototype.addMonth=function(){this._date=this._date.plus({months:1}).startOf("month")};mt.prototype.addDay=function(){this._date=this._date.plus({days:1}).startOf("day")};mt.prototype.addHour=function(){var e=this._date;this._date=this._date.plus({hours:1}).startOf("hour"),this._date<=e&&(this._date=this._date.plus({hours:1}))};mt.prototype.addMinute=function(){var e=this._date;this._date=this._date.plus({minutes:1}).startOf("minute"),this._date<e&&(this._date=this._date.plus({hours:1}))};mt.prototype.addSecond=function(){var e=this._date;this._date=this._date.plus({seconds:1}).startOf("second"),this._date<e&&(this._date=this._date.plus({hours:1}))};mt.prototype.subtractYear=function(){this._date=this._date.minus({years:1})};mt.prototype.subtractMonth=function(){this._date=this._date.minus({months:1}).endOf("month").startOf("second")};mt.prototype.subtractDay=function(){this._date=this._date.minus({days:1}).endOf("day").startOf("second")};mt.prototype.subtractHour=function(){var e=this._date;this._date=this._date.minus({hours:1}).endOf("hour").startOf("second"),this._date>=e&&(this._date=this._date.minus({hours:1}))};mt.prototype.subtractMinute=function(){var e=this._date;this._date=this._date.minus({minutes:1}).endOf("minute").startOf("second"),this._date>e&&(this._date=this._date.minus({hours:1}))};mt.prototype.subtractSecond=function(){var e=this._date;this._date=this._date.minus({seconds:1}).startOf("second"),this._date>e&&(this._date=this._date.minus({hours:1}))};mt.prototype.getDate=function(){return this._date.day};mt.prototype.getFullYear=function(){return this._date.year};mt.prototype.getDay=function(){var e=this._date.weekday;return e==7?0:e};mt.prototype.getMonth=function(){return this._date.month-1};mt.prototype.getHours=function(){return this._date.hour};mt.prototype.getMinutes=function(){return this._date.minute};mt.prototype.getSeconds=function(){return this._date.second};mt.prototype.getMilliseconds=function(){return this._date.millisecond};mt.prototype.getTime=function(){return this._date.valueOf()};mt.prototype.getUTCDate=function(){return this._getUTC().day};mt.prototype.getUTCFullYear=function(){return this._getUTC().year};mt.prototype.getUTCDay=function(){var e=this._getUTC().weekday;return e==7?0:e};mt.prototype.getUTCMonth=function(){return this._getUTC().month-1};mt.prototype.getUTCHours=function(){return this._getUTC().hour};mt.prototype.getUTCMinutes=function(){return this._getUTC().minute};mt.prototype.getUTCSeconds=function(){return this._getUTC().second};mt.prototype.toISOString=function(){return this._date.toUTC().toISO()};mt.prototype.toJSON=function(){return this._date.toJSON()};mt.prototype.setDate=function(e){this._date=this._date.set({day:e})};mt.prototype.setFullYear=function(e){this._date=this._date.set({year:e})};mt.prototype.setDay=function(e){this._date=this._date.set({weekday:e})};mt.prototype.setMonth=function(e){this._date=this._date.set({month:e+1})};mt.prototype.setHours=function(e){this._date=this._date.set({hour:e})};mt.prototype.setMinutes=function(e){this._date=this._date.set({minute:e})};mt.prototype.setSeconds=function(e){this._date=this._date.set({second:e})};mt.prototype.setMilliseconds=function(e){this._date=this._date.set({millisecond:e})};mt.prototype._getUTC=function(){return this._date.toUTC()};mt.prototype.toString=function(){return this.toDate().toString()};mt.prototype.toDate=function(){return this._date.toJSDate()};mt.prototype.isLastDayOfMonth=function(){var e=this._date.plus({days:1}).startOf("day");return this._date.month!==e.month};mt.prototype.isLastWeekdayOfMonth=function(){var e=this._date.plus({days:7}).startOf("day");return this._date.month!==e.month};function mt(e,t){var r={zone:t};if(e?e instanceof mt?this._date=e._date:e instanceof Date?this._date=mg.DateTime.fromJSDate(e,r):typeof e=="number"?this._date=mg.DateTime.fromMillis(e,r):typeof e=="string"&&(this._date=mg.DateTime.fromISO(e,r),this._date.isValid||(this._date=mg.DateTime.fromRFC2822(e,r)),this._date.isValid||(this._date=mg.DateTime.fromSQL(e,r)),this._date.isValid||(this._date=mg.DateTime.fromFormat(e,"EEE, d MMM yyyy HH:mm:ss",r))):this._date=mg.DateTime.local(),!this._date||!this._date.isValid)throw new Error("CronDate: unhandled timestamp: "+JSON.stringify(e));t&&t!==this._date.zoneName&&(this._date=this._date.setZone(t))}o(mt,"CronDate");Gve.exports=mt});var zve=R((den,Qve)=>{"use strict";function hg(e){return{start:e,count:1}}o(hg,"buildRange");function Kve(e,t){e.end=t,e.step=t-e.start,e.count=2}o(Kve,"completeRangeWithItem");function QH(e,t,r){t&&(t.count===2?(e.push(hg(t.start)),e.push(hg(t.end))):e.push(t)),r&&e.push(r)}o(QH,"finalizeCurrentRange");function xLt(e){for(var t=[],r=void 0,n=0;n<e.length;n++){var i=e[n];typeof i!="number"?(QH(t,r,hg(i)),r=void 0):r?r.count===1?Kve(r,i):r.step===i-r.end?(r.count++,r.end=i):r.count===2?(t.push(hg(r.start)),r=hg(r.end),Kve(r,i)):(QH(t,r),r=hg(i)):r=hg(i)}return QH(t,r),t}o(xLt,"compactField");Qve.exports=xLt});var Jve=R((men,Yve)=>{"use strict";var CLt=zve();function DLt(e,t,r){var n=CLt(e);if(n.length===1){var i=n[0],s=i.step;if(s===1&&i.start===t&&i.end===r)return"*";if(s!==1&&i.start===t&&i.end===r-s+1)return"*/"+s}for(var a=[],u=0,c=n.length;u<c;++u){var l=n[u];if(l.count===1){a.push(l.start);continue}var s=l.step;if(l.step===1){a.push(l.start+"-"+l.end);continue}var f=l.start==0?l.count-1:l.count;l.step*f>l.end?a=a.concat(Array.from({length:l.end-l.start+1}).map(function(p,m){var h=l.start+m;return(h-l.start)%l.step===0?h:null}).filter(function(p){return p!=null})):l.end===r-l.step+1?a.push(l.start+"/"+l.step):a.push(l.start+"-"+l.end+"/"+l.step)}return a.join(",")}o(DLt,"stringifyField");Yve.exports=DLt});var eSe=R((gen,Zve)=>{"use strict";var gg=Hve(),PLt=Jve(),Xve=1e4;function Le(e,t){this._options=t,this._utc=t.utc||!1,this._tz=this._utc?"UTC":t.tz,this._currentDate=new gg(t.currentDate,this._tz),this._startDate=t.startDate?new gg(t.startDate,this._tz):null,this._endDate=t.endDate?new gg(t.endDate,this._tz):null,this._isIterator=t.iterator||!1,this._hasIterated=!1,this._nthDayOfWeek=t.nthDayOfWeek||0,this.fields=Le._freezeFields(e)}o(Le,"CronExpression");Le.map=["second","minute","hour","dayOfMonth","month","dayOfWeek"];Le.predefined={"@yearly":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@hourly":"0 * * * *"};Le.constraints=[{min:0,max:59,chars:[]},{min:0,max:59,chars:[]},{min:0,max:23,chars:[]},{min:1,max:31,chars:["L"]},{min:1,max:12,chars:[]},{min:0,max:7,chars:["L"]}];Le.daysInMonth=[31,29,31,30,31,30,31,31,30,31,30,31];Le.aliases={month:{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},dayOfWeek:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}};Le.parseDefaults=["0","*","*","*","*","*"];Le.standardValidCharacters=/^[,*\d/-]+$/;Le.dayOfWeekValidCharacters=/^[?,*\dL#/-]+$/;Le.dayOfMonthValidCharacters=/^[?,*\dL/-]+$/;Le.validCharacters={second:Le.standardValidCharacters,minute:Le.standardValidCharacters,hour:Le.standardValidCharacters,dayOfMonth:Le.dayOfMonthValidCharacters,month:Le.standardValidCharacters,dayOfWeek:Le.dayOfWeekValidCharacters};Le._isValidConstraintChar=o(function(t,r){return typeof r!="string"?!1:t.chars.some(function(n){return r.indexOf(n)>-1})},"_isValidConstraintChar");Le._parseField=o(function(t,r,n){switch(t){case"month":case"dayOfWeek":var i=Le.aliases[t];r=r.replace(/[a-z]{3}/gi,function(c){if(c=c.toLowerCase(),typeof i[c]<"u")return i[c];throw new Error('Validation error, cannot resolve alias "'+c+'"')});break}if(!Le.validCharacters[t].test(r))throw new Error("Invalid characters, got value: "+r);r.indexOf("*")!==-1?r=r.replace(/\*/g,n.min+"-"+n.max):r.indexOf("?")!==-1&&(r=r.replace(/\?/g,n.min+"-"+n.max));function s(c){var l=[];function f(h){if(h instanceof Array)for(var g=0,b=h.length;g<b;g++){var w=h[g];if(Le._isValidConstraintChar(n,w)){l.push(w);continue}if(typeof w!="number"||Number.isNaN(w)||w<n.min||w>n.max)throw new Error("Constraint error, got value "+w+" expected range "+n.min+"-"+n.max);l.push(w)}else{if(Le._isValidConstraintChar(n,h)){l.push(h);return}var E=+h;if(Number.isNaN(E)||E<n.min||E>n.max)throw new Error("Constraint error, got value "+h+" expected range "+n.min+"-"+n.max);t==="dayOfWeek"&&(E=E%7),l.push(E)}}o(f,"handleResult");var d=c.split(",");if(!d.every(function(h){return h.length>0}))throw new Error("Invalid list value format");if(d.length>1)for(var p=0,m=d.length;p<m;p++)f(a(d[p]));else f(a(c));return l.sort(Le._sortCompareFn),l}o(s,"parseSequence");function a(c){var l=1,f=c.split("/");if(f.length>2)throw new Error("Invalid repeat: "+c);return f.length>1?(f[0]==+f[0]&&(f=[f[0]+"-"+n.max,f[1]]),u(f[0],f[f.length-1])):u(c,l)}o(a,"parseRepeat");function u(c,l){var f=[],d=c.split("-");if(d.length>1){if(d.length<2)return+c;if(!d[0].length){if(!d[1].length)throw new Error("Invalid range: "+c);return+c}var p=+d[0],m=+d[1];if(Number.isNaN(p)||Number.isNaN(m)||p<n.min||m>n.max)throw new Error("Constraint error, got range "+p+"-"+m+" expected range "+n.min+"-"+n.max);if(p>m)throw new Error("Invalid range: "+c);var h=+l;if(Number.isNaN(h)||h<=0)throw new Error("Constraint error, cannot repeat at every "+h+" time.");t==="dayOfWeek"&&m%7===0&&f.push(0);for(var g=p,b=m;g<=b;g++){var w=f.indexOf(g)!==-1;!w&&h>0&&h%l===0?(h=1,f.push(g)):h++}return f}return Number.isNaN(+c)?c:+c}return o(u,"parseRange"),s(r)},"_parseField");Le._sortCompareFn=function(e,t){var r=typeof e=="number",n=typeof t=="number";return r&&n?e-t:!r&&n?1:r&&!n?-1:e.localeCompare(t)};Le._handleMaxDaysInMonth=function(e){if(e.month.length===1){var t=Le.daysInMonth[e.month[0]-1];if(e.dayOfMonth[0]>t)throw new Error("Invalid explicit day of month definition");return e.dayOfMonth.filter(function(r){return r==="L"?!0:r<=t}).sort(Le._sortCompareFn)}};Le._freezeFields=function(e){for(var t=0,r=Le.map.length;t<r;++t){var n=Le.map[t],i=e[n];e[n]=Object.freeze(i)}return Object.freeze(e)};Le.prototype._applyTimezoneShift=function(e,t,r){if(r==="Month"||r==="Day"){var n=e.getTime();e[t+r]();var i=e.getTime();n===i&&(e.getMinutes()===0&&e.getSeconds()===0?e.addHour():e.getMinutes()===59&&e.getSeconds()===59&&e.subtractHour())}else{var s=e.getHours();e[t+r]();var a=e.getHours(),u=a-s;u===2?this.fields.hour.length!==24&&(this._dstStart=a):u===0&&e.getMinutes()===0&&e.getSeconds()===0&&this.fields.hour.length!==24&&(this._dstEnd=a)}};Le.prototype._findSchedule=o(function(t){function r(w,E){for(var v=0,S=E.length;v<S;v++)if(E[v]>=w)return E[v]===w;return E[0]===w}o(r,"matchSchedule");function n(w,E){if(E<6){if(w.getDate()<8&&E===1)return!0;var v=w.getDate()%7?1:0,S=w.getDate()-w.getDate()%7,T=Math.floor(S/7)+v;return T===E}return!1}o(n,"isNthDayMatch");function i(w){return w.length>0&&w.some(function(E){return typeof E=="string"&&E.indexOf("L")>=0})}o(i,"isLInExpressions"),t=t||!1;var s=t?"subtract":"add",a=new gg(this._currentDate,this._tz),u=this._startDate,c=this._endDate,l=a.getTime(),f=0;function d(w){return w.some(function(E){if(!i([E]))return!1;var v=Number.parseInt(E[0])%7;if(Number.isNaN(v))throw new Error("Invalid last weekday of the month expression: "+E);return a.getDay()===v&&a.isLastWeekdayOfMonth()})}for(o(d,"isLastWeekdayOfMonthMatch");f<Xve;){if(f++,t){if(u&&a.getTime()-u.getTime()<0)throw new Error("Out of the timespan range")}else if(c&&c.getTime()-a.getTime()<0)throw new Error("Out of the timespan range");var p=r(a.getDate(),this.fields.dayOfMonth);i(this.fields.dayOfMonth)&&(p=p||a.isLastDayOfMonth());var m=r(a.getDay(),this.fields.dayOfWeek);i(this.fields.dayOfWeek)&&(m=m||d(this.fields.dayOfWeek));var h=this.fields.dayOfMonth.length>=Le.daysInMonth[a.getMonth()],g=this.fields.dayOfWeek.length===Le.constraints[5].max-Le.constraints[5].min+1,b=a.getHours();if(!p&&(!m||g)){this._applyTimezoneShift(a,s,"Day");continue}if(!h&&g&&!p){this._applyTimezoneShift(a,s,"Day");continue}if(h&&!g&&!m){this._applyTimezoneShift(a,s,"Day");continue}if(this._nthDayOfWeek>0&&!n(a,this._nthDayOfWeek)){this._applyTimezoneShift(a,s,"Day");continue}if(!r(a.getMonth()+1,this.fields.month)){this._applyTimezoneShift(a,s,"Month");continue}if(r(b,this.fields.hour)){if(this._dstEnd===b&&!t){this._dstEnd=null,this._applyTimezoneShift(a,"add","Hour");continue}}else if(this._dstStart!==b){this._dstStart=null,this._applyTimezoneShift(a,s,"Hour");continue}else if(!r(b-1,this.fields.hour)){a[s+"Hour"]();continue}if(!r(a.getMinutes(),this.fields.minute)){this._applyTimezoneShift(a,s,"Minute");continue}if(!r(a.getSeconds(),this.fields.second)){this._applyTimezoneShift(a,s,"Second");continue}if(l===a.getTime()){s==="add"||a.getMilliseconds()===0?this._applyTimezoneShift(a,s,"Second"):a.setMilliseconds(0);continue}break}if(f>=Xve)throw new Error("Invalid expression, loop limit exceeded");return this._currentDate=new gg(a,this._tz),this._hasIterated=!0,a},"_findSchedule");Le.prototype.next=o(function(){var t=this._findSchedule();return this._isIterator?{value:t,done:!this.hasNext()}:t},"next");Le.prototype.prev=o(function(){var t=this._findSchedule(!0);return this._isIterator?{value:t,done:!this.hasPrev()}:t},"prev");Le.prototype.hasNext=function(){var e=this._currentDate,t=this._hasIterated;try{return this._findSchedule(),!0}catch{return!1}finally{this._currentDate=e,this._hasIterated=t}};Le.prototype.hasPrev=function(){var e=this._currentDate,t=this._hasIterated;try{return this._findSchedule(!0),!0}catch{return!1}finally{this._currentDate=e,this._hasIterated=t}};Le.prototype.iterate=o(function(t,r){var n=[];if(t>=0)for(var i=0,s=t;i<s;i++)try{var a=this.next();n.push(a),r&&r(a,i)}catch{break}else for(var i=0,s=t;i>s;i--)try{var a=this.prev();n.push(a),r&&r(a,i)}catch{break}return n},"iterate");Le.prototype.reset=o(function(t){this._currentDate=new gg(t||this._options.currentDate)},"reset");Le.prototype.stringify=o(function(t){for(var r=[],n=t?0:1,i=Le.map.length;n<i;++n){var s=Le.map[n],a=this.fields[s],u=Le.constraints[n];s==="dayOfMonth"&&this.fields.month.length===1?u={min:1,max:Le.daysInMonth[this.fields.month[0]-1]}:s==="dayOfWeek"&&(u={min:0,max:6},a=a[a.length-1]===7?a.slice(0,-1):a),r.push(PLt(a,u.min,u.max))}return r.join(" ")},"stringify");Le.parse=o(function(t,r){var n=this;typeof r=="function"&&(r={});function i(s,a){a||(a={}),typeof a.currentDate>"u"&&(a.currentDate=new gg(void 0,n._tz)),Le.predefined[s]&&(s=Le.predefined[s]);var u=[],c=(s+"").trim().split(/\s+/);if(c.length>6)throw new Error("Invalid cron expression");for(var l=Le.map.length-c.length,f=0,d=Le.map.length;f<d;++f){var p=Le.map[f],m=c[c.length>d?f:f-l];if(f<l||!m)u.push(Le._parseField(p,Le.parseDefaults[f],Le.constraints[f]));else{var h=p==="dayOfWeek"?E(m):m;u.push(Le._parseField(p,h,Le.constraints[f]))}}for(var g={},f=0,d=Le.map.length;f<d;f++){var b=Le.map[f];g[b]=u[f]}var w=Le._handleMaxDaysInMonth(g);return g.dayOfMonth=w||g.dayOfMonth,new Le(g,a);function E(v){var S=v.split("#");if(S.length>1){var T=+S[S.length-1];if(/,/.test(v))throw new Error("Constraint error, invalid dayOfWeek `#` and `,` special characters are incompatible");if(/\//.test(v))throw new Error("Constraint error, invalid dayOfWeek `#` and `/` special characters are incompatible");if(/-/.test(v))throw new Error("Constraint error, invalid dayOfWeek `#` and `-` special characters are incompatible");if(S.length>2||Number.isNaN(T)||T<1||T>5)throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return a.nthDayOfWeek=T,S[0]}return v}o(E,"parseNthDay")}return o(i,"parse"),i(t,r)},"parse");Le.fieldsToExpression=o(function(t,r){function n(p,m,h){if(!m)throw new Error("Validation error, Field "+p+" is missing");if(m.length===0)throw new Error("Validation error, Field "+p+" contains no values");for(var g=0,b=m.length;g<b;g++){var w=m[g];if(!Le._isValidConstraintChar(h,w)&&(typeof w!="number"||Number.isNaN(w)||w<h.min||w>h.max))throw new Error("Constraint error, got value "+w+" expected range "+h.min+"-"+h.max)}}o(n,"validateConstraints");for(var i={},s=0,a=Le.map.length;s<a;++s){var u=Le.map[s],c=t[u];n(u,c,Le.constraints[s]);for(var l=[],f=-1;++f<c.length;)l[f]=c[f];if(c=l.sort(Le._sortCompareFn).filter(function(p,m,h){return!m||p!==h[m-1]}),c.length!==l.length)throw new Error("Validation error, Field "+u+" contains duplicate values");i[u]=c}var d=Le._handleMaxDaysInMonth(i);return i.dayOfMonth=d||i.dayOfMonth,new Le(i,r||{})},"fieldsToExpression");Zve.exports=Le});var rSe=R((ben,tSe)=>{"use strict";var Dk=eSe();function Np(){}o(Np,"CronParser");Np._parseEntry=o(function(t){var r=t.split(" ");if(r.length===6)return{interval:Dk.parse(t)};if(r.length>6)return{interval:Dk.parse(r.slice(0,6).join(" ")),command:r.slice(6,r.length)};throw new Error("Invalid entry: "+t)},"_parseEntry");Np.parseExpression=o(function(t,r){return Dk.parse(t,r)},"parseExpression");Np.fieldsToExpression=o(function(t,r){return Dk.fieldsToExpression(t,r)},"fieldsToExpression");Np.parseString=o(function(t){for(var r=t.split(`
5
5
  `),n={variables:{},expressions:[],errors:{}},i=0,s=r.length;i<s;i++){var a=r[i],u=null,c=a.trim();if(c.length>0){if(c.match(/^#/))continue;if(u=c.match(/^(.*)=(.*)$/))n.variables[u[1]]=u[2];else{var l=null;try{l=Np._parseEntry("0 "+c),n.expressions.push(l.interval)}catch(f){n.errors[c]=f}}}}return n},"parseString");Np.parseFile=o(function(t,r){require("fs").readFile(t,function(n,i){if(n){r(n);return}return r(null,Np.parseString(i.toString()))})},"parseFile");tSe.exports=Np});function NLt(e){let t=[];for(let r of e){r.includes(nSe)&&(r=r.split(nSe)[0].trim());for(let[n,i]of Object.entries(kLt))r.includes(n)&&(r=r.replace(new RegExp(n,"g"),i));t.push(r)}return t}function sSe(e,t=4){let r=oSe.default.parseExpression(e),n=[];for(let i=0;i<t;i++)n.push(r.next().toString());return n}function aSe(e){let t=(0,iSe.default)(e,{preset:"npm-cron-schedule",override:{useSeconds:!1}});return t.isValid()?{valid:!0}:{valid:!1,err:NLt(t.getError())}}var iSe,oSe,nSe,kLt,uSe=y(()=>{"use strict";iSe=q(al()),oSe=q(rSe()),nSe="(Input cron: ",kLt={"smaller than lower limit":"less than","bigger than upper limit":"greater than",daysOfMonth:"'days of the month'",daysOfWeek:"'days of the week'",years:"'years'",months:"'months'",hours:"'hours'",minutes:"'minutes'",seconds:"'seconds'"};o(NLt,"improveErrors");o(sSe,"getNextExecutionDates");o(aSe,"validate")});var xA={};G(xA,{decodeNonAscii:()=>zH,encodeNonAscii:()=>MLt,isDeprecatedSingleUserColumn:()=>LLt,isNumeric:()=>FLt,isRequired:()=>ULt});function LLt(e){return e.type==="bb_reference"&&e.subtype==="user"&&e.constraints?.type!=="array"}function ULt(e){return!!e&&(typeof e.presence!="boolean"&&e.presence?.allowEmpty===!1||e.presence===!0)}function MLt(e){return e.split("").map(t=>t.charCodeAt(0)>127?"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"):t).join("")}function zH(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,(t,r)=>String.fromCharCode(parseInt(r,16)))}function FLt(e){return e.type==="number"||e.type==="bigint"}var YH=y(()=>{"use strict";P();o(LLt,"isDeprecatedSingleUserColumn");o(ULt,"isRequired");o(MLt,"encodeNonAscii");o(zH,"decodeNonAscii");o(FLt,"isNumeric")});var JH={};G(JH,{normalizeSchemaForStructuredOutput:()=>BLt});function BLt(e){function t(n){if(typeof n!="object"||n===null)return n;let i={...n};if(i.type==="object"&&(i.additionalProperties=!1,i.properties&&typeof i.properties=="object"&&i.properties!==null)){let s=i.properties,a=[],u={};for(let[f,d]of Object.entries(s))if(typeof d=="object"&&d!==null){let p=d;if(p.required===!0){a.push(f);let{required:m,...h}=p;u[f]=t(h)}else u[f]=t(p)}else u[f]=d;i.properties=u;let c=Array.isArray(i.required)?i.required:[],l=[...new Set([...c,...a])];l.length>0?i.required=l:i.required=Object.keys(u)}i.type==="array"&&i.items&&typeof i.items=="object"&&i.items!==null&&(i.items=t(i.items));for(let s of["anyOf","oneOf","allOf"])Array.isArray(i[s])&&(i[s]=i[s].map(a=>t(a)));return i}o(t,"processSchema");let r=t(e);return r.type==="array"?r={type:"object",properties:{items:r},required:["items"],additionalProperties:!1}:r.type!=="object"&&(r={type:"object",properties:{value:r},required:["value"],additionalProperties:!1}),r}var cSe=y(()=>{"use strict";o(BLt,"normalizeSchemaForStructuredOutput")});var ZH={};G(ZH,{basicFields:()=>GLt,calculationFields:()=>VLt,hasCalculationFields:()=>$Lt,isBasicViewField:()=>WLt,isCalculationField:()=>CA,isCalculationView:()=>jLt,isV2:()=>HLt,isVisible:()=>lSe});function CA(e){return"calculationType"in e}function WLt(e){return!CA(e)}function jLt(e){return e.type==="calculation"}function $Lt(e){return Object.values(e.schema||{}).some(CA)}function VLt(e){return(0,XH.default)(e.schema||{},CA)}function lSe(e){return e.visible!==!1}function GLt(e,t){let{visible:r=!0}=t||{};return(0,XH.default)(e.schema||{},n=>!CA(n)&&(!r||lSe(n)))}function HLt(e){return e.version===2}var XH,fSe=y(()=>{"use strict";P();XH=q(require("lodash/pickBy"));o(CA,"isCalculationField");o(WLt,"isBasicViewField");o(jLt,"isCalculationView");o($Lt,"hasCalculationFields");o(VLt,"calculationFields");o(lSe,"isVisible");o(GLt,"basicFields");o(HLt,"isV2")});var e4={};G(e4,{checkForRoleInheritanceLoops:()=>QLt});function KLt(e){return`role${fe}${e}`}function QLt(e){let t=new Map;e.forEach(s=>{t.set(s._id,s)});let r=new Set,n=new Set;function i(s){let a=KLt(s);if(n.has(s)||n.has(a))return!0;if(r.has(s)||r.has(a))return!1;n.add(s);let u=t.get(a)||t.get(s);if(!u)return n.delete(s),!1;let c=Array.isArray(u.inherits)?u.inherits:[u.inherits];for(let l of c)if(l&&i(l))return!0;return n.delete(s),r.add(s),!1}return o(i,"hasLoop"),!!e.find(s=>i(s._id))}var dSe=y(()=>{"use strict";P();o(KLt,"prefixForCheck");o(QLt,"checkForRoleInheritanceLoops")});var t4={};G(t4,{punctuateList:()=>zLt});function zLt(e){return e.length===0?"":e.length===1?e[0]:e.length===2?e.join(" and "):e.slice(0,-1).join(", ")+" and "+e[e.length-1]}var pSe=y(()=>{"use strict";o(zLt,"punctuateList")});var YLt,JLt,mSe=y(()=>{"use strict";YLt=o((e,t)=>{let r=new RegExp("\\s(\\d+)$"),n=e.split(r)[0],i=new RegExp(`${n}\\s(\\d+)$`),s=[];t.filter(u=>{if(u===n)return!0;let c=u.match(i);return c?(s.push(parseInt(c[1])),!0):!1}),s.sort((u,c)=>u-c);let a;if(s.length===0)a=1;else{for(let u=0;u<s.length;u++)if(s[u]!==u+1){a=u+1;break}a||(a=s.length+1)}return`${n} ${a}`},"duplicateName"),JLt=o((e,t,{getName:r,numberFirstItem:n,separator:i=""}={})=>{if(!t?.length)return"";let s=t.trim(),a=n?`${t}1`:s;if(!e?.length)return a;let u=0;return e.forEach(c=>{let l=r?.(c)??c;if(typeof l!="string"||!l.startsWith(s))return;let f=l.split(s);if(f.length!==2)return;f[1].trim()===""&&(f[1]="1");let d=parseInt(f[1]);d>u&&(u=d)}),u===0?a:`${t}${i}${u+1}`},"getSequentialName")});var XLt,ZLt,Lp,hSe,gSe,ySe,bSe,_Se,wSe,ESe,vSe,eUt,SSe=y(()=>{"use strict";SG();XLt=o(e=>e?e.startsWith("/")?e:`/${e}`:"","normalizePath"),ZLt=o(e=>e?e.endsWith("/")?e.slice(0,-1):e:"","normalizeBase"),Lp=o((e,t)=>{let r=XLt(t);if(!e)return r;let n=ZLt(e);return r?`${n}${r}`:n},"joinBaseAndPath"),hSe=o(e=>Lp(e,HP.ACCOUNT),"accountPortalAccountUrl"),gSe=o(e=>Lp(e,HP.BILLING),"accountPortalBillingUrl"),ySe=o(e=>Lp(e,HP.UPGRADE),"accountPortalUpgradeUrl"),bSe=o(e=>Lp(e,C_.WORKSPACES),"builderWorkspacesUrl"),_Se=o(e=>Lp(e,C_.SETTINGS_EMAIL),"builderSettingsEmailUrl"),wSe=o(e=>Lp(e,C_.SETTINGS_AUTH),"builderSettingsAuthUrl"),ESe=o(e=>Lp(e,C_.SETTINGS_PEOPLE_USERS),"builderSettingsPeopleUsersUrl"),vSe=o(e=>Lp(e,C_.APPS),"builderAppsUrl"),eUt={accountPortalAccountUrl:hSe,accountPortalBillingUrl:gSe,accountPortalUpgradeUrl:ySe,builderWorkspacesUrl:bSe,builderSettingsEmailUrl:_Se,builderSettingsAuthUrl:wSe,builderSettingsPeopleUsersUrl:ESe,builderAppsUrl:vSe}});function tUt(e,t=""){let r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],i=0,s=typeof e=="string"?parseInt(e,10):e||0;for(;s>=1024&&i<r.length-1&&++i;)s/=1024;return`${s.toFixed(s<10&&i>0?1:0)}${t}${r[i]}`}var TSe=y(()=>{"use strict";o(tUt,"formatBytes")});var _e={};G(_e,{accountPortalAccountUrl:()=>hSe,accountPortalBillingUrl:()=>gSe,accountPortalUpgradeUrl:()=>ySe,builderAppsUrl:()=>vSe,builderSettingsAuthUrl:()=>wSe,builderSettingsEmailUrl:()=>_Se,builderSettingsPeopleUsersUrl:()=>ESe,builderWorkspacesUrl:()=>bSe,cancelableTimeout:()=>M_e,cron:()=>rUt,deepGet:()=>OG,duplicateName:()=>YLt,formatBytes:()=>tUt,getSequentialName:()=>JLt,getUserColor:()=>qDt,getUserInitials:()=>BDt,getUserLabel:()=>WDt,isGoogleSheets:()=>$Dt,isSQL:()=>VDt,lists:()=>t4,retry:()=>GDt,roles:()=>e4,schema:()=>xA,structuredOutput:()=>JH,urlHelpers:()=>eUt,views:()=>ZH,wait:()=>xG,withTimeout:()=>jDt});var rUt,r4=y(()=>{"use strict";F_e();B_e();CG();q_e();uSe();YH();cSe();fSe();dSe();pSe();mSe();SSe();TSe();rUt={getNextExecutionDates:sSe,validate:aSe}});var Kt={};G(Kt,{ColumnSplitter:()=>i4,NoEmptyFilterStrings:()=>ISe,buildQuery:()=>OSe,cleanupQuery:()=>a4,fixupFilterArrays:()=>c4,getKeyNumbering:()=>u4,getValidOperatorsForType:()=>sUt,hasFilters:()=>o4,limit:()=>CSe,recurseLogicalOperators:()=>s4,removeKeyNumbering:()=>QP,runQuery:()=>kk,search:()=>cUt,sort:()=>xSe,splitFiltersArray:()=>zP});function s4(e,t){for(let r of RSe)e[r]&&(e[r].conditions=e[r].conditions.map(n=>t(n)));return e}function aUt(e){return Array.isArray(e)&&e.length===0}function uUt(e){if(!e||!e?.operator||!e?.field)return;let t={},{operator:r,field:n,type:i,externalType:s}=e,{value:a}=e;(r==="empty"||r==="notEmpty")&&(a=null);let u=typeof a=="string"&&(a.match(iUt)||[]).length>0;switch(i){case"datetime":if(!u&&r!=="empty"&&r!=="notEmpty"){if(!a)return;if(typeof a=="string")a=new Date(a).toISOString();else if(IP(r))return t[r]??={},t[r][n]=a,t}break;case"number":typeof a=="string"&&!u&&(r==="oneOf"?a=a.split(",").map(parseFloat):a=parseFloat(a));break;case"boolean":a=`${a}`.toLowerCase()==="true";break;case"array":["contains","notContains","containsAny"].includes(r.toLocaleString())&&typeof a=="string"&&(a=a.split(","));break}if(IP(r)){let l=C_e[s]||{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER};t[r]??={},t[r][n]={low:i==="number"?l.min:"0000-00-00T00:00:00.000Z",high:i==="number"?l.max:"9999-00-00T00:00:00.000Z"}}else if(r==="rangeHigh"&&a!=null&&a!=="")t.range??={},t.range[n]={...t.range[n],high:a};else if(r==="rangeLow"&&a!=null&&a!=="")t.range??={},t.range[n]={...t.range[n],low:a};else if(Oge(r)||xge(r)||IP(r))i==="boolean"?r==="equal"&&a===!1?(t.notEqual=t.notEqual||{},t.notEqual[n]=!0):r==="notEqual"&&a===!1?(t.equal=t.equal||{},t.equal[n]=!0):(t[r]??={},t[r][n]=a):(t[r]??={},t[r][n]=a);else throw new Error(`Unsupported operator: ${r}`);return t}function zP(e){let t={filters:[]};for(let r of e)"operator"in r&&r.operator==="allOr"?t.allOr=!0:"onEmptyFilter"in r?t.onEmptyFilter=r.onEmptyFilter:t.filters.push(r);return t}function OSe(e){if(!e)return{};if(Array.isArray(e)&&(e=AG(e),!e))return{};let t={};e.onEmptyFilter?t.onEmptyFilter=e.onEmptyFilter:t.onEmptyFilter="all";let r=ASe(e.logicalOperator||"all");return t[r]={conditions:(e.groups||[]).map(n=>{if(n.groups){let c=OSe(n);return delete c.onEmptyFilter,c}let{allOr:i,onEmptyFilter:s,filters:a}=zP(n.filters||[]);s&&(t.onEmptyFilter=s);let u=i?"$or":"$and";return n.logicalOperator&&(u=ASe(n.logicalOperator)),{[u]:{conditions:a.map(uUt).filter(c=>c)}}})},t}function ASe(e){return e==="all"?"$and":"$or"}function c4(e){if(!e)return e;for(let t of Object.values(oa)){let r=e[t];if(!(r==null||!(0,Pk.default)(r)))for(let n of Object.keys(r)){if(Array.isArray(r[n]))continue;let i=r[n];typeof i=="string"?r[n]=i.split(",").map(s=>s.trim()):r[n]=[i]}}return s4(e,c4),e}function cUt(e,t){let r=kk(e,t.query);t.sort&&(r=xSe(r,t.sort,t.sortOrder||"ascending",t.sortType));let n=r.length;t.limit&&(r=CSe(r,t.limit.toString()));let i={rows:r};return t.countRows&&(i.totalRows=n),i}function kk(e,t){if(!e||!Array.isArray(e))return[];if(!t)return e;if(t=a4(t),t=c4(t),!o4(t)&&t.onEmptyFilter==="none")return[];let r=o((T,x)=>O=>{for(let[C,D]of Object.entries(t[T]||{})){let N=Sp(T)?O:OG(O,QP(C)),k=x(N,D);if(t.allOr&&k)return!0;if(!t.allOr&&!k)return!1}return!t.allOr},"match"),n=r("string",(T,x)=>typeof T!="string"||typeof x!="string"?!1:T.toLowerCase().startsWith(x.toLowerCase())),i=r("fuzzy",(T,x)=>typeof T!="string"||typeof x!="string"?!1:T.toLowerCase().includes(x.toLowerCase())),s=r("range",(T,x)=>{if(T==null||T===""||((0,Pk.default)(x.low)&&(0,n4.default)(x.low)&&(x.low=void 0),(0,Pk.default)(x.high)&&(0,n4.default)(x.high)&&(x.high=void 0),x.low==null&&x.high==null))return!1;let O=+T;if(!isNaN(O)){let D=+x.low,N=+x.high;if(!isNaN(D)&&!isNaN(N))return O>=D&&O<=N;if(isNaN(D)){if(!isNaN(N))return O<=N}else return O>=D}let C=(0,K_.default)(T);if(C.isValid()){let D=(0,K_.default)(x.low||"0000-00-00T00:00:00.000Z"),N=(0,K_.default)(x.high||"9999-00-00T00:00:00.000Z");if(D.isValid()&&N.isValid())return C.isAfter(D)&&C.isBefore(N)||C.isSame(D)||C.isSame(N);if(D.isValid())return C.isAfter(D)||C.isSame(D);if(N.isValid())return C.isBefore(N)||C.isSame(N)}return x.low!=null&&x.high!=null?T>=x.low&&T<=x.high:x.low!=null?T>=x.low:x.high!=null?T<=x.high:!1}),a=o((T,x)=>{if(Array.isArray(T)){for(let C of T)if(a(C,x))return!0;return!1}if(T&&typeof T=="object"&&typeof x=="string")return T._id===x;if(T===x)return!0;if(T==null&&x!=null||T!=null&&x==null)return!1;let O=(0,K_.default)(T);if(O.isValid()){let C=(0,K_.default)(x);if(C.isValid())return O.isSame(C)}return!1},"_valueMatches"),u=o(T=>(...x)=>!T(...x),"not"),c=r("equal",a),l=r("notEqual",u(a)),f=o(T=>typeof T=="string"?T==="":Array.isArray(T)?T.length===0:T&&typeof T=="object"?Object.keys(T).length===0:T==null,"_empty"),d=r("empty",f),p=r("notEmpty",u(f)),m=r("oneOf",(T,x)=>(typeof x=="string"&&(x=x.split(",")),typeof T=="number"&&(x=x.map(O=>parseFloat(O))),Array.isArray(x)?x.some(O=>a(T,O)):!1)),h=o(T=>(x,O)=>!Array.isArray(x)||(typeof O=="string"&&(O=O.split(","),typeof x[0]=="number"&&(O=O.map(C=>parseFloat(C)))),!Array.isArray(O))?!1:O.length===0?!0:O[T](C=>a(x,C)),"_contains"),g=r("contains",(T,x)=>Array.isArray(x)&&x.length===0?!0:h("every")(T,x)),b=r("notContains",(T,x)=>Array.isArray(x)&&x.length===0?!0:u(h("every"))(T,x)),w=r("containsAny",h("some")),E=r("$and",(T,x)=>{if(!x.length)return!1;for(let O of x)if(!kk([T],O).length)return!1;return!0}),v=r("$or",(T,x)=>{if(!x.length)return!1;for(let O of x)if(kk([T],{...O,allOr:!0}).length)return!0;return!1}),S=o(T=>{let x={string:n,fuzzy:i,range:s,equal:c,notEqual:l,empty:d,notEmpty:p,oneOf:m,contains:g,containsAny:w,notContains:b,$and:E,$or:v},O=Object.entries(t||{}).filter(([C,D])=>!["allOr","onEmptyFilter"].includes(C)&&D&&Object.keys(D).length>0).map(([C])=>x[C]?.(T)??!1);return o4(t)?t.allOr?O.some(C=>C===!0):O.every(C=>C===!0):!0},"docMatch");return e.filter(S)}function xSe(e,t,r,n="string"){if(!t||!r||!n)return e;let i=o(s=>s==null?s:n==="string"?`${s}`:parseFloat(s),"parse");return e.slice().sort((s,a)=>{let u=i(s[t]),c=i(a[t]),l=c==null||u>c?1:-1;return r.toLowerCase()==="descending"?l*-1:l})}function CSe(e,t){let r=typeof t=="number"?t:parseFloat(t);return isNaN(r)?e:e.slice(0,r)}var K_,Pk,n4,iUt,RSe,oUt,sUt,ISe,a4,QP,u4,i4,o4,IG=y(()=>{"use strict";P();K_=q(require("dayjs"));WT();RG();r4();Pk=q(require("lodash/isPlainObject")),n4=q(require("lodash/isEmpty"));YH();iUt=/{{([^{].*?)}}/g,RSe=Object.values(T_),oUt=[...Object.values(il),...Object.values(oa),...Object.values(Df)],sUt=o((e,t,r)=>{let n=aa,i=[n.Equals,n.NotEquals,n.StartsWith,n.Like,n.Empty,n.NotEmpty,n.In],s=[n.Equals,n.NotEquals,n.MoreThan,n.LessThan,n.Empty,n.NotEmpty,n.In],a=[n.Contains,n.NotContains,n.ContainsAny,n.Empty,n.NotEmpty],u=[],{type:c,formulaType:l,subtype:f}=e;c==="string"?f==="array"?u=a:u=i:c==="number"||c==="bigint"?u=s:c==="options"?u=[n.Equals,n.NotEquals,n.Empty,n.NotEmpty,n.In]:c==="array"?u=a:c==="boolean"?u=[n.Equals,n.NotEquals,n.Empty,n.NotEmpty]:c==="longform"?u=i:c==="datetime"?u=s:c==="formula"&&l==="static"?u=i.concat([n.MoreThan,n.LessThan]):c==="ai"?u=i.concat([n.MoreThan,n.LessThan]):c==="bb_reference_single"||xA.isDeprecatedSingleUserColumn(e)?u=[n.Equals,n.NotEquals,n.Empty,n.NotEmpty,n.In]:c==="bb_reference"?u=a:c==="barcodeqr"?u=i:c==="link"&&(u=[n.Empty,n.NotEmpty]);let d=r?.tableId?.includes("datasource_plus");return t==="_id"&&d&&(u=[n.Equals,n.NotEquals,n.In]),u},"getValidOperatorsForType"),ISe=[aa.StartsWith.value,aa.Like.value,aa.Equals.value,aa.NotEquals.value,aa.Contains.value,aa.NotContains.value,aa.ContainsAny.value,aa.In.value];o(s4,"recurseLogicalOperators");a4=o(e=>{for(let t of ISe)if(e[t])for(let r of Object.keys(e)){if(r!==t)continue;if(typeof e[r]=="object")for(let[i,s]of Object.entries(e[r]))(s==null||s===""||aUt(s))&&delete e[t][i]}return e=s4(e,a4),e},"cleanupQuery");o(aUt,"isEmptyArray");QP=o(e=>u4(e).key,"removeKeyNumbering"),u4=o(e=>{if(typeof e=="string"&&e.match(/\d[0-9]*:/g)!=null){let t=e.split(":");return{prefix:`${t.shift()}:`,key:t.join(":")}}else return{key:e}},"getKeyNumbering"),i4=class{static{o(this,"ColumnSplitter")}constructor(t,r){if(this.tableNames=t.map(n=>n.name),this.tableIds=t.map(n=>n._id),this.relationshipColumnNames=t.flatMap(n=>Object.keys(n.schema).filter(i=>n.schema[i].type==="link")),this.relationships=this.tableNames.concat(this.tableIds).concat(this.relationshipColumnNames).sort((n,i)=>i.length-n.length),r?.aliases){this.aliases={};for(let[n,i]of Object.entries(r.aliases))this.aliases[i]=n}this.columnPrefix=r?.columnPrefix}run(t){let{prefix:r,key:n}=u4(t),i;if(this.aliases)for(let a of Object.keys(this.aliases||{})){let u=`${a}.`;n.startsWith(u)&&(i=this.aliases[a],n=n.slice(u.length))}let s;for(let a of this.relationships){let u=`${a}.`;if(n.startsWith(u)){let c=n.split(u);c.shift(),s=u,n=c.join(".");break}}return this.columnPrefix&&n.startsWith(this.columnPrefix)&&(n=zH(n.slice(this.columnPrefix.length))),{tableName:i,numberPrefix:r,relationshipPrefix:s,column:n}}};o(uUt,"buildCondition");o(zP,"splitFiltersArray");o(OSe,"buildQuery");o(ASe,"logicalOperatorFromUI");o(c4,"fixupFilterArrays");o(cUt,"search");o(kk,"runQuery");o(xSe,"sort");o(CSe,"limit");o4=o(e=>{if(!e)return!1;let t=o(r=>{for(let n of RSe)if(r[n])for(let i of r[n]?.conditions||[]){let s=t(i);if(s)return s}for(let n of oUt){let i=r[n];if(!i||typeof i!="object")continue;if(Object.entries(i).filter(a=>{let u=a[1]!==void 0||a[1]!==null||a[1]!=="";return n==="notEmpty"||u}).length!==0)return!0}return!1},"check");return t(e)},"hasFilters")});var f4={};G(f4,{getDevAppID:()=>lUt,getProdAppID:()=>PA});function lUt(e){if(!e)throw new Error("No app ID provided");if(e.startsWith(DA))return e;let t=e.split(l4);t.shift();let r=t.join(l4);return`${DA}${r}`}function PA(e){if(!e)throw new Error("No app ID provided");if(!e.startsWith(DA))return e;let t=e.split(DA);t.shift();let r=t.join(DA);return`${l4}${r}`}var l4,DA,d4=y(()=>{"use strict";P();l4=Ao("app"),DA=Ao("app_dev");o(lUt,"getDevAppID");o(PA,"getProdAppID")});var m4={};G(m4,{checkForCollectStep:()=>p4,isAppAction:()=>pUt,isRowAction:()=>fUt,isWebhookAction:()=>dUt});function fUt(e){return e.definition.trigger?.stepId==="ROW_ACTION"}function dUt(e){return e.definition.trigger?.stepId==="WEBHOOK"}function pUt(e){return e.definition.trigger?.stepId==="APP"}function DSe(e){if(!e||!Array.isArray(e))return!1;for(let t of e){if(t.stepId==="COLLECT")return!0;if(Jye(t)&&t.inputs.children){for(let r of Object.values(t.inputs.children))if(DSe(r))return!0}}return!1}function p4(e){return DSe(e.definition.steps)}var h4=y(()=>{"use strict";P();o(fUt,"isRowAction");o(dUt,"isWebhookAction");o(pUt,"isAppAction");o(DSe,"hasCollectBlockRecursive");o(p4,"checkForCollectStep")});var b4={};G(b4,{canCreateApps:()=>mUt,containsUserID:()=>vUt,getGlobalUserID:()=>EUt,getUserAppGroups:()=>SUt,hasAdminPermissions:()=>y4,hasAppBuilderPermissions:()=>Uk,hasBuilderPermissions:()=>_Ut,hasCreatorPermissions:()=>Mk,isAdmin:()=>kA,isAdminOrBuilder:()=>gUt,isAdminOrGlobalBuilder:()=>yUt,isAdminOrWorkspaceBuilder:()=>hUt,isBuilder:()=>g4,isCreator:()=>wUt,isGlobalBuilder:()=>Lk,userAppAccessList:()=>TUt});function g4(e,t){return e?e.builder?.global?!0:!!(t&&e.builder?.apps?.includes(PA(t))):!1}function Lk(e){return g4(e)&&!Uk(e)||kA(e)}function mUt(e){return Lk(e)||Mk(e)}function kA(e){return e?y4(e):!1}function hUt(e,t){return e?!!(kA(e)||t&&e.builder?.apps?.includes(PA(t))):!1}function gUt(e,t){return g4(e,t)||kA(e)}function yUt(e){return Lk(e)||kA(e)}function Uk(e){if(!e)return!1;let t=e.builder?.apps?.length;return!!!e.builder?.global&&t!=null&&t>0}function bUt(e){return e?!!Object.values(e.roles??{}).find(t=>t==="CREATOR"):!1}function _Ut(e){return e?e.builder?.global||Uk(e)||Mk(e):!1}function y4(e){return e?!!e.admin?.global:!1}function Mk(e){return e?!!e.builder?.creator:!1}function wUt(e){return e?Lk(e)||y4(e)||Mk(e)||Uk(e)||bUt(e):!1}function EUt(e){if(typeof e!="string")return e;let t=`ro${fe}ta_users${fe}`;return e.startsWith(t)?e.split(t)[1]:e}function vUt(e){return typeof e!="string"?!1:e.includes(`us${fe}`)}function PSe(e,t){return t?.filter(r=>r.users?.find(n=>n._id===e))||[]}function SUt(e,t,r){let n=PA(e);return PSe(t,r).filter(s=>Object.keys(s.roles||{}).find(a=>a===n))}function TUt(e,t){let n=PSe(e._id,t).flatMap(s=>Object.keys(s.roles||{})),i=[...Object.keys(e?.roles||{}),...n];return[...new Set(i)]}var kSe=y(()=>{"use strict";P();d4();o(g4,"isBuilder");o(Lk,"isGlobalBuilder");o(mUt,"canCreateApps");o(kA,"isAdmin");o(hUt,"isAdminOrWorkspaceBuilder");o(gUt,"isAdminOrBuilder");o(yUt,"isAdminOrGlobalBuilder");o(Uk,"hasAppBuilderPermissions");o(bUt,"hasAppCreatorPermissions");o(_Ut,"hasBuilderPermissions");o(y4,"hasAdminPermissions");o(Mk,"hasCreatorPermissions");o(wUt,"isCreator");o(EUt,"getGlobalUserID");o(vUt,"containsUserID");o(PSe,"getUserGroups");o(SUt,"getUserAppGroups");o(TUt,"userAppAccessList")});var _4={};G(_4,{findInSettings:()=>AUt});function AUt(e,t){let r=[];function n(i,s=""){for(let[a,u]of Object.entries(i))u&&(typeof u=="string"&&u.includes(t)?r.push({setting:s?`${s}.${a}`:a,value:u}):typeof u=="object"&&n(u,a))}return o(n,"recurse"),n(e.props),r}var NSe=y(()=>{"use strict";o(AUt,"findInSettings")});var LSe=y(()=>{"use strict";d4();h4();kSe();NSe()});var rr={};G(rr,{applications:()=>f4,automations:()=>m4,screens:()=>_4,users:()=>b4});var USe=y(()=>{"use strict";LSe()});function MSe(e){return!!RUt[e]}function FSe(e){let t=Object.keys(e.schema),r=t.map(s=>s.toLowerCase()),n=new Set(r),i=[];if(n.size!==r.length)for(let s of n.keys())r.filter(u=>u===s).length>1&&i.push(s);for(let s of ai)t.find(a=>a===s)&&i.push(s);return i}var RUt,Btn,qtn,BSe=y(()=>{"use strict";P();WT();RUt={string:!0,longform:!0,options:!0,number:!0,datetime:!0,formula:!0,ai:!0,auto:!0,internal:!0,barcodeqr:!0,bigint:!0,boolean:!1,array:!1,attachment:!1,attachment_single:!1,signature_single:!1,link:!1,json:!1,bb_reference:!1,bb_reference_single:!1},Btn={string:!0,longform:!0,options:!0,number:!0,datetime:!0,auto:!0,internal:!0,barcodeqr:!0,bigint:!0,boolean:!0,json:!1,formula:!1,ai:!1,attachment:!1,attachment_single:!1,signature_single:!1,array:!1,link:!1,bb_reference:!1,bb_reference_single:!1},qtn={number:!0,json:!0,datetime:!0,longform:!0,string:!0,options:!0,array:!0,bigint:!0,boolean:!0,auto:!1,internal:!1,barcodeqr:!1,formula:!1,ai:!1,attachment:!1,attachment_single:!1,signature_single:!1,link:!1,bb_reference:!0,bb_reference_single:!0};o(MSe,"canBeDisplayColumn");o(FSe,"findDuplicateInternalColumns")});var qSe,WSe=y(()=>{"use strict";vG();P();qSe=o((e,t="darkest")=>e?(e.startsWith(EG)&&(e=e.split(EG)[1]),x_e.some(r=>r.id===e)?e:e==="lightest"?"light":e==="dark"?"darkest":t):t,"ensureValidTheme")});var w4={};G(w4,{definition:()=>IUt});var IUt,jSe=y(()=>{"use strict";P();IUt={name:"Bash Scripting",tagline:"Execute a bash command",icon:"git-branch",description:"Run a bash script",type:"ACTION",internal:!0,features:{LOOPING:!0},stepId:"EXECUTE_BASH",inputs:{},schema:{inputs:{properties:{code:{type:"string",customType:"code",title:"Code"}},required:["code"]},outputs:{properties:{stdout:{type:"string",description:"Standard output of your bash command or script"},success:{type:"boolean",description:"Whether the command was successful"}},required:["stdout"]}}}});var E4={};G(E4,{definition:()=>OUt});var OUt,$Se=y(()=>{"use strict";P();OUt={name:"Branch",icon:"git-branch",tagline:"Branch from this step",description:"Branching",stepId:"BRANCH",internal:!0,features:{},inputs:{},schema:{inputs:{properties:{branches:{properties:{name:{type:"string"},condition:{customType:"filters"}}},children:{type:"array"}},required:["conditions"]},outputs:{properties:{branchName:{type:"string"},status:{type:"string",description:"Branch result"},branchId:{type:"string",description:"Branch ID"},success:{type:"boolean",description:"Branch success"}},required:["output"]}},type:"LOGIC"}});var v4={};G(v4,{definition:()=>xUt});var xUt,VSe=y(()=>{"use strict";P();xUt={name:"Collect Data",tagline:"Collect data to be sent to design",icon:"stack",description:"Collects specified data so it can be provided to the design section",type:"ACTION",internal:!0,features:{},stepId:"COLLECT",inputs:{},schema:{inputs:{properties:{collection:{type:"string",title:"What to Collect"}},required:["collection"]},outputs:{properties:{success:{type:"boolean",description:"Whether the action was successful"},value:{type:"string",description:"Collected data"}},required:["success","value"]}}}});var S4={};G(S4,{definition:()=>CUt});var CUt,GSe=y(()=>{"use strict";P();CUt={name:"Create Row",tagline:"Create a {{inputs.enriched.table.name}} row",icon:"rows-plus-bottom",description:"Add a row to your database",type:"ACTION",internal:!0,features:{LOOPING:!0},stepId:"CREATE_ROW",inputs:{},schema:{inputs:{properties:{row:{type:"object",properties:{tableId:{type:"string",customType:"table"}},customType:"row",title:"Table",required:["tableId"]}},required:["row"]},outputs:{properties:{row:{type:"object",customType:"row",description:"The new row"},response:{type:"object",description:"The response from the table"},success:{type:"boolean",description:"Whether the row creation was successful"},id:{type:"string",description:"The identifier of the new row"},revision:{type:"string",description:"The revision of the new row"}},required:["success","id","revision"]}}}});var T4={};G(T4,{definition:()=>DUt});var DUt,HSe=y(()=>{"use strict";P();DUt={name:"Delay",icon:"clock",tagline:"Delay for {{inputs.time}} milliseconds",description:"Delay the automation until an amount of time has passed",stepId:"DELAY",internal:!0,features:{},inputs:{},schema:{inputs:{properties:{time:{type:"number",title:"Delay in milliseconds"}},required:["time"]},outputs:{properties:{success:{type:"boolean",description:"Whether the delay was successful"}},required:["success"]}},type:"LOGIC"}});var A4={};G(A4,{definition:()=>PUt});var PUt,KSe=y(()=>{"use strict";P();PUt={description:"Delete a row from your database",icon:"trash-simple",name:"Delete Row",tagline:"Delete a {{inputs.enriched.table.name}} row",type:"ACTION",stepId:"DELETE_ROW",internal:!0,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{tableId:{type:"string",customType:"table",title:"Table"},id:{type:"string",title:"Row ID"}},required:["tableId","id"]},outputs:{properties:{row:{type:"object",customType:"row",description:"The deleted row"},response:{type:"object",description:"The response from the table"},success:{type:"boolean",description:"Whether the deletion was successful"}},required:["row","success"]}}}});var R4={};G(R4,{definition:()=>kUt});var kUt,QSe=y(()=>{"use strict";P();kUt={name:"Discord Message",tagline:"Send a message to a Discord server",description:"Send a message to a Discord server",icon:"ri-discord-line",stepId:"discord",type:"ACTION",internal:!1,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{url:{type:"string",title:"Discord Webhook URL"},username:{type:"string",title:"Bot Name"},avatar_url:{type:"string",title:"Bot Avatar URL"},content:{type:"string",title:"Message"}},required:["url","content"]},outputs:{properties:{httpStatus:{type:"number",description:"The HTTP status code of the request"},response:{type:"string",description:"The response from the Discord Webhook"},success:{type:"boolean",description:"Whether the message sent successfully"}}}}}});var I4={};G(I4,{definition:()=>NUt});var NUt,zSe=y(()=>{"use strict";P();NUt={name:"External Data Connector",tagline:"Execute Data Connector",icon:"database",description:"Execute a query in an external data connector",type:"ACTION",stepId:"EXECUTE_QUERY",internal:!0,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{query:{type:"object",properties:{queryId:{type:"string",customType:"query"}},customType:"queryParams",title:"Parameters",required:["queryId"]}},required:["query"]},outputs:{properties:{response:{type:"object",description:"The response from the datasource execution"},info:{type:"object",description:"Some query types may return extra data, like headers from a REST query"},success:{type:"boolean",description:"Whether the action was successful"}},required:["response","success"]}}}});var O4={};G(O4,{definition:()=>LUt});var LUt,YSe=y(()=>{"use strict";P();LUt={name:"API Request",tagline:"Execute a REST request",icon:"globe",description:"Execute a HTTP query from a REST datasource",type:"ACTION",stepId:"API_REQUEST",internal:!0,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{query:{type:"object",properties:{queryId:{type:"string"}},customType:"queryParams",title:"Parameters",required:["queryId"]}},required:["query"]},outputs:{properties:{response:{type:"object",description:"The response from the datasource execution"},info:{type:"object",description:"Some query types may return extra data, like headers from a REST query"},success:{type:"boolean",description:"Whether the action was successful"}},required:["response","success"]}}}});var x4={};G(x4,{definition:()=>UUt});var UUt,JSe=y(()=>{"use strict";P();UUt={name:"JS Scripting",tagline:"Execute JavaScript Code",deprecated:!0,icon:"code",description:"Run a piece of JavaScript code in your automation",type:"ACTION",internal:!0,stepId:"EXECUTE_SCRIPT",inputs:{},features:{LOOPING:!0},schema:{inputs:{properties:{code:{type:"string",customType:"code",title:"Code"}},required:["code"]},outputs:{properties:{value:{type:"string",description:"The result of the return statement"},success:{type:"boolean",description:"Whether the action was successful"}},required:["success"]}}}});var C4={};G(C4,{definition:()=>MUt});var MUt,XSe=y(()=>{"use strict";P();MUt={name:"JavaScript",tagline:"Execute JavaScript Code",icon:"brackets-angle",description:"Run a piece of JavaScript code in your automation",type:"ACTION",internal:!0,new:!1,stepId:"EXECUTE_SCRIPT_V2",inputs:{},features:{LOOPING:!0},schema:{inputs:{properties:{code:{type:"string",customType:"code",title:"Code"}},required:["code"]},outputs:{properties:{value:{type:"string",description:"The result of the return statement"},success:{type:"boolean",description:"Whether the action was successful"}},required:["success"]}}}});var D4={};G(D4,{PrettyFilterConditions:()=>ZSe,definition:()=>FUt});var ZSe,FUt,eTe=y(()=>{"use strict";P();ZSe={EQUAL:"Equals",NOT_EQUAL:"Not equals",GREATER_THAN:"Greater than",LESS_THAN:"Less than"},FUt={name:"Condition",tagline:"{{inputs.field}} {{inputs.condition}} {{inputs.value}}",icon:"git-branch",description:"Conditionally halt automations which do not meet certain conditions",type:"LOGIC",internal:!0,features:{},stepId:"FILTER",inputs:{condition:"EQUAL"},schema:{inputs:{properties:{field:{type:"string",title:"Reference Value"},condition:{type:"string",title:"Condition",enum:Object.values(qP),pretty:Object.values(ZSe)},value:{type:"string",title:"Comparison Value"}},required:["field","condition","value"]},outputs:{properties:{success:{type:"boolean",description:"Whether the action was successful"},result:{type:"boolean",description:"Whether the logic block passed"}},required:["success","result"]}}}});var P4={};G(P4,{definition:()=>qUt});var BUt,qUt,tTe=y(()=>{"use strict";P();BUt={ascending:"Ascending",descending:"Descending"},qUt={description:"Get a single row from the database",icon:"box-arrow-down",name:"Get Row",tagline:"Get a row from {{inputs.enriched.table.name}} table",type:"ACTION",stepId:"GET_ROW",internal:!0,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{tableId:{type:"string",customType:"table",title:"Table"},rowId:{type:"string",title:"Row ID"},filters:{type:"object",customType:"filters",title:"Filtering"},sortColumn:{type:"string",title:"Sort Column",customType:"column"},sortOrder:{type:"string",title:"Sort Order",enum:Object.values(eo),pretty:Object.values(BUt)}},required:["tableId"]},outputs:{properties:{row:{type:"object",customType:"row",description:"The row that was found"},success:{type:"boolean",description:"Whether the query was successful"}},required:["row","success"]}}}});var k4={};G(k4,{definition:()=>WUt});var WUt,rTe=y(()=>{"use strict";P();WUt={name:"Looping",icon:"recycle",tagline:"Loop the block",description:"Loop",stepId:"LOOP",internal:!0,features:{},inputs:{},schema:{inputs:{properties:{option:{customType:"loopOption",title:"Input type"},binding:{type:"string",title:"Binding / Value"},iterations:{type:"number",title:"Max loop iterations"},failure:{type:"string",title:"Failure Condition"}},required:["type","value","iterations","failure"]},outputs:{properties:{items:{customType:"item",description:"The item currently being executed"},success:{type:"boolean",description:"Whether the message loop was successfully"},iterations:{type:"number",description:"The amount of times the block ran"}},required:["success","items","iterations"]}},type:"LOGIC"}});var N4={};G(N4,{definition:()=>jUt});var jUt,nTe=y(()=>{"use strict";P();jUt={name:"Make Integration",stepTitle:"Make",tagline:"Trigger a Make scenario",description:"Performs a webhook call to Make and gets the response (if configured)",icon:"ri-shut-down-line",stepId:"integromat",type:"ACTION",internal:!1,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{url:{type:"string",title:"Webhook URL"},body:{type:"json",title:"Payload"}},required:["url","body"]},outputs:{properties:{success:{type:"boolean",description:"Whether call was successful"},httpStatus:{type:"number",description:"The HTTP status code returned"},response:{type:"object",description:"The webhook response - this can have properties"}},required:["success","response"]}}}});var L4={};G(L4,{definition:()=>$Ut});var $Ut,iTe=y(()=>{"use strict";P();$Ut={name:"n8n Integration",stepTitle:"n8n",tagline:"Trigger an n8n workflow",description:"Performs a webhook call to n8n and gets the response (if configured)",icon:"ri-shut-down-line",stepId:"n8n",type:"ACTION",internal:!1,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{url:{type:"string",title:"Webhook URL"},method:{type:"string",title:"Method",enum:Object.values(BT)},authorization:{type:"string",title:"Authorization"},body:{type:"json",title:"Payload"}},required:["url","method"]},outputs:{properties:{success:{type:"boolean",description:"Whether call was successful"},httpStatus:{type:"number",description:"The HTTP status code returned"},response:{type:"object",description:"The webhook response - this can have properties"}},required:["success","response"]}}}});var U4={};G(U4,{definition:()=>VUt});var oTe,VUt,sTe=y(()=>{"use strict";P();oTe=(u=>(u.GPT_4O_MINI="gpt-4o-mini",u.GPT_4O="gpt-4o",u.GPT_4="gpt-4",u.GPT_35_TURBO="gpt-3.5-turbo",u.GPT_5_MINI="gpt-5-mini",u.GPT_5="gpt-5",u.GPT_5_NANO="gpt-5-nano",u))(oTe||{}),VUt={name:"OpenAI",tagline:"Send prompts to ChatGPT",icon:"flow-arrow",description:"Interact with the OpenAI ChatGPT API.",type:"ACTION",internal:!0,features:{},deprecated:!1,stepId:"OPENAI",inputs:{prompt:""},schema:{inputs:{properties:{prompt:{type:"string",title:"Prompt"},model:{type:"string",title:"Model",enum:Object.values(oTe)}},required:["prompt","model"]},outputs:{properties:{success:{type:"boolean",description:"Whether the action was successful"},response:{type:"string",description:"What was output"}},required:["success","response"]}}}});var M4={};G(M4,{definition:()=>GUt});var aTe,GUt,uTe=y(()=>{"use strict";P();aTe=(s=>(s.POST="POST",s.GET="GET",s.PUT="PUT",s.DELETE="DELETE",s.PATCH="PATCH",s))(aTe||{}),GUt={deprecated:!0,name:"Outgoing webhook",tagline:"Send a {{inputs.requestMethod}} request",icon:"paper-plane-right",description:"Send a request of specified method to a URL",type:"ACTION",internal:!0,features:{LOOPING:!0},stepId:"OUTGOING_WEBHOOK",inputs:{requestMethod:"POST",url:"http://",requestBody:"{}",headers:"{}"},schema:{inputs:{properties:{requestMethod:{type:"string",enum:Object.values(aTe),title:"Request method"},url:{type:"string",title:"URL"},requestBody:{type:"string",title:"JSON Body",customType:"wide"},headers:{type:"string",title:"Headers",customType:"wide"}},required:["requestMethod","url"]},outputs:{properties:{response:{type:"object",description:"The response from the webhook"},httpStatus:{type:"number",description:"The HTTP status code returned"},success:{type:"boolean",description:"Whether the action was successful"}},required:["response","success"]}}}});var F4={};G(F4,{definition:()=>KUt});var HUt,KUt,cTe=y(()=>{"use strict";P();HUt={ascending:"Ascending",descending:"Descending"},KUt={description:"Query rows from the database",icon:"magnifying-glass",name:"Query Rows",tagline:"Query rows from {{inputs.enriched.table.name}} table",type:"ACTION",stepId:"QUERY_ROWS",internal:!0,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{tableId:{type:"string",customType:"table",title:"Table"},filters:{type:"object",customType:"filters",title:"Filtering"},sortColumn:{type:"string",title:"Sort Column",customType:"column"},sortOrder:{type:"string",title:"Sort Order",enum:Object.values(eo),pretty:Object.values(HUt)},limit:{type:"number",title:"Limit",customType:"queryLimit"}},required:["tableId"]},outputs:{properties:{rows:{type:"array",customType:"rows",description:"The rows that were found"},success:{type:"boolean",description:"Whether the query was successful"}},required:["rows","success"]}}}});var B4={};G(B4,{definition:()=>QUt});var QUt,lTe=y(()=>{"use strict";P();QUt={description:"Send an email using SMTP",tagline:"Send SMTP email to {{inputs.to}}",icon:"envelope",name:"Send Email (SMTP)",type:"ACTION",internal:!0,features:{LOOPING:!0},stepId:"SEND_EMAIL_SMTP",inputs:{},schema:{inputs:{properties:{to:{type:"string",title:"Send To"},from:{type:"string",title:"Send From"},cc:{type:"string",title:"CC"},bcc:{type:"string",title:"BCC"},subject:{type:"string",title:"Email Subject"},contents:{type:"longform",title:"Message",description:"Use markdown or HTML for rich text formatting: **bold**, _italics_, # Headings, * Bullets, <br> for line breaks, and more."},addInvite:{type:"boolean",title:"Add calendar invite"},startTime:{type:"date",title:"Start Time",dependsOn:"addInvite"},endTime:{type:"date",title:"End Time",dependsOn:"addInvite"},summary:{type:"string",title:"Meeting Summary",dependsOn:"addInvite"},location:{type:"string",title:"Location",dependsOn:"addInvite"},attachments:{type:"attachment",customType:"multi_attachments",title:"Attachments"}},required:["to","from","subject","contents"]},outputs:{properties:{success:{type:"boolean",description:"Whether the email was sent"},response:{type:"object",description:"A response from the email client, this may be an error"}},required:["success"]}}}});var q4={};G(q4,{definition:()=>zUt});var zUt,fTe=y(()=>{"use strict";P();zUt={name:"Backend log",tagline:"Console log a value in the backend",icon:"activity",description:"Logs the given text to the server (using console.log)",type:"ACTION",internal:!0,features:{LOOPING:!0},stepId:"SERVER_LOG",inputs:{text:""},schema:{inputs:{properties:{text:{type:"string",title:"Log"}},required:["text"]},outputs:{properties:{success:{type:"boolean",description:"Whether the action was successful"},message:{type:"string",description:"What was output"}},required:["success","message"]}}}});var W4={};G(W4,{definition:()=>YUt});var YUt,dTe=y(()=>{"use strict";P();YUt={name:"Slack Message",tagline:"Send a message to Slack",description:"Send a message to Slack",icon:"ri-slack-line",stepId:"slack",type:"ACTION",internal:!1,features:{LOOPING:!0},inputs:{},schema:{inputs:{properties:{url:{type:"string",title:"Incoming Webhook URL"},text:{type:"string",title:"Message"}},required:["url","text"]},outputs:{properties:{httpStatus:{type:"number",description:"The HTTP status code of the request"},success:{type:"boolean",description:"Whether the message sent successfully"},response:{type:"string",description:"The response from the Slack Webhook"}}}}}});var j4={};G(j4,{definition:()=>JUt});var JUt,pTe=y(()=>{"use strict";P();JUt={name:"Trigger an automation",tagline:"Triggers an automation synchronously",icon:"arrows-clockwise",description:"Triggers an automation synchronously",type:"ACTION",internal:!0,features:{},stepId:"TRIGGER_AUTOMATION_RUN",inputs:{},schema:{inputs:{properties:{automation:{type:"object",properties:{automationId:{type:"string",customType:"automation"}},customType:"automationFields",title:"Automation Fields",required:["automationId"]},timeout:{type:"number",title:"Timeout (ms)"}},required:["automationId"]},outputs:{properties:{success:{type:"boolean",description:"Whether the automation was successful"},value:{type:"object",description:"Automation Result"}},required:["success","value"]}}}});var $4={};G($4,{definition:()=>XUt});var XUt,mTe=y(()=>{"use strict";P();XUt={name:"Update Row",tagline:"Update a {{inputs.enriched.table.name}} row",icon:"arrow-clockwise",description:"Update a row in your database",type:"ACTION",internal:!0,features:{LOOPING:!0},stepId:"UPDATE_ROW",inputs:{},schema:{inputs:{properties:{meta:{type:"object",title:"Field settings"},row:{type:"object",customType:"row",title:"Table"},rowId:{type:"string",title:"Row ID"}},required:["row","rowId"]},outputs:{properties:{row:{type:"object",customType:"row",description:"The updated row"},response:{type:"object",description:"The response from the table"},success:{type:"boolean",description:"Whether the action was successful"},id:{type:"string",description:"The identifier of the updated row"},revision:{type:"string",description:"The revision of the updated row"}},required:["success","id","revision"]}}}});var V4={};G(V4,{definition:()=>ZUt});var ZUt,hTe=y(()=>{"use strict";P();ZUt={name:"Zapier Webhook",stepId:"zapier",type:"ACTION",internal:!1,features:{LOOPING:!0},description:"Trigger a Zapier Zap via webhooks",tagline:"Trigger a Zapier Zap",icon:"ri-flashlight-line",inputs:{},schema:{inputs:{properties:{url:{type:"string",title:"Webhook URL"},body:{type:"json",title:"Payload"}},required:["url"]},outputs:{properties:{httpStatus:{type:"number",description:"The HTTP status code of the request"},response:{type:"string",description:"The response from Zapier"}}}}}});var G4={};G(G4,{definition:()=>eMt});var eMt,gTe=y(()=>{"use strict";P();eMt={name:"Classify Text",icon:"PageTag",tagline:"Classify text into predefined categories using AI",description:"Analyzes text and assigns it to one of the categories you provide.",stepId:"CLASSIFY_CONTENT",internal:!0,inputs:{},features:{LOOPING:!0},schema:{inputs:{properties:{textInput:{type:"longform",title:"Text",description:"The text content you want the AI to classify."},categoryItems:{type:"array",customType:"categories",title:"Categories",description:"Add categories for the AI to use when classifying text."}},required:["textInput","categoryItems"]},outputs:{properties:{category:{type:"string",description:"The category assigned by the AI."},success:{type:"boolean",description:"Whether the classification was successful."}},required:["category","success"]}},type:"ACTION"}});var H4={};G(H4,{definition:()=>tMt});var tMt,yTe=y(()=>{"use strict";P();tMt={name:"LLM Prompt",tagline:"Send prompts to LLM",icon:"Algorithm",description:"Interact with an LLM.",type:"ACTION",internal:!0,features:{},stepId:"PROMPT_LLM",inputs:{prompt:""},schema:{inputs:{properties:{prompt:{type:"longform",title:"Prompt"}},required:["prompt","model"]},outputs:{properties:{success:{type:"boolean",description:"Whether the action was successful"},response:{type:"string",description:"What was output"}},required:["success","response"]}}}});var K4={};G(K4,{definition:()=>rMt});var rMt,bTe=y(()=>{"use strict";P();rMt={name:"Translate",tagline:"Translate text to a different language",icon:"globe",description:"Translate text to a different language.",type:"ACTION",internal:!0,features:{},stepId:"TRANSLATE",inputs:{prompt:""},schema:{inputs:{properties:{text:{type:"string",title:"Text"},language:{type:"string",title:"Language"}},required:["text","language"]},outputs:{properties:{success:{type:"boolean",description:"Whether the action was successful"},response:{type:"string",description:"What was the translated text"}},required:["success","response"]}}}});var Q4={};G(Q4,{definition:()=>nMt});var _Te,nMt,wTe=y(()=>{"use strict";P();_Te=(n=>(n.SHORT="Short",n.MEDIUM="Medium",n.LONG="Long",n))(_Te||{}),nMt={name:"Summarise",tagline:"Summarise text",icon:"Summarize",description:"Summarise text.",type:"ACTION",internal:!0,features:{},stepId:"SUMMARISE",inputs:{prompt:""},schema:{inputs:{properties:{text:{type:"longform",title:"Text"},length:{type:"string",title:"Length",enum:Object.values(_Te)}},required:["text","length"]},outputs:{properties:{success:{type:"boolean",description:"Whether the action was successful"},response:{type:"string",description:"What was the summarised text"}},required:["success","response"]}}}});var z4={};G(z4,{definition:()=>iMt});var iMt,ETe=y(()=>{"use strict";P();iMt={name:"Generate Text",icon:"Edit",tagline:"Generate contentusing AI",description:"Uses AI to generate text content based on your instructions and chosen format",stepId:"GENERATE_TEXT",internal:!0,inputs:{contentType:"document"},features:{LOOPING:!0},schema:{inputs:{properties:{contentType:{type:"string",title:"Content type",enum:Object.values(UP),pretty:Object.values(zye)},instructions:{type:"longform",title:"Instructions",description:"Provide guidance to help the AI produce content in the format that you want"}},required:["contentType","instructions"]},outputs:{properties:{generatedText:{type:"string",description:"The text content generated by the AI"},success:{type:"boolean",description:"Whether the text generation was successful"}},required:["generatedText","success"]}},type:"ACTION"}});var Y4={};G(Y4,{definition:()=>oMt});var oMt,vTe=y(()=>{"use strict";P();oMt={name:"Extract Document Data",icon:"Document",tagline:"Extract structured data from documents using AI",description:"Extracts structured data from PDF or image according to provided schema.",stepId:"EXTRACT_FILE_DATA",internal:!0,inputs:{},features:{LOOPING:!0},schema:{inputs:{properties:{file:{type:"string",title:"Document",description:"Attachment or Link to the document to extract data from."},source:{type:"string",enum:Object.values(MP),title:"Source",description:"The source of the document to extract data from."},fileType:{dependsOn:{field:"source",value:"URL"},type:"string",enum:Object.values(FP),title:"File Type",description:"The type of file at the URL."},schema:{customType:"triggerSchema",title:"Data schema",description:'Schema defining the structure of data to extract. Example: {"name": "string", "price": "number"}.'}},required:["file","schema"]},outputs:{properties:{data:{type:"json",description:"The structured data extracted from the document."},success:{type:"boolean",description:"Whether the extraction was successful."}},required:["data","success"]}},type:"ACTION"}});var J4={};G(J4,{definition:()=>sMt});var sMt,STe=y(()=>{"use strict";P();sMt={name:"Agent",icon:"Effect",tagline:"Run an AI agent with tools",description:"Execute a pre-configured AI agent that can use tools to accomplish tasks",stepId:"AGENT",internal:!0,inputs:{},features:{LOOPING:!0},schema:{inputs:{properties:{agentId:{customType:"agent",title:"Agent",description:"Select the agent to run"},prompt:{type:"longform",title:"Prompt",description:"The task or question to send to the agent"},useStructuredOutput:{type:"boolean",title:"Use structured output",description:"Constrain the agent response to a specific JSON structure"},outputSchema:{type:"object",customType:"outputSchema",title:"Output Schema",description:"Define the structure of the agent's output",dependsOn:"useStructuredOutput"}},required:["agentId","prompt"]},outputs:{properties:{response:{type:"string",description:"The agent's response"},success:{type:"boolean",description:"Whether the agent completed successfully"},steps:{type:"array",description:"The steps taken by the agent"},output:{type:"object",description:"Structured output from the agent (when output schema is defined)"}},required:["response","success"]}},type:"ACTION"}});var X4={};G(X4,{definition:()=>aMt});var aMt,TTe=y(()=>{"use strict";P();aMt={name:"State",tagline:"Extract automation state",icon:"brackets-curly",description:"Extract automation state into a named variable",type:"ACTION",internal:!0,new:!1,stepId:"EXTRACT_STATE",inputs:{},features:{LOOPING:!0},schema:{inputs:{properties:{key:{type:"string",title:"Key"},value:{type:"longform",title:"Value"}},required:["value","key"]},outputs:{properties:{value:{type:"string",description:"The result of the return statement"},success:{type:"boolean",description:"Whether the action was successful"}},required:["success"]}}}});var Z4={};G(Z4,{definition:()=>uMt});var uMt,ATe=y(()=>{"use strict";P();uMt={name:"Loop",icon:"recycle",tagline:"Loop the block",description:"Loop",stepId:"LOOP_V2",internal:!0,features:{},inputs:{},schema:{inputs:{properties:{children:{type:"array",title:"Input type"},binding:{type:"string",title:"Binding / Value"},iterations:{type:"number",title:"Max loop iterations"},failure:{type:"string",title:"Failure Condition"}}},outputs:{properties:{success:{type:"boolean",description:"Loop success"},iterations:{type:"number",description:"The number of iterations executed"},items:{type:"json",description:"Per-step iteration results"},summary:{type:"json",description:"Loop summary including per-step counters"}},required:["success"]}},type:"LOGIC"}});var e3={};G(e3,{agent:()=>J4,apiRequest:()=>O4,bash:()=>w4,branch:()=>E4,classifyText:()=>G4,collect:()=>v4,createRow:()=>S4,delay:()=>T4,deleteRow:()=>A4,discord:()=>R4,executeQuery:()=>I4,executeScript:()=>x4,executeScriptV2:()=>C4,extract:()=>Y4,extractState:()=>X4,filter:()=>D4,generate:()=>z4,getRow:()=>P4,loop:()=>k4,loopV2:()=>Z4,make:()=>N4,n8n:()=>L4,openai:()=>U4,outgoingWebhook:()=>M4,promptLLM:()=>H4,queryRows:()=>F4,sendSmtpEmail:()=>B4,serverLog:()=>q4,slack:()=>W4,summarise:()=>Q4,translate:()=>K4,triggerAutomationRun:()=>j4,updateRow:()=>$4,zapier:()=>V4});var RTe=y(()=>{"use strict";jSe();$Se();VSe();GSe();HSe();KSe();QSe();zSe();YSe();JSe();XSe();eTe();tTe();rTe();nTe();iTe();sTe();uTe();cTe();lTe();fTe();dTe();pTe();mTe();hTe();gTe();yTe();bTe();wTe();ETe();vTe();STe();TTe();ATe()});var ITe,OTe=y(()=>{"use strict";P();ITe={name:"User action",event:"app:trigger",icon:"cursor-click",tagline:"Automation fired from the frontend",description:"Trigger an automation from an action inside your app",stepId:"APP",inputs:{},schema:{inputs:{properties:{fields:{type:"object",customType:"triggerSchema",title:"Fields"}},required:[]},outputs:{properties:{fields:{type:"object",description:"Fields submitted from the app frontend",customType:"triggerSchema"}},required:["fields"]}},type:"TRIGGER"}});var xTe,CTe=y(()=>{"use strict";P();xTe={name:"CRON / Schedule",event:"cron:trigger",icon:"clock",tagline:"Cron Trigger (<b>{{inputs.cron}}</b>)",description:"Triggers automation on a cron schedule.",stepId:"CRON",inputs:{},schema:{inputs:{properties:{cron:{type:"string",customType:"cron",title:"Expression"}},required:["cron"]},outputs:{properties:{timestamp:{type:"number",description:"Timestamp the cron was executed"}},required:["timestamp"]}},type:"TRIGGER"}});var DTe,PTe=y(()=>{"use strict";P();DTe={name:"Email Received",event:"email:trigger",icon:"envelope",tagline:"Email Trigger",description:"Triggers automation when an email is received",stepId:"EMAIL",inputs:{host:"",port:993,secure:!0,username:"",password:"",mailbox:"INBOX"},schema:{inputs:{properties:{host:{type:"string",description:"IMAP host address"},port:{type:"number",description:"IMAP port"},secure:{type:"boolean",description:"Use TLS/SSL for the IMAP connection"},username:{type:"string",description:"IMAP username"},password:{type:"string",description:"IMAP password"},mailbox:{type:"string",description:"Mailbox to monitor"}},required:["host","port","secure","username","password"]},outputs:{properties:{from:{type:"string",description:"Who sent the email"},to:{type:"string",description:"Who received the email"},cc:{type:"array",subtype:"string",description:"Who was CC'd on the email"},subject:{type:"string",description:"What was the subject of the email"},sentAt:{type:"datetime",description:"When the email was sent"},bodyText:{type:"string",description:"Email content (plain text)"}},required:["from","to"]}},type:"TRIGGER"}});var kTe,NTe=y(()=>{"use strict";P();kTe={name:"Row Deleted",event:"row:delete",icon:"trash-simple",tagline:"Row is deleted from {{inputs.enriched.table.name}}",description:"Fired when a row is deleted from your database",stepId:"ROW_DELETED",inputs:{},schema:{inputs:{properties:{tableId:{type:"string",customType:"table",title:"Table"}},required:["tableId"]},outputs:{properties:{row:{type:"object",customType:"row",description:"The row that was deleted"}},required:["row"]}},type:"TRIGGER"}});var LTe,UTe=y(()=>{"use strict";P();LTe={name:"Row Created",event:"row:save",icon:"rows-plus-bottom",tagline:"Row is added to {{inputs.enriched.table.name}}",description:"Fired when a row is added to your database",stepId:"ROW_SAVED",inputs:{},schema:{inputs:{properties:{tableId:{type:"string",customType:"table",title:"Table"},filters:{type:"object",customType:"trigger_filter",title:"Filtering"}},required:["tableId"]},outputs:{properties:{row:{type:"object",customType:"row",description:"The new row that was created"},id:{type:"string",description:"Row ID - can be used for updating"},revision:{type:"string",description:"Revision of row"}},required:["row","id"]}},type:"TRIGGER"}});var MTe,FTe=y(()=>{"use strict";P();MTe={name:"Row Updated",event:"row:update",icon:"arrow-clockwise",tagline:"Row is updated in {{inputs.enriched.table.name}}",description:"Fired when a row is updated in your database",stepId:"ROW_UPDATED",inputs:{},schema:{inputs:{properties:{tableId:{type:"string",customType:"table",title:"Table"},filters:{type:"object",customType:"trigger_filter",title:"Filtering"}},required:["tableId"]},outputs:{properties:{oldRow:{type:"object",customType:"row",description:"The row that was updated",title:"Old Row"},row:{type:"object",customType:"row",description:"The row before it was updated",title:"Row"},id:{type:"string",description:"Row ID - can be used for updating"},revision:{type:"string",description:"Revision of row"}},required:["row","id"]}},type:"TRIGGER"}});var BTe,qTe=y(()=>{"use strict";P();BTe={name:"Webhook",event:"web:trigger",icon:"paper-plane-right",tagline:"Webhook endpoint is hit",description:"Trigger an automation when a HTTP POST webhook is hit",stepId:"WEBHOOK",inputs:{},schema:{inputs:{properties:{schemaUrl:{type:"string",customType:"webhookUrl",title:"Schema URL"},triggerUrl:{type:"string",customType:"webhookUrl",title:"Trigger URL"}},required:["schemaUrl","triggerUrl"]},outputs:{properties:{body:{type:"object",description:"Body of the request which hit the webhook"}},required:["body"]}},type:"TRIGGER"}});var WTe,jTe=y(()=>{"use strict";P();WTe={type:"TRIGGER",name:"Row Action",event:"row:action",icon:"tree-structure",tagline:"Row action triggered in {{inputs.enriched.table.name}} by {{inputs.enriched.row._id}}",description:"row action workflow",stepId:"ROW_ACTION",inputs:{},schema:{inputs:{properties:{tableId:{type:"string",customType:"table",title:"Table",readonly:!0}},required:["tableId"]},outputs:{properties:{id:{type:"string",description:"Row ID - can be used for updating"},revision:{type:"string",description:"Revision of row"},table:{type:"object",customType:"table",title:"The table linked to the row action"},row:{type:"object",customType:"row",description:"The row linked to the row action"}}}}}});var t3={};G(t3,{definitions:()=>yMt});var yMt,$Te=y(()=>{"use strict";OTe();CTe();PTe();NTe();UTe();FTe();qTe();jTe();yMt={ROW_SAVED:LTe,ROW_UPDATED:MTe,ROW_DELETED:kTe,WEBHOOK:BTe,APP:ITe,CRON:xTe,EMAIL:DTe,ROW_ACTION:WTe}});var st={};G(st,{steps:()=>e3,triggers:()=>t3});var VTe=y(()=>{"use strict";RTe();$Te()});function GTe(e){return bMt.find(t=>e.startsWith(`${t}${fe}`))}function HTe(e){return _Mt.find(t=>e.startsWith(`${t}${fe}`))}function Un(e){if(!Gn(e))throw new Error("Unable to extract table ID, is not a view ID");let t=e.split(fe);return t.shift(),e=t.join(fe),new RegExp(`^(?<tableId>.+)${fe}([^${fe}]+)$`).exec(e).groups.tableId}var bMt,_Mt,wMt,Fk,EMt,Zo,vMt,Gn,Q_,KTe,QTe=y(()=>{"use strict";P();bMt=Object.values(qe).sort((e,t)=>t.length-e.length);o(GTe,"getDocumentType");_Mt=Object.values(Tp).sort((e,t)=>t.length-e.length);o(HTe,"getVirtualDocumentType");wMt=new RegExp("^datasource_plus_(.+)__(.+)$"),Fk=o(e=>t=>!!t&&t.startsWith(`${e}${fe}`),"idCheckFor"),EMt=o(e=>{let t=e.match(wMt);return!!e&&t!==null},"isExternalTableId"),Zo=o(e=>vMt(e)||EMt(e),"isTableIdOrExternalTableId"),vMt=Fk("ta"),Gn=Fk("view"),Q_=Fk("datasource"),KTe=Fk("query");o(Un,"getTableIdFromViewId")});var zTe=y(()=>{"use strict"});var YTe=y(()=>{"use strict"});var Ro,fl=y(()=>{"use strict";Ro=o((e,t)=>t.map(r=>{let n=r.fullKey??(r.key.includes(".")?r.key:`${e}.${r.key}`);return{key:r.key,name:r.name,defaultValue:r.defaultValue,category:e,fullKey:n}}),"createTranslationDefinitions")});var SMt,JTe,XTe=y(()=>{"use strict";fl();SMt="userMenu",JTe=Ro(SMt,[{key:"profile",fullKey:"profile",name:"User menu profile label",defaultValue:"My profile"},{key:"password",fullKey:"password",name:"User menu password label",defaultValue:"Update password"},{key:"portal",fullKey:"portal",name:"User menu portal label",defaultValue:"Go to portal"},{key:"logout",fullKey:"logout",name:"User menu logout label",defaultValue:"Log out"}])});var TMt,ZTe,eAe=y(()=>{"use strict";fl();TMt="profileModal",ZTe=Ro(TMt,[{key:"title",fullKey:"profileModalTitle",name:"Profile modal title",defaultValue:"My profile"},{key:"body",fullKey:"profileModalBody",name:"Profile modal body",defaultValue:"Personalise the platform by adding your first name and last name."},{key:"emailLabel",fullKey:"profileModalEmailLabel",name:"Profile email label",defaultValue:"Email"},{key:"firstNameLabel",fullKey:"profileModalFirstNameLabel",name:"Profile first name label",defaultValue:"First name"},{key:"lastNameLabel",fullKey:"profileModalLastNameLabel",name:"Profile last name label",defaultValue:"Last name"},{key:"saveText",fullKey:"profileModalSaveButton",name:"Profile save button",defaultValue:"Save"},{key:"cancelText",fullKey:"profileModalCancelButton",name:"Profile cancel button",defaultValue:"Cancel"},{key:"successText",fullKey:"profileModalSuccess",name:"Profile update success notification",defaultValue:"Information updated successfully"},{key:"errorText",fullKey:"profileModalError",name:"Profile update error notification",defaultValue:"Failed to update information"}])});var AMt,tAe,rAe=y(()=>{"use strict";fl();AMt="passwordModal",tAe=Ro(AMt,[{key:"title",fullKey:"passwordTitle",name:"Password title",defaultValue:"Update password"},{key:"body",fullKey:"passwordBody",name:"Password body",defaultValue:"Enter your new password below."},{key:"passwordLabel",fullKey:"passwordModalLabel",name:"Password password label",defaultValue:"Password"},{key:"repeatLabel",fullKey:"passwordModalRepeatLabel",name:"Password repeat label",defaultValue:"Repeat password"},{key:"saveText",fullKey:"passwordModalSaveButton",name:"Password save button",defaultValue:"Update password"},{key:"cancelText",fullKey:"passwordModalCancelButton",name:"Password modal cancel button",defaultValue:"Cancel"},{key:"minLengthText",fullKey:"passwordModalMinLength",name:"Password minimum length copy",defaultValue:"Please enter at least 12 characters. We recommend using machine generated or random passwords."},{key:"mismatchText",fullKey:"passwordModalMismatchText",name:"Password mismatch copy",defaultValue:"Passwords must match"},{key:"successText",fullKey:"passwordModalSuccess",name:"Password success notification",defaultValue:"Password changed successfully"},{key:"errorText",fullKey:"passwordModalError",name:"Password error notification",defaultValue:"Failed to update password"}])});var RMt,nAe,iAe=y(()=>{"use strict";fl();RMt="picker",nAe=Ro(RMt,[{key:"searchPlaceholder",name:"Picker search placeholder",defaultValue:"Search"},{key:"searchByFieldPlaceholder",name:"Picker search by field placeholder",defaultValue:"Search by {field}"}])});var IMt,oAe,sAe=y(()=>{"use strict";fl();IMt="recaptcha",oAe=Ro(IMt,[{key:"prompt",name:"Prompt",defaultValue:"Human verification step required to continue."},{key:"submit",name:"Submit button",defaultValue:"Submit"},{key:"error",name:"Error message",defaultValue:"Recaptcha verification failed, please try again"}])});var OMt,aAe,uAe=y(()=>{"use strict";fl();OMt="portal",aAe=Ro(OMt,[{key:"greeting",name:"Greeting heading",defaultValue:"Hey {{name}}"},{key:"intro",name:"Introductory body",defaultValue:"Welcome to the {{company}} portal. Below you'll find the list of apps that you have access to."},{key:"offlineHeading",name:"Offline heading",defaultValue:"Your apps are currently offline."},{key:"offlineDescription",name:"Offline description",defaultValue:"Please contact the account holder to get them back online."},{key:"appsHeading",name:"Apps heading",defaultValue:"Apps"},{key:"updatedAgo",name:"Updated duration label",defaultValue:"Updated {{ duration time 'millisecond' }} ago"},{key:"neverUpdated",name:"Never updated label",defaultValue:"Never updated"},{key:"noAppsHeading",name:"No apps heading",defaultValue:"You don't have access to any apps yet."},{key:"noAppsDescription",name:"No apps description",defaultValue:"The apps you have access to will be listed here."}])});var xMt,cAe,lAe=y(()=>{"use strict";fl();xMt="login",cAe=Ro(xMt,[{key:"emailLabel",name:"Login email label",defaultValue:"Your work email"},{key:"emailError",name:"Login email error",defaultValue:"Please enter a valid email"},{key:"passwordLabel",name:"Login password label",defaultValue:"Password"},{key:"passwordIncorrectError",name:"Login password incorrect error",defaultValue:"Incorrect password"},{key:"passwordError",name:"Login password error",defaultValue:"Please enter your password"},{key:"invalidCredentials",name:"Login invalid credentials message",defaultValue:"Invalid credentials"},{key:"forgotPassword",name:"Forgot password link",defaultValue:"Forgot password?"},{key:"loginWith",name:"Login with label",defaultValue:"Log in with"}])});var CMt,fAe,dAe=y(()=>{"use strict";fl();CMt="forgotPassword",fAe=Ro(CMt,[{key:"heading",name:"Forgot password heading",defaultValue:"Forgot your password?"},{key:"description",name:"Forgot password description",defaultValue:"Enter your email to receive reset instructions."},{key:"emailLabel",name:"Forgot password email label",defaultValue:"Your work email"},{key:"emailError",name:"Forgot password email error",defaultValue:"Please enter a valid email"},{key:"submit",name:"Forgot password submit button",defaultValue:"Send reset email"},{key:"success",name:"Forgot password success notification",defaultValue:"If that account exists, we'll send a reset email shortly."}])});var DMt,pAe,tin,PMt,kMt,mAe,hAe=y(()=>{"use strict";XTe();eAe();rAe();iAe();sAe();uAe();lAe();dAe();fl();DMt=[JTe,ZTe,tAe,nAe,oAe,aAe,cAe,fAe],pAe=DMt.flat(),tin=pAe.reduce((e,t)=>(e[t.category]||(e[t.category]=[]),e[t.category].push(t),e),{}),PMt=pAe.reduce((e,t)=>(e.set(t.fullKey,t),e),new Map),kMt=o(e=>e?Object.entries(e).reduce((t,[r,n])=>(typeof n!="string"||!PMt.has(r)||(t[r]=n),t),{}):{},"filterValidTranslationOverrides"),mAe=o(e=>kMt(e),"resolveWorkspaceTranslations")});var we=y(()=>{"use strict";WT();IG();r4();RG();USe();BSe();WSe();VTe();QTe();zTe();YTe();hAe()});var r3,Mp,NA,Vr,uc,n3,cc,Fp,gAe,no,yAe,bAe,_Ae,wAe,Bk,bg,i3=y(()=>{"use strict";P();we();P();r3=(n=>(n.ALL="all",n.AUTOMATION="automation",n.STATUS="status",n))(r3||{}),Mp=(f=>(f.USER_BY_WORKSPACE="by_app",f.USER_BY_EMAIL="by_email2",f.BY_API_KEY="by_api_key",f.LINK="by_link",f.ROUTING="screen_routes_2",f.AUTOMATION_LOGS="automation_logs",f.ACCOUNT_BY_EMAIL="account_by_email",f.PLATFORM_USERS_LOWERCASE="platform_users_lowercase_2",f.USER_BY_GROUP="user_by_group",f.WORKSPACE_BACKUP_BY_TRIGGER="by_trigger",f))(Mp||{}),NA={by_email2:["by_email"]},Vr={GLOBAL:{name:"global-db",docs:{apiKeys:"apikeys",usageQuota:"usage_quota",licenseInfo:"license_info",environmentVariables:"environmentvariables"}},PLATFORM_INFO:{name:"global-info",docs:{tenants:"tenants",install:"install"}},AUDIT_LOGS:{name:"audit-logs"},SCIM_LOGS:{name:"scim-logs"},SELF_HOST_CLOUD:{name:"self-host-cloud"}},uc=Ao("app"),n3=Ao("app_dev"),cc=n3,Fp="internal",gAe="budibase",no="_design/sqlite",yAe="ta_bb_jobs",bAe="ta_bb_inventory",_Ae="ta_bb_expenses",wAe="ta_bb_employee",Bk=`ro${fe}ta_users${fe}`,bg=(r=>(r[r.SQLITE=no]="SQLITE",r.MIGRATIONS="_design/migrations",r))(bg||{})});var o3,Wf,EAe,vAe,NMt,s3,Mn,SAe=y(()=>{"use strict";we();o3=(r=>(r.ACTIVE="active",r.INACTIVE="inactive",r))(o3||{}),Wf=(u=>(u.Auth="budibase:auth",u.Init="budibase:init",u.ACCOUNT_RETURN_URL="budibase:account:returnurl",u.DatasourceAuth="budibase:datasourceauth",u.OIDC_CONFIG="budibase:oidc:config",u.FeatureFlags="budibase:featureflags",u.RecaptchaSession="budibase:recaptcha",u))(Wf||{}),EAe=(i=>(i.OWNER="owner",i.ADMIN="admin",i.BUILDER="builder",i.WORKSPACE_MANAGER="workspace_manager",i))(EAe||{}),vAe=(c=>(c.SETTINGS="settings",c.ACCOUNT="account",c.SMTP="smtp",c.GOOGLE="google",c.OIDC="oidc",c.OIDC_LOGOS="logos_oidc",c.SCIM="scim",c.AI="AI",c))(vAe||{}),NMt=new Date(-2147483647e3),s3=new Date(2147483647e3),Mn="default"});var ft={};G(ft,{AutomationViewMode:()=>r3,BUDIBASE_DATASOURCE_TYPE:()=>gAe,Config:()=>vAe,Cookie:()=>Wf,DEFAULT_BB_DATASOURCE_ID:()=>qT,DEFAULT_EMPLOYEE_TABLE_ID:()=>wAe,DEFAULT_EXPENSES_TABLE_ID:()=>_Ae,DEFAULT_INVENTORY_TABLE_ID:()=>bAe,DEFAULT_JOBS_TABLE_ID:()=>yAe,DEFAULT_TENANT_ID:()=>Mn,DeprecatedViews:()=>NA,DesignDocuments:()=>bg,DocumentType:()=>qe,GlobalRole:()=>EAe,Header:()=>Fi,InternalTable:()=>Pf,MAX_VALID_DATE:()=>s3,MIN_VALID_DATE:()=>NMt,SEPARATOR:()=>fe,SQLITE_DESIGN_DOC_ID:()=>no,SQS_DATASOURCE_INTERNAL:()=>Fp,StaticDatabases:()=>Vr,UNICODE_MAX:()=>to,USER_METADATA_PREFIX:()=>Bk,UserStatus:()=>o3,ViewName:()=>Mp,WORKSPACE_DEV:()=>n3,WORKSPACE_DEV_PREFIX:()=>cc,WORKSPACE_PREFIX:()=>uc});var pr=y(()=>{"use strict";i3();SAe()});function u3(){return OAe()}function OAe(){return process.env.NODE_ENV==="jest"||process.env.JEST_WORKER_ID!=null&&process.env.JEST_WORKER_ID!=="null"}function qk(){return process.env.NODE_ENV!=="production"}function UMt(e){if(e)return parseInt(e)}function MMt(){return process.env.API_ENCRYPTION_KEY?process.env.API_ENCRYPTION_KEY:process.env.JWT_SECRET}function FMt(){return process.env.HTTP_LOGGING===void 0?!0:process.env.HTTP_LOGGING}function BMt(){function e(r){function n(u,c){let l=`${c}/${u}`;if((0,Wk.existsSync)(l))return l;let f=`${c}/..`;return f===c?null:n(u,f)}o(n,"findFileInAncestors");let i=n(r,process.cwd()),s=(0,Wk.readFileSync)(i,"utf-8");return JSON.parse(s)}o(e,"getParentFile");let t;if(qk()&&!u3())try{t=`${e("lerna.json").version}+local`}catch{}try{let r=e("package.json");return{VERSION:t||process.env.BUDIBASE_VERSION||r.version,SERVICE_NAME:r.name}}catch{return{VERSION:process.env.BUDIBASE_VERSION||"",SERVICE_NAME:""}}}function qMt(){return lc.SERVICE_TYPE==="worker"}function WMt(){return lc.SERVICE_TYPE==="apps"}function jMt(){return lc.BUDIBASE_ENVIRONMENT==="QA"}function $Mt(){return process.env.SERVICE?process.env.SERVICE:process.env.APPS_SERVICE?process.env.APPS_SERVICE:process.env.WORKER_SERVICE?process.env.WORKER_SERVICE:"budibase"}function c3(e){let t=(0,IAe.cloneDeep)(lc),r;for(r in e)lc._set(r,e[r]);return()=>{for(let[n,i]of Object.entries(t))lc._set(n,i)}}var a3,Wk,IAe,LA,LMt,TAe,z_,AAe,lc,xAe,U,tt=y(()=>{"use strict";P();a3=require("crypto"),Wk=require("fs"),IAe=require("lodash"),LA=require("path"),LMt=process.env.TOP_LEVEL_PATH||process.env.SERVER_TOP_LEVEL_PATH||(0,LA.resolve)((0,LA.join)(__dirname,"..","..","..")),TAe=!1;!TAe&&qk()&&!u3()&&(require("dotenv").config({path:(0,LA.join)(LMt,".env")}),TAe=!0);o(u3,"isTest");o(OAe,"isJest");o(qk,"isDev");o(UMt,"parseIntSafe");z_={BACKUPS:"backups",APPS:"prod-budi-app-assets",TEMPLATES:"templates",GLOBAL:"global",PLUGINS:"plugins",TEMP:"tmp-file-attachments"},AAe=!!parseInt(process.env.SELF_HOSTED||"");o(MMt,"getAPIEncryptionKey");o(FMt,"httpLogging");o(BMt,"getPackageJsonFields");o(qMt,"isWorker");o(WMt,"isApps");o(jMt,"isQA");o($Mt,"getServiceName");lc={isTest:u3,isJest:OAe,isDev:qk,isWorker:qMt,isApps:WMt,isQA:jMt,isProd:()=>!qk(),BUDIBASE_ENVIRONMENT:process.env.BUDIBASE_ENVIRONMENT,JWT_SECRET:process.env.JWT_SECRET?(0,a3.createSecretKey)(process.env.JWT_SECRET,"utf8"):void 0,JWT_SECRET_FALLBACK:process.env.JWT_SECRET_FALLBACK?(0,a3.createSecretKey)(process.env.JWT_SECRET_FALLBACK,"utf8"):void 0,ENCRYPTION_KEY:process.env.ENCRYPTION_KEY,API_ENCRYPTION_KEY:MMt(),COUCH_DB_URL:process.env.COUCH_DB_URL||"http://localhost:4005",COUCH_DB_SQL_URL:process.env.COUCH_DB_SQL_URL,COUCH_DB_USERNAME:process.env.COUCH_DB_USER,COUCH_DB_PASSWORD:process.env.COUCH_DB_PASSWORD,GOOGLE_CLIENT_ID:process.env.GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET:process.env.GOOGLE_CLIENT_SECRET,SALT_ROUNDS:process.env.SALT_ROUNDS,REDIS_URL:process.env.REDIS_URL||"localhost:6379",REDIS_PASSWORD:process.env.REDIS_PASSWORD,REDIS_USERNAME:process.env.REDIS_USERNAME,REDIS_CLUSTERED:process.env.REDIS_CLUSTERED,MINIO_ACCESS_KEY:process.env.MINIO_ACCESS_KEY,MINIO_SECRET_KEY:process.env.MINIO_SECRET_KEY,AWS_SESSION_TOKEN:process.env.AWS_SESSION_TOKEN,AWS_REGION:process.env.AWS_REGION||"eu-west-1",MINIO_URL:process.env.MINIO_URL,MINIO_ENABLED:process.env.MINIO_ENABLED||1,S3_IGNORE_SELF_SIGNED:process.env.S3_IGNORE_SELF_SIGNED,INTERNAL_API_KEY:process.env.INTERNAL_API_KEY,INTERNAL_API_KEY_FALLBACK:process.env.INTERNAL_API_KEY_FALLBACK,MULTI_TENANCY:process.env.MULTI_TENANCY,ACCOUNT_PORTAL_URL:process.env.ACCOUNT_PORTAL_URL||"https://account.budibase.app",INTERNAL_ACCOUNT_PORTAL_URL:process.env.INTERNAL_ACCOUNT_PORTAL_URL||process.env.ACCOUNT_PORTAL_URL||"https://account.budibase.app",ACCOUNT_PORTAL_API_KEY:process.env.ACCOUNT_PORTAL_API_KEY||"",BUDICLOUD_URL:process.env.BUDICLOUD_URL||"https://budibase.app",DISABLE_ACCOUNT_PORTAL:process.env.DISABLE_ACCOUNT_PORTAL,SELF_HOSTED:AAe,COOKIE_DOMAIN:process.env.COOKIE_DOMAIN,PLATFORM_URL:process.env.PLATFORM_URL||"",POSTHOG_TOKEN:process.env.POSTHOG_TOKEN,POSTHOG_PERSONAL_TOKEN:process.env.POSTHOG_PERSONAL_TOKEN,POSTHOG_API_HOST:process.env.POSTHOG_API_HOST||"https://us.i.posthog.com",POSTHOG_FEATURE_FLAGS_ENABLED:process.env.POSTHOG_FEATURE_FLAGS_ENABLED,ENABLE_ANALYTICS:process.env.ENABLE_ANALYTICS,TENANT_FEATURE_FLAGS:process.env.TENANT_FEATURE_FLAGS,CLOUDFRONT_CDN:process.env.CLOUDFRONT_CDN,CLOUDFRONT_PRIVATE_KEY_64:process.env.CLOUDFRONT_PRIVATE_KEY_64,CLOUDFRONT_PUBLIC_KEY_ID:process.env.CLOUDFRONT_PUBLIC_KEY_ID,BACKUPS_BUCKET_NAME:process.env.BACKUPS_BUCKET_NAME||z_.BACKUPS,APPS_BUCKET_NAME:process.env.APPS_BUCKET_NAME||z_.APPS,TEMPLATES_BUCKET_NAME:process.env.TEMPLATES_BUCKET_NAME||z_.TEMPLATES,GLOBAL_BUCKET_NAME:process.env.GLOBAL_BUCKET_NAME||z_.GLOBAL,PLUGIN_BUCKET_NAME:process.env.PLUGIN_BUCKET_NAME||z_.PLUGINS,TEMP_BUCKET_NAME:process.env.TEMP_BUCKET_NAME||z_.TEMP,USE_COUCH:process.env.USE_COUCH||!0,MOCK_REDIS:process.env.MOCK_REDIS,DEFAULT_LICENSE:process.env.DEFAULT_LICENSE,SERVICE:$Mt(),LOG_LEVEL:process.env.LOG_LEVEL||"info",SESSION_UPDATE_PERIOD:process.env.SESSION_UPDATE_PERIOD,DEPLOYMENT_ENVIRONMENT:process.env.DEPLOYMENT_ENVIRONMENT||"docker-compose",HTTP_LOGGING:FMt(),ENABLE_AUDIT_LOG_IP_ADDR:process.env.ENABLE_AUDIT_LOG_IP_ADDR,SQL_LOGGING_ENABLE:process.env.SQL_LOGGING_ENABLE,SQL_MAX_ROWS:process.env.SQL_MAX_ROWS,SQL_MAX_RELATED_ROWS:process.env.MAX_RELATED_ROWS,SMTP_FALLBACK_ENABLED:process.env.SMTP_FALLBACK_ENABLED,SMTP_USER:process.env.SMTP_USER,SMTP_PASSWORD:process.env.SMTP_PASSWORD,SMTP_HOST:process.env.SMTP_HOST,SMTP_PORT:parseInt(process.env.SMTP_PORT||""),SMTP_FROM_ADDRESS:process.env.SMTP_FROM_ADDRESS,DISABLE_JWT_WARNING:process.env.DISABLE_JWT_WARNING,BLACKLIST_IPS:process.env.BLACKLIST_IPS,SERVICE_TYPE:"unknown",PASSWORD_MIN_LENGTH:process.env.PASSWORD_MIN_LENGTH,PASSWORD_MAX_LENGTH:process.env.PASSWORD_MAX_LENGTH,ENABLE_SSO_MAINTENANCE_MODE:AAe?process.env.ENABLE_SSO_MAINTENANCE_MODE:!1,...BMt(),DISABLE_PINO_LOGGER:process.env.DISABLE_PINO_LOGGER,OFFLINE_MODE:process.env.OFFLINE_MODE,SESSION_EXPIRY_SECONDS:process.env.SESSION_EXPIRY_SECONDS,_set(e,t){process.env[e]=t,lc[e]=t},ROLLING_LOG_MAX_SIZE:process.env.ROLLING_LOG_MAX_SIZE||"10M",ENABLE_SCIM_LOGGER:process.env.ENABLE_SCIM_LOGGER,BB_ADMIN_USER_EMAIL:process.env.BB_ADMIN_USER_EMAIL,BB_ADMIN_USER_PASSWORD:process.env.BB_ADMIN_USER_PASSWORD,OPENAI_API_KEY:process.env.OPENAI_API_KEY,MIN_VERSION_WITHOUT_POWER_ROLE:process.env.MIN_VERSION_WITHOUT_POWER_ROLE||"3.0.0",DISABLE_CONTENT_SECURITY_POLICY:process.env.DISABLE_CONTENT_SECURITY_POLICY,BSON_BUFFER_SIZE:UMt(process.env.BSON_BUFFER_SIZE),CUSTOM_CSP_MEDIA_SRC:process.env.CUSTOM_CSP_MEDIA_SRC,CUSTOM_CSP_SCRIPT_SRC:process.env.CUSTOM_CSP_SCRIPT_SRC,CUSTOM_CSP_CONNECT_SRC:process.env.CUSTOM_CSP_CONNECT_SRC,CUSTOM_CSP_IMG_SRC:process.env.CUSTOM_CSP_IMG_SRC,CUSTOM_CSP_FONT_SRC:process.env.CUSTOM_CSP_FONT_SRC,CUSTOM_CSP_FRAME_SRC:process.env.CUSTOM_CSP_FRAME_SRC};o(c3,"setEnv");xAe=["API_ENCRYPTION_KEY","BB_ADMIN_USER_PASSWORD","COUCH_DB_PASSWORD","COUCH_DB_SQL_URL","COUCH_DB_URL","GOOGLE_CLIENT_SECRET","INTERNAL_API_KEY_FALLBACK","INTERNAL_API_KEY","JWT_SECRET","MINIO_ACCESS_KEY","MINIO_SECRET_KEY","OPENAI_API_KEY","REDIS_PASSWORD","REDIS_USERNAME"];for(let[e,t]of Object.entries(lc))t==="0"&&(lc[e]=0),t==="false"&&(lc[e]=0);U=lc});var $k={};G($k,{Databases:()=>l3,SEPARATOR:()=>Y_,SelectableDatabase:()=>UA,getRedisClusterOptions:()=>f3,getRedisConnectionDetails:()=>jk,getRedisOptions:()=>_g,removeDbPrefix:()=>d3});function jk(){let e=U.REDIS_PASSWORD,t=U.REDIS_USERNAME,r=U.REDIS_URL.split("//");if(r=r.length>1?r[1]:r[0],r=r.split("@"),r.length>1){let a=r[0].split(":");t=t||a[0]||void 0,e=a[1],r=r[1]}else r=r[0];let[n,i]=r.split(":"),s=parseInt(i);return{host:n,password:e,username:t,port:isNaN(s)?6379:s}}function f3(){return{slotsRefreshTimeout:2e3,dnsLookup:(e,t)=>t(null,e),redisOptions:{..._g(),tls:{}}}}function _g(){let{host:e,password:t,port:r,username:n}=jk();return{connectTimeout:3e4,port:r,host:e,password:t,...n&&{username:n}}}function d3(e){let t=e.split(Y_);return t.length>=2?(t.shift(),t.join(Y_)):t[0]}var Y_,l3,UA,J_=y(()=>{"use strict";tt();Y_="-",l3=(v=>(v.PW_RESETS="pwReset",v.VERIFICATIONS="verification",v.INVITATIONS="invitation",v.DEV_LOCKS="devLocks",v.DEBOUNCE="debounce",v.SESSIONS="session",v.USER_CACHE="users",v.FLAGS="flags",v.WORKSPACE_METADATA="appMetadata",v.QUERY_VARS="queryVars",v.LICENSES="license",v.GENERIC_CACHE="data_cache",v.WRITE_THROUGH="writeThrough",v.LOCKS="locks",v.SOCKET_IO="socket_io",v.BPM_EVENTS="bpmEvents",v.DOC_WRITE_THROUGH="docWriteThrough",v.RECAPTCHA_SESSION="recaptchaSession",v.OPENAPI_IMPORT_SPECS="openapiImportSpecs",v))(l3||{}),UA=(b=>(b[b.DEFAULT=0]="DEFAULT",b[b.SOCKET_IO=1]="SOCKET_IO",b[b.RATE_LIMITING=2]="RATE_LIMITING",b[b.OPENAPI_IMPORT_SPECS=3]="OPENAPI_IMPORT_SPECS",b[b.UNUSED_3=4]="UNUSED_3",b[b.UNUSED_4=5]="UNUSED_4",b[b.UNUSED_5=6]="UNUSED_5",b[b.UNUSED_6=7]="UNUSED_6",b[b.UNUSED_7=8]="UNUSED_7",b[b.UNUSED_8=9]="UNUSED_8",b[b.UNUSED_9=10]="UNUSED_9",b[b.UNUSED_10=11]="UNUSED_10",b[b.UNUSED_11=12]="UNUSED_11",b[b.UNUSED_12=13]="UNUSED_12",b[b.UNUSED_13=14]="UNUSED_13",b[b.UNUSED_14=15]="UNUSED_14",b))(UA||{});o(jk,"getRedisConnectionDetails");o(f3,"getRedisClusterOptions");o(_g,"getRedisOptions");o(d3,"removeDbPrefix")});function yr(){return(0,CAe.v4)().replace(/-/g,"")}var CAe,Vk=y(()=>{"use strict";CAe=require("uuid");o(yr,"newid")});async function m3(e){let t=await p3.genSalt(VMt);return p3.hash(e,t)}async function h3(e,t){return p3.compare(e,t)}var p3,VMt,DAe=y(()=>{"use strict";tt();Vk();p3=require("bcrypt"),VMt=U.SALT_ROUNDS||10;o(m3,"hash");o(h3,"compare")});var FA={};G(FA,{doInAccountContext:()=>GMt,doInIdentityContext:()=>y3,doInUserContext:()=>b3,getAccountUserId:()=>PAe,getIdentity:()=>g3});function g3(){return jf()}function y3(e,t){return BA(e,t)}function b3(e,t,r){let n={...e,_id:e._id,type:"user",hostInfo:{ipAddress:t.request.ip,userAgent:t.userAgent.source}};return y3(n,r)}function GMt(e,t){let r=PAe(e),n=e.tenantId,i={_id:r,type:"user",tenantId:n,account:e};return y3(i,t)}function PAe(e){let t;return NP(e)?t=e.budibaseUserId:t=e.accountId,t}var Gk=y(()=>{"use strict";P();yt();o(g3,"getIdentity");o(y3,"doInIdentityContext");o(b3,"doInUserContext");o(GMt,"doInAccountContext");o(PAe,"getAccountUserId")});var fc,_3,qA=y(()=>{"use strict";tt();fc=o(e=>{let t=_3(e),r,n;if(t.auth?.username)r=t.auth.username;else if(U.COUCH_DB_USERNAME)r=U.COUCH_DB_USERNAME;else if(!U.isTest())throw new Error("CouchDB username not set");if(t.auth?.password)n=t.auth.password;else if(U.COUCH_DB_PASSWORD)n=U.COUCH_DB_PASSWORD;else if(!U.isTest())throw new Error("CouchDB password not set");let i=Buffer.from(`${r}:${n}`).toString("base64"),s=U.COUCH_DB_SQL_URL;if(U.isDev()&&!s)s="http://localhost:4006";else if(!s&&t.url){let a=new URL(t.url);s=t.url.replace(a.port,"4984")}return{url:t.url,sqlUrl:_3(s).url,auth:{username:r,password:n},cookie:`Basic ${i}`}},"getCouchInfo"),_3=o((e=U.COUCH_DB_URL)=>{let t,r,n,i;if(e){/^https?:\/\//i.test(e)||(e=`http://${e}`);let a=e.split("://"),u=a[0],c=a.slice(1).join("://");if(e.includes("@")){let l=c.split("@");i=l[l.length-1];let f=l.slice(0,-1).join("@");if(f.includes(":")){let d=f.split(":");r=d[0],n=d.slice(1).join(":")}else r=f}else i=c;t=`${u}://${i}`}return{url:t,auth:{username:r,password:n}}},"getUrlInfo")});function Hk(e){return e.replace(/(https?:\/\/)|(\/)+/g,"$1$2")}var w3=y(()=>{"use strict";o(Hk,"checkSlashesInUrl")});async function NAe(e,t="GET",r){let{url:n,cookie:i}=fc(),s=`${n}/${e}`;return await WA({url:s,cookie:i,method:t,body:r})}async function WA({url:e,cookie:t,method:r,body:n}){let i={method:r,headers:{Authorization:t}};return n&&r!=="GET"&&(typeof n=="string"?(i.body=n,i.headers["Content-Type"]="text/plain"):(i.body=JSON.stringify(n),i.headers["Content-Type"]="application/json")),await(0,kAe.default)(Hk(encodeURI(e)),i)}async function E3(e,t="GET",r){let n=await NAe(e,t,r);if(n.status<300)return await n.json();throw"Cannot connect to CouchDB instance"}var kAe,v3=y(()=>{"use strict";qA();kAe=q(require("node-fetch"));w3();o(NAe,"directCouchCall");o(WA,"directCouchUrlCall");o(E3,"directCouchQuery")});var Kk=R((zin,MAe)=>{"use strict";var jA=require("buffer").Buffer;function LAe(){return jA.hasOwnProperty("from")&&typeof jA.from=="function"}o(LAe,"hasFrom");function UAe(e){if(!jA.isBuffer(e))throw new Error("Can only clone Buffer.");if(LAe())return jA.from(e);var t=new jA(e.length);return e.copy(t),t}o(UAe,"cloneBuffer");UAe.hasFrom=LAe;MAe.exports=UAe});var $A=R((Jin,FAe)=>{"use strict";FAe.exports=HMt;function HMt(e){return function(){var t=arguments.length;if(t){for(var r=[],n=-1;++n<t;)r[n]=arguments[n];return e.call(this,r)}else return e.call(this,[])}}o(HMt,"argsArray")});var Z_=R(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0});function Qk(e){return"$"+e}o(Qk,"mangle");function KMt(e){return e.substring(1)}o(KMt,"unmangle");function Bp(){this._store={}}o(Bp,"Map$1");Bp.prototype.get=function(e){var t=Qk(e);return this._store[t]};Bp.prototype.set=function(e,t){var r=Qk(e);return this._store[r]=t,!0};Bp.prototype.has=function(e){var t=Qk(e);return t in this._store};Bp.prototype.delete=function(e){var t=Qk(e),r=t in this._store;return delete this._store[t],r};Bp.prototype.forEach=function(e){for(var t=Object.keys(this._store),r=0,n=t.length;r<n;r++){var i=t[r],s=this._store[i];i=KMt(i),e(s,i)}};Object.defineProperty(Bp.prototype,"size",{get:function(){return Object.keys(this._store).length}});function VA(e){if(this._store=new Bp,e&&Array.isArray(e))for(var t=0,r=e.length;t<r;t++)this.add(e[t])}o(VA,"Set$1");VA.prototype.add=function(e){return this._store.set(e,!0)};VA.prototype.has=function(e){return this._store.has(e)};VA.prototype.forEach=function(e){this._store.forEach(function(t,r){e(r)})};Object.defineProperty(VA.prototype,"size",{get:function(){return this._store.size}});function QMt(){if(typeof Symbol>"u"||typeof Map>"u"||typeof Set>"u")return!1;var e=Object.getOwnPropertyDescriptor(Map,Symbol.species);return e&&"get"in e&&Map[Symbol.species]===Map}o(QMt,"supportsMapAndSet");QMt()?(X_.Set=Set,X_.Map=Map):(X_.Set=VA,X_.Map=Bp)});var BAe=R((ton,S3)=>{"use strict";typeof Object.create=="function"?S3.exports=o(function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):S3.exports=o(function(t,r){if(r){t.super_=r;var n=o(function(){},"TempCtor");n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}},"inherits")});var jt=R((non,A3)=>{"use strict";try{if(T3=require("util"),typeof T3.inherits!="function")throw"";A3.exports=T3.inherits}catch{A3.exports=BAe()}var T3});var ew=R(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});function zMt(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(zMt,"_interopDefault");var YMt=zMt(jt());YMt(Lr,Error);function Lr(e,t,r){Error.call(this,r),this.status=e,this.name=t,this.message=r,this.error=!0}o(Lr,"PouchError");Lr.prototype.toString=function(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})};var JMt=new Lr(401,"unauthorized","Name or password is incorrect."),XMt=new Lr(400,"bad_request","Missing JSON list of 'docs'"),ZMt=new Lr(404,"not_found","missing"),eFt=new Lr(409,"conflict","Document update conflict"),tFt=new Lr(400,"bad_request","_id field must contain a string"),rFt=new Lr(412,"missing_id","_id is required for puts"),nFt=new Lr(400,"bad_request","Only reserved document ids may start with underscore."),iFt=new Lr(412,"precondition_failed","Database not open"),qAe=new Lr(500,"unknown_error","Database encountered an unknown error"),oFt=new Lr(500,"badarg","Some query argument is invalid"),sFt=new Lr(400,"invalid_request","Request was invalid"),aFt=new Lr(400,"query_parse_error","Some query parameter is invalid"),uFt=new Lr(500,"doc_validation","Bad special document member"),cFt=new Lr(400,"bad_request","Something wrong with the request"),lFt=new Lr(400,"bad_request","Document must be a JSON object"),fFt=new Lr(404,"not_found","Database not found"),dFt=new Lr(500,"indexed_db_went_bad","unknown"),pFt=new Lr(500,"web_sql_went_bad","unknown"),mFt=new Lr(500,"levelDB_went_went_bad","unknown"),hFt=new Lr(403,"forbidden","Forbidden by design doc validate_doc_update function"),gFt=new Lr(400,"bad_request","Invalid rev format"),yFt=new Lr(412,"file_exists","The database could not be created, the file already exists."),bFt=new Lr(412,"missing_stub","A pre-existing attachment stub wasn't found"),_Ft=new Lr(413,"invalid_url","Provided URL is invalid");function wFt(e,t){function r(n){for(var i=Object.getOwnPropertyNames(e),s=0,a=i.length;s<a;s++)typeof e[i[s]]!="function"&&(this[i[s]]=e[i[s]]);n!==void 0&&(this.reason=n)}return o(r,"CustomPouchError"),r.prototype=Lr.prototype,new r(t)}o(wFt,"createError");function EFt(e){if(typeof e!="object"){var t=e;e=qAe,e.data=t}return"error"in e&&e.error==="conflict"&&(e.name="conflict",e.status=409),"name"in e||(e.name=e.error||"unknown"),"status"in e||(e.status=500),"message"in e||(e.message=e.message||e.reason),e}o(EFt,"generateErrorFromResponse");Or.UNAUTHORIZED=JMt;Or.MISSING_BULK_DOCS=XMt;Or.MISSING_DOC=ZMt;Or.REV_CONFLICT=eFt;Or.INVALID_ID=tFt;Or.MISSING_ID=rFt;Or.RESERVED_ID=nFt;Or.NOT_OPEN=iFt;Or.UNKNOWN_ERROR=qAe;Or.BAD_ARG=oFt;Or.INVALID_REQUEST=sFt;Or.QUERY_PARSE_ERROR=aFt;Or.DOC_VALIDATION=uFt;Or.BAD_REQUEST=cFt;Or.NOT_AN_OBJECT=lFt;Or.DB_MISSING=fFt;Or.WSQ_ERROR=pFt;Or.LDB_ERROR=mFt;Or.FORBIDDEN=hFt;Or.INVALID_REV=gFt;Or.FILE_EXISTS=yFt;Or.MISSING_STUB=bFt;Or.IDB_ERROR=dFt;Or.INVALID_URL=_Ft;Or.createError=wFt;Or.generateErrorFromResponse=EFt});var tw=R(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});function vFt(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(vFt,"_interopDefault");var WAe=vFt(require("crypto"));function SFt(e,t){var r=WAe.createHash("md5").update(e,"binary").digest("base64");t(r)}o(SFt,"binaryMd5");function TFt(e){return WAe.createHash("md5").update(e,"binary").digest("hex")}o(TFt,"stringMd5");zk.binaryMd5=SFt;zk.stringMd5=TFt});var ZAe=R(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});function Yk(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(Yk,"_interopDefault");var AFt=Yk(Kk()),O3=Yk($A()),RFt=Z_(),IFt=Yk(jt()),qp=ew(),Jk=Yk(require("events")),GAe=require("uuid"),OFt=tw();function xFt(e){return e instanceof Buffer}o(xFt,"isBinaryObject");var HAe=Function.prototype.toString,CFt=HAe.call(Object);function DFt(e){var t=Object.getPrototypeOf(e);if(t===null)return!0;var r=t.constructor;return typeof r=="function"&&r instanceof r&&HAe.call(r)==CFt}o(DFt,"isPlainObject");function GA(e){var t,r,n;if(!e||typeof e!="object")return e;if(Array.isArray(e)){for(t=[],r=0,n=e.length;r<n;r++)t[r]=GA(e[r]);return t}if(e instanceof Date)return e.toISOString();if(xFt(e))return AFt(e);if(!DFt(e))return e;t={};for(r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=GA(e[r]);typeof i<"u"&&(t[r]=i)}return t}o(GA,"clone");function KAe(e){var t=!1;return O3(function(r){if(t)throw new Error("once called more than once");t=!0,e.apply(this,r)})}o(KAe,"once");function QAe(e){return O3(function(t){t=GA(t);var r=this,n=typeof t[t.length-1]=="function"?t.pop():!1,i=new Promise(function(s,a){var u;try{var c=KAe(function(l,f){l?a(l):s(f)});t.push(c),u=e.apply(r,t),u&&typeof u.then=="function"&&s(u)}catch(l){a(l)}});return n&&i.then(function(s){n(null,s)},n),i})}o(QAe,"toPromise");function PFt(e,t,r){if(e.constructor.listeners("debug").length){for(var n=["api",e.name,t],i=0;i<r.length-1;i++)n.push(r[i]);e.constructor.emit("debug",n);var s=r[r.length-1];r[r.length-1]=function(a,u){var c=["api",e.name,t];c=c.concat(a?["error",a]:["success",u]),e.constructor.emit("debug",c),s(a,u)}}}o(PFt,"logApiCall");function kFt(e,t){return QAe(O3(function(r){if(this._closed)return Promise.reject(new Error("database is closed"));if(this._destroyed)return Promise.reject(new Error("database is destroyed"));var n=this;return PFt(n,e,r),this.taskqueue.isReady?t.apply(this,r):new Promise(function(i,s){n.taskqueue.addTask(function(a){a?s(a):i(n[e].apply(n,r))})})}))}o(kFt,"adapterFun");function x3(e,t){for(var r={},n=0,i=t.length;n<i;n++){var s=t[n];s in e&&(r[s]=e[s])}return r}o(x3,"pick");var NFt=6;function jAe(e){return e}o(jAe,"identityFunction");function LFt(e){return[{ok:e}]}o(LFt,"formatResultForOpenRevsGet");function UFt(e,t,r){var n=t.docs,i=new RFt.Map;n.forEach(function(g){i.has(g.id)?i.get(g.id).push(g):i.set(g.id,[g])});var s=i.size,a=0,u=new Array(s);function c(){var g=[];u.forEach(function(b){b.docs.forEach(function(w){g.push({id:b.id,docs:[w]})})}),r(null,{results:g})}o(c,"collapseResultsAndFinish");function l(){++a===s&&c()}o(l,"checkDone");function f(g,b,w){u[g]={id:b,docs:w},l()}o(f,"gotResult");var d=[];i.forEach(function(g,b){d.push(b)});var p=0;function m(){if(!(p>=d.length)){var g=Math.min(p+NFt,d.length),b=d.slice(p,g);h(b,p),p+=b.length}}o(m,"nextBatch");function h(g,b){g.forEach(function(w,E){var v=b+E,S=i.get(w),T=x3(S[0],["atts_since","attachments"]);T.open_revs=S.map(function(O){return O.rev}),T.open_revs=T.open_revs.filter(jAe);var x=jAe;T.open_revs.length===0&&(delete T.open_revs,x=LFt),["revs","attachments","binary","ajax","latest"].forEach(function(O){O in t&&(T[O]=t[O])}),e.get(w,T,function(O,C){var D;O?D=[{error:O}]:D=x(C),f(v,w,D),m()})})}o(h,"processBatch"),m()}o(UFt,"bulkGet");function C3(){return!1}o(C3,"hasLocalStorage");function zAe(e){process.nextTick(e)}o(zAe,"nextTick");IFt(rw,Jk);function MFt(e){C3()&&addEventListener("storage",function(t){e.emit(t.key)})}o(MFt,"attachBrowserEvents");function rw(){Jk.call(this),this._listeners={},MFt(this)}o(rw,"Changes");rw.prototype.addListener=function(e,t,r,n){if(this._listeners[t])return;var i=this,s=!1;function a(){if(!i._listeners[t])return;if(s){s="waiting";return}s=!0;var u=x3(n,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary","return_docs"]);function c(){s=!1}o(c,"onError"),r.changes(u).on("change",function(l){l.seq>n.since&&!n.cancelled&&(n.since=l.seq,n.onChange(l))}).on("complete",function(){s==="waiting"&&zAe(a),s=!1}).on("error",c)}o(a,"eventFunction"),this._listeners[t]=a,this.on(e,a)};rw.prototype.removeListener=function(e,t){t in this._listeners&&(Jk.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])};rw.prototype.notifyLocalWindows=function(e){C3()&&(localStorage[e]=localStorage[e]==="a"?"b":"a")};rw.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};function YAe(e){if(typeof console<"u"&&typeof console[e]=="function"){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}o(YAe,"guardedConsole");function FFt(e,t){var r=6e5;e=parseInt(e,10)||0,t=parseInt(t,10),t!==t||t<=e?t=(e||1)<<1:t=t+1,t>r&&(e=r>>1,t=r);var n=Math.random(),i=t-e;return~~(i*n+e)}o(FFt,"randomNumber");function BFt(e){var t=0;return e||(t=2e3),FFt(e,t)}o(BFt,"defaultBackOff");var qFt=o(function(){},"res"),R3;typeof Object.assign=="function"?R3=Object.assign:R3=o(function(e){for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(n!=null)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},"assign");var WFt=R3;function jFt(e,t,r){try{return!e(t,r)}catch(i){var n="Filter function threw: "+i.toString();return qp.createError(qp.BAD_REQUEST,n)}}o(jFt,"tryFilter");function $Ft(e){var t={},r=e.filter&&typeof e.filter=="function";return t.query=e.query_params,o(function(i){i.doc||(i.doc={});var s=r&&jFt(e.filter,i.doc,t);if(typeof s=="object")return s;if(s)return!1;if(!e.include_docs)delete i.doc;else if(!e.attachments)for(var a in i.doc._attachments)i.doc._attachments.hasOwnProperty(a)&&(i.doc._attachments[a].stub=!0);return!0},"filter")}o($Ft,"filterChange");function VFt(e){for(var t=[],r=0,n=e.length;r<n;r++)t=t.concat(e[r]);return t}o(VFt,"flatten");function GFt(){}o(GFt,"f");var HFt=GFt.name,I3;HFt?I3=o(function(e){return e.name},"res$1"):I3=o(function(e){var t=e.toString().match(/^\s*function\s*(?:(\S+)\s*)?\(/);return t&&t[1]?t[1]:""},"res$1");var KFt=I3;function QFt(e){var t;if(e?typeof e!="string"?t=qp.createError(qp.INVALID_ID):/^_/.test(e)&&!/^_(design|local)/.test(e)&&(t=qp.createError(qp.RESERVED_ID)):t=qp.createError(qp.MISSING_ID),t)throw t}o(QFt,"invalidIdError");function zFt(e){return typeof e._remote=="boolean"?e._remote:typeof e.type=="function"?(YAe("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),e.type()==="http"):!1}o(zFt,"isRemote");function YFt(e,t){return"listenerCount"in e?e.listenerCount(t):Jk.listenerCount(e,t)}o(YFt,"listenerCount");function JAe(e){if(!e)return null;var t=e.split("/");return t.length===2?t:t.length===1?[e,e]:null}o(JAe,"parseDesignDocFunctionName");function JFt(e){var t=JAe(e);return t?t.join("/"):null}o(JFt,"normalizeDesignDocFunctionName");var $Ae=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],VAe="queryKey",XFt=/(?:^|&)([^&=]*)=?([^&]*)/g,ZFt=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function eBt(e){for(var t=ZFt.exec(e),r={},n=14;n--;){var i=$Ae[n],s=t[n]||"",a=["user","password"].indexOf(i)!==-1;r[i]=a?decodeURIComponent(s):s}return r[VAe]={},r[$Ae[12]].replace(XFt,function(u,c,l){c&&(r[VAe][c]=l)}),r}o(eBt,"parseUri");function tBt(e,t){var r=[],n=[];for(var i in t)t.hasOwnProperty(i)&&(r.push(i),n.push(t[i]));return r.push(e),Function.apply(null,r).apply(null,n)}o(tBt,"scopeEval");function XAe(e,t,r){return new Promise(function(n,i){e.get(t,function(s,a){if(s){if(s.status!==404)return i(s);a={}}var u=a._rev,c=r(a);if(!c)return n({updated:!1,rev:u});c._id=t,c._rev=u,n(rBt(e,c,r))})})}o(XAe,"upsert");function rBt(e,t,r){return e.put(t).then(function(n){return{updated:!0,rev:n.rev}},function(n){if(n.status!==409)throw n;return XAe(e,t._id,r)})}o(rBt,"tryAndPut");function nBt(e,t){var r=GA(e);return t?(delete r._rev_tree,OFt.stringMd5(JSON.stringify(r))):GAe.v4().replace(/-/g,"").toLowerCase()}o(nBt,"rev");var iBt=GAe.v4;xr.adapterFun=kFt;xr.assign=WFt;xr.bulkGetShim=UFt;xr.changesHandler=rw;xr.clone=GA;xr.defaultBackOff=BFt;xr.explainError=qFt;xr.filterChange=$Ft;xr.flatten=VFt;xr.functionName=KFt;xr.guardedConsole=YAe;xr.hasLocalStorage=C3;xr.invalidIdError=QFt;xr.isRemote=zFt;xr.listenerCount=YFt;xr.nextTick=zAe;xr.normalizeDdocFunctionName=JFt;xr.once=KAe;xr.parseDdocFunctionName=JAe;xr.parseUri=eBt;xr.pick=x3;xr.rev=nBt;xr.scopeEval=tBt;xr.toPromise=QAe;xr.upsert=XAe;xr.uuid=iBt});var wg=R((lon,eRe)=>{"use strict";eRe.exports=sBt;var oBt=Object.prototype.hasOwnProperty;function sBt(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)oBt.call(r,n)&&(e[n]=r[n])}return e}o(sBt,"extend")});var rRe=R((don,tRe)=>{"use strict";tRe.exports=uBt;var aBt=Object.prototype.hasOwnProperty;function uBt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)aBt.call(r,n)&&(e[n]=r[n])}return e}o(uBt,"extend")});var D3=R((mon,iRe)=>{"use strict";var nRe=wg(),cBt=rRe();iRe.exports=o(function(){var t=nRe.apply(null,arguments);return cBt(t,{bufferKeys:t.bufferKeys||!1,snapshots:t.snapshots||!1,permanence:t.permanence||!1,seek:t.seek||!1,clear:t.clear||!1,status:t.status||!1,createIfMissing:t.createIfMissing||!1,errorIfExists:t.errorIfExists||!1,deferredOpen:t.deferredOpen||!1,openCallback:t.openCallback||!1,promises:t.promises||!1,streams:t.streams||!1,encodings:t.encodings||!1,additionalMethods:nRe(t.additionalMethods)})},"supports")});var Xk=R((gon,oRe)=>{"use strict";oRe.exports=process.nextTick});var P3=R((yon,sRe)=>{"use strict";var nw=Xk();function Wp(e){if(typeof e!="object"||e===null)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._ended=!1,this._nexting=!1}o(Wp,"AbstractIterator");Wp.prototype.next=function(e){var t=this;if(typeof e!="function")throw new Error("next() requires a callback argument");return t._ended?(nw(e,new Error("cannot call next() after end()")),t):t._nexting?(nw(e,new Error("cannot call next() before previous next() has completed")),t):(t._nexting=!0,t._next(function(){t._nexting=!1,e.apply(null,arguments)}),t)};Wp.prototype._next=function(e){nw(e)};Wp.prototype.seek=function(e){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");e=this.db._serializeKey(e),this._seek(e)};Wp.prototype._seek=function(e){};Wp.prototype.end=function(e){if(typeof e!="function")throw new Error("end() requires a callback argument");if(this._ended)return nw(e,new Error("end() already called on iterator"));this._ended=!0,this._end(e)};Wp.prototype._end=function(e){nw(e)};Wp.prototype._nextTick=nw;sRe.exports=Wp});var k3=R((_on,aRe)=>{"use strict";var lBt=Xk();function dc(e){if(typeof e!="object"||e===null)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=e,this._operations=[],this._written=!1}o(dc,"AbstractChainedBatch");dc.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")};dc.prototype.put=function(e,t){this._checkWritten();var r=this.db._checkKey(e)||this.db._checkValue(t);if(r)throw r;return e=this.db._serializeKey(e),t=this.db._serializeValue(t),this._put(e,t),this};dc.prototype._put=function(e,t){this._operations.push({type:"put",key:e,value:t})};dc.prototype.del=function(e){this._checkWritten();var t=this.db._checkKey(e);if(t)throw t;return e=this.db._serializeKey(e),this._del(e),this};dc.prototype._del=function(e){this._operations.push({type:"del",key:e})};dc.prototype.clear=function(){return this._checkWritten(),this._clear(),this};dc.prototype._clear=function(){this._operations=[]};dc.prototype.write=function(e,t){if(this._checkWritten(),typeof e=="function"&&(t=e),typeof t!="function")throw new Error("write() requires a callback argument");(typeof e!="object"||e===null)&&(e={}),this._written=!0,this._write(e,t)};dc.prototype._write=function(e,t){this.db._batch(this._operations,e,t)};dc.prototype._nextTick=lBt;aRe.exports=dc});var lRe=R((Eon,cRe)=>{"use strict";var fBt=wg(),dBt=D3(),pBt=require("buffer").Buffer,mBt=P3(),hBt=k3(),Io=Xk(),gBt=Object.prototype.hasOwnProperty,yBt="start end gt gte lt lte".split(" ");function mn(e){this.status="new",this.supports=dBt(e,{status:!0})}o(mn,"AbstractLevelDOWN");mn.prototype.open=function(e,t){var r=this,n=this.status;if(typeof e=="function"&&(t=e),typeof t!="function")throw new Error("open() requires a callback argument");(typeof e!="object"||e===null)&&(e={}),e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists,this.status="opening",this._open(e,function(i){if(i)return r.status=n,t(i);r.status="open",t()})};mn.prototype._open=function(e,t){Io(t)};mn.prototype.close=function(e){var t=this,r=this.status;if(typeof e!="function")throw new Error("close() requires a callback argument");this.status="closing",this._close(function(n){if(n)return t.status=r,e(n);t.status="closed",e()})};mn.prototype._close=function(e){Io(e)};mn.prototype.get=function(e,t,r){if(typeof t=="function"&&(r=t),typeof r!="function")throw new Error("get() requires a callback argument");var n=this._checkKey(e);if(n)return Io(r,n);e=this._serializeKey(e),(typeof t!="object"||t===null)&&(t={}),t.asBuffer=t.asBuffer!==!1,this._get(e,t,r)};mn.prototype._get=function(e,t,r){Io(function(){r(new Error("NotFound"))})};mn.prototype.put=function(e,t,r,n){if(typeof r=="function"&&(n=r),typeof n!="function")throw new Error("put() requires a callback argument");var i=this._checkKey(e)||this._checkValue(t);if(i)return Io(n,i);e=this._serializeKey(e),t=this._serializeValue(t),(typeof r!="object"||r===null)&&(r={}),this._put(e,t,r,n)};mn.prototype._put=function(e,t,r,n){Io(n)};mn.prototype.del=function(e,t,r){if(typeof t=="function"&&(r=t),typeof r!="function")throw new Error("del() requires a callback argument");var n=this._checkKey(e);if(n)return Io(r,n);e=this._serializeKey(e),(typeof t!="object"||t===null)&&(t={}),this._del(e,t,r)};mn.prototype._del=function(e,t,r){Io(r)};mn.prototype.batch=function(e,t,r){if(!arguments.length)return this._chainedBatch();if(typeof t=="function"&&(r=t),typeof e=="function"&&(r=e),typeof r!="function")throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return Io(r,new Error("batch(array) requires an array argument"));if(e.length===0)return Io(r);(typeof t!="object"||t===null)&&(t={});for(var n=new Array(e.length),i=0;i<e.length;i++){if(typeof e[i]!="object"||e[i]===null)return Io(r,new Error("batch(array) element must be an object and not `null`"));var s=fBt(e[i]);if(s.type!=="put"&&s.type!=="del")return Io(r,new Error("`type` must be 'put' or 'del'"));var a=this._checkKey(s.key);if(a)return Io(r,a);if(s.key=this._serializeKey(s.key),s.type==="put"){var u=this._checkValue(s.value);if(u)return Io(r,u);s.value=this._serializeValue(s.value)}n[i]=s}this._batch(n,t,r)};mn.prototype._batch=function(e,t,r){Io(r)};mn.prototype.clear=function(e,t){if(typeof e=="function")t=e;else if(typeof t!="function")throw new Error("clear() requires a callback argument");e=uRe(this,e),e.reverse=!!e.reverse,e.limit="limit"in e?e.limit:-1,this._clear(e,t)};mn.prototype._clear=function(e,t){e.keys=!0,e.values=!1,e.keyAsBuffer=!0,e.valueAsBuffer=!0;var r=this._iterator(e),n={},i=this,s=o(function(a){if(a)return r.end(function(){t(a)});r.next(function(u,c){if(u)return s(u);if(c===void 0)return r.end(t);i._del(c,n,s)})},"next");s()};mn.prototype._setupIteratorOptions=function(e){return e=uRe(this,e),e.reverse=!!e.reverse,e.keys=e.keys!==!1,e.values=e.values!==!1,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=e.keyAsBuffer!==!1,e.valueAsBuffer=e.valueAsBuffer!==!1,e};function uRe(e,t){var r={};for(var n in t)if(gBt.call(t,n)){var i=t[n];bBt(n)&&(i=e._serializeKey(i)),r[n]=i}return r}o(uRe,"cleanRangeOptions");function bBt(e){return yBt.indexOf(e)!==-1}o(bBt,"isRangeOption");mn.prototype.iterator=function(e){return(typeof e!="object"||e===null)&&(e={}),e=this._setupIteratorOptions(e),this._iterator(e)};mn.prototype._iterator=function(e){return new mBt(this)};mn.prototype._chainedBatch=function(){return new hBt(this)};mn.prototype._serializeKey=function(e){return e};mn.prototype._serializeValue=function(e){return e};mn.prototype._checkKey=function(e){if(e==null)return new Error("key cannot be `null` or `undefined`");if(pBt.isBuffer(e)&&e.length===0)return new Error("key cannot be an empty Buffer");if(e==="")return new Error("key cannot be an empty String");if(Array.isArray(e)&&e.length===0)return new Error("key cannot be an empty Array")};mn.prototype._checkValue=function(e){if(e==null)return new Error("value cannot be `null` or `undefined`")};mn.prototype._nextTick=Io;cRe.exports=mn});var N3=R(Zk=>{"use strict";Zk.AbstractLevelDOWN=lRe();Zk.AbstractIterator=P3();Zk.AbstractChainedBatch=k3()});var pRe=R((Ton,dRe)=>{"use strict";var fRe=N3().AbstractIterator,_Bt=jt();function iw(e,t){fRe.call(this,e),this._options=t,this._iterator=null,this._operations=[]}o(iw,"DeferredIterator");_Bt(iw,fRe);iw.prototype.setDb=function(e){var t=this._iterator=e.iterator(this._options);this._operations.forEach(function(r){t[r.method].apply(t,r.args)})};iw.prototype._operation=function(e,t){if(this._iterator)return this._iterator[e].apply(this._iterator,t);this._operations.push({method:e,args:t})};"next end".split(" ").forEach(function(e){iw.prototype["_"+e]=function(){this._operation(e,arguments)}});iw.prototype.seek=function(){this._operation("seek",arguments)};dRe.exports=iw});var bRe=R((Ron,L3)=>{"use strict";var mRe=N3().AbstractLevelDOWN,wBt=jt(),hRe=pRe(),gRe="put get del batch clear".split(" "),EBt="approximateSize compactRange".split(" ");function Eg(e){mRe.call(this,e.supports||{}),EBt.forEach(function(t){typeof e[t]=="function"&&!this.supports.additionalMethods[t]&&(this.supports.additionalMethods[t]=!0)},this),this._db=e,this._operations=[],yRe(this)}o(Eg,"DeferredLevelDOWN");wBt(Eg,mRe);Eg.prototype.type="deferred-leveldown";Eg.prototype._open=function(e,t){var r=this;this._db.open(e,function(n){if(n)return t(n);r._operations.forEach(function(i){i.iterator?i.iterator.setDb(r._db):r._db[i.method].apply(r._db,i.args)}),r._operations=[],vBt(r),t()})};Eg.prototype._close=function(e){var t=this;this._db.close(function(r){if(r)return e(r);yRe(t),e()})};function vBt(e){gRe.concat("iterator").forEach(function(t){e["_"+t]=function(){return this._db[t].apply(this._db,arguments)}}),Object.keys(e.supports.additionalMethods).forEach(function(t){e[t]=function(){return this._db[t].apply(this._db,arguments)}})}o(vBt,"open");function yRe(e){gRe.forEach(function(t){e["_"+t]=function(){this._operations.push({method:t,args:arguments})}}),Object.keys(e.supports.additionalMethods).forEach(function(t){e[t]=function(){this._operations.push({method:t,args:arguments})}}),e._iterator=function(t){var r=new hRe(e,t);return this._operations.push({iterator:r}),r}}o(yRe,"closed");Eg.prototype._serializeKey=function(e){return e};Eg.prototype._serializeValue=function(e){return e};L3.exports=Eg;L3.exports.DeferredIterator=hRe});var U3=R((Oon,_Re)=>{"use strict";_Re.exports=require("stream")});var ARe=R((xon,TRe)=>{"use strict";function wRe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}o(wRe,"ownKeys");function ERe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wRe(Object(r),!0).forEach(function(n){SBt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wRe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}o(ERe,"_objectSpread");function SBt(e,t,r){return t=SRe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(SBt,"_defineProperty");function TBt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}o(TBt,"_classCallCheck");function vRe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,SRe(n.key),n)}}o(vRe,"_defineProperties");function ABt(e,t,r){return t&&vRe(e.prototype,t),r&&vRe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}o(ABt,"_createClass");function SRe(e){var t=RBt(e,"string");return typeof t=="symbol"?t:String(t)}o(SRe,"_toPropertyKey");function RBt(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}o(RBt,"_toPrimitive");var IBt=require("buffer"),eN=IBt.Buffer,OBt=require("util"),M3=OBt.inspect,xBt=M3&&M3.custom||"inspect";function CBt(e,t,r){eN.prototype.copy.call(e,t,r)}o(CBt,"copyBuffer");TRe.exports=function(){function e(){TBt(this,e),this.head=null,this.tail=null,this.length=0}return o(e,"BufferList"),ABt(e,[{key:"push",value:o(function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},"push")},{key:"unshift",value:o(function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},"unshift")},{key:"shift",value:o(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift")},{key:"clear",value:o(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:o(function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},"join")},{key:"concat",value:o(function(r){if(this.length===0)return eN.alloc(0);for(var n=eN.allocUnsafe(r>>>0),i=this.head,s=0;i;)CBt(i.data,n,s),s+=i.data.length,i=i.next;return n},"concat")},{key:"consume",value:o(function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i},"consume")},{key:"first",value:o(function(){return this.head.data},"first")},{key:"_getString",value:o(function(r){var n=this.head,i=1,s=n.data;for(r-=s.length;n=n.next;){var a=n.data,u=r>a.length?a.length:r;if(u===a.length?s+=a:s+=a.slice(0,r),r-=u,r===0){u===a.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(u));break}++i}return this.length-=i,s},"_getString")},{key:"_getBuffer",value:o(function(r){var n=eN.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var a=i.data,u=r>a.length?a.length:r;if(a.copy(n,n.length-r,0,u),r-=u,r===0){u===a.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(u));break}++s}return this.length-=s,n},"_getBuffer")},{key:xBt,value:o(function(r,n){return M3(this,ERe(ERe({},n),{},{depth:0,customInspect:!1}))},"value")}]),e}()});var B3=R((Don,IRe)=>{"use strict";function DBt(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(F3,this,e)):process.nextTick(F3,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(tN,r):(r._writableState.errorEmitted=!0,process.nextTick(RRe,r,s)):process.nextTick(RRe,r,s):t?(process.nextTick(tN,r),t(s)):process.nextTick(tN,r)}),this)}o(DBt,"destroy");function RRe(e,t){F3(e,t),tN(e)}o(RRe,"emitErrorAndCloseNT");function tN(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}o(tN,"emitCloseNT");function PBt(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}o(PBt,"undestroy");function F3(e,t){e.emit("error",t)}o(F3,"emitErrorNT");function kBt(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}o(kBt,"errorOrDestroy");IRe.exports={destroy:DBt,undestroy:PBt,errorOrDestroy:kBt}});var jp=R((kon,CRe)=>{"use strict";var xRe={};function au(e,t,r){r||(r=Error);function n(s,a,u){return typeof t=="string"?t:t(s,a,u)}o(n,"getMessage");class i extends r{static{o(this,"NodeError")}constructor(a,u,c){super(n(a,u,c))}}i.prototype.name=r.name,i.prototype.code=e,xRe[e]=i}o(au,"createErrorType");function ORe(e,t){if(Array.isArray(e)){let r=e.length;return e=e.map(n=>String(n)),r>2?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:r===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}o(ORe,"oneOf");function NBt(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}o(NBt,"startsWith");function LBt(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}o(LBt,"endsWith");function UBt(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}o(UBt,"includes");au("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);au("ERR_INVALID_ARG_TYPE",function(e,t,r){let n;typeof t=="string"&&NBt(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i;if(LBt(e," argument"))i=`The ${e} ${n} ${ORe(t,"type")}`;else{let s=UBt(e,".")?"property":"argument";i=`The "${e}" ${s} ${n} ${ORe(t,"type")}`}return i+=`. Received type ${typeof r}`,i},TypeError);au("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");au("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});au("ERR_STREAM_PREMATURE_CLOSE","Premature close");au("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});au("ERR_MULTIPLE_CALLBACK","Callback called multiple times");au("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");au("ERR_STREAM_WRITE_AFTER_END","write after end");au("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);au("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);au("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");CRe.exports.codes=xRe});var q3=R((Lon,DRe)=>{"use strict";var MBt=jp().codes.ERR_INVALID_OPT_VALUE;function FBt(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}o(FBt,"highWaterMarkFrom");function BBt(e,t,r,n){var i=FBt(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new MBt(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}o(BBt,"getHighWaterMark");DRe.exports={getHighWaterMark:BBt}});var W3=R((Mon,PRe)=>{"use strict";PRe.exports=require("util").deprecate});var V3=R((Fon,FRe)=>{"use strict";FRe.exports=Fn;function NRe(e){var t=this;this.next=null,this.entry=null,this.finish=function(){d1t(t,e)}}o(NRe,"CorkedRequest");var ow;Fn.WritableState=KA;var qBt={deprecate:W3()},LRe=U3(),nN=require("buffer").Buffer,WBt=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function jBt(e){return nN.from(e)}o(jBt,"_uint8ArrayToBuffer");function $Bt(e){return nN.isBuffer(e)||e instanceof WBt}o($Bt,"_isUint8Array");var $3=B3(),VBt=q3(),GBt=VBt.getHighWaterMark,$p=jp().codes,HBt=$p.ERR_INVALID_ARG_TYPE,KBt=$p.ERR_METHOD_NOT_IMPLEMENTED,QBt=$p.ERR_MULTIPLE_CALLBACK,zBt=$p.ERR_STREAM_CANNOT_PIPE,YBt=$p.ERR_STREAM_DESTROYED,JBt=$p.ERR_STREAM_NULL_VALUES,XBt=$p.ERR_STREAM_WRITE_AFTER_END,ZBt=$p.ERR_UNKNOWN_ENCODING,sw=$3.errorOrDestroy;jt()(Fn,LRe);function e1t(){}o(e1t,"nop");function KA(e,t,r){ow=ow||vg(),e=e||{},typeof r!="boolean"&&(r=t instanceof ow),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=GBt(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=e.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){a1t(t,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new NRe(this)}o(KA,"WritableState");KA.prototype.getBuffer=o(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(KA.prototype,"buffer",{get:qBt.deprecate(o(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var rN;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(rN=Function.prototype[Symbol.hasInstance],Object.defineProperty(Fn,Symbol.hasInstance,{value:o(function(t){return rN.call(this,t)?!0:this!==Fn?!1:t&&t._writableState instanceof KA},"value")})):rN=o(function(t){return t instanceof this},"realHasInstance");function Fn(e){ow=ow||vg();var t=this instanceof ow;if(!t&&!rN.call(Fn,this))return new Fn(e);this._writableState=new KA(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),LRe.call(this)}o(Fn,"Writable");Fn.prototype.pipe=function(){sw(this,new zBt)};function t1t(e,t){var r=new XBt;sw(e,r),process.nextTick(t,r)}o(t1t,"writeAfterEnd");function r1t(e,t,r,n){var i;return r===null?i=new JBt:typeof r!="string"&&!t.objectMode&&(i=new HBt("chunk",["string","Buffer"],r)),i?(sw(e,i),process.nextTick(n,i),!1):!0}o(r1t,"validChunk");Fn.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&$Bt(e);return s&&!nN.isBuffer(e)&&(e=jBt(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=e1t),n.ending?t1t(this,r):(s||r1t(this,n,e,r))&&(n.pendingcb++,i=i1t(this,n,s,e,t,r)),i};Fn.prototype.cork=function(){this._writableState.corked++};Fn.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&URe(this,e))};Fn.prototype.setDefaultEncoding=o(function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new ZBt(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty(Fn.prototype,"writableBuffer",{enumerable:!1,get:o(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function n1t(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=nN.from(t,r)),t}o(n1t,"decodeChunk");Object.defineProperty(Fn.prototype,"writableHighWaterMark",{enumerable:!1,get:o(function(){return this._writableState.highWaterMark},"get")});function i1t(e,t,r,n,i,s){if(!r){var a=n1t(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var u=t.objectMode?1:n.length;t.length+=u;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else j3(e,t,!1,u,n,i,s);return c}o(i1t,"writeOrBuffer");function j3(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new YBt("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}o(j3,"doWrite");function o1t(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(HA,e,t),e._writableState.errorEmitted=!0,sw(e,n)):(i(n),e._writableState.errorEmitted=!0,sw(e,n),HA(e,t))}o(o1t,"onwriteError");function s1t(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}o(s1t,"onwriteStateUpdate");function a1t(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new QBt;if(s1t(r),t)o1t(e,r,n,t,i);else{var s=MRe(r)||e.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&URe(e,r),n?process.nextTick(kRe,e,r,s,i):kRe(e,r,s,i)}}o(a1t,"onwrite");function kRe(e,t,r,n){r||u1t(e,t),t.pendingcb--,n(),HA(e,t)}o(kRe,"afterWrite");function u1t(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}o(u1t,"onwriteDrain");function URe(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,j3(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new NRe(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback,d=t.objectMode?1:c.length;if(j3(e,t,!1,d,c,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}o(URe,"clearBuffer");Fn.prototype._write=function(e,t,r){r(new KBt("_write()"))};Fn.prototype._writev=null;Fn.prototype.end=function(e,t,r){var n=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||f1t(this,n,r),this};Object.defineProperty(Fn.prototype,"writableLength",{enumerable:!1,get:o(function(){return this._writableState.length},"get")});function MRe(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}o(MRe,"needFinish");function c1t(e,t){e._final(function(r){t.pendingcb--,r&&sw(e,r),t.prefinished=!0,e.emit("prefinish"),HA(e,t)})}o(c1t,"callFinal");function l1t(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(c1t,e,t)):(t.prefinished=!0,e.emit("prefinish")))}o(l1t,"prefinish");function HA(e,t){var r=MRe(t);if(r&&(l1t(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}o(HA,"finishMaybe");function f1t(e,t,r){t.ending=!0,HA(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}o(f1t,"endWritable");function d1t(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}o(d1t,"onCorkedFinish");Object.defineProperty(Fn.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:o(function(t){this._writableState&&(this._writableState.destroyed=t)},"set")});Fn.prototype.destroy=$3.destroy;Fn.prototype._undestroy=$3.undestroy;Fn.prototype._destroy=function(e,t){t(e)}});var vg=R((qon,qRe)=>{"use strict";var p1t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};qRe.exports=dl;var BRe=K3(),H3=V3();jt()(dl,BRe);for(G3=p1t(H3.prototype),iN=0;iN<G3.length;iN++)oN=G3[iN],dl.prototype[oN]||(dl.prototype[oN]=H3.prototype[oN]);var G3,oN,iN;function dl(e){if(!(this instanceof dl))return new dl(e);BRe.call(this,e),H3.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",m1t)))}o(dl,"Duplex");Object.defineProperty(dl.prototype,"writableHighWaterMark",{enumerable:!1,get:o(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(dl.prototype,"writableBuffer",{enumerable:!1,get:o(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(dl.prototype,"writableLength",{enumerable:!1,get:o(function(){return this._writableState.length},"get")});function m1t(){this._writableState.ended||process.nextTick(h1t,this)}o(m1t,"onend");function h1t(e){e.end()}o(h1t,"onEndNT");Object.defineProperty(dl.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:o(function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")})});var aN=R((Q3,jRe)=>{"use strict";var sN=require("buffer"),pl=sN.Buffer;function WRe(e,t){for(var r in e)t[r]=e[r]}o(WRe,"copyProps");pl.from&&pl.alloc&&pl.allocUnsafe&&pl.allocUnsafeSlow?jRe.exports=sN:(WRe(sN,Q3),Q3.Buffer=Sg);function Sg(e,t,r){return pl(e,t,r)}o(Sg,"SafeBuffer");Sg.prototype=Object.create(pl.prototype);WRe(pl,Sg);Sg.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return pl(e,t,r)};Sg.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=pl(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};Sg.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return pl(e)};Sg.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return sN.SlowBuffer(e)}});var J3=R(VRe=>{"use strict";var Y3=aN().Buffer,$Re=Y3.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function g1t(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}o(g1t,"_normalizeEncoding");function y1t(e){var t=g1t(e);if(typeof t!="string"&&(Y3.isEncoding===$Re||!$Re(e)))throw new Error("Unknown encoding: "+e);return t||e}o(y1t,"normalizeEncoding");VRe.StringDecoder=QA;function QA(e){this.encoding=y1t(e);var t;switch(this.encoding){case"utf16le":this.text=S1t,this.end=T1t,t=4;break;case"utf8":this.fillLast=w1t,t=4;break;case"base64":this.text=A1t,this.end=R1t,t=3;break;default:this.write=I1t,this.end=O1t;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Y3.allocUnsafe(t)}o(QA,"StringDecoder");QA.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};QA.prototype.end=v1t;QA.prototype.text=E1t;QA.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function z3(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}o(z3,"utf8CheckByte");function b1t(e,t,r){var n=t.length-1;if(n<r)return 0;var i=z3(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=z3(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=z3(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}o(b1t,"utf8CheckIncomplete");function _1t(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}o(_1t,"utf8CheckExtraBytes");function w1t(e){var t=this.lastTotal-this.lastNeed,r=_1t(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}o(w1t,"utf8FillLast");function E1t(e,t){var r=b1t(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}o(E1t,"utf8Text");function v1t(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}o(v1t,"utf8End");function S1t(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}o(S1t,"utf16Text");function T1t(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}o(T1t,"utf16End");function A1t(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}o(A1t,"base64Text");function R1t(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}o(R1t,"base64End");function I1t(e){return e.toString(this.encoding)}o(I1t,"simpleWrite");function O1t(e){return e&&e.length?this.write(e):""}o(O1t,"simpleEnd")});var uN=R((Gon,KRe)=>{"use strict";var GRe=jp().codes.ERR_STREAM_PREMATURE_CLOSE;function x1t(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}o(x1t,"once");function C1t(){}o(C1t,"noop");function D1t(e){return e.setHeader&&typeof e.abort=="function"}o(D1t,"isRequest");function HRe(e,t,r){if(typeof t=="function")return HRe(e,null,t);t||(t={}),r=x1t(r||C1t);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=o(function(){e.writable||u()},"onlegacyfinish"),a=e._writableState&&e._writableState.finished,u=o(function(){i=!1,a=!0,n||r.call(e)},"onfinish"),c=e._readableState&&e._readableState.endEmitted,l=o(function(){n=!1,c=!0,i||r.call(e)},"onend"),f=o(function(h){r.call(e,h)},"onerror"),d=o(function(){var h;if(n&&!c)return(!e._readableState||!e._readableState.ended)&&(h=new GRe),r.call(e,h);if(i&&!a)return(!e._writableState||!e._writableState.ended)&&(h=new GRe),r.call(e,h)},"onclose"),p=o(function(){e.req.on("finish",u)},"onrequest");return D1t(e)?(e.on("complete",u),e.on("abort",d),e.req?p():e.on("request",p)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",l),e.on("finish",u),t.error!==!1&&e.on("error",f),e.on("close",d),function(){e.removeListener("complete",u),e.removeListener("abort",d),e.removeListener("request",p),e.req&&e.req.removeListener("finish",u),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",u),e.removeListener("end",l),e.removeListener("error",f),e.removeListener("close",d)}}o(HRe,"eos");KRe.exports=HRe});var zRe=R((Kon,QRe)=>{"use strict";var cN;function Vp(e,t,r){return t=P1t(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(Vp,"_defineProperty");function P1t(e){var t=k1t(e,"string");return typeof t=="symbol"?t:String(t)}o(P1t,"_toPropertyKey");function k1t(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}o(k1t,"_toPrimitive");var N1t=uN(),Gp=Symbol("lastResolve"),Tg=Symbol("lastReject"),zA=Symbol("error"),lN=Symbol("ended"),Ag=Symbol("lastPromise"),X3=Symbol("handlePromise"),Rg=Symbol("stream");function Hp(e,t){return{value:e,done:t}}o(Hp,"createIterResult");function L1t(e){var t=e[Gp];if(t!==null){var r=e[Rg].read();r!==null&&(e[Ag]=null,e[Gp]=null,e[Tg]=null,t(Hp(r,!1)))}}o(L1t,"readAndResolve");function U1t(e){process.nextTick(L1t,e)}o(U1t,"onReadable");function M1t(e,t){return function(r,n){e.then(function(){if(t[lN]){r(Hp(void 0,!0));return}t[X3](r,n)},n)}}o(M1t,"wrapForNext");var F1t=Object.getPrototypeOf(function(){}),B1t=Object.setPrototypeOf((cN={get stream(){return this[Rg]},next:o(function(){var t=this,r=this[zA];if(r!==null)return Promise.reject(r);if(this[lN])return Promise.resolve(Hp(void 0,!0));if(this[Rg].destroyed)return new Promise(function(a,u){process.nextTick(function(){t[zA]?u(t[zA]):a(Hp(void 0,!0))})});var n=this[Ag],i;if(n)i=new Promise(M1t(n,this));else{var s=this[Rg].read();if(s!==null)return Promise.resolve(Hp(s,!1));i=new Promise(this[X3])}return this[Ag]=i,i},"next")},Vp(cN,Symbol.asyncIterator,function(){return this}),Vp(cN,"return",o(function(){var t=this;return new Promise(function(r,n){t[Rg].destroy(null,function(i){if(i){n(i);return}r(Hp(void 0,!0))})})},"_return")),cN),F1t),q1t=o(function(t){var r,n=Object.create(B1t,(r={},Vp(r,Rg,{value:t,writable:!0}),Vp(r,Gp,{value:null,writable:!0}),Vp(r,Tg,{value:null,writable:!0}),Vp(r,zA,{value:null,writable:!0}),Vp(r,lN,{value:t._readableState.endEmitted,writable:!0}),Vp(r,X3,{value:o(function(s,a){var u=n[Rg].read();u?(n[Ag]=null,n[Gp]=null,n[Tg]=null,s(Hp(u,!1))):(n[Gp]=s,n[Tg]=a)},"value"),writable:!0}),r));return n[Ag]=null,N1t(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Tg];s!==null&&(n[Ag]=null,n[Gp]=null,n[Tg]=null,s(i)),n[zA]=i;return}var a=n[Gp];a!==null&&(n[Ag]=null,n[Gp]=null,n[Tg]=null,a(Hp(void 0,!0))),n[lN]=!0}),t.on("readable",U1t.bind(null,n)),n},"createReadableStreamAsyncIterator");QRe.exports=q1t});var ZRe=R((zon,XRe)=>{"use strict";function YRe(e,t,r,n,i,s,a){try{var u=e[s](a),c=u.value}catch(l){r(l);return}u.done?t(c):Promise.resolve(c).then(n,i)}o(YRe,"asyncGeneratorStep");function W1t(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function a(c){YRe(s,n,i,a,u,"next",c)}o(a,"_next");function u(c){YRe(s,n,i,a,u,"throw",c)}o(u,"_throw"),a(void 0)})}}o(W1t,"_asyncToGenerator");function JRe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}o(JRe,"ownKeys");function j1t(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JRe(Object(r),!0).forEach(function(n){$1t(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JRe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}o(j1t,"_objectSpread");function $1t(e,t,r){return t=V1t(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o($1t,"_defineProperty");function V1t(e){var t=G1t(e,"string");return typeof t=="symbol"?t:String(t)}o(V1t,"_toPropertyKey");function G1t(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}o(G1t,"_toPrimitive");var H1t=jp().codes.ERR_INVALID_ARG_TYPE;function K1t(e,t,r){var n;if(t&&typeof t.next=="function")n=t;else if(t&&t[Symbol.asyncIterator])n=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])n=t[Symbol.iterator]();else throw new H1t("iterable",["Iterable"],t);var i=new e(j1t({objectMode:!0},r)),s=!1;i._read=function(){s||(s=!0,a())};function a(){return u.apply(this,arguments)}o(a,"next");function u(){return u=W1t(function*(){try{var c=yield n.next(),l=c.value,f=c.done;f?i.push(null):i.push(yield l)?a():s=!1}catch(d){i.destroy(d)}}),u.apply(this,arguments)}return o(u,"_next2"),i}o(K1t,"from");XRe.exports=K1t});var K3=R((Xon,cIe)=>{"use strict";cIe.exports=or;var aw;or.ReadableState=nIe;var Jon=require("events").EventEmitter,rIe=o(function(t,r){return t.listeners(r).length},"EElistenerCount"),JA=U3(),fN=require("buffer").Buffer,Q1t=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function z1t(e){return fN.from(e)}o(z1t,"_uint8ArrayToBuffer");function Y1t(e){return fN.isBuffer(e)||e instanceof Q1t}o(Y1t,"_isUint8Array");var Z3=require("util"),Nt;Z3&&Z3.debuglog?Nt=Z3.debuglog("stream"):Nt=o(function(){},"debug");var J1t=ARe(),sK=B3(),X1t=q3(),Z1t=X1t.getHighWaterMark,dN=jp().codes,eqt=dN.ERR_INVALID_ARG_TYPE,tqt=dN.ERR_STREAM_PUSH_AFTER_EOF,rqt=dN.ERR_METHOD_NOT_IMPLEMENTED,nqt=dN.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,uw,eK,tK;jt()(or,JA);var YA=sK.errorOrDestroy,rK=["error","close","destroy","pause","resume"];function iqt(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}o(iqt,"prependListener");function nIe(e,t,r){aw=aw||vg(),e=e||{},typeof r!="boolean"&&(r=t instanceof aw),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=Z1t(this,e,"readableHighWaterMark",r),this.buffer=new J1t,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(uw||(uw=J3().StringDecoder),this.decoder=new uw(e.encoding),this.encoding=e.encoding)}o(nIe,"ReadableState");function or(e){if(aw=aw||vg(),!(this instanceof or))return new or(e);var t=this instanceof aw;this._readableState=new nIe(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),JA.call(this)}o(or,"Readable");Object.defineProperty(or.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:o(function(t){this._readableState&&(this._readableState.destroyed=t)},"set")});or.prototype.destroy=sK.destroy;or.prototype._undestroy=sK.undestroy;or.prototype._destroy=function(e,t){t(e)};or.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=fN.from(e,t),t=""),n=!0),iIe(this,e,t,!1,n)};or.prototype.unshift=function(e){return iIe(this,e,null,!0,!1)};function iIe(e,t,r,n,i){Nt("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,aqt(e,s);else{var a;if(i||(a=oqt(s,t)),a)YA(e,a);else if(s.objectMode||t&&t.length>0)if(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==fN.prototype&&(t=z1t(t)),n)s.endEmitted?YA(e,new nqt):nK(e,s,t,!0);else if(s.ended)YA(e,new tqt);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?nK(e,s,t,!1):oK(e,s)):nK(e,s,t,!1)}else n||(s.reading=!1,oK(e,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}o(iIe,"readableAddChunk");function nK(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&pN(e)),oK(e,t)}o(nK,"addChunk");function oqt(e,t){var r;return!Y1t(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new eqt("chunk",["string","Buffer","Uint8Array"],t)),r}o(oqt,"chunkInvalid");or.prototype.isPaused=function(){return this._readableState.flowing===!1};or.prototype.setEncoding=function(e){uw||(uw=J3().StringDecoder);var t=new uw(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var eIe=1073741824;function sqt(e){return e>=eIe?e=eIe:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}o(sqt,"computeNewHighWaterMark");function tIe(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=sqt(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}o(tIe,"howMuchToRead");or.prototype.read=function(e){Nt("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return Nt("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?iK(this):pN(this),null;if(e=tIe(e,t),e===0&&t.ended)return t.length===0&&iK(this),null;var n=t.needReadable;Nt("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,Nt("length less than watermark",n)),t.ended||t.reading?(n=!1,Nt("reading or ended",n)):n&&(Nt("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=tIe(r,t)));var i;return e>0?i=aIe(e,t):i=null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&iK(this)),i!==null&&this.emit("data",i),i};function aqt(e,t){if(Nt("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?pN(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,oIe(e)))}}o(aqt,"onEofChunk");function pN(e){var t=e._readableState;Nt("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(Nt("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(oIe,e))}o(pN,"emitReadable");function oIe(e){var t=e._readableState;Nt("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,aK(e)}o(oIe,"emitReadable_");function oK(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(uqt,e,t))}o(oK,"maybeReadMore");function uqt(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(Nt("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}o(uqt,"maybeReadMore_");or.prototype._read=function(e){YA(this,new rqt("_read()"))};or.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,Nt("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?u:g;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",a);function a(b,w){Nt("onunpipe"),b===r&&w&&w.hasUnpiped===!1&&(w.hasUnpiped=!0,f())}o(a,"onunpipe");function u(){Nt("onend"),e.end()}o(u,"onend");var c=cqt(r);e.on("drain",c);var l=!1;function f(){Nt("cleanup"),e.removeListener("close",m),e.removeListener("finish",h),e.removeListener("drain",c),e.removeListener("error",p),e.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",d),l=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}o(f,"cleanup"),r.on("data",d);function d(b){Nt("ondata");var w=e.write(b);Nt("dest.write",w),w===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&uIe(n.pipes,e)!==-1)&&!l&&(Nt("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}o(d,"ondata");function p(b){Nt("onerror",b),g(),e.removeListener("error",p),rIe(e,"error")===0&&YA(e,b)}o(p,"onerror"),iqt(e,"error",p);function m(){e.removeListener("finish",h),g()}o(m,"onclose"),e.once("close",m);function h(){Nt("onfinish"),e.removeListener("close",m),g()}o(h,"onfinish"),e.once("finish",h);function g(){Nt("unpipe"),r.unpipe(e)}return o(g,"unpipe"),e.emit("pipe",r),n.flowing||(Nt("pipe resume"),r.resume()),e};function cqt(e){return o(function(){var r=e._readableState;Nt("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&rIe(e,"data")&&(r.flowing=!0,aK(e))},"pipeOnDrainFunctionResult")}o(cqt,"pipeOnDrain");or.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=uIe(t.pipes,e);return a===-1?this:(t.pipes.splice(a,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};or.prototype.on=function(e,t){var r=JA.prototype.on.call(this,e,t),n=this._readableState;return e==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):e==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Nt("on readable",n.length,n.reading),n.length?pN(this):n.reading||process.nextTick(lqt,this)),r};or.prototype.addListener=or.prototype.on;or.prototype.removeListener=function(e,t){var r=JA.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(sIe,this),r};or.prototype.removeAllListeners=function(e){var t=JA.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(sIe,this),t};function sIe(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}o(sIe,"updateReadableListening");function lqt(e){Nt("readable nexttick read 0"),e.read(0)}o(lqt,"nReadingNextTick");or.prototype.resume=function(){var e=this._readableState;return e.flowing||(Nt("resume"),e.flowing=!e.readableListening,fqt(this,e)),e.paused=!1,this};function fqt(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(dqt,e,t))}o(fqt,"resume");function dqt(e,t){Nt("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),aK(e),t.flowing&&!t.reading&&e.read(0)}o(dqt,"resume_");or.prototype.pause=function(){return Nt("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Nt("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function aK(e){var t=e._readableState;for(Nt("flow",t.flowing);t.flowing&&e.read()!==null;);}o(aK,"flow");or.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(Nt("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&t.push(a)}t.push(null)}),e.on("data",function(a){if(Nt("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var u=t.push(a);u||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=o(function(u){return o(function(){return e[u].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var s=0;s<rK.length;s++)e.on(rK[s],this.emit.bind(this,rK[s]));return this._read=function(a){Nt("wrapped _read",a),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(or.prototype[Symbol.asyncIterator]=function(){return eK===void 0&&(eK=zRe()),eK(this)});Object.defineProperty(or.prototype,"readableHighWaterMark",{enumerable:!1,get:o(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(or.prototype,"readableBuffer",{enumerable:!1,get:o(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(or.prototype,"readableFlowing",{enumerable:!1,get:o(function(){return this._readableState.flowing},"get"),set:o(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});or._fromList=aIe;Object.defineProperty(or.prototype,"readableLength",{enumerable:!1,get:o(function(){return this._readableState.length},"get")});function aIe(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}o(aIe,"fromList");function iK(e){var t=e._readableState;Nt("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(pqt,t,e))}o(iK,"endReadable");function pqt(e,t){if(Nt("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}o(pqt,"endReadableNT");typeof Symbol=="function"&&(or.from=function(e,t){return tK===void 0&&(tK=ZRe()),tK(or,e,t)});function uIe(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}o(uIe,"indexOf")});var uK=R((esn,fIe)=>{"use strict";fIe.exports=$f;var mN=jp().codes,mqt=mN.ERR_METHOD_NOT_IMPLEMENTED,hqt=mN.ERR_MULTIPLE_CALLBACK,gqt=mN.ERR_TRANSFORM_ALREADY_TRANSFORMING,yqt=mN.ERR_TRANSFORM_WITH_LENGTH_0,hN=vg();jt()($f,hN);function bqt(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new hqt);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}o(bqt,"afterTransform");function $f(e){if(!(this instanceof $f))return new $f(e);hN.call(this,e),this._transformState={afterTransform:bqt.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",_qt)}o($f,"Transform");function _qt(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){lIe(e,t,r)}):lIe(this,null,null)}o(_qt,"prefinish");$f.prototype.push=function(e,t){return this._transformState.needTransform=!1,hN.prototype.push.call(this,e,t)};$f.prototype._transform=function(e,t,r){r(new mqt("_transform()"))};$f.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};$f.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};$f.prototype._destroy=function(e,t){hN.prototype._destroy.call(this,e,function(r){t(r)})};function lIe(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new yqt;if(e._transformState.transforming)throw new gqt;return e.push(null)}o(lIe,"done")});var mIe=R((rsn,pIe)=>{"use strict";pIe.exports=XA;var dIe=uK();jt()(XA,dIe);function XA(e){if(!(this instanceof XA))return new XA(e);dIe.call(this,e)}o(XA,"PassThrough");XA.prototype._transform=function(e,t,r){r(null,e)}});var _Ie=R((isn,bIe)=>{"use strict";var cK;function wqt(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}o(wqt,"once");var yIe=jp().codes,Eqt=yIe.ERR_MISSING_ARGS,vqt=yIe.ERR_STREAM_DESTROYED;function hIe(e){if(e)throw e}o(hIe,"noop");function Sqt(e){return e.setHeader&&typeof e.abort=="function"}o(Sqt,"isRequest");function Tqt(e,t,r,n){n=wqt(n);var i=!1;e.on("close",function(){i=!0}),cK===void 0&&(cK=uN()),cK(e,{readable:t,writable:r},function(a){if(a)return n(a);i=!0,n()});var s=!1;return function(a){if(!i&&!s){if(s=!0,Sqt(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(a||new vqt("pipe"))}}}o(Tqt,"destroyer");function gIe(e){e()}o(gIe,"call");function Aqt(e,t){return e.pipe(t)}o(Aqt,"pipe");function Rqt(e){return!e.length||typeof e[e.length-1]!="function"?hIe:e.pop()}o(Rqt,"popCallback");function Iqt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=Rqt(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Eqt("streams");var i,s=t.map(function(a,u){var c=u<t.length-1,l=u>0;return Tqt(a,c,l,function(f){i||(i=f),f&&s.forEach(gIe),!c&&(s.forEach(gIe),n(i))})});return t.reduce(Aqt)}o(Iqt,"pipeline");bIe.exports=Iqt});var Kp=R((uu,eR)=>{"use strict";var ZA=require("stream");process.env.READABLE_STREAM==="disable"&&ZA?(eR.exports=ZA.Readable,Object.assign(eR.exports,ZA),eR.exports.Stream=ZA):(uu=eR.exports=K3(),uu.Stream=ZA||uu,uu.Readable=uu,uu.Writable=V3(),uu.Duplex=vg(),uu.Transform=uK(),uu.PassThrough=mIe(),uu.finished=uN(),uu.pipeline=_Ie())});var vIe=R((ssn,EIe)=>{"use strict";var Oqt=jt(),wIe=Kp().Readable,xqt=wg();EIe.exports=cw;Oqt(cw,wIe);function cw(e,t){if(!(this instanceof cw))return new cw(e,t);t=t||{},wIe.call(this,xqt(t,{objectMode:!0})),this._iterator=e,this._options=t,this.on("end",this.destroy.bind(this,null,null))}o(cw,"ReadStream");cw.prototype._read=function(){var e=this,t=this._options;this.destroyed||this._iterator.next(function(r,n,i){if(!e.destroyed){if(r)return e.destroy(r);n===void 0&&i===void 0?e.push(null):t.keys!==!1&&t.values===!1?e.push(n):t.keys===!1&&t.values!==!1?e.push(i):e.push({key:n,value:i})}})};cw.prototype._destroy=function(e,t){this._iterator.end(function(r){t(e||r)})}});var TIe=R((SIe,gN)=>{"use strict";(function(e,t,r){typeof gN<"u"&&gN.exports?gN.exports=r():t[e]=r()})("prr",SIe,function(){var e=typeof Object.defineProperty=="function"?function(n,i,s){return Object.defineProperty(n,i,s),n}:function(n,i,s){return n[i]=s.value,n},t=o(function(n,i){var s=typeof i=="object",a=!s&&typeof i=="string",u=o(function(c){return s?!!i[c]:a?i.indexOf(c[0])>-1:!1},"op");return{enumerable:u("enumerable"),configurable:u("configurable"),writable:u("writable"),value:n}},"makeOptions"),r=o(function(n,i,s,a){var u;if(a=t(s,a),typeof i=="object"){for(u in i)Object.hasOwnProperty.call(i,u)&&(a.value=i[u],e(n,u,a));return n}return e(n,i,a)},"prr");return r})});var IIe=R((csn,RIe)=>{"use strict";var Cqt=TIe();function AIe(e,t,r){t&&typeof t!="string"&&(t=t.message||t.name),Cqt(this,{type:e,name:e,cause:typeof t!="string"?t:r,message:t},"ewr")}o(AIe,"init");function lK(e,t){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),AIe.call(this,"CustomError",e,t)}o(lK,"CustomError");lK.prototype=new Error;function Dqt(e,t,r){var n=o(function(i,s){AIe.call(this,t,i,s),t=="FilesystemError"&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(e.errno[this.cause.errno]?e.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,n)},"err");return n.prototype=r?new r:new lK,n}o(Dqt,"createError");RIe.exports=function(e){var t=o(function(r,n){return Dqt(e,r,n)},"ce");return{CustomError:lK,FilesystemError:t("FilesystemError"),createError:t}}});var OIe=R((fsn,ml)=>{"use strict";var Pqt=ml.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];ml.exports.errno={};ml.exports.code={};Pqt.forEach(function(e){ml.exports.errno[e.errno]=e,ml.exports.code[e.code]=e});ml.exports.custom=IIe()(ml.exports);ml.exports.create=ml.exports.custom.createError});var dK=R((dsn,xIe)=>{"use strict";var Og=OIe().create,Ig=Og("LevelUPError"),fK=Og("NotFoundError",Ig);fK.prototype.notFound=!0;fK.prototype.status=404;xIe.exports={LevelUPError:Ig,InitializationError:Og("InitializationError",Ig),OpenError:Og("OpenError",Ig),ReadError:Og("ReadError",Ig),WriteError:Og("WriteError",Ig),NotFoundError:fK,EncodingError:Og("EncodingError",Ig)}});var pK=R((psn,CIe)=>{"use strict";function kqt(){var e,t=new Promise(function(r,n){e=o(function(s,a){s?n(s):r(a)},"callback")});return e.promise=t,e}o(kqt,"promisify");CIe.exports=kqt});var tR=R(mK=>{"use strict";mK.getCallback=function(e,t){return typeof e=="function"?e:t};mK.getOptions=function(e){return typeof e=="object"&&e!==null?e:{}}});var PIe=R((gsn,DIe)=>{"use strict";var rR=dK().WriteError,Nqt=pK(),Lqt=tR().getCallback,Uqt=tR().getOptions;function nR(e){this.db=this._levelup=e,this.batch=e.db.batch(),this.ops=[],this.length=0}o(nR,"Batch");nR.prototype.put=function(e,t){try{this.batch.put(e,t)}catch(r){throw new rR(r)}return this.ops.push({type:"put",key:e,value:t}),this.length++,this};nR.prototype.del=function(e){try{this.batch.del(e)}catch(t){throw new rR(t)}return this.ops.push({type:"del",key:e}),this.length++,this};nR.prototype.clear=function(){try{this.batch.clear()}catch(e){throw new rR(e)}return this.ops=[],this.length=0,this};nR.prototype.write=function(e,t){var r=this._levelup,n=this.ops,i;t=Lqt(e,t),t||(t=Nqt(),i=t.promise),e=Uqt(e);try{this.batch.write(e,function(s){if(s)return t(new rR(s));r.emit("batch",n),t()})}catch(s){throw new rR(s)}return i};DIe.exports=nR});var UIe=R((bsn,LIe)=>{"use strict";var yN=require("events").EventEmitter,Mqt=require("util").inherits,hK=wg(),kIe=bRe(),Fqt=vIe(),Bqt=PIe(),lw=dK(),qqt=D3(),Wqt=require("assert"),xg=pK(),iR=tR().getCallback,fw=tR().getOptions,bN=lw.WriteError,NIe=lw.ReadError,jqt=lw.NotFoundError,$qt=lw.OpenError,Vqt=lw.InitializationError;function Ur(e,t,r){if(!(this instanceof Ur))return new Ur(e,t,r);var n,i=this;if(yN.call(this),this.setMaxListeners(1/0),typeof t=="function"&&(r=t,t={}),t=t||{},!e||typeof e!="object"){if(n=new Vqt("First argument must be an abstract-leveldown compliant store"),typeof r=="function")return process.nextTick(r,n);throw n}Wqt.strictEqual(typeof e.status,"string",".status required, old abstract-leveldown"),this.options=fw(t),this._db=e,this.db=new kIe(e),this.open(r||function(s){s&&i.emit("error",s)}),this.supports=qqt(this.db.supports,{status:!1,deferredOpen:!0,openCallback:!0,promises:!0,streams:!0}),Object.keys(this.supports.additionalMethods).forEach(function(s){this[s]==null&&(this[s]=function(){return this.db[s].apply(this.db,arguments)})},this)}o(Ur,"LevelUP");Ur.prototype.emit=yN.prototype.emit;Ur.prototype.once=yN.prototype.once;Mqt(Ur,yN);Ur.prototype.open=function(e,t){var r=this,n;return typeof e=="function"&&(t=e,e=null),t||(t=xg(),n=t.promise),e||(e=this.options),this.isOpen()?(process.nextTick(t,null,r),n):this._isOpening()?(this.once("open",function(){t(null,r)}),n):(this.emit("opening"),this.db.open(e,function(i){if(i)return t(new $qt(i));r.db=r._db,t(null,r),r.emit("open"),r.emit("ready")}),n)};Ur.prototype.close=function(e){var t=this,r;return e||(e=xg(),r=e.promise),this.isOpen()?(this.db.close(function(){t.emit("closed"),e.apply(null,arguments)}),this.emit("closing"),this.db=new kIe(this._db)):this.isClosed()?process.nextTick(e):this.db.status==="closing"?this.once("closed",e):this._isOpening()&&this.once("open",function(){t.close(e)}),r};Ur.prototype.isOpen=function(){return this.db.status==="open"};Ur.prototype._isOpening=function(){return this.db.status==="opening"};Ur.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)};Ur.prototype.get=function(e,t,r){var n;return r=iR(t,r),r||(r=xg(),n=r.promise),oR(this,r)||(t=fw(t),this.db.get(e,t,function(i,s){if(i)return/notfound/i.test(i)||i.notFound?i=new jqt("Key not found in database ["+e+"]",i):i=new NIe(i),r(i);r(null,s)})),n};Ur.prototype.put=function(e,t,r,n){var i=this,s;return n=iR(r,n),n||(n=xg(),s=n.promise),oR(this,n)||(r=fw(r),this.db.put(e,t,r,function(a){if(a)return n(new bN(a));i.emit("put",e,t),n()})),s};Ur.prototype.del=function(e,t,r){var n=this,i;return r=iR(t,r),r||(r=xg(),i=r.promise),oR(this,r)||(t=fw(t),this.db.del(e,t,function(s){if(s)return r(new bN(s));n.emit("del",e),r()})),i};Ur.prototype.batch=function(e,t,r){if(!arguments.length)return new Bqt(this);var n=this,i;return typeof e=="function"?r=e:r=iR(t,r),r||(r=xg(),i=r.promise),oR(this,r)||(t=fw(t),this.db.batch(e,t,function(s){if(s)return r(new bN(s));n.emit("batch",e),r()})),i};Ur.prototype.iterator=function(e){return this.db.iterator(e)};Ur.prototype.clear=function(e,t){var r=this,n;return t=iR(e,t),e=fw(e),t||(t=xg(),n=t.promise),oR(this,t)||this.db.clear(e,function(i){if(i)return t(new bN(i));r.emit("clear",e),t()}),n};Ur.prototype.readStream=Ur.prototype.createReadStream=function(e){return e=hK({keys:!0,values:!0},e),typeof e.limit!="number"&&(e.limit=-1),new Fqt(this.db.iterator(e),e)};Ur.prototype.keyStream=Ur.prototype.createKeyStream=function(e){return this.createReadStream(hK(e,{keys:!0,values:!1}))};Ur.prototype.valueStream=Ur.prototype.createValueStream=function(e){return this.createReadStream(hK(e,{keys:!1,values:!0}))};Ur.prototype.toString=function(){return"LevelUP"};Ur.prototype.type="levelup";function oR(e,t){if(!e._isOpening()&&!e.isOpen())return process.nextTick(t,new NIe("Database is not open")),!0}o(oR,"maybeError");Ur.errors=lw;LIe.exports=Ur.default=Ur});var wK=R(Hn=>{"use strict";Hn.compare=function(e,t){if(Buffer.isBuffer(e)){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){var i=e[n]-t[n];if(i)return i}return e.length-t.length}return e<t?-1:e>t?1:0};function MIe(e){return e!==void 0&&e!==""}o(MIe,"isDef");function dw(e,t){return Object.hasOwnProperty.call(e,t)}o(dw,"has");function hl(e,t){return Object.hasOwnProperty.call(e,t)&&t}o(hl,"hasKey");var Gqt=Hn.lowerBoundKey=function(e){return hl(e,"gt")||hl(e,"gte")||hl(e,"min")||(e.reverse?hl(e,"end"):hl(e,"start"))||void 0},gK=Hn.lowerBound=function(e,t){var r=Gqt(e);return r?e[r]:t},yK=Hn.lowerBoundInclusive=function(e){return!dw(e,"gt")},bK=Hn.upperBoundInclusive=function(e){return!dw(e,"lt")},Hqt=Hn.lowerBoundExclusive=function(e){return!yK(e)},Kqt=Hn.upperBoundExclusive=function(e){return!bK(e)},Qqt=Hn.upperBoundKey=function(e){return hl(e,"lt")||hl(e,"lte")||hl(e,"max")||(e.reverse?hl(e,"start"):hl(e,"end"))||void 0},_K=Hn.upperBound=function(e,t){var r=Qqt(e);return r?e[r]:t};Hn.start=function(e,t){return e.reverse?_K(e,t):gK(e,t)};Hn.end=function(e,t){return e.reverse?gK(e,t):_K(e,t)};Hn.startInclusive=function(e){return e.reverse?bK(e):yK(e)};Hn.endInclusive=function(e){return e.reverse?yK(e):bK(e)};function zqt(e){return e}o(zqt,"id");Hn.toLtgt=function(e,t,r,n,i){t=t||{},r=r||zqt;var s=arguments.length>3,a=Hn.lowerBoundKey(e),u=Hn.upperBoundKey(e);return a?a==="gt"?t.gt=r(e.gt,!1):t.gte=r(e[a],!1):s&&(t.gte=r(n,!1)),u?u==="lt"?t.lt=r(e.lt,!0):t.lte=r(e[u],!0):s&&(t.lte=r(i,!0)),e.reverse!=null&&(t.reverse=!!e.reverse),dw(t,"max")&&delete t.max,dw(t,"min")&&delete t.min,dw(t,"start")&&delete t.start,dw(t,"end")&&delete t.end,t};Hn.contains=function(e,t,r){r=r||Hn.compare;var n=gK(e);if(MIe(n)){var i=r(t,n);if(i<0||i===0&&Hqt(e))return!1}var s=_K(e);if(MIe(s)){var i=r(t,s);if(i>0||i===0&&Kqt(e))return!1}return!0};Hn.filter=function(e,t){return function(r){return Hn.contains(e,r,t)}}});var FIe=R(Vf=>{"use strict";var EK=require("buffer").Buffer;Vf.utf8=Vf["utf-8"]={encode:function(e){return vK(e)?e:String(e)},decode:_N,buffer:!1,type:"utf8"};Vf.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"};Vf.binary={encode:function(e){return vK(e)?e:EK.from(e)},decode:_N,buffer:!0,type:"binary"};Vf.none={encode:_N,decode:_N,buffer:!1,type:"id"};Vf.id=Vf.none;var Yqt=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];Yqt.forEach(function(e){Vf[e]={encode:function(t){return vK(t)?t:EK.from(t,e)},decode:function(t){return t.toString(e)},buffer:!0,type:e}});function _N(e){return e}o(_N,"identity");function vK(e){return e==null||EK.isBuffer(e)}o(vK,"isBinary")});var qIe=R((Tsn,BIe)=>{"use strict";var SK=FIe();BIe.exports=es;function es(e){if(!(this instanceof es))return new es(e);this.opts=e||{},this.encodings=SK}o(es,"Codec");es.prototype._encoding=function(e){return typeof e=="string"&&(e=SK[e]),e||(e=SK.id),e};es.prototype._keyEncoding=function(e,t){return this._encoding(t&&t.keyEncoding||e&&e.keyEncoding||this.opts.keyEncoding)};es.prototype._valueEncoding=function(e,t){return this._encoding(t&&(t.valueEncoding||t.encoding)||e&&(e.valueEncoding||e.encoding)||this.opts.valueEncoding||this.opts.encoding)};es.prototype.encodeKey=function(e,t,r){return this._keyEncoding(t,r).encode(e)};es.prototype.encodeValue=function(e,t,r){return this._valueEncoding(t,r).encode(e)};es.prototype.decodeKey=function(e,t){return this._keyEncoding(t).decode(e)};es.prototype.decodeValue=function(e,t){return this._valueEncoding(t).decode(e)};es.prototype.encodeBatch=function(e,t){var r=this;return e.map(function(n){var i={type:n.type,key:r.encodeKey(n.key,t,n)};return r.keyAsBuffer(t,n)&&(i.keyEncoding="binary"),n.prefix&&(i.prefix=n.prefix),"value"in n&&(i.value=r.encodeValue(n.value,t,n),r.valueAsBuffer(t,n)&&(i.valueEncoding="binary")),i})};var Jqt=["lt","gt","lte","gte","start","end"];es.prototype.encodeLtgt=function(e){var t=this,r={};return Object.keys(e).forEach(function(n){r[n]=Jqt.indexOf(n)>-1?t.encodeKey(e[n],e):e[n]}),r};es.prototype.createStreamDecoder=function(e){var t=this;return e.keys&&e.values?function(r,n){return{key:t.decodeKey(r,e),value:t.decodeValue(n,e)}}:e.keys?function(r){return t.decodeKey(r,e)}:e.values?function(r,n){return t.decodeValue(n,e)}:function(){}};es.prototype.keyAsBuffer=function(e){return this._keyEncoding(e).buffer};es.prototype.valueAsBuffer=function(e){return this._valueEncoding(e).buffer}});var jIe=R((Rsn,WIe)=>{"use strict";WIe.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}});var xo=R(Oo=>{"use strict";function Xqt(e){return Array.isArray?Array.isArray(e):wN(e)==="[object Array]"}o(Xqt,"isArray");Oo.isArray=Xqt;function Zqt(e){return typeof e=="boolean"}o(Zqt,"isBoolean");Oo.isBoolean=Zqt;function e2t(e){return e===null}o(e2t,"isNull");Oo.isNull=e2t;function t2t(e){return e==null}o(t2t,"isNullOrUndefined");Oo.isNullOrUndefined=t2t;function r2t(e){return typeof e=="number"}o(r2t,"isNumber");Oo.isNumber=r2t;function n2t(e){return typeof e=="string"}o(n2t,"isString");Oo.isString=n2t;function i2t(e){return typeof e=="symbol"}o(i2t,"isSymbol");Oo.isSymbol=i2t;function o2t(e){return e===void 0}o(o2t,"isUndefined");Oo.isUndefined=o2t;function s2t(e){return wN(e)==="[object RegExp]"}o(s2t,"isRegExp");Oo.isRegExp=s2t;function a2t(e){return typeof e=="object"&&e!==null}o(a2t,"isObject");Oo.isObject=a2t;function u2t(e){return wN(e)==="[object Date]"}o(u2t,"isDate");Oo.isDate=u2t;function c2t(e){return wN(e)==="[object Error]"||e instanceof Error}o(c2t,"isError");Oo.isError=c2t;function l2t(e){return typeof e=="function"}o(l2t,"isFunction");Oo.isFunction=l2t;function f2t(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}o(f2t,"isPrimitive");Oo.isPrimitive=f2t;Oo.isBuffer=require("buffer").Buffer.isBuffer;function wN(e){return Object.prototype.toString.call(e)}o(wN,"objectToString")});var AK=R((xsn,YIe)=>{"use strict";YIe.exports=cu;var d2t=require("buffer").Buffer;cu.WritableState=HIe;var pa=xo();pa.inherits=jt();var GIe=require("stream");pa.inherits(cu,GIe);function p2t(e,t,r){this.chunk=e,this.encoding=t,this.callback=r}o(p2t,"WriteReq");function HIe(e,t){var r=Cg();e=e||{};var n=e.highWaterMark,i=e.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:i,this.objectMode=!!e.objectMode,t instanceof r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){w2t(t,a)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}o(HIe,"WritableState");function cu(e){var t=Cg();if(!(this instanceof cu)&&!(this instanceof t))return new cu(e);this._writableState=new HIe(e,this),this.writable=!0,GIe.call(this)}o(cu,"Writable");cu.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function m2t(e,t,r){var n=new Error("write after end");e.emit("error",n),process.nextTick(function(){r(n)})}o(m2t,"writeAfterEnd");function h2t(e,t,r,n){var i=!0;if(!pa.isBuffer(r)&&!pa.isString(r)&&!pa.isNullOrUndefined(r)&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),process.nextTick(function(){n(s)}),i=!1}return i}o(h2t,"validChunk");cu.prototype.write=function(e,t,r){var n=this._writableState,i=!1;return pa.isFunction(t)&&(r=t,t=null),pa.isBuffer(e)?t="buffer":t||(t=n.defaultEncoding),pa.isFunction(r)||(r=o(function(){},"cb")),n.ended?m2t(this,n,r):h2t(this,n,e,r)&&(n.pendingcb++,i=y2t(this,n,e,t,r)),i};cu.prototype.cork=function(){var e=this._writableState;e.corked++};cu.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.finished&&!e.bufferProcessing&&e.buffer.length&&KIe(this,e))};function g2t(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&pa.isString(t)&&(t=new d2t(t,r)),t}o(g2t,"decodeChunk");function y2t(e,t,r,n,i){r=g2t(t,r,n),pa.isBuffer(r)&&(n="buffer");var s=t.objectMode?1:r.length;t.length+=s;var a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked?t.buffer.push(new p2t(r,n,i)):TK(e,t,!1,s,r,n,i),a}o(y2t,"writeOrBuffer");function TK(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}o(TK,"doWrite");function b2t(e,t,r,n,i){r?process.nextTick(function(){t.pendingcb--,i(n)}):(t.pendingcb--,i(n)),e._writableState.errorEmitted=!0,e.emit("error",n)}o(b2t,"onwriteError");function _2t(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}o(_2t,"onwriteStateUpdate");function w2t(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(_2t(r),t)b2t(e,r,n,t,i);else{var s=QIe(e,r);!s&&!r.corked&&!r.bufferProcessing&&r.buffer.length&&KIe(e,r),n?process.nextTick(function(){$Ie(e,r,s,i)}):$Ie(e,r,s,i)}}o(w2t,"onwrite");function $Ie(e,t,r,n){r||E2t(e,t),t.pendingcb--,n(),zIe(e,t)}o($Ie,"afterWrite");function E2t(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}o(E2t,"onwriteDrain");function KIe(e,t){if(t.bufferProcessing=!0,e._writev&&t.buffer.length>1){for(var r=[],n=0;n<t.buffer.length;n++)r.push(t.buffer[n].callback);t.pendingcb++,TK(e,t,!0,t.length,t.buffer,"",function(l){for(var f=0;f<r.length;f++)t.pendingcb--,r[f](l)}),t.buffer=[]}else{for(var n=0;n<t.buffer.length;n++){var i=t.buffer[n],s=i.chunk,a=i.encoding,u=i.callback,c=t.objectMode?1:s.length;if(TK(e,t,!1,c,s,a,u),t.writing){n++;break}}n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}t.bufferProcessing=!1}o(KIe,"clearBuffer");cu.prototype._write=function(e,t,r){r(new Error("not implemented"))};cu.prototype._writev=null;cu.prototype.end=function(e,t,r){var n=this._writableState;pa.isFunction(e)?(r=e,e=null,t=null):pa.isFunction(t)&&(r=t,t=null),pa.isNullOrUndefined(e)||this.write(e,t),n.corked&&(n.corked=1,this.uncork()),!n.ending&&!n.finished&&v2t(this,n,r)};function QIe(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}o(QIe,"needFinish");function VIe(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}o(VIe,"prefinish");function zIe(e,t){var r=QIe(e,t);return r&&(t.pendingcb===0?(VIe(e,t),t.finished=!0,e.emit("finish")):VIe(e,t)),r}o(zIe,"finishMaybe");function v2t(e,t,r){t.ending=!0,zIe(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0}o(v2t,"endWritable")});var Cg=R((Dsn,ZIe)=>{"use strict";ZIe.exports=pw;var S2t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},JIe=xo();JIe.inherits=jt();var XIe=IK(),RK=AK();JIe.inherits(pw,XIe);A2t(S2t(RK.prototype),function(e){pw.prototype[e]||(pw.prototype[e]=RK.prototype[e])});function pw(e){if(!(this instanceof pw))return new pw(e);XIe.call(this,e),RK.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",T2t)}o(pw,"Duplex");function T2t(){this.allowHalfOpen||this._writableState.ended||process.nextTick(this.end.bind(this))}o(T2t,"onend");function A2t(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}o(A2t,"forEach")});var sR=R(tOe=>{"use strict";var eOe=require("buffer").Buffer,R2t=eOe.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function I2t(e){if(e&&!R2t(e))throw new Error("Unknown encoding: "+e)}o(I2t,"assertEncoding");var OK=tOe.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),I2t(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=x2t;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=C2t;break;default:this.write=O2t;return}this.charBuffer=new eOe(6),this.charReceived=0,this.charLength=0};OK.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";e=e.slice(r,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=t.charCodeAt(t.length-1);if(i>=55296&&i<=56319){this.charLength+=this.surrogateSize,t="";continue}if(this.charReceived=this.charLength=0,e.length===0)return t;break}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived),t+=e.toString(this.encoding,0,n);var n=t.length-1,i=t.charCodeAt(n);if(i>=55296&&i<=56319){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),e.copy(this.charBuffer,0,0,s),t.substring(0,n)}return t};OK.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(t==1&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t};OK.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t};function O2t(e){return e.toString(this.encoding)}o(O2t,"passThroughWrite");function x2t(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}o(x2t,"utf16DetectIncompleteChar");function C2t(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}o(C2t,"base64DetectIncompleteChar")});var IK=R((Lsn,uOe)=>{"use strict";uOe.exports=Ei;var D2t=jIe(),CK=require("buffer").Buffer;Ei.ReadableState=oOe;var EN=require("events").EventEmitter;EN.listenerCount||(EN.listenerCount=function(e,t){return e.listeners(t).length});var DK=require("stream"),ma=xo();ma.inherits=jt();var mw,nr=require("util");nr&&nr.debuglog?nr=nr.debuglog("stream"):nr=o(function(){},"debug");ma.inherits(Ei,DK);function oOe(e,t){var r=Cg();e=e||{};var n=e.highWaterMark,i=e.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,t instanceof r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(mw||(mw=sR().StringDecoder),this.decoder=new mw(e.encoding),this.encoding=e.encoding)}o(oOe,"ReadableState");function Ei(e){var t=Cg();if(!(this instanceof Ei))return new Ei(e);this._readableState=new oOe(e,this),this.readable=!0,DK.call(this)}o(Ei,"Readable");Ei.prototype.push=function(e,t){var r=this._readableState;return ma.isString(e)&&!r.objectMode&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=new CK(e,t),t="")),sOe(this,r,e,t,!1)};Ei.prototype.unshift=function(e){var t=this._readableState;return sOe(this,t,e,"",!0)};function sOe(e,t,r,n,i){var s=N2t(t,r);if(s)e.emit("error",s);else if(ma.isNullOrUndefined(r))t.reading=!1,t.ended||L2t(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else t.decoder&&!i&&!n&&(r=t.decoder.write(r)),i||(t.reading=!1),t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&vN(e)),U2t(e,t);else i||(t.reading=!1);return P2t(t)}o(sOe,"readableAddChunk");function P2t(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}o(P2t,"needMoreData");Ei.prototype.setEncoding=function(e){return mw||(mw=sR().StringDecoder),this._readableState.decoder=new mw(e),this._readableState.encoding=e,this};var rOe=8388608;function k2t(e){if(e>=rOe)e=rOe;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}o(k2t,"roundUpToNextPowerOf2");function nOe(e,t){return t.length===0&&t.ended?0:t.objectMode?e===0?0:1:isNaN(e)||ma.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=k2t(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}o(nOe,"howMuchToRead");Ei.prototype.read=function(e){nr("read",e);var t=this._readableState,r=e;if((!ma.isNumber(e)||e>0)&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return nr("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?xK(this):vN(this),null;if(e=nOe(e,t),e===0&&t.ended)return t.length===0&&xK(this),null;var n=t.needReadable;nr("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,nr("length less than watermark",n)),(t.ended||t.reading)&&(n=!1,nr("reading or ended",n)),n&&(nr("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),n&&!t.reading&&(e=nOe(r,t));var i;return e>0?i=aOe(e,t):i=null,ma.isNull(i)&&(t.needReadable=!0,e=0),t.length-=e,t.length===0&&!t.ended&&(t.needReadable=!0),r!==e&&t.ended&&t.length===0&&xK(this),ma.isNull(i)||this.emit("data",i),i};function N2t(e,t){var r=null;return!ma.isBuffer(t)&&!ma.isString(t)&&!ma.isNullOrUndefined(t)&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}o(N2t,"chunkInvalid");function L2t(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,vN(e)}o(L2t,"onEofChunk");function vN(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(nr("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?process.nextTick(function(){iOe(e)}):iOe(e))}o(vN,"emitReadable");function iOe(e){nr("emit readable"),e.emit("readable"),PK(e)}o(iOe,"emitReadable_");function U2t(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(function(){M2t(e,t)}))}o(U2t,"maybeReadMore");function M2t(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(nr("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}o(M2t,"maybeReadMore_");Ei.prototype._read=function(e){this.emit("error",new Error("not implemented"))};Ei.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,nr("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?u:l;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",a);function a(g){nr("onunpipe"),g===r&&l()}o(a,"onunpipe");function u(){nr("onend"),e.end()}o(u,"onend");var c=F2t(r);e.on("drain",c);function l(){nr("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",l),r.removeListener("data",f),n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}o(l,"cleanup"),r.on("data",f);function f(g){nr("ondata");var b=e.write(g);b===!1&&(nr("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,r.pause())}o(f,"ondata");function d(g){nr("onerror",g),h(),e.removeListener("error",d),EN.listenerCount(e,"error")===0&&e.emit("error",g)}o(d,"onerror"),!e._events||!e._events.error?e.on("error",d):D2t(e._events.error)?e._events.error.unshift(d):e._events.error=[d,e._events.error];function p(){e.removeListener("finish",m),h()}o(p,"onclose"),e.once("close",p);function m(){nr("onfinish"),e.removeListener("close",p),h()}o(m,"onfinish"),e.once("finish",m);function h(){nr("unpipe"),r.unpipe(e)}return o(h,"unpipe"),e.emit("pipe",r),n.flowing||(nr("pipe resume"),r.resume()),e};function F2t(e){return function(){var t=e._readableState;nr("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&EN.listenerCount(e,"data")&&(t.flowing=!0,PK(e))}}o(F2t,"pipeOnDrain");Ei.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<n;i++)r[i].emit("unpipe",this);return this}var i=j2t(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)};Ei.prototype.on=function(e,t){var r=DK.prototype.on.call(this,e,t);if(e==="data"&&this._readableState.flowing!==!1&&this.resume(),e==="readable"&&this.readable){var n=this._readableState;if(!n.readableListening)if(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading)n.length&&vN(this,n);else{var i=this;process.nextTick(function(){nr("readable nexttick read 0"),i.read(0)})}}return r};Ei.prototype.addListener=Ei.prototype.on;Ei.prototype.resume=function(){var e=this._readableState;return e.flowing||(nr("resume"),e.flowing=!0,e.reading||(nr("resume read 0"),this.read(0)),B2t(this,e)),this};function B2t(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(function(){q2t(e,t)}))}o(B2t,"resume");function q2t(e,t){t.resumeScheduled=!1,e.emit("resume"),PK(e),t.flowing&&!t.reading&&e.read(0)}o(q2t,"resume_");Ei.prototype.pause=function(){return nr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(nr("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function PK(e){var t=e._readableState;if(nr("flow",t.flowing),t.flowing)do var r=e.read();while(r!==null&&t.flowing)}o(PK,"flow");Ei.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;e.on("end",function(){if(nr("wrapped end"),t.decoder&&!t.ended){var a=t.decoder.end();a&&a.length&&n.push(a)}n.push(null)}),e.on("data",function(a){if(nr("wrapped data"),t.decoder&&(a=t.decoder.write(a)),!(!a||!t.objectMode&&!a.length)){var u=n.push(a);u||(r=!0,e.pause())}});for(var i in e)ma.isFunction(e[i])&&ma.isUndefined(this[i])&&(this[i]=function(a){return function(){return e[a].apply(e,arguments)}}(i));var s=["error","close","destroy","pause","resume"];return W2t(s,function(a){e.on(a,n.emit.bind(n,a))}),n._read=function(a){nr("wrapped _read",a),r&&(r=!1,e.resume())},n};Ei._fromList=aOe;function aOe(e,t){var r=t.buffer,n=t.length,i=!!t.decoder,s=!!t.objectMode,a;if(r.length===0)return null;if(n===0)a=null;else if(s)a=r.shift();else if(!e||e>=n)i?a=r.join(""):a=CK.concat(r,n),r.length=0;else if(e<r[0].length){var u=r[0];a=u.slice(0,e),r[0]=u.slice(e)}else if(e===r[0].length)a=r.shift();else{i?a="":a=new CK(e);for(var c=0,l=0,f=r.length;l<f&&c<e;l++){var u=r[0],d=Math.min(e-c,u.length);i?a+=u.slice(0,d):u.copy(a,c,0,d),d<u.length?r[0]=u.slice(d):r.shift(),c+=d}}return a}o(aOe,"fromList");function xK(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,process.nextTick(function(){!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}o(xK,"endReadable");function W2t(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}o(W2t,"forEach");function j2t(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}o(j2t,"indexOf")});var NK=R((Msn,lOe)=>{"use strict";lOe.exports=Qp;var kK=Cg(),aR=xo();aR.inherits=jt();aR.inherits(Qp,kK);function $2t(e,t){this.afterTransform=function(r,n){return V2t(t,r,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}o($2t,"TransformState");function V2t(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,aR.isNullOrUndefined(r)||e.push(r),i&&i(t);var s=e._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&e._read(s.highWaterMark)}o(V2t,"afterTransform");function Qp(e){if(!(this instanceof Qp))return new Qp(e);kK.call(this,e),this._transformState=new $2t(e,this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",function(){aR.isFunction(this._flush)?this._flush(function(r){cOe(t,r)}):cOe(t)})}o(Qp,"Transform");Qp.prototype.push=function(e,t){return this._transformState.needTransform=!1,kK.prototype.push.call(this,e,t)};Qp.prototype._transform=function(e,t,r){throw new Error("not implemented")};Qp.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Qp.prototype._read=function(e){var t=this._transformState;!aR.isNull(t.writechunk)&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};function cOe(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("calling transform done when ws.length != 0");if(n.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}o(cOe,"done")});var mOe=R((Bsn,pOe)=>{"use strict";pOe.exports=uR;var fOe=NK(),dOe=xo();dOe.inherits=jt();dOe.inherits(uR,fOe);function uR(e){if(!(this instanceof uR))return new uR(e);fOe.call(this,e)}o(uR,"PassThrough");uR.prototype._transform=function(e,t,r){r(null,e)}});var hOe=R((Gf,LK)=>{"use strict";Gf=LK.exports=IK();Gf.Stream=require("stream");Gf.Readable=Gf;Gf.Writable=AK();Gf.Duplex=Cg();Gf.Transform=NK();Gf.PassThrough=mOe();!process.browser&&process.env.READABLE_STREAM==="disable"&&(LK.exports=require("stream"))});var wOe=R((Wsn,_Oe)=>{"use strict";function cR(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(cR,"_interopDefault");var G2t=cR(wK()),H2t=cR(require("events")),K2t=cR(qIe()),Q2t=cR(hOe()),gOe=cR(jt());function z2t(e){return typeof e=="function"}o(z2t,"isFunction");function Y2t(e){return z2t(e.prefix)?e.prefix():e}o(Y2t,"getPrefix");function J2t(e){var t={};for(var r in e)t[r]=e[r];return t}o(J2t,"clone");function X2t(e,t,r){function n(s,a,u,c){return t.encode([s,r.encodeKey(a,u,c)])}o(n,"encodePrefix");function i(s,a){return a&&a.options&&(s.keyEncoding=s.keyEncoding||a.options.keyEncoding,s.valueEncoding=s.valueEncoding||a.options.valueEncoding),s}return o(i,"addEncodings"),e.open(function(){}),{apply:function(s,a,u){a=a||{};for(var c=[],l=-1,f=s.length;++l<f;){var d=s[l];i(d,d.prefix),d.prefix=Y2t(d.prefix),c.push({key:n(d.prefix,d.key,a,d),value:d.type!=="del"&&r.encodeValue(d.value,a,d),type:d.type})}e.db.batch(c,a,u)},get:function(s,a,u,c){return u.asBuffer=r.valueAsBuffer(u),e.db.get(n(a,s,u),u,function(l,f){l?c(l):c(null,r.decodeValue(f,u))})},createDecoder:function(s){return function(a,u){return{key:r.decodeKey(t.decode(a)[1],s),value:r.decodeValue(u,s)}}},isClosed:o(function(){return e.isClosed()},"isClosed"),close:o(function(a){return e.close(a)},"close"),iterator:function(s){var a=J2t(s||{}),u=s.prefix||[];function c(f){return n(u,f,a,{})}o(c,"encodeKey"),G2t.toLtgt(s,a,c,t.lowerBound,t.upperBound),a.prefix=null,a.keyAsBuffer=a.valueAsBuffer=!1,typeof a.limit!="number"&&(a.limit=-1),a.keyAsBuffer=t.buffer,a.valueAsBuffer=r.valueAsBuffer(a);function l(f){return{next:function(d){return f.next(d)},end:function(d){f.end(d)}}}return o(l,"wrapIterator"),l(e.db.iterator(a))}}}o(X2t,"nut");function UK(){Error.call(this)}o(UK,"NotFoundError");gOe(UK,Error);UK.prototype.name="NotFoundError";var Z2t=H2t.EventEmitter,eWt="6.5.4",tWt=new UK,yOe=o(function(e,t,r,n){var i=new Z2t;i.sublevels={},i.options=n,i.version=eWt,i.methods={},t=t||[];function s(a){var u={},c;if(n)for(c in n)typeof n[c]<"u"&&(u[c]=n[c]);if(a)for(c in a)typeof a[c]<"u"&&(u[c]=a[c]);return u}return o(s,"mergeOpts"),i.put=function(a,u,c,l){typeof c=="function"&&(l=c,c={}),e.apply([{key:a,value:u,prefix:t.slice(),type:"put"}],s(c),function(f){if(f)return l(f);i.emit("put",a,u),l(null)})},i.prefix=function(){return t.slice()},i.batch=function(a,u,c){typeof u=="function"&&(c=u,u={}),a=a.map(function(l){return{key:l.key,value:l.value,prefix:l.prefix||t,keyEncoding:l.keyEncoding,valueEncoding:l.valueEncoding,type:l.type}}),e.apply(a,s(u),function(l){if(l)return c(l);i.emit("batch",a),c(null)})},i.get=function(a,u,c){typeof u=="function"&&(c=u,u={}),e.get(a,t,s(u),function(l,f){l?c(tWt):c(null,f)})},i.sublevel=function(a,u){return i.sublevels[a]=i.sublevels[a]||yOe(e,t.concat(a),r,s(u))},i.readStream=i.createReadStream=function(a){a=s(a),a.prefix=t;var u,c=e.iterator(a);return u=r(a,e.createDecoder(a)),u.setIterator(c),u},i.close=function(a){e.close(a)},i.isOpen=e.isOpen,i.isClosed=e.isClosed,i},"sublevel"),bOe=Q2t.Readable;function zp(e,t){if(!(this instanceof zp))return new zp(e,t);bOe.call(this,{objectMode:!0,highWaterMark:e.highWaterMark}),this._waiting=!1,this._options=e,this._makeData=t}o(zp,"ReadStream");gOe(zp,bOe);zp.prototype.setIterator=function(e){return this._iterator=e,this._destroyed?e.end(function(){}):this._waiting?(this._waiting=!1,this._read()):this};zp.prototype._read=o(function(){var t=this;if(!t._destroyed){if(!t._iterator)return this._waiting=!0;t._iterator.next(function(r,n,i){if(r||n===void 0&&i===void 0)return!r&&!t._destroyed&&t.push(null),t._cleanup(r);i=t._makeData(n,i),t._destroyed||t.push(i)})}},"read");zp.prototype._cleanup=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;e&&e.message!=="iterator has ended"&&t.emit("error",e),t._iterator?t._iterator.end(function(){t._iterator=null,t.emit("close")}):t.emit("close")}};zp.prototype.destroy=function(){this._cleanup()};var rWt={encode:function(e){return"\xFF"+e[0]+"\xFF"+e[1]},decode:function(e){var t=e.toString(),r=t.indexOf("\xFF",1);return[t.substring(1,r),t.substring(r+1)]},lowerBound:"\0",upperBound:"\xFF"},nWt=new K2t;function iWt(e){return yOe(X2t(e,rWt,nWt),[],zp,e.options)}o(iWt,"sublevelPouch");_Oe.exports=iWt});var SOe=R(($sn,SN)=>{"use strict";var EOe=Kp().Transform,vOe=jt();function hw(e){EOe.call(this,e),this._destroyed=!1}o(hw,"DestroyableTransform");vOe(hw,EOe);hw.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;process.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}};function oWt(e,t,r){r(null,e)}o(oWt,"noop");function MK(e){return function(t,r,n){return typeof t=="function"&&(n=r,r=t,t={}),typeof r!="function"&&(r=oWt),typeof n!="function"&&(n=null),e(t,r,n)}}o(MK,"through2");SN.exports=MK(function(e,t,r){var n=new hw(e);return n._transform=t,r&&(n._flush=r),n});SN.exports.ctor=MK(function(e,t,r){function n(i){if(!(this instanceof n))return new n(i);this.options=Object.assign({},e,i),hw.call(this,this.options)}return o(n,"Through2"),vOe(n,hw),n.prototype._transform=t,r&&(n.prototype._flush=r),n});SN.exports.obj=MK(function(e,t,r){var n=new hw(Object.assign({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n})});var IOe=R((Gsn,ROe)=>{"use strict";function mr(e){if(this._capacity=AOe(e),this._length=0,this._front=0,TOe(e)){for(var t=e.length,r=0;r<t;++r)this[r]=e[r];this._length=t}}o(mr,"Deque");mr.prototype.toArray=o(function(){for(var t=this._length,r=new Array(t),n=this._front,i=this._capacity,s=0;s<t;++s)r[s]=this[n+s&i-1];return r},"Deque$toArray");mr.prototype.push=o(function(t){var r=arguments.length,n=this._length;if(r>1){var i=this._capacity;if(n+r>i){for(var a=0;a<r;++a){this._checkCapacity(n+1);var s=this._front+n&this._capacity-1;this[s]=arguments[a],n++,this._length=n}return n}else{for(var s=this._front,a=0;a<r;++a)this[s+n&i-1]=arguments[a],s++;return this._length=n+r,n+r}}if(r===0)return n;this._checkCapacity(n+1);var a=this._front+n&this._capacity-1;return this[a]=t,this._length=n+1,n+1},"Deque$push");mr.prototype.pop=o(function(){var t=this._length;if(t!==0){var r=this._front+t-1&this._capacity-1,n=this[r];return this[r]=void 0,this._length=t-1,n}},"Deque$pop");mr.prototype.shift=o(function(){var t=this._length;if(t!==0){var r=this._front,n=this[r];return this[r]=void 0,this._front=r+1&this._capacity-1,this._length=t-1,n}},"Deque$shift");mr.prototype.unshift=o(function(t){var r=this._length,n=arguments.length;if(n>1){var a=this._capacity;if(r+n>a){for(var u=n-1;u>=0;u--){this._checkCapacity(r+1);var a=this._capacity,i=(this._front-1&a-1^a)-a;this[i]=arguments[u],r++,this._length=r,this._front=i}return r}else{for(var s=this._front,u=n-1;u>=0;u--){var i=(s-1&a-1^a)-a;this[i]=arguments[u],s=i}return this._front=s,this._length=r+n,r+n}}if(n===0)return r;this._checkCapacity(r+1);var a=this._capacity,u=(this._front-1&a-1^a)-a;return this[u]=t,this._length=r+1,this._front=u,r+1},"Deque$unshift");mr.prototype.peekBack=o(function(){var t=this._length;if(t!==0){var r=this._front+t-1&this._capacity-1;return this[r]}},"Deque$peekBack");mr.prototype.peekFront=o(function(){if(this._length!==0)return this[this._front]},"Deque$peekFront");mr.prototype.get=o(function(t){var r=t;if(r===(r|0)){var n=this._length;if(r<0&&(r=r+n),!(r<0||r>=n))return this[this._front+r&this._capacity-1]}},"Deque$get");mr.prototype.isEmpty=o(function(){return this._length===0},"Deque$isEmpty");mr.prototype.clear=o(function(){for(var t=this._length,r=this._front,n=this._capacity,i=0;i<t;++i)this[r+i&n-1]=void 0;this._length=0,this._front=0},"Deque$clear");mr.prototype.toString=o(function(){return this.toArray().toString()},"Deque$toString");mr.prototype.valueOf=mr.prototype.toString;mr.prototype.removeFront=mr.prototype.shift;mr.prototype.removeBack=mr.prototype.pop;mr.prototype.insertFront=mr.prototype.unshift;mr.prototype.insertBack=mr.prototype.push;mr.prototype.enqueue=mr.prototype.push;mr.prototype.dequeue=mr.prototype.shift;mr.prototype.toJSON=mr.prototype.toArray;Object.defineProperty(mr.prototype,"length",{get:function(){return this._length},set:function(){throw new RangeError("")}});mr.prototype._checkCapacity=o(function(t){this._capacity<t&&this._resizeTo(AOe(this._capacity*1.5+16))},"Deque$_checkCapacity");mr.prototype._resizeTo=o(function(t){var r=this._capacity;this._capacity=t;var n=this._front,i=this._length;if(n+i>r){var s=n+i&r-1;sWt(this,0,this,r,s)}},"Deque$_resizeTo");var TOe=Array.isArray;function sWt(e,t,r,n,i){for(var s=0;s<i;++s)r[s+n]=e[s+t],e[s+t]=void 0}o(sWt,"arrayMove");function aWt(e){return e=e>>>0,e=e-1,e=e|e>>1,e=e|e>>2,e=e|e>>4,e=e|e>>8,e=e|e>>16,e+1}o(aWt,"pow2AtLeast");function AOe(e){if(typeof e!="number")if(TOe(e))e=e.length;else return 16;return aWt(Math.min(Math.max(16,e),1073741824))}o(AOe,"getCapacity");ROe.exports=mr});var xOe=R((Ksn,OOe)=>{"use strict";var uWt=Object.prototype.toString,FK=typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function cWt(e){return uWt.call(e).slice(8,-1)==="ArrayBuffer"}o(cWt,"isArrayBuffer");function lWt(e,t,r){t>>>=0;var n=e.byteLength-t;if(n<0)throw new RangeError("'offset' is out of bounds");if(r===void 0)r=n;else if(r>>>=0,r>n)throw new RangeError("'length' is out of bounds");return FK?Buffer.from(e.slice(t,t+r)):new Buffer(new Uint8Array(e.slice(t,t+r)))}o(lWt,"fromArrayBuffer");function fWt(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!Buffer.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return FK?Buffer.from(e,t):new Buffer(e,t)}o(fWt,"fromString");function dWt(e,t,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return cWt(e)?lWt(e,t,r):typeof e=="string"?fWt(e,t):FK?Buffer.from(e):new Buffer(e)}o(dWt,"bufferFrom");OOe.exports=dWt});var WOe=R(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});function TN(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(TN,"_interopDefault");var pWt=TN(Kk()),WK=TN($A()),mWt=Z_(),hWt=TN(jt()),Yp=ew(),AN=TN(require("events")),kOe=require("uuid"),gWt=tw();function yWt(e){return e instanceof Buffer}o(yWt,"isBinaryObject");var NOe=Function.prototype.toString,bWt=NOe.call(Object);function _Wt(e){var t=Object.getPrototypeOf(e);if(t===null)return!0;var r=t.constructor;return typeof r=="function"&&r instanceof r&&NOe.call(r)==bWt}o(_Wt,"isPlainObject");function lR(e){var t,r,n;if(!e||typeof e!="object")return e;if(Array.isArray(e)){for(t=[],r=0,n=e.length;r<n;r++)t[r]=lR(e[r]);return t}if(e instanceof Date)return e.toISOString();if(yWt(e))return pWt(e);if(!_Wt(e))return e;t={};for(r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=lR(e[r]);typeof i<"u"&&(t[r]=i)}return t}o(lR,"clone");function LOe(e){var t=!1;return WK(function(r){if(t)throw new Error("once called more than once");t=!0,e.apply(this,r)})}o(LOe,"once");function UOe(e){return WK(function(t){t=lR(t);var r=this,n=typeof t[t.length-1]=="function"?t.pop():!1,i=new Promise(function(s,a){var u;try{var c=LOe(function(l,f){l?a(l):s(f)});t.push(c),u=e.apply(r,t),u&&typeof u.then=="function"&&s(u)}catch(l){a(l)}});return n&&i.then(function(s){n(null,s)},n),i})}o(UOe,"toPromise");function wWt(e,t,r){if(e.constructor.listeners("debug").length){for(var n=["api",e.name,t],i=0;i<r.length-1;i++)n.push(r[i]);e.constructor.emit("debug",n);var s=r[r.length-1];r[r.length-1]=function(a,u){var c=["api",e.name,t];c=c.concat(a?["error",a]:["success",u]),e.constructor.emit("debug",c),s(a,u)}}}o(wWt,"logApiCall");function EWt(e,t){return UOe(WK(function(r){if(this._closed)return Promise.reject(new Error("database is closed"));if(this._destroyed)return Promise.reject(new Error("database is destroyed"));var n=this;return wWt(n,e,r),this.taskqueue.isReady?t.apply(this,r):new Promise(function(i,s){n.taskqueue.addTask(function(a){a?s(a):i(n[e].apply(n,r))})})}))}o(EWt,"adapterFun");function jK(e,t){for(var r={},n=0,i=t.length;n<i;n++){var s=t[n];s in e&&(r[s]=e[s])}return r}o(jK,"pick");var vWt=6;function COe(e){return e}o(COe,"identityFunction");function SWt(e){return[{ok:e}]}o(SWt,"formatResultForOpenRevsGet");function TWt(e,t,r){var n=t.docs,i=new mWt.Map;n.forEach(function(g){i.has(g.id)?i.get(g.id).push(g):i.set(g.id,[g])});var s=i.size,a=0,u=new Array(s);function c(){var g=[];u.forEach(function(b){b.docs.forEach(function(w){g.push({id:b.id,docs:[w]})})}),r(null,{results:g})}o(c,"collapseResultsAndFinish");function l(){++a===s&&c()}o(l,"checkDone");function f(g,b,w){u[g]={id:b,docs:w},l()}o(f,"gotResult");var d=[];i.forEach(function(g,b){d.push(b)});var p=0;function m(){if(!(p>=d.length)){var g=Math.min(p+vWt,d.length),b=d.slice(p,g);h(b,p),p+=b.length}}o(m,"nextBatch");function h(g,b){g.forEach(function(w,E){var v=b+E,S=i.get(w),T=jK(S[0],["atts_since","attachments"]);T.open_revs=S.map(function(O){return O.rev}),T.open_revs=T.open_revs.filter(COe);var x=COe;T.open_revs.length===0&&(delete T.open_revs,x=SWt),["revs","attachments","binary","ajax","latest"].forEach(function(O){O in t&&(T[O]=t[O])}),e.get(w,T,function(O,C){var D;O?D=[{error:O}]:D=x(C),f(v,w,D),m()})})}o(h,"processBatch"),m()}o(TWt,"bulkGet");function $K(){return!1}o($K,"hasLocalStorage");function MOe(e){process.nextTick(e)}o(MOe,"nextTick");hWt(gw,AN);function AWt(e){$K()&&addEventListener("storage",function(t){e.emit(t.key)})}o(AWt,"attachBrowserEvents");function gw(){AN.call(this),this._listeners={},AWt(this)}o(gw,"Changes");gw.prototype.addListener=function(e,t,r,n){if(this._listeners[t])return;var i=this,s=!1;function a(){if(!i._listeners[t])return;if(s){s="waiting";return}s=!0;var u=jK(n,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary","return_docs"]);function c(){s=!1}o(c,"onError"),r.changes(u).on("change",function(l){l.seq>n.since&&!n.cancelled&&(n.since=l.seq,n.onChange(l))}).on("complete",function(){s==="waiting"&&MOe(a),s=!1}).on("error",c)}o(a,"eventFunction"),this._listeners[t]=a,this.on(e,a)};gw.prototype.removeListener=function(e,t){t in this._listeners&&(AN.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])};gw.prototype.notifyLocalWindows=function(e){$K()&&(localStorage[e]=localStorage[e]==="a"?"b":"a")};gw.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};function FOe(e){if(typeof console<"u"&&typeof console[e]=="function"){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}o(FOe,"guardedConsole");function RWt(e,t){var r=6e5;e=parseInt(e,10)||0,t=parseInt(t,10),t!==t||t<=e?t=(e||1)<<1:t=t+1,t>r&&(e=r>>1,t=r);var n=Math.random(),i=t-e;return~~(i*n+e)}o(RWt,"randomNumber");function IWt(e){var t=0;return e||(t=2e3),RWt(e,t)}o(IWt,"defaultBackOff");var OWt=o(function(){},"res"),BK;typeof Object.assign=="function"?BK=Object.assign:BK=o(function(e){for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(n!=null)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},"assign");var xWt=BK;function CWt(e,t,r){try{return!e(t,r)}catch(i){var n="Filter function threw: "+i.toString();return Yp.createError(Yp.BAD_REQUEST,n)}}o(CWt,"tryFilter");function DWt(e){var t={},r=e.filter&&typeof e.filter=="function";return t.query=e.query_params,o(function(i){i.doc||(i.doc={});var s=r&&CWt(e.filter,i.doc,t);if(typeof s=="object")return s;if(s)return!1;if(!e.include_docs)delete i.doc;else if(!e.attachments)for(var a in i.doc._attachments)i.doc._attachments.hasOwnProperty(a)&&(i.doc._attachments[a].stub=!0);return!0},"filter")}o(DWt,"filterChange");function PWt(e){for(var t=[],r=0,n=e.length;r<n;r++)t=t.concat(e[r]);return t}o(PWt,"flatten");function kWt(){}o(kWt,"f");var NWt=kWt.name,qK;NWt?qK=o(function(e){return e.name},"res$1"):qK=o(function(e){var t=e.toString().match(/^\s*function\s*(?:(\S+)\s*)?\(/);return t&&t[1]?t[1]:""},"res$1");var LWt=qK;function UWt(e){var t;if(e?typeof e!="string"?t=Yp.createError(Yp.INVALID_ID):/^_/.test(e)&&!/^_(design|local)/.test(e)&&(t=Yp.createError(Yp.RESERVED_ID)):t=Yp.createError(Yp.MISSING_ID),t)throw t}o(UWt,"invalidIdError");function MWt(e){return typeof e._remote=="boolean"?e._remote:typeof e.type=="function"?(FOe("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),e.type()==="http"):!1}o(MWt,"isRemote");function FWt(e,t){return"listenerCount"in e?e.listenerCount(t):AN.listenerCount(e,t)}o(FWt,"listenerCount");function BOe(e){if(!e)return null;var t=e.split("/");return t.length===2?t:t.length===1?[e,e]:null}o(BOe,"parseDesignDocFunctionName");function BWt(e){var t=BOe(e);return t?t.join("/"):null}o(BWt,"normalizeDesignDocFunctionName");var DOe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],POe="queryKey",qWt=/(?:^|&)([^&=]*)=?([^&]*)/g,WWt=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function jWt(e){for(var t=WWt.exec(e),r={},n=14;n--;){var i=DOe[n],s=t[n]||"",a=["user","password"].indexOf(i)!==-1;r[i]=a?decodeURIComponent(s):s}return r[POe]={},r[DOe[12]].replace(qWt,function(u,c,l){c&&(r[POe][c]=l)}),r}o(jWt,"parseUri");function $Wt(e,t){var r=[],n=[];for(var i in t)t.hasOwnProperty(i)&&(r.push(i),n.push(t[i]));return r.push(e),Function.apply(null,r).apply(null,n)}o($Wt,"scopeEval");function qOe(e,t,r){return new Promise(function(n,i){e.get(t,function(s,a){if(s){if(s.status!==404)return i(s);a={}}var u=a._rev,c=r(a);if(!c)return n({updated:!1,rev:u});c._id=t,c._rev=u,n(VWt(e,c,r))})})}o(qOe,"upsert");function VWt(e,t,r){return e.put(t).then(function(n){return{updated:!0,rev:n.rev}},function(n){if(n.status!==409)throw n;return qOe(e,t._id,r)})}o(VWt,"tryAndPut");function GWt(e,t){var r=lR(e);return t?(delete r._rev_tree,gWt.stringMd5(JSON.stringify(r))):kOe.v4().replace(/-/g,"").toLowerCase()}o(GWt,"rev");var HWt=kOe.v4;Cr.adapterFun=EWt;Cr.assign=xWt;Cr.bulkGetShim=TWt;Cr.changesHandler=gw;Cr.clone=lR;Cr.defaultBackOff=IWt;Cr.explainError=OWt;Cr.filterChange=DWt;Cr.flatten=PWt;Cr.functionName=LWt;Cr.guardedConsole=FOe;Cr.hasLocalStorage=$K;Cr.invalidIdError=UWt;Cr.isRemote=MWt;Cr.listenerCount=FWt;Cr.nextTick=MOe;Cr.normalizeDdocFunctionName=BWt;Cr.once=LOe;Cr.parseDdocFunctionName=BOe;Cr.parseUri=jWt;Cr.pick=jK;Cr.rev=GWt;Cr.scopeEval=$Wt;Cr.toPromise=UOe;Cr.upsert=qOe;Cr.uuid=HWt});var $Oe=R((Jsn,jOe)=>{"use strict";var KWt=Object.prototype.toString,VK=typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function QWt(e){return KWt.call(e).slice(8,-1)==="ArrayBuffer"}o(QWt,"isArrayBuffer");function zWt(e,t,r){t>>>=0;var n=e.byteLength-t;if(n<0)throw new RangeError("'offset' is out of bounds");if(r===void 0)r=n;else if(r>>>=0,r>n)throw new RangeError("'length' is out of bounds");return VK?Buffer.from(e.slice(t,t+r)):new Buffer(new Uint8Array(e.slice(t,t+r)))}o(zWt,"fromArrayBuffer");function YWt(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!Buffer.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return VK?Buffer.from(e,t):new Buffer(e,t)}o(YWt,"fromString");function JWt(e,t,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return QWt(e)?zWt(e,t,r):typeof e=="string"?YWt(e,t):VK?Buffer.from(e):new Buffer(e)}o(JWt,"bufferFrom");jOe.exports=JWt});var HK=R(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});function XWt(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(XWt,"_interopDefault");var VOe=XWt($Oe());function ZWt(e){var t=new Buffer(e,"base64");if(t.toString("base64")!==e)throw new Error("attachment is not a valid base64 string");return t.toString("binary")}o(ZWt,"thisAtob");function ejt(e){return VOe(e,"binary").toString("base64")}o(ejt,"thisBtoa");function GK(e,t,r){var n=VOe(e,t);return n.type=r,n}o(GK,"typedBuffer");function tjt(e,t){return GK(e,"base64",t)}o(tjt,"b64ToBluffer");function rjt(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}o(rjt,"binaryStringToArrayBuffer");function njt(e,t){return GK(e,"binary",t)}o(njt,"binStringToBluffer");function ijt(){}o(ijt,"createBlob");function ojt(e,t){t(e.toString("base64"))}o(ojt,"blobToBase64");function sjt(e,t){t(e.toString("binary"))}o(sjt,"blobToBase64$1");function ajt(e,t){var r=new FileReader;r.onloadend=function(n){var i=n.target.result||new ArrayBuffer(0);t(i)},r.readAsArrayBuffer(e)}o(ajt,"readAsArrayBuffer");function ujt(e){for(var t="",r=new Uint8Array(e),n=r.byteLength,i=0;i<n;i++)t+=String.fromCharCode(r[i]);return t}o(ujt,"arrayBufferToBinaryString");function cjt(e,t){var r=new FileReader,n=typeof r.readAsBinaryString=="function";r.onloadend=function(i){var s=i.target.result||"";if(n)return t(s);t(ujt(s))},n?r.readAsBinaryString(e):r.readAsArrayBuffer(e)}o(cjt,"readAsBinaryString");ha.atob=ZWt;ha.btoa=ejt;ha.base64StringToBlobOrBuffer=tjt;ha.binaryStringToArrayBuffer=rjt;ha.binaryStringToBlobOrBuffer=njt;ha.blob=ijt;ha.blobOrBufferToBase64=ojt;ha.blobOrBufferToBinaryString=sjt;ha.readAsArrayBuffer=ajt;ha.readAsBinaryString=cjt;ha.typedBuffer=GK});var QK=R(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});function KK(e){for(var t,r,n,i=e.rev_tree.slice(),s;s=i.pop();){var a=s.ids,u=a[2],c=s.pos;if(u.length){for(var l=0,f=u.length;l<f;l++)i.push({pos:c+1,ids:u[l]});continue}var d=!!a[1].deleted,p=a[0];(!t||(n!==d?n:r!==c?r<c:t<p))&&(t=p,r=c,n=d)}return r+"-"+t}o(KK,"winningRev");function RN(e,t){for(var r=e.slice(),n;n=r.pop();)for(var i=n.pos,s=n.ids,a=s[2],u=t(a.length===0,i,s[0],n.ctx,s[1]),c=0,l=a.length;c<l;c++)r.push({pos:i+1,ids:a[c],ctx:u})}o(RN,"traverseRevTree");function ljt(e,t){return e.pos-t.pos}o(ljt,"sortByPos");function KOe(e){var t=[];RN(e,function(i,s,a,u,c){i&&t.push({rev:s+"-"+a,pos:s,opts:c})}),t.sort(ljt).reverse();for(var r=0,n=t.length;r<n;r++)delete t[r].pos;return t}o(KOe,"collectLeaves");function fjt(e){for(var t=KK(e),r=KOe(e.rev_tree),n=[],i=0,s=r.length;i<s;i++){var a=r[i];a.rev!==t&&!a.opts.deleted&&n.push(a.rev)}return n}o(fjt,"collectConflicts");function djt(e){var t=[];return RN(e.rev_tree,function(r,n,i,s,a){a.status==="available"&&!r&&(t.push(n+"-"+i),a.status="missing")}),t}o(djt,"compactTree");function QOe(e){for(var t=[],r=e.slice(),n;n=r.pop();){var i=n.pos,s=n.ids,a=s[0],u=s[1],c=s[2],l=c.length===0,f=n.history?n.history.slice():[];f.push({id:a,opts:u}),l&&t.push({pos:i+1-f.length,ids:f});for(var d=0,p=c.length;d<p;d++)r.push({pos:i+1,ids:c[d],history:f})}return t.reverse()}o(QOe,"rootToLeaf");function pjt(e,t){return e.pos-t.pos}o(pjt,"sortByPos$1");function mjt(e,t,r){for(var n=0,i=e.length,s;n<i;)s=n+i>>>1,r(e[s],t)<0?n=s+1:i=s;return n}o(mjt,"binarySearch");function hjt(e,t,r){var n=mjt(e,t,r);e.splice(n,0,t)}o(hjt,"insertSorted");function GOe(e,t){for(var r,n,i=t,s=e.length;i<s;i++){var a=e[i],u=[a.id,a.opts,[]];n?(n[2].push(u),n=u):r=n=u}return r}o(GOe,"pathToTree");function gjt(e,t){return e[0]<t[0]?-1:1}o(gjt,"compareTree");function HOe(e,t){for(var r=[{tree1:e,tree2:t}],n=!1;r.length>0;){var i=r.pop(),s=i.tree1,a=i.tree2;(s[1].status||a[1].status)&&(s[1].status=s[1].status==="available"||a[1].status==="available"?"available":"missing");for(var u=0;u<a[2].length;u++){if(!s[2][0]){n="new_leaf",s[2][0]=a[2][u];continue}for(var c=!1,l=0;l<s[2].length;l++)s[2][l][0]===a[2][u][0]&&(r.push({tree1:s[2][l],tree2:a[2][u]}),c=!0);c||(n="new_branch",hjt(s[2],a[2][u],gjt))}}return{conflicts:n,tree:e}}o(HOe,"mergeTree");function zOe(e,t,r){var n=[],i=!1,s=!1,a;if(!e.length)return{tree:[t],conflicts:"new_leaf"};for(var u=0,c=e.length;u<c;u++){var l=e[u];if(l.pos===t.pos&&l.ids[0]===t.ids[0])a=HOe(l.ids,t.ids),n.push({pos:l.pos,ids:a.tree}),i=i||a.conflicts,s=!0;else if(r!==!0){var f=l.pos<t.pos?l:t,d=l.pos<t.pos?t:l,p=d.pos-f.pos,m=[],h=[];for(h.push({ids:f.ids,diff:p,parent:null,parentIdx:null});h.length>0;){var g=h.pop();if(g.diff===0){g.ids[0]===d.ids[0]&&m.push(g);continue}for(var b=g.ids[2],w=0,E=b.length;w<E;w++)h.push({ids:b[w],diff:g.diff-1,parent:g.ids,parentIdx:w})}var v=m[0];v?(a=HOe(v.ids,d.ids),v.parent[2][v.parentIdx]=a.tree,n.push({pos:f.pos,ids:f.ids}),i=i||a.conflicts,s=!0):n.push(l)}else n.push(l)}return s||n.push(t),n.sort(pjt),{tree:n,conflicts:i||"internal_node"}}o(zOe,"doMerge");function yjt(e,t){for(var r=QOe(e),n,i,s=0,a=r.length;s<a;s++){var u=r[s],c=u.ids,l;if(c.length>t){n||(n={});var f=c.length-t;l={pos:u.pos+f,ids:GOe(c,f)};for(var d=0;d<f;d++){var p=u.pos+d+"-"+c[d].id;n[p]=!0}}else l={pos:u.pos,ids:GOe(c,0)};i?i=zOe(i,l,!0).tree:i=[l]}return n&&RN(i,function(m,h,g){delete n[h+"-"+g]}),{tree:i,revs:n?Object.keys(n):[]}}o(yjt,"stem");function bjt(e,t,r){var n=zOe(e,t),i=yjt(n.tree,r);return{tree:i.tree,stemmedRevs:i.revs,conflicts:n.conflicts}}o(bjt,"merge");function _jt(e,t){for(var r=e.slice(),n=t.split("-"),i=parseInt(n[0],10),s=n[1],a;a=r.pop();){if(a.pos===i&&a.ids[0]===s)return!0;for(var u=a.ids[2],c=0,l=u.length;c<l;c++)r.push({pos:a.pos+1,ids:u[c]})}return!1}o(_jt,"revExists");function wjt(e){return e.ids}o(wjt,"getTrees");function Ejt(e,t){t||(t=KK(e));for(var r=t.substring(t.indexOf("-")+1),n=e.rev_tree.map(wjt),i;i=n.pop();){if(i[0]===r)return!!i[1].deleted;n=n.concat(i[2])}}o(Ejt,"isDeleted");function vjt(e){return/^_local/.test(e)}o(vjt,"isLocalId");function Sjt(e,t){for(var r=t.rev_tree.slice(),n;n=r.pop();){var i=n.pos,s=n.ids,a=s[0],u=s[1],c=s[2],l=c.length===0,f=n.history?n.history.slice():[];if(f.push({id:a,pos:i,opts:u}),l)for(var d=0,p=f.length;d<p;d++){var m=f[d],h=m.pos+"-"+m.id;if(h===e)return i+"-"+a}for(var g=0,b=c.length;g<b;g++)r.push({pos:i+1,ids:c[g],history:f})}throw new Error("Unable to resolve latest revision for id "+t.id+", rev "+e)}o(Sjt,"latest");ga.collectConflicts=fjt;ga.collectLeaves=KOe;ga.compactTree=djt;ga.isDeleted=Ejt;ga.isLocalId=vjt;ga.merge=bjt;ga.revExists=_jt;ga.rootToLeaf=QOe;ga.traverseRevTree=RN;ga.winningRev=KK;ga.latest=Sjt});var txe=R(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});var Dg=WOe(),fR=HK(),JOe=tw(),Tjt=Z_(),ya=ew(),Os=QK();function Ajt(e,t){var r=t.keys,n={offset:t.skip};return Promise.all(r.map(function(i){var s=Dg.assign({key:i,deleted:"ok"},t);return["limit","skip","keys"].forEach(function(a){delete s[a]}),new Promise(function(a,u){e._allDocs(s,function(c,l){if(c)return u(c);t.update_seq&&l.update_seq!==void 0&&(n.update_seq=l.update_seq),n.total_rows=l.total_rows,a(l.rows[0]||{key:i,error:"not_found"})})})})).then(function(i){return n.rows=i,n})}o(Ajt,"allDocsKeysQuery");function XOe(e){return e.reduce(function(t,r){return t[r]=!0,t},{})}o(XOe,"toObject");var Rjt=XOe(["_id","_rev","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),Ijt=XOe(["_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]);function YOe(e){if(!/^\d+-/.test(e))return ya.createError(ya.INVALID_REV);var t=e.indexOf("-"),r=e.substring(0,t),n=e.substring(t+1);return{prefix:parseInt(r,10),id:n}}o(YOe,"parseRevisionInfo");function Ojt(e,t){for(var r=e.start-e.ids.length+1,n=e.ids,i=[n[0],t,[]],s=1,a=n.length;s<a;s++)i=[n[s],{status:"missing"},[i]];return[{pos:r,ids:i}]}o(Ojt,"makeRevTreeFromRevisions");function ZOe(e,t,r){r||(r={deterministic_revs:!0});var n,i,s,a={status:"available"};if(e._deleted&&(a.deleted=!0),t)if(e._id||(e._id=Dg.uuid()),i=Dg.rev(e,r.deterministic_revs),e._rev){if(s=YOe(e._rev),s.error)return s;e._rev_tree=[{pos:s.prefix,ids:[s.id,{status:"missing"},[[i,a,[]]]]}],n=s.prefix+1}else e._rev_tree=[{pos:1,ids:[i,a,[]]}],n=1;else if(e._revisions&&(e._rev_tree=Ojt(e._revisions,a),n=e._revisions.start,i=e._revisions.ids[0]),!e._rev_tree){if(s=YOe(e._rev),s.error)return s;n=s.prefix,i=s.id,e._rev_tree=[{pos:n,ids:[i,a,[]]}]}Dg.invalidIdError(e._id),e._rev=n+"-"+i;var u={metadata:{},data:{}};for(var c in e)if(Object.prototype.hasOwnProperty.call(e,c)){var l=c[0]==="_";if(l&&!Rjt[c]){var f=ya.createError(ya.DOC_VALIDATION,c);throw f.message=ya.DOC_VALIDATION.message+": "+c,f}else l&&!Ijt[c]?u.metadata[c.slice(1)]=e[c]:u.data[c]=e[c]}return u}o(ZOe,"parseDoc");function xjt(e){try{return fR.atob(e)}catch{var t=ya.createError(ya.BAD_ARG,"Attachment is not a valid base64 string");return{error:t}}}o(xjt,"parseBase64");function Cjt(e,t,r){var n=xjt(e.data);if(n.error)return r(n.error);e.length=n.length,t==="blob"?e.data=fR.binaryStringToBlobOrBuffer(n,e.content_type):t==="base64"?e.data=fR.btoa(n):e.data=n,JOe.binaryMd5(n,function(i){e.digest="md5-"+i,r()})}o(Cjt,"preprocessString");function Djt(e,t,r){JOe.binaryMd5(e.data,function(n){e.digest="md5-"+n,e.length=e.data.size||e.data.length||0,t==="binary"?fR.blobOrBufferToBinaryString(e.data,function(i){e.data=i,r()}):t==="base64"?fR.blobOrBufferToBase64(e.data,function(i){e.data=i,r()}):r()})}o(Djt,"preprocessBlob");function Pjt(e,t,r){if(e.stub)return r();typeof e.data=="string"?Cjt(e,t,r):Djt(e,t,r)}o(Pjt,"preprocessAttachment");function kjt(e,t,r){if(!e.length)return r();var n=0,i;e.forEach(function(a){var u=a.data&&a.data._attachments?Object.keys(a.data._attachments):[],c=0;if(!u.length)return s();function l(d){i=d,c++,c===u.length&&s()}o(l,"processedAttachment");for(var f in a.data._attachments)a.data._attachments.hasOwnProperty(f)&&Pjt(a.data._attachments[f],t,l)});function s(){n++,e.length===n&&(i?r(i):r())}o(s,"done")}o(kjt,"preprocessAttachments");function exe(e,t,r,n,i,s,a,u){if(Os.revExists(t.rev_tree,r.metadata.rev)&&!u)return n[i]=r,s();var c=t.winningRev||Os.winningRev(t),l="deleted"in t?t.deleted:Os.isDeleted(t,c),f="deleted"in r.metadata?r.metadata.deleted:Os.isDeleted(r.metadata),d=/^1-/.test(r.metadata.rev);if(l&&!f&&u&&d){var p=r.data;p._rev=c,p._id=r.metadata.id,r=ZOe(p,u)}var m=Os.merge(t.rev_tree,r.metadata.rev_tree[0],e),h=u&&(l&&f&&m.conflicts!=="new_leaf"||!l&&m.conflicts!=="new_leaf"||l&&!f&&m.conflicts==="new_branch");if(h){var g=ya.createError(ya.REV_CONFLICT);return n[i]=g,s()}var b=r.metadata.rev;r.metadata.rev_tree=m.tree,r.stemmedRevs=m.stemmedRevs||[],t.rev_map&&(r.metadata.rev_map=t.rev_map);var w=Os.winningRev(r.metadata),E=Os.isDeleted(r.metadata,w),v=l===E?0:l<E?-1:1,S;b===w?S=E:S=Os.isDeleted(r.metadata,b),a(r,w,E,S,!0,v,i,s)}o(exe,"updateDoc");function Njt(e){return e.metadata.rev_tree[0].ids[1].status==="missing"}o(Njt,"rootIsMissing");function Ljt(e,t,r,n,i,s,a,u,c){e=e||1e3;function l(g,b,w){var E=Os.winningRev(g.metadata),v=Os.isDeleted(g.metadata,E);if("was_delete"in u&&v)return s[b]=ya.createError(ya.MISSING_DOC,"deleted"),w();var S=f&&Njt(g);if(S){var T=ya.createError(ya.REV_CONFLICT);return s[b]=T,w()}var x=v?0:1;a(g,E,v,v,!1,x,b,w)}o(l,"insertDoc");var f=u.new_edits,d=new Tjt.Map,p=0,m=t.length;function h(){++p===m&&c&&c()}o(h,"checkAllDocsDone"),t.forEach(function(g,b){if(g._id&&Os.isLocalId(g._id)){var w=g._deleted?"_removeLocal":"_putLocal";r[w](g,{ctx:i},function(v,S){s[b]=v||S,h()});return}var E=g.metadata.id;d.has(E)?(m--,d.get(E).push([g,b])):d.set(E,[[g,b]])}),d.forEach(function(g,b){var w=0;function E(){++w<g.length?v():h()}o(E,"docWritten");function v(){var S=g[w],T=S[0],x=S[1];if(n.has(b))exe(e,n.get(b),T,s,x,E,a,f);else{var O=Os.merge([],T.metadata.rev_tree[0],e);T.metadata.rev_tree=O.tree,T.stemmedRevs=O.stemmedRevs||[],l(T,x,E)}}o(v,"nextDoc"),v()})}o(Ljt,"processDocs");lu.invalidIdError=Dg.invalidIdError;lu.normalizeDdocFunctionName=Dg.normalizeDdocFunctionName;lu.parseDdocFunctionName=Dg.parseDdocFunctionName;lu.isDeleted=Os.isDeleted;lu.isLocalId=Os.isLocalId;lu.allDocsKeysQuery=Ajt;lu.parseDoc=ZOe;lu.preprocessAttachments=kjt;lu.processDocs=Ljt;lu.updateDoc=exe});var rxe=R(zK=>{"use strict";zK.stringify=o(function(t){var r=[];r.push({obj:t});for(var n="",i,s,a,u,c,l,f,d,p,m,h;i=r.pop();)if(s=i.obj,a=i.prefix||"",u=i.val||"",n+=a,u)n+=u;else if(typeof s!="object")n+=typeof s>"u"?null:JSON.stringify(s);else if(s===null)n+="null";else if(Array.isArray(s)){for(r.push({val:"]"}),c=s.length-1;c>=0;c--)l=c===0?"":",",r.push({obj:s[c],prefix:l});r.push({val:"["})}else{f=[];for(d in s)s.hasOwnProperty(d)&&f.push(d);for(r.push({val:"}"}),c=f.length-1;c>=0;c--)p=f[c],m=s[p],h=c>0?",":"",h+=JSON.stringify(p)+":",r.push({obj:m,prefix:h});r.push({val:"{"})}return n},"stringify");function yw(e,t,r){var n=r[r.length-1];e===n.element&&(r.pop(),n=r[r.length-1]);var i=n.element,s=n.index;if(Array.isArray(i))i.push(e);else if(s===t.length-2){var a=t.pop();i[a]=e}else t.push(e)}o(yw,"pop");zK.parse=function(e){for(var t=[],r=[],n=0,i,s,a,u,c,l,f,d,p;;){if(i=e[n++],i==="}"||i==="]"||typeof i>"u"){if(t.length===1)return t.pop();yw(t.pop(),t,r);continue}switch(i){case" ":case" ":case`
6
6
  `:case":":case",":break;case"n":n+=3,yw(null,t,r);break;case"t":n+=3,yw(!0,t,r);break;case"f":n+=4,yw(!1,t,r);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(s="",n--;;)if(a=e[n++],/[\d\.\-e\+]/.test(a))s+=a;else{n--;break}yw(parseFloat(s),t,r);break;case'"':for(u="",c=void 0,l=0;f=e[n++],f!=='"'||c==="\\"&&l%2===1;)u+=f,c=f,c==="\\"?l++:l=0;yw(JSON.parse('"'+u+'"'),t,r);break;case"[":d={element:[],index:t.length},t.push(d.element),r.push(d);break;case"{":p={element:{},index:t.length},t.push(p.element),r.push(p);break;default:throw new Error("unexpectedly reached end of input: "+i)}}}});var ixe=R(IN=>{"use strict";Object.defineProperty(IN,"__esModule",{value:!0});function Ujt(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(Ujt,"_interopDefault");var nxe=Ujt(rxe());function Mjt(e){try{return JSON.parse(e)}catch{return nxe.parse(e)}}o(Mjt,"safeJsonParse");function Fjt(e){try{return JSON.stringify(e)}catch{return nxe.stringify(e)}}o(Fjt,"safeJsonStringify");IN.safeJsonParse=Mjt;IN.safeJsonStringify=Fjt});var gxe=R(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});function ON(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(ON,"_interopDefault");var Bjt=ON(Kk()),XK=ON($A()),qjt=Z_(),Wjt=ON(jt()),Jp=ew(),xN=ON(require("events")),uxe=require("uuid"),jjt=tw();function $jt(e){return e instanceof Buffer}o($jt,"isBinaryObject");var cxe=Function.prototype.toString,Vjt=cxe.call(Object);function Gjt(e){var t=Object.getPrototypeOf(e);if(t===null)return!0;var r=t.constructor;return typeof r=="function"&&r instanceof r&&cxe.call(r)==Vjt}o(Gjt,"isPlainObject");function dR(e){var t,r,n;if(!e||typeof e!="object")return e;if(Array.isArray(e)){for(t=[],r=0,n=e.length;r<n;r++)t[r]=dR(e[r]);return t}if(e instanceof Date)return e.toISOString();if($jt(e))return Bjt(e);if(!Gjt(e))return e;t={};for(r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=dR(e[r]);typeof i<"u"&&(t[r]=i)}return t}o(dR,"clone");function lxe(e){var t=!1;return XK(function(r){if(t)throw new Error("once called more than once");t=!0,e.apply(this,r)})}o(lxe,"once");function fxe(e){return XK(function(t){t=dR(t);var r=this,n=typeof t[t.length-1]=="function"?t.pop():!1,i=new Promise(function(s,a){var u;try{var c=lxe(function(l,f){l?a(l):s(f)});t.push(c),u=e.apply(r,t),u&&typeof u.then=="function"&&s(u)}catch(l){a(l)}});return n&&i.then(function(s){n(null,s)},n),i})}o(fxe,"toPromise");function Hjt(e,t,r){if(e.constructor.listeners("debug").length){for(var n=["api",e.name,t],i=0;i<r.length-1;i++)n.push(r[i]);e.constructor.emit("debug",n);var s=r[r.length-1];r[r.length-1]=function(a,u){var c=["api",e.name,t];c=c.concat(a?["error",a]:["success",u]),e.constructor.emit("debug",c),s(a,u)}}}o(Hjt,"logApiCall");function Kjt(e,t){return fxe(XK(function(r){if(this._closed)return Promise.reject(new Error("database is closed"));if(this._destroyed)return Promise.reject(new Error("database is destroyed"));var n=this;return Hjt(n,e,r),this.taskqueue.isReady?t.apply(this,r):new Promise(function(i,s){n.taskqueue.addTask(function(a){a?s(a):i(n[e].apply(n,r))})})}))}o(Kjt,"adapterFun");function ZK(e,t){for(var r={},n=0,i=t.length;n<i;n++){var s=t[n];s in e&&(r[s]=e[s])}return r}o(ZK,"pick");var Qjt=6;function oxe(e){return e}o(oxe,"identityFunction");function zjt(e){return[{ok:e}]}o(zjt,"formatResultForOpenRevsGet");function Yjt(e,t,r){var n=t.docs,i=new qjt.Map;n.forEach(function(g){i.has(g.id)?i.get(g.id).push(g):i.set(g.id,[g])});var s=i.size,a=0,u=new Array(s);function c(){var g=[];u.forEach(function(b){b.docs.forEach(function(w){g.push({id:b.id,docs:[w]})})}),r(null,{results:g})}o(c,"collapseResultsAndFinish");function l(){++a===s&&c()}o(l,"checkDone");function f(g,b,w){u[g]={id:b,docs:w},l()}o(f,"gotResult");var d=[];i.forEach(function(g,b){d.push(b)});var p=0;function m(){if(!(p>=d.length)){var g=Math.min(p+Qjt,d.length),b=d.slice(p,g);h(b,p),p+=b.length}}o(m,"nextBatch");function h(g,b){g.forEach(function(w,E){var v=b+E,S=i.get(w),T=ZK(S[0],["atts_since","attachments"]);T.open_revs=S.map(function(O){return O.rev}),T.open_revs=T.open_revs.filter(oxe);var x=oxe;T.open_revs.length===0&&(delete T.open_revs,x=zjt),["revs","attachments","binary","ajax","latest"].forEach(function(O){O in t&&(T[O]=t[O])}),e.get(w,T,function(O,C){var D;O?D=[{error:O}]:D=x(C),f(v,w,D),m()})})}o(h,"processBatch"),m()}o(Yjt,"bulkGet");function eQ(){return!1}o(eQ,"hasLocalStorage");function dxe(e){process.nextTick(e)}o(dxe,"nextTick");Wjt(bw,xN);function Jjt(e){eQ()&&addEventListener("storage",function(t){e.emit(t.key)})}o(Jjt,"attachBrowserEvents");function bw(){xN.call(this),this._listeners={},Jjt(this)}o(bw,"Changes");bw.prototype.addListener=function(e,t,r,n){if(this._listeners[t])return;var i=this,s=!1;function a(){if(!i._listeners[t])return;if(s){s="waiting";return}s=!0;var u=ZK(n,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary","return_docs"]);function c(){s=!1}o(c,"onError"),r.changes(u).on("change",function(l){l.seq>n.since&&!n.cancelled&&(n.since=l.seq,n.onChange(l))}).on("complete",function(){s==="waiting"&&dxe(a),s=!1}).on("error",c)}o(a,"eventFunction"),this._listeners[t]=a,this.on(e,a)};bw.prototype.removeListener=function(e,t){t in this._listeners&&(xN.prototype.removeListener.call(this,e,this._listeners[t]),delete this._listeners[t])};bw.prototype.notifyLocalWindows=function(e){eQ()&&(localStorage[e]=localStorage[e]==="a"?"b":"a")};bw.prototype.notify=function(e){this.emit(e),this.notifyLocalWindows(e)};function pxe(e){if(typeof console<"u"&&typeof console[e]=="function"){var t=Array.prototype.slice.call(arguments,1);console[e].apply(console,t)}}o(pxe,"guardedConsole");function Xjt(e,t){var r=6e5;e=parseInt(e,10)||0,t=parseInt(t,10),t!==t||t<=e?t=(e||1)<<1:t=t+1,t>r&&(e=r>>1,t=r);var n=Math.random(),i=t-e;return~~(i*n+e)}o(Xjt,"randomNumber");function Zjt(e){var t=0;return e||(t=2e3),Xjt(e,t)}o(Zjt,"defaultBackOff");var e$t=o(function(){},"res"),YK;typeof Object.assign=="function"?YK=Object.assign:YK=o(function(e){for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(n!=null)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},"assign");var t$t=YK;function r$t(e,t,r){try{return!e(t,r)}catch(i){var n="Filter function threw: "+i.toString();return Jp.createError(Jp.BAD_REQUEST,n)}}o(r$t,"tryFilter");function n$t(e){var t={},r=e.filter&&typeof e.filter=="function";return t.query=e.query_params,o(function(i){i.doc||(i.doc={});var s=r&&r$t(e.filter,i.doc,t);if(typeof s=="object")return s;if(s)return!1;if(!e.include_docs)delete i.doc;else if(!e.attachments)for(var a in i.doc._attachments)i.doc._attachments.hasOwnProperty(a)&&(i.doc._attachments[a].stub=!0);return!0},"filter")}o(n$t,"filterChange");function i$t(e){for(var t=[],r=0,n=e.length;r<n;r++)t=t.concat(e[r]);return t}o(i$t,"flatten");function o$t(){}o(o$t,"f");var s$t=o$t.name,JK;s$t?JK=o(function(e){return e.name},"res$1"):JK=o(function(e){var t=e.toString().match(/^\s*function\s*(?:(\S+)\s*)?\(/);return t&&t[1]?t[1]:""},"res$1");var a$t=JK;function u$t(e){var t;if(e?typeof e!="string"?t=Jp.createError(Jp.INVALID_ID):/^_/.test(e)&&!/^_(design|local)/.test(e)&&(t=Jp.createError(Jp.RESERVED_ID)):t=Jp.createError(Jp.MISSING_ID),t)throw t}o(u$t,"invalidIdError");function c$t(e){return typeof e._remote=="boolean"?e._remote:typeof e.type=="function"?(pxe("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),e.type()==="http"):!1}o(c$t,"isRemote");function l$t(e,t){return"listenerCount"in e?e.listenerCount(t):xN.listenerCount(e,t)}o(l$t,"listenerCount");function mxe(e){if(!e)return null;var t=e.split("/");return t.length===2?t:t.length===1?[e,e]:null}o(mxe,"parseDesignDocFunctionName");function f$t(e){var t=mxe(e);return t?t.join("/"):null}o(f$t,"normalizeDesignDocFunctionName");var sxe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],axe="queryKey",d$t=/(?:^|&)([^&=]*)=?([^&]*)/g,p$t=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function m$t(e){for(var t=p$t.exec(e),r={},n=14;n--;){var i=sxe[n],s=t[n]||"",a=["user","password"].indexOf(i)!==-1;r[i]=a?decodeURIComponent(s):s}return r[axe]={},r[sxe[12]].replace(d$t,function(u,c,l){c&&(r[axe][c]=l)}),r}o(m$t,"parseUri");function h$t(e,t){var r=[],n=[];for(var i in t)t.hasOwnProperty(i)&&(r.push(i),n.push(t[i]));return r.push(e),Function.apply(null,r).apply(null,n)}o(h$t,"scopeEval");function hxe(e,t,r){return new Promise(function(n,i){e.get(t,function(s,a){if(s){if(s.status!==404)return i(s);a={}}var u=a._rev,c=r(a);if(!c)return n({updated:!1,rev:u});c._id=t,c._rev=u,n(g$t(e,c,r))})})}o(hxe,"upsert");function g$t(e,t,r){return e.put(t).then(function(n){return{updated:!0,rev:n.rev}},function(n){if(n.status!==409)throw n;return hxe(e,t._id,r)})}o(g$t,"tryAndPut");function y$t(e,t){var r=dR(e);return t?(delete r._rev_tree,jjt.stringMd5(JSON.stringify(r))):uxe.v4().replace(/-/g,"").toLowerCase()}o(y$t,"rev");var b$t=uxe.v4;Dr.adapterFun=Kjt;Dr.assign=t$t;Dr.bulkGetShim=Yjt;Dr.changesHandler=bw;Dr.clone=dR;Dr.defaultBackOff=Zjt;Dr.explainError=e$t;Dr.filterChange=n$t;Dr.flatten=i$t;Dr.functionName=a$t;Dr.guardedConsole=pxe;Dr.hasLocalStorage=eQ;Dr.invalidIdError=u$t;Dr.isRemote=c$t;Dr.listenerCount=l$t;Dr.nextTick=dxe;Dr.normalizeDdocFunctionName=f$t;Dr.once=lxe;Dr.parseDdocFunctionName=mxe;Dr.parseUri=m$t;Dr.pick=ZK;Dr.rev=y$t;Dr.scopeEval=h$t;Dr.toPromise=fxe;Dr.upsert=hxe;Dr.uuid=b$t});var Rxe=R((fan,Axe)=>{"use strict";function gR(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(gR,"_interopDefault");var _$t=gR(UIe()),w$t=gR(wOe()),yxe=SOe(),CN=gR($A()),E$t=gR(IOe()),v$t=gR(xOe()),Pg=txe(),hR=QK(),bxe=ixe(),S$t=tw(),nQ=HK(),pc=Z_(),Kn=gxe(),hn=ew();function Sxe(e,t){return e.type=t,e}o(Sxe,"readAsBlobOrBuffer");function T$t(e,t){t(e)}o(T$t,"prepareAttachmentForStorage");function A$t(e){return nQ.typedBuffer("","binary",e)}o(A$t,"createEmptyBlobOrBuffer");function Txe(e,t){var r=t.prefix()[0],n=e._cache,i=n.get(r);return i||(i=new pc.Map,n.set(r,i)),i}o(Txe,"getCacheFor");function kg(){this._batch=[],this._cache=new pc.Map}o(kg,"LevelTransaction");kg.prototype.get=function(e,t,r){var n=Txe(this,e),i=n.get(t);if(i)return Kn.nextTick(function(){r(null,i)});if(i===null)return Kn.nextTick(function(){r({name:"NotFoundError"})});e.get(t,function(s,a){if(s)return s.name==="NotFoundError"&&n.set(t,null),r(s);n.set(t,a),r(null,a)})};kg.prototype.batch=function(e){for(var t=0,r=e.length;t<r;t++){var n=e[t],i=Txe(this,n.prefix);n.type==="put"?i.set(n.key,n.value):i.set(n.key,null)}this._batch=this._batch.concat(e)};kg.prototype.execute=function(e,t){for(var r=new pc.Set,n=[],i=this._batch.length-1;i>=0;i--){var s=this._batch[i],a=s.prefix.prefix()[0]+"\xFF"+s.key;r.has(a)||(r.add(a),n.push(s))}e.batch(n,t)};var R$t="document-store",I$t="by-sequence",O$t="attach-store",x$t="attach-binary-store",C$t="local-store",D$t="meta-store",pR=new pc.Map,_xe="_local_last_update_seq",wxe="_local_doc_count",Exe="_local_uuid",P$t="md5-",k$t={encode:bxe.safeJsonStringify,decode:bxe.safeJsonParse,buffer:!1,type:"cheap-json"},mR=new Kn.changesHandler;function tQ(e){return"winningRev"in e?e.winningRev:hR.winningRev(e)}o(tQ,"getWinningRev");function vxe(e,t){return"deleted"in e?e.deleted:Pg.isDeleted(e,t)}o(vxe,"getIsDeleted");function N$t(e,t,r){var n=e.content_type;return new Promise(function(i,s){t.binaryStore.get(e.digest,function(a,u){var c;if(a){if(a.name!=="NotFoundError")return s(a);r.binary?c=nQ.binaryStringToBlobOrBuffer("",n):c=""}else r.binary?c=Sxe(u,n):c=u.toString("base64");delete e.stub,delete e.length,e.data=c,i()})})}o(N$t,"fetchAttachment");function rQ(e,t,r){var n=[];return e.forEach(function(i){if(i.doc&&i.doc._attachments){var s=Object.keys(i.doc._attachments);s.forEach(function(a){var u=i.doc._attachments[a];"data"in u||n.push(u)})}}),Promise.all(n.map(function(i){return N$t(i,t,r)}))}o(rQ,"fetchAttachments");function L$t(e,t){e=Kn.clone(e);var r=this,n,i={},s=e.revs_limit,a,u=e.name;typeof e.createIfMissing>"u"&&(e.createIfMissing=!0);var c=e.db,l,f=Kn.functionName(c);pR.has(f)?l=pR.get(f):(l=new pc.Map,pR.set(f,l)),l.has(u)?(a=l.get(u),d()):l.set(u,w$t(_$t(c(u),e,function(O){if(O)return l.delete(u),t(O);a=l.get(u),a._docCount=-1,a._queue=new E$t,typeof e.migrate=="object"?e.migrate.doMigrationOne(u,a,d):d()})));function d(){i.docStore=a.sublevel(R$t,{valueEncoding:k$t}),i.bySeqStore=a.sublevel(I$t,{valueEncoding:"json"}),i.attachmentStore=a.sublevel(O$t,{valueEncoding:"json"}),i.binaryStore=a.sublevel(x$t,{valueEncoding:"binary"}),i.localStore=a.sublevel(C$t,{valueEncoding:"json"}),i.metaStore=a.sublevel(D$t,{valueEncoding:"json"}),typeof e.migrate=="object"?e.migrate.doMigrationTwo(a,i,p):p()}o(d,"afterDBCreated");function p(){i.metaStore.get(_xe,function(O,C){typeof a._updateSeq>"u"&&(a._updateSeq=C||0),i.metaStore.get(wxe,function(D,N){a._docCount=D?0:N,i.metaStore.get(Exe,function(k,V){n=k?Kn.uuid():V,i.metaStore.put(Exe,n,function(){Kn.nextTick(function(){t(null,r)})})})})})}o(p,"afterLastMigration");function m(O){return a.isClosed()?O(new Error("database is closed")):O(null,a._docCount)}o(m,"countDocs"),r._remote=!1,r.type=function(){return"leveldb"},r._id=function(O){O(null,n)},r._info=function(O){var C={doc_count:a._docCount,update_seq:a._updateSeq,backend_adapter:Kn.functionName(c)};return Kn.nextTick(function(){O(null,C)})};function h(O,C){try{O.apply(null,C)}catch(D){C[C.length-1](D)}}o(h,"tryCode");function g(){var O=a._queue.peekFront();O.type==="read"?b(O):w(O)}o(g,"executeNext");function b(O){for(var C=[O],D=1,N=a._queue.get(D);typeof N<"u"&&N.type==="read";)C.push(N),D++,N=a._queue.get(D);var k=0;C.forEach(function(V){var L=V.args,Y=L[L.length-1];L[L.length-1]=CN(function(B){Y.apply(null,B),++k===C.length&&Kn.nextTick(function(){C.forEach(function(){a._queue.shift()}),a._queue.length&&g()})}),h(V.fun,L)})}o(b,"runReadOperation");function w(O){var C=O.args,D=C[C.length-1];C[C.length-1]=CN(function(N){D.apply(null,N),Kn.nextTick(function(){a._queue.shift(),a._queue.length&&g()})}),h(O.fun,C)}o(w,"runWriteOperation");function E(O){return CN(function(C){a._queue.push({fun:O,args:C,type:"write"}),a._queue.length===1&&Kn.nextTick(g)})}o(E,"writeLock");function v(O){return CN(function(C){a._queue.push({fun:O,args:C,type:"read"}),a._queue.length===1&&Kn.nextTick(g)})}o(v,"readLock");function S(O){return("0000000000000000"+O).slice(-16)}o(S,"formatSeq");function T(O){return parseInt(O,10)}o(T,"parseSeq"),r._get=v(function(O,C,D){C=Kn.clone(C),i.docStore.get(O,function(N,k){if(N||!k)return D(hn.createError(hn.MISSING_DOC,"missing"));var V;if(C.rev)V=C.latest?hR.latest(C.rev,k):C.rev;else{V=tQ(k);var L=vxe(k,V);if(L)return D(hn.createError(hn.MISSING_DOC,"deleted"))}var Y=k.rev_map[V];i.bySeqStore.get(S(Y),function(B,W){if(!W)return D(hn.createError(hn.MISSING_DOC));if("_id"in W&&W._id!==k.id)return D(new Error("wrong doc returned"));if(W._id=k.id,"_rev"in W){if(W._rev!==V)return D(new Error("wrong doc returned"))}else W._rev=V;return D(null,{doc:W,metadata:k})})})}),r._getAttachment=function(O,C,D,N,k){var V=D.digest,L=D.content_type;i.binaryStore.get(V,function(Y,B){if(Y)return Y.name!=="NotFoundError"?k(Y):k(null,N.binary?A$t(L):"");N.binary?k(null,Sxe(B,L)):k(null,B.toString("base64"))})},r._bulkDocs=E(function(O,C,D){var N=C.new_edits,k=new Array(O.docs.length),V=new pc.Map,L=new pc.Map,Y=new kg,B=0,W=a._updateSeq,te=O.docs,z=te.map(function(Z){if(Z._id&&Pg.isLocalId(Z._id))return Z;var Se=Pg.parseDoc(Z,N,r.__opts);return Se.metadata&&!Se.metadata.rev_map&&(Se.metadata.rev_map={}),Se}),H=z.filter(function(Z){return Z.error});if(H.length)return D(H[0]);function Pe(Z,Se){Y.get(i.attachmentStore,Z,function(Ge){if(Ge){var ot=hn.createError(hn.MISSING_STUB,"unknown stub attachment with digest "+Z);Se(ot)}else Se()})}o(Pe,"verifyAttachment");function xe(Z){var Se=[];if(te.forEach(function(ut){ut&&ut._attachments&&Object.keys(ut._attachments).forEach(function(jr){var ii=ut._attachments[jr];ii.stub&&Se.push(ii.digest)})}),!Se.length)return Z();var Ge=0,ot;Se.forEach(function(ut){Pe(ut,function(jr){jr&&!ot&&(ot=jr),++Ge===Se.length&&Z(ot)})})}o(xe,"verifyAttachments");function $e(Z){var Se=0,Ge;function ot(){if(++Se===te.length)return Z(Ge)}o(ot,"checkDone"),te.forEach(function(ut){if(ut._id&&Pg.isLocalId(ut._id))return ot();Y.get(i.docStore,ut._id,function(jr,ii){jr?jr.name!=="NotFoundError"&&(Ge=jr):V.set(ut._id,ii),ot()})})}o($e,"fetchExistingDocs");function K(Z,Se){var Ge=Promise.resolve();Z.forEach(function(ot,ut){Ge=Ge.then(function(){return new Promise(function(jr,ii){r._doCompactionNoLock(ut,ot,{ctx:Y},function(Vn){if(Vn)return ii(Vn);jr()})})})}),Ge.then(function(){Se()},Se)}o(K,"compact");function ie(Z){var Se=new pc.Map;V.forEach(function(Ge,ot){Se.set(ot,hR.compactTree(Ge))}),K(Se,Z)}o(ie,"autoCompact");function ae(){K(L,function(Z){if(Z&&pe(Z),r.auto_compaction)return ie(pe);pe()})}o(ae,"finish");function ue(Z,Se,Ge,ot,ut,jr,ii,Vn){B+=jr;var Xo=null,Li=0;Z.metadata.winningRev=Se,Z.metadata.deleted=Ge,Z.data._id=Z.metadata.id,Z.data._rev=Z.metadata.rev,ot&&(Z.data._deleted=!0),Z.stemmedRevs.length&&L.set(Z.metadata.id,Z.stemmedRevs);var Za=Z.data._attachments?Object.keys(Z.data._attachments):[];function PT(Be){Li++,Xo||(Be?(Xo=Be,Vn(Xo)):Li===Za.length&&ye())}o(PT,"attachmentSaved");function kT(Be,Ot,lr,ct){return function($r){de(Be,P$t+$r,Ot,lr,ct)}}o(kT,"onMD5Load");function RP(Be,Ot,lr){return function(ct){S$t.binaryMd5(ct,kT(Be,Ot,ct,lr))}}o(RP,"doMD5");for(var ec=0;ec<Za.length;ec++){var v_=Za[ec],vr=Z.data._attachments[v_];if(vr.stub){var J=Z.data._id,re=Z.data._rev;Ae(J,re,vr.digest,PT);continue}var be;if(typeof vr.data=="string"){try{be=nQ.atob(vr.data)}catch{D(hn.createError(hn.BAD_ARG,"Attachment is not a valid base64 string"));return}RP(Z,v_,PT)(be)}else T$t(vr.data,RP(Z,v_,PT))}function ye(){var Be=Z.metadata.rev_map[Z.metadata.rev];if(Be)return Vn();Be=++W,Z.metadata.rev_map[Z.metadata.rev]=Z.metadata.seq=Be;var Ot=S(Be),lr=[{key:Ot,value:Z.data,prefix:i.bySeqStore,type:"put"},{key:Z.metadata.id,value:Z.metadata,prefix:i.docStore,type:"put"}];Y.batch(lr),k[ii]={ok:!0,id:Z.metadata.id,rev:Z.metadata.rev},V.set(Z.metadata.id,Z.metadata),Vn()}o(ye,"finish"),Za.length||ye()}o(ue,"writeDoc");var ve={};function Ae(Z,Se,Ge,ot){function ut(){return new Promise(function(Vn,Xo){Y.get(i.attachmentStore,Ge,function(Li,Za){if(Li&&Li.name!=="NotFoundError")return Xo(Li);Vn(Za)})})}o(ut,"fetchAtt");function jr(Vn){var Xo=[Z,Se].join("@"),Li={};return Vn?Vn.refs&&(Li.refs=Vn.refs,Li.refs[Xo]=!0):(Li.refs={},Li.refs[Xo]=!0),new Promise(function(Za){Y.batch([{type:"put",prefix:i.attachmentStore,key:Ge,value:Li}]),Za(!Vn)})}o(jr,"saveAtt");var ii=ve[Ge]||Promise.resolve();ve[Ge]=ii.then(function(){return ut().then(jr).then(function(Vn){ot(null,Vn)},ot)})}o(Ae,"saveAttachmentRefs");function de(Z,Se,Ge,ot,ut){var jr=Z.data._attachments[Ge];delete jr.data,jr.digest=Se,jr.length=ot.length;var ii=Z.metadata.id,Vn=Z.metadata.rev;jr.revpos=parseInt(Vn,10),Ae(ii,Vn,Se,function(Xo,Li){if(Xo||ot.length===0||!Li)return ut(Xo);Y.batch([{type:"put",prefix:i.binaryStore,key:Se,value:v$t(ot,"binary")}]),ut()})}o(de,"saveAttachment");function pe(Z){if(Z)return Kn.nextTick(function(){D(Z)});Y.batch([{prefix:i.metaStore,type:"put",key:_xe,value:W},{prefix:i.metaStore,type:"put",key:wxe,value:a._docCount+B}]),Y.execute(a,function(Se){if(Se)return D(Se);a._docCount+=B,a._updateSeq=W,mR.notify(u),Kn.nextTick(function(){D(null,k)})})}if(o(pe,"complete"),!z.length)return D(null,[]);xe(function(Z){if(Z)return D(Z);$e(function(Se){if(Se)return D(Se);Pg.processDocs(s,z,r,V,Y,k,ue,C,ae)})})}),r._allDocs=function(O,C){return"keys"in O?Pg.allDocsKeysQuery(this,O):v(function(D,N){D=Kn.clone(D),m(function(k,V){if(k)return N(k);var L={},Y=D.skip||0;if(D.startkey&&(L.gte=D.startkey),D.endkey&&(L.lte=D.endkey),D.key&&(L.gte=L.lte=D.key),D.descending){L.reverse=!0;var B=L.lte;L.lte=L.gte,L.gte=B}var W;if(typeof D.limit=="number"&&(W=D.limit),W===0||"gte"in L&&"lte"in L&&L.gte>L.lte){var te={total_rows:V,offset:D.skip,rows:[]};return D.update_seq&&(te.update_seq=a._updateSeq),N(null,te)}var z=[],H=i.docStore.readStream(L),Pe=yxe.obj(function(xe,$e,K){var ie=xe.value,ae=tQ(ie),ue=vxe(ie,ae);if(ue){if(D.deleted!=="ok"){K();return}}else if(Y-- >0){K();return}else if(typeof W=="number"&&W--<=0){H.unpipe(),H.destroy(),K();return}function ve(de){var pe={id:ie.id,key:ie.id,value:{rev:ae}};if(D.include_docs){if(pe.doc=de,pe.doc._rev=pe.value.rev,D.conflicts){var Z=hR.collectConflicts(ie);Z.length&&(pe.doc._conflicts=Z)}for(var Se in pe.doc._attachments)pe.doc._attachments.hasOwnProperty(Se)&&(pe.doc._attachments[Se].stub=!0)}if(D.inclusive_end===!1&&ie.id===D.endkey)return K();if(ue)if(D.deleted==="ok")pe.value.deleted=!0,pe.doc=null;else return K();z.push(pe),K()}if(o(ve,"allDocsInner"),D.include_docs){var Ae=ie.rev_map[ae];i.bySeqStore.get(S(Ae),function(de,pe){ve(pe)})}else ve()},function(xe){Promise.resolve().then(function(){if(D.include_docs&&D.attachments)return rQ(z,i,D)}).then(function(){var $e={total_rows:V,offset:D.skip,rows:z};D.update_seq&&($e.update_seq=a._updateSeq),N(null,$e)},N),xe()}).on("unpipe",function(){Pe.end()});H.on("error",N),H.pipe(Pe)})})(O,C)},r._changes=function(O){if(O=Kn.clone(O),O.continuous){var C=u+":"+Kn.uuid();return mR.addListener(u,C,r,O),mR.notify(u),{cancel:function(){mR.removeListener(u,C)}}}var D=O.descending,N=[],k=O.since||0,V=0,L={reverse:D},Y;"limit"in O&&O.limit>0&&(Y=O.limit),L.reverse||(L.start=S(O.since||0));var B=O.doc_ids&&new pc.Set(O.doc_ids),W=Kn.filterChange(O),te=new pc.Map;function z(){O.done=!0,O.return_docs&&O.limit&&O.limit<N.length&&(N.length=O.limit),H.unpipe(Pe),H.destroy(),!O.continuous&&!O.cancelled&&(O.include_docs&&O.attachments&&O.return_docs?rQ(N,i,O).then(function(){O.complete(null,{results:N,last_seq:k})}):O.complete(null,{results:N,last_seq:k}))}o(z,"complete");var H=i.bySeqStore.readStream(L),Pe=yxe.obj(function(xe,$e,K){if(Y&&V>=Y)return z(),K();if(O.cancelled||O.done)return K();var ie=T(xe.key),ae=xe.value;if(ie===O.since&&!D||B&&!B.has(ae._id))return K();var ue;function ve(Ae){var de=tQ(Ae);function pe(Se){var Ge=O.processChange(Se,Ae,O);Ge.seq=Ae.seq;var ot=W(Ge);if(typeof ot=="object")return O.complete(ot);ot&&(V++,O.attachments&&O.include_docs?rQ([Ge],i,O).then(function(){O.onChange(Ge)}):O.onChange(Ge),O.return_docs&&N.push(Ge)),K()}if(o(pe,"onGetWinningDoc"),Ae.seq!==ie)return K();if(k=ie,de===ae._rev)return pe(ae);var Z=Ae.rev_map[de];i.bySeqStore.get(S(Z),function(Se,Ge){pe(Ge)})}if(o(ve,"onGetMetadata"),ue=te.get(ae._id),ue)return ve(ue);i.docStore.get(ae._id,function(Ae,de){if(O.cancelled||O.done||a.isClosed()||Pg.isLocalId(de.id))return K();te.set(ae._id,de),ve(de)})},function(xe){if(O.cancelled)return xe();O.return_docs&&O.limit&&O.limit<N.length&&(N.length=O.limit),xe()}).on("unpipe",function(){Pe.end(),z()});return H.pipe(Pe),{cancel:function(){O.cancelled=!0,z()}}},r._close=function(O){if(a.isClosed())return O(hn.createError(hn.NOT_OPEN));a.close(function(C){C?O(C):(l.delete(u),O())})},r._getRevisionTree=function(O,C){i.docStore.get(O,function(D,N){D?C(hn.createError(hn.MISSING_DOC)):C(null,N.rev_tree)})},r._doCompaction=E(function(O,C,D,N){r._doCompactionNoLock(O,C,D,N)}),r._doCompactionNoLock=function(O,C,D,N){if(typeof D=="function"&&(N=D,D={}),!C.length)return N();var k=D.ctx||new kg;k.get(i.docStore,O,function(V,L){if(V)return N(V);var Y=C.map(function($e){var K=L.rev_map[$e];return delete L.rev_map[$e],K});hR.traverseRevTree(L.rev_tree,function($e,K,ie,ae,ue){var ve=K+"-"+ie;C.indexOf(ve)!==-1&&(ue.status="missing")});var B=[];B.push({key:L.id,value:L,type:"put",prefix:i.docStore});var W={},te=0,z;function H($e){if($e&&(z=$e),++te===C.length){if(z)return N(z);xe()}}o(H,"checkDone");function Pe($e){if($e)return N($e);if(k.batch(B),D.ctx)return N();k.execute(a,N)}o(Pe,"finish");function xe(){var $e=Object.keys(W);if(!$e.length)return Pe();var K=0,ie;function ae(ve){ve&&(ie=ve),++K===$e.length&&Pe(ie)}o(ae,"checkDone");var ue=new pc.Map;C.forEach(function(ve){ue.set(O+"@"+ve,!0)}),$e.forEach(function(ve){k.get(i.attachmentStore,ve,function(Ae,de){if(Ae)return Ae.name==="NotFoundError"?ae():ae(Ae);var pe=Object.keys(de.refs||{}).filter(function(Se){return!ue.has(Se)}),Z={};pe.forEach(function(Se){Z[Se]=!0}),pe.length?B.push({key:ve,type:"put",value:{refs:Z},prefix:i.attachmentStore}):B=B.concat([{key:ve,type:"del",prefix:i.attachmentStore},{key:ve,type:"del",prefix:i.binaryStore}]),ae()})})}o(xe,"deleteOrphanedAttachments"),Y.forEach(function($e){B.push({key:S($e),type:"del",prefix:i.bySeqStore}),k.get(i.bySeqStore,S($e),function(K,ie){if(K)return K.name==="NotFoundError"?H():H(K);var ae=Object.keys(ie._attachments||{});ae.forEach(function(ue){var ve=ie._attachments[ue].digest;W[ve]=!0}),H()})})})},r._getLocal=function(O,C){i.localStore.get(O,function(D,N){D?C(hn.createError(hn.MISSING_DOC)):C(null,N)})},r._putLocal=function(O,C,D){typeof C=="function"&&(D=C,C={}),C.ctx?r._putLocalNoLock(O,C,D):r._putLocalWithLock(O,C,D)},r._putLocalWithLock=E(function(O,C,D){r._putLocalNoLock(O,C,D)}),r._putLocalNoLock=function(O,C,D){delete O._revisions;var N=O._rev,k=O._id,V=C.ctx||new kg;V.get(i.localStore,k,function(L,Y){if(L&&N||Y&&Y._rev!==N)return D(hn.createError(hn.REV_CONFLICT));O._rev=N?"0-"+(parseInt(N.split("-")[1],10)+1):"0-1";var B=[{type:"put",prefix:i.localStore,key:k,value:O}];V.batch(B);var W={ok:!0,id:O._id,rev:O._rev};if(C.ctx)return D(null,W);V.execute(a,function(te){if(te)return D(te);D(null,W)})})},r._removeLocal=function(O,C,D){typeof C=="function"&&(D=C,C={}),C.ctx?r._removeLocalNoLock(O,C,D):r._removeLocalWithLock(O,C,D)},r._removeLocalWithLock=E(function(O,C,D){r._removeLocalNoLock(O,C,D)}),r._removeLocalNoLock=function(O,C,D){var N=C.ctx||new kg;N.get(i.localStore,O._id,function(k,V){if(k)return k.name!=="NotFoundError"?D(k):D(hn.createError(hn.MISSING_DOC));if(V._rev!==O._rev)return D(hn.createError(hn.REV_CONFLICT));N.batch([{prefix:i.localStore,type:"del",key:O._id}]);var L={ok:!0,id:O._id,rev:"0-0"};if(C.ctx)return D(null,L);N.execute(a,function(Y){if(Y)return D(Y);D(null,L)})})},r._destroy=function(O,C){var D,N=Kn.functionName(c);if(pR.has(N))D=pR.get(N);else return x(u,C);D.has(u)?(mR.removeAllListeners(u),D.get(u).close(function(){D.delete(u),x(u,C)})):x(u,C)};function x(O,C){"destroy"in c?c.destroy(O,C):C(null)}o(x,"callDestroy")}o(L$t,"LevelPouch");Axe.exports=L$t});var oQ=R((pan,Ixe)=>{"use strict";function iQ(e){this.db=e,this._ended=!1,this._nexting=!1}o(iQ,"AbstractIterator");iQ.prototype.next=function(e){var t=this;if(typeof e!="function")throw new Error("next() requires a callback argument");if(t._ended)return e(new Error("cannot call next() after end()"));if(t._nexting)return e(new Error("cannot call next() before previous next() has completed"));if(t._nexting=!0,typeof t._next=="function")return t._next(function(){t._nexting=!1,e.apply(null,arguments)});process.nextTick(function(){t._nexting=!1,e()})};iQ.prototype.end=function(e){if(typeof e!="function")throw new Error("end() requires a callback argument");if(this._ended)return e(new Error("end() already called on iterator"));if(this._ended=!0,typeof this._end=="function")return this._end(e);process.nextTick(e)};Ixe.exports=iQ});var sQ=R((han,Oxe)=>{"use strict";function Xp(e){this._db=e,this._operations=[],this._written=!1}o(Xp,"AbstractChainedBatch");Xp.prototype._serializeKey=function(e){return this._db._serializeKey(e)};Xp.prototype._serializeValue=function(e){return this._db._serializeValue(e)};Xp.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")};Xp.prototype.put=function(e,t){this._checkWritten();var r=this._db._checkKey(e,"key",this._db._isBuffer);if(r)throw r;return e=this._serializeKey(e),t=this._serializeValue(t),typeof this._put=="function"?this._put(e,t):this._operations.push({type:"put",key:e,value:t}),this};Xp.prototype.del=function(e){this._checkWritten();var t=this._db._checkKey(e,"key",this._db._isBuffer);if(t)throw t;return e=this._serializeKey(e),typeof this._del=="function"?this._del(e):this._operations.push({type:"del",key:e}),this};Xp.prototype.clear=function(){return this._checkWritten(),this._operations=[],typeof this._clear=="function"&&this._clear(),this};Xp.prototype.write=function(e,t){if(this._checkWritten(),typeof e=="function"&&(t=e),typeof t!="function")throw new Error("write() requires a callback argument");if(typeof e!="object"&&(e={}),this._written=!0,typeof this._write=="function")return this._write(t);if(typeof this._db._batch=="function")return this._db._batch(this._operations,e,t);process.nextTick(t)};Oxe.exports=Xp});var aQ=R((yan,xxe)=>{"use strict";var U$t=wg(),M$t=oQ(),F$t=sQ();function ts(e){if(!arguments.length||e===void 0)throw new Error("constructor requires at least a location argument");if(typeof e!="string")throw new Error("constructor requires a location string argument");this.location=e,this.status="new"}o(ts,"AbstractLevelDOWN");ts.prototype.open=function(e,t){var r=this,n=this.status;if(typeof e=="function"&&(t=e),typeof t!="function")throw new Error("open() requires a callback argument");typeof e!="object"&&(e={}),e.createIfMissing=e.createIfMissing!=!1,e.errorIfExists=!!e.errorIfExists,typeof this._open=="function"?(this.status="opening",this._open(e,function(i){if(i)return r.status=n,t(i);r.status="open",t()})):(this.status="open",process.nextTick(t))};ts.prototype.close=function(e){var t=this,r=this.status;if(typeof e!="function")throw new Error("close() requires a callback argument");typeof this._close=="function"?(this.status="closing",this._close(function(n){if(n)return t.status=r,e(n);t.status="closed",e()})):(this.status="closed",process.nextTick(e))};ts.prototype.get=function(e,t,r){var n;if(typeof t=="function"&&(r=t),typeof r!="function")throw new Error("get() requires a callback argument");if(n=this._checkKey(e,"key"))return r(n);if(e=this._serializeKey(e),typeof t!="object"&&(t={}),t.asBuffer=t.asBuffer!=!1,typeof this._get=="function")return this._get(e,t,r);process.nextTick(function(){r(new Error("NotFound"))})};ts.prototype.put=function(e,t,r,n){var i;if(typeof r=="function"&&(n=r),typeof n!="function")throw new Error("put() requires a callback argument");if(i=this._checkKey(e,"key"))return n(i);if(e=this._serializeKey(e),t=this._serializeValue(t),typeof r!="object"&&(r={}),typeof this._put=="function")return this._put(e,t,r,n);process.nextTick(n)};ts.prototype.del=function(e,t,r){var n;if(typeof t=="function"&&(r=t),typeof r!="function")throw new Error("del() requires a callback argument");if(n=this._checkKey(e,"key"))return r(n);if(e=this._serializeKey(e),typeof t!="object"&&(t={}),typeof this._del=="function")return this._del(e,t,r);process.nextTick(r)};ts.prototype.batch=function(e,t,r){if(!arguments.length)return this._chainedBatch();if(typeof t=="function"&&(r=t),typeof e=="function"&&(r=e),typeof r!="function")throw new Error("batch(array) requires a callback argument");if(!Array.isArray(e))return r(new Error("batch(array) requires an array argument"));(!t||typeof t!="object")&&(t={});for(var n=0,i=e.length,s,a;n<i;n++)if(s=e[n],typeof s=="object"&&((a=this._checkKey(s.type,"type"))||(a=this._checkKey(s.key,"key"))))return r(a);if(typeof this._batch=="function")return this._batch(e,t,r);process.nextTick(r)};ts.prototype.approximateSize=function(e,t,r){if(e==null||t==null||typeof e=="function"||typeof t=="function")throw new Error("approximateSize() requires valid `start`, `end` and `callback` arguments");if(typeof r!="function")throw new Error("approximateSize() requires a callback argument");if(e=this._serializeKey(e),t=this._serializeKey(t),typeof this._approximateSize=="function")return this._approximateSize(e,t,r);process.nextTick(function(){r(null,0)})};ts.prototype._setupIteratorOptions=function(e){var t=this;return e=U$t(e),["start","end","gt","gte","lt","lte"].forEach(function(r){e[r]&&t._isBuffer(e[r])&&e[r].length===0&&delete e[r]}),e.reverse=!!e.reverse,e.keys=e.keys!=!1,e.values=e.values!=!1,e.limit="limit"in e?e.limit:-1,e.keyAsBuffer=e.keyAsBuffer!=!1,e.valueAsBuffer=e.valueAsBuffer!=!1,e};ts.prototype.iterator=function(e){return typeof e!="object"&&(e={}),e=this._setupIteratorOptions(e),typeof this._iterator=="function"?this._iterator(e):new M$t(this)};ts.prototype._chainedBatch=function(){return new F$t(this)};ts.prototype._isBuffer=function(e){return Buffer.isBuffer(e)};ts.prototype._serializeKey=function(e){return this._isBuffer(e)?e:String(e)};ts.prototype._serializeValue=function(e){return e==null?"":this._isBuffer(e)||process.browser?e:String(e)};ts.prototype._checkKey=function(e,t){if(e==null)return new Error(t+" cannot be `null` or `undefined`");if(this._isBuffer(e)&&e.length===0)return new Error(t+" cannot be an empty Buffer");if(String(e)==="")return new Error(t+" cannot be an empty String")};xxe.exports=ts});var Dxe=R((_an,Cxe)=>{"use strict";var B$t=aQ();function q$t(e){return!e||typeof e!="object"?!1:Object.keys(B$t.prototype).filter(function(t){return t[0]!="_"&&t!="approximateSize"}).every(function(t){return typeof e[t]=="function"})}o(q$t,"isLevelDOWN");Cxe.exports=q$t});var uQ=R(yR=>{"use strict";yR.AbstractLevelDOWN=aQ();yR.AbstractIterator=oQ();yR.AbstractChainedBatch=sQ();yR.isLevelDOWN=Dxe()});var Nxe=R((van,kxe)=>{"use strict";kxe.exports=$$t;var Gr=0,sr=1;function ba(e,t,r,n,i,s){this._color=e,this.key=t,this.value=r,this.left=n,this.right=i,this._count=s}o(ba,"RBNode");function gl(e){return new ba(e._color,e.key,e.value,e.left,e.right,e._count)}o(gl,"cloneNode");function Zp(e,t){return new ba(e,t.key,t.value,t.left,t.right,t._count)}o(Zp,"repaint");function gn(e){e._count=1+(e.left?e.left._count:0)+(e.right?e.right._count:0)}o(gn,"recount");function em(e,t){this._compare=e,this.root=t}o(em,"RedBlackTree");var rs=em.prototype;Object.defineProperty(rs,"keys",{get:function(){var e=[];return this.forEach(function(t,r){e.push(t)}),e}});Object.defineProperty(rs,"values",{get:function(){var e=[];return this.forEach(function(t,r){e.push(r)}),e}});Object.defineProperty(rs,"length",{get:function(){return this.root?this.root._count:0}});rs.insert=function(e,t){for(var r=this._compare,n=this.root,i=[],s=[];n;){var a=r(e,n.key);i.push(n),s.push(a),a<=0?n=n.left:n=n.right}i.push(new ba(Gr,e,t,null,null,1));for(var u=i.length-2;u>=0;--u){var n=i[u];s[u]<=0?i[u]=new ba(n._color,n.key,n.value,i[u+1],n.right,n._count+1):i[u]=new ba(n._color,n.key,n.value,n.left,i[u+1],n._count+1)}for(var u=i.length-1;u>1;--u){var c=i[u-1],n=i[u];if(c._color===sr||n._color===sr)break;var l=i[u-2];if(l.left===c)if(c.left===n){var f=l.right;if(f&&f._color===Gr)c._color=sr,l.right=Zp(sr,f),l._color=Gr,u-=1;else{if(l._color=Gr,l.left=c.right,c._color=sr,c.right=l,i[u-2]=c,i[u-1]=n,gn(l),gn(c),u>=3){var d=i[u-3];d.left===l?d.left=c:d.right=c}break}}else{var f=l.right;if(f&&f._color===Gr)c._color=sr,l.right=Zp(sr,f),l._color=Gr,u-=1;else{if(c.right=n.left,l._color=Gr,l.left=n.right,n._color=sr,n.left=c,n.right=l,i[u-2]=n,i[u-1]=c,gn(l),gn(c),gn(n),u>=3){var d=i[u-3];d.left===l?d.left=n:d.right=n}break}}else if(c.right===n){var f=l.left;if(f&&f._color===Gr)c._color=sr,l.left=Zp(sr,f),l._color=Gr,u-=1;else{if(l._color=Gr,l.right=c.left,c._color=sr,c.left=l,i[u-2]=c,i[u-1]=n,gn(l),gn(c),u>=3){var d=i[u-3];d.right===l?d.right=c:d.left=c}break}}else{var f=l.left;if(f&&f._color===Gr)c._color=sr,l.left=Zp(sr,f),l._color=Gr,u-=1;else{if(c.left=n.right,l._color=Gr,l.right=n.left,n._color=sr,n.right=c,n.left=l,i[u-2]=n,i[u-1]=c,gn(l),gn(c),gn(n),u>=3){var d=i[u-3];d.right===l?d.right=n:d.left=n}break}}}return i[0]._color=sr,new em(r,i[0])};function cQ(e,t){if(t.left){var r=cQ(e,t.left);if(r)return r}var r=e(t.key,t.value);if(r)return r;if(t.right)return cQ(e,t.right)}o(cQ,"doVisitFull");function lQ(e,t,r,n){var i=t(e,n.key);if(i<=0){if(n.left){var s=lQ(e,t,r,n.left);if(s)return s}var s=r(n.key,n.value);if(s)return s}if(n.right)return lQ(e,t,r,n.right)}o(lQ,"doVisitHalf");function fQ(e,t,r,n,i){var s=r(e,i.key),a=r(t,i.key),u;if(s<=0&&(i.left&&(u=fQ(e,t,r,n,i.left),u)||a>0&&(u=n(i.key,i.value),u)))return u;if(a>0&&i.right)return fQ(e,t,r,n,i.right)}o(fQ,"doVisit");rs.forEach=o(function(t,r,n){if(this.root)switch(arguments.length){case 1:return cQ(t,this.root);case 2:return lQ(r,this._compare,t,this.root);case 3:return this._compare(r,n)>=0?void 0:fQ(r,n,this._compare,t,this.root)}},"rbTreeForEach");Object.defineProperty(rs,"begin",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.left;return new _a(this,e)}});Object.defineProperty(rs,"end",{get:function(){for(var e=[],t=this.root;t;)e.push(t),t=t.right;return new _a(this,e)}});rs.at=function(e){if(e<0)return new _a(this,[]);for(var t=this.root,r=[];;){if(r.push(t),t.left){if(e<t.left._count){t=t.left;continue}e-=t.left._count}if(!e)return new _a(this,r);if(e-=1,t.right){if(e>=t.right._count)break;t=t.right}else break}return new _a(this,[])};rs.ge=function(e){for(var t=this._compare,r=this.root,n=[],i=0;r;){var s=t(e,r.key);n.push(r),s<=0&&(i=n.length),s<=0?r=r.left:r=r.right}return n.length=i,new _a(this,n)};rs.gt=function(e){for(var t=this._compare,r=this.root,n=[],i=0;r;){var s=t(e,r.key);n.push(r),s<0&&(i=n.length),s<0?r=r.left:r=r.right}return n.length=i,new _a(this,n)};rs.lt=function(e){for(var t=this._compare,r=this.root,n=[],i=0;r;){var s=t(e,r.key);n.push(r),s>0&&(i=n.length),s<=0?r=r.left:r=r.right}return n.length=i,new _a(this,n)};rs.le=function(e){for(var t=this._compare,r=this.root,n=[],i=0;r;){var s=t(e,r.key);n.push(r),s>=0&&(i=n.length),s<0?r=r.left:r=r.right}return n.length=i,new _a(this,n)};rs.find=function(e){for(var t=this._compare,r=this.root,n=[];r;){var i=t(e,r.key);if(n.push(r),i===0)return new _a(this,n);i<=0?r=r.left:r=r.right}return new _a(this,[])};rs.remove=function(e){var t=this.find(e);return t?t.remove():this};rs.get=function(e){for(var t=this._compare,r=this.root;r;){var n=t(e,r.key);if(n===0)return r.value;n<=0?r=r.left:r=r.right}};function _a(e,t){this.tree=e,this._stack=t}o(_a,"RedBlackTreeIterator");var fu=_a.prototype;Object.defineProperty(fu,"valid",{get:function(){return this._stack.length>0}});Object.defineProperty(fu,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0});fu.clone=function(){return new _a(this.tree,this._stack.slice())};function Pxe(e,t){e.key=t.key,e.value=t.value,e.left=t.left,e.right=t.right,e._color=t._color,e._count=t._count}o(Pxe,"swapNode");function W$t(e){for(var t,r,n,i,s=e.length-1;s>=0;--s){if(t=e[s],s===0){t._color=sr;return}if(r=e[s-1],r.left===t){if(n=r.right,n.right&&n.right._color===Gr){if(n=r.right=gl(n),i=n.right=gl(n.right),r.right=n.left,n.left=r,n.right=i,n._color=r._color,t._color=sr,r._color=sr,i._color=sr,gn(r),gn(n),s>1){var a=e[s-2];a.left===r?a.left=n:a.right=n}e[s-1]=n;return}else if(n.left&&n.left._color===Gr){if(n=r.right=gl(n),i=n.left=gl(n.left),r.right=i.left,n.left=i.right,i.left=r,i.right=n,i._color=r._color,r._color=sr,n._color=sr,t._color=sr,gn(r),gn(n),gn(i),s>1){var a=e[s-2];a.left===r?a.left=i:a.right=i}e[s-1]=i;return}if(n._color===sr)if(r._color===Gr){r._color=sr,r.right=Zp(Gr,n);return}else{r.right=Zp(Gr,n);continue}else{if(n=gl(n),r.right=n.left,n.left=r,n._color=r._color,r._color=Gr,gn(r),gn(n),s>1){var a=e[s-2];a.left===r?a.left=n:a.right=n}e[s-1]=n,e[s]=r,s+1<e.length?e[s+1]=t:e.push(t),s=s+2}}else{if(n=r.left,n.left&&n.left._color===Gr){if(n=r.left=gl(n),i=n.left=gl(n.left),r.left=n.right,n.right=r,n.left=i,n._color=r._color,t._color=sr,r._color=sr,i._color=sr,gn(r),gn(n),s>1){var a=e[s-2];a.right===r?a.right=n:a.left=n}e[s-1]=n;return}else if(n.right&&n.right._color===Gr){if(n=r.left=gl(n),i=n.right=gl(n.right),r.left=i.right,n.right=i.left,i.right=r,i.left=n,i._color=r._color,r._color=sr,n._color=sr,t._color=sr,gn(r),gn(n),gn(i),s>1){var a=e[s-2];a.right===r?a.right=i:a.left=i}e[s-1]=i;return}if(n._color===sr)if(r._color===Gr){r._color=sr,r.left=Zp(Gr,n);return}else{r.left=Zp(Gr,n);continue}else{if(n=gl(n),r.left=n.right,n.right=r,n._color=r._color,r._color=Gr,gn(r),gn(n),s>1){var a=e[s-2];a.right===r?a.right=n:a.left=n}e[s-1]=n,e[s]=r,s+1<e.length?e[s+1]=t:e.push(t),s=s+2}}}}o(W$t,"fixDoubleBlack");fu.remove=function(){var e=this._stack;if(e.length===0)return this.tree;var t=new Array(e.length),r=e[e.length-1];t[t.length-1]=new ba(r._color,r.key,r.value,r.left,r.right,r._count);for(var n=e.length-2;n>=0;--n){var r=e[n];r.left===e[n+1]?t[n]=new ba(r._color,r.key,r.value,t[n+1],r.right,r._count):t[n]=new ba(r._color,r.key,r.value,r.left,t[n+1],r._count)}if(r=t[t.length-1],r.left&&r.right){var i=t.length;for(r=r.left;r.right;)t.push(r),r=r.right;var s=t[i-1];t.push(new ba(r._color,s.key,s.value,r.left,r.right,r._count)),t[i-1].key=r.key,t[i-1].value=r.value;for(var n=t.length-2;n>=i;--n)r=t[n],t[n]=new ba(r._color,r.key,r.value,r.left,t[n+1],r._count);t[i-1].left=t[i]}if(r=t[t.length-1],r._color===Gr){var a=t[t.length-2];a.left===r?a.left=null:a.right===r&&(a.right=null),t.pop();for(var n=0;n<t.length;++n)t[n]._count--;return new em(this.tree._compare,t[0])}else if(r.left||r.right){r.left?Pxe(r,r.left):r.right&&Pxe(r,r.right),r._color=sr;for(var n=0;n<t.length-1;++n)t[n]._count--;return new em(this.tree._compare,t[0])}else{if(t.length===1)return new em(this.tree._compare,null);for(var n=0;n<t.length;++n)t[n]._count--;var u=t[t.length-2];W$t(t),u.left===r?u.left=null:u.right=null}return new em(this.tree._compare,t[0])};Object.defineProperty(fu,"key",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].key},enumerable:!0});Object.defineProperty(fu,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0});Object.defineProperty(fu,"index",{get:function(){var e=0,t=this._stack;if(t.length===0){var r=this.tree.root;return r?r._count:0}else t[t.length-1].left&&(e=t[t.length-1].left._count);for(var n=t.length-2;n>=0;--n)t[n+1]===t[n].right&&(++e,t[n].left&&(e+=t[n].left._count));return e},enumerable:!0});fu.next=function(){var e=this._stack;if(e.length!==0){var t=e[e.length-1];if(t.right)for(t=t.right;t;)e.push(t),t=t.left;else for(e.pop();e.length>0&&e[e.length-1].right===t;)t=e[e.length-1],e.pop()}};Object.defineProperty(fu,"hasNext",{get:function(){var e=this._stack;if(e.length===0)return!1;if(e[e.length-1].right)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].left===e[t])return!0;return!1}});fu.update=function(e){var t=this._stack;if(t.length===0)throw new Error("Can't update empty node!");var r=new Array(t.length),n=t[t.length-1];r[r.length-1]=new ba(n._color,n.key,e,n.left,n.right,n._count);for(var i=t.length-2;i>=0;--i)n=t[i],n.left===t[i+1]?r[i]=new ba(n._color,n.key,n.value,r[i+1],n.right,n._count):r[i]=new ba(n._color,n.key,n.value,n.left,r[i+1],n._count);return new em(this.tree._compare,r[0])};fu.prev=function(){var e=this._stack;if(e.length!==0){var t=e[e.length-1];if(t.left)for(t=t.left;t;)e.push(t),t=t.right;else for(e.pop();e.length>0&&e[e.length-1].left===t;)t=e[e.length-1],e.pop()}};Object.defineProperty(fu,"hasPrev",{get:function(){var e=this._stack;if(e.length===0)return!1;if(e[e.length-1].left)return!0;for(var t=e.length-1;t>0;--t)if(e[t-1].right===e[t])return!0;return!1}});function j$t(e,t){return e<t?-1:e>t?1:0}o(j$t,"defaultCompare");function $$t(e){return new em(e||j$t,null)}o($$t,"createRBTree")});var Mxe=R((dQ,Uxe)=>{"use strict";var DN=require("buffer"),Hf=DN.Buffer;function Lxe(e,t){for(var r in e)t[r]=e[r]}o(Lxe,"copyProps");Hf.from&&Hf.alloc&&Hf.allocUnsafe&&Hf.allocUnsafeSlow?Uxe.exports=DN:(Lxe(DN,dQ),dQ.Buffer=_w);function _w(e,t,r){return Hf(e,t,r)}o(_w,"SafeBuffer");Lxe(Hf,_w);_w.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Hf(e,t,r)};_w.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Hf(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};_w.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Hf(e)};_w.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return DN.SlowBuffer(e)}});var Bxe=R((Aan,Fxe)=>{"use strict";Fxe.exports=setImmediate});var Vxe=R((Ran,$xe)=>{"use strict";var qxe=jt(),Wxe=uQ().AbstractLevelDOWN,jxe=uQ().AbstractIterator,wa=wK(),V$t=Nxe(),PN=Mxe().Buffer,ww={},mc=Bxe();function G$t(e){return wa.compare(e,this._end)>0}o(G$t,"gt");function H$t(e){return wa.compare(e,this._end)>=0}o(H$t,"gte");function K$t(e){return wa.compare(e,this._end)<0}o(K$t,"lt");function Q$t(e){return wa.compare(e,this._end)<=0}o(Q$t,"lte");function kN(e,t){jxe.call(this,e),this._limit=t.limit,this._limit===-1&&(this._limit=1/0);var r=e._store[e._location];this.keyAsBuffer=t.keyAsBuffer!==!1,this.valueAsBuffer=t.valueAsBuffer!==!1,this._reverse=t.reverse,this._options=t,this._done=0,this._reverse?(this._incr="prev",this._start=wa.upperBound(t),this._end=wa.lowerBound(t),typeof this._start>"u"?this._tree=r.end:wa.upperBoundInclusive(t)?this._tree=r.le(this._start):this._tree=r.lt(this._start),this._end&&(wa.lowerBoundInclusive(t)?this._test=H$t:this._test=G$t)):(this._incr="next",this._start=wa.lowerBound(t),this._end=wa.upperBound(t),typeof this._start>"u"?this._tree=r.begin:wa.lowerBoundInclusive(t)?this._tree=r.ge(this._start):this._tree=r.gt(this._start),this._end&&(wa.upperBoundInclusive(t)?this._test=Q$t:this._test=K$t))}o(kN,"MemIterator");qxe(kN,jxe);kN.prototype._next=function(e){var t,r;if(this._done++>=this._limit||!this._tree.valid||(t=this._tree.key,r=this._tree.value,!this._test(t)))return mc(e);this.keyAsBuffer&&(t=PN.from(t)),this.valueAsBuffer&&(r=PN.from(r)),this._tree[this._incr](),mc(o(function(){e(null,t,r)},"callNext"))};kN.prototype._test=function(){return!0};function xs(e){if(!(this instanceof xs))return new xs(e);Wxe.call(this,typeof e=="string"?e:""),this._location=this.location?"$"+this.location:"_tree",this._store=this.location?ww:this,this._store[this._location]=this._store[this._location]||V$t(wa.compare)}o(xs,"MemDOWN");xs.clearGlobalStore=function(e){e?Object.keys(ww).forEach(function(t){delete ww[t]}):ww={}};qxe(xs,Wxe);xs.prototype._open=function(e,t){var r=this;mc(o(function(){t(null,r)},"callNext"))};xs.prototype._put=function(e,t,r,n){(typeof t>"u"||t===null)&&(t="");var i=this._store[this._location].find(e);i.valid?this._store[this._location]=i.update(t):this._store[this._location]=this._store[this._location].insert(e,t),mc(n)};xs.prototype._get=function(e,t,r){var n=this._store[this._location].get(e);if(typeof n>"u")return mc(o(function(){r(new Error("NotFound"))},"callNext"));t.asBuffer!==!1&&!this._isBuffer(n)&&(n=PN.from(String(n))),mc(o(function(){r(null,n)},"callNext"))};xs.prototype._del=function(e,t,r){this._store[this._location]=this._store[this._location].remove(e),mc(r)};xs.prototype._batch=function(e,t,r){for(var n=-1,i,s,a,u=e.length,c=this._store[this._location];++n<u;)e[n]&&(i=this._isBuffer(e[n].key)?e[n].key:String(e[n].key),a=c.find(i),e[n].type==="put"?(s=this._isBuffer(e[n].value)?e[n].value:String(e[n].value),c=a.valid?a.update(s):c.insert(i,s)):c=a.remove());this._store[this._location]=c,mc(r)};xs.prototype._iterator=function(e){return new kN(this,e)};xs.prototype._isBuffer=function(e){return PN.isBuffer(e)};xs.destroy=function(e,t){var r="$"+e;r in ww&&delete ww[r],mc(t)};$xe.exports=xs.default=xs});var Kxe=R((Oan,Hxe)=>{"use strict";function Gxe(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(Gxe,"_interopDefault");var z$t=ZAe(),Y$t=Gxe(Rxe()),J$t=Gxe(Vxe());function pQ(e,t){var r=z$t.assign({db:J$t},e);Y$t.call(this,r,t)}o(pQ,"MemDownPouch");pQ.valid=function(){return!0};pQ.use_prefix=!1;function X$t(e){e.adapter("memory",pQ,!0)}o(X$t,"index");Hxe.exports=X$t});var Jxe=R((Can,Yxe)=>{"use strict";var Qxe=global.MutationObserver||global.WebKitMutationObserver,Ew;process.browser?Qxe?(mQ=0,zxe=new Qxe(bR),hQ=global.document.createTextNode(""),zxe.observe(hQ,{characterData:!0}),Ew=o(function(){hQ.data=mQ=++mQ%2},"scheduleDrain")):!global.setImmediate&&typeof global.MessageChannel<"u"?(gQ=new global.MessageChannel,gQ.port1.onmessage=bR,Ew=o(function(){gQ.port2.postMessage(0)},"scheduleDrain")):"document"in global&&"onreadystatechange"in global.document.createElement("script")?Ew=o(function(){var e=global.document.createElement("script");e.onreadystatechange=function(){bR(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)},"scheduleDrain"):Ew=o(function(){setTimeout(bR,0)},"scheduleDrain"):Ew=o(function(){process.nextTick(bR)},"scheduleDrain");var mQ,zxe,hQ,gQ,yQ,_R=[];function bR(){yQ=!0;for(var e,t,r=_R.length;r;){for(t=_R,_R=[],e=-1;++e<r;)t[e]();r=_R.length}yQ=!1}o(bR,"nextTick");Yxe.exports=Z$t;function Z$t(e){_R.push(e)===1&&!yQ&&Ew()}o(Z$t,"immediate")});var iCe=R((Pan,nCe)=>{"use strict";var Xxe=Jxe();function vw(){}o(vw,"INTERNAL");var Co={},Zxe=["REJECTED"],bQ=["FULFILLED"],eCe=["PENDING"];process.browser||(wR=["UNHANDLED"]);var wR;nCe.exports=Ng;function Ng(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=eCe,this.queue=[],this.outcome=void 0,process.browser||(this.handled=wR),e!==vw&&tCe(this,e)}o(Ng,"Promise");Ng.prototype.catch=function(e){return this.then(null,e)};Ng.prototype.then=function(e,t){if(typeof e!="function"&&this.state===bQ||typeof t!="function"&&this.state===Zxe)return this;var r=new this.constructor(vw);if(process.browser||this.handled===wR&&(this.handled=null),this.state!==eCe){var n=this.state===bQ?e:t;_Q(r,n,this.outcome)}else this.queue.push(new ER(r,e,t));return r};function ER(e,t,r){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof r=="function"&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}o(ER,"QueueItem");ER.prototype.callFulfilled=function(e){Co.resolve(this.promise,e)};ER.prototype.otherCallFulfilled=function(e){_Q(this.promise,this.onFulfilled,e)};ER.prototype.callRejected=function(e){Co.reject(this.promise,e)};ER.prototype.otherCallRejected=function(e){_Q(this.promise,this.onRejected,e)};function _Q(e,t,r){Xxe(function(){var n;try{n=t(r)}catch(i){return Co.reject(e,i)}n===e?Co.reject(e,new TypeError("Cannot resolve promise with itself")):Co.resolve(e,n)})}o(_Q,"unwrap");Co.resolve=function(e,t){var r=rCe(eVt,t);if(r.status==="error")return Co.reject(e,r.value);var n=r.value;if(n)tCe(e,n);else{e.state=bQ,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e};Co.reject=function(e,t){e.state=Zxe,e.outcome=t,process.browser||e.handled===wR&&Xxe(function(){e.handled===wR&&process.emit("unhandledRejection",t,e)});for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e};function eVt(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return o(function(){t.apply(e,arguments)},"appyThen")}o(eVt,"getThen");function tCe(e,t){var r=!1;function n(u){r||(r=!0,Co.reject(e,u))}o(n,"onError");function i(u){r||(r=!0,Co.resolve(e,u))}o(i,"onSuccess");function s(){t(i,n)}o(s,"tryToUnwrap");var a=rCe(s);a.status==="error"&&n(a.value)}o(tCe,"safelyResolveThenable");function rCe(e,t){var r={};try{r.value=e(t),r.status="success"}catch(n){r.status="error",r.value=n}return r}o(rCe,"tryCatch");Ng.resolve=tVt;function tVt(e){return e instanceof this?e:Co.resolve(new this(vw),e)}o(tVt,"resolve");Ng.reject=rVt;function rVt(e){var t=new this(vw);return Co.reject(t,e)}o(rVt,"reject");Ng.all=nVt;function nVt(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var i=new Array(r),s=0,a=-1,u=new this(vw);++a<r;)c(e[a],a);return u;function c(l,f){t.resolve(l).then(d,function(p){n||(n=!0,Co.reject(u,p))});function d(p){i[f]=p,++s===r&&!n&&(n=!0,Co.resolve(u,i))}o(d,"resolveFromAll")}}o(nVt,"all");Ng.race=iVt;function iVt(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var i=-1,s=new this(vw);++i<r;)a(e[i]);return s;function a(u){t.resolve(u).then(function(c){n||(n=!0,Co.resolve(s,c))},function(c){n||(n=!0,Co.reject(s,c))})}}o(iVt,"race")});var wQ=R((Nan,oCe)=>{"use strict";function oVt(e){return e&&typeof e=="object"&&"default"in e?e.default:e}o(oVt,"_interopDefault");var sVt=oVt(iCe()),aVt=typeof Promise=="function"?Promise:sVt;oCe.exports=aVt});var EQ=R(tm=>{"use strict";var uVt=wQ();tm.once=function(e){var t=!1;return tm.getArguments(function(r){if(t)throw console.trace(),new Error("once called more than once");t=!0,e.apply(this,r)})};tm.getArguments=function(e){return function(){for(var t=arguments.length,r=new Array(t),n=-1;++n<t;)r[n]=arguments[n];return e.call(this,r)}};tm.toPromise=function(e){return tm.getArguments(function(t){var r=this,n=typeof t[t.length-1]=="function"?t.pop():!1,i;n&&(i=o(function(a,u){process.nextTick(function(){n(a,u)})},"usedCB"));var s=new uVt(function(a,u){try{var c=tm.once(function(l,f){l?u(l):a(f)});t.push(c),e.apply(r,t)}catch(l){u(l)}});return i&&s.then(function(a){i(null,a)},i),s.cancel=function(){return this},s})};tm.inherits=jt()});var sCe=R((Fan,cVt)=>{cVt.exports={name:"@budibase/pouchdb-replication-stream",version:"1.2.11",description:"PouchDB/CouchDB replication as a stream",main:"lib/index.js",repository:{type:"git",url:"git://github.com/nolanlawson/pouchdb-replication-stream.git"},keywords:["pouch","pouchdb","plugin","stream","replication","couch","couchdb"],author:"",license:"Apache-2.0",bugs:{url:"https://github.com/nolanlawson/pouchdb-replication-stream/issues"},scripts:{"test-node":"TEST_DB=testdb,http://localhost:5984/testdb istanbul test ./node_modules/mocha/bin/_mocha test/test.js -- -R spec","test-browser":"./bin/test-browser.js",jshint:"jshint -c .jshintrc lib test/test.js",test:"npm run jshint && ./bin/run-test.sh",build:"mkdirp dist && npm run browserify && npm run min",browserify:"browserify -p bundle-collapser/plugin -s PouchReplicationStream . | ./bin/es3ify.js | derequire > dist/pouchdb.replication-stream.js",min:"uglifyjs dist/pouchdb.replication-stream.js -mc > dist/pouchdb.replication-stream.min.js",dev:"browserify test/test.js > test/test-bundle.js && npm run dev-server","dev-server":"./bin/dev-server.js",coverage:"npm test --coverage && istanbul check-coverage --lines 100 --function 100 --statements 100 --branches 100"},dependencies:{inherits:"^2.0.3",ndjson:"^1.4.3","pouch-stream":"^0.4.0","pouchdb-promise":"^6.0.4",through2:"^2.0.0"},devDependencies:{bluebird:"^1.0.7",browserify:"^11.2.0","bundle-collapser":"^1.2.1",chai:"^3.3.0","chai-as-promised":"^5.1.0",derequire:"^2.0.0",es3ify:"^0.1.3","http-server":"~0.8.5",istanbul:"^0.2.7",jshint:"^2.3.0",lie:"^3.1.0",memorystream:"^0.3.0",mkdirp:"^0.5.0",mocha:"~1.18",noms:"0.0.0",phantomjs:"^1.9.7-5","pouchdb-memory":"^6.0.0","random-document-stream":"0.0.0",request:"^2.36.0","sauce-connect-launcher":"^0.4.2","selenium-standalone":"3.0.2","uglify-js":"^2.4.13",watchify:"^3.1.0",wd:"^0.2.21"}}});var uCe=R((Ban,aCe)=>{"use strict";aCe.exports=sCe().version});var vR=R((qan,vQ)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?vQ.exports={nextTick:lVt}:vQ.exports=process;function lVt(e,t,r,n){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,s,a;switch(i){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(o(function(){e.call(null,t)},"afterTickOne"));case 3:return process.nextTick(o(function(){e.call(null,t,r)},"afterTickTwo"));case 4:return process.nextTick(o(function(){e.call(null,t,r,n)},"afterTickThree"));default:for(s=new Array(i-1),a=0;a<s.length;)s[a++]=arguments[a];return process.nextTick(o(function(){e.apply(null,s)},"afterTick"))}}o(lVt,"nextTick")});var lCe=R((jan,cCe)=>{"use strict";var fVt={}.toString;cCe.exports=Array.isArray||function(e){return fVt.call(e)=="[object Array]"}});var SQ=R(($an,fCe)=>{"use strict";fCe.exports=require("stream")});var SR=R((TQ,pCe)=>{"use strict";var NN=require("buffer"),Kf=NN.Buffer;function dCe(e,t){for(var r in e)t[r]=e[r]}o(dCe,"copyProps");Kf.from&&Kf.alloc&&Kf.allocUnsafe&&Kf.allocUnsafeSlow?pCe.exports=NN:(dCe(NN,TQ),TQ.Buffer=Sw);function Sw(e,t,r){return Kf(e,t,r)}o(Sw,"SafeBuffer");dCe(Kf,Sw);Sw.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Kf(e,t,r)};Sw.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Kf(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};Sw.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Kf(e)};Sw.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return NN.SlowBuffer(e)}});var hCe=R((Gan,AQ)=>{"use strict";function dVt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}o(dVt,"_classCallCheck");var mCe=SR().Buffer,TR=require("util");function pVt(e,t,r){e.copy(t,r)}o(pVt,"copyBuffer");AQ.exports=function(){function e(){dVt(this,e),this.head=null,this.tail=null,this.length=0}return o(e,"BufferList"),e.prototype.push=o(function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},"push"),e.prototype.unshift=o(function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},"unshift"),e.prototype.shift=o(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift"),e.prototype.clear=o(function(){this.head=this.tail=null,this.length=0},"clear"),e.prototype.join=o(function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},"join"),e.prototype.concat=o(function(r){if(this.length===0)return mCe.alloc(0);for(var n=mCe.allocUnsafe(r>>>0),i=this.head,s=0;i;)pVt(i.data,n,s),s+=i.data.length,i=i.next;return n},"concat"),e}();TR&&TR.inspect&&TR.inspect.custom&&(AQ.exports.prototype[TR.inspect.custom]=function(){var e=TR.inspect({length:this.length});return this.constructor.name+" "+e})});var RQ=R((Kan,gCe)=>{"use strict";var LN=vR();function mVt(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,LN.nextTick(UN,this,e)):LN.nextTick(UN,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,LN.nextTick(UN,r,s)):LN.nextTick(UN,r,s):t&&t(s)}),this)}o(mVt,"destroy");function hVt(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}o(hVt,"undestroy");function UN(e,t){e.emit("error",t)}o(UN,"emitErrorNT");gCe.exports={destroy:mVt,undestroy:hVt}});var OQ=R((zan,TCe)=>{"use strict";var Lg=vR();TCe.exports=ci;function bCe(e){var t=this;this.next=null,this.entry=null,this.finish=function(){kVt(t,e)}}o(bCe,"CorkedRequest");var gVt=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Lg.nextTick,Tw;ci.WritableState=RR;var _Ce=Object.create(xo());_Ce.inherits=jt();var yVt={deprecate:W3()},wCe=SQ(),FN=SR().Buffer,bVt=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _Vt(e){return FN.from(e)}o(_Vt,"_uint8ArrayToBuffer");function wVt(e){return FN.isBuffer(e)||e instanceof bVt}o(wVt,"_isUint8Array");var ECe=RQ();_Ce.inherits(ci,wCe);function EVt(){}o(EVt,"nop");function RR(e,t){Tw=Tw||Ug(),e=e||{};var r=t instanceof Tw;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,i=e.writableHighWaterMark,s=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=s,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=e.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(u){OVt(t,u)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new bCe(this)}o(RR,"WritableState");RR.prototype.getBuffer=o(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(RR.prototype,"buffer",{get:yVt.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var MN;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(MN=Function.prototype[Symbol.hasInstance],Object.defineProperty(ci,Symbol.hasInstance,{value:function(e){return MN.call(this,e)?!0:this!==ci?!1:e&&e._writableState instanceof RR}})):MN=o(function(e){return e instanceof this},"realHasInstance");function ci(e){if(Tw=Tw||Ug(),!MN.call(ci,this)&&!(this instanceof Tw))return new ci(e);this._writableState=new RR(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),wCe.call(this)}o(ci,"Writable");ci.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function vVt(e,t){var r=new Error("write after end");e.emit("error",r),Lg.nextTick(t,r)}o(vVt,"writeAfterEnd");function SVt(e,t,r,n){var i=!0,s=!1;return r===null?s=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),Lg.nextTick(n,s),i=!1),i}o(SVt,"validChunk");ci.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&wVt(e);return s&&!FN.isBuffer(e)&&(e=_Vt(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=EVt),n.ended?vVt(this,r):(s||SVt(this,n,e,r))&&(n.pendingcb++,i=AVt(this,n,s,e,t,r)),i};ci.prototype.cork=function(){var e=this._writableState;e.corked++};ci.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&vCe(this,e))};ci.prototype.setDefaultEncoding=o(function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");function TVt(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=FN.from(t,r)),t}o(TVt,"decodeChunk");Object.defineProperty(ci.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function AVt(e,t,r,n,i,s){if(!r){var a=TVt(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var u=t.objectMode?1:n.length;t.length+=u;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else IQ(e,t,!1,u,n,i,s);return c}o(AVt,"writeOrBuffer");function IQ(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}o(IQ,"doWrite");function RVt(e,t,r,n,i){--t.pendingcb,r?(Lg.nextTick(i,n),Lg.nextTick(AR,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),AR(e,t))}o(RVt,"onwriteError");function IVt(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}o(IVt,"onwriteStateUpdate");function OVt(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(IVt(r),t)RVt(e,r,n,t,i);else{var s=SCe(r);!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&vCe(e,r),n?gVt(yCe,e,r,s,i):yCe(e,r,s,i)}}o(OVt,"onwrite");function yCe(e,t,r,n){r||xVt(e,t),t.pendingcb--,n(),AR(e,t)}o(yCe,"afterWrite");function xVt(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}o(xVt,"onwriteDrain");function vCe(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,IQ(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new bCe(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,l=r.encoding,f=r.callback,d=t.objectMode?1:c.length;if(IQ(e,t,!1,d,c,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}o(vCe,"clearBuffer");ci.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};ci.prototype._writev=null;ci.prototype.end=function(e,t,r){var n=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||PVt(this,n,r)};function SCe(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}o(SCe,"needFinish");function CVt(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),AR(e,t)})}o(CVt,"callFinal");function DVt(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Lg.nextTick(CVt,e,t)):(t.prefinished=!0,e.emit("prefinish")))}o(DVt,"prefinish");function AR(e,t){var r=SCe(t);return r&&(DVt(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}o(AR,"finishMaybe");function PVt(e,t,r){t.ending=!0,AR(e,t),r&&(t.finished?Lg.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}o(PVt,"endWritable");function kVt(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}o(kVt,"onCorkedFinish");Object.defineProperty(ci.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});ci.prototype.destroy=ECe.destroy;ci.prototype._undestroy=ECe.undestroy;ci.prototype._destroy=function(e,t){this.end(),t(e)}});var Ug=R((Jan,OCe)=>{"use strict";var ACe=vR(),NVt=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};OCe.exports=Qf;var RCe=Object.create(xo());RCe.inherits=jt();var ICe=DQ(),CQ=OQ();RCe.inherits(Qf,ICe);for(xQ=NVt(CQ.prototype),BN=0;BN<xQ.length;BN++)qN=xQ[BN],Qf.prototype[qN]||(Qf.prototype[qN]=CQ.prototype[qN]);var xQ,qN,BN;function Qf(e){if(!(this instanceof Qf))return new Qf(e);ICe.call(this,e),CQ.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",LVt)}o(Qf,"Duplex");Object.defineProperty(Qf.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function LVt(){this.allowHalfOpen||this._writableState.ended||ACe.nextTick(UVt,this)}o(LVt,"onend");function UVt(e){e.end()}o(UVt,"onEndNT");Object.defineProperty(Qf.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});Qf.prototype._destroy=function(e,t){this.push(null),this.end(),ACe.nextTick(t,e)}});var NQ=R(CCe=>{"use strict";var kQ=SR().Buffer,xCe=kQ.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function MVt(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}o(MVt,"_normalizeEncoding");function FVt(e){var t=MVt(e);if(typeof t!="string"&&(kQ.isEncoding===xCe||!xCe(e)))throw new Error("Unknown encoding: "+e);return t||e}o(FVt,"normalizeEncoding");CCe.StringDecoder=IR;function IR(e){this.encoding=FVt(e);var t;switch(this.encoding){case"utf16le":this.text=VVt,this.end=GVt,t=4;break;case"utf8":this.fillLast=WVt,t=4;break;case"base64":this.text=HVt,this.end=KVt,t=3;break;default:this.write=QVt,this.end=zVt;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=kQ.allocUnsafe(t)}o(IR,"StringDecoder");IR.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};IR.prototype.end=$Vt;IR.prototype.text=jVt;IR.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function PQ(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}o(PQ,"utf8CheckByte");function BVt(e,t,r){var n=t.length-1;if(n<r)return 0;var i=PQ(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=PQ(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=PQ(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}o(BVt,"utf8CheckIncomplete");function qVt(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}o(qVt,"utf8CheckExtraBytes");function WVt(e){var t=this.lastTotal-this.lastNeed,r=qVt(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}o(WVt,"utf8FillLast");function jVt(e,t){var r=BVt(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}o(jVt,"utf8Text");function $Vt(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}o($Vt,"utf8End");function VVt(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}o(VVt,"utf16Text");function GVt(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}o(GVt,"utf16End");function HVt(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}o(HVt,"base64Text");function KVt(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}o(KVt,"base64End");function QVt(e){return e.toString(this.encoding)}o(QVt,"simpleWrite");function zVt(e){return e&&e.length?this.write(e):""}o(zVt,"simpleEnd")});var DQ=R((run,jCe)=>{"use strict";var Rw=vR();jCe.exports=Zr;var YVt=lCe(),OR;Zr.ReadableState=MCe;var tun=require("events").EventEmitter,NCe=o(function(e,t){return e.listeners(t).length},"EElistenerCount"),BQ=SQ(),xR=SR().Buffer,JVt=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function XVt(e){return xR.from(e)}o(XVt,"_uint8ArrayToBuffer");function ZVt(e){return xR.isBuffer(e)||e instanceof JVt}o(ZVt,"_isUint8Array");var LCe=Object.create(xo());LCe.inherits=jt();var LQ=require("util"),hr=void 0;LQ&&LQ.debuglog?hr=LQ.debuglog("stream"):hr=o(function(){},"debug");var eGt=hCe(),UCe=RQ(),Aw;LCe.inherits(Zr,BQ);var UQ=["error","close","destroy","pause","resume"];function tGt(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):YVt(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}o(tGt,"prependListener");function MCe(e,t){OR=OR||Ug(),e=e||{};var r=t instanceof OR;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,i=e.readableHighWaterMark,s=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new eGt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(Aw||(Aw=NQ().StringDecoder),this.decoder=new Aw(e.encoding),this.encoding=e.encoding)}o(MCe,"ReadableState");function Zr(e){if(OR=OR||Ug(),!(this instanceof Zr))return new Zr(e);this._readableState=new MCe(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),BQ.call(this)}o(Zr,"Readable");Object.defineProperty(Zr.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Zr.prototype.destroy=UCe.destroy;Zr.prototype._undestroy=UCe.undestroy;Zr.prototype._destroy=function(e,t){this.push(null),t(e)};Zr.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=xR.from(e,t),t=""),n=!0),FCe(this,e,t,!1,n)};Zr.prototype.unshift=function(e){return FCe(this,e,null,!0,!1)};function FCe(e,t,r,n,i){var s=e._readableState;if(t===null)s.reading=!1,oGt(e,s);else{var a;i||(a=rGt(s,t)),a?e.emit("error",a):s.objectMode||t&&t.length>0?(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==xR.prototype&&(t=XVt(t)),n?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):MQ(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?MQ(e,s,t,!1):BCe(e,s)):MQ(e,s,t,!1))):n||(s.reading=!1)}return nGt(s)}o(FCe,"readableAddChunk");function MQ(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&WN(e)),BCe(e,t)}o(MQ,"addChunk");function rGt(e,t){var r;return!ZVt(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}o(rGt,"chunkInvalid");function nGt(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}o(nGt,"needMoreData");Zr.prototype.isPaused=function(){return this._readableState.flowing===!1};Zr.prototype.setEncoding=function(e){return Aw||(Aw=NQ().StringDecoder),this._readableState.decoder=new Aw(e),this._readableState.encoding=e,this};var DCe=8388608;function iGt(e){return e>=DCe?e=DCe:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}o(iGt,"computeNewHighWaterMark");function PCe(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=iGt(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}o(PCe,"howMuchToRead");Zr.prototype.read=function(e){hr("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return hr("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?FQ(this):WN(this),null;if(e=PCe(e,t),e===0&&t.ended)return t.length===0&&FQ(this),null;var n=t.needReadable;hr("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,hr("length less than watermark",n)),t.ended||t.reading?(n=!1,hr("reading or ended",n)):n&&(hr("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=PCe(r,t)));var i;return e>0?i=qCe(e,t):i=null,i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&FQ(this)),i!==null&&this.emit("data",i),i};function oGt(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,WN(e)}}o(oGt,"onEofChunk");function WN(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(hr("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Rw.nextTick(kCe,e):kCe(e))}o(WN,"emitReadable");function kCe(e){hr("emit readable"),e.emit("readable"),qQ(e)}o(kCe,"emitReadable_");function BCe(e,t){t.readingMore||(t.readingMore=!0,Rw.nextTick(sGt,e,t))}o(BCe,"maybeReadMore");function sGt(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(hr("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}o(sGt,"maybeReadMore_");Zr.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};Zr.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,hr("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?u:b;n.endEmitted?Rw.nextTick(s):r.once("end",s),e.on("unpipe",a);function a(w,E){hr("onunpipe"),w===r&&E&&E.hasUnpiped===!1&&(E.hasUnpiped=!0,f())}o(a,"onunpipe");function u(){hr("onend"),e.end()}o(u,"onend");var c=aGt(r);e.on("drain",c);var l=!1;function f(){hr("cleanup"),e.removeListener("close",h),e.removeListener("finish",g),e.removeListener("drain",c),e.removeListener("error",m),e.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",b),r.removeListener("data",p),l=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}o(f,"cleanup");var d=!1;r.on("data",p);function p(w){hr("ondata"),d=!1;var E=e.write(w);E===!1&&!d&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&WCe(n.pipes,e)!==-1)&&!l&&(hr("false write response, pause",n.awaitDrain),n.awaitDrain++,d=!0),r.pause())}o(p,"ondata");function m(w){hr("onerror",w),b(),e.removeListener("error",m),NCe(e,"error")===0&&e.emit("error",w)}o(m,"onerror"),tGt(e,"error",m);function h(){e.removeListener("finish",g),b()}o(h,"onclose"),e.once("close",h);function g(){hr("onfinish"),e.removeListener("close",h),b()}o(g,"onfinish"),e.once("finish",g);function b(){hr("unpipe"),r.unpipe(e)}return o(b,"unpipe"),e.emit("pipe",r),n.flowing||(hr("pipe resume"),r.resume()),e};function aGt(e){return function(){var t=e._readableState;hr("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&NCe(e,"data")&&(t.flowing=!0,qQ(e))}}o(aGt,"pipeOnDrain");Zr.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=WCe(t.pipes,e);return a===-1?this:(t.pipes.splice(a,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};Zr.prototype.on=function(e,t){var r=BQ.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var n=this._readableState;!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&WN(this):Rw.nextTick(uGt,this))}return r};Zr.prototype.addListener=Zr.prototype.on;function uGt(e){hr("readable nexttick read 0"),e.read(0)}o(uGt,"nReadingNextTick");Zr.prototype.resume=function(){var e=this._readableState;return e.flowing||(hr("resume"),e.flowing=!0,cGt(this,e)),this};function cGt(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Rw.nextTick(lGt,e,t))}o(cGt,"resume");function lGt(e,t){t.reading||(hr("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),qQ(e),t.flowing&&!t.reading&&e.read(0)}o(lGt,"resume_");Zr.prototype.pause=function(){return hr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(hr("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function qQ(e){var t=e._readableState;for(hr("flow",t.flowing);t.flowing&&e.read()!==null;);}o(qQ,"flow");Zr.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(hr("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&t.push(a)}t.push(null)}),e.on("data",function(a){if(hr("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var u=t.push(a);u||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=function(a){return function(){return e[a].apply(e,arguments)}}(i));for(var s=0;s<UQ.length;s++)e.on(UQ[s],this.emit.bind(this,UQ[s]));return this._read=function(a){hr("wrapped _read",a),n&&(n=!1,e.resume())},this};Object.defineProperty(Zr.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Zr._fromList=qCe;function qCe(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=fGt(e,t.buffer,t.decoder),r}o(qCe,"fromList");function fGt(e,t,r){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?n=t.shift():n=r?dGt(e,t):pGt(e,t),n}o(fGt,"fromListPartial");function dGt(e,t){var r=t.head,n=1,i=r.data;for(e-=i.length;r=r.next;){var s=r.data,a=e>s.length?s.length:e;if(a===s.length?i+=s:i+=s.slice(0,e),e-=a,e===0){a===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(a));break}++n}return t.length-=n,i}o(dGt,"copyFromBufferString");function pGt(e,t){var r=xR.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var s=n.data,a=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,a),e-=a,e===0){a===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(a));break}++i}return t.length-=i,r}o(pGt,"copyFromBuffer");function FQ(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Rw.nextTick(mGt,t,e))}o(FQ,"endReadable");function mGt(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}o(mGt,"endReadableNT");function WCe(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}o(WCe,"indexOf")});var WQ=R((iun,GCe)=>{"use strict";GCe.exports=zf;var jN=Ug(),VCe=Object.create(xo());VCe.inherits=jt();VCe.inherits(zf,jN);function hGt(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}o(hGt,"afterTransform");function zf(e){if(!(this instanceof zf))return new zf(e);jN.call(this,e),this._transformState={afterTransform:hGt.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",gGt)}o(zf,"Transform");function gGt(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){$Ce(e,t,r)}):$Ce(this,null,null)}o(gGt,"prefinish");zf.prototype.push=function(e,t){return this._transformState.needTransform=!1,jN.prototype.push.call(this,e,t)};zf.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};zf.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};zf.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};zf.prototype._destroy=function(e,t){var r=this;jN.prototype._destroy.call(this,e,function(n){t(n),r.emit("close")})};function $Ce(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}o($Ce,"done")});var zCe=R((sun,QCe)=>{"use strict";QCe.exports=CR;var HCe=WQ(),KCe=Object.create(xo());KCe.inherits=jt();KCe.inherits(CR,HCe);function CR(e){if(!(this instanceof CR))return new CR(e);HCe.call(this,e)}o(CR,"PassThrough");CR.prototype._transform=function(e,t,r){r(null,e)}});var YCe=R((io,$N)=>{"use strict";var yl=require("stream");process.env.READABLE_STREAM==="disable"&&yl?($N.exports=yl,io=$N.exports=yl.Readable,io.Readable=yl.Readable,io.Writable=yl.Writable,io.Duplex=yl.Duplex,io.Transform=yl.Transform,io.PassThrough=yl.PassThrough,io.Stream=yl):(io=$N.exports=DQ(),io.Stream=yl||io,io.Readable=io,io.Writable=OQ(),io.Duplex=Ug(),io.Transform=WQ(),io.PassThrough=zCe())});var DR=R((uun,VN)=>{"use strict";var JCe=YCe().Transform,XCe=require("util").inherits,ZCe=wg();function Iw(e){JCe.call(this,e),this._destroyed=!1}o(Iw,"DestroyableTransform");XCe(Iw,JCe);Iw.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;process.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}};function yGt(e,t,r){r(null,e)}o(yGt,"noop");function jQ(e){return function(t,r,n){return typeof t=="function"&&(n=r,r=t,t={}),typeof r!="function"&&(r=yGt),typeof n!="function"&&(n=null),e(t,r,n)}}o(jQ,"through2");VN.exports=jQ(function(e,t,r){var n=new Iw(e);return n._transform=t,r&&(n._flush=r),n});VN.exports.ctor=jQ(function(e,t,r){function n(i){if(!(this instanceof n))return new n(i);this.options=ZCe(e,i),Iw.call(this,this.options)}return o(n,"Through2"),XCe(n,Iw),n.prototype._transform=t,r&&(n.prototype._flush=r),n});VN.exports.obj=jQ(function(e,t,r){var n=new Iw(ZCe({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n})});var nDe=R((lun,rDe)=>{"use strict";var bGt=DR(),_Gt=require("string_decoder").StringDecoder;function wGt(e,t,r){if(this._last+=this._decoder.write(e),this._last.length>this.maxLength)return r(new Error("maximum buffer reached"));var n=this._last.split(this.matcher);this._last=n.pop();for(var i=0;i<n.length;i++)tDe(this,this.mapper(n[i]));r()}o(wGt,"transform");function EGt(e){this._last+=this._decoder.end(),this._last&&tDe(this,this.mapper(this._last)),e()}o(EGt,"flush");function tDe(e,t){t!==void 0&&e.push(t)}o(tDe,"push");function eDe(e){return e}o(eDe,"noop");function vGt(e,t,r){switch(e=e||/\r?\n/,t=t||eDe,r=r||{},arguments.length){case 1:typeof e=="function"?(t=e,e=/\r?\n/):typeof e=="object"&&!(e instanceof RegExp)&&(r=e,e=/\r?\n/);break;case 2:typeof e=="function"?(r=t,t=e,e=/\r?\n/):typeof t=="object"&&(r=t,t=eDe)}var n=bGt(r,wGt,EGt);return n._readableState.objectMode=!0,n._readableState.highWaterMark&&!r.highWaterMark&&(n._readableState.highWaterMark=16),n._last="",n._decoder=new _Gt("utf8"),n.matcher=e,n.mapper=t,n.maxLength=r.maxLength,n}o(vGt,"split");rDe.exports=vGt});var sDe=R(($Q,oDe)=>{"use strict";$Q=oDe.exports=SGt;$Q.getSerialize=iDe;function SGt(e,t,r,n){return JSON.stringify(e,iDe(t,n),r)}o(SGt,"stringify");function iDe(e,t){var r=[],n=[];return t==null&&(t=o(function(i,s){return r[0]===s?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(s)).join(".")+"]"},"cycleReplacer")),function(i,s){if(r.length>0){var a=r.indexOf(this);~a?r.splice(a+1):r.push(this),~a?n.splice(a,1/0,i):n.push(i),~r.indexOf(s)&&(s=t.call(this,i,s))}else r.push(s);return e==null?s:e.call(this,i,s)}}o(iDe,"serializer")});var VQ=R((pun,PR)=>{"use strict";var TGt=DR(),AGt=nDe(),RGt=require("os").EOL,IGt=sDe();PR.exports=aDe;PR.exports.serialize=PR.exports.stringify=OGt;PR.exports.parse=aDe;function aDe(e){e=e||{},e.strict=e.strict!==!1;function t(r){try{if(r)return JSON.parse(r)}catch{e.strict&&this.emit("error",new Error("Could not parse row "+r.slice(0,50)+"..."))}}return o(t,"parseRow"),AGt(t,e)}o(aDe,"parse");function OGt(e){return TGt.obj(e,function(t,r,n){n(null,IGt(t)+RGt)})}o(OGt,"serialize")});var cDe=R((hun,uDe)=>{"use strict";var xGt=DR().obj;uDe.exports=function(){return xGt(function(e,t,r){!(e instanceof Buffer)&&Buffer.isBuffer(e)&&(e=new Buffer(e)),this.push(e),r()})}});var pDe=R((gun,dDe)=>{"use strict";var CGt=EQ(),DGt=wQ(),lDe={status:409,name:"conflict",message:"Document update conflict"},PGt=VQ(),fDe={status:404,name:"not_found",message:"missing"};function GQ(e,t){var r=this;r.instanceId=Math.random().toString(),r.ndj=PGt.serialize(),r.localStore={},r.originalName=e.name,r.setupStream=function(n){r.ndj.pipe(n)},r.type=function(){return"writableStream"},r._remote=!1,r._id=CGt.toPromise(function(n){n(null,r.instanceId)}),r._bulkDocs=function(n,i,s){var a=n.docs,u=this;i.new_edits===!1?this.ndj.write({docs:a},function(){s(null,a.map(function(c){return{ok:!0,id:c._id,rev:c._rev}}))}):DGt.all(a.map(function(c){u.localStore[c._id]=c})).then(function(c){s(null,c)}).catch(function(c){s(c)})},r._getRevisionTree=function(n,i){process.nextTick(function(){i(fDe)})},r._close=function(n){this.ndj.end(n)},r._getLocal=function(n,i){var s=this;process.nextTick(function(){var a=s.localStore[n];a?i(null,a):i(fDe)})},r._putLocal=function(n,i,s){var a=this;typeof i=="function"&&(s=i,i={}),delete n._revisions;var u=n._rev,c=n._id,l;u?l=n._rev="0-"+(parseInt(u.split("-")[1],10)+1):l=n._rev="0-1",process.nextTick(function(){var f=a.localStore[c];if(f&&u!==f._rev)s(lDe);else{a.localStore[c]=n;var d=o(function(){s(null,{ok:!0,id:c,rev:l})},"done");"last_seq"in n?a.ndj.write({seq:n.last_seq},d):d()}})},r._removeLocal=function(n,i){var s=this;process.nextTick(function(){var a=s.localStore[n._id];a&&n._rev!==a._rev?i(lDe):(delete s.localStore[n._id],i(null,{ok:!0,id:n._id,rev:"0-0"}))})},r._destroy=function(n,i){typeof n=="function"&&(i=n,n={}),GQ.Changes.removeAllListeners(r.originalName),process.nextTick(function(){i(null,{ok:!0})})},process.nextTick(function(){t(null,r)})}o(GQ,"WritableStreamPouch");GQ.valid=function(){return!0};dDe.exports=GQ});var hDe=R((bun,mDe)=>{"use strict";mDe.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}});var KQ=R((_un,SDe)=>{"use strict";SDe.exports=du;var kGt=require("buffer").Buffer;du.WritableState=_De;var Ea=xo();Ea.inherits=jt();var bDe=require("stream");Ea.inherits(du,bDe);function NGt(e,t,r){this.chunk=e,this.encoding=t,this.callback=r}o(NGt,"WriteReq");function _De(e,t){var r=Mg();e=e||{};var n=e.highWaterMark,i=e.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:i,this.objectMode=!!e.objectMode,t instanceof r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){WGt(t,a)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}o(_De,"WritableState");function du(e){var t=Mg();if(!(this instanceof du)&&!(this instanceof t))return new du(e);this._writableState=new _De(e,this),this.writable=!0,bDe.call(this)}o(du,"Writable");du.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function LGt(e,t,r){var n=new Error("write after end");e.emit("error",n),process.nextTick(function(){r(n)})}o(LGt,"writeAfterEnd");function UGt(e,t,r,n){var i=!0;if(!Ea.isBuffer(r)&&!Ea.isString(r)&&!Ea.isNullOrUndefined(r)&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s),process.nextTick(function(){n(s)}),i=!1}return i}o(UGt,"validChunk");du.prototype.write=function(e,t,r){var n=this._writableState,i=!1;return Ea.isFunction(t)&&(r=t,t=null),Ea.isBuffer(e)?t="buffer":t||(t=n.defaultEncoding),Ea.isFunction(r)||(r=o(function(){},"cb")),n.ended?LGt(this,n,r):UGt(this,n,e,r)&&(n.pendingcb++,i=FGt(this,n,e,t,r)),i};du.prototype.cork=function(){var e=this._writableState;e.corked++};du.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.finished&&!e.bufferProcessing&&e.buffer.length&&wDe(this,e))};function MGt(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&Ea.isString(t)&&(t=new kGt(t,r)),t}o(MGt,"decodeChunk");function FGt(e,t,r,n,i){r=MGt(t,r,n),Ea.isBuffer(r)&&(n="buffer");var s=t.objectMode?1:r.length;t.length+=s;var a=t.length<t.highWaterMark;return a||(t.needDrain=!0),t.writing||t.corked?t.buffer.push(new NGt(r,n,i)):HQ(e,t,!1,s,r,n,i),a}o(FGt,"writeOrBuffer");function HQ(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}o(HQ,"doWrite");function BGt(e,t,r,n,i){r?process.nextTick(function(){t.pendingcb--,i(n)}):(t.pendingcb--,i(n)),e._writableState.errorEmitted=!0,e.emit("error",n)}o(BGt,"onwriteError");function qGt(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}o(qGt,"onwriteStateUpdate");function WGt(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(qGt(r),t)BGt(e,r,n,t,i);else{var s=EDe(e,r);!s&&!r.corked&&!r.bufferProcessing&&r.buffer.length&&wDe(e,r),n?process.nextTick(function(){gDe(e,r,s,i)}):gDe(e,r,s,i)}}o(WGt,"onwrite");function gDe(e,t,r,n){r||jGt(e,t),t.pendingcb--,n(),vDe(e,t)}o(gDe,"afterWrite");function jGt(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}o(jGt,"onwriteDrain");function wDe(e,t){if(t.bufferProcessing=!0,e._writev&&t.buffer.length>1){for(var r=[],n=0;n<t.buffer.length;n++)r.push(t.buffer[n].callback);t.pendingcb++,HQ(e,t,!0,t.length,t.buffer,"",function(l){for(var f=0;f<r.length;f++)t.pendingcb--,r[f](l)}),t.buffer=[]}else{for(var n=0;n<t.buffer.length;n++){var i=t.buffer[n],s=i.chunk,a=i.encoding,u=i.callback,c=t.objectMode?1:s.length;if(HQ(e,t,!1,c,s,a,u),t.writing){n++;break}}n<t.buffer.length?t.buffer=t.buffer.slice(n):t.buffer.length=0}t.bufferProcessing=!1}o(wDe,"clearBuffer");du.prototype._write=function(e,t,r){r(new Error("not implemented"))};du.prototype._writev=null;du.prototype.end=function(e,t,r){var n=this._writableState;Ea.isFunction(e)?(r=e,e=null,t=null):Ea.isFunction(t)&&(r=t,t=null),Ea.isNullOrUndefined(e)||this.write(e,t),n.corked&&(n.corked=1,this.uncork()),!n.ending&&!n.finished&&$Gt(this,n,r)};function EDe(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}o(EDe,"needFinish");function yDe(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}o(yDe,"prefinish");function vDe(e,t){var r=EDe(e,t);return r&&(t.pendingcb===0?(yDe(e,t),t.finished=!0,e.emit("finish")):yDe(e,t)),r}o(vDe,"finishMaybe");function $Gt(e,t,r){t.ending=!0,vDe(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0}o($Gt,"endWritable")});var Mg=R((Eun,RDe)=>{"use strict";RDe.exports=Ow;var VGt=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},TDe=xo();TDe.inherits=jt();var ADe=zQ(),QQ=KQ();TDe.inherits(Ow,ADe);HGt(VGt(QQ.prototype),function(e){Ow.prototype[e]||(Ow.prototype[e]=QQ.prototype[e])});function Ow(e){if(!(this instanceof Ow))return new Ow(e);ADe.call(this,e),QQ.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",GGt)}o(Ow,"Duplex");function GGt(){this.allowHalfOpen||this._writableState.ended||process.nextTick(this.end.bind(this))}o(GGt,"onend");function HGt(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}o(HGt,"forEach")});var zQ=R((Sun,kDe)=>{"use strict";kDe.exports=vi;var KGt=hDe(),JQ=require("buffer").Buffer;vi.ReadableState=CDe;var GN=require("events").EventEmitter;GN.listenerCount||(GN.listenerCount=function(e,t){return e.listeners(t).length});var XQ=require("stream"),va=xo();va.inherits=jt();var xw,ir=require("util");ir&&ir.debuglog?ir=ir.debuglog("stream"):ir=o(function(){},"debug");va.inherits(vi,XQ);function CDe(e,t){var r=Mg();e=e||{};var n=e.highWaterMark,i=e.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,t instanceof r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(xw||(xw=sR().StringDecoder),this.decoder=new xw(e.encoding),this.encoding=e.encoding)}o(CDe,"ReadableState");function vi(e){var t=Mg();if(!(this instanceof vi))return new vi(e);this._readableState=new CDe(e,this),this.readable=!0,XQ.call(this)}o(vi,"Readable");vi.prototype.push=function(e,t){var r=this._readableState;return va.isString(e)&&!r.objectMode&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=new JQ(e,t),t="")),DDe(this,r,e,t,!1)};vi.prototype.unshift=function(e){var t=this._readableState;return DDe(this,t,e,"",!0)};function DDe(e,t,r,n,i){var s=YGt(t,r);if(s)e.emit("error",s);else if(va.isNullOrUndefined(r))t.reading=!1,t.ended||JGt(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else t.decoder&&!i&&!n&&(r=t.decoder.write(r)),i||(t.reading=!1),t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&HN(e)),XGt(e,t);else i||(t.reading=!1);return QGt(t)}o(DDe,"readableAddChunk");function QGt(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}o(QGt,"needMoreData");vi.prototype.setEncoding=function(e){return xw||(xw=sR().StringDecoder),this._readableState.decoder=new xw(e),this._readableState.encoding=e,this};var IDe=8388608;function zGt(e){if(e>=IDe)e=IDe;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}o(zGt,"roundUpToNextPowerOf2");function ODe(e,t){return t.length===0&&t.ended?0:t.objectMode?e===0?0:1:isNaN(e)||va.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=zGt(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}o(ODe,"howMuchToRead");vi.prototype.read=function(e){ir("read",e);var t=this._readableState,r=e;if((!va.isNumber(e)||e>0)&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return ir("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?YQ(this):HN(this),null;if(e=ODe(e,t),e===0&&t.ended)return t.length===0&&YQ(this),null;var n=t.needReadable;ir("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,ir("length less than watermark",n)),(t.ended||t.reading)&&(n=!1,ir("reading or ended",n)),n&&(ir("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),n&&!t.reading&&(e=ODe(r,t));var i;return e>0?i=PDe(e,t):i=null,va.isNull(i)&&(t.needReadable=!0,e=0),t.length-=e,t.length===0&&!t.ended&&(t.needReadable=!0),r!==e&&t.ended&&t.length===0&&YQ(this),va.isNull(i)||this.emit("data",i),i};function YGt(e,t){var r=null;return!va.isBuffer(t)&&!va.isString(t)&&!va.isNullOrUndefined(t)&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}o(YGt,"chunkInvalid");function JGt(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,HN(e)}o(JGt,"onEofChunk");function HN(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(ir("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?process.nextTick(function(){xDe(e)}):xDe(e))}o(HN,"emitReadable");function xDe(e){ir("emit readable"),e.emit("readable"),ZQ(e)}o(xDe,"emitReadable_");function XGt(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(function(){ZGt(e,t)}))}o(XGt,"maybeReadMore");function ZGt(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(ir("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}o(ZGt,"maybeReadMore_");vi.prototype._read=function(e){this.emit("error",new Error("not implemented"))};vi.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,ir("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?u:l;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",a);function a(g){ir("onunpipe"),g===r&&l()}o(a,"onunpipe");function u(){ir("onend"),e.end()}o(u,"onend");var c=eHt(r);e.on("drain",c);function l(){ir("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",l),r.removeListener("data",f),n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&c()}o(l,"cleanup"),r.on("data",f);function f(g){ir("ondata");var b=e.write(g);b===!1&&(ir("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,r.pause())}o(f,"ondata");function d(g){ir("onerror",g),h(),e.removeListener("error",d),GN.listenerCount(e,"error")===0&&e.emit("error",g)}o(d,"onerror"),!e._events||!e._events.error?e.on("error",d):KGt(e._events.error)?e._events.error.unshift(d):e._events.error=[d,e._events.error];function p(){e.removeListener("finish",m),h()}o(p,"onclose"),e.once("close",p);function m(){ir("onfinish"),e.removeListener("close",p),h()}o(m,"onfinish"),e.once("finish",m);function h(){ir("unpipe"),r.unpipe(e)}return o(h,"unpipe"),e.emit("pipe",r),n.flowing||(ir("pipe resume"),r.resume()),e};function eHt(e){return function(){var t=e._readableState;ir("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&GN.listenerCount(e,"data")&&(t.flowing=!0,ZQ(e))}}o(eHt,"pipeOnDrain");vi.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<n;i++)r[i].emit("unpipe",this);return this}var i=iHt(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)};vi.prototype.on=function(e,t){var r=XQ.prototype.on.call(this,e,t);if(e==="data"&&this._readableState.flowing!==!1&&this.resume(),e==="readable"&&this.readable){var n=this._readableState;if(!n.readableListening)if(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading)n.length&&HN(this,n);else{var i=this;process.nextTick(function(){ir("readable nexttick read 0"),i.read(0)})}}return r};vi.prototype.addListener=vi.prototype.on;vi.prototype.resume=function(){var e=this._readableState;return e.flowing||(ir("resume"),e.flowing=!0,e.reading||(ir("resume read 0"),this.read(0)),tHt(this,e)),this};function tHt(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(function(){rHt(e,t)}))}o(tHt,"resume");function rHt(e,t){t.resumeScheduled=!1,e.emit("resume"),ZQ(e),t.flowing&&!t.reading&&e.read(0)}o(rHt,"resume_");vi.prototype.pause=function(){return ir("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ir("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function ZQ(e){var t=e._readableState;if(ir("flow",t.flowing),t.flowing)do var r=e.read();while(r!==null&&t.flowing)}o(ZQ,"flow");vi.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;e.on("end",function(){if(ir("wrapped end"),t.decoder&&!t.ended){var a=t.decoder.end();a&&a.length&&n.push(a)}n.push(null)}),e.on("data",function(a){if(ir("wrapped data"),t.decoder&&(a=t.decoder.write(a)),!(!a||!t.objectMode&&!a.length)){var u=n.push(a);u||(r=!0,e.pause())}});for(var i in e)va.isFunction(e[i])&&va.isUndefined(this[i])&&(this[i]=function(a){return function(){return e[a].apply(e,arguments)}}(i));var s=["error","close","destroy","pause","resume"];return nHt(s,function(a){e.on(a,n.emit.bind(n,a))}),n._read=function(a){ir("wrapped _read",a),r&&(r=!1,e.resume())},n};vi._fromList=PDe;function PDe(e,t){var r=t.buffer,n=t.length,i=!!t.decoder,s=!!t.objectMode,a;if(r.length===0)return null;if(n===0)a=null;else if(s)a=r.shift();else if(!e||e>=n)i?a=r.join(""):a=JQ.concat(r,n),r.length=0;else if(e<r[0].length){var u=r[0];a=u.slice(0,e),r[0]=u.slice(e)}else if(e===r[0].length)a=r.shift();else{i?a="":a=new JQ(e);for(var c=0,l=0,f=r.length;l<f&&c<e;l++){var u=r[0],d=Math.min(e-c,u.length);i?a+=u.slice(0,d):u.copy(a,c,0,d),d<u.length?r[0]=u.slice(d):r.shift(),c+=d}}return a}o(PDe,"fromList");function YQ(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,process.nextTick(function(){!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}o(YQ,"endReadable");function nHt(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}o(nHt,"forEach");function iHt(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}o(iHt,"indexOf")});var t6=R((Aun,LDe)=>{"use strict";LDe.exports=rm;var e6=Mg(),kR=xo();kR.inherits=jt();kR.inherits(rm,e6);function oHt(e,t){this.afterTransform=function(r,n){return sHt(t,r,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}o(oHt,"TransformState");function sHt(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,kR.isNullOrUndefined(r)||e.push(r),i&&i(t);var s=e._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&e._read(s.highWaterMark)}o(sHt,"afterTransform");function rm(e){if(!(this instanceof rm))return new rm(e);e6.call(this,e),this._transformState=new oHt(e,this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",function(){kR.isFunction(this._flush)?this._flush(function(r){NDe(t,r)}):NDe(t)})}o(rm,"Transform");rm.prototype.push=function(e,t){return this._transformState.needTransform=!1,e6.prototype.push.call(this,e,t)};rm.prototype._transform=function(e,t,r){throw new Error("not implemented")};rm.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};rm.prototype._read=function(e){var t=this._transformState;!kR.isNull(t.writechunk)&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};function NDe(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("calling transform done when ws.length != 0");if(n.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}o(NDe,"done")});var BDe=R((Iun,FDe)=>{"use strict";FDe.exports=NR;var UDe=t6(),MDe=xo();MDe.inherits=jt();MDe.inherits(NR,UDe);function NR(e){if(!(this instanceof NR))return new NR(e);UDe.call(this,e)}o(NR,"PassThrough");NR.prototype._transform=function(e,t,r){r(null,e)}});var n6=R((Yf,r6)=>{"use strict";Yf=r6.exports=zQ();Yf.Stream=require("stream");Yf.Readable=Yf;Yf.Writable=KQ();Yf.Duplex=Mg();Yf.Transform=t6();Yf.PassThrough=BDe();!process.browser&&process.env.READABLE_STREAM==="disable"&&(r6.exports=require("stream"))});var jDe=R((xun,WDe)=>{"use strict";var aHt=jt(),qDe=n6().Writable;WDe.exports=LR;aHt(LR,qDe);function LR(e,t){if(!(this instanceof LR))return new LR(e);qDe.call(this,{objectMode:!0}),this.db=e,this.opts=t||{}}o(LR,"WriteStream");LR.prototype._write=function(e,t,r){if(Buffer.isBuffer(e)&&(e=e.toString()),typeof e=="string")try{e=JSON.parse(e)}catch(n){return r(n)}Array.isArray(e)?this.db.bulkDocs({docs:e},this.opts).then(function(){r()},r):"_id"in e?this.db.put(e,this.opts).then(function(){r()},r):this.db.post(e,this.opts).then(function(){r()},r)}});var GDe=R((Dun,VDe)=>{"use strict";var uHt=jt(),$De=n6().Readable;VDe.exports=Cw;uHt(Cw,$De);function Cw(e,t){if(!(this instanceof Cw))return new Cw(e,t);$De.call(this,{objectMode:!0}),t=t||{};var r=this.opts={since:0};Object.keys(t).forEach(function(n){r[n]=t[n]}),this.opts.returnDocs=!1,this.last=t.since,this.db=e,this.changes=void 0,this.canceled=!1}o(Cw,"ReadStream");Cw.prototype._read=function(){if(!this.changes){var e=this;this.opts.since=this.last,this.changes=this.db.changes(this.opts).on("complete",function(t){e.cancel=function(){},t.canceled||e.push(null)}),this.changes.on("change",function(t){e.last=t.seq;var r=e.push(t);r||e.changes.cancel()})}};Cw.prototype.cancel=function(){if(this.canceled=!0,this.changes&&typeof this.changes.cancel=="function")return this.changes.cancel()}});var KDe=R((kun,HDe)=>{"use strict";HDe.exports=function(e,t,r){e.on("newListener",function(n,i){~r.indexOf(n)&&t.on(n,i)}),e.on("removeListener",function(n,i){~r.indexOf(n)&&t.removeListener(n,i)})}});var zDe=R(UR=>{"use strict";var QDe=jDe(),cHt=GDe();UR.createReadStream=function(e){return e=e||{},new cHt(this,e)};UR.createWriteStream=function(e){return e=e||{},new QDe(this,e)};var lHt=KDe(),fHt=["drain","pipe","unpipe","error"];UR.write=function(e,t,r){return this.__stream||(this.__stream=new QDe(this),lHt(this,this.__stream,fHt),this.on("destroy",function(){this.__stream.end()})),this.__stream.write(e,t,r)};UR.end=function(){this.emit("done")}});var ZDe=R(nm=>{"use strict";var JDe=EQ(),dHt=uCe(),pHt=VQ(),YDe=DR().obj,mHt=cDe(),XDe=50;nm.adapters={};nm.adapters.writableStream=pDe();nm.plugin=zDe();nm.plugin.dump=JDe.toPromise(function(e,t,r){var n=this;typeof t=="function"&&(r=t,t={});var i=n.constructor,s=n.name||n._db_name,a=new i(s,{adapter:"writableStream"});a.setupStream(e);var u=n.info().then(function(l){var f={version:dHt,db_type:n.type(),start_time:new Date().toJSON(),db_info:l};return e.write(JSON.stringify(f)+`
7
- `),t.batch_size||(t.batch_size=XDe),n.replicate.to(a,t)}).then(function(){return a.close()}).then(function(){r(null,{ok:!0})});function c(l){r(l)}o(c,"onErr"),u.catch(c)});nm.plugin.load=JDe.toPromise(function(e,t,r){typeof t=="function"&&(r=t,t={});var n;"batch_size"in t?n=t.batch_size:n=XDe;var i=null,s=[];e.pipe(mHt()).pipe(pHt.parse()).on("error",function(a){i=a}).pipe(YDe(function(a,u,c){if(!a.docs)return c();a.docs.forEach(function(l){this.push(l)},this),c()})).pipe(YDe(function(a,u,c){s.push(a),s.length>=n&&(this.push(s),s=[]),c()},function(a){s.length&&this.push(s),a()})).pipe(this.createWriteStream({new_edits:!1})).on("error",r).on("finish",function(){r(i,{ok:!0})})});typeof window<"u"&&window.PouchDB&&(window.PouchDB.plugin(nm.plugin),window.PouchDB.adapter("writableStream",nm.adapters.writableStream))});function KN(e){e0e=i6(e),t0e=!0}function pu(e,t){hHt();let r=new e0e(e,t),n=r.put;return r.put=async(i,s={})=>(i.createdAt||(i.createdAt=new Date().toISOString()),i.updatedAt=new Date().toISOString(),n(i,s)),r.exists=async()=>!(await r.info()).error,r}async function MR(e){if(!(!e||U.isTest()))try{return await e.close()}catch{}}var Fg,e0e,t0e,i6,hHt,o6=y(()=>{"use strict";Fg=q(require("pouchdb"));tt();qA();t0e=!1,i6=o((e={})=>{let{url:t,cookie:r}=fc(),n={prefix:t,fetch:(i,s)=>(s.headers.set("Authorization",r),Fg.default.fetch(i,s))};if(e.inMemory){let i=Kxe();Fg.default.plugin(i),n={adapter:"memory"}}if(e.onDisk&&(n={adapter:"leveldb"}),e.replication){let i=ZDe();Fg.default.plugin(i.plugin),Fg.default.adapter("writableStream",i.adapters.writableStream)}if(e.find){let i=require("pouchdb-find");Fg.default.plugin(i)}return Fg.default.defaults(n)},"getPouch");o(KN,"init");hHt=o(()=>{if(!t0e)throw new Error("init has not been called")},"checkInitialised");o(pu,"getPouchDB");o(MR,"closePouchDB")});var Bn,Dw,s6=y(()=>{"use strict";Bn=q(require("dd-trace")),Dw=class{constructor(t){this.db=t}static{o(this,"DDInstrumentedDatabase")}get name(){return this.db.name}exists(t){return Bn.default.trace("db.exists",r=>(r.addTags({db_name:this.name,doc_id:t}),t?this.db.exists(t):this.db.exists()))}get(t){return Bn.default.trace("db.get",r=>(r.addTags({db_name:this.name,doc_id:t}),this.db.get(t)))}tryGet(t){return Bn.default.trace("db.tryGet",async r=>{r.addTags({db_name:this.name,doc_id:t});let n=await this.db.tryGet(t);return r.addTags({doc_found:n!==void 0}),n})}getMultiple(t,r){return Bn.default.trace("db.getMultiple",async n=>{n.addTags({db_name:this.name,num_docs:t?.length||0,allow_missing:r?.allowMissing});let i=await this.db.getMultiple(t,r);return n.addTags({num_docs_found:i.length}),i})}remove(t,r){return Bn.default.trace("db.remove",async n=>{n.addTags({db_name:this.name,doc_id:t,rev:r});let i=typeof t=="object",s=i?t._id:t;r=i?t._rev:r;let a=await this.db.remove(s,r);return n.addTags({ok:a.ok}),a})}bulkRemove(t,r){return Bn.default.trace("db.bulkRemove",n=>(n.addTags({db_name:this.name,num_docs:t.length,silence_errors:r?.silenceErrors}),this.db.bulkRemove(t,r)))}put(t,r){return Bn.default.trace("db.put",async n=>{n.addTags({db_name:this.name,doc_id:t._id,force:r?.force,return_doc:r?.returnDoc});let i=await this.db.put(t,r);return n.addTags({ok:i.ok}),i})}bulkDocs(t){return Bn.default.trace("db.bulkDocs",r=>(r.addTags({db_name:this.name,num_docs:t.length}),this.db.bulkDocs(t)))}async find(t){return Bn.default.trace("db.find",async r=>{r.addTags({db_name:this.name,...t});let n=await this.db.find(t);return r.addTags({rows_length:n.docs.length}),n})}allDocs(t){return Bn.default.trace("db.allDocs",async r=>{r.addTags({db_name:this.name,...t});let n=await this.db.allDocs(t);return r.addTags({total_rows:n.total_rows,rows_length:n.rows.length,offset:n.offset}),n})}query(t,r){return Bn.default.trace("db.query",async n=>{n.addTags({db_name:this.name,view_name:t,...r});let i=await this.db.query(t,r);return n.addTags({total_rows:i.total_rows,rows_length:i.rows.length,offset:i.offset}),i})}destroy(){return Bn.default.trace("db.destroy",async t=>{t.addTags({db_name:this.name});let r=await this.db.destroy();return t.addTags({ok:r.ok}),r})}compact(){return Bn.default.trace("db.compact",async t=>{t.addTags({db_name:this.name});let r=await this.db.compact();return t.addTags({ok:r.ok}),r})}dump(t,r){return Bn.default.trace("db.dump",n=>(n.addTags({db_name:this.name,batch_limit:r?.batch_limit,batch_size:r?.batch_size,style:r?.style,timeout:r?.timeout,num_doc_ids:r?.doc_ids?.length,view:r?.view}),this.db.dump(t,r)))}load(...t){return Bn.default.trace("db.load",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.load(...t)))}createIndex(...t){return Bn.default.trace("db.createIndex",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.createIndex(...t)))}deleteIndex(...t){return Bn.default.trace("db.deleteIndex",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.deleteIndex(...t)))}getIndexes(...t){return Bn.default.trace("db.getIndexes",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.getIndexes(...t)))}sql(t,r){return Bn.default.trace("db.sql",async n=>{n.addTags({db_name:this.name,num_bindings:r?.length});let i=await this.db.sql(t,r);return n.addTags({num_rows:i.length}),i})}sqlPurgeDocument(t){return Bn.default.trace("db.sqlPurgeDocument",r=>(r.addTags({db_name:this.name,num_docs:Array.isArray(t)?t.length:1}),this.db.sqlPurgeDocument(t)))}sqlDiskCleanup(){return Bn.default.trace("db.sqlDiskCleanup",t=>(t.addTags({db_name:this.name}),this.db.sqlDiskCleanup()))}}});var m6={};G(m6,{breakExternalTableId:()=>c6,breakRowIdField:()=>OHt,buildExternalTableId:()=>vHt,convertRowId:()=>IHt,encodeTableId:()=>SHt,encodeViewId:()=>THt,extractDate:()=>f6,generateRowIdField:()=>AHt,getNativeSql:()=>Pw,isExternalTable:()=>u6,isExternalTableID:()=>QN,isInternalTableID:()=>EHt,isRowId:()=>RHt,isValidFilter:()=>YN,isValidISODateString:()=>zN,isValidISODateStringWithoutTimezone:()=>l6,isValidTime:()=>d6,sqlLog:()=>FR,validateManyToMany:()=>p6});function QN(e){return e.startsWith("datasource"+fe)}function EHt(e){return!QN(e)}function Pw(e){let t=e.toSQL();if(Array.isArray(t))return t;let r;return t.toNative&&(r=t.toNative()),{sql:r?.sql||t.sql,bindings:r?.bindings||t.bindings}}function u6(e){return e?.sourceId&&e.sourceId.includes("datasource"+fe)&&e?.sourceId!==qT||e?.sourceType==="external"?!0:!!(e?._id&&QN(e._id))}function vHt(e,t){return`${e}${a6}${encodeURIComponent(t)}`}function SHt(e){return QN(e)?encodeURIComponent(e):e}function THt(e){return encodeURIComponent(e)}function c6(e){let t=e.split(a6),r=t.shift(),n=t.join(a6);if(n.includes(gHt)&&(n=decodeURIComponent(n)),!r||!n)throw new Error("Unable to get datasource/table name from table ID");return{datasourceId:r,tableName:n}}function AHt(e=[]){Array.isArray(e)||(e=[e]);for(let t in e)e[t]instanceof Buffer&&(e[t]=e[t].toString());return encodeURIComponent(JSON.stringify(e).replace(/"/g,"'"))}function RHt(e){return Array.isArray(e)||typeof e=="string"&&e.match(r0e)!=null}function IHt(e){return Array.isArray(e)?e[0]:typeof e=="string"&&e.match(r0e)!=null?e.substring(1,e.length-1):e}function OHt(e){if(!e)return[];let t=typeof e=="string"?e:e._id,r=decodeURIComponent(t).replace(/'/g,'"');try{let n=JSON.parse(r);return Array.isArray(n)?n:[n]}catch{return[e]}}function zN(e){let t=e.trim();if(!yHt.test(t))return!1;let r=new Date(t);return!isNaN(r.getTime())}function l6(e){let t=e.trim();if(!bHt.test(t))return!1;let r=new Date(t);return!isNaN(r.getTime())}function f6(e){let t=e.match(_Ht);if(t)return t[0]}function YN(e){return e!=null&&e!==""}function d6(e){return wHt.test(e)}function FR(e,t,r){if(!U.SQL_LOGGING_ENABLE)return;let n=`[SQL] [${e.toUpperCase()}] query="${t}"`;r&&(n+=` values="${r.join(", ")}"`),console.log(n)}function xHt(e){return!!e.through&&!!e.fromPrimary&&!!e.from&&!!e.toPrimary&&!!e.to}function p6(e){if(xHt(e))return e}var a6,r0e,gHt,yHt,bHt,_Ht,wHt,BR=y(()=>{"use strict";P();pr();tt();a6=`${fe}${fe}`,r0e=/^\[.*]$/g,gHt=encodeURIComponent(" "),yHt=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}:\d{2}(?:.\d{3})?Z)?$/,bHt=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}:\d{2}(?:.\d{3})?)?$/,_Ht=/(\d{4}-\d{2}-\d{2})/,wHt=/^(?:\d{2}:)?(?:\d{2}:)(?:\d{2})$/;o(QN,"isExternalTableID");o(EHt,"isInternalTableID");o(Pw,"getNativeSql");o(u6,"isExternalTable");o(vHt,"buildExternalTableId");o(SHt,"encodeTableId");o(THt,"encodeViewId");o(c6,"breakExternalTableId");o(AHt,"generateRowIdField");o(RHt,"isRowId");o(IHt,"convertRowId");o(OHt,"breakRowIdField");o(zN,"isValidISODateString");o(l6,"isValidISODateStringWithoutTimezone");o(f6,"extractDate");o(YN,"isValidFilter");o(d6,"isValidTime");o(FR,"sqlLog");o(xHt,"isValidManyToManyRelationship");o(p6,"validateManyToMany")});function i0e(e){return(0,o0e.default)({url:e.url,requestDefaults:{headers:{Authorization:e.cookie}},parseUrl:!1})}function CHt(e,t,r){if(!e||!t)throw new Error("Unable to create database without database name or connection");let n=new kw(e,r,t);return new Dw(n)}var o0e,n0e,im,kw,s0e=y(()=>{"use strict";o0e=q(require("@budibase/nano"));P();qA();v3();o6();Vk();pr();s6();w3();BR();n0e="Database does not exist.";o(i0e,"buildNano");im=class extends Error{constructor(r,n){super(r);let i=n.status||n.statusCode||500;this.status=i,this.statusCode=i,this.reason=n.reason||"Unknown",this.name=n.name,this.errid=n.errid||"Unknown",this.description=n.description||"Unknown",this.error=n.error||"Not found"}static{o(this,"CouchDBError")}};o(CHt,"DatabaseWithConnection");kw=class e{constructor(t,r,n){this.couchInfo=fc();this.name=t,this.pouchOpts=r||{},n&&(this.couchInfo=fc(n),this.instanceNano=i0e(this.couchInfo)),e.nano||e.init()}static{o(this,"DatabaseImpl")}static init(){let t=fc();e.nano=i0e(t)}exists(t){return t===void 0?this.dbExists():this.docExists(t)}async dbExists(){return(await WA({url:`${this.couchInfo.url}/${this.name}`,method:"HEAD",cookie:this.couchInfo.cookie})).status===200}async docExists(t){try{return await this.performCall(r=>()=>r.head(t)),!0}catch{return!1}}nano(){return this.instanceNano||e.nano}getDb(){return this.nano().db.use(this.name)}async checkAndCreateDb(){let t=!this.pouchOpts?.skip_setup,r=await this.exists();if(!t&&!r)throw new Error("DB does not exist");if(!r)try{await this.nano().db.create(this.name)}catch(n){if(n.statusCode!==412)throw new im(n.message,n)}return this.getDb()}async performCallWithDBCreation(t){let r=this.getDb(),n=await t(r);try{return await n()}catch(i){if(i.statusCode===404&&i.reason===n0e)return await this.checkAndCreateDb(),await this.performCallWithDBCreation(t);throw new im(`CouchDB error: ${i.message}`,i)}}async performCall(t){let r=this.getDb(),n=await t(r);try{return await n()}catch(i){throw new im(`CouchDB error: ${i.message}`,i)}}async get(t){return this.performCall(r=>{if(!t)throw new Error("Unable to get doc without a valid _id.");return()=>r.get(t)})}async tryGet(t){try{return await this.get(t)}catch(r){if(r.statusCode===404)return;throw r}}async getMultiple(t,r){if(!t||t.length===0)return[];t=[...new Set(t)];let n=!r?.excludeDocs,i=await this.allDocs({keys:t,include_docs:n}),s=o(c=>n&&c.doc==null||c.value&&"deleted"in c.value&&c.value.deleted?!0:c.error==="not_found","rowUnavailable"),a=i.rows.filter(c=>!s(c)),u=a.length!==i.rows.length;if(!r?.allowMissing&&u){let l=i.rows.filter(f=>s(f)).map(f=>f.key).join(", ");throw new Error(`Unable to get bulk documents: ${l}`)}return a.map(c=>n?c.doc:c.value)}async remove(t,r){return this.performCall(n=>{let i,s;if(Lge(t)?(i=t._id,s=t._rev):(i=t,s=r),!i||!s)throw new Error("Unable to remove doc without a valid _id and _rev.");return()=>n.destroy(i,s)})}async bulkRemove(t,r){let n=await this.performCall(a=>()=>a.bulk({docs:t.map(u=>({...u,_deleted:!0}))}));if(r?.silenceErrors)return;let i=!1,s="Unable to bulk remove documents: ";for(let a of n)a.error&&(i=!0,s+=a.error);if(i)throw new im(s,{name:this.name,status:400})}async post(t,r){return t._id||(t._id=yr()),this.put(t,r)}async put(t,r){if(!t._id)throw new Error("Cannot store document without _id field.");return this.performCallWithDBCreation(async n=>{if(t.createdAt||(t.createdAt=new Date().toISOString()),t.updatedAt=new Date().toISOString(),r?.force&&t._id)try{let i=await this.get(t._id);i&&(t._rev=i._rev)}catch(i){if(i.status!==404)throw i}return async()=>{let i=await n.insert(t);return r?.returnDoc?{...i,doc:{...t,_rev:i.rev}}:i}})}async bulkDocs(t){let r=new Date().toISOString();return this.performCallWithDBCreation(n=>()=>n.bulk({docs:t.map(i=>({createdAt:r,...i,updatedAt:r}))}))}async find(t){return this.performCall(r=>async()=>r.find(t))}async allDocs(t){return this.performCall(r=>async()=>{try{return await r.list(t)}catch(n){if(n.reason===n0e)return{offset:0,total_rows:0,rows:[]};throw n}})}async _sqlQuery(t,r,n){t=Hk(`${this.couchInfo.sqlUrl}/${t}`);let i={url:t,method:r,cookie:this.couchInfo.cookie};return n&&(i.body=n),this.performCall(()=>async()=>{let s=await WA(i),a=await s.text();if(s.status>300){let u;try{u=JSON.parse(a)}catch{throw console.error(`SQS error: ${a}`),new im("error while running SQS query, please try again later",{name:"sqs_error",status:s.status})}throw u}return JSON.parse(a)})}async sql(t,r){let i=`/${this.name}/${no}`;return FR("sqlite3",t,r),await this._sqlQuery(i,"POST",{query:t,args:r})}async sqlDiskCleanup(){let r=`/${this.name}/_cleanup`;try{await this._sqlQuery(r,"POST")}catch(n){if(n.status!==500)throw n}}async sqlPurgeDocument(t){Array.isArray(t)||(t=[t]);let n=`/${this.name}/_purge`;return await this._sqlQuery(n,"POST",{docs:t})}async query(t,r){return this.performCall(n=>{let[i,s]=t.split("/");return()=>n.view(i,s,r)})}async destroy(){if(await this.exists(no)){let t=await this.get(no);t.sql.tables={},await this.put(t),await this.sqlDiskCleanup()}try{return await this.nano().db.destroy(this.name)}catch(t){if(t.statusCode===404)return{ok:!0};throw new im(t.message,t)}}async compact(){return this.performCall(t=>()=>t.compact())}async dump(t,r){return pu(this.name).dump(t,r)}async load(t){return pu(this.name).load(t)}async createIndex(t){return pu(this.name).createIndex(t)}async deleteIndex(t){return pu(this.name).deleteIndex(t)}async getIndexes(){return pu(this.name).getIndexes()}}});var qR=y(()=>{"use strict";qA();s0e();v3();o6()});function ns(e,t){return new Dw(new kw(e,t))}async function Sa(e,t,r){let n=ns(e,r);return await t(n)}async function h6(e){let t="/_all_dbs";return e&&(t+=`?${e}`),await E3(t)}var Nw=y(()=>{"use strict";qR();s6();o(ns,"getDB");o(Sa,"doWithDB");o(h6,"directCouchAllDbs")});function om(e){if(!e)throw g6;return e.startsWith(cc)}function DHt(e){if(!e)throw g6;return e.startsWith(uc)&&!om(e)}function WR(e){if(!e)throw g6;return om(e.appId)}function JN(e){if(!e||e.startsWith(cc))return e;let t=e.split(uc);t.shift();let r=t.join(uc);return`${cc}${r}`}function Ta(e){if(!e||!e.startsWith(cc))return e;let t=e.split(cc);t.shift();let r=t.join(cc);return`${uc}${r}`}var g6,jR=y(()=>{"use strict";pr();g6="No app provided";o(om,"isDevWorkspaceID");o(DHt,"isProdWorkspaceID");o(WR,"isDevWorkspace");o(JN,"getDevWorkspaceID");o(Ta,"getProdWorkspaceID")});var a0e,li,u0e=y(()=>{"use strict";a0e=require("async_hooks"),li=class e{static{o(this,"Context")}static{this.storage=new a0e.AsyncLocalStorage}static run(t,r){return e.storage.run(t,()=>r())}static get(){return e.storage.getStore()}}});function Bg(e){return e||(e=rt()),$R(e)}function l0e(e){return e||(e=rt()),e===Mn?Vr.AUDIT_LOGS.name:`${e}${fe}${Vr.AUDIT_LOGS.name}`}function kHt(e){return e||(e=rt()),e===Mn?Vr.SCIM_LOGS.name:`${e}${fe}${Vr.SCIM_LOGS.name}`}function $R(e){return!e||e===Mn?Vr.GLOBAL.name:`${e}${fe}${Vr.GLOBAL.name}`}function y6(){return U.PLATFORM_URL}function sm(){return!!U.MULTI_TENANCY}function NHt(){return!!li.get()?.tenantId}function LHt(){return U.MULTI_TENANCY}function Lw(e){if(!e)return;if(!sm())return Mn;let t=e.split(fe),r=t[1]==="dev";if(!(r&&t.length===3||!r&&t.length===2))return r?t[2]:t[1]}function UHt(e){let t;try{t=li.get()}catch{t={}}return t={...t,...e},t}async function hc(e,t){$Ht();let r=UHt(e);return li.run(r,t)}async function MHt(e){return await d0e(),await hc({tenantId:Lw(e.workspaceId),appId:e.workspaceId,automationId:e.automationId},e.task)}async function b6(e,t){let r=Lw(e);return hc({tenantId:r,appId:e},t)}async function is(e,t){return U.MULTI_TENANCY||(e=e||Mn),hc(e?{tenantId:e}:{},t)}async function FHt(e,t){return hc({tenantId:e,isSelfHostUsingCloud:!0},t)}async function BHt(e,t){return hc({license:e},t)}function qHt(){return li.get()?.license}function XN(){return!!li.get()?.isSelfHostUsingCloud}function WHt(){let e=li.get();if(!e||!e.isSelfHostUsingCloud)throw new Error("Self-host cloud DB not found");return ns(Vr.SELF_HOST_CLOUD.name)}async function jHt(e,t){return f0e(e,t)}async function f0e(e,t,r){if(!e)throw new Error("workspaceId is required");let n=Lw(e),i={appId:e,...r};return n&&(i.tenantId=n),hc(i,t)}async function BA(e,t){if(!e)throw new Error("identity is required");let r={identity:e};return e.tenantId&&(r.tenantId=e.tenantId),hc(r,t)}function $Ht(){if(li.get()?.isMigrating)throw new Error("The context cannot be changed, a migration is currently running")}async function VHt(e,t){return f0e(e,t,{isMigrating:!0})}function jf(){try{return li.get()?.identity}catch{}}function rt(){if(!sm())return Mn;let t=li.get()?.tenantId;if(!t)throw new Error("Tenant id not found");return t}function _6(){return li.get()?.automationId}function os(){let t=li.get()?.appId;return!t&&U.isTest()&&c0e?c0e:t}function GHt(){let e=os();if(!e)throw new Error("Workspace id not set");return e}function w6(){return li.get()?.ip}function QHt(e,t){if(!e)throw new Error("Must supply environment variables.");return hc({environmentVariables:e},t)}function zHt(e){return hc({isScim:!0},e)}function E6(e,t){return hc({ip:e},t)}async function d0e(){let e=qg();if(!e||e.snippets)return;let t,r=Uw();r&&(t=(await r.tryGet("app_metadata"))?.snippets),e.snippets=t||[]}function YHt(){let e=li.get();return e.environmentVariables?e.environmentVariables:null}function Qt(){let e=li.get();if(!e||U.MULTI_TENANCY&&!e.tenantId)throw new Error("Global DB not found");if(e.isSelfHostUsingCloud)throw new Error("Global DB not found - self-host users using cloud don't have a global DB");return ns($R(e?.tenantId))}function JHt(){if(!rt())throw new Error("No tenant ID found - cannot open audit log DB");return ns(l0e())}function Uw(e){let t=os();if(!t)throw new Error("Unable to retrieve workspace DB - no workspace ID.");if(XN())throw new Error("Workspace DB not found - self-host users using cloud don't have workspace DBs");return ns(t,e)}function XHt(e){let t=os();if(!t)throw new Error("Unable to retrieve prod DB - no workspace ID.");return ns(Ta(t),e)}function ZHt(e){let t=os();if(!t)throw new Error("Unable to retrieve dev DB - no workspace ID.");return ns(JN(t),e)}function gc(){return!!li.get()?.isScim}function qg(){try{return li.get()}catch{return}}function v6(e){let t=qg();if(t)return t.featureFlagCache?.[e]}function S6(e,t){let r=qg();r&&(r.featureFlagCache??={},r.featureFlagCache[e]=t)}function T6(){return qg()?.featureFlagOverrides||{}}async function A6(e,t){return await hc({featureFlagOverrides:e},t)}function e4t(e){let t=qg();if(t)return t.viewToTableCache?.[e]}function t4t(e,t){let r=qg();r&&(r.viewToTableCache??={},r.viewToTableCache[e]=t)}var c0e,HHt,KHt,p0e=y(()=>{"use strict";pr();Nw();jR();tt();u0e();c0e=null;o(Bg,"getGlobalDBName");o(l0e,"getAuditLogDBName");o(kHt,"getScimDBName");o($R,"baseGlobalDBName");o(y6,"getPlatformURL");o(sm,"isMultiTenant");o(NHt,"isTenantIdSet");o(LHt,"isTenancyEnabled");o(Lw,"getTenantIDFromWorkspaceID");o(UHt,"updateContext");o(hc,"newContext");o(MHt,"doInAutomationContext");o(b6,"doInContext");o(is,"doInTenant");o(FHt,"doInSelfHostTenantUsingCloud");o(BHt,"doInLicenseContext");o(qHt,"getLicense");o(XN,"isSelfHostUsingCloud");o(WHt,"getSelfHostCloudDB");o(jHt,"doInWorkspaceContext");o(f0e,"_doInWorkspaceContext");o(BA,"doInIdentityContext");o($Ht,"guardMigration");o(VHt,"doInWorkspaceMigrationContext");o(jf,"getIdentity");o(rt,"getTenantId");o(_6,"getAutomationId");o(os,"getWorkspaceId");o(GHt,"getOrThrowWorkspaceId");o(w6,"getIP");HHt=o(()=>{let e=os();if(!e)throw new Error("Could not get workspaceId");return JN(e)},"getDevWorkspaceId"),KHt=o(()=>{let e=os();if(!e)throw new Error("Could not get workspaceId");return Ta(e)},"getProdWorkspaceId");o(QHt,"doInEnvironmentContext");o(zHt,"doInScimContext");o(E6,"doInIPContext");o(d0e,"ensureSnippetContext");o(YHt,"getEnvironmentVariables");o(Qt,"getGlobalDB");o(JHt,"getAuditLogsDB");o(Uw,"getWorkspaceDB");o(XHt,"getProdWorkspaceDB");o(ZHt,"getDevWorkspaceDB");o(gc,"isScim");o(qg,"getCurrentContext");o(v6,"getFeatureFlags");o(S6,"setFeatureFlags");o(T6,"getFeatureFlagOverrides");o(A6,"doInFeatureFlagOverrideContext");o(e4t,"getTableForView");o(t4t,"setTableForView")});var I={};G(I,{DEFAULT_TENANT_ID:()=>Mn,baseGlobalDBName:()=>$R,doInAutomationContext:()=>MHt,doInContext:()=>b6,doInEnvironmentContext:()=>QHt,doInFeatureFlagOverrideContext:()=>A6,doInIPContext:()=>E6,doInIdentityContext:()=>BA,doInLicenseContext:()=>BHt,doInScimContext:()=>zHt,doInSelfHostTenantUsingCloud:()=>FHt,doInTenant:()=>is,doInWorkspaceContext:()=>jHt,doInWorkspaceMigrationContext:()=>VHt,ensureSnippetContext:()=>d0e,getAuditLogDBName:()=>l0e,getAuditLogsDB:()=>JHt,getAutomationId:()=>_6,getCurrentContext:()=>qg,getDevWorkspaceDB:()=>ZHt,getDevWorkspaceId:()=>HHt,getEnvironmentVariables:()=>YHt,getFeatureFlagOverrides:()=>T6,getFeatureFlags:()=>v6,getGlobalDB:()=>Qt,getGlobalDBName:()=>Bg,getIP:()=>w6,getIdentity:()=>jf,getLicense:()=>qHt,getOrThrowWorkspaceId:()=>GHt,getPlatformURL:()=>y6,getProdWorkspaceDB:()=>XHt,getProdWorkspaceId:()=>KHt,getScimDBName:()=>kHt,getSelfHostCloudDB:()=>WHt,getTableForView:()=>e4t,getTenantIDFromWorkspaceID:()=>Lw,getTenantId:()=>rt,getWorkspaceDB:()=>Uw,getWorkspaceId:()=>os,identity:()=>FA,isMultiTenant:()=>sm,isScim:()=>gc,isSelfHostUsingCloud:()=>XN,isTenancyEnabled:()=>LHt,isTenantIdSet:()=>NHt,setFeatureFlags:()=>S6,setTableForView:()=>t4t});var yt=y(()=>{"use strict";pr();Gk();p0e()});async function r4t(e=0){return await ZN.tracer.trace("Redis.init",async t=>{if(U.MOCK_REDIS)return t.addTags({mock:!0}),new m0e(_g());let r;if(U.REDIS_CLUSTERED){t.addTags({clustered:!0});let{host:n,port:i}=jk();r=new eL.Cluster([{host:n,port:i}],f3())}else r=new eL.default(_g());return new Promise((n,i)=>{r.on("error",s=>{t.addTags({error:!0}),console.error(`failed to connect to redis (db: ${e})`,s),i(s)}),r.on("reconnecting",()=>{console.log(`Redis reconnecting... (db: ${e})`)}),r.on("ready",()=>{t.addTags({connected:!0}),console.log(`Redis ready to receive commands (db: ${e})`),n(r)})})})}function n4t(e,t){return new Promise((r,n)=>{let i=new Set;e.on("data",s=>s.forEach(a=>i.add(a))),e.on("error",s=>n(s)),e.on("end",async()=>{try{let s=Array.from(i).map(async a=>{let u=await t.get(a);return u&&(u=JSON.parse(u)),{key:d3(a),value:u}});r(await Promise.all(s))}catch(s){n(s)}})})}function i4t(e){return e.isCluster}var eL,ZN,h0e,m0e,R6,so,I6=y(()=>{"use strict";tt();eL=q(require("ioredis"));J_();ZN=require("dd-trace"),h0e=require("lodash");if(U.MOCK_REDIS)try{m0e=require("ioredis-mock")}catch{console.log("Mock redis unavailable")}o(r4t,"init");o(n4t,"promisifyStream");o(i4t,"isCluster");R6=class e{static{o(this,"RedisWrapper")}constructor(t,r){this.client=t,this.db=r}static async init(t,r=0){return await ZN.tracer.trace("RedisWrapper.init",async n=>{let i=await r4t(r);return r&&!U.isTest()&&(n.addTags({db:t}),i.select(r)),new e(i,t)})}trace(t,r){return ZN.tracer.trace(t,async n=>(n.addTags({db:this.db}),await r(n)))}prefixed(t){return t.includes(this.db)?t:`${this.db}${Y_}${t}`}async finish(){return await this.trace("RedisWrapper.finish",async()=>{await this.client.quit()})}async scan(t=""){return await this.trace("RedisWrapper.scan",async r=>{r.addTags({key:t}),t=`${this.db}${Y_}${t}`;let n;i4t(this.client)?n=this.client.nodes("master")[0].scanStream({match:t+"*",count:100}):n=this.client.scanStream({match:t+"*",count:100});let i=await n4t(n,this.client);return r.addTags({numKeysFound:i.length}),i})}async keys(t){return await this.trace("RedisWrapper.keys",async r=>(r.addTags({pattern:t}),this.client.keys(this.prefixed(t))))}async exists(t){return await this.trace("RedisWrapper.exists",async r=>(r.addTags({key:t}),await this.client.exists(this.prefixed(t))))}async get(t){return await this.trace("RedisWrapper.get",async r=>{r.addTags({key:t});let n=await this.client.get(this.prefixed(t));n!=null&&n.key&&(n.key=t);try{return JSON.parse(n)}catch{return n}})}async bulkGet(t){return await this.trace("RedisWrapper.bulkGet",async r=>{if(r.addTags({numKeys:t.length}),t.length===0)return{};let n=await this.client.mget(t.map(i=>this.prefixed(i)));return r.addTags({numKeysFound:n.length}),(0,h0e.zip)(t,n).reduce((i,[s,a])=>{if(s===void 0||a===void 0)throw new Error(`Keys and response length mismatch: ${t.length} vs ${n.length}`);try{i[s]=a?JSON.parse(a):null}catch{i[s]=a}return i},{})})}async store(t,r,n=null){return await this.trace("RedisWrapper.store",async i=>{i.addTags({key:t,expirySeconds:n}),typeof r=="object"&&(r=JSON.stringify(r)),await this.client.set(this.prefixed(t),r),n&&await this.client.expire(this.prefixed(t),n)})}async bulkStore(t,r=null){return await this.trace("RedisWrapper.bulkStore",async n=>{n.addTags({numKeys:Object.keys(t).length,expirySeconds:r});let i=Object.entries(t).reduce((a,[u,c])=>(a[this.prefixed(u)]=typeof c=="object"?JSON.stringify(c):c,a),{}),s=this.client.pipeline();if(s.mset(i),r!==null)for(let a of Object.keys(i))s.expire(a,r);await s.exec()})}async getTTL(t){return await this.trace("RedisWrapper.getTTL",async r=>(r.addTags({key:t}),await this.client.ttl(this.prefixed(t))))}async setExpiry(t,r){return await this.trace("RedisWrapper.setExpiry",async n=>(n.addTags({key:t,expirySeconds:r}),await this.client.expire(this.prefixed(t),r)))}async delete(t){return await this.trace("RedisWrapper.delete",async r=>{r.addTags({key:t}),await this.client.del(this.prefixed(t))})}async bulkDelete(t){return await this.trace("RedisWrapper.bulkDelete",async r=>{r.addTags({numKeys:t.length}),await this.client.del(t.map(n=>this.prefixed(n)))})}async clear(){return await this.trace("RedisWrapper.clear",async t=>{let r=await this.scan();t.addTags({numKeys:r.length}),await Promise.all(r.map(n=>this.delete(n.key)))})}async increment(t){return await this.trace("RedisWrapper.increment",async r=>{r.addTags({key:t});let n=await this.client.incr(this.prefixed(t));if(isNaN(n))throw new Error(`Redis ${t} does not contain a number`);return n})}async deleteIfValue(t,r){return await this.trace("RedisWrapper.deleteIfValue",async n=>{n.addTags({key:t});let i=`
7
+ `),t.batch_size||(t.batch_size=XDe),n.replicate.to(a,t)}).then(function(){return a.close()}).then(function(){r(null,{ok:!0})});function c(l){r(l)}o(c,"onErr"),u.catch(c)});nm.plugin.load=JDe.toPromise(function(e,t,r){typeof t=="function"&&(r=t,t={});var n;"batch_size"in t?n=t.batch_size:n=XDe;var i=null,s=[];e.pipe(mHt()).pipe(pHt.parse()).on("error",function(a){i=a}).pipe(YDe(function(a,u,c){if(!a.docs)return c();a.docs.forEach(function(l){this.push(l)},this),c()})).pipe(YDe(function(a,u,c){s.push(a),s.length>=n&&(this.push(s),s=[]),c()},function(a){s.length&&this.push(s),a()})).pipe(this.createWriteStream({new_edits:!1})).on("error",r).on("finish",function(){r(i,{ok:!0})})});typeof window<"u"&&window.PouchDB&&(window.PouchDB.plugin(nm.plugin),window.PouchDB.adapter("writableStream",nm.adapters.writableStream))});function KN(e){e0e=i6(e),t0e=!0}function pu(e,t){hHt();let r=new e0e(e,t),n=r.put;return r.put=async(i,s={})=>(i.createdAt||(i.createdAt=new Date().toISOString()),i.updatedAt=new Date().toISOString(),n(i,s)),r.exists=async()=>!(await r.info()).error,r}async function MR(e){if(!(!e||U.isTest()))try{return await e.close()}catch{}}var Fg,e0e,t0e,i6,hHt,o6=y(()=>{"use strict";Fg=q(require("pouchdb"));tt();qA();t0e=!1,i6=o((e={})=>{let{url:t,cookie:r}=fc(),n={prefix:t,fetch:(i,s)=>(s.headers.set("Authorization",r),Fg.default.fetch(i,s))};if(e.inMemory){let i=Kxe();Fg.default.plugin(i),n={adapter:"memory"}}if(e.onDisk&&(n={adapter:"leveldb"}),e.replication){let i=ZDe();Fg.default.plugin(i.plugin),Fg.default.adapter("writableStream",i.adapters.writableStream)}if(e.find){let i=require("pouchdb-find");Fg.default.plugin(i)}return Fg.default.defaults(n)},"getPouch");o(KN,"init");hHt=o(()=>{if(!t0e)throw new Error("init has not been called")},"checkInitialised");o(pu,"getPouchDB");o(MR,"closePouchDB")});var Bn,Dw,s6=y(()=>{"use strict";Bn=q(require("dd-trace")),Dw=class{constructor(t){this.db=t}static{o(this,"DDInstrumentedDatabase")}get name(){return this.db.name}exists(t){return Bn.default.trace("db.exists",r=>(r.addTags({db_name:this.name,doc_id:t}),t?this.db.exists(t):this.db.exists()))}get(t){return Bn.default.trace("db.get",r=>(r.addTags({db_name:this.name,doc_id:t}),this.db.get(t)))}tryGet(t){return Bn.default.trace("db.tryGet",async r=>{r.addTags({db_name:this.name,doc_id:t});let n=await this.db.tryGet(t);return r.addTags({doc_found:n!==void 0}),n})}getMultiple(t,r){return Bn.default.trace("db.getMultiple",async n=>{n.addTags({db_name:this.name,num_docs:t?.length||0,allow_missing:r?.allowMissing});let i=await this.db.getMultiple(t,r);return n.addTags({num_docs_found:i.length}),i})}remove(t,r){return Bn.default.trace("db.remove",async n=>{n.addTags({db_name:this.name,doc_id:t,rev:r});let i=typeof t=="object",s=i?t._id:t;r=i?t._rev:r;let a=await this.db.remove(s,r);return n.addTags({ok:a.ok}),a})}bulkRemove(t,r){return Bn.default.trace("db.bulkRemove",n=>(n.addTags({db_name:this.name,num_docs:t.length,silence_errors:r?.silenceErrors}),this.db.bulkRemove(t,r)))}put(t,r){return Bn.default.trace("db.put",async n=>{n.addTags({db_name:this.name,doc_id:t._id,force:r?.force,return_doc:r?.returnDoc});let i=await this.db.put(t,r);return n.addTags({ok:i.ok}),i})}bulkDocs(t){return Bn.default.trace("db.bulkDocs",r=>(r.addTags({db_name:this.name,num_docs:t.length}),this.db.bulkDocs(t)))}async find(t){return Bn.default.trace("db.find",async r=>{r.addTags({db_name:this.name,...t});let n=await this.db.find(t);return r.addTags({rows_length:n.docs.length}),n})}allDocs(t){return Bn.default.trace("db.allDocs",async r=>{r.addTags({db_name:this.name,...t});let n=await this.db.allDocs(t);return r.addTags({total_rows:n.total_rows,rows_length:n.rows.length,offset:n.offset}),n})}query(t,r){return Bn.default.trace("db.query",async n=>{n.addTags({db_name:this.name,view_name:t,...r});let i=await this.db.query(t,r);return n.addTags({total_rows:i.total_rows,rows_length:i.rows.length,offset:i.offset}),i})}destroy(){return Bn.default.trace("db.destroy",async t=>{t.addTags({db_name:this.name});let r=await this.db.destroy();return t.addTags({ok:r.ok}),r})}compact(){return Bn.default.trace("db.compact",async t=>{t.addTags({db_name:this.name});let r=await this.db.compact();return t.addTags({ok:r.ok}),r})}dump(t,r){return Bn.default.trace("db.dump",n=>(n.addTags({db_name:this.name,batch_limit:r?.batch_limit,batch_size:r?.batch_size,style:r?.style,timeout:r?.timeout,num_doc_ids:r?.doc_ids?.length,view:r?.view}),this.db.dump(t,r)))}load(...t){return Bn.default.trace("db.load",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.load(...t)))}createIndex(...t){return Bn.default.trace("db.createIndex",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.createIndex(...t)))}deleteIndex(...t){return Bn.default.trace("db.deleteIndex",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.deleteIndex(...t)))}getIndexes(...t){return Bn.default.trace("db.getIndexes",r=>(r.addTags({db_name:this.name,num_args:t.length}),this.db.getIndexes(...t)))}sql(t,r){return Bn.default.trace("db.sql",async n=>{n.addTags({db_name:this.name,num_bindings:r?.length});let i=await this.db.sql(t,r);return n.addTags({num_rows:i.length}),i})}sqlPurgeDocument(t){return Bn.default.trace("db.sqlPurgeDocument",r=>(r.addTags({db_name:this.name,num_docs:Array.isArray(t)?t.length:1}),this.db.sqlPurgeDocument(t)))}sqlDiskCleanup(){return Bn.default.trace("db.sqlDiskCleanup",t=>(t.addTags({db_name:this.name}),this.db.sqlDiskCleanup()))}}});var m6={};G(m6,{breakExternalTableId:()=>c6,breakRowIdField:()=>OHt,buildExternalTableId:()=>vHt,convertRowId:()=>IHt,encodeTableId:()=>SHt,encodeViewId:()=>THt,extractDate:()=>f6,generateRowIdField:()=>AHt,getNativeSql:()=>Pw,isExternalTable:()=>u6,isExternalTableID:()=>QN,isInternalTableID:()=>EHt,isRowId:()=>RHt,isValidFilter:()=>YN,isValidISODateString:()=>zN,isValidISODateStringWithoutTimezone:()=>l6,isValidTime:()=>d6,sqlLog:()=>FR,validateManyToMany:()=>p6});function QN(e){return e.startsWith("datasource"+fe)}function EHt(e){return!QN(e)}function Pw(e){let t=e.toSQL();if(Array.isArray(t))return t;let r;return t.toNative&&(r=t.toNative()),{sql:r?.sql||t.sql,bindings:r?.bindings||t.bindings}}function u6(e){return e?.sourceId&&e.sourceId.includes("datasource"+fe)&&e?.sourceId!==qT||e?.sourceType==="external"?!0:!!(e?._id&&QN(e._id))}function vHt(e,t){return`${e}${a6}${encodeURIComponent(t)}`}function SHt(e){return QN(e)?encodeURIComponent(e):e}function THt(e){return encodeURIComponent(e)}function c6(e){let t=e.split(a6),r=t.shift(),n=t.join(a6);if(n.includes(gHt)&&(n=decodeURIComponent(n)),!r||!n)throw new Error("Unable to get datasource/table name from table ID");return{datasourceId:r,tableName:n}}function AHt(e=[]){Array.isArray(e)||(e=[e]);for(let t in e)e[t]instanceof Buffer&&(e[t]=e[t].toString());return encodeURIComponent(JSON.stringify(e).replace(/"/g,"'"))}function RHt(e){return Array.isArray(e)||typeof e=="string"&&e.match(r0e)!=null}function IHt(e){return Array.isArray(e)?e[0]:typeof e=="string"&&e.match(r0e)!=null?e.substring(1,e.length-1):e}function OHt(e){if(!e)return[];let t=typeof e=="string"?e:e._id,r=decodeURIComponent(t).replace(/'/g,'"');try{let n=JSON.parse(r);return Array.isArray(n)?n:[n]}catch{return[e]}}function zN(e){let t=e.trim();if(!yHt.test(t))return!1;let r=new Date(t);return!isNaN(r.getTime())}function l6(e){let t=e.trim();if(!bHt.test(t))return!1;let r=new Date(t);return!isNaN(r.getTime())}function f6(e){let t=e.match(_Ht);if(t)return t[0]}function YN(e){return e!=null&&e!==""}function d6(e){return wHt.test(e)}function FR(e,t,r){if(!U.SQL_LOGGING_ENABLE)return;let n=`[SQL] [${e.toUpperCase()}] query="${t}"`;r&&(n+=` values="${r.join(", ")}"`),console.log(n)}function xHt(e){return!!e.through&&!!e.fromPrimary&&!!e.from&&!!e.toPrimary&&!!e.to}function p6(e){if(xHt(e))return e}var a6,r0e,gHt,yHt,bHt,_Ht,wHt,BR=y(()=>{"use strict";P();pr();tt();a6=`${fe}${fe}`,r0e=/^\[.*]$/g,gHt=encodeURIComponent(" "),yHt=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}:\d{2}(?:.\d{3})?Z)?$/,bHt=/^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}:\d{2}(?:.\d{3})?)?$/,_Ht=/(\d{4}-\d{2}-\d{2})/,wHt=/^(?:\d{2}:)?(?:\d{2}:)(?:\d{2})$/;o(QN,"isExternalTableID");o(EHt,"isInternalTableID");o(Pw,"getNativeSql");o(u6,"isExternalTable");o(vHt,"buildExternalTableId");o(SHt,"encodeTableId");o(THt,"encodeViewId");o(c6,"breakExternalTableId");o(AHt,"generateRowIdField");o(RHt,"isRowId");o(IHt,"convertRowId");o(OHt,"breakRowIdField");o(zN,"isValidISODateString");o(l6,"isValidISODateStringWithoutTimezone");o(f6,"extractDate");o(YN,"isValidFilter");o(d6,"isValidTime");o(FR,"sqlLog");o(xHt,"isValidManyToManyRelationship");o(p6,"validateManyToMany")});function i0e(e){return(0,o0e.default)({url:e.url,requestDefaults:{headers:{Authorization:e.cookie}},parseUrl:!1})}function CHt(e,t,r){if(!e||!t)throw new Error("Unable to create database without database name or connection");let n=new kw(e,r,t);return new Dw(n)}var o0e,n0e,im,kw,s0e=y(()=>{"use strict";o0e=q(require("@budibase/nano"));P();qA();v3();o6();Vk();pr();s6();w3();BR();n0e="Database does not exist.";o(i0e,"buildNano");im=class extends Error{constructor(r,n){super(r);let i=n.status||n.statusCode||500;this.status=i,this.statusCode=i,this.reason=n.reason||"Unknown",this.name=n.name,this.errid=n.errid||"Unknown",this.description=n.description||"Unknown",this.error=n.error||"Not found"}static{o(this,"CouchDBError")}};o(CHt,"DatabaseWithConnection");kw=class e{constructor(t,r,n){this.couchInfo=fc();this.name=t,this.pouchOpts=r||{},n&&(this.couchInfo=fc(n),this.instanceNano=i0e(this.couchInfo)),e.nano||e.init()}static{o(this,"DatabaseImpl")}static init(){let t=fc();e.nano=i0e(t)}exists(t){return t===void 0?this.dbExists():this.docExists(t)}async dbExists(){return(await WA({url:`${this.couchInfo.url}/${this.name}`,method:"HEAD",cookie:this.couchInfo.cookie})).status===200}async docExists(t){try{return await this.performCall(r=>()=>r.head(t)),!0}catch{return!1}}nano(){return this.instanceNano||e.nano}getDb(){return this.nano().db.use(this.name)}async checkAndCreateDb(){let t=!this.pouchOpts?.skip_setup,r=await this.exists();if(!t&&!r)throw new Error("DB does not exist");if(!r)try{await this.nano().db.create(this.name)}catch(n){if(n.statusCode!==412)throw new im(n.message,n)}return this.getDb()}async performCallWithDBCreation(t){let r=this.getDb(),n=await t(r);try{return await n()}catch(i){if(i.statusCode===404&&i.reason===n0e)return await this.checkAndCreateDb(),await this.performCallWithDBCreation(t);throw new im(`CouchDB error: ${i.message}`,i)}}async performCall(t){let r=this.getDb(),n=await t(r);try{return await n()}catch(i){throw new im(`CouchDB error: ${i.message}`,i)}}async get(t){return this.performCall(r=>{if(!t)throw new Error("Unable to get doc without a valid _id.");return()=>r.get(t)})}async tryGet(t){try{return await this.get(t)}catch(r){if(r.statusCode===404)return;throw r}}async getMultiple(t,r){if(!t||t.length===0)return[];t=[...new Set(t)];let n=!r?.excludeDocs,i=await this.allDocs({keys:t,include_docs:n}),s=o(c=>n&&c.doc==null||c.value&&"deleted"in c.value&&c.value.deleted?!0:c.error==="not_found","rowUnavailable"),a=i.rows.filter(c=>!s(c)),u=a.length!==i.rows.length;if(!r?.allowMissing&&u){let l=i.rows.filter(f=>s(f)).map(f=>f.key).join(", ");throw new Error(`Unable to get bulk documents: ${l}`)}return a.map(c=>n?c.doc:c.value)}async remove(t,r){return this.performCall(n=>{let i,s;if(Lge(t)?(i=t._id,s=t._rev):(i=t,s=r),!i||!s)throw new Error("Unable to remove doc without a valid _id and _rev.");return()=>n.destroy(i,s)})}async bulkRemove(t,r){let n=await this.performCall(a=>()=>a.bulk({docs:t.map(u=>({...u,_deleted:!0}))}));if(r?.silenceErrors)return;let i=!1,s="Unable to bulk remove documents: ";for(let a of n)a.error&&(i=!0,s+=a.error);if(i)throw new im(s,{name:this.name,status:400})}async post(t,r){return t._id||(t._id=yr()),this.put(t,r)}async put(t,r){if(!t._id)throw new Error("Cannot store document without _id field.");return this.performCallWithDBCreation(async n=>{if(t.createdAt||(t.createdAt=new Date().toISOString()),t.updatedAt=new Date().toISOString(),r?.force&&t._id)try{let i=await this.get(t._id);i&&(t._rev=i._rev)}catch(i){if(i.status!==404)throw i}return async()=>{let i=await n.insert(t);return r?.returnDoc?{...i,doc:{...t,_rev:i.rev}}:i}})}async bulkDocs(t){let r=new Date().toISOString();return this.performCallWithDBCreation(n=>()=>n.bulk({docs:t.map(i=>({createdAt:r,...i,updatedAt:r}))}))}async find(t){return this.performCall(r=>async()=>r.find(t))}async allDocs(t){return this.performCall(r=>async()=>{try{return await r.list(t)}catch(n){if(n.reason===n0e)return{offset:0,total_rows:0,rows:[]};throw n}})}async _sqlQuery(t,r,n){t=Hk(`${this.couchInfo.sqlUrl}/${t}`);let i={url:t,method:r,cookie:this.couchInfo.cookie};return n&&(i.body=n),this.performCall(()=>async()=>{let s=await WA(i),a=await s.text();if(s.status>300){let u;try{u=JSON.parse(a)}catch{throw console.error(`SQS error: ${a}`),new im("error while running SQS query, please try again later",{name:"sqs_error",status:s.status})}throw u}return JSON.parse(a)})}async sql(t,r){let i=`/${this.name}/${no}`;return FR("sqlite3",t,r),await this._sqlQuery(i,"POST",{query:t,args:r})}async sqlDiskCleanup(){let r=`/${this.name}/_cleanup`;try{await this._sqlQuery(r,"POST")}catch(n){if(n.status!==500)throw n}}async sqlPurgeDocument(t){Array.isArray(t)||(t=[t]);let n=`/${this.name}/_purge`;return await this._sqlQuery(n,"POST",{docs:t})}async query(t,r){return this.performCall(n=>{let[i,s]=t.split("/");return()=>n.view(i,s,r)})}async destroy(){if(await this.exists(no)){let t=await this.get(no);t.sql.tables={},await this.put(t),await this.sqlDiskCleanup()}try{return await this.nano().db.destroy(this.name)}catch(t){if(t.statusCode===404)return{ok:!0};throw new im(t.message,t)}}async compact(){return this.performCall(t=>()=>t.compact())}async dump(t,r){return pu(this.name).dump(t,r)}async load(t){return pu(this.name).load(t)}async createIndex(t){return pu(this.name).createIndex(t)}async deleteIndex(t){return pu(this.name).deleteIndex(t)}async getIndexes(){return pu(this.name).getIndexes()}}});var qR=y(()=>{"use strict";qA();s0e();v3();o6()});function ns(e,t){return new Dw(new kw(e,t))}async function Sa(e,t,r){let n=ns(e,r);return await t(n)}async function h6(e){let t="/_all_dbs";return e&&(t+=`?${e}`),await E3(t)}var Nw=y(()=>{"use strict";qR();s6();o(ns,"getDB");o(Sa,"doWithDB");o(h6,"directCouchAllDbs")});function om(e){if(!e)throw g6;return e.startsWith(cc)}function DHt(e){if(!e)throw g6;return e.startsWith(uc)&&!om(e)}function WR(e){if(!e)throw g6;return om(e.appId)}function JN(e){if(!e||e.startsWith(cc))return e;let t=e.split(uc);t.shift();let r=t.join(uc);return`${cc}${r}`}function Ta(e){if(!e||!e.startsWith(cc))return e;let t=e.split(cc);t.shift();let r=t.join(cc);return`${uc}${r}`}var g6,jR=y(()=>{"use strict";pr();g6="No app provided";o(om,"isDevWorkspaceID");o(DHt,"isProdWorkspaceID");o(WR,"isDevWorkspace");o(JN,"getDevWorkspaceID");o(Ta,"getProdWorkspaceID")});var a0e,li,u0e=y(()=>{"use strict";a0e=require("async_hooks"),li=class e{static{o(this,"Context")}static{this.storage=new a0e.AsyncLocalStorage}static run(t,r){return e.storage.run(t,()=>r())}static get(){return e.storage.getStore()}}});function Bg(e){return e||(e=rt()),$R(e)}function l0e(e){return e||(e=rt()),e===Mn?Vr.AUDIT_LOGS.name:`${e}${fe}${Vr.AUDIT_LOGS.name}`}function kHt(e){return e||(e=rt()),e===Mn?Vr.SCIM_LOGS.name:`${e}${fe}${Vr.SCIM_LOGS.name}`}function $R(e){return!e||e===Mn?Vr.GLOBAL.name:`${e}${fe}${Vr.GLOBAL.name}`}function y6(){return U.PLATFORM_URL}function sm(){return!!U.MULTI_TENANCY}function NHt(){return!!li.get()?.tenantId}function LHt(){return U.MULTI_TENANCY}function Lw(e){if(!e)return;if(!sm())return Mn;let t=e.split(fe),r=t[1]==="dev";if(!(r&&t.length===3||!r&&t.length===2))return r?t[2]:t[1]}function UHt(e){let t;try{t=li.get()}catch{t={}}return t={...t,...e},t}async function hc(e,t){$Ht();let r=UHt(e);return li.run(r,t)}async function MHt(e){return await d0e(),await hc({tenantId:Lw(e.workspaceId),appId:e.workspaceId,automationId:e.automationId},e.task)}async function b6(e,t){let r=Lw(e);return hc({tenantId:r,appId:e},t)}async function is(e,t){return U.MULTI_TENANCY||(e=e||Mn),hc(e?{tenantId:e}:{},t)}async function FHt(e,t){return hc({tenantId:e,isSelfHostUsingCloud:!0},t)}async function BHt(e,t){return hc({license:e},t)}function qHt(){return li.get()?.license}function XN(){return!!li.get()?.isSelfHostUsingCloud}function WHt(){let e=li.get();if(!e||!e.isSelfHostUsingCloud)throw new Error("Self-host cloud DB not found");return ns(Vr.SELF_HOST_CLOUD.name)}async function jHt(e,t){return f0e(e,t)}async function f0e(e,t,r){if(!e)throw new Error("workspaceId is required");let n=Lw(e),i={appId:e,...r};return n&&(i.tenantId=n),hc(i,t)}async function BA(e,t){if(!e)throw new Error("identity is required");let r={identity:e};return e.tenantId&&(r.tenantId=e.tenantId),hc(r,t)}function $Ht(){if(li.get()?.isMigrating)throw new Error("The context cannot be changed, a migration is currently running")}async function VHt(e,t){return f0e(e,t,{isMigrating:!0})}function jf(){try{return li.get()?.identity}catch{}}function rt(){if(!sm())return Mn;let t=li.get()?.tenantId;if(!t)throw new Error("Tenant id not found");return t}function _6(){return li.get()?.automationId}function os(){let t=li.get()?.appId;return!t&&U.isTest()&&c0e?c0e:t}function GHt(){let e=os();if(!e)throw new Error("Workspace id not set");return e}function w6(){return li.get()?.ip}function QHt(e,t){if(!e)throw new Error("Must supply environment variables.");return hc({environmentVariables:e},t)}function zHt(e){return hc({isScim:!0},e)}function E6(e,t){return hc({ip:e},t)}async function d0e(){let e=qg();if(!e||e.snippets)return;let t,r=Uw();r&&(t=(await r.tryGet("app_metadata"))?.snippets),e.snippets=t||[]}function YHt(){let e=li.get();return e.environmentVariables?e.environmentVariables:null}function Qt(){let e=li.get();if(!e||U.MULTI_TENANCY&&!e.tenantId)throw new Error("Global DB not found");if(e.isSelfHostUsingCloud)throw new Error("Global DB not found - self-host users using cloud don't have a global DB");return ns($R(e?.tenantId))}function JHt(){if(!rt())throw new Error("No tenant ID found - cannot open audit log DB");return ns(l0e())}function Uw(e){let t=os();if(!t)throw new Error("Unable to retrieve workspace DB - no workspace ID.");if(XN())throw new Error("Workspace DB not found - self-host users using cloud don't have workspace DBs");return ns(t,e)}function XHt(e){let t=os();if(!t)throw new Error("Unable to retrieve prod DB - no workspace ID.");return ns(Ta(t),e)}function ZHt(e){let t=os();if(!t)throw new Error("Unable to retrieve dev DB - no workspace ID.");return ns(JN(t),e)}function gc(){return!!li.get()?.isScim}function qg(){try{return li.get()}catch{return}}function v6(e){let t=qg();if(t)return t.featureFlagCache?.[e]}function S6(e,t){let r=qg();r&&(r.featureFlagCache??={},r.featureFlagCache[e]=t)}function T6(){return qg()?.featureFlagOverrides||{}}async function A6(e,t){return await hc({featureFlagOverrides:e},t)}function e4t(e){let t=qg();if(t)return t.viewToTableCache?.[e]}function t4t(e,t){let r=qg();r&&(r.viewToTableCache??={},r.viewToTableCache[e]=t)}var c0e,HHt,KHt,p0e=y(()=>{"use strict";pr();Nw();jR();tt();u0e();c0e=null;o(Bg,"getGlobalDBName");o(l0e,"getAuditLogDBName");o(kHt,"getScimDBName");o($R,"baseGlobalDBName");o(y6,"getPlatformURL");o(sm,"isMultiTenant");o(NHt,"isTenantIdSet");o(LHt,"isTenancyEnabled");o(Lw,"getTenantIDFromWorkspaceID");o(UHt,"updateContext");o(hc,"newContext");o(MHt,"doInAutomationContext");o(b6,"doInContext");o(is,"doInTenant");o(FHt,"doInSelfHostTenantUsingCloud");o(BHt,"doInLicenseContext");o(qHt,"getLicense");o(XN,"isSelfHostUsingCloud");o(WHt,"getSelfHostCloudDB");o(jHt,"doInWorkspaceContext");o(f0e,"_doInWorkspaceContext");o(BA,"doInIdentityContext");o($Ht,"guardMigration");o(VHt,"doInWorkspaceMigrationContext");o(jf,"getIdentity");o(rt,"getTenantId");o(_6,"getAutomationId");o(os,"getWorkspaceId");o(GHt,"getOrThrowWorkspaceId");o(w6,"getIP");HHt=o(()=>{let e=os();if(!e)throw new Error("Could not get workspaceId");return JN(e)},"getDevWorkspaceId"),KHt=o(()=>{let e=os();if(!e)throw new Error("Could not get workspaceId");return Ta(e)},"getProdWorkspaceId");o(QHt,"doInEnvironmentContext");o(zHt,"doInScimContext");o(E6,"doInIPContext");o(d0e,"ensureSnippetContext");o(YHt,"getEnvironmentVariables");o(Qt,"getGlobalDB");o(JHt,"getAuditLogsDB");o(Uw,"getWorkspaceDB");o(XHt,"getProdWorkspaceDB");o(ZHt,"getDevWorkspaceDB");o(gc,"isScim");o(qg,"getCurrentContext");o(v6,"getFeatureFlags");o(S6,"setFeatureFlags");o(T6,"getFeatureFlagOverrides");o(A6,"doInFeatureFlagOverrideContext");o(e4t,"getTableForView");o(t4t,"setTableForView")});var I={};G(I,{DEFAULT_TENANT_ID:()=>Mn,baseGlobalDBName:()=>$R,doInAutomationContext:()=>MHt,doInContext:()=>b6,doInEnvironmentContext:()=>QHt,doInFeatureFlagOverrideContext:()=>A6,doInIPContext:()=>E6,doInIdentityContext:()=>BA,doInLicenseContext:()=>BHt,doInScimContext:()=>zHt,doInSelfHostTenantUsingCloud:()=>FHt,doInTenant:()=>is,doInWorkspaceContext:()=>jHt,doInWorkspaceMigrationContext:()=>VHt,ensureSnippetContext:()=>d0e,getAuditLogDBName:()=>l0e,getAuditLogsDB:()=>JHt,getAutomationId:()=>_6,getCurrentContext:()=>qg,getDevWorkspaceDB:()=>ZHt,getDevWorkspaceId:()=>HHt,getEnvironmentVariables:()=>YHt,getFeatureFlagOverrides:()=>T6,getFeatureFlags:()=>v6,getGlobalDB:()=>Qt,getGlobalDBName:()=>Bg,getIP:()=>w6,getIdentity:()=>jf,getLicense:()=>qHt,getOrThrowWorkspaceId:()=>GHt,getPlatformURL:()=>y6,getProdWorkspaceDB:()=>XHt,getProdWorkspaceId:()=>KHt,getScimDBName:()=>kHt,getSelfHostCloudDB:()=>WHt,getTableForView:()=>e4t,getTenantIDFromWorkspaceID:()=>Lw,getTenantId:()=>rt,getWorkspaceDB:()=>Uw,getWorkspaceId:()=>os,identity:()=>FA,isMultiTenant:()=>sm,isScim:()=>gc,isSelfHostUsingCloud:()=>XN,isTenancyEnabled:()=>LHt,isTenantIdSet:()=>NHt,setFeatureFlags:()=>S6,setTableForView:()=>t4t});var yt=y(()=>{"use strict";pr();Gk();p0e()});async function r4t(e=0){return await ZN.tracer.trace("Redis.init",async t=>{if(U.MOCK_REDIS)return t.addTags({mock:!0}),new m0e(_g());let r;if(U.REDIS_CLUSTERED){t.addTags({clustered:!0});let{host:n,port:i}=jk();r=new eL.Cluster([{host:n,port:i}],f3())}else r=new eL.default(_g());return new Promise((n,i)=>{r.on("error",s=>{t.addTags({error:!0}),console.error(`failed to connect to redis (db: ${e})`,s),i(s)}),r.on("reconnecting",()=>{console.log(`Redis reconnecting... (db: ${e})`)}),r.on("ready",()=>{t.addTags({connected:!0}),console.log(`Redis ready to receive commands (db: ${e})`),n(r)})})})}function n4t(e,t){return new Promise((r,n)=>{let i=new Set;e.on("data",s=>s.forEach(a=>i.add(a))),e.on("error",s=>n(s)),e.on("end",async()=>{try{let s=Array.from(i).map(async a=>{let u=await t.get(a);return u&&(u=JSON.parse(u)),{key:d3(a),value:u}});r(await Promise.all(s))}catch(s){n(s)}})})}function i4t(e){return e.isCluster}var eL,ZN,h0e,m0e,R6,so,I6=y(()=>{"use strict";tt();eL=q(require("ioredis"));J_();ZN=require("dd-trace"),h0e=require("lodash");if(U.MOCK_REDIS)try{m0e=require("ioredis-mock")}catch{console.log("Mock redis unavailable")}o(r4t,"init");o(n4t,"promisifyStream");o(i4t,"isCluster");R6=class e{static{o(this,"RedisWrapper")}constructor(t,r){this.client=t,this.db=r}static async init(t,r=0){return await ZN.tracer.trace("RedisWrapper.init",async n=>{let i=await r4t(r);return r&&!U.isTest()&&(n.addTags({db:t}),i.select(r)),new e(i,t)})}trace(t,r){return ZN.tracer.trace(t,async n=>(n.addTags({db:this.db}),await r(n)))}prefixed(t){return t.includes(this.db)?t:`${this.db}${Y_}${t}`}async finish(){return await this.trace("RedisWrapper.finish",async()=>{await this.client.quit()})}async scan(t=""){return await this.trace("RedisWrapper.scan",async r=>{r.addTags({key:t}),t=`${this.db}${Y_}${t}`;let n;i4t(this.client)?n=this.client.nodes("master")[0].scanStream({match:t+"*",count:1e3}):n=this.client.scanStream({match:t+"*",count:1e3});let i=await n4t(n,this.client);return r.addTags({numKeysFound:i.length}),i})}async keys(t){return await this.trace("RedisWrapper.keys",async r=>(r.addTags({pattern:t}),this.client.keys(this.prefixed(t))))}async exists(t){return await this.trace("RedisWrapper.exists",async r=>(r.addTags({key:t}),await this.client.exists(this.prefixed(t))))}async get(t){return await this.trace("RedisWrapper.get",async r=>{r.addTags({key:t});let n=await this.client.get(this.prefixed(t));n!=null&&n.key&&(n.key=t);try{return JSON.parse(n)}catch{return n}})}async bulkGet(t){return await this.trace("RedisWrapper.bulkGet",async r=>{if(r.addTags({numKeys:t.length}),t.length===0)return{};let n=await this.client.mget(t.map(i=>this.prefixed(i)));return r.addTags({numKeysFound:n.length}),(0,h0e.zip)(t,n).reduce((i,[s,a])=>{if(s===void 0||a===void 0)throw new Error(`Keys and response length mismatch: ${t.length} vs ${n.length}`);try{i[s]=a?JSON.parse(a):null}catch{i[s]=a}return i},{})})}async store(t,r,n=null){return await this.trace("RedisWrapper.store",async i=>{i.addTags({key:t,expirySeconds:n}),typeof r=="object"&&(r=JSON.stringify(r)),await this.client.set(this.prefixed(t),r),n&&await this.client.expire(this.prefixed(t),n)})}async bulkStore(t,r=null){return await this.trace("RedisWrapper.bulkStore",async n=>{n.addTags({numKeys:Object.keys(t).length,expirySeconds:r});let i=Object.entries(t).reduce((a,[u,c])=>(a[this.prefixed(u)]=typeof c=="object"?JSON.stringify(c):c,a),{}),s=this.client.pipeline();if(s.mset(i),r!==null)for(let a of Object.keys(i))s.expire(a,r);await s.exec()})}async getTTL(t){return await this.trace("RedisWrapper.getTTL",async r=>(r.addTags({key:t}),await this.client.ttl(this.prefixed(t))))}async setExpiry(t,r){return await this.trace("RedisWrapper.setExpiry",async n=>(n.addTags({key:t,expirySeconds:r}),await this.client.expire(this.prefixed(t),r)))}async delete(t){return await this.trace("RedisWrapper.delete",async r=>{r.addTags({key:t}),await this.client.del(this.prefixed(t))})}async bulkDelete(t){return await this.trace("RedisWrapper.bulkDelete",async r=>{r.addTags({numKeys:t.length}),await this.client.del(t.map(n=>this.prefixed(n)))})}async clear(){return await this.trace("RedisWrapper.clear",async t=>{let r=await this.scan();t.addTags({numKeys:r.length}),await Promise.all(r.map(n=>this.delete(n.key)))})}async increment(t){return await this.trace("RedisWrapper.increment",async r=>{r.addTags({key:t});let n=await this.client.incr(this.prefixed(t));if(isNaN(n))throw new Error(`Redis ${t} does not contain a number`);return n})}async deleteIfValue(t,r){return await this.trace("RedisWrapper.deleteIfValue",async n=>{n.addTags({key:t});let i=`
8
8
  if redis.call('GET', KEYS[1]) == ARGV[1] then
9
9
  redis.call('DEL', KEYS[1])
10
10
  end