bkper-js 2.35.2 → 2.36.0
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/README.md +2 -0
- package/dist/bkper.min.js +2 -2
- package/dist/bkper.min.js.map +4 -4
- package/lib/index.d.ts +44 -0
- package/lib/index.js +1 -0
- package/lib/model/Book.js +15 -0
- package/lib/model/FileList.js +52 -0
- package/lib/service/file-service.js +14 -0
- package/package.json +2 -2
package/dist/bkper.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var bkperjs=(()=>{var
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return e=n[Symbol.iterator](),e.next.bind(e)}var Be=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Br(Error)),aa=(function(n){J(e,n);function e(t){return n.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(Be),ua=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(Be),la=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(Be),kt=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Di=(function(n){J(e,n);function e(t){return n.call(this,"Invalid unit "+t)||this}return e})(Be),Y=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Ee=(function(n){J(e,n);function e(){return n.call(this,"Zone is an abstract class")||this}return e})(Be),h="numeric",se="short",j="long",er={year:h,month:h,day:h},$r={year:h,month:se,day:h},Si={year:h,month:se,day:h,weekday:se},jr={year:h,month:j,day:h},zr={year:h,month:j,day:h,weekday:j},qr={hour:h,minute:h},Zr={hour:h,minute:h,second:h},Wr={hour:h,minute:h,second:h,timeZoneName:se},Yr={hour:h,minute:h,second:h,timeZoneName:j},Kr={hour:h,minute:h,hour12:!1},Jr={hour:h,minute:h,second:h,hour12:!1},Qr={hour:h,minute:h,second:h,hour12:!1,timeZoneName:se},Xr={hour:h,minute:h,second:h,hour12:!1,timeZoneName:j},en={year:h,month:h,day:h,hour:h,minute:h},tn={year:h,month:h,day:h,hour:h,minute:h,second:h},rn={year:h,month:se,day:h,hour:h,minute:h},nn={year:h,month:se,day:h,hour:h,minute:h,second:h},Ii={year:h,month:se,day:h,weekday:se,hour:h,minute:h},on={year:h,month:j,day:h,hour:h,minute:h,timeZoneName:se},sn={year:h,month:j,day:h,hour:h,minute:h,second:h,timeZoneName:se},an={year:h,month:j,day:h,weekday:j,hour:h,minute:h,timeZoneName:j},un={year:h,month:j,day:h,weekday:j,hour:h,minute:h,second:h,timeZoneName:j};function A(n){return typeof n=="undefined"}function Pe(n){return typeof n=="number"}function or(n){return typeof n=="number"&&n%1===0}function ca(n){return typeof n=="string"}function da(n){return Object.prototype.toString.call(n)==="[object Date]"}function de(){try{return typeof Intl!="undefined"&&Intl.DateTimeFormat}catch(n){return!1}}function Ft(){return!A(Intl.DateTimeFormat.prototype.formatToParts)}function Oi(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function fa(n){return Array.isArray(n)?n:[n]}function ni(n,e,t){if(n.length!==0)return n.reduce(function(r,i){var o=[e(i),i];return r&&t(r[0],o[0])===r[0]?r:o},null)[1]}function ki(n,e){return e.reduce(function(t,r){return t[r]=n[r],t},{})}function Qe(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function pe(n,e,t){return or(n)&&n>=e&&n<=t}function ha(n,e){return n-e*Math.floor(n/e)}function Ke(n,e){e===void 0&&(e=2);var t=n<0?"-":"",r=t?n*-1:n,i;return r.toString().length<e?i=("0".repeat(e)+r).slice(-e):i=r.toString(),""+t+i}function V(n){if(!(A(n)||n===null||n===""))return parseInt(n,10)}function ln(n){if(!(A(n)||n===null||n==="")){var e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function cn(n,e,t){t===void 0&&(t=!1);var r=Math.pow(10,e),i=t?Math.trunc:Math.round;return i(n*r)/r}function Pt(n){return n%4===0&&(n%100!==0||n%400===0)}function Nt(n){return Pt(n)?366:365}function tr(n,e){var t=ha(e-1,12)+1,r=n+(e-t)/12;return t===2?Pt(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function dn(n){var e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function rr(n){var e=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7,t=n-1,r=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||r===3?53:52}function _r(n){return n>99?n:n>60?1900+n:2e3+n}function xi(n,e,t,r){r===void 0&&(r=null);var i=new Date(n),o={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);var s=Object.assign({timeZoneName:e},o),a=de();if(a&&Ft()){var c=new Intl.DateTimeFormat(t,s).formatToParts(i).find(function(p){return p.type.toLowerCase()==="timezonename"});return c?c.value:null}else if(a){var l=new Intl.DateTimeFormat(t,o).format(i),u=new Intl.DateTimeFormat(t,s).format(i),d=u.substring(l.length),f=d.replace(/^[, \u200e]+/,"");return f}else return null}function sr(n,e){var t=parseInt(n,10);Number.isNaN(t)&&(t=0);var r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function Ni(n){var e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new Y("Invalid unit value "+n);return e}function nr(n,e,t){var r={};for(var i in n)if(Qe(n,i)){if(t.indexOf(i)>=0)continue;var o=n[i];if(o==null)continue;r[e(i)]=Ni(o)}return r}function ir(n,e){var t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return""+i+Ke(t,2)+":"+Ke(r,2);case"narrow":return""+i+t+(r>0?":"+r:"");case"techie":return""+i+Ke(t,2)+Ke(r,2);default:throw new RangeError("Value format "+e+" is out of range for property format")}}function ar(n){return ki(n,["hour","minute","second","millisecond"])}var Mi=/[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/;function I(n){return JSON.stringify(n,Object.keys(n).sort())}var pa=["January","February","March","April","May","June","July","August","September","October","November","December"],Fi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ma=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pi(n){switch(n){case"narrow":return[].concat(ma);case"short":return[].concat(Fi);case"long":return[].concat(pa);case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var Bi=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],_i=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ga=["M","T","W","T","F","S","S"];function Ri(n){switch(n){case"narrow":return[].concat(ga);case"short":return[].concat(_i);case"long":return[].concat(Bi);case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Li=["AM","PM"],ya=["Before Christ","Anno Domini"],va=["BC","AD"],wa=["B","A"];function Ui(n){switch(n){case"narrow":return[].concat(wa);case"short":return[].concat(va);case"long":return[].concat(ya);default:return null}}function Ea(n){return Li[n.hour<12?0:1]}function Ta(n,e){return Ri(e)[n.weekday-1]}function Aa(n,e){return Pi(e)[n.month-1]}function ba(n,e){return Ui(e)[n.year<0?0:1]}function Ca(n,e,t,r){t===void 0&&(t="always"),r===void 0&&(r=!1);var 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."]},o=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&o){var s=n==="days";switch(e){case 1:return s?"tomorrow":"next "+i[n][0];case-1:return s?"yesterday":"last "+i[n][0];case 0:return s?"today":"this "+i[n][0]}}var a=Object.is(e,-0)||e<0,c=Math.abs(e),l=c===1,u=i[n],d=r?l?u[1]:u[2]||u[1]:l?i[n][0]:n;return a?c+" "+d+" ago":"in "+c+" "+d}function Da(n){var e=ki(n,["weekday","era","year","month","day","hour","minute","second","timeZoneName","hour12"]),t=I(e),r="EEEE, LLLL d, yyyy, h:mm a";switch(t){case I(er):return"M/d/yyyy";case I($r):return"LLL d, yyyy";case I(Si):return"EEE, LLL d, yyyy";case I(jr):return"LLLL d, yyyy";case I(zr):return"EEEE, LLLL d, yyyy";case I(qr):return"h:mm a";case I(Zr):return"h:mm:ss a";case I(Wr):return"h:mm a";case I(Yr):return"h:mm a";case I(Kr):return"HH:mm";case I(Jr):return"HH:mm:ss";case I(Qr):return"HH:mm";case I(Xr):return"HH:mm";case I(en):return"M/d/yyyy, h:mm a";case I(rn):return"LLL d, yyyy, h:mm a";case I(on):return"LLLL d, yyyy, h:mm a";case I(an):return r;case I(tn):return"M/d/yyyy, h:mm:ss a";case I(nn):return"LLL d, yyyy, h:mm:ss a";case I(Ii):return"EEE, d LLL yyyy, h:mm a";case I(sn):return"LLLL d, yyyy, h:mm:ss a";case I(un):return"EEEE, LLLL d, yyyy, h:mm:ss a";default:return r}}function ii(n,e){for(var t="",r=Te(n),i;!(i=r()).done;){var o=i.value;o.literal?t+=o.val:t+=e(o.val)}return t}var Sa={D:er,DD:$r,DDD:jr,DDDD:zr,t:qr,tt:Zr,ttt:Wr,tttt:Yr,T:Kr,TT:Jr,TTT:Qr,TTTT:Xr,f:en,ff:rn,fff:on,ffff:an,F:tn,FF:nn,FFF:sn,FFFF:un},le=(function(){n.create=function(r,i){return i===void 0&&(i={}),new n(r,i)},n.parseFormat=function(r){for(var i=null,o="",s=!1,a=[],c=0;c<r.length;c++){var l=r.charAt(c);l==="'"?(o.length>0&&a.push({literal:s,val:o}),i=null,o="",s=!s):s||l===i?o+=l:(o.length>0&&a.push({literal:!1,val:o}),o=l,i=l)}return o.length>0&&a.push({literal:s,val:o}),a},n.macroTokenToFormatOpts=function(r){return Sa[r]};function n(t,r){this.opts=r,this.loc=t,this.systemLoc=null}var e=n.prototype;return e.formatWithSystemDefault=function(r,i){this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem());var o=this.systemLoc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTime=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTimeParts=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.formatToParts()},e.resolvedOptions=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.resolvedOptions()},e.num=function(r,i){if(i===void 0&&(i=0),this.opts.forceSimple)return Ke(r,i);var o=Object.assign({},this.opts);return i>0&&(o.padTo=i),this.loc.numberFormatter(o).format(r)},e.formatDateTimeFromString=function(r,i){var o=this,s=this.loc.listingMode()==="en",a=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory"&&Ft(),c=function(y,S){return o.loc.extract(r,y,S)},l=function(y){return r.isOffsetFixed&&r.offset===0&&y.allowZ?"Z":r.isValid?r.zone.formatOffset(r.ts,y.format):""},u=function(){return s?Ea(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?Aa(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?Ta(r,y):c(S?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday")},p=function(y){var S=n.macroTokenToFormatOpts(y);return S?o.formatWithSystemDefault(r,S):y},g=function(y){return s?ba(r,y):c({era:y},"era")},v=function(y){switch(y){case"S":return o.num(r.millisecond);case"u":case"SSS":return o.num(r.millisecond,3);case"s":return o.num(r.second);case"ss":return o.num(r.second,2);case"m":return o.num(r.minute);case"mm":return o.num(r.minute,2);case"h":return o.num(r.hour%12===0?12:r.hour%12);case"hh":return o.num(r.hour%12===0?12:r.hour%12,2);case"H":return o.num(r.hour);case"HH":return o.num(r.hour,2);case"Z":return l({format:"narrow",allowZ:o.opts.allowZ});case"ZZ":return l({format:"short",allowZ:o.opts.allowZ});case"ZZZ":return l({format:"techie",allowZ:o.opts.allowZ});case"ZZZZ":return r.zone.offsetName(r.ts,{format:"short",locale:o.loc.locale});case"ZZZZZ":return r.zone.offsetName(r.ts,{format:"long",locale:o.loc.locale});case"z":return r.zoneName;case"a":return u();case"d":return a?c({day:"numeric"},"day"):o.num(r.day);case"dd":return a?c({day:"2-digit"},"day"):o.num(r.day,2);case"c":return o.num(r.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return o.num(r.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return a?c({month:"numeric",day:"numeric"},"month"):o.num(r.month);case"LL":return a?c({month:"2-digit",day:"numeric"},"month"):o.num(r.month,2);case"LLL":return d("short",!0);case"LLLL":return d("long",!0);case"LLLLL":return d("narrow",!0);case"M":return a?c({month:"numeric"},"month"):o.num(r.month);case"MM":return a?c({month:"2-digit"},"month"):o.num(r.month,2);case"MMM":return d("short",!1);case"MMMM":return d("long",!1);case"MMMMM":return d("narrow",!1);case"y":return a?c({year:"numeric"},"year"):o.num(r.year);case"yy":return a?c({year:"2-digit"},"year"):o.num(r.year.toString().slice(-2),2);case"yyyy":return a?c({year:"numeric"},"year"):o.num(r.year,4);case"yyyyyy":return a?c({year:"numeric"},"year"):o.num(r.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return o.num(r.weekYear.toString().slice(-2),2);case"kkkk":return o.num(r.weekYear,4);case"W":return o.num(r.weekNumber);case"WW":return o.num(r.weekNumber,2);case"o":return o.num(r.ordinal);case"ooo":return o.num(r.ordinal,3);case"q":return o.num(r.quarter);case"qq":return o.num(r.quarter,2);case"X":return o.num(Math.floor(r.ts/1e3));case"x":return o.num(r.ts);default:return p(y)}};return ii(n.parseFormat(i),v)},e.formatDurationFromString=function(r,i){var o=this,s=function(f){switch(f[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"M":return"month";case"y":return"year";default:return null}},a=function(f){return function(p){var g=s(p);return g?o.num(f.get(g),p.length):p}},c=n.parseFormat(i),l=c.reduce(function(d,f){var p=f.literal,g=f.val;return p?d:d.concat(g)},[]),u=r.shiftTo.apply(r,l.map(s).filter(function(d){return d}));return ii(c,a(u))},n})(),ie=(function(){function n(t,r){this.reason=t,this.explanation=r}var e=n.prototype;return e.toMessage=function(){return this.explanation?this.reason+": "+this.explanation:this.reason},n})(),Xe=(function(){function n(){}var e=n.prototype;return e.offsetName=function(r,i){throw new Ee},e.formatOffset=function(r,i){throw new Ee},e.offset=function(r){throw new Ee},e.equals=function(r){throw new Ee},oe(n,[{key:"type",get:function(){throw new Ee}},{key:"name",get:function(){throw new Ee}},{key:"universal",get:function(){throw new Ee}},{key:"isValid",get:function(){throw new Ee}}]),n})(),Ir=null,Gi=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return xi(i,s,a)},t.formatOffset=function(i,o){return ir(this.offset(i),o)},t.offset=function(i){return-new Date(i).getTimezoneOffset()},t.equals=function(i){return i.type==="local"},oe(e,[{key:"type",get:function(){return"local"}},{key:"name",get:function(){return de()?new Intl.DateTimeFormat().resolvedOptions().timeZone:"local"}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!0}}],[{key:"instance",get:function(){return Ir===null&&(Ir=new e),Ir}}]),e})(Xe),Ia=RegExp("^"+Mi.source+"$"),Jt={};function Oa(n){return Jt[n]||(Jt[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Jt[n]}var ka={year:0,month:1,day:2,hour:3,minute:4,second:5};function xa(n,e){var t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t),i=r[1],o=r[2],s=r[3],a=r[4],c=r[5],l=r[6];return[s,i,o,a,c,l]}function Na(n,e){for(var t=n.formatToParts(e),r=[],i=0;i<t.length;i++){var o=t[i],s=o.type,a=o.value,c=ka[s];A(c)||(r[c]=parseInt(a,10))}return r}var Zt={},ce=(function(n){J(e,n),e.create=function(i){return Zt[i]||(Zt[i]=new e(i)),Zt[i]},e.resetCache=function(){Zt={},Jt={}},e.isValidSpecifier=function(i){return!!(i&&i.match(Ia))},e.isValidZone=function(i){try{return new Intl.DateTimeFormat("en-US",{timeZone:i}).format(),!0}catch(o){return!1}},e.parseGMTOffset=function(i){if(i){var o=i.match(/^Etc\/GMT(0|[+-]\d{1,2})$/i);if(o)return-60*parseInt(o[1])}return null};function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i.valid=e.isValidZone(r),i}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return xi(i,s,a,this.name)},t.formatOffset=function(i,o){return ir(this.offset(i),o)},t.offset=function(i){var o=new Date(i);if(isNaN(o))return NaN;var s=Oa(this.name),a=s.formatToParts?Na(s,o):xa(s,o),c=a[0],l=a[1],u=a[2],d=a[3],f=a[4],p=a[5],g=d===24?0:d,v=dn({year:c,month:l,day:u,hour:g,minute:f,second:p,millisecond:0}),w=+o,y=w%1e3;return w-=y>=0?y:1e3+y,(v-w)/(60*1e3)},t.equals=function(i){return i.type==="iana"&&i.name===this.name},oe(e,[{key:"type",get:function(){return"iana"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return this.valid}}]),e})(Xe),Or=null,$=(function(n){J(e,n),e.instance=function(i){return i===0?e.utcInstance:new e(i)},e.parseSpecifier=function(i){if(i){var o=i.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(o)return new e(sr(o[1],o[2]))}return null},oe(e,null,[{key:"utcInstance",get:function(){return Or===null&&(Or=new e(0)),Or}}]);function e(r){var i;return i=n.call(this)||this,i.fixed=r,i}var t=e.prototype;return t.offsetName=function(){return this.name},t.formatOffset=function(i,o){return ir(this.fixed,o)},t.offset=function(){return this.fixed},t.equals=function(i){return i.type==="fixed"&&i.fixed===this.fixed},oe(e,[{key:"type",get:function(){return"fixed"}},{key:"name",get:function(){return this.fixed===0?"UTC":"UTC"+ir(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(Xe),Rr=(function(n){J(e,n);function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i}var t=e.prototype;return t.offsetName=function(){return null},t.formatOffset=function(){return""},t.offset=function(){return NaN},t.equals=function(){return!1},oe(e,[{key:"type",get:function(){return"invalid"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!1}}]),e})(Xe);function Me(n,e){var t;if(A(n)||n===null)return e;if(n instanceof Xe)return n;if(ca(n)){var r=n.toLowerCase();return r==="local"?e:r==="utc"||r==="gmt"?$.utcInstance:(t=ce.parseGMTOffset(n))!=null?$.instance(t):ce.isValidSpecifier(r)?ce.create(n):$.parseSpecifier(r)||new Rr(n)}else return Pe(n)?$.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new Rr(n)}var oi=function(){return Date.now()},kr=null,si=null,ai=null,ui=null,li=!1,x=(function(){function n(){}return n.resetCaches=function(){B.resetCache(),ce.resetCache()},oe(n,null,[{key:"now",get:function(){return oi},set:function(t){oi=t}},{key:"defaultZoneName",get:function(){return n.defaultZone.name},set:function(t){t?kr=Me(t):kr=null}},{key:"defaultZone",get:function(){return kr||Gi.instance}},{key:"defaultLocale",get:function(){return si},set:function(t){si=t}},{key:"defaultNumberingSystem",get:function(){return ai},set:function(t){ai=t}},{key:"defaultOutputCalendar",get:function(){return ui},set:function(t){ui=t}},{key:"throwOnInvalid",get:function(){return li},set:function(t){li=t}}]),n})(),Lr={};function Ur(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Lr[t];return r||(r=new Intl.DateTimeFormat(n,e),Lr[t]=r),r}var Gr={};function Ma(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Gr[t];return r||(r=new Intl.NumberFormat(n,e),Gr[t]=r),r}var Vr={};function Fa(n,e){e===void 0&&(e={});var t=e,r=t.base,i=oa(t,["base"]),o=JSON.stringify([n,i]),s=Vr[o];return s||(s=new Intl.RelativeTimeFormat(n,e),Vr[o]=s),s}var Ne=null;function Pa(){if(Ne)return Ne;if(de()){var n=new Intl.DateTimeFormat().resolvedOptions().locale;return Ne=!n||n==="und"?"en-US":n,Ne}else return Ne="en-US",Ne}function Ba(n){var e=n.indexOf("-u-");if(e===-1)return[n];var t,r=n.substring(0,e);try{t=Ur(n).resolvedOptions()}catch(a){t=Ur(r).resolvedOptions()}var i=t,o=i.numberingSystem,s=i.calendar;return[r,o,s]}function _a(n,e,t){return de()?((t||e)&&(n+="-u",t&&(n+="-ca-"+t),e&&(n+="-nu-"+e)),n):[]}function Ra(n){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(n(r))}return e}function La(n){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(n(r))}return e}function Wt(n,e,t,r,i){var o=n.listingMode(t);return o==="error"?null:o==="en"?r(e):i(e)}function Ua(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||de()&&new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}var Ga=(function(){function n(t,r,i){if(this.padTo=i.padTo||0,this.floor=i.floor||!1,!r&&de()){var o={useGrouping:!1};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=Ma(t,o)}}var e=n.prototype;return e.format=function(r){if(this.inf){var i=this.floor?Math.floor(r):r;return this.inf.format(i)}else{var o=this.floor?Math.floor(r):cn(r,3);return Ke(o,this.padTo)}},n})(),Va=(function(){function n(t,r,i){this.opts=i,this.hasIntl=de();var o;if(t.zone.universal&&this.hasIntl){var s=-1*(t.offset/60),a=s>=0?"Etc/GMT+"+s:"Etc/GMT"+s,c=ce.isValidZone(a);t.offset!==0&&c?(o=a,this.dt=t):(o="UTC",i.timeZoneName?this.dt=t:this.dt=t.offset===0?t:M.fromMillis(t.ts+t.offset*60*1e3))}else t.zone.type==="local"?this.dt=t:(this.dt=t,o=t.zone.name);if(this.hasIntl){var l=Object.assign({},this.opts);o&&(l.timeZone=o),this.dtf=Ur(r,l)}}var e=n.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=Da(this.opts),i=B.create("en-US");return le.create(i).formatDateTimeFromString(this.dt,r)},e.formatToParts=function(){return this.hasIntl&&Ft()?this.dtf.formatToParts(this.dt.toJSDate()):[]},e.resolvedOptions=function(){return this.hasIntl?this.dtf.resolvedOptions():{locale:"en-US",numberingSystem:"latn",outputCalendar:"gregory"}},n})(),Ha=(function(){function n(t,r,i){this.opts=Object.assign({style:"long"},i),!r&&Oi()&&(this.rtf=Fa(t,i))}var e=n.prototype;return e.format=function(r,i){return this.rtf?this.rtf.format(r,i):Ca(i,r,this.opts.numeric,this.opts.style!=="long")},e.formatToParts=function(r,i){return this.rtf?this.rtf.formatToParts(r,i):[]},n})(),B=(function(){n.fromOpts=function(r){return n.create(r.locale,r.numberingSystem,r.outputCalendar,r.defaultToEN)},n.create=function(r,i,o,s){s===void 0&&(s=!1);var a=r||x.defaultLocale,c=a||(s?"en-US":Pa()),l=i||x.defaultNumberingSystem,u=o||x.defaultOutputCalendar;return new n(c,l,u,a)},n.resetCache=function(){Ne=null,Lr={},Gr={},Vr={}},n.fromObject=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar;return n.create(o,s,a)};function n(t,r,i,o){var s=Ba(t),a=s[0],c=s[1],l=s[2];this.locale=a,this.numberingSystem=r||c||null,this.outputCalendar=i||l||null,this.intl=_a(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}var e=n.prototype;return e.listingMode=function(r){r===void 0&&(r=!0);var i=de(),o=i&&Ft(),s=this.isEnglish(),a=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return!o&&!(s&&a)&&!r?"error":!o||s&&a?"en":"intl"},e.clone=function(r){return!r||Object.getOwnPropertyNames(r).length===0?this:n.create(r.locale||this.specifiedLocale,r.numberingSystem||this.numberingSystem,r.outputCalendar||this.outputCalendar,r.defaultToEN||!1)},e.redefaultToEN=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!0}))},e.redefaultToSystem=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!1}))},e.months=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Wt(this,r,o,Pi,function(){var a=i?{month:r,day:"numeric"}:{month:r},c=i?"format":"standalone";return s.monthsCache[c][r]||(s.monthsCache[c][r]=Ra(function(l){return s.extract(l,a,"month")})),s.monthsCache[c][r]})},e.weekdays=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Wt(this,r,o,Ri,function(){var a=i?{weekday:r,year:"numeric",month:"long",day:"numeric"}:{weekday:r},c=i?"format":"standalone";return s.weekdaysCache[c][r]||(s.weekdaysCache[c][r]=La(function(l){return s.extract(l,a,"weekday")})),s.weekdaysCache[c][r]})},e.meridiems=function(r){var i=this;return r===void 0&&(r=!0),Wt(this,void 0,r,function(){return Li},function(){if(!i.meridiemCache){var o={hour:"numeric",hour12:!0};i.meridiemCache=[M.utc(2016,11,13,9),M.utc(2016,11,13,19)].map(function(s){return i.extract(s,o,"dayperiod")})}return i.meridiemCache})},e.eras=function(r,i){var o=this;return i===void 0&&(i=!0),Wt(this,r,i,Ui,function(){var s={era:r};return o.eraCache[r]||(o.eraCache[r]=[M.utc(-40,1,1),M.utc(2017,1,1)].map(function(a){return o.extract(a,s,"era")})),o.eraCache[r]})},e.extract=function(r,i,o){var s=this.dtFormatter(r,i),a=s.formatToParts(),c=a.find(function(l){return l.type.toLowerCase()===o});return c?c.value:null},e.numberFormatter=function(r){return r===void 0&&(r={}),new Ga(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,i){return i===void 0&&(i={}),new Va(r,this.intl,i)},e.relFormatter=function(r){return r===void 0&&(r={}),new Ha(this.intl,this.isEnglish(),r)},e.isEnglish=function(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||de()&&new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")},e.equals=function(r){return this.locale===r.locale&&this.numberingSystem===r.numberingSystem&&this.outputCalendar===r.outputCalendar},oe(n,[{key:"fastNumbers",get:function(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Ua(this)),this.fastNumbersCached}}]),n})();function et(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];var r=e.reduce(function(i,o){return i+o.source},"");return RegExp("^"+r+"$")}function _e(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r){return e.reduce(function(i,o){var s=i[0],a=i[1],c=i[2],l=o(r,c),u=l[0],d=l[1],f=l[2];return[Object.assign(s,u),a||d,f]},[{},null,1]).slice(0,2)}}function tt(n){if(n==null)return[null,null];for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];for(var i=0,o=t;i<o.length;i++){var s=o[i],a=s[0],c=s[1],l=a.exec(n);if(l)return c(l)}return[null,null]}function Vi(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r,i){var o={},s;for(s=0;s<e.length;s++)o[e[s]]=V(r[i+s]);return[o,null,i+s]}}var Hi=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,fn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,$i=RegExp(""+fn.source+Hi.source+"?"),hn=RegExp("(?:T"+$i.source+")?"),$a=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,ja=/(\d{4})-?W(\d\d)(?:-?(\d))?/,za=/(\d{4})-?(\d{3})/,qa=Vi("weekYear","weekNumber","weekDay"),Za=Vi("year","ordinal"),Wa=/(\d{4})-(\d\d)-(\d\d)/,ji=RegExp(fn.source+" ?(?:"+Hi.source+"|("+Mi.source+"))?"),Ya=RegExp("(?: "+ji.source+")?");function Je(n,e,t){var r=n[e];return A(r)?t:V(r)}function zi(n,e){var t={year:Je(n,e),month:Je(n,e+1,1),day:Je(n,e+2,1)};return[t,null,e+3]}function Re(n,e){var t={hours:Je(n,e,0),minutes:Je(n,e+1,0),seconds:Je(n,e+2,0),milliseconds:ln(n[e+3])};return[t,null,e+4]}function rt(n,e){var t=!n[e]&&!n[e+1],r=sr(n[e+1],n[e+2]),i=t?null:$.instance(r);return[{},i,e+3]}function qi(n,e){var t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}var Ka=RegExp("^T?"+fn.source+"$"),Ja=/^-?P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,9}))?S)?)?)$/;function Qa(n){var e=n[0],t=n[1],r=n[2],i=n[3],o=n[4],s=n[5],a=n[6],c=n[7],l=n[8],u=e[0]==="-",d=c&&c[0]==="-",f=function(g,v){return v===void 0&&(v=!1),g!==void 0&&(v||g&&u)?-g:g};return[{years:f(V(t)),months:f(V(r)),weeks:f(V(i)),days:f(V(o)),hours:f(V(s)),minutes:f(V(a)),seconds:f(V(c),c==="-0"),milliseconds:f(ln(l),d)}]}var Xa={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function pn(n,e,t,r,i,o,s){var a={year:e.length===2?_r(V(e)):V(e),month:Fi.indexOf(t)+1,day:V(r),hour:V(i),minute:V(o)};return s&&(a.second=V(s)),n&&(a.weekday=n.length>3?Bi.indexOf(n)+1:_i.indexOf(n)+1),a}var eu=/^(?:(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 tu(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=n[8],l=n[9],u=n[10],d=n[11],f=pn(e,i,r,t,o,s,a),p;return c?p=Xa[c]:l?p=0:p=sr(u,d),[f,new $(p)]}function ru(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var nu=/^(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$/,iu=/^(Monday|Tuesday|Wedsday|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$/,ou=/^(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 ci(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=pn(e,i,r,t,o,s,a);return[c,$.utcInstance]}function su(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=pn(e,a,t,r,i,o,s);return[c,$.utcInstance]}var au=et($a,hn),uu=et(ja,hn),lu=et(za,hn),cu=et($i),du=_e(zi,Re,rt),fu=_e(qa,Re,rt),hu=_e(Za,Re,rt),pu=_e(Re,rt);function mu(n){return tt(n,[au,du],[uu,fu],[lu,hu],[cu,pu])}function gu(n){return tt(ru(n),[eu,tu])}function yu(n){return tt(n,[nu,ci],[iu,ci],[ou,su])}function vu(n){return tt(n,[Ja,Qa])}var wu=_e(Re);function Eu(n){return tt(n,[Ka,wu])}var Tu=et(Wa,Ya),Au=et(ji),bu=_e(zi,Re,rt,qi),Cu=_e(Re,rt,qi);function Du(n){return tt(n,[Tu,bu],[Au,Cu])}var Su="Invalid Duration",Zi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Iu=Object.assign({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:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3}},Zi),W=146097/400,Ze=146097/4800,Ou=Object.assign({years:{quarters:4,months:12,weeks:W/7,days:W,hours:W*24,minutes:W*24*60,seconds:W*24*60*60,milliseconds:W*24*60*60*1e3},quarters:{months:3,weeks:W/28,days:W/4,hours:W*24/4,minutes:W*24*60/4,seconds:W*24*60*60/4,milliseconds:W*24*60*60*1e3/4},months:{weeks:Ze/7,days:Ze,hours:Ze*24,minutes:Ze*24*60,seconds:Ze*24*60*60,milliseconds:Ze*24*60*60*1e3}},Zi),We=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ku=We.slice(0).reverse();function xe(n,e,t){t===void 0&&(t=!1);var r={values:t?e.values:Object.assign({},n.values,e.values||{}),loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy};return new H(r)}function xu(n){return n<0?Math.floor(n):Math.ceil(n)}function Wi(n,e,t,r,i){var o=n[i][t],s=e[t]/o,a=Math.sign(s)===Math.sign(r[i]),c=!a&&r[i]!==0&&Math.abs(s)<=1?xu(s):Math.trunc(s);r[i]+=c,e[t]-=c*o}function Nu(n,e){ku.reduce(function(t,r){return A(e[r])?t:(t&&Wi(n,e,t,e,r),r)},null)}var H=(function(){function n(t){var r=t.conversionAccuracy==="longterm"||!1;this.values=t.values,this.loc=t.loc||B.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=r?Ou:Iu,this.isLuxonDuration=!0}n.fromMillis=function(r,i){return n.fromObject(Object.assign({milliseconds:r},i))},n.fromObject=function(r){if(r==null||typeof r!="object")throw new Y("Duration.fromObject: argument expected to be an object, got "+(r===null?"null":typeof r));return new n({values:nr(r,n.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:B.fromObject(r),conversionAccuracy:r.conversionAccuracy})},n.fromISO=function(r,i){var o=vu(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.fromISOTime=function(r,i){var o=Eu(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new Y("need to specify a reason the Duration is invalid");var o=r instanceof ie?r:new ie(r,i);if(x.throwOnInvalid)throw new la(o);return new n({invalid:o})},n.normalizeUnit=function(r){var i={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"}[r&&r.toLowerCase()];if(!i)throw new Di(r);return i},n.isDuration=function(r){return r&&r.isLuxonDuration||!1};var e=n.prototype;return e.toFormat=function(r,i){i===void 0&&(i={});var o=Object.assign({},i,{floor:i.round!==!1&&i.floor!==!1});return this.isValid?le.create(this.loc,o).formatDurationFromString(this,r):Su},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.values);return r.includeConfig&&(i.conversionAccuracy=this.conversionAccuracy,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toISO=function(){if(!this.isValid)return null;var r="P";return this.years!==0&&(r+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(r+=this.months+this.quarters*3+"M"),this.weeks!==0&&(r+=this.weeks+"W"),this.days!==0&&(r+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(r+="T"),this.hours!==0&&(r+=this.hours+"H"),this.minutes!==0&&(r+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(r+=cn(this.seconds+this.milliseconds/1e3,3)+"S"),r==="P"&&(r+="T0S"),r},e.toISOTime=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=this.toMillis();if(i<0||i>=864e5)return null;r=Object.assign({suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended"},r);var o=this.shiftTo("hours","minutes","seconds","milliseconds"),s=r.format==="basic"?"hhmm":"hh:mm";(!r.suppressSeconds||o.seconds!==0||o.milliseconds!==0)&&(s+=r.format==="basic"?"ss":":ss",(!r.suppressMilliseconds||o.milliseconds!==0)&&(s+=".SSS"));var a=o.toFormat(s);return r.includePrefix&&(a="T"+a),a},e.toJSON=function(){return this.toISO()},e.toString=function(){return this.toISO()},e.toMillis=function(){return this.as("milliseconds")},e.valueOf=function(){return this.toMillis()},e.plus=function(r){if(!this.isValid)return this;for(var i=Fe(r),o={},s=Te(We),a;!(a=s()).done;){var c=a.value;(Qe(i.values,c)||Qe(this.values,c))&&(o[c]=i.get(c)+this.get(c))}return xe(this,{values:o},!0)},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r);return this.plus(i.negate())},e.mapUnits=function(r){if(!this.isValid)return this;for(var i={},o=0,s=Object.keys(this.values);o<s.length;o++){var a=s[o];i[a]=Ni(r(this.values[a],a))}return xe(this,{values:i},!0)},e.get=function(r){return this[n.normalizeUnit(r)]},e.set=function(r){if(!this.isValid)return this;var i=Object.assign(this.values,nr(r,n.normalizeUnit,[]));return xe(this,{values:i})},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.conversionAccuracy,c=this.loc.clone({locale:o,numberingSystem:s}),l={loc:c};return a&&(l.conversionAccuracy=a),xe(this,l)},e.as=function(r){return this.isValid?this.shiftTo(r).get(r):NaN},e.normalize=function(){if(!this.isValid)return this;var r=this.toObject();return Nu(this.matrix,r),xe(this,{values:r},!0)},e.shiftTo=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!this.isValid)return this;if(i.length===0)return this;i=i.map(function(S){return n.normalizeUnit(S)});for(var s={},a={},c=this.toObject(),l,u=Te(We),d;!(d=u()).done;){var f=d.value;if(i.indexOf(f)>=0){l=f;var p=0;for(var g in a)p+=this.matrix[g][f]*a[g],a[g]=0;Pe(c[f])&&(p+=c[f]);var v=Math.trunc(p);s[f]=v,a[f]=p-v;for(var w in c)We.indexOf(w)>We.indexOf(f)&&Wi(this.matrix,c,w,s,f)}else Pe(c[f])&&(a[f]=c[f])}for(var y in a)a[y]!==0&&(s[l]+=y===l?a[y]:a[y]/this.matrix[l][y]);return xe(this,{values:s},!0).normalize()},e.negate=function(){if(!this.isValid)return this;for(var r={},i=0,o=Object.keys(this.values);i<o.length;i++){var s=o[i];r[s]=-this.values[s]}return xe(this,{values:r},!0)},e.equals=function(r){if(!this.isValid||!r.isValid||!this.loc.equals(r.loc))return!1;function i(c,l){return c===void 0||c===0?l===void 0||l===0:c===l}for(var o=Te(We),s;!(s=o()).done;){var a=s.value;if(!i(this.values[a],r.values[a]))return!1}return!0},oe(n,[{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"years",get:function(){return this.isValid?this.values.years||0:NaN}},{key:"quarters",get:function(){return this.isValid?this.values.quarters||0:NaN}},{key:"months",get:function(){return this.isValid?this.values.months||0:NaN}},{key:"weeks",get:function(){return this.isValid?this.values.weeks||0:NaN}},{key:"days",get:function(){return this.isValid?this.values.days||0:NaN}},{key:"hours",get:function(){return this.isValid?this.values.hours||0:NaN}},{key:"minutes",get:function(){return this.isValid?this.values.minutes||0:NaN}},{key:"seconds",get:function(){return this.isValid?this.values.seconds||0:NaN}},{key:"milliseconds",get:function(){return this.isValid?this.values.milliseconds||0:NaN}},{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})();function Fe(n){if(Pe(n))return H.fromMillis(n);if(H.isDuration(n))return n;if(typeof n=="object")return H.fromObject(n);throw new Y("Unknown duration argument "+n+" of type "+typeof n)}var Dt="Invalid Interval";function Mu(n,e){return!n||!n.isValid?Mt.invalid("missing or invalid start"):!e||!e.isValid?Mt.invalid("missing or invalid end"):e<n?Mt.invalid("end before start","The end of an interval must be after its start, but you had start="+n.toISO()+" and end="+e.toISO()):null}var Mt=(function(){function n(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new Y("need to specify a reason the Interval is invalid");var o=r instanceof ie?r:new ie(r,i);if(x.throwOnInvalid)throw new ua(o);return new n({invalid:o})},n.fromDateTimes=function(r,i){var o=Ot(r),s=Ot(i),a=Mu(o,s);return a==null?new n({start:o,end:s}):a},n.after=function(r,i){var o=Fe(i),s=Ot(r);return n.fromDateTimes(s,s.plus(o))},n.before=function(r,i){var o=Fe(i),s=Ot(r);return n.fromDateTimes(s.minus(o),s)},n.fromISO=function(r,i){var o=(r||"").split("/",2),s=o[0],a=o[1];if(s&&a){var c,l;try{c=M.fromISO(s,i),l=c.isValid}catch(g){l=!1}var u,d;try{u=M.fromISO(a,i),d=u.isValid}catch(g){d=!1}if(l&&d)return n.fromDateTimes(c,u);if(l){var f=H.fromISO(a,i);if(f.isValid)return n.after(c,f)}else if(d){var p=H.fromISO(s,i);if(p.isValid)return n.before(u,p)}}return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.isInterval=function(r){return r&&r.isLuxonInterval||!1};var e=n.prototype;return e.length=function(r){return r===void 0&&(r="milliseconds"),this.isValid?this.toDuration.apply(this,[r]).get(r):NaN},e.count=function(r){if(r===void 0&&(r="milliseconds"),!this.isValid)return NaN;var i=this.start.startOf(r),o=this.end.startOf(r);return Math.floor(o.diff(i,r).get(r))+1},e.hasSame=function(r){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,r):!1},e.isEmpty=function(){return this.s.valueOf()===this.e.valueOf()},e.isAfter=function(r){return this.isValid?this.s>r:!1},e.isBefore=function(r){return this.isValid?this.e<=r:!1},e.contains=function(r){return this.isValid?this.s<=r&&this.e>r:!1},e.set=function(r){var i=r===void 0?{}:r,o=i.start,s=i.end;return this.isValid?n.fromDateTimes(o||this.s,s||this.e):this},e.splitAt=function(){var r=this;if(!this.isValid)return[];for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];for(var a=o.map(Ot).filter(function(p){return r.contains(p)}).sort(),c=[],l=this.s,u=0;l<this.e;){var d=a[u]||this.e,f=+d>+this.e?this.e:d;c.push(n.fromDateTimes(l,f)),l=f,u+=1}return c},e.splitBy=function(r){var i=Fe(r);if(!this.isValid||!i.isValid||i.as("milliseconds")===0)return[];for(var o=this.s,s=1,a,c=[];o<this.e;){var l=this.start.plus(i.mapUnits(function(u){return u*s}));a=+l>+this.e?this.e:l,c.push(n.fromDateTimes(o,a)),o=a,s+=1}return c},e.divideEqually=function(r){return this.isValid?this.splitBy(this.length()/r).slice(0,r):[]},e.overlaps=function(r){return this.e>r.s&&this.s<r.e},e.abutsStart=function(r){return this.isValid?+this.e==+r.s:!1},e.abutsEnd=function(r){return this.isValid?+r.e==+this.s:!1},e.engulfs=function(r){return this.isValid?this.s<=r.s&&this.e>=r.e:!1},e.equals=function(r){return!this.isValid||!r.isValid?!1:this.s.equals(r.s)&&this.e.equals(r.e)},e.intersection=function(r){if(!this.isValid)return this;var i=this.s>r.s?this.s:r.s,o=this.e<r.e?this.e:r.e;return i>=o?null:n.fromDateTimes(i,o)},e.union=function(r){if(!this.isValid)return this;var i=this.s<r.s?this.s:r.s,o=this.e>r.e?this.e:r.e;return n.fromDateTimes(i,o)},n.merge=function(r){var i=r.sort(function(a,c){return a.s-c.s}).reduce(function(a,c){var l=a[0],u=a[1];return u?u.overlaps(c)||u.abutsStart(c)?[l,u.union(c)]:[l.concat([u]),c]:[l,c]},[[],null]),o=i[0],s=i[1];return s&&o.push(s),o},n.xor=function(r){for(var i,o=null,s=0,a=[],c=r.map(function(g){return[{time:g.s,type:"s"},{time:g.e,type:"e"}]}),l=(i=Array.prototype).concat.apply(i,c),u=l.sort(function(g,v){return g.time-v.time}),d=Te(u),f;!(f=d()).done;){var p=f.value;s+=p.type==="s"?1:-1,s===1?o=p.time:(o&&+o!=+p.time&&a.push(n.fromDateTimes(o,p.time)),o=null)}return n.merge(a)},e.difference=function(){for(var r=this,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return n.xor([this].concat(o)).map(function(a){return r.intersection(a)}).filter(function(a){return a&&!a.isEmpty()})},e.toString=function(){return this.isValid?"["+this.s.toISO()+" \u2013 "+this.e.toISO()+")":Dt},e.toISO=function(r){return this.isValid?this.s.toISO(r)+"/"+this.e.toISO(r):Dt},e.toISODate=function(){return this.isValid?this.s.toISODate()+"/"+this.e.toISODate():Dt},e.toISOTime=function(r){return this.isValid?this.s.toISOTime(r)+"/"+this.e.toISOTime(r):Dt},e.toFormat=function(r,i){var o=i===void 0?{}:i,s=o.separator,a=s===void 0?" \u2013 ":s;return this.isValid?""+this.s.toFormat(r)+a+this.e.toFormat(r):Dt},e.toDuration=function(r,i){return this.isValid?this.e.diff(this.s,r,i):H.invalid(this.invalidReason)},e.mapEndpoints=function(r){return n.fromDateTimes(r(this.s),r(this.e))},oe(n,[{key:"start",get:function(){return this.isValid?this.s:null}},{key:"end",get:function(){return this.isValid?this.e:null}},{key:"isValid",get:function(){return this.invalidReason===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})(),xt=(function(){function n(){}return n.hasDST=function(t){t===void 0&&(t=x.defaultZone);var r=M.now().setZone(t).set({month:12});return!t.universal&&r.offset!==r.set({month:6}).offset},n.isValidIANAZone=function(t){return ce.isValidSpecifier(t)&&ce.isValidZone(t)},n.normalizeZone=function(t){return Me(t,x.defaultZone)},n.months=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t)},n.monthsFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t,!0)},n.weekdays=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t)},n.weekdaysFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t,!0)},n.meridiems=function(t){var r=t===void 0?{}:t,i=r.locale,o=i===void 0?null:i;return B.create(o).meridiems()},n.eras=function(t,r){t===void 0&&(t="short");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o;return B.create(s,null,"gregory").eras(t)},n.features=function(){var t=!1,r=!1,i=!1,o=!1;if(de()){t=!0,r=Ft(),o=Oi();try{i=new Intl.DateTimeFormat("en",{timeZone:"America/New_York"}).resolvedOptions().timeZone==="America/New_York"}catch(s){i=!1}}return{intl:t,intlTokens:r,zones:i,relative:o}},n})();function di(n,e){var t=function(o){return o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf()},r=t(e)-t(n);return Math.floor(H.fromMillis(r).as("days"))}function Fu(n,e,t){for(var r=[["years",function(v,w){return w.year-v.year}],["quarters",function(v,w){return w.quarter-v.quarter}],["months",function(v,w){return w.month-v.month+(w.year-v.year)*12}],["weeks",function(v,w){var y=di(v,w);return(y-y%7)/7}],["days",di]],i={},o,s,a=0,c=r;a<c.length;a++){var l=c[a],u=l[0],d=l[1];if(t.indexOf(u)>=0){var f;o=u;var p=d(n,e);if(s=n.plus((f={},f[u]=p,f)),s>e){var g;n=n.plus((g={},g[u]=p-1,g)),p-=1}else n=s;i[u]=p}}return[n,i,s,o]}function Pu(n,e,t,r){var i=Fu(n,e,t),o=i[0],s=i[1],a=i[2],c=i[3],l=e-o,u=t.filter(function(g){return["hours","minutes","seconds","milliseconds"].indexOf(g)>=0});if(u.length===0){if(a<e){var d;a=o.plus((d={},d[c]=1,d))}a!==o&&(s[c]=(s[c]||0)+l/(a-o))}var f=H.fromObject(Object.assign(s,r));if(u.length>0){var p;return(p=H.fromMillis(l,r)).shiftTo.apply(p,u).plus(f)}else return f}var mn={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"},fi={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]},Bu=mn.hanidec.replace(/[\[|\]]/g,"").split("");function _u(n){var e=parseInt(n,10);if(isNaN(e)){e="";for(var t=0;t<n.length;t++){var r=n.charCodeAt(t);if(n[t].search(mn.hanidec)!==-1)e+=Bu.indexOf(n[t]);else for(var i in fi){var o=fi[i],s=o[0],a=o[1];r>=s&&r<=a&&(e+=r-s)}}return parseInt(e,10)}else return e}function re(n,e){var t=n.numberingSystem;return e===void 0&&(e=""),new RegExp(""+mn[t||"latn"]+e)}var Ru="missing Intl.DateTimeFormat.formatToParts support";function b(n,e){return e===void 0&&(e=function(r){return r}),{regex:n,deser:function(r){var i=r[0];return e(_u(i))}}}var Lu="\xA0",Yi="( |"+Lu+")",Ki=new RegExp(Yi,"g");function Uu(n){return n.replace(/\./g,"\\.?").replace(Ki,Yi)}function hi(n){return n.replace(/\./g,"").replace(Ki," ").toLowerCase()}function ne(n,e){return n===null?null:{regex:RegExp(n.map(Uu).join("|")),deser:function(r){var i=r[0];return n.findIndex(function(o){return hi(i)===hi(o)})+e}}}function pi(n,e){return{regex:n,deser:function(r){var i=r[1],o=r[2];return sr(i,o)},groups:e}}function mi(n){return{regex:n,deser:function(t){var r=t[0];return r}}}function Gu(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Vu(n,e){var t=re(e),r=re(e,"{2}"),i=re(e,"{3}"),o=re(e,"{4}"),s=re(e,"{6}"),a=re(e,"{1,2}"),c=re(e,"{1,3}"),l=re(e,"{1,6}"),u=re(e,"{1,9}"),d=re(e,"{2,4}"),f=re(e,"{4,6}"),p=function(y){return{regex:RegExp(Gu(y.val)),deser:function(ae){var D=ae[0];return D},literal:!0}},g=function(y){if(n.literal)return p(y);switch(y.val){case"G":return ne(e.eras("short",!1),0);case"GG":return ne(e.eras("long",!1),0);case"y":return b(l);case"yy":return b(d,_r);case"yyyy":return b(o);case"yyyyy":return b(f);case"yyyyyy":return b(s);case"M":return b(a);case"MM":return b(r);case"MMM":return ne(e.months("short",!0,!1),1);case"MMMM":return ne(e.months("long",!0,!1),1);case"L":return b(a);case"LL":return b(r);case"LLL":return ne(e.months("short",!1,!1),1);case"LLLL":return ne(e.months("long",!1,!1),1);case"d":return b(a);case"dd":return b(r);case"o":return b(c);case"ooo":return b(i);case"HH":return b(r);case"H":return b(a);case"hh":return b(r);case"h":return b(a);case"mm":return b(r);case"m":return b(a);case"q":return b(a);case"qq":return b(r);case"s":return b(a);case"ss":return b(r);case"S":return b(c);case"SSS":return b(i);case"u":return mi(u);case"a":return ne(e.meridiems(),0);case"kkkk":return b(o);case"kk":return b(d,_r);case"W":return b(a);case"WW":return b(r);case"E":case"c":return b(t);case"EEE":return ne(e.weekdays("short",!1,!1),1);case"EEEE":return ne(e.weekdays("long",!1,!1),1);case"ccc":return ne(e.weekdays("short",!0,!1),1);case"cccc":return ne(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return pi(new RegExp("([+-]"+a.source+")(?::("+r.source+"))?"),2);case"ZZZ":return pi(new RegExp("([+-]"+a.source+")("+r.source+")?"),2);case"z":return mi(/[a-z_+-/]{1,256}?/i);default:return p(y)}},v=g(n)||{invalidReason:Ru};return v.token=n,v}var Hu={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",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"}};function $u(n,e,t){var r=n.type,i=n.value;if(r==="literal")return{literal:!0,val:i};var o=t[r],s=Hu[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function ju(n){var e=n.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",n]}function zu(n,e,t){var r=n.match(e);if(r){var i={},o=1;for(var s in t)if(Qe(t,s)){var a=t[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(o,o+c))),o+=c}return[r,i]}else return[r,{}]}function qu(n){var e=function(o){switch(o){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}},t;A(n.Z)?A(n.z)?t=null:t=ce.create(n.z):t=new $(n.Z),A(n.q)||(n.M=(n.q-1)*3+1),A(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),A(n.u)||(n.S=ln(n.u));var r=Object.keys(n).reduce(function(i,o){var s=e(o);return s&&(i[s]=n[o]),i},{});return[r,t]}var xr=null;function Zu(){return xr||(xr=M.fromMillis(1555555555555)),xr}function Wu(n,e){if(n.literal)return n;var t=le.macroTokenToFormatOpts(n.val);if(!t)return n;var r=le.create(e,t),i=r.formatDateTimeParts(Zu()),o=i.map(function(s){return $u(s,e,t)});return o.includes(void 0)?n:o}function Yu(n,e){var t;return(t=Array.prototype).concat.apply(t,n.map(function(r){return Wu(r,e)}))}function Ji(n,e,t){var r=Yu(le.parseFormat(t),n),i=r.map(function(w){return Vu(w,n)}),o=i.find(function(w){return w.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=ju(i),a=s[0],c=s[1],l=RegExp(a,"i"),u=zu(e,l,c),d=u[0],f=u[1],p=f?qu(f):[null,null],g=p[0],v=p[1];if(Qe(f,"a")&&Qe(f,"H"))throw new kt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:l,rawMatches:d,matches:f,result:g,zone:v}}function Ku(n,e,t){var r=Ji(n,e,t),i=r.result,o=r.zone,s=r.invalidReason;return[i,o,s]}var Qi=[0,31,59,90,120,151,181,212,243,273,304,334],Xi=[0,31,60,91,121,152,182,213,244,274,305,335];function K(n,e){return new ie("unit out of range","you specified "+e+" (of type "+typeof e+") as a "+n+", which is invalid")}function eo(n,e,t){var r=new Date(Date.UTC(n,e-1,t)).getUTCDay();return r===0?7:r}function to(n,e,t){return t+(Pt(n)?Xi:Qi)[e-1]}function ro(n,e){var t=Pt(n)?Xi:Qi,r=t.findIndex(function(o){return o<e}),i=e-t[r];return{month:r+1,day:i}}function Hr(n){var e=n.year,t=n.month,r=n.day,i=to(e,t,r),o=eo(e,t,r),s=Math.floor((i-o+10)/7),a;return s<1?(a=e-1,s=rr(a)):s>rr(e)?(a=e+1,s=1):a=e,Object.assign({weekYear:a,weekNumber:s,weekday:o},ar(n))}function gi(n){var e=n.weekYear,t=n.weekNumber,r=n.weekday,i=eo(e,1,4),o=Nt(e),s=t*7+r-i-3,a;s<1?(a=e-1,s+=Nt(a)):s>o?(a=e+1,s-=Nt(e)):a=e;var c=ro(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},ar(n))}function Nr(n){var e=n.year,t=n.month,r=n.day,i=to(e,t,r);return Object.assign({year:e,ordinal:i},ar(n))}function yi(n){var e=n.year,t=n.ordinal,r=ro(e,t),i=r.month,o=r.day;return Object.assign({year:e,month:i,day:o},ar(n))}function Ju(n){var e=or(n.weekYear),t=pe(n.weekNumber,1,rr(n.weekYear)),r=pe(n.weekday,1,7);return e?t?r?!1:K("weekday",n.weekday):K("week",n.week):K("weekYear",n.weekYear)}function Qu(n){var e=or(n.year),t=pe(n.ordinal,1,Nt(n.year));return e?t?!1:K("ordinal",n.ordinal):K("year",n.year)}function no(n){var e=or(n.year),t=pe(n.month,1,12),r=pe(n.day,1,tr(n.year,n.month));return e?t?r?!1:K("day",n.day):K("month",n.month):K("year",n.year)}function io(n){var e=n.hour,t=n.minute,r=n.second,i=n.millisecond,o=pe(e,0,23)||e===24&&t===0&&r===0&&i===0,s=pe(t,0,59),a=pe(r,0,59),c=pe(i,0,999);return o?s?a?c?!1:K("millisecond",i):K("second",r):K("minute",t):K("hour",e)}var Mr="Invalid DateTime",vi=864e13;function Yt(n){return new ie("unsupported zone",'the zone "'+n.name+'" is not supported')}function Fr(n){return n.weekData===null&&(n.weekData=Hr(n.c)),n.weekData}function St(n,e){var t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new M(Object.assign({},t,e,{old:t}))}function oo(n,e,t){var r=n-e*60*1e3,i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;var o=t.offset(r);return i===o?[r,i]:[n-Math.min(i,o)*60*1e3,Math.max(i,o)]}function wi(n,e){n+=e*60*1e3;var t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Qt(n,e,t){return oo(dn(n),e,t)}function Ei(n,e){var t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o=Object.assign({},n.c,{year:r,month:i,day:Math.min(n.c.day,tr(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7}),s=H.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=dn(o),c=oo(a,t,n.zone),l=c[0],u=c[1];return s!==0&&(l+=s,u=n.zone.offset(l)),{ts:l,o:u}}function It(n,e,t,r,i){var o=t.setZone,s=t.zone;if(n&&Object.keys(n).length!==0){var a=e||s,c=M.fromObject(Object.assign(n,t,{zone:a,setZone:void 0}));return o?c:c.setZone(s)}else return M.invalid(new ie("unparsable",'the input "'+i+`" can't be parsed as `+r))}function Ye(n,e,t){return t===void 0&&(t=!0),n.isValid?le.create(B.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Ti(n,e){var t=e.suppressSeconds,r=t===void 0?!1:t,i=e.suppressMilliseconds,o=i===void 0?!1:i,s=e.includeOffset,a=e.includePrefix,c=a===void 0?!1:a,l=e.includeZone,u=l===void 0?!1:l,d=e.spaceZone,f=d===void 0?!1:d,p=e.format,g=p===void 0?"extended":p,v=g==="basic"?"HHmm":"HH:mm";(!r||n.second!==0||n.millisecond!==0)&&(v+=g==="basic"?"ss":":ss",(!o||n.millisecond!==0)&&(v+=".SSS")),(u||s)&&f&&(v+=" "),u?v+="z":s&&(v+=g==="basic"?"ZZZ":"ZZ");var w=Ye(n,v);return c&&(w="T"+w),w}var so={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Xu={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},el={ordinal:1,hour:0,minute:0,second:0,millisecond:0},ao=["year","month","day","hour","minute","second","millisecond"],tl=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],rl=["year","ordinal","hour","minute","second","millisecond"];function Ai(n){var e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Di(n);return e}function bi(n,e){for(var t=Te(ao),r;!(r=t()).done;){var i=r.value;A(n[i])&&(n[i]=so[i])}var o=no(n)||io(n);if(o)return M.invalid(o);var s=x.now(),a=e.offset(s),c=Qt(n,a,e),l=c[0],u=c[1];return new M({ts:l,zone:e,o:u})}function Ci(n,e,t){var r=A(t.round)?!0:t.round,i=function(d,f){d=cn(d,r||t.calendary?0:2,!0);var p=e.loc.clone(t).relFormatter(t);return p.format(d,f)},o=function(d){return t.calendary?e.hasSame(n,d)?0:e.startOf(d).diff(n.startOf(d),d).get(d):e.diff(n,d).get(d)};if(t.unit)return i(o(t.unit),t.unit);for(var s=Te(t.units),a;!(a=s()).done;){var c=a.value,l=o(c);if(Math.abs(l)>=1)return i(l,c)}return i(n>e?-0:0,t.units[t.units.length-1])}var M=(function(){function n(t){var r=t.zone||x.defaultZone,i=t.invalid||(Number.isNaN(t.ts)?new ie("invalid input"):null)||(r.isValid?null:Yt(r));this.ts=A(t.ts)?x.now():t.ts;var o=null,s=null;if(!i){var a=t.old&&t.old.ts===this.ts&&t.old.zone.equals(r);if(a){var c=[t.old.c,t.old.o];o=c[0],s=c[1]}else{var l=r.offset(this.ts);o=wi(this.ts,l),i=Number.isNaN(o.year)?new ie("invalid input"):null,o=i?null:o,s=i?null:l}}this._zone=r,this.loc=t.loc||B.create(),this.invalid=i,this.weekData=null,this.c=o,this.o=s,this.isLuxonDateTime=!0}n.now=function(){return new n({})},n.local=function(r,i,o,s,a,c,l){return A(r)?n.now():bi({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},x.defaultZone)},n.utc=function(r,i,o,s,a,c,l){return A(r)?new n({ts:x.now(),zone:$.utcInstance}):bi({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},$.utcInstance)},n.fromJSDate=function(r,i){i===void 0&&(i={});var o=da(r)?r.valueOf():NaN;if(Number.isNaN(o))return n.invalid("invalid input");var s=Me(i.zone,x.defaultZone);return s.isValid?new n({ts:o,zone:s,loc:B.fromObject(i)}):n.invalid(Yt(s))},n.fromMillis=function(r,i){if(i===void 0&&(i={}),Pe(r))return r<-vi||r>vi?n.invalid("Timestamp out of range"):new n({ts:r,zone:Me(i.zone,x.defaultZone),loc:B.fromObject(i)});throw new Y("fromMillis requires a numerical input, but received a "+typeof r+" with value "+r)},n.fromSeconds=function(r,i){if(i===void 0&&(i={}),Pe(r))return new n({ts:r*1e3,zone:Me(i.zone,x.defaultZone),loc:B.fromObject(i)});throw new Y("fromSeconds requires a numerical input")},n.fromObject=function(r){var i=Me(r.zone,x.defaultZone);if(!i.isValid)return n.invalid(Yt(i));var o=x.now(),s=i.offset(o),a=nr(r,Ai,["zone","locale","outputCalendar","numberingSystem"]),c=!A(a.ordinal),l=!A(a.year),u=!A(a.month)||!A(a.day),d=l||u,f=a.weekYear||a.weekNumber,p=B.fromObject(r);if((d||c)&&f)throw new kt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new kt("Can't mix ordinal dates with month/day");var g=f||a.weekday&&!d,v,w,y=wi(o,s);g?(v=tl,w=Xu,y=Hr(y)):c?(v=rl,w=el,y=Nr(y)):(v=ao,w=so);for(var S=!1,ae=Te(v),D;!(D=ae()).done;){var L=D.value,Dr=a[L];A(Dr)?S?a[L]=w[L]:a[L]=y[L]:S=!0}var Vs=g?Ju(a):c?Qu(a):no(a),Bn=Vs||io(a);if(Bn)return n.invalid(Bn);var Hs=g?gi(a):c?yi(a):a,_n=Qt(Hs,s,i),$s=_n[0],js=_n[1],Sr=new n({ts:$s,zone:i,o:js,loc:p});return a.weekday&&d&&r.weekday!==Sr.weekday?n.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+Sr.toISO()):Sr},n.fromISO=function(r,i){i===void 0&&(i={});var o=mu(r),s=o[0],a=o[1];return It(s,a,i,"ISO 8601",r)},n.fromRFC2822=function(r,i){i===void 0&&(i={});var o=gu(r),s=o[0],a=o[1];return It(s,a,i,"RFC 2822",r)},n.fromHTTP=function(r,i){i===void 0&&(i={});var o=yu(r),s=o[0],a=o[1];return It(s,a,i,"HTTP",i)},n.fromFormat=function(r,i,o){if(o===void 0&&(o={}),A(r)||A(i))throw new Y("fromFormat requires an input string and a format");var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0}),f=Ku(d,r,i),p=f[0],g=f[1],v=f[2];return v?n.invalid(v):It(p,g,o,"format "+i,r)},n.fromString=function(r,i,o){return o===void 0&&(o={}),n.fromFormat(r,i,o)},n.fromSQL=function(r,i){i===void 0&&(i={});var o=Du(r),s=o[0],a=o[1];return It(s,a,i,"SQL",r)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new Y("need to specify a reason the DateTime is invalid");var o=r instanceof ie?r:new ie(r,i);if(x.throwOnInvalid)throw new aa(o);return new n({invalid:o})},n.isDateTime=function(r){return r&&r.isLuxonDateTime||!1};var e=n.prototype;return e.get=function(r){return this[r]},e.resolvedLocaleOpts=function(r){r===void 0&&(r={});var i=le.create(this.loc.clone(r),r).resolvedOptions(this),o=i.locale,s=i.numberingSystem,a=i.calendar;return{locale:o,numberingSystem:s,outputCalendar:a}},e.toUTC=function(r,i){return r===void 0&&(r=0),i===void 0&&(i={}),this.setZone($.instance(r),i)},e.toLocal=function(){return this.setZone(x.defaultZone)},e.setZone=function(r,i){var o=i===void 0?{}:i,s=o.keepLocalTime,a=s===void 0?!1:s,c=o.keepCalendarTime,l=c===void 0?!1:c;if(r=Me(r,x.defaultZone),r.equals(this.zone))return this;if(r.isValid){var u=this.ts;if(a||l){var d=r.offset(this.ts),f=this.toObject(),p=Qt(f,d,r);u=p[0]}return St(this,{ts:u,zone:r})}else return n.invalid(Yt(r))},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar,c=this.loc.clone({locale:o,numberingSystem:s,outputCalendar:a});return St(this,{loc:c})},e.setLocale=function(r){return this.reconfigure({locale:r})},e.set=function(r){if(!this.isValid)return this;var i=nr(r,Ai,[]),o=!A(i.weekYear)||!A(i.weekNumber)||!A(i.weekday),s=!A(i.ordinal),a=!A(i.year),c=!A(i.month)||!A(i.day),l=a||c,u=i.weekYear||i.weekNumber;if((l||s)&&u)throw new kt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new kt("Can't mix ordinal dates with month/day");var d;o?d=gi(Object.assign(Hr(this.c),i)):A(i.ordinal)?(d=Object.assign(this.toObject(),i),A(i.day)&&(d.day=Math.min(tr(d.year,d.month),d.day))):d=yi(Object.assign(Nr(this.c),i));var f=Qt(d,this.o,this.zone),p=f[0],g=f[1];return St(this,{ts:p,o:g})},e.plus=function(r){if(!this.isValid)return this;var i=Fe(r);return St(this,Ei(this,i))},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r).negate();return St(this,Ei(this,i))},e.startOf=function(r){if(!this.isValid)return this;var i={},o=H.normalizeUnit(r);switch(o){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(o==="weeks"&&(i.weekday=1),o==="quarters"){var s=Math.ceil(this.month/3);i.month=(s-1)*3+1}return this.set(i)},e.endOf=function(r){var i;return this.isValid?this.plus((i={},i[r]=1,i)).startOf(r).minus(1):this},e.toFormat=function(r,i){return i===void 0&&(i={}),this.isValid?le.create(this.loc.redefaultToEN(i)).formatDateTimeFromString(this,r):Mr},e.toLocaleString=function(r){return r===void 0&&(r=er),this.isValid?le.create(this.loc.clone(r),r).formatDateTime(this):Mr},e.toLocaleParts=function(r){return r===void 0&&(r={}),this.isValid?le.create(this.loc.clone(r),r).formatDateTimeParts(this):[]},e.toISO=function(r){return r===void 0&&(r={}),this.isValid?this.toISODate(r)+"T"+this.toISOTime(r):null},e.toISODate=function(r){var i=r===void 0?{}:r,o=i.format,s=o===void 0?"extended":o,a=s==="basic"?"yyyyMMdd":"yyyy-MM-dd";return this.year>9999&&(a="+"+a),Ye(this,a)},e.toISOWeekDate=function(){return Ye(this,"kkkk-'W'WW-c")},e.toISOTime=function(r){var i=r===void 0?{}:r,o=i.suppressMilliseconds,s=o===void 0?!1:o,a=i.suppressSeconds,c=a===void 0?!1:a,l=i.includeOffset,u=l===void 0?!0:l,d=i.includePrefix,f=d===void 0?!1:d,p=i.format,g=p===void 0?"extended":p;return Ti(this,{suppressSeconds:c,suppressMilliseconds:s,includeOffset:u,includePrefix:f,format:g})},e.toRFC2822=function(){return Ye(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)},e.toHTTP=function(){return Ye(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")},e.toSQLDate=function(){return Ye(this,"yyyy-MM-dd")},e.toSQLTime=function(r){var i=r===void 0?{}:r,o=i.includeOffset,s=o===void 0?!0:o,a=i.includeZone,c=a===void 0?!1:a;return Ti(this,{includeOffset:s,includeZone:c,spaceZone:!0})},e.toSQL=function(r){return r===void 0&&(r={}),this.isValid?this.toSQLDate()+" "+this.toSQLTime(r):null},e.toString=function(){return this.isValid?this.toISO():Mr},e.valueOf=function(){return this.toMillis()},e.toMillis=function(){return this.isValid?this.ts:NaN},e.toSeconds=function(){return this.isValid?this.ts/1e3:NaN},e.toJSON=function(){return this.toISO()},e.toBSON=function(){return this.toJSDate()},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.c);return r.includeConfig&&(i.outputCalendar=this.outputCalendar,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toJSDate=function(){return new Date(this.isValid?this.ts:NaN)},e.diff=function(r,i,o){if(i===void 0&&(i="milliseconds"),o===void 0&&(o={}),!this.isValid||!r.isValid)return H.invalid(this.invalid||r.invalid,"created by diffing an invalid DateTime");var s=Object.assign({locale:this.locale,numberingSystem:this.numberingSystem},o),a=fa(i).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=Pu(l,u,a,s);return c?d.negate():d},e.diffNow=function(r,i){return r===void 0&&(r="milliseconds"),i===void 0&&(i={}),this.diff(n.now(),r,i)},e.until=function(r){return this.isValid?Mt.fromDateTimes(this,r):this},e.hasSame=function(r,i){if(!this.isValid)return!1;var o=r.valueOf(),s=this.setZone(r.zone,{keepLocalTime:!0});return s.startOf(i)<=o&&o<=s.endOf(i)},e.equals=function(r){return this.isValid&&r.isValid&&this.valueOf()===r.valueOf()&&this.zone.equals(r.zone)&&this.loc.equals(r.loc)},e.toRelative=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=r.base||n.fromObject({zone:this.zone}),o=r.padding?this<i?-r.padding:r.padding:0,s=["years","months","days","hours","minutes","seconds"],a=r.unit;return Array.isArray(r.unit)&&(s=r.unit,a=void 0),Ci(i,this.plus(o),Object.assign(r,{numeric:"always",units:s,unit:a}))},e.toRelativeCalendar=function(r){return r===void 0&&(r={}),this.isValid?Ci(r.base||n.fromObject({zone:this.zone}),this,Object.assign(r,{numeric:"auto",units:["years","months","days"],calendary:!0})):null},n.min=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new Y("min requires all arguments be DateTimes");return ni(i,function(s){return s.valueOf()},Math.min)},n.max=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new Y("max requires all arguments be DateTimes");return ni(i,function(s){return s.valueOf()},Math.max)},n.fromFormatExplain=function(r,i,o){o===void 0&&(o={});var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0});return Ji(d,r,i)},n.fromStringExplain=function(r,i,o){return o===void 0&&(o={}),n.fromFormatExplain(r,i,o)},oe(n,[{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}},{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"outputCalendar",get:function(){return this.isValid?this.loc.outputCalendar:null}},{key:"zone",get:function(){return this._zone}},{key:"zoneName",get:function(){return this.isValid?this.zone.name:null}},{key:"year",get:function(){return this.isValid?this.c.year:NaN}},{key:"quarter",get:function(){return this.isValid?Math.ceil(this.c.month/3):NaN}},{key:"month",get:function(){return this.isValid?this.c.month:NaN}},{key:"day",get:function(){return this.isValid?this.c.day:NaN}},{key:"hour",get:function(){return this.isValid?this.c.hour:NaN}},{key:"minute",get:function(){return this.isValid?this.c.minute:NaN}},{key:"second",get:function(){return this.isValid?this.c.second:NaN}},{key:"millisecond",get:function(){return this.isValid?this.c.millisecond:NaN}},{key:"weekYear",get:function(){return this.isValid?Fr(this).weekYear:NaN}},{key:"weekNumber",get:function(){return this.isValid?Fr(this).weekNumber:NaN}},{key:"weekday",get:function(){return this.isValid?Fr(this).weekday:NaN}},{key:"ordinal",get:function(){return this.isValid?Nr(this.c).ordinal:NaN}},{key:"monthShort",get:function(){return this.isValid?xt.months("short",{locObj:this.loc})[this.month-1]:null}},{key:"monthLong",get:function(){return this.isValid?xt.months("long",{locObj:this.loc})[this.month-1]:null}},{key:"weekdayShort",get:function(){return this.isValid?xt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}},{key:"weekdayLong",get:function(){return this.isValid?xt.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}},{key:"offset",get:function(){return this.isValid?+this.o:NaN}},{key:"offsetNameShort",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}},{key:"offsetNameLong",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}},{key:"isOffsetFixed",get:function(){return this.isValid?this.zone.universal:null}},{key:"isInDST",get:function(){return this.isOffsetFixed?!1:this.offset>this.set({month:1}).offset||this.offset>this.set({month:5}).offset}},{key:"isInLeapYear",get:function(){return Pt(this.year)}},{key:"daysInMonth",get:function(){return tr(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?Nt(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?rr(this.weekYear):NaN}}],[{key:"DATE_SHORT",get:function(){return er}},{key:"DATE_MED",get:function(){return $r}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return Si}},{key:"DATE_FULL",get:function(){return jr}},{key:"DATE_HUGE",get:function(){return zr}},{key:"TIME_SIMPLE",get:function(){return qr}},{key:"TIME_WITH_SECONDS",get:function(){return Zr}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return Wr}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return Yr}},{key:"TIME_24_SIMPLE",get:function(){return Kr}},{key:"TIME_24_WITH_SECONDS",get:function(){return Jr}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return Qr}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return Xr}},{key:"DATETIME_SHORT",get:function(){return en}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return tn}},{key:"DATETIME_MED",get:function(){return rn}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return nn}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return Ii}},{key:"DATETIME_FULL",get:function(){return on}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return sn}},{key:"DATETIME_HUGE",get:function(){return an}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return un}}]),n})();function Ot(n){if(M.isDateTime(n))return n;if(n&&n.valueOf&&Pe(n.valueOf()))return M.fromJSDate(n);if(n&&typeof n=="object")return M.fromObject(n);throw new Y("Unknown datetime argument: "+n+", of type "+typeof n)}var nl="1.28.1";z.DateTime=M;z.Duration=H;z.FixedOffsetZone=$;z.IANAZone=ce;z.Info=xt;z.Interval=Mt;z.InvalidZone=Rr;z.LocalZone=Gi;z.Settings=x;z.VERSION=nl;z.Zone=Xe});var bl={};Js(bl,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>ut,Agent:()=>lt,Amount:()=>E,App:()=>ve,Backlog:()=>Et,Balance:()=>Oe,BalanceType:()=>Ae,BalancesDataTableBuilder:()=>he,BalancesReport:()=>vt,Billing:()=>ht,Bkper:()=>O,BkperError:()=>ue,Book:()=>X,BooksDataTableBuilder:()=>Cr,BotResponse:()=>ft,BotResponseType:()=>ot,Collaborator:()=>ct,Collection:()=>De,Connection:()=>je,DecimalSeparator:()=>He,Event:()=>pt,EventList:()=>mt,EventType:()=>fr,File:()=>Ie,Group:()=>Q,GroupsDataTableBuilder:()=>Tt,Integration:()=>ee,MenuOpenMode:()=>it,Month:()=>dr,Period:()=>cr,Periodicity:()=>Rt,Permission:()=>nt,Query:()=>wt,Template:()=>bt,Transaction:()=>Z,TransactionList:()=>gt,TransactionStatus:()=>me,TransactionsDataTableBuilder:()=>At,User:()=>Se,Visibility:()=>lr});var ue=class extends Error{constructor(e,t,r){super(t),this.name="BkperError",this.code=e,this.reason=r}};var ea=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},qe=class{constructor(e){this.params=[],this.headers={},this.method="GET",this.payload=null,this.url=e}setMethod(e){return this.method=e,this}setHeader(e,t){return this.headers[e]=t,this}addParam(e,t){return this.params.push({name:e,value:t}),this}setPayload(e){return this.payload=e,this}getUrl(){let e=this.url;if(this.params!=null){let i=0;e.indexOf("?")<0?e+="?":i++;for(let o of this.params){i>0&&(e+="&");var t=o.name,r=o.value;r!=null&&(e+=t+"="+encodeURIComponent(r),i++)}}return e}execute(){return ea(this,void 0,void 0,function*(){let e=this.getUrl(),t={method:this.method,headers:this.headers};this.payload&&this.method!=="GET"&&(typeof this.payload=="string"?t.body=this.payload:(t.body=JSON.stringify(this.payload),!this.headers["Content-Type"]&&!this.headers["content-type"]&&(t.headers=Object.assign(Object.assign({},this.headers),{"Content-Type":"application/json"}))));let r=yield fetch(e,t),i,o=r.headers.get("content-type");return o&&o.includes("application/json")?i=yield r.json():i=yield r.text(),{data:i,status:r.status,headers:r.headers}})}};var Ct=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ta="https://api.bkper.app";function ra(n){return n.apiBaseUrl?n.apiBaseUrl:ta}var te=class extends qe{constructor(e,t){let r=ra(t);super(`${r}/${e}`),this.retry=0,this.config=t,this.requestPath=e}fetch(){let e=Object.create(null,{execute:{get:()=>super.execute}});return Ct(this,void 0,void 0,function*(){this.addCustomHeaders(),yield this.addAgentIdHeader();let t=yield this.getAccessToken();t&&this.setHeader("Authorization",`Bearer ${t}`),yield this.addApiKeyHeader();try{let r=yield e.execute.call(this);if(r.status>=200&&r.status<300)return r;if(r.status==404){let i={response:{status:r.status,data:r.data}};throw this.handleError(i)}else if(this.shouldRetry(r.status)&&this.retry<3){this.retry++;let i=this.config;return i.requestRetryHandler?yield i.requestRetryHandler(r.status,r.data,this.retry):console.log(`${JSON.stringify(r.data)} - Retrying ${this.retry}/3... `),yield this.fetch()}else{let i={response:{status:r.status,data:r.data}};throw this.handleError(i)}}catch(r){if(r instanceof ue||r.response)throw r;if(this.isNetworkError(r)&&this.retry<3){this.retry++;let i=this.config;return i.requestRetryHandler?yield i.requestRetryHandler(520,r,this.retry):console.log(`${this.formatNetworkErrorMessage(r)} - Retrying ${this.retry}/3... `),yield this.fetch()}throw this.handleError(r)}})}shouldRetry(e){return e==401||e==403||e==408||e==429||e!=null&&e>=500}isNetworkError(e){return e instanceof TypeError&&e.message.toLowerCase().includes("fetch")}formatNetworkErrorMessage(e){var t,r,i,o,s;let a=[];return!((t=e.cause)===null||t===void 0)&&t.code&&a.push(e.cause.code),!((r=e.cause)===null||r===void 0)&&r.hostname?a.push(e.cause.hostname):!((i=e.cause)===null||i===void 0)&&i.address&&a.push(e.cause.address),((o=e.cause)===null||o===void 0?void 0:o.port)!==void 0&&a.push(`port=${e.cause.port}`),!((s=e.cause)===null||s===void 0)&&s.syscall&&a.push(`syscall=${e.cause.syscall}`),a.length>0?`Network error calling ${this.requestPath}: ${e.message} (${a.join(", ")})`:`Network error calling ${this.requestPath}: ${e.message}`}handleError(e){var t,r,i,o,s,a,c,l,u;let d=this.config,f=d.requestErrorHandler?d.requestErrorHandler(e):void 0;if(f)return f;if(e instanceof ue)return e;if(this.isNetworkError(e))return new ue(((t=e.response)===null||t===void 0?void 0:t.status)||((r=e.response)===null||r===void 0?void 0:r.code)||e.status||e.code||0,this.formatNetworkErrorMessage(e),void 0);{let p=((o=(i=e.response)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.error)||((s=e.data)===null||s===void 0?void 0:s.error)||e.error;return p?new ue(p.code,p.message,(c=(a=p.errors)===null||a===void 0?void 0:a[0])===null||c===void 0?void 0:c.reason):new ue(((l=e.response)===null||l===void 0?void 0:l.status)||((u=e.response)===null||u===void 0?void 0:u.code)||e.status||e.code||0,e.message||String(e),void 0)}}addCustomHeaders(){return Ct(this,void 0,void 0,function*(){let e=this.config;if(e.requestHeadersProvider){let t=yield e.requestHeadersProvider();Object.entries(t).forEach(([r,i])=>this.setHeader(r,i))}})}addAgentIdHeader(){return Ct(this,void 0,void 0,function*(){let e=this.config;if(e.agentIdProvider){let t=yield e.agentIdProvider();t&&this.setHeader("bkper-agent-id",t)}})}addApiKeyHeader(){return Ct(this,void 0,void 0,function*(){let e=this.config;if(e.apiKeyProvider){let t=yield e.apiKeyProvider();t&&this.setHeader("bkper-api-key",t)}})}getAccessToken(){return Ct(this,void 0,void 0,function*(){let e,t=this.config;return t.oauthTokenProvider&&(e=yield t.oauthTokenProvider()),e&&(e=e.replace("Bearer ",""),e=e.replace("bearer ","")),e})}},m=class extends te{constructor(e,t){super(`v5/books/${e}`,t)}},k=class extends te{constructor(e,t){super(`v5/${e}`,t)}};var we=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ln(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Un(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Gn(n,e,t){return we(this,void 0,void 0,function*(){var r=e,i=yield new m(`${n}/accounts`,t).setMethod("PUT").setPayload(r).fetch();return i.data})}function Vn(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("PUT").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Hn(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function $n(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/delete/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function jn(n,e,t){return we(this,void 0,void 0,function*(){return(yield new m(`${n}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function zn(n,e){return we(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/accounts`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var ke=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Zn(n,e,t){return ke(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Wn(n,e,t){return ke(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/groups/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Yn(n,e,t){return ke(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Kn(n,e,t){return ke(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Jn(n,e){return ke(this,void 0,void 0,function*(){var t=yield new m(`${n}/groups`,e).setMethod("GET").fetch(),r=t.data;return r!=null&&r.items?r.items:[]})}function Qn(n,e,t){return ke(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${encodeURIComponent(e)}`,t).setMethod("GET").fetch();return r.data})}function Xn(n,e,t){return ke(this,void 0,void 0,function*(){if(!e)return[];var r=yield new m(`${n}/groups/${encodeURIComponent(e)}/accounts`,t).setMethod("GET").fetch(),i=r.data;return i!=null&&i.items?i.items:[]})}var Lt=Qs(uo(),1);var il=20,ol=1,Le=1e6,lo=1e6,sl=-7,al=21,ul=!1,Bt="[big.js] ",Ue=Bt+"Invalid ",ur=Ue+"decimal places",ll=Ue+"rounding mode",co=Bt+"Division by zero",C={},fe=void 0,cl=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function fo(){function n(e){var t=this;if(!(t instanceof n))return e===fe?fo():new n(e);if(e instanceof n)t.s=e.s,t.e=e.e,t.c=e.c.slice();else{if(typeof e!="string"){if(n.strict===!0&&typeof e!="bigint")throw TypeError(Ue+"value");e=e===0&&1/e<0?"-0":String(e)}dl(t,e)}t.constructor=n}return n.prototype=C,n.DP=il,n.RM=ol,n.NE=sl,n.PE=al,n.strict=ul,n.roundDown=0,n.roundHalfUp=1,n.roundHalfEven=2,n.roundUp=3,n}function dl(n,e){var t,r,i;if(!cl.test(e))throw Error(Ue+"number");for(n.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),i=e.length,r=0;r<i&&e.charAt(r)=="0";)++r;if(r==i)n.c=[n.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(n.e=t-r-1,n.c=[],t=0;r<=i;)n.c[t++]=+e.charAt(r++)}return n}function Ge(n,e,t,r){var i=n.c;if(t===fe&&(t=n.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(ll);if(e<1)r=t===3&&(r||!!i[0])||e===0&&(t===1&&i[0]>=5||t===2&&(i[0]>5||i[0]===5&&(r||i[1]!==fe))),i.length=1,r?(n.e=n.e-e+1,i[0]=1):i[0]=n.e=0;else if(e<i.length){if(r=t===1&&i[e]>=5||t===2&&(i[e]>5||i[e]===5&&(r||i[e+1]!==fe||i[e-1]&1))||t===3&&(r||!!i[0]),i.length=e,r){for(;++i[--e]>9;)if(i[e]=0,e===0){++n.e,i.unshift(1);break}}for(e=i.length;!i[--e];)i.pop()}return n}function Ve(n,e,t){var r=n.e,i=n.c.join(""),o=i.length;if(e)i=i.charAt(0)+(o>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)i="0"+i;i="0."+i}else if(r>0)if(++r>o)for(r-=o;r--;)i+="0";else r<o&&(i=i.slice(0,r)+"."+i.slice(r));else o>1&&(i=i.charAt(0)+"."+i.slice(1));return n.s<0&&t?"-"+i:i}C.abs=function(){var n=new this.constructor(this);return n.s=1,n};C.cmp=function(n){var e,t=this,r=t.c,i=(n=new t.constructor(n)).c,o=t.s,s=n.s,a=t.e,c=n.e;if(!r[0]||!i[0])return r[0]?o:i[0]?-s:0;if(o!=s)return o;if(e=o<0,a!=c)return a>c^e?1:-1;for(s=(a=r.length)<(c=i.length)?a:c,o=-1;++o<s;)if(r[o]!=i[o])return r[o]>i[o]^e?1:-1;return a==c?0:a>c^e?1:-1};C.div=function(n){var e=this,t=e.constructor,r=e.c,i=(n=new t(n)).c,o=e.s==n.s?1:-1,s=t.DP;if(s!==~~s||s<0||s>Le)throw Error(ur);if(!i[0])throw Error(co);if(!r[0])return n.s=o,n.c=[n.e=0],n;var a,c,l,u,d,f=i.slice(),p=a=i.length,g=r.length,v=r.slice(0,a),w=v.length,y=n,S=y.c=[],ae=0,D=s+(y.e=e.e-n.e)+1;for(y.s=o,o=D<0?0:D,f.unshift(0);w++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(w=v.length))u=a>w?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=v[d]){u=i[d]>v[d]?1:-1;break}if(u<0){for(c=w==a?i:f;w;){if(v[--w]<c[w]){for(d=w;d&&!v[--d];)v[d]=9;--v[d],v[w]+=10}v[w]-=c[w]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[w]=r[p]||0:v=[r[p]]}while((p++<g||v[0]!==fe)&&o--);return!S[0]&&ae!=1&&(S.shift(),y.e--,D--),ae>D&&Ge(y,D,t.RM,v[0]!==fe),y};C.eq=function(n){return this.cmp(n)===0};C.gt=function(n){return this.cmp(n)>0};C.gte=function(n){return this.cmp(n)>-1};C.lt=function(n){return this.cmp(n)<0};C.lte=function(n){return this.cmp(n)<1};C.minus=C.sub=function(n){var e,t,r,i,o=this,s=o.constructor,a=o.s,c=(n=new s(n)).s;if(a!=c)return n.s=-c,o.plus(n);var l=o.c.slice(),u=o.e,d=n.c,f=n.e;if(!l[0]||!d[0])return d[0]?n.s=-c:l[0]?n=new s(o):n.s=1,n;if(a=u-f){for((i=a<0)?(a=-a,r=l):(f=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(t=((i=l.length<d.length)?l:d).length,a=c=0;c<t;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,n.s=-n.s),(c=(t=d.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;t>a;){if(l[--t]<d[t]){for(e=t;e&&!l[--e];)l[e]=9;--l[e],l[t]+=10}l[t]-=d[t]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--f;return l[0]||(n.s=1,l=[f=0]),n.c=l,n.e=f,n};C.mod=function(n){var e,t=this,r=t.constructor,i=t.s,o=(n=new r(n)).s;if(!n.c[0])throw Error(co);return t.s=n.s=1,e=n.cmp(t)==1,t.s=i,n.s=o,e?new r(t):(i=r.DP,o=r.RM,r.DP=r.RM=0,t=t.div(n),r.DP=i,r.RM=o,this.minus(t.times(n)))};C.neg=function(){var n=new this.constructor(this);return n.s=-n.s,n};C.plus=C.add=function(n){var e,t,r,i=this,o=i.constructor;if(n=new o(n),i.s!=n.s)return n.s=-n.s,i.minus(n);var s=i.e,a=i.c,c=n.e,l=n.c;if(!a[0]||!l[0])return l[0]||(a[0]?n=new o(i):n.s=i.s),n;if(a=a.slice(),e=s-c){for(e>0?(c=s,r=l):(e=-e,r=a),r.reverse();e--;)r.push(0);r.reverse()}for(a.length-l.length<0&&(r=l,l=a,a=r),e=l.length,t=0;e;a[e]%=10)t=(a[--e]=a[e]+l[e]+t)/10|0;for(t&&(a.unshift(t),++c),e=a.length;a[--e]===0;)a.pop();return n.c=a,n.e=c,n};C.pow=function(n){var e=this,t=new e.constructor("1"),r=t,i=n<0;if(n!==~~n||n<-lo||n>lo)throw Error(Ue+"exponent");for(i&&(n=-n);n&1&&(r=r.times(e)),n>>=1,!!n;)e=e.times(e);return i?t.div(r):r};C.prec=function(n,e){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");return Ge(new this.constructor(this),n,e)};C.round=function(n,e){if(n===fe)n=0;else if(n!==~~n||n<-Le||n>Le)throw Error(ur);return Ge(new this.constructor(this),n+this.e+1,e)};C.sqrt=function(){var n,e,t,r=this,i=r.constructor,o=r.s,s=r.e,a=new i("0.5");if(!r.c[0])return new i(r);if(o<0)throw Error(Bt+"No square root");o=Math.sqrt(+Ve(r,!0,!0)),o===0||o===1/0?(e=r.c.join(""),e.length+s&1||(e+="0"),o=Math.sqrt(e),s=((s+1)/2|0)-(s<0||s&1),n=new i((o==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):n=new i(o+""),s=n.e+(i.DP+=4);do t=n,n=a.times(t.plus(r.div(t)));while(t.c.slice(0,s).join("")!==n.c.slice(0,s).join(""));return Ge(n,(i.DP-=4)+n.e+1,i.RM)};C.times=C.mul=function(n){var e,t=this,r=t.constructor,i=t.c,o=(n=new r(n)).c,s=i.length,a=o.length,c=t.e,l=n.e;if(n.s=t.s==n.s?1:-1,!i[0]||!o[0])return n.c=[n.e=0],n;for(n.e=c+l,s<a&&(e=i,i=o,o=e,l=s,s=a,a=l),e=new Array(l=s+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=s+c;l>c;)a=e[l]+o[c]*i[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++n.e:e.shift(),c=e.length;!e[--c];)e.pop();return n.c=e,n};C.toExponential=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(ur);for(t=Ge(new t.constructor(t),++n,e);t.c.length<n;)t.c.push(0)}return Ve(t,!0,!!r)};C.toFixed=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(ur);for(t=Ge(new t.constructor(t),n+t.e+1,e),n=n+t.e+1;t.c.length<n;)t.c.push(0)}return Ve(t,!1,!!r)};C[Symbol.for("nodejs.util.inspect.custom")]=C.toJSON=C.toString=function(){var n=this,e=n.constructor;return Ve(n,n.e<=e.NE||n.e>=e.PE,!!n.c[0])};C.toNumber=function(){var n=+Ve(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(n.toString()))throw Error(Bt+"Imprecise conversion");return n};C.toPrecision=function(n,e){var t=this,r=t.constructor,i=t.c[0];if(n!==fe){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");for(t=Ge(new r(t),n,e);t.c.length<n;)t.c.push(0)}return Ve(t,n<=t.e||t.e<=r.NE||t.e>=r.PE,!!i)};C.valueOf=function(){var n=this,e=n.constructor;if(e.strict===!0)throw Error(Bt+"valueOf disallowed");return Ve(n,n.e<=e.NE||n.e>=e.PE,!0)};var fl=fo(),_t=fl;var E=class n{constructor(e){this.checkNumberNotNull(e),typeof e=="string"?this.big=new _t(e):e instanceof n?this.big=new _t(e.big):e.toString?this.big=new _t(e.toString()):this.big=new _t(+e)}abs(){let e=this.big.abs();return this.wrap(e)}cmp(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.cmp(e):e instanceof n?this.big.cmp(e.big):e.toString?this.big.cmp(e.toString()):this.big.cmp(+e)}div(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.div(e):e instanceof n?t=this.big.div(e.big):e.toString?t=this.big.div(e.toString()):t=this.big.div(+e),this.wrap(t)}eq(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.eq(e):e instanceof n?this.big.eq(e.big):e.toString?this.big.eq(e.toString()):this.big.eq(+e)}gt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gt(e):e instanceof n?this.big.gt(e.big):e.toString?this.big.gt(e.toString()):this.big.gt(+e)}gte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gte(e):e instanceof n?this.big.gte(e.big):e.toString?this.big.gte(e.toString()):this.big.gte(+e)}lt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lt(e):e instanceof n?this.big.lt(e.big):e.toString?this.big.lt(e.toString()):this.big.lt(+e)}lte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lte(e):e instanceof n?this.big.lte(e.big):e.toString?this.big.lte(e.toString()):this.big.lte(+e)}plus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.plus(e):e instanceof n?t=this.big.plus(e.big):e.toString?t=this.big.plus(e.toString()):t=this.big.plus(+e),this.wrap(t)}minus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.minus(e):e instanceof n?t=this.big.minus(e.big):e.toString?t=this.big.minus(e.toString()):t=this.big.minus(+e),this.wrap(t)}mod(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.mod(e):e instanceof n?t=this.big.mod(e.big):e.toString?t=this.big.mod(e.toString()):t=this.big.mod(+e),this.wrap(t)}round(e){let t=this.big.round(e);return this.wrap(t)}times(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.times(e):e instanceof n?t=this.big.times(e.big):e.toString?t=this.big.times(e.toString()):t=this.big.times(+e),this.wrap(t)}toFixed(e){return this.big.toFixed(e)}toString(){return this.big.toString()}toNumber(){return this.big.toNumber()}checkNumberNotNull(e){if(e==null)throw new Error("Invalid number: null")}static create(){return Object.create(this.prototype)}wrap(e){let t=n.create();return t.big=e,t}};var Rt;(function(n){n.DAILY="DAILY",n.MONTHLY="MONTHLY",n.YEARLY="YEARLY"})(Rt||(Rt={}));var He;(function(n){n.COMMA="COMMA",n.DOT="DOT"})(He||(He={}));var nt;(function(n){n.NONE="NONE",n.VIEWER="VIEWER",n.RECORDER="RECORDER",n.POSTER="POSTER",n.EDITOR="EDITOR",n.OWNER="OWNER"})(nt||(nt={}));var lr;(function(n){n.PUBLIC="PUBLIC",n.PRIVATE="PRIVATE"})(lr||(lr={}));var F;(function(n){n.ASSET="ASSET",n.LIABILITY="LIABILITY",n.INCOMING="INCOMING",n.OUTGOING="OUTGOING"})(F||(F={}));var Ae;(function(n){n.TOTAL="TOTAL",n.PERIOD="PERIOD",n.CUMULATIVE="CUMULATIVE"})(Ae||(Ae={}));var cr;(function(n){n.MONTH="MONTH",n.QUARTER="QUARTER",n.YEAR="YEAR"})(cr||(cr={}));var dr;(function(n){n.JANUARY="JANUARY",n.FEBRUARY="FEBRUARY",n.MARCH="MARCH",n.APRIL="APRIL",n.MAY="MAY",n.JUNE="JUNE",n.JULY="JULY",n.AUGUST="AUGUST",n.SEPTEMBER="SEPTEMBER",n.OCTOBER="OCTOBER",n.NOVEMBER="NOVEMBER",n.DECEMBER="DECEMBER"})(dr||(dr={}));var me;(function(n){n.TRASHED="TRASHED",n.DRAFT="DRAFT",n.UNCHECKED="UNCHECKED",n.CHECKED="CHECKED"})(me||(me={}));var it;(function(n){n.SIDEBAR="SIDEBAR",n.EXPANDED="EXPANDED",n.NEW_TAB="NEW_TAB"})(it||(it={}));var ot;(function(n){n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR"})(ot||(ot={}));var fr;(function(n){n.FILE_CREATED="FILE_CREATED",n.FILE_UPDATED="FILE_UPDATED",n.TRANSACTION_CREATED="TRANSACTION_CREATED",n.TRANSACTION_UPDATED="TRANSACTION_UPDATED",n.TRANSACTION_DELETED="TRANSACTION_DELETED",n.TRANSACTION_POSTED="TRANSACTION_POSTED",n.TRANSACTION_CHECKED="TRANSACTION_CHECKED",n.TRANSACTION_UNCHECKED="TRANSACTION_UNCHECKED",n.TRANSACTION_RESTORED="TRANSACTION_RESTORED",n.ACCOUNT_CREATED="ACCOUNT_CREATED",n.ACCOUNT_UPDATED="ACCOUNT_UPDATED",n.ACCOUNT_DELETED="ACCOUNT_DELETED",n.QUERY_CREATED="QUERY_CREATED",n.QUERY_UPDATED="QUERY_UPDATED",n.QUERY_DELETED="QUERY_DELETED",n.GROUP_CREATED="GROUP_CREATED",n.GROUP_UPDATED="GROUP_UPDATED",n.GROUP_DELETED="GROUP_DELETED",n.COMMENT_CREATED="COMMENT_CREATED",n.COMMENT_DELETED="COMMENT_DELETED",n.COLLABORATOR_ADDED="COLLABORATOR_ADDED",n.COLLABORATOR_UPDATED="COLLABORATOR_UPDATED",n.COLLABORATOR_REMOVED="COLLABORATOR_REMOVED",n.INTEGRATION_CREATED="INTEGRATION_CREATED",n.INTEGRATION_UPDATED="INTEGRATION_UPDATED",n.INTEGRATION_DELETED="INTEGRATION_DELETED",n.BOOK_AUDITED="BOOK_AUDITED",n.BOOK_CREATED="BOOK_CREATED",n.BOOK_UPDATED="BOOK_UPDATED",n.BOOK_DELETED="BOOK_DELETED"})(fr||(fr={}));function pr(n,e){return e<=0?"":e===1?n:n+pr(n,e-1)}function po(n){if(!n||typeof n!="string")return[];let e=/#([a-zA-Z0-9_]+)/g,t=new Set,r;for(;(r=e.exec(n))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}var hr=null;function mr(n,e){return n==null&&(n=new E("0")),e?new E(n).round(e):new E(n).round(2)}function ge(n,e,t){if(n==null)return"";if(typeof n=="string"){if(n.trim()=="")return"";n=new E(n)}if(n==null)return"";t==null&&(t=2);var r=n.toFixed(t)+"";return e==He.DOT?r.replace(/\,/g,"."):r.replace(/\./g,",")}function gr(n,e){if(n!=null){if(!isNaN(+n)&&isFinite(+n))return new E(n);e==He.DOT?n=n.replace(/\,/g,""):n=n.replace(/\./g,"").replace(/\,/g,".");try{return new E(n)}catch(t){return}}}function mo(n,e){if(!n)return new Date;var t=n/1e4,r=n/100%100,i=n%100,o=yn(t,r,i,e);return o}function yn(n,e,t,r){var i=new Date(n,e-1,t);return r||(r=0),i.setTime(i.getTime()+r*60*1e3),i}function Ut(n,e,t){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!t||t=="")&&(t="UTC"),e?Lt.DateTime.fromJSDate(n,{zone:t}).toFormat(e):$e(n,t))}function $e(n,e){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!e||e=="")&&(e="UTC"),Lt.DateTime.fromJSDate(n,{zone:e}).toISODate())}function st(n){return+n.replace(/-/g,"")}function yr(n,e,t){e||(e="yyyy-MM-dd");let r=Lt.DateTime.fromFormat(n,e,{zone:t}).toJSDate();return r instanceof Date&&!isNaN(r.getTime())?r:Lt.DateTime.fromFormat(n,"yyyy-MM-dd",{zone:t}).toJSDate()}function q(n,e){return n==null?new E(0):e!=null&&!e?n.times(-1):n}function be(n){for(var e=0,t=0;t<n.length;t++)n[t].length>e&&(e=n[t].length);for(var t=0;t<n.length;t++)for(;n[t].length<e;)n[t].push(null);return n}function ye(n){return Gt(n,"_")}function Gt(n,e){return!n||typeof n!="string"?"":(e&&(n=n.replace(new RegExp(e,"g")," ")),n=n.replace(new RegExp("-","g")," "),n=n.replace(/ +(?= )/g,""),n=hl(n.trim().toLowerCase()),e&&(n=n.replace(new RegExp(" ","g"),e)),n)}function hl(n){for(var e=n.split(""),t="",r=0;r<e.length;r++)t+=e[r]in ho()?ho()[e[r]]:e[r];return t}function ho(){if(hr==null){hr={};for(var n=0;n<gn.length;n++)for(var e=gn[n].letters.split(""),t=0;t<e.length;t++)hr[e[t]]=gn[n].base}return hr}var gn=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}];var P=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}};var U=class extends P{isHiddenProperty(e){return e.endsWith("_")}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}setProperties(e){return this.payload.properties=Object.assign({},e),this}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}setProperty(e,t){return e==null||e.trim()==""?this:(this.payload.properties==null&&(this.payload.properties={}),t||(t=""),this.payload.properties[e]=t,this)}deleteProperty(e){return this.setProperty(e,null),this}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}setVisibleProperty(e,t){return this.isHiddenProperty(e)?this:this.setProperty(e,t)}setVisibleProperties(e){if(e==null)return this;let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return this.setProperties(t)}getVisibleProperties(){let e=this.getProperties(),t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return t}};var Vt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Q=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.children=new Map,this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return Vt(this,void 0,void 0,function*(){let e=yield this.getAccounts();for(let t of e)if(!t.isBalanceVerified())return!1;return!0})}isLocked(){return this.payload.locked==null?!1:this.payload.locked}setLocked(e){return this.payload.locked=e,this}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Gt(this.getName())}getAccounts(){return Vt(this,void 0,void 0,function*(){if(this.accounts)return Array.from(this.accounts.values());let e=this.getId();if(!e)return[];let t=yield Xn(this.book.getId(),e,this.getConfig());return t?t.map(i=>new G(this.book,i)):[]})}getType(){return this.payload.type}isHidden(){return this.payload.hidden}setHidden(e){return this.payload.hidden=e,this}isCredit(){return this.payload.credit}isMixed(){return this.payload.mixed}isPermanent(){return this.payload.permanent}getParent(){return this.parent}setParent(e){return e?this.payload.parent={id:e.getId(),name:e.getName(),normalizedName:e.getNormalizedName()}:this.payload.parent=void 0,this}hasParent(){return this.payload.parent!=null}getChildren(){return Array.from(this.children.values())||[]}addChild(e){let t=e.getId();t&&this.children.set(t,e)}getDescendants(){let e=new Set;return this.traverseDescendants(this,e),e}getDescendantTreeIds(){return new Set(Array.from(this.getDescendants()).map(e=>e.getId()||""))}hasChildren(){return this.getChildren().length>0}isLeaf(){return this.getChildren().length===0}isRoot(){return this.getParent()==null}getDepth(){return this.depth==null&&(this.parent?this.depth=this.parent.getDepth()+1:this.depth=0),this.depth}getRoot(){return this.root==null&&(this.parent!=null?this.root=this.parent.getRoot():this.root=this),this.root}getRootName(){let e=this.getRoot();return e!=null&&e.getName()||""}traverseDescendants(e,t){t.add(e);let r=e.getChildren();if(r.length>0)for(let i of r)this.traverseDescendants(i,t)}buildGroupTree(e){if(this.parent=void 0,this.depth=void 0,this.root=void 0,this.payload.parent){let t=e.get(this.payload.parent.id||"");t&&(this.parent=t,t.addChild(this))}}addAccount(e){let t=e==null?void 0:e.getId();t&&(this.accounts||(this.accounts=new Map),this.accounts.set(t,e))}hasAccounts(){return this.payload.hasAccounts}create(){return Vt(this,void 0,void 0,function*(){return this.payload=yield Zn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return Vt(this,void 0,void 0,function*(){return this.payload=yield Yn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return Vt(this,void 0,void 0,function*(){return this.payload=yield Kn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(!0),this})}updateGroupCache(e){this.book.setGroup(this.payload,e),this.book.clearCache()}};var at=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},G=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return this.payload.balanceVerified}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Gt(this.getName())}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}isArchived(){return this.payload.archived}setArchived(e){return this.payload.archived=e,this}hasTransactionPosted(){return this.payload.hasTransactionPosted}isPermanent(){return this.payload.permanent}isCredit(){return this.payload.credit}getGroups(){return at(this,void 0,void 0,function*(){if(!this.getId())return[];if(yield this.book.getGroups(),this.payload.groups!=null){let t=[];for(let r of this.payload.groups){let i=yield this.book.getGroup(r.id);i&&t.push(i)}return t}return[]})}setGroups(e){return this.payload.groups=void 0,e!=null&&e.forEach(t=>this.addGroup(t)),this}addGroup(e){return this.payload.groups||(this.payload.groups=[]),e instanceof Q?this.payload.groups.push(e.json()):this.payload.groups.push(e),this}removeGroup(e){return at(this,void 0,void 0,function*(){if(this.payload.groups!=null){let t;if(e instanceof Q?t=e:typeof e=="string"&&(t=yield this.book.getGroup(e)),t)for(let r=0;r<this.payload.groups.length;r++)this.payload.groups[r].id==t.getId()&&this.payload.groups.splice(r,1)}return this})}isInGroup(e){return at(this,void 0,void 0,function*(){if(e==null)return!1;if(e instanceof Q)return this.isInGroupObject_(e);var t=yield this.book.getGroup(e);return t==null?!1:this.isInGroupObject_(t)})}isInGroupObject_(e){if(this.payload.groups==null)return!1;for(var t=0;t<this.payload.groups.length;t++)if(this.payload.groups[t]==e.getId())return!0;return!1}create(){return at(this,void 0,void 0,function*(){return this.payload=yield Ln(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}update(){return at(this,void 0,void 0,function*(){return this.payload=yield Gn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}remove(){return at(this,void 0,void 0,function*(){return this.payload=yield Hn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(!0),this})}updateAccountCache(e){this.book.setAccount(this.payload,e),this.book.clearCache()}};var go=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ut=class{constructor(e){this.accounts=e,this.shouldIncludeArchived=!1,this.shouldAddGroups=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[]}archived(e){return this.shouldIncludeArchived=e,this}groups(e){return this.shouldAddGroups=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}getPropertyKeys(){if(this.propertyKeys.length===0){for(let e of this.accounts)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getTypeIndex(e){return e===F.ASSET?0:e===F.LIABILITY?1:e===F.INCOMING?2:3}getMaxNumberOfGroups(){return go(this,void 0,void 0,function*(){let e=0;for(let t of this.accounts){let r=yield t.getGroups();r.length>e&&(e=r.length)}return e})}sortGroupsHierarchyPath_(e){let t=[],r=[];for(let a of e)a.getParent()!=null||a.hasChildren()?t.push(a):r.push(a);let i=new Map;for(let a of t){let l=a.getRoot().getId()||"";i.has(l)||i.set(l,[]),i.get(l).push(a)}let o=Array.from(i.entries()).sort((a,c)=>{let l=a[1][0].getRoot(),u=c[1][0].getRoot();return l.getNormalizedName().localeCompare(u.getNormalizedName())}).map(([a,c])=>c.sort((l,u)=>l.getDepth()-u.getDepth()));r.sort((a,c)=>a.getNormalizedName().localeCompare(c.getNormalizedName()));let s=[];for(let a of o)s.push(...a);return s.push(...r),s}build(){return go(this,void 0,void 0,function*(){let e=new Array,t=this.accounts;this.shouldIncludeArchived||(t=this.accounts.filter(o=>!o.isArchived()));let r=[];if(this.shouldAddIds&&r.push("Account Id"),r.push("Name"),r.push("Type"),this.shouldAddGroups){let o=yield this.getMaxNumberOfGroups();for(let s=0;s<o;s++)r.push("Group")}t.sort((o,s)=>{let a=this.getTypeIndex(o.getType())-this.getTypeIndex(s.getType());return a===0&&(a=o.getNormalizedName().localeCompare(s.getNormalizedName())),a});let i=[];this.shouldAddProperties&&(i=this.getPropertyKeys());for(let o of t){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()),s.push(o.getType()),this.shouldAddGroups){let a=this.sortGroupsHierarchyPath_(yield o.getGroups());for(let c of a)s.push(c.getName())}if(this.shouldAddGroups&&this.shouldAddProperties){let a=r.length-s.length;for(let c=0;c<a;c++)s.push("")}if(this.shouldAddProperties){let a=o.getProperties();for(let c of i){let l=a[c];if(l){s.push(l);continue}s.push("")}}e.push(s)}return this.shouldAddProperties&&(r=r.concat(i)),e.unshift(r),be(e),e})}};var lt=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}getId(){return this.payload.id}getName(){return this.payload.name}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}};var wr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function yo(n){return wr(this,void 0,void 0,function*(){let e=yield new te("v5/apps",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}function vo(n,e){return wr(this,void 0,void 0,function*(){return(yield new te(`v5/apps/${n}`,e).setMethod("GET").fetch()).data})}function wo(n,e){return wr(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("POST").setPayload(n).fetch();return t.data})}function Eo(n,e){return wr(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("PUT").setPayload(n).fetch();return t.data})}var Ce=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ao(n,e){return Ce(this,void 0,void 0,function*(){let t=new m("",e);n&&t.addParam("query",n);let r=yield t.fetch();if(r.data==null)return[];let o=r.data.items;return o==null?[]:o})}function bo(n,e,t,r){return Ce(this,void 0,void 0,function*(){if(n==null)throw new Error("Book id null!");return e=e||!1,t=t||!1,(yield new m(n,r).addParam("loadAccounts",e).addParam("loadGroups",t).fetch()).data})}function Co(n,e){return Ce(this,void 0,void 0,function*(){return(yield new m("",e).setMethod("POST").setPayload(n).fetch()).data})}function Do(n,e,t){return Ce(this,void 0,void 0,function*(){var r=yield new m(`${n}`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function So(n,e){return Ce(this,void 0,void 0,function*(){new m(`${n}/audit`,e).setMethod("PATCH").fetch()})}function Io(n,e){return Ce(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/apps`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Oo(n,e,t,r,i){return Ce(this,void 0,void 0,function*(){let o=new m(`${n}/copy`,i).setMethod("POST").addParam("name",e);return t&&(o.addParam("copyTransactions",t),r&&o.addParam("fromDate",r)),(yield o.fetch()).data})}function ko(n,e){return Ce(this,void 0,void 0,function*(){return(yield new m(`${n}`,e).setMethod("DELETE").fetch()).data})}var Er=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function No(n,e){return Er(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/queries`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Mo(n,e,t){return Er(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Fo(n,e,t){return Er(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function Po(n,e,t){return Er(this,void 0,void 0,function*(){return(yield new m(`${n}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}var pl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function _o(n,e,t){return pl(this,void 0,void 0,function*(){var r;let i=yield new m(`${n}/balances`,t).addParam("query",e).addParam("time",Date.now()).fetch(),o=(r=i.data)===null||r===void 0?void 0:r.balancesUrl;if(o){let s=yield new qe(o).setMethod("GET").execute();i={data:s.data,status:s.status}}return i.data})}var vn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ro(n,e,t){return vn(this,void 0,void 0,function*(){var r=yield new m(`${n}/files`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Tr(n,e,t){return vn(this,void 0,void 0,function*(){var r=yield new m(`${n}/files/${e}`,t).setMethod("GET").fetch();return r.data})}function Lo(n,e,t){return vn(this,void 0,void 0,function*(){return(yield new m(`${n}/files`,t).setMethod("PUT").setPayload(e).fetch()).data})}var Ar=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Go(n,e){return Ar(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function wn(n,e,t){return Ar(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("POST").fetch()).data})}function En(n,e,t){return Ar(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function Vo(n,e,t){return Ar(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations/${e}`,t).setMethod("DELETE").fetch()).data})}var _=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function $o(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function jo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function zo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;return r=yield(yield new m(`${n}/transactions/batch`,t).setMethod("POST").setPayload(i).fetch()).data,r!=null&&r.items!=null?r.items:[]})}function qo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;return i=yield(yield new m(`${n}/transactions/batch`,r).setMethod("PUT").setPayload(o).addParam("updateChecked",t).fetch()).data,i!=null&&i.items!=null?i.items:[]})}function Zo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Wo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Yo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;i=yield(yield new m(`${n}/transactions/trash/batch`,r).setMethod("PATCH").setPayload(o).addParam("trashChecked",t).fetch()).data})}function Ko(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;r=yield(yield new m(`${n}/transactions/untrash/batch`,t).setMethod("PATCH").setPayload(i).fetch()).data})}function Jo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Qo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/post`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function Xo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/check`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function es(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/uncheck`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ts(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/trash`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function rs(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ns(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function is(n,e,t,r,i){return _(this,void 0,void 0,function*(){e||(e=""),t||(t=100);var o=new m(`${n}/transactions`,i);o.addParam("query",e),o.addParam("limit",t),r!=null&&o.setHeader("cursor",r);var s=yield o.fetch();return s.data})}function os(n,e,t){return _(this,void 0,void 0,function*(){let r=Object.assign({},e);return(yield new m(`${n}/transactions/merge`,t).setMethod("PATCH").setPayload(r).fetch()).data})}function ss(n,e,t){return _(this,void 0,void 0,function*(){return(yield new m(`${n}/transactions/count`,t).setMethod("GET").addParam("query",e).fetch()).data})}var Ht=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function us(n,e,t,r,i,o,s,a){return Ht(this,void 0,void 0,function*(){let c=new m(`${n.getId()}/events`,a);c.addParam("after",e),c.addParam("before",t),c.addParam("error",r),c.addParam("resoureId",i),c.addParam("limit",o),s!=null&&c.setHeader("cursor",s);var l=yield c.fetch();return l.data})}function ls(n,e,t,r){return Ht(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("PUT").fetch()).data})}function cs(n,e,t,r){return Ht(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("DELETE").fetch()).data})}function ds(n,e,t,r){return Ht(this,void 0,void 0,function*(){let i=new m(`${n.getId()}/events/replay/batch`,r).setMethod("PATCH").setPayload(e);t&&i.addParam("errorsOnly",t),yield i.fetch()})}function fs(n,e){return Ht(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/backlog`,e).setMethod("GET").fetch()).data})}var Tn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function ps(n,e){return Tn(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/collaborators`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function An(n,e,t,r){return Tn(this,void 0,void 0,function*(){let i=new m(`${n}/collaborators`,r).setMethod("POST").setPayload(e);return t&&(i=i.addParam("message",t)),(yield i.fetch()).data})}function ms(n,e,t){return Tn(this,void 0,void 0,function*(){return(yield new m(`${n}/collaborators/${e}`,t).setMethod("DELETE").fetch()).data})}var bn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ct=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getEmail(){return this.payload.email}setEmail(e){return this.payload.email=e,this}getPermission(){return this.payload.permission}setPermission(e){return this.payload.permission=e,this}create(e){return bn(this,void 0,void 0,function*(){return this.payload=yield An(this.book.getId(),this.payload,e,this.getConfig()),this.book.clearCollaboratorCache(),this})}update(){return bn(this,void 0,void 0,function*(){return this.payload=yield An(this.book.getId(),this.payload,void 0,this.getConfig()),this.book.clearCollaboratorCache(),this})}remove(){return bn(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield ms(this.book.getId(),e,this.getConfig()),this.book.clearCollaboratorCache(),this})}};var dt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function ys(n){return dt(this,void 0,void 0,function*(){var e;let t=yield new k("collections",n).fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function vs(n,e){return dt(this,void 0,void 0,function*(){return(yield new k("collections",e).setMethod("POST").setPayload(n).fetch()).data})}function ws(n,e){return dt(this,void 0,void 0,function*(){return(yield new k("collections",e).setMethod("PUT").setPayload(n).fetch()).data})}function Es(n,e){return dt(this,void 0,void 0,function*(){var t;let r=yield new k(`collections/${n.id}`,e).setMethod("DELETE").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Ts(n,e,t){return dt(this,void 0,void 0,function*(){var r;let i=yield new k(`collections/${n}/books/add`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}function As(n,e,t){return dt(this,void 0,void 0,function*(){var r;let i=yield new k(`collections/${n}/books/remove`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}var $t=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},De=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||O.globalConfig}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getOwnerUsername(){return this.payload.ownerUsername}getPermission(){return this.payload.permission?this.payload.permission:void 0}getBooks(){let e=[];if(this.payload.books==null)return e;for(let t of this.payload.books){let r=new X(t,this.config);e.push(r)}return e}addBooks(e){return $t(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield Ts(t,r,this.getConfig())).map(o=>new X(o,this.config))}return[]})}removeBooks(e){return $t(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield As(t,r,this.getConfig())).map(o=>new X(o,this.config))}return[]})}getUpdatedAt(){return this.payload.updatedAt}create(){return $t(this,void 0,void 0,function*(){return this.payload=yield vs(this.payload,this.getConfig()),this})}update(){return $t(this,void 0,void 0,function*(){return this.payload=yield ws(this.payload,this.getConfig()),this})}remove(){return $t(this,void 0,void 0,function*(){return(yield Es(this.payload,this.getConfig())).map(t=>new X(t,this.config))})}};var Cs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ft=class{constructor(e,t){this.event=e,this.payload=t||{}}getType(){return this.payload.type}getAgentId(){return this.payload.agentId}getMessage(){return this.payload.message}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getEvent(){return this.event}replay(){return Cs(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield ls(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}remove(){return Cs(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield cs(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}updateCache(e){var t;this.event.payload=e,this.event.clearCache();let r=(t=e==null?void 0:e.botResponses)===null||t===void 0?void 0:t.find(i=>i.agentId&&i.agentId===this.getAgentId());this.payload=r||{}}};var jt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ds(n,e){return jt(this,void 0,void 0,function*(){return(yield new k(`user/connections/${n}`,e).setMethod("GET").fetch()).data})}function Ss(n){return jt(this,void 0,void 0,function*(){var e;let t=yield new k("user/connections",n).setMethod("GET").fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function Is(n,e){return jt(this,void 0,void 0,function*(){return(yield new k("user/connections",e).setPayload(n).setMethod("POST").fetch()).data})}function Os(n,e){return jt(this,void 0,void 0,function*(){return(yield new k(`user/connections/${n}`,e).setMethod("DELETE").fetch()).data})}function ks(n,e){return jt(this,void 0,void 0,function*(){var t;let r=yield new k(`user/connections/${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var gl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ee=class extends U{constructor(e,t){super(e||{}),this.config=t}getConfig(){return this.config||O.globalConfig}getBookId(){return this.payload.bookId}getId(){return this.payload.id}getName(){return this.payload.name}getAddedBy(){return this.payload.addedBy}getAgentId(){return this.payload.agentId}getLogo(){return this.payload.logo}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}getDateAddedMs(){return this.payload.dateAddedMs}getLastUpdateMs(){return this.payload.lastUpdateMs}remove(){return gl(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield Vo(e,t,this.getConfig())),this})}};var Cn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},je=class extends U{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||O.globalConfig}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}setAgentId(e){return this.payload.agentId=e,this}getName(){return this.payload.name}getLogo(){return this.payload.logo}getDateAddedMs(){return this.payload.dateAddedMs}getEmail(){return this.payload.email}setName(e){return this.payload.name=e,this}setUUID(e){return this.payload.uuid=e,this}getUUID(){return this.payload.uuid}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}clearTokenProperties(){this.getPropertyKeys().filter(e=>e.includes("token")).forEach(e=>this.deleteProperty(e))}getIntegrations(){return Cn(this,void 0,void 0,function*(){let e=this.getId();return e?(yield ks(e,this.getConfig())).map(i=>new ee(i,this.config)):[]})}create(){return Cn(this,void 0,void 0,function*(){return this.payload=yield Is(this.payload,this.getConfig()),this})}remove(){return Cn(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield Os(e,this.getConfig())),this})}};var zt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ns(n){return zt(this,void 0,void 0,function*(){return(yield new k("user",n).setMethod("GET").fetch()).data})}function Ms(n){return zt(this,void 0,void 0,function*(){return(yield new k("user/billing",n).setMethod("GET").fetch()).data})}function Fs(n){return zt(this,void 0,void 0,function*(){return(yield new k("user/billing/counts",n).setMethod("GET").fetch()).data})}function Ps(n,e){return zt(this,void 0,void 0,function*(){return(yield new k("user/billing/portal",e).addParam("returnUrl",n).fetch()).data})}function Bs(n,e,t,r,i){return zt(this,void 0,void 0,function*(){let o=new k("user/billing/checkout",i).addParam("plan",n);return r&&o.addParam("cycle",r),e&&o.addParam("successUrl",e),t&&o.addParam("cancelUrl",t),(yield o.fetch()).data})}var Sn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ht=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||O.globalConfig}isEnabled(){return this.payload.enabled}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getPlan(){return this.payload.plan}isPlanOverdue(){return this.payload.planOverdue}getAdminEmail(){return this.payload.adminEmail}hasStartedTrial(){return this.payload.startedTrial}getDaysLeftInTrial(){return this.payload.daysLeftInTrial}getTotalTransactionsThisMonth(){return this.payload.totalTransactionsThisMonth}getTotalTransactionsThisYear(){return this.payload.totalTransactionsThisYear}getCounts(){return Sn(this,void 0,void 0,function*(){return yield Fs(this.getConfig())})}getPortalUrl(e){return Sn(this,void 0,void 0,function*(){let t=yield Ps(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,i){return Sn(this,void 0,void 0,function*(){let o=yield Bs(e,t,r,i,this.getConfig());return o==null?void 0:o.url})}};var In=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Se=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||O.globalConfig}getId(){return this.payload.id}getGivenName(){return this.payload.givenName}getName(){return this.payload.name}getAvatarUrl(){return this.payload.avatarUrl}getFullName(){return this.payload.fullName}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getUsername(){return this.payload.username}getBilling(){return In(this,void 0,void 0,function*(){let e=yield Ms(this.getConfig());return new ht(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return In(this,void 0,void 0,function*(){return(yield Ss(this.getConfig())).map(t=>new je(t,this.config))})}getConnection(e){return In(this,void 0,void 0,function*(){let t=yield Ds(e,this.getConfig());return new je(t,this.config)})}};var pt=class{constructor(e,t){this.book=e,this.payload=t||{}}json(){return Object.assign({},this.payload)}getBook(){return this.book}getId(){return this.payload.id}getUser(){return this.payload.user?new Se(this.payload.user,this.book.getConfig()):void 0}getAgent(){return this.payload.agent?new lt(this.payload.agent):void 0}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getType(){return this.payload.type}getBotResponses(){if(this.botResponses!==void 0)return this.botResponses;let e=[];if(this.payload.botResponses)for(let t of this.payload.botResponses)e.push(new ft(this,t));return this.botResponses=e,this.botResponses}hasErrorResponse(){let e=this.getBotResponses();for(let t of e)if(t.getType()===ot.ERROR)return!0;return!1}clearCache(){this.botResponses=void 0}};var mt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.map(t=>new pt(this.book,t)))||[]}};var On=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Ie=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getBook(){return this.book}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getContentType(){return this.payload.contentType}setContentType(e){return this.payload.contentType=e,this}getContent(){return On(this,void 0,void 0,function*(){let e=this.getId();return this.getId()!=null&&(this.payload==null||this.payload.content==null)&&this.book&&e&&(this.payload=yield Tr(this.book.getId(),e,this.getConfig())),this.payload.content})}setContent(e){return this.payload.content=e,this}getUrl(){return this.payload.url}getSize(){return this.payload.size}create(){return On(this,void 0,void 0,function*(){return this.payload=yield Ro(this.book.getId(),this.payload,this.getConfig()),this})}update(){return On(this,void 0,void 0,function*(){return this.payload=yield Lo(this.book.getId(),this.payload,this.getConfig()),this})}};var R=[];for(let n=0;n<256;++n)R.push((n+256).toString(16).slice(1));function _s(n,e=0){return(R[n[e+0]]+R[n[e+1]]+R[n[e+2]]+R[n[e+3]]+"-"+R[n[e+4]]+R[n[e+5]]+"-"+R[n[e+6]]+R[n[e+7]]+"-"+R[n[e+8]]+R[n[e+9]]+"-"+R[n[e+10]]+R[n[e+11]]+R[n[e+12]]+R[n[e+13]]+R[n[e+14]]+R[n[e+15]]).toLowerCase()}var kn,yl=new Uint8Array(16);function xn(){if(!kn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");kn=crypto.getRandomValues.bind(crypto)}return kn(yl)}var vl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Nn={randomUUID:vl};function wl(n,e,t){var i,o,s;if(Nn.randomUUID&&!e&&!n)return Nn.randomUUID();n=n||{};let r=(s=(o=n.random)!=null?o:(i=n.rng)==null?void 0:i.call(n))!=null?s:xn();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[t+a]=r[a];return e}return _s(r)}var Mn=wl;var N=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Z=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.pendingFiles=new Map,this.book=e}getConfig(){return this.book.getConfig()}getBook(){return this.book}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}getAgentName(){return this.payload.agentName}getAgentLogoUrl(){return this.payload.agentLogo}getAgentLogoUrlDark(){return this.payload.agentLogoDark}getRemoteIds(){return this.payload.remoteIds||[]}addRemoteId(e){return this.payload.remoteIds==null&&(this.payload.remoteIds=[]),e&&this.payload.remoteIds.push(e),this}isPosted(){return this.payload.posted}isChecked(){return this.payload.checked}setChecked(e){return this.payload.checked=e,this}isTrashed(){return this.payload.trashed}isLocked(){let e=this.getDate()||$e(new Date,this.book.getTimeZone()),t=this.book.getMostRecentLockDate_();return t!=null&&st(t)>=st(e)}getStatus(){return this.isTrashed()?me.TRASHED:this.isPosted()?this.isChecked()?me.CHECKED:me.UNCHECKED:me.DRAFT}getTags(){if(this.payload.tags&&this.payload.tags.length>0)return this.payload.tags;let e=this.getDescription();return e&&e.includes("#")?po(e):[]}getUrls(){return this.payload.urls||[]}setUrls(e){return this.payload.urls=void 0,e&&e.forEach(t=>{this.addUrl(t)}),this}addUrl(e){return this.payload.urls==null&&(this.payload.urls=[]),e&&this.payload.urls.push(e),this}getFiles(){return this.payload.files&&this.payload.files.length>0?this.payload.files.map(t=>new Ie(this.book,t)):[]}removeFile(e){let t=e.getId();return t&&(this.payload.files!=null&&(this.payload.files=this.payload.files.filter(r=>r.id!==t)),this.pendingFiles.delete(t)),this}addFile(e){var t;this.payload.files==null&&(this.payload.files=[]);let r=e.getId(),i=(t=e.getBook())===null||t===void 0?void 0:t.getId();return(r==null||i!=this.book.getId())&&(r==null&&(e.payload.id=`temporary_${Mn()}`),this.pendingFiles.set(e.getId(),e)),this.payload.files.push(e.json()),this}createPendingFiles(){return N(this,void 0,void 0,function*(){if(this.pendingFiles.size===0)return;this.payload.files==null&&(this.payload.files=[]);let e=Array.from(this.pendingFiles.entries()).map(r=>N(this,[r],void 0,function*([i,o]){o.book=this.book,o.setProperty("upload_method","attachment");let s=yield o.create();return{fileId:i,createdFile:s}})),t=yield Promise.all(e);for(let{fileId:r,createdFile:i}of t){let o=this.payload.files.findIndex(s=>s.id===r);o>=0?this.payload.files[o]=i.json():this.payload.files.push(i.json())}this.pendingFiles.clear()})}hasTag(e){for(var t=this.getTags(),r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}getCreditAccount(){return N(this,void 0,void 0,function*(){if(this.payload.creditAccount)return yield this.book.getAccount(this.payload.creditAccount.id)})}getCreditAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getCreditAccount())!=null?(e=yield this.getCreditAccount())===null||e===void 0?void 0:e.getName():""})}setCreditAccount(e){return e==null?(this.payload.creditAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.creditAccount=e.json()):e.id!=null&&(this.payload.creditAccount=e),this)}from(e){return this.setCreditAccount(e)}getDebitAccount(){return N(this,void 0,void 0,function*(){if(this.payload.debitAccount)return yield this.book.getAccount(this.payload.debitAccount.id)})}getDebitAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getDebitAccount())!=null?(e=yield this.getDebitAccount())===null||e===void 0?void 0:e.getName():""})}setDebitAccount(e){return e==null?(this.payload.debitAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.debitAccount={id:e.getId(),name:e.getName()}):e.id!=null&&(this.payload.debitAccount={id:e.id,name:e.name}),this)}to(e){return this.setDebitAccount(e)}getAmount(){return this.payload.amount!=null&&this.payload.amount.trim()!=""?new E(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=gr(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new E(e),e.eq(0)?(this.payload.amount=void 0,this):(this.payload.amount=e.abs().toString(),this))}getCreditAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return this.getAmount()})}getDebitAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isDebit(t))return this.getAmount()})}getOtherAccount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return yield this.getDebitAccount();if(yield this.isDebit(t))return yield this.getCreditAccount()})}getOtherAccountName(e){return N(this,void 0,void 0,function*(){var t=yield this.getOtherAccount(e);return t!=null?t.getName():""})}isCredit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getCreditAccount())!=null&&e!=null&&((t=yield this.getCreditAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}isDebit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getDebitAccount())!=null&&e!=null&&((t=yield this.getDebitAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}getAccount_(e){return N(this,void 0,void 0,function*(){return e==null||e instanceof G?e:yield this.book.getAccount(e)})}getDescription(){return this.payload.description==null?"":this.payload.description}setDescription(e){return this.payload.description=e,this}getDate(){return this.payload.date}setDate(e){if(typeof e=="string")if(e.indexOf("/")>0){let t=yr(e,this.book.getDatePattern(),this.book.getTimeZone());this.payload.date=$e(t,this.book.getTimeZone())}else e.indexOf("-")>=0&&(this.payload.date=e);else Object.prototype.toString.call(e)==="[object Date]"&&(this.payload.date=$e(e,this.book.getTimeZone()));return this}getDateObject(){return mo(this.getDateValue(),this.book.getTimeZoneOffset())}getDateValue(){return this.payload.dateValue}getDateFormatted(){return this.payload.dateFormatted}getCreatedAt(){return new Date(new Number(this.payload.createdAt).valueOf())}getCreatedAtFormatted(){return Ut(this.getCreatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCreatedBy(){return this.payload.createdBy}getUpdatedAt(){return new Date(new Number(this.payload.updatedAt).valueOf())}getUpdatedAtFormatted(){return Ut(this.getUpdatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCaEvolvedBalance_(){return this.payload.creditAccount!=null&&this.payload.creditAccount.balance!=null?new E(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new E(this.payload.debitAccount.balance):void 0}getAccountBalance(e){return N(this,void 0,void 0,function*(){var t=this.getCaEvolvedBalance_(),r=!0;if(t==null&&(t=this.getDaEvolvedBalance_(),r=!1),t!=null){if(!e){var i=r?yield this.getCreditAccount():yield this.getDebitAccount();t=q(t,i==null?void 0:i.isCredit())}return mr(t,this.book.getFractionDigits())}else return})}create(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield $o(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}update(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Jo(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}check(){return N(this,void 0,void 0,function*(){var e;let t=yield Xo(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}uncheck(){return N(this,void 0,void 0,function*(){var e;let t=yield es(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}post(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Qo(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}trash(){return N(this,void 0,void 0,function*(){var e;let t=yield ts(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}untrash(){return N(this,void 0,void 0,function*(){var e;let t=yield rs(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}};var El=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},gt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getAccount(){return El(this,void 0,void 0,function*(){if(this.payload.account)return yield this.book.getAccount(this.payload.account)})}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;let t=[];for(let r of(e=this.payload.items)!==null&&e!==void 0?e:[])t.push(new Z(this.book,r));return t}};var Oe=class{constructor(e,t){this.container=e,this.payload=t}getDay(){return this.payload.day}getMonth(){return this.payload.month}getYear(){return this.payload.year}getDate(){var e=this.getYear(),t=this.getMonth(),r=this.getDay();(t==null||t==0)&&e++,(r==null||r==0)&&t++;var i=yn(e,t,r,this.container.getBalancesReport().getBook().getTimeZoneOffset());return i}getFuzzyDate(){return this.payload.fuzzyDate}getCumulativeBalance(){return q(this.getCumulativeBalanceRaw(),this.container.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit)}getPeriodBalance(){return q(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance)}getPeriodCredit(){return new E(this.payload.periodCredit)}getPeriodDebit(){return new E(this.payload.periodDebit)}};var he=class{constructor(e,t,r){this.maxDepth=0,this.expandAllAccounts=!1,this.expandAllGroups=!1,this.skipRoot=!1,this.book=e,this.balancesContainers=t,this.periodicity=r,this.balanceType=Ae.TOTAL,this.shouldFormatDate=!1,this.shouldHideDates=!1,this.shouldHideNames=!1,this.shouldFormatValue=!1,this.shouldTranspose=!1,this.shouldTrial=!1,this.shouldPeriod=!1,this.shouldRaw=!1,this.shouldAddProperties=!1,this.shouldAddHiddenProperties=!1}getBalance(e,t){return this.getRepresentativeBalance(e,t).toNumber()}getRepresentativeBalance(e,t){return e==null?new E(0):t?e.times(-1):e}getBalanceText(e,t){return this.book.formatValue(this.getRepresentativeBalance(e,t))}formatDates(e){return this.shouldFormatDate=e,this}formatValues(e){return this.shouldFormatValue=e,this}expanded(e){return typeof e=="boolean"&&e==!0?(this.maxDepth=1,this.skipRoot=!0):e==-1?this.expandAllGroups=!0:e==-2?this.expandAllAccounts=!0:typeof e=="number"&&e>0&&(this.maxDepth=e),this}type(e){return this.balanceType=e,this}transposed(e){return this.shouldTranspose=e,this}hideDates(e){return this.shouldHideDates=e,this}hideNames(e){return this.shouldHideNames=e,this}properties(e){return this.shouldAddProperties=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}trial(e){return this.shouldTrial=e,this}period(e){return this.shouldPeriod=e,this}raw(e){return this.shouldRaw=e,this}build(){return this.balanceType==Ae.TOTAL?this.buildTotalDataTable_():this.buildTimeDataTable_()}addPropertyKeys(e,t){for(let r of t.getPropertyKeys())!this.shouldAddHiddenProperties&&r.endsWith("_")||e.indexOf(r)<=-1&&e.push(r)}flattenContainers(e,t){for(let r of this.balancesContainers)this.expandAllAccounts?(this.flattenAllAccounts(r,e,t),e.sort(this.sortContainersFunction)):r.isFromGroup()&&this.expandAllGroups?this.flattenAllGroups(r,e,t):this.flattenMaxDepth(r,e,t)}flattenAllAccounts(e,t,r){if(e.isFromGroup())for(let i of e.getBalancesContainers())this.flattenAllAccounts(i,t,r);else t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e)}sortContainersFunction(e,t){let r=0;e.isPermanent()&&!t.isPermanent()?r=-1:!e.isPermanent()&&t.isPermanent()&&(r=1),r==0&&(e.getParent()&&!t.getParent()?r=-1:!e.getParent()&&t.getParent()&&(r=1)),r==0&&(r=i(e)-i(t)),r==0&&(r=e.getName().toLowerCase().localeCompare(t.getName().toLowerCase()));function i(o){return o.isPermanent()&&!o.isCredit()?0:o.isPermanent()&&o.isCredit()?1:!o.isPermanent()&&o.isCredit()?2:!o.isPermanent()&&!o.isCredit()?3:4}return r}flattenMaxDepth(e,t,r){let i=e.getDepth();if(i<=this.maxDepth){!this.skipRoot&&!this.shouldTranspose&&(e.payload.name=pr(" ",i*4)+e.payload.name),(!this.skipRoot||i!=0)&&(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e));let o=e.getBalancesContainers();if(o&&o.length>0){o.sort(this.sortContainersFunction);for(let s of o)this.flattenMaxDepth(s,t,r)}}}flattenAllGroups(e,t,r){if(e.isFromGroup()){if(!this.shouldTranspose){let i=e.getDepth();e.payload.name=pr(" ",i*4)+e.payload.name}if(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e),e.hasGroupBalances()){let i=e.getBalancesContainers();i.sort(this.sortContainersFunction);for(let o of i)this.flattenAllGroups(o,t,r)}}}buildTotalDataTable_(){var e=new Array;if(this.balancesContainers==null)return e;this.balancesContainers.sort((c,l)=>c!=null&&l!=null?c.getName().toLowerCase().localeCompare(l.getName().toLowerCase()):-1);let t=[],r=new Array;if(this.flattenContainers(r,t),this.shouldAddProperties){t.sort();let c=["name","balance"];for(let l of t)c.push(l);e.push(c)}for(var i=0;i<r.length;i++){var o=r[i];if(o!=null){var s=new Array,a=o.getName();if(s.push(a),this.shouldTrial?this.shouldFormatValue?this.shouldPeriod?(s.push(o.getPeriodDebitText()),s.push(o.getPeriodCreditText())):(s.push(o.getCumulativeDebitText()),s.push(o.getCumulativeCreditText())):this.shouldPeriod?(s.push(o.getPeriodDebit().toNumber()),s.push(o.getPeriodCredit().toNumber())):(s.push(o.getCumulativeDebit().toNumber()),s.push(o.getCumulativeCredit().toNumber())):this.shouldFormatValue?this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRawText()):s.push(this.getBalanceText(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRawText()):s.push(this.getBalanceText(o.getCumulativeBalanceRaw(),o.isPermanent())):this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRaw().toNumber()):s.push(this.getBalance(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRaw().toNumber()):s.push(this.getBalance(o.getCumulativeBalanceRaw(),o.isPermanent())),this.shouldAddProperties){let c=o.getProperties();for(let l of t){let u=c[l];if(u){s.push(u);continue}s.push("")}}e.push(s)}}return this.shouldHideNames&&(e=e.map(c=>c.slice(1))),this.shouldTranspose&&e.length>0&&(e=e[0].map((c,l)=>e.map(u=>u[l]))),e}buildTimeDataTable_(){var e=new Array,t=new Object,r=this.balanceType==Ae.CUMULATIVE,i=new Array;if(i.push(""),this.balancesContainers==null)return e;let o=[],s=new Array;this.flattenContainers(s,o);for(let D of s){i.push(D.getName());var a=D.getBalances();if(a!=null)for(let L of a){var c=L.getFuzzyDate(),l=t[c];l==null&&(l={},l.date=L.getDate(),t[c]=l);var u;r?u=L.getCumulativeBalanceRaw():u=L.getPeriodBalanceRaw(),l[D.getName()]=this.shouldRaw?u:this.getRepresentativeBalance(u,D.isPermanent())}}e.push(i);var d=new Array;for(var f in t){var p=t[f],g=new Array;g.push(p.date);for(let D of s){var u=p[D.getName()];u==null?u="null_amount":(u=new E(u),this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber()),g.push(u)}d.push(g)}d.sort(function(D,L){return D[0].getTime()-L[0].getTime()});for(var v=null,w=0;w<d.length;w++){var g=d[w];if(w==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}else for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"&&r)v&&(g[y]=v[y]);else if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ge(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}v=g,e.push(g)}if(this.shouldFormatDate&&e.length>0)for(var y=1;y<e.length;y++){var g=e[y];g.length>0&&(g[0]=$e(g[0],this.book.getTimeZone()))}if(this.shouldAddProperties){o.sort();for(let D of o){var ae=[D];for(let L of s)ae.push(L.getProperty(D)||"");e.push(ae)}}return this.shouldHideNames&&e.shift(),this.shouldHideDates&&(e=e.map(D=>D.slice(1))),!this.shouldTranspose&&e.length>0&&(e=e[0].map((D,L)=>e.map(Dr=>Dr[L]))),e}};var Rs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},yt=class{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return Rs(this,void 0,void 0,function*(){return null})}getAccount(){return Rs(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getAccount(this.getNormalizedName()))||null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!0}isFromGroup(){return!1}hasGroupBalances(){return!1}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}createDataTable(){return new he(this.balancesReport.getBook(),[this],this.balancesReport.getPeriodicity())}getBalancesContainers(){return[]}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new Oe(this,e)):new Array}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainer(e){let t=ye(e);if(this.getNormalizedName()==t)return this;throw`${e} does not match ${this.getName()}`}};var Ls=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},br=class n{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return Ls(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getGroup(this.getNormalizedName()))||null})}getAccount(){return Ls(this,void 0,void 0,function*(){return null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit||!1}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!1}isFromGroup(){return!0}hasGroupBalances(){let e=this.getGroupContainers();return e!=null&&e.length>0}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new Oe(this,e)):new Array}createDataTable(){return new he(this.balancesReport.getBook(),this.getBalancesContainers(),this.balancesReport.getPeriodicity())}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainers(){let e=[],t=this.getGroupContainers();t&&t.length>0&&(e=e.concat(t));let r=this.getAccountContainers();return r&&r.length>0&&(e=e.concat(r)),e}getGroupContainers(){let e=this.payload.groupBalances;if(this.groupBalances==null&&e!=null){this.groupBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.groupBalances.push(new n(this,this.balancesReport,r))}}return this.groupBalances||[]}getAccountContainers(){let e=this.payload.accountBalances;if(this.accountBalances==null&&e!=null){this.accountBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.accountBalances.push(new yt(this,this.balancesReport,r))}}return this.accountBalances||[]}getBalancesContainer(e){var t;let r=ye(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found on group ${this.getName()}`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found on group ${this.getName()}`;return o}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var vt=class{constructor(e,t){this.book=e,this.payload=t}getBook(){return this.book}createDataTable(){return new he(this.book,this.getBalancesContainers(),this.getPeriodicity())}getPeriodicity(){return this.payload.periodicity}getBalancesContainers(){let e=[],t=this.getRootAccountBalancesContainers();t!=null&&t.length>0&&(e=e.concat(t));let r=this.getGroupBalancesContainers();return r!=null&&r.length>0&&(e=e.concat(r)),e}getBalancesContainer(e){var t;let r=ye(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found`;return o}getRootAccountBalancesContainers(){if(this.accountBalancesContainers==null&&this.payload.accountBalances!=null){this.accountBalancesContainers=[];for(let e=0;e<this.payload.accountBalances.length;e++){let t=this.payload.accountBalances[e],r=new yt(null,this,t);this.accountBalancesContainers.push(r)}}return this.accountBalancesContainers||[]}getGroupBalancesContainers(){if(this.groupBalancesContainers==null&&this.payload.groupBalances!=null){this.groupBalancesContainers=[];for(let e=0;e<this.payload.groupBalances.length;e++){let t=this.payload.groupBalances[e],r=new br(null,this,t);this.groupBalancesContainers.push(r)}}return this.groupBalancesContainers||[]}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var Fn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},wt=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getTitle(){return this.payload.title}setTitle(e){return this.payload.title=e,this}getQuery(){return this.payload.query}setQuery(e){return this.payload.query=e,this}create(){return Fn(this,void 0,void 0,function*(){return this.payload=yield Mo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}update(){return Fn(this,void 0,void 0,function*(){return this.payload=yield Fo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}remove(){return Fn(this,void 0,void 0,function*(){let e=this.getId();if(!e)throw new Error("Query id null!");return this.payload=yield Po(this.book.getId(),e,this.getConfig()),this.updateQueryCache(!0),this})}updateQueryCache(e){this.book.queries&&(this.book.queries=this.book.queries.filter(t=>t.getId()!==this.getId()),e||this.book.queries.push(this))}};var Et=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||O.globalConfig}getCount(){return this.payload.count}};var Tt=class{constructor(e){this.COMPARATOR=(t,r)=>{let i=this.getTypeIndex(this.getStringType(t))-this.getTypeIndex(this.getStringType(r));return i===0&&(i=this.getHasChildrenIndex(t.hasChildren())-this.getHasChildrenIndex(r.hasChildren())),i===0&&(i=t.getNormalizedName().localeCompare(r.getNormalizedName())),i},this.groups=e,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.shouldShowTree=!1,this.propertyKeys=[]}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}tree(e){return this.shouldShowTree=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.groups)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}getStringType(e){let t=e.getType()?e.getType()+"":void 0;return t||(t=e.isPermanent()?F.ASSET+"_"+F.LIABILITY:F.INCOMING+"_"+F.OUTGOING),t}getTypeIndex(e){return e===F.ASSET+"_"+F.LIABILITY?0:e===F.ASSET?1:e===F.LIABILITY?2:e===F.INCOMING+"_"+F.OUTGOING?3:e===F.INCOMING?4:5}getHasChildrenIndex(e){return e?0:1}build(){let e=new Array,t=this.groups;t.sort(this.COMPARATOR);let r=[];this.shouldAddIds&&r.push("Group Id"),r.push("Name"),r.push("Type"),this.shouldShowTree||r.push("Parent"),this.shouldAddProperties&&this.mapPropertyKeys();for(let i of t)i.isHidden()||i.getParent()||(e.push(this.buildGroupLine(i,0)),e=this.traverse(i,e,1));return this.shouldAddProperties&&(r=r.concat(this.propertyKeys)),e.unshift(r),be(e),e}buildGroupLine(e,t){let r=[];this.shouldAddIds&&r.push(e.getId());let i=this.shouldShowTree?" ".repeat(t)+e.getName():e.getName();if(r.push(i),r.push(this.getStringType(e)),!this.shouldShowTree){let o=e.getParent()?e.getParent().getName():"";r.push(o)}if(this.shouldAddProperties){let o=e.getProperties();for(let s of this.propertyKeys){let a=o[s];if(a){r.push(a);continue}r.push("")}}return r}traverse(e,t,r){let i=e.getChildren();i.sort(this.COMPARATOR);for(let o of i)t.push(this.buildGroupLine(o,r)),o.hasChildren()&&this.traverse(o,t,r+1);return t}};var Pn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},At=class{constructor(e,t,r){this.shouldFormatDates=!1,this.shouldFormatValues=!1,this.shouldAddUrls=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddRecordedAt=!0,this.shouldAddHiddenProperties=!1,this.book=e,this.transactions=t,this.account=r}formatDates(e){return this.shouldFormatDates=e,this}formatValues(e){return this.shouldFormatValues=e,this}urls(e){return this.shouldAddUrls=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}recordedAt(e){return this.shouldAddRecordedAt=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}includeUrls(e){return this.urls(e)}includeProperties(e){return this.properties(e)}includeIds(e){return this.ids(e)}getAccount(){return this.account}build(){return Pn(this,void 0,void 0,function*(){let e=this.getHeaderLine(),t=yield this.get2DArray_();return t.length>0?(t.splice(0,0,e),be(t),t):[e]})}getHeaderLine(){let e=[];if(this.shouldAddIds&&e.push("Transaction Id"),e.push("Status"),e.push("Date"),e.push("Origin"),e.push("Destination"),e.push("Description"),e.push("Amount"),this.shouldShowBalances()&&e.push("Balance"),this.shouldAddRecordedAt&&e.push("Recorded at"),this.shouldAddProperties)for(let t of this.getPropertyKeys())e.push(t);if(this.shouldAddIds)for(let t of this.getRemoteIdHeaders())e.push(t);if(this.shouldAddUrls)for(let t of this.getAttachmentHeaders())e.push(t);return e}get2DArray_(){return Pn(this,void 0,void 0,function*(){let e=[];for(let t of this.transactions){let r=[];this.shouldAddIds&&r.push(t.getId()),r.push(t.getStatus()),this.shouldFormatDates?r.push(t.getDateFormatted()):r.push(t.getDateObject()),r.push(yield t.getCreditAccountName()),r.push(yield t.getDebitAccountName()),r.push(t.getDescription());let i=t.getAmount();if(i!=null){if(this.shouldShowBalances()&&this.account){let o=yield this.isCreditOnTransaction_(t,this.account);i=q(i,!o)}this.shouldFormatValues?r.push(ge(i,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(i.toNumber())}else r.push("");if(this.shouldShowBalances()){let o=yield t.getAccountBalance();o!=null?this.shouldFormatValues?r.push(ge(o,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(o.toNumber()):r.push("")}this.shouldAddRecordedAt&&(this.shouldFormatDates?r.push(t.getCreatedAtFormatted()):r.push(t.getCreatedAt())),this.shouldAddProperties&&this.addPropertiesToLine(r,t),this.shouldAddIds&&this.addRemoteIdsToLine(r,t),this.shouldAddUrls&&this.addUrlsToLine(r,t),e.push(r)}return e})}shouldShowBalances(){return this.account!=null&&this.account.isPermanent()===!0}isCreditOnTransaction_(e,t){return Pn(this,void 0,void 0,function*(){let r=yield e.getCreditAccount();return t==null||r==null?!1:r.getId()===t.getId()})}getPropertyKeys(){if(this.propertyKeys==null){this.propertyKeys=[];for(let e of this.transactions)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getAttachmentHeaders(){if(this.attachmentHeaders==null){this.attachmentHeaders=[];for(let e of this.transactions){let t=this.getUrls(e);t.length>this.attachmentHeaders.length&&(this.attachmentHeaders=[],t.forEach(()=>this.attachmentHeaders.push("Attachment")))}}return this.attachmentHeaders}getRemoteIdHeaders(){if(this.remoteIdHeaders==null){this.remoteIdHeaders=[];for(let e of this.transactions){let t=e.getRemoteIds();t&&t.length>this.remoteIdHeaders.length&&(this.remoteIdHeaders=[],t.forEach(()=>this.remoteIdHeaders.push("Remote Id")))}}return this.remoteIdHeaders}addPropertiesToLine(e,t){let r=e.length;for(let i of this.getPropertyKeys())e.push("");for(let i of t.getPropertyKeys()){if(!this.shouldAddHiddenProperties&&i.endsWith("_"))continue;let o=this.getPropertyKeys().indexOf(i)+r;e[o]=t.getProperty(i)}}addRemoteIdsToLine(e,t){let r=e.length;for(let o of this.getRemoteIdHeaders())e.push("");let i=t.getRemoteIds();if(i)for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}addUrlsToLine(e,t){let r=e.length;for(let o of this.getAttachmentHeaders())e.push("");let i=this.getUrls(t);for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}getUrls(e){let t=e.getUrls();t==null&&(t=[]);let r=e.getFiles();return r!=null&&(t=t.concat(r.map(i=>i.getUrl()).filter(i=>i!=null))),t}};var T=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},X=class n extends U{constructor(e,t){super(e),this.allGroupsLoaded=!1,this.allAccountsLoaded=!1,this.config=t,this.payload.permission==nt.RECORDER&&(this.payload.groups=this.payload.groups||[],this.payload.accounts=this.payload.accounts||[]),this.allGroupsLoaded=this.mapGroups(this.payload.groups),this.allAccountsLoaded=this.mapAccounts(this.payload.accounts)}getConfig(){return this.config||O.globalConfig}getId(){return this.payload.id||""}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getFractionDigits(){return this.payload.fractionDigits}getDecimalPlaces(){return this.getFractionDigits()}setFractionDigits(e){return this.payload.fractionDigits=e,this}getPeriod(){return this.payload.period}setPeriod(e){return this.payload.period=e,this}getPeriodStartMonth(){return this.payload.periodStartMonth}setPeriodStartMonth(e){return this.payload.periodStartMonth=e,this}getPageSize(){return this.payload.pageSize}setPageSize(e){return this.payload.pageSize=e,this}getOwnerName(){return this.payload.ownerName}getLogoUrl(){return this.payload.logoUrl}getPermission(){return this.payload.permission}getCollection(){return this.payload.collection!=null&&this.collection==null&&(this.collection=new De(this.payload.collection,this.config)),this.collection}getDatePattern(){return this.payload.datePattern}setDatePattern(e){return this.payload.datePattern=e,this}getLockDate(){return this.payload.lockDate}setLockDate(e){return e==null&&(e="1900-00-00"),this.payload.lockDate=e,this}getClosingDate(){return this.payload.closingDate}setClosingDate(e){return e==null&&(e="1900-00-00"),this.payload.closingDate=e,this}getDecimalSeparator(){return this.payload.decimalSeparator}setDecimalSeparator(e){return this.payload.decimalSeparator=e,this}getTimeZone(){return this.payload.timeZone}setTimeZone(e){return this.payload.timeZone=e,this}getTimeZoneOffset(){return this.payload.timeZoneOffset}getAutoPost(){return this.payload.autoPost}setAutoPost(e){return this.payload.autoPost=e,this}getLastUpdateMs(){return this.payload.lastUpdateMs?+this.payload.lastUpdateMs:void 0}getTotalTransactions(){return this.payload.totalTransactions?+this.payload.totalTransactions:0}getTotalTransactionsCurrentMonth(){return this.payload.totalTransactionsCurrentMonth?+this.payload.totalTransactionsCurrentMonth:0}getTotalTransactionsCurrentYear(){return this.payload.totalTransactionsCurrentYear?+this.payload.totalTransactionsCurrentYear:0}getVisibility(){return this.payload.visibility}setVisibility(e){return this.payload.visibility=e,this}formatDate(e,t){return(t==null||t.trim()=="")&&(t=this.getTimeZone()),Ut(e,this.getDatePattern(),t)}parseDate(e){return yr(e,this.getDatePattern(),this.getTimeZone())}formatValue(e){return e?ge(e,this.getDecimalSeparator(),this.getFractionDigits()):""}parseValue(e){return gr(e,this.getDecimalSeparator())}round(e){return mr(e,this.getFractionDigits())}batchCreateTransactions(e){return T(this,void 0,void 0,function*(){let t=[];return e.forEach(r=>t.push(r.json())),t=yield zo(this.getId(),t,this.getConfig()),e=t.map(r=>new Z(this,r)),e})}batchPostTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield jo(this.getId(),t,this.getConfig())})}batchUpdateTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];return e.forEach(i=>r.push(i.json())),r=yield qo(this.getId(),r,t,this.getConfig()),e=r.map(i=>new Z(this,i)),e})}batchCheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Zo(this.getId(),t,this.getConfig())})}batchUncheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Wo(this.getId(),t,this.getConfig())})}batchTrashTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];e.forEach(i=>r.push(i.json())),yield Yo(this.getId(),r,t,this.getConfig())})}batchUntrashTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Ko(this.getId(),t,this.getConfig())})}mergeTransactions(e,t){return T(this,void 0,void 0,function*(){let r=typeof e=="string"?e:e instanceof Z?e.getId():e.id;if(r==null||r.trim()==="")throw new Error("The first transaction must provide an id for merge.");let i=typeof t=="string"?t:t instanceof Z?t.getId():t.id;if(i==null||i.trim()==="")throw new Error("The second transaction must provide an id for merge.");let o={items:[{id:r},{id:i}]},s=yield os(this.getId(),o,this.getConfig());return new Z(this,s.transaction||{})})}batchReplayEvents(e,t){return T(this,void 0,void 0,function*(){let o={items:e.map(s=>s.getId()).map(s=>({id:s}))};yield ds(this,o,t,this.getConfig())})}batchCreateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:yield Promise.all(e.map(o=>this.normalizeAccountPayloadForBatchCreate_(o)))},r=yield Un(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}normalizeAccountPayloadForBatchCreate_(e){return T(this,void 0,void 0,function*(){let t=e.json();if(!t.groups||t.groups.length===0)return t;let r=[];for(let i of t.groups){let o=i.id||i.name;if(!o||o.trim()==="")throw new Error("Account group reference must include id or name");let s=yield this.getGroup(o);if(!s)throw new Error(`Group not found: ${o}`);r.push(s.json())}return t.groups=r,t})}batchUpdateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Vn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}batchDeleteAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield $n(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o,!0)}return this.clearCache(),i}return[]})}batchCreateGroups(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Wn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new Q(this,o);i.push(s),this.setGroup(o)}return this.clearCache(),i}return[]})}audit(){So(this.getId(),this.getConfig())}getApps(){return T(this,void 0,void 0,function*(){if(this.apps!=null)return this.apps;let e=yield Io(this.getId(),this.getConfig());return this.apps=e.map(t=>new ve(t,this.config)),this.apps})}getIntegrations(){return T(this,void 0,void 0,function*(){return(yield Go(this.getId(),this.getConfig())).map(r=>new ee(r,this.config))})}createIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof ee?e=yield wn(this.getId(),e.json(),this.getConfig()):e=yield wn(this.getId(),e,this.getConfig()),new ee(e,this.config)})}updateIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof ee?e=yield En(this.getId(),e.json(),this.getConfig()):e=yield En(this.getId(),e,this.getConfig()),new ee(e,this.config)})}getAccount(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idAccountMap&&(t=this.idAccountMap.get(e)),!t&&this.nameAccountMap&&(t=this.nameAccountMap.get(ye(e))),!t){let r=yield jn(this.getId(),e,this.getConfig());r&&(t=new G(this,r),this.updateAccountCache(t))}return t})}updateGroupCache(e){this.updateGroupIdMap(e),this.updateGroupNameMap(e)}updateGroupIdMap(e){this.idGroupMap=this.idGroupMap||new Map;let t=e.getId();t&&this.idGroupMap.set(t,e)}updateGroupNameMap(e){this.nameGroupMap=this.nameGroupMap||new Map;let t=e.getNormalizedName();t&&this.nameGroupMap.set(t,e)}updateAccountCache(e){this.updateAccountIdMap(e),this.updateAccountNameMap(e)}updateAccountIdMap(e){this.idAccountMap=this.idAccountMap||new Map;let t=e.getId();t&&this.idAccountMap.set(t,e)}updateAccountNameMap(e){this.nameAccountMap=this.nameAccountMap||new Map;let t=e.getNormalizedName();t&&this.nameAccountMap.set(t,e)}getMostRecentLockDate_(){let e=this.getClosingDate(),t=this.getLockDate();return!e&&!t?null:!e&&t?t:e&&!t||st(e)>st(t)?e:t}getGroup(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idGroupMap&&(t=this.idGroupMap.get(e)),!t&&this.nameGroupMap&&(t=this.nameGroupMap.get(ye(e))),!t){let r=yield Qn(this.getId(),e,this.getConfig());r&&(t=new Q(this,r),this.updateGroupCache(t))}return t})}getGroups(){return T(this,void 0,void 0,function*(){var e,t;if(this.idGroupMap&&this.allGroupsLoaded)return Array.from(((e=this.idGroupMap)===null||e===void 0?void 0:e.values())||[]);let r=yield Jn(this.getId(),this.getConfig());return this.allGroupsLoaded=this.mapGroups(r),Array.from(((t=this.idGroupMap)===null||t===void 0?void 0:t.values())||[])})}mapGroups(e){if(!e)return!1;let t=e.map(r=>new Q(this,r));this.idGroupMap=new Map,this.nameGroupMap=new Map;for(let r of t)this.updateGroupCache(r),r.buildGroupTree(this.idGroupMap);for(let r of t)r.buildGroupTree(this.idGroupMap);return!0}getAccounts(){return T(this,void 0,void 0,function*(){var e,t;if(this.idAccountMap&&this.allAccountsLoaded)return Array.from(((e=this.idAccountMap)===null||e===void 0?void 0:e.values())||[]);yield this.getGroups();let r=yield zn(this.getId(),this.getConfig());return this.allAccountsLoaded=this.mapAccounts(r),Array.from(((t=this.idAccountMap)===null||t===void 0?void 0:t.values())||[])})}mapAccounts(e){if(!e)return!1;let t=e.map(r=>new G(this,r));this.idAccountMap=new Map,this.nameAccountMap=new Map;for(let r of t)this.updateAccountCache(r),this.linkAccountsAndGroups(r);return this.ensureGroupsAccountMapsLoaded(),!0}linkAccountsAndGroups(e){var t;let r=e.json().groups||[];for(let i of r){let o=(t=this.idGroupMap)===null||t===void 0?void 0:t.get(i.id||"");o!=null&&o.addAccount(e)}}ensureGroupsAccountMapsLoaded(){if(this.idGroupMap)for(let e of this.idGroupMap.values())e.accounts==null&&(e.accounts=new Map)}clearCache(){this.clearGroupCache(),this.clearAccountCache()}clearGroupCache(){this.allGroupsLoaded=!1,this.idGroupMap=void 0,this.nameGroupMap=void 0}clearAccountCache(){this.allAccountsLoaded=!1,this.idAccountMap=void 0,this.nameAccountMap=void 0}clearCollaboratorCache(){this.collaborators=void 0}setAccount(e,t){let r=this.payload.accounts||[];t?this.payload.accounts=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.accounts=r.map(o=>o.id===e.id?e:o):this.payload.accounts=[...r,e]}setGroup(e,t){let r=this.payload.groups||[];t?this.payload.groups=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.groups=r.map(o=>o.id===e.id?e:o):this.payload.groups=[...r,e]}listTransactions(e,t,r){return T(this,void 0,void 0,function*(){let i=yield is(this.getId(),e,t,r,this.getConfig());return new gt(this,i)})}countTransactions(e){return T(this,void 0,void 0,function*(){return(yield ss(this.getId(),e,this.getConfig())).total})}listEvents(e,t,r,i,o,s){return T(this,void 0,void 0,function*(){let a=yield us(this,e,t,r,i,o,s,this.getConfig());return new mt(this,a)})}getTransaction(e){return T(this,void 0,void 0,function*(){let t=yield ns(this.getId(),e,this.getConfig());return t?new Z(this,t):void 0})}getFile(e){return T(this,void 0,void 0,function*(){let t=yield Tr(this.getId(),e,this.getConfig());return t?new Ie(this,t):void 0})}create(){return T(this,void 0,void 0,function*(){return this.payload=yield Co(this.payload,this.getConfig()),this})}copy(e,t,r){return T(this,void 0,void 0,function*(){let i=yield Oo(this.getId(),e,t,r,this.getConfig());return new n(i,this.config)})}update(){return T(this,void 0,void 0,function*(){return this.payload=yield Do(this.getId(),this.payload,this.getConfig()),this})}remove(){return T(this,void 0,void 0,function*(){return this.payload=yield ko(this.getId(),this.getConfig()),this})}getBalancesReport(e){return T(this,void 0,void 0,function*(){let t=yield _o(this.getId(),e,this.getConfig());return new vt(this,t)})}getSavedQueries(){return T(this,void 0,void 0,function*(){if(this.queries==null){let e=yield No(this.getId(),this.getConfig());this.queries=e.map(t=>new wt(this,t))}return this.queries})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield ps(this.getId(),this.getConfig());this.collaborators=e.map(t=>new ct(this,t))}return this.collaborators})}getBacklog(){return T(this,void 0,void 0,function*(){let e=yield fs(this,this.getConfig());return new Et(e,this.config)})}createAccountsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getAccounts()),new ut(e)})}createGroupsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getGroups()),new Tt(e)})}createTransactionsDataTable(e,t){return new At(this,e,t)}};var Tl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Us(n){return Tl(this,void 0,void 0,function*(){let e=yield new te("v5/templates",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}var bt=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||O.globalConfig}getName(){return this.payload.name}getDescription(){return this.payload.description}getImageUrl(){return this.payload.imageUrl}getCategory(){return this.payload.category}getTimesUsed(){return this.payload.timesUsed||0}getBookId(){return this.payload.bookId}getBookLink(){return this.payload.bookLink}getSheetsLink(){return this.payload.sheetsLink}};var ze=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},O=class n{static setConfig(e){n.globalConfig=e}constructor(e){this.config=e||n.globalConfig}getConfig(){return this.config}getBook(e,t,r){return ze(this,void 0,void 0,function*(){let i=yield bo(e,t,r,this.config);return new X(i,this.config)})}getBooks(e){return ze(this,void 0,void 0,function*(){return(yield Ao(e,this.config)).map(r=>new X(r,this.config))})}getCollections(){return ze(this,void 0,void 0,function*(){return(yield ys(this.config)).map(t=>new De(t,this.config))})}getApps(){return ze(this,void 0,void 0,function*(){return(yield yo(this.config)).map(t=>new ve(t,this.config))})}getApp(e){return ze(this,void 0,void 0,function*(){let t=yield vo(e,this.config);return new ve(t,this.config)})}getTemplates(){return ze(this,void 0,void 0,function*(){return(yield Us(this.config)).map(t=>new bt(t,this.config))})}getUser(){return ze(this,void 0,void 0,function*(){let e=yield Ns(this.config);return new Se(e,this.config)})}};O.globalConfig={};var Gs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ve=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||O.globalConfig}setWebhookUrlDev(e){return this.payload.webhookUrlDev=e,this}getId(){return this.payload.id}getName(){return this.payload.name}hasEvents(){return(this.getEvents()||[]).length>0}getEvents(){return this.payload.events}isPublished(){return this.payload.published||!1}isInstallable(){return this.payload.installable||!1}getLogoUrl(){return this.payload.logoUrl}getLogoUrlDark(){return this.payload.logoUrlDark}getDescription(){return this.payload.description}setUsers(e){return this.payload.users=e,this}getUsers(){return this.payload.users}getMenuUrl(){return this.payload.menuUrl}getMenuUrlDev(){return this.payload.menuUrlDev}getMenuText(){return this.payload.menuText}getMenuOpenMode(){return this.payload.menuOpenMode||it.SIDEBAR}setMenuOpenMode(e){return this.payload.menuOpenMode=e,this}getMenuPopupWidth(){return this.payload.menuPopupWidth}getMenuPopupHeight(){return this.payload.menuPopupHeight}getOwnerName(){return this.payload.ownerName}getOwnerLogoUrl(){return this.payload.ownerLogoUrl}getOwnerWebsiteUrl(){return this.payload.ownerWebsite}getFilePatterns(){return this.payload.filePatterns}setDevelopers(e){return this.payload.developers=e,this}getDevelopers(){return this.payload.developers}setClientSecret(e){return this.payload.clientSecret=e,this}getWebsiteUrl(){return this.payload.website}isRepositoryPrivate(){return this.payload.repoPrivate}getRepositoryUrl(){return this.payload.repoUrl}getReadme(){return this.payload.readmeMd||this.payload.readme}setReadme(e){return this.payload.readmeMd=e,this}create(){return Gs(this,void 0,void 0,function*(){return yield wo(this.payload,this.getConfig()),this})}update(){return Gs(this,void 0,void 0,function*(){return yield Eo(this.payload,this.getConfig()),this})}};var Cr=class{constructor(e){this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[],this.books=e}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.books)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}build(){var e,t;let r=new Array;this.books.sort((o,s)=>{var a,c;let l=(a=o.getCollection())===null||a===void 0?void 0:a.getName(),u=(c=s.getCollection())===null||c===void 0?void 0:c.getName();if(l&&!u)return-1;if(!l&&u)return 1;let d=(l||"").localeCompare(u||"");return d===0&&(d=(o.getName()||"").localeCompare(s.getName()||"")),d});let i=[];this.shouldAddIds&&i.push("Book Id"),i.push("Name"),i.push("Collection"),i.push("Date Pattern"),i.push("Decimal Separator"),i.push("Fraction Digits"),i.push("Period"),i.push("Owner"),this.shouldAddProperties&&(this.mapPropertyKeys(),i=i.concat(this.propertyKeys));for(let o of this.books){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()||""),s.push(((e=o.getCollection())===null||e===void 0?void 0:e.getName())||""),s.push(o.getDatePattern()||""),s.push(o.getDecimalSeparator()||""),s.push((t=o.getFractionDigits())!==null&&t!==void 0?t:""),s.push(o.getPeriod()||""),s.push(o.getOwnerName()||""),this.shouldAddProperties){let a=o.getProperties();for(let c of this.propertyKeys)s.push(a[c]||"")}r.push(s)}return r.unshift(i),be(r),r}};return Xs(bl);})();
|
|
1
|
+
"use strict";var bkperjs=(()=>{var Zs=Object.create;var Zt=Object.defineProperty;var Ws=Object.getOwnPropertyDescriptor;var Ys=Object.getOwnPropertyNames;var Ks=Object.getPrototypeOf,Js=Object.prototype.hasOwnProperty;var Qs=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Xs=(n,e)=>{for(var t in e)Zt(n,t,{get:e[t],enumerable:!0})},Ln=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ys(e))!Js.call(n,i)&&i!==t&&Zt(n,i,{get:()=>e[i],enumerable:!(r=Ws(e,i))||r.enumerable});return n};var ea=(n,e,t)=>(t=n!=null?Zs(Ks(n)):{},Ln(e||!n||!n.__esModule?Zt(t,"default",{value:n,enumerable:!0}):t,n)),ta=n=>Ln(Zt({},"__esModule",{value:!0}),n);var lo=Qs(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});function ri(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function oe(n,e,t){return e&&ri(n.prototype,e),t&&ri(n,t),n}function J(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function _r(n){return _r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},_r(n)}function er(n,e){return er=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},er(n,e)}function oa(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(n){return!1}}function Jt(n,e,t){return oa()?Jt=Reflect.construct:Jt=function(i,o,s){var a=[null];a.push.apply(a,o);var c=Function.bind.apply(i,a),l=new c;return s&&er(l,s.prototype),l},Jt.apply(null,arguments)}function sa(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Rr(n){var e=typeof Map=="function"?new Map:void 0;return Rr=function(r){if(r===null||!sa(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return Jt(r,arguments,_r(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),er(i,r)},Rr(n)}function aa(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function ua(n,e){if(n){if(typeof n=="string")return ni(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ni(n,e)}}function ni(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Ae(n){var e=0;if(typeof Symbol=="undefined"||n[Symbol.iterator]==null){if(Array.isArray(n)||(n=ua(n)))return function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}};throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return e=n[Symbol.iterator](),e.next.bind(e)}var Be=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Rr(Error)),la=(function(n){J(e,n);function e(t){return n.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(Be),ca=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(Be),da=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(Be),xt=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Si=(function(n){J(e,n);function e(t){return n.call(this,"Invalid unit "+t)||this}return e})(Be),Y=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Be),Te=(function(n){J(e,n);function e(){return n.call(this,"Zone is an abstract class")||this}return e})(Be),h="numeric",se="short",j="long",tr={year:h,month:h,day:h},zr={year:h,month:se,day:h},Ii={year:h,month:se,day:h,weekday:se},qr={year:h,month:j,day:h},Zr={year:h,month:j,day:h,weekday:j},Wr={hour:h,minute:h},Yr={hour:h,minute:h,second:h},Kr={hour:h,minute:h,second:h,timeZoneName:se},Jr={hour:h,minute:h,second:h,timeZoneName:j},Qr={hour:h,minute:h,hour12:!1},Xr={hour:h,minute:h,second:h,hour12:!1},en={hour:h,minute:h,second:h,hour12:!1,timeZoneName:se},tn={hour:h,minute:h,second:h,hour12:!1,timeZoneName:j},rn={year:h,month:h,day:h,hour:h,minute:h},nn={year:h,month:h,day:h,hour:h,minute:h,second:h},on={year:h,month:se,day:h,hour:h,minute:h},sn={year:h,month:se,day:h,hour:h,minute:h,second:h},ki={year:h,month:se,day:h,weekday:se,hour:h,minute:h},an={year:h,month:j,day:h,hour:h,minute:h,timeZoneName:se},un={year:h,month:j,day:h,hour:h,minute:h,second:h,timeZoneName:se},ln={year:h,month:j,day:h,weekday:j,hour:h,minute:h,timeZoneName:j},cn={year:h,month:j,day:h,weekday:j,hour:h,minute:h,second:h,timeZoneName:j};function A(n){return typeof n=="undefined"}function Pe(n){return typeof n=="number"}function sr(n){return typeof n=="number"&&n%1===0}function fa(n){return typeof n=="string"}function ha(n){return Object.prototype.toString.call(n)==="[object Date]"}function de(){try{return typeof Intl!="undefined"&&Intl.DateTimeFormat}catch(n){return!1}}function Pt(){return!A(Intl.DateTimeFormat.prototype.formatToParts)}function Oi(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function pa(n){return Array.isArray(n)?n:[n]}function ii(n,e,t){if(n.length!==0)return n.reduce(function(r,i){var o=[e(i),i];return r&&t(r[0],o[0])===r[0]?r:o},null)[1]}function xi(n,e){return e.reduce(function(t,r){return t[r]=n[r],t},{})}function Qe(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function me(n,e,t){return sr(n)&&n>=e&&n<=t}function ma(n,e){return n-e*Math.floor(n/e)}function Ke(n,e){e===void 0&&(e=2);var t=n<0?"-":"",r=t?n*-1:n,i;return r.toString().length<e?i=("0".repeat(e)+r).slice(-e):i=r.toString(),""+t+i}function V(n){if(!(A(n)||n===null||n===""))return parseInt(n,10)}function dn(n){if(!(A(n)||n===null||n==="")){var e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function fn(n,e,t){t===void 0&&(t=!1);var r=Math.pow(10,e),i=t?Math.trunc:Math.round;return i(n*r)/r}function Bt(n){return n%4===0&&(n%100!==0||n%400===0)}function Mt(n){return Bt(n)?366:365}function rr(n,e){var t=ma(e-1,12)+1,r=n+(e-t)/12;return t===2?Bt(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function hn(n){var e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function nr(n){var e=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7,t=n-1,r=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||r===3?53:52}function Lr(n){return n>99?n:n>60?1900+n:2e3+n}function Ni(n,e,t,r){r===void 0&&(r=null);var i=new Date(n),o={hour12:!1,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);var s=Object.assign({timeZoneName:e},o),a=de();if(a&&Pt()){var c=new Intl.DateTimeFormat(t,s).formatToParts(i).find(function(p){return p.type.toLowerCase()==="timezonename"});return c?c.value:null}else if(a){var l=new Intl.DateTimeFormat(t,o).format(i),u=new Intl.DateTimeFormat(t,s).format(i),d=u.substring(l.length),f=d.replace(/^[, \u200e]+/,"");return f}else return null}function ar(n,e){var t=parseInt(n,10);Number.isNaN(t)&&(t=0);var r=parseInt(e,10)||0,i=t<0||Object.is(t,-0)?-r:r;return t*60+i}function Mi(n){var e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new Y("Invalid unit value "+n);return e}function ir(n,e,t){var r={};for(var i in n)if(Qe(n,i)){if(t.indexOf(i)>=0)continue;var o=n[i];if(o==null)continue;r[e(i)]=Mi(o)}return r}function or(n,e){var t=Math.trunc(Math.abs(n/60)),r=Math.trunc(Math.abs(n%60)),i=n>=0?"+":"-";switch(e){case"short":return""+i+Ke(t,2)+":"+Ke(r,2);case"narrow":return""+i+t+(r>0?":"+r:"");case"techie":return""+i+Ke(t,2)+Ke(r,2);default:throw new RangeError("Value format "+e+" is out of range for property format")}}function ur(n){return xi(n,["hour","minute","second","millisecond"])}var Fi=/[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/;function I(n){return JSON.stringify(n,Object.keys(n).sort())}var ga=["January","February","March","April","May","June","July","August","September","October","November","December"],Pi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ya=["J","F","M","A","M","J","J","A","S","O","N","D"];function Bi(n){switch(n){case"narrow":return[].concat(ya);case"short":return[].concat(Pi);case"long":return[].concat(ga);case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var _i=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ri=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],va=["M","T","W","T","F","S","S"];function Li(n){switch(n){case"narrow":return[].concat(va);case"short":return[].concat(Ri);case"long":return[].concat(_i);case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Ui=["AM","PM"],wa=["Before Christ","Anno Domini"],Ea=["BC","AD"],Ta=["B","A"];function Gi(n){switch(n){case"narrow":return[].concat(Ta);case"short":return[].concat(Ea);case"long":return[].concat(wa);default:return null}}function Aa(n){return Ui[n.hour<12?0:1]}function ba(n,e){return Li(e)[n.weekday-1]}function Ca(n,e){return Bi(e)[n.month-1]}function Da(n,e){return Gi(e)[n.year<0?0:1]}function Sa(n,e,t,r){t===void 0&&(t="always"),r===void 0&&(r=!1);var 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."]},o=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&o){var s=n==="days";switch(e){case 1:return s?"tomorrow":"next "+i[n][0];case-1:return s?"yesterday":"last "+i[n][0];case 0:return s?"today":"this "+i[n][0]}}var a=Object.is(e,-0)||e<0,c=Math.abs(e),l=c===1,u=i[n],d=r?l?u[1]:u[2]||u[1]:l?i[n][0]:n;return a?c+" "+d+" ago":"in "+c+" "+d}function Ia(n){var e=xi(n,["weekday","era","year","month","day","hour","minute","second","timeZoneName","hour12"]),t=I(e),r="EEEE, LLLL d, yyyy, h:mm a";switch(t){case I(tr):return"M/d/yyyy";case I(zr):return"LLL d, yyyy";case I(Ii):return"EEE, LLL d, yyyy";case I(qr):return"LLLL d, yyyy";case I(Zr):return"EEEE, LLLL d, yyyy";case I(Wr):return"h:mm a";case I(Yr):return"h:mm:ss a";case I(Kr):return"h:mm a";case I(Jr):return"h:mm a";case I(Qr):return"HH:mm";case I(Xr):return"HH:mm:ss";case I(en):return"HH:mm";case I(tn):return"HH:mm";case I(rn):return"M/d/yyyy, h:mm a";case I(on):return"LLL d, yyyy, h:mm a";case I(an):return"LLLL d, yyyy, h:mm a";case I(ln):return r;case I(nn):return"M/d/yyyy, h:mm:ss a";case I(sn):return"LLL d, yyyy, h:mm:ss a";case I(ki):return"EEE, d LLL yyyy, h:mm a";case I(un):return"LLLL d, yyyy, h:mm:ss a";case I(cn):return"EEEE, LLLL d, yyyy, h:mm:ss a";default:return r}}function oi(n,e){for(var t="",r=Ae(n),i;!(i=r()).done;){var o=i.value;o.literal?t+=o.val:t+=e(o.val)}return t}var ka={D:tr,DD:zr,DDD:qr,DDDD:Zr,t:Wr,tt:Yr,ttt:Kr,tttt:Jr,T:Qr,TT:Xr,TTT:en,TTTT:tn,f:rn,ff:on,fff:an,ffff:ln,F:nn,FF:sn,FFF:un,FFFF:cn},le=(function(){n.create=function(r,i){return i===void 0&&(i={}),new n(r,i)},n.parseFormat=function(r){for(var i=null,o="",s=!1,a=[],c=0;c<r.length;c++){var l=r.charAt(c);l==="'"?(o.length>0&&a.push({literal:s,val:o}),i=null,o="",s=!s):s||l===i?o+=l:(o.length>0&&a.push({literal:!1,val:o}),o=l,i=l)}return o.length>0&&a.push({literal:s,val:o}),a},n.macroTokenToFormatOpts=function(r){return ka[r]};function n(t,r){this.opts=r,this.loc=t,this.systemLoc=null}var e=n.prototype;return e.formatWithSystemDefault=function(r,i){this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem());var o=this.systemLoc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTime=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.format()},e.formatDateTimeParts=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.formatToParts()},e.resolvedOptions=function(r,i){i===void 0&&(i={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,i));return o.resolvedOptions()},e.num=function(r,i){if(i===void 0&&(i=0),this.opts.forceSimple)return Ke(r,i);var o=Object.assign({},this.opts);return i>0&&(o.padTo=i),this.loc.numberFormatter(o).format(r)},e.formatDateTimeFromString=function(r,i){var o=this,s=this.loc.listingMode()==="en",a=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory"&&Pt(),c=function(y,S){return o.loc.extract(r,y,S)},l=function(y){return r.isOffsetFixed&&r.offset===0&&y.allowZ?"Z":r.isValid?r.zone.formatOffset(r.ts,y.format):""},u=function(){return s?Aa(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?Ca(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?ba(r,y):c(S?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday")},p=function(y){var S=n.macroTokenToFormatOpts(y);return S?o.formatWithSystemDefault(r,S):y},g=function(y){return s?Da(r,y):c({era:y},"era")},v=function(y){switch(y){case"S":return o.num(r.millisecond);case"u":case"SSS":return o.num(r.millisecond,3);case"s":return o.num(r.second);case"ss":return o.num(r.second,2);case"m":return o.num(r.minute);case"mm":return o.num(r.minute,2);case"h":return o.num(r.hour%12===0?12:r.hour%12);case"hh":return o.num(r.hour%12===0?12:r.hour%12,2);case"H":return o.num(r.hour);case"HH":return o.num(r.hour,2);case"Z":return l({format:"narrow",allowZ:o.opts.allowZ});case"ZZ":return l({format:"short",allowZ:o.opts.allowZ});case"ZZZ":return l({format:"techie",allowZ:o.opts.allowZ});case"ZZZZ":return r.zone.offsetName(r.ts,{format:"short",locale:o.loc.locale});case"ZZZZZ":return r.zone.offsetName(r.ts,{format:"long",locale:o.loc.locale});case"z":return r.zoneName;case"a":return u();case"d":return a?c({day:"numeric"},"day"):o.num(r.day);case"dd":return a?c({day:"2-digit"},"day"):o.num(r.day,2);case"c":return o.num(r.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return o.num(r.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return a?c({month:"numeric",day:"numeric"},"month"):o.num(r.month);case"LL":return a?c({month:"2-digit",day:"numeric"},"month"):o.num(r.month,2);case"LLL":return d("short",!0);case"LLLL":return d("long",!0);case"LLLLL":return d("narrow",!0);case"M":return a?c({month:"numeric"},"month"):o.num(r.month);case"MM":return a?c({month:"2-digit"},"month"):o.num(r.month,2);case"MMM":return d("short",!1);case"MMMM":return d("long",!1);case"MMMMM":return d("narrow",!1);case"y":return a?c({year:"numeric"},"year"):o.num(r.year);case"yy":return a?c({year:"2-digit"},"year"):o.num(r.year.toString().slice(-2),2);case"yyyy":return a?c({year:"numeric"},"year"):o.num(r.year,4);case"yyyyyy":return a?c({year:"numeric"},"year"):o.num(r.year,6);case"G":return g("short");case"GG":return g("long");case"GGGGG":return g("narrow");case"kk":return o.num(r.weekYear.toString().slice(-2),2);case"kkkk":return o.num(r.weekYear,4);case"W":return o.num(r.weekNumber);case"WW":return o.num(r.weekNumber,2);case"o":return o.num(r.ordinal);case"ooo":return o.num(r.ordinal,3);case"q":return o.num(r.quarter);case"qq":return o.num(r.quarter,2);case"X":return o.num(Math.floor(r.ts/1e3));case"x":return o.num(r.ts);default:return p(y)}};return oi(n.parseFormat(i),v)},e.formatDurationFromString=function(r,i){var o=this,s=function(f){switch(f[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"M":return"month";case"y":return"year";default:return null}},a=function(f){return function(p){var g=s(p);return g?o.num(f.get(g),p.length):p}},c=n.parseFormat(i),l=c.reduce(function(d,f){var p=f.literal,g=f.val;return p?d:d.concat(g)},[]),u=r.shiftTo.apply(r,l.map(s).filter(function(d){return d}));return oi(c,a(u))},n})(),ie=(function(){function n(t,r){this.reason=t,this.explanation=r}var e=n.prototype;return e.toMessage=function(){return this.explanation?this.reason+": "+this.explanation:this.reason},n})(),Xe=(function(){function n(){}var e=n.prototype;return e.offsetName=function(r,i){throw new Te},e.formatOffset=function(r,i){throw new Te},e.offset=function(r){throw new Te},e.equals=function(r){throw new Te},oe(n,[{key:"type",get:function(){throw new Te}},{key:"name",get:function(){throw new Te}},{key:"universal",get:function(){throw new Te}},{key:"isValid",get:function(){throw new Te}}]),n})(),Or=null,Vi=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return Ni(i,s,a)},t.formatOffset=function(i,o){return or(this.offset(i),o)},t.offset=function(i){return-new Date(i).getTimezoneOffset()},t.equals=function(i){return i.type==="local"},oe(e,[{key:"type",get:function(){return"local"}},{key:"name",get:function(){return de()?new Intl.DateTimeFormat().resolvedOptions().timeZone:"local"}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!0}}],[{key:"instance",get:function(){return Or===null&&(Or=new e),Or}}]),e})(Xe),Oa=RegExp("^"+Fi.source+"$"),Qt={};function xa(n){return Qt[n]||(Qt[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Qt[n]}var Na={year:0,month:1,day:2,hour:3,minute:4,second:5};function Ma(n,e){var t=n.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t),i=r[1],o=r[2],s=r[3],a=r[4],c=r[5],l=r[6];return[s,i,o,a,c,l]}function Fa(n,e){for(var t=n.formatToParts(e),r=[],i=0;i<t.length;i++){var o=t[i],s=o.type,a=o.value,c=Na[s];A(c)||(r[c]=parseInt(a,10))}return r}var Wt={},ce=(function(n){J(e,n),e.create=function(i){return Wt[i]||(Wt[i]=new e(i)),Wt[i]},e.resetCache=function(){Wt={},Qt={}},e.isValidSpecifier=function(i){return!!(i&&i.match(Oa))},e.isValidZone=function(i){try{return new Intl.DateTimeFormat("en-US",{timeZone:i}).format(),!0}catch(o){return!1}},e.parseGMTOffset=function(i){if(i){var o=i.match(/^Etc\/GMT(0|[+-]\d{1,2})$/i);if(o)return-60*parseInt(o[1])}return null};function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i.valid=e.isValidZone(r),i}var t=e.prototype;return t.offsetName=function(i,o){var s=o.format,a=o.locale;return Ni(i,s,a,this.name)},t.formatOffset=function(i,o){return or(this.offset(i),o)},t.offset=function(i){var o=new Date(i);if(isNaN(o))return NaN;var s=xa(this.name),a=s.formatToParts?Fa(s,o):Ma(s,o),c=a[0],l=a[1],u=a[2],d=a[3],f=a[4],p=a[5],g=d===24?0:d,v=hn({year:c,month:l,day:u,hour:g,minute:f,second:p,millisecond:0}),w=+o,y=w%1e3;return w-=y>=0?y:1e3+y,(v-w)/(60*1e3)},t.equals=function(i){return i.type==="iana"&&i.name===this.name},oe(e,[{key:"type",get:function(){return"iana"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return this.valid}}]),e})(Xe),xr=null,$=(function(n){J(e,n),e.instance=function(i){return i===0?e.utcInstance:new e(i)},e.parseSpecifier=function(i){if(i){var o=i.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(o)return new e(ar(o[1],o[2]))}return null},oe(e,null,[{key:"utcInstance",get:function(){return xr===null&&(xr=new e(0)),xr}}]);function e(r){var i;return i=n.call(this)||this,i.fixed=r,i}var t=e.prototype;return t.offsetName=function(){return this.name},t.formatOffset=function(i,o){return or(this.fixed,o)},t.offset=function(){return this.fixed},t.equals=function(i){return i.type==="fixed"&&i.fixed===this.fixed},oe(e,[{key:"type",get:function(){return"fixed"}},{key:"name",get:function(){return this.fixed===0?"UTC":"UTC"+or(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(Xe),Ur=(function(n){J(e,n);function e(r){var i;return i=n.call(this)||this,i.zoneName=r,i}var t=e.prototype;return t.offsetName=function(){return null},t.formatOffset=function(){return""},t.offset=function(){return NaN},t.equals=function(){return!1},oe(e,[{key:"type",get:function(){return"invalid"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return!1}}]),e})(Xe);function Me(n,e){var t;if(A(n)||n===null)return e;if(n instanceof Xe)return n;if(fa(n)){var r=n.toLowerCase();return r==="local"?e:r==="utc"||r==="gmt"?$.utcInstance:(t=ce.parseGMTOffset(n))!=null?$.instance(t):ce.isValidSpecifier(r)?ce.create(n):$.parseSpecifier(r)||new Ur(n)}else return Pe(n)?$.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new Ur(n)}var si=function(){return Date.now()},Nr=null,ai=null,ui=null,li=null,ci=!1,x=(function(){function n(){}return n.resetCaches=function(){B.resetCache(),ce.resetCache()},oe(n,null,[{key:"now",get:function(){return si},set:function(t){si=t}},{key:"defaultZoneName",get:function(){return n.defaultZone.name},set:function(t){t?Nr=Me(t):Nr=null}},{key:"defaultZone",get:function(){return Nr||Vi.instance}},{key:"defaultLocale",get:function(){return ai},set:function(t){ai=t}},{key:"defaultNumberingSystem",get:function(){return ui},set:function(t){ui=t}},{key:"defaultOutputCalendar",get:function(){return li},set:function(t){li=t}},{key:"throwOnInvalid",get:function(){return ci},set:function(t){ci=t}}]),n})(),Gr={};function Vr(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Gr[t];return r||(r=new Intl.DateTimeFormat(n,e),Gr[t]=r),r}var Hr={};function Pa(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=Hr[t];return r||(r=new Intl.NumberFormat(n,e),Hr[t]=r),r}var $r={};function Ba(n,e){e===void 0&&(e={});var t=e,r=t.base,i=aa(t,["base"]),o=JSON.stringify([n,i]),s=$r[o];return s||(s=new Intl.RelativeTimeFormat(n,e),$r[o]=s),s}var Ne=null;function _a(){if(Ne)return Ne;if(de()){var n=new Intl.DateTimeFormat().resolvedOptions().locale;return Ne=!n||n==="und"?"en-US":n,Ne}else return Ne="en-US",Ne}function Ra(n){var e=n.indexOf("-u-");if(e===-1)return[n];var t,r=n.substring(0,e);try{t=Vr(n).resolvedOptions()}catch(a){t=Vr(r).resolvedOptions()}var i=t,o=i.numberingSystem,s=i.calendar;return[r,o,s]}function La(n,e,t){return de()?((t||e)&&(n+="-u",t&&(n+="-ca-"+t),e&&(n+="-nu-"+e)),n):[]}function Ua(n){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(n(r))}return e}function Ga(n){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(n(r))}return e}function Yt(n,e,t,r,i){var o=n.listingMode(t);return o==="error"?null:o==="en"?r(e):i(e)}function Va(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||de()&&new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}var Ha=(function(){function n(t,r,i){if(this.padTo=i.padTo||0,this.floor=i.floor||!1,!r&&de()){var o={useGrouping:!1};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=Pa(t,o)}}var e=n.prototype;return e.format=function(r){if(this.inf){var i=this.floor?Math.floor(r):r;return this.inf.format(i)}else{var o=this.floor?Math.floor(r):fn(r,3);return Ke(o,this.padTo)}},n})(),$a=(function(){function n(t,r,i){this.opts=i,this.hasIntl=de();var o;if(t.zone.universal&&this.hasIntl){var s=-1*(t.offset/60),a=s>=0?"Etc/GMT+"+s:"Etc/GMT"+s,c=ce.isValidZone(a);t.offset!==0&&c?(o=a,this.dt=t):(o="UTC",i.timeZoneName?this.dt=t:this.dt=t.offset===0?t:M.fromMillis(t.ts+t.offset*60*1e3))}else t.zone.type==="local"?this.dt=t:(this.dt=t,o=t.zone.name);if(this.hasIntl){var l=Object.assign({},this.opts);o&&(l.timeZone=o),this.dtf=Vr(r,l)}}var e=n.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=Ia(this.opts),i=B.create("en-US");return le.create(i).formatDateTimeFromString(this.dt,r)},e.formatToParts=function(){return this.hasIntl&&Pt()?this.dtf.formatToParts(this.dt.toJSDate()):[]},e.resolvedOptions=function(){return this.hasIntl?this.dtf.resolvedOptions():{locale:"en-US",numberingSystem:"latn",outputCalendar:"gregory"}},n})(),ja=(function(){function n(t,r,i){this.opts=Object.assign({style:"long"},i),!r&&Oi()&&(this.rtf=Ba(t,i))}var e=n.prototype;return e.format=function(r,i){return this.rtf?this.rtf.format(r,i):Sa(i,r,this.opts.numeric,this.opts.style!=="long")},e.formatToParts=function(r,i){return this.rtf?this.rtf.formatToParts(r,i):[]},n})(),B=(function(){n.fromOpts=function(r){return n.create(r.locale,r.numberingSystem,r.outputCalendar,r.defaultToEN)},n.create=function(r,i,o,s){s===void 0&&(s=!1);var a=r||x.defaultLocale,c=a||(s?"en-US":_a()),l=i||x.defaultNumberingSystem,u=o||x.defaultOutputCalendar;return new n(c,l,u,a)},n.resetCache=function(){Ne=null,Gr={},Hr={},$r={}},n.fromObject=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar;return n.create(o,s,a)};function n(t,r,i,o){var s=Ra(t),a=s[0],c=s[1],l=s[2];this.locale=a,this.numberingSystem=r||c||null,this.outputCalendar=i||l||null,this.intl=La(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=o,this.fastNumbersCached=null}var e=n.prototype;return e.listingMode=function(r){r===void 0&&(r=!0);var i=de(),o=i&&Pt(),s=this.isEnglish(),a=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return!o&&!(s&&a)&&!r?"error":!o||s&&a?"en":"intl"},e.clone=function(r){return!r||Object.getOwnPropertyNames(r).length===0?this:n.create(r.locale||this.specifiedLocale,r.numberingSystem||this.numberingSystem,r.outputCalendar||this.outputCalendar,r.defaultToEN||!1)},e.redefaultToEN=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!0}))},e.redefaultToSystem=function(r){return r===void 0&&(r={}),this.clone(Object.assign({},r,{defaultToEN:!1}))},e.months=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Yt(this,r,o,Bi,function(){var a=i?{month:r,day:"numeric"}:{month:r},c=i?"format":"standalone";return s.monthsCache[c][r]||(s.monthsCache[c][r]=Ua(function(l){return s.extract(l,a,"month")})),s.monthsCache[c][r]})},e.weekdays=function(r,i,o){var s=this;return i===void 0&&(i=!1),o===void 0&&(o=!0),Yt(this,r,o,Li,function(){var a=i?{weekday:r,year:"numeric",month:"long",day:"numeric"}:{weekday:r},c=i?"format":"standalone";return s.weekdaysCache[c][r]||(s.weekdaysCache[c][r]=Ga(function(l){return s.extract(l,a,"weekday")})),s.weekdaysCache[c][r]})},e.meridiems=function(r){var i=this;return r===void 0&&(r=!0),Yt(this,void 0,r,function(){return Ui},function(){if(!i.meridiemCache){var o={hour:"numeric",hour12:!0};i.meridiemCache=[M.utc(2016,11,13,9),M.utc(2016,11,13,19)].map(function(s){return i.extract(s,o,"dayperiod")})}return i.meridiemCache})},e.eras=function(r,i){var o=this;return i===void 0&&(i=!0),Yt(this,r,i,Gi,function(){var s={era:r};return o.eraCache[r]||(o.eraCache[r]=[M.utc(-40,1,1),M.utc(2017,1,1)].map(function(a){return o.extract(a,s,"era")})),o.eraCache[r]})},e.extract=function(r,i,o){var s=this.dtFormatter(r,i),a=s.formatToParts(),c=a.find(function(l){return l.type.toLowerCase()===o});return c?c.value:null},e.numberFormatter=function(r){return r===void 0&&(r={}),new Ha(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,i){return i===void 0&&(i={}),new $a(r,this.intl,i)},e.relFormatter=function(r){return r===void 0&&(r={}),new ja(this.intl,this.isEnglish(),r)},e.isEnglish=function(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||de()&&new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")},e.equals=function(r){return this.locale===r.locale&&this.numberingSystem===r.numberingSystem&&this.outputCalendar===r.outputCalendar},oe(n,[{key:"fastNumbers",get:function(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Va(this)),this.fastNumbersCached}}]),n})();function et(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];var r=e.reduce(function(i,o){return i+o.source},"");return RegExp("^"+r+"$")}function _e(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r){return e.reduce(function(i,o){var s=i[0],a=i[1],c=i[2],l=o(r,c),u=l[0],d=l[1],f=l[2];return[Object.assign(s,u),a||d,f]},[{},null,1]).slice(0,2)}}function tt(n){if(n==null)return[null,null];for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];for(var i=0,o=t;i<o.length;i++){var s=o[i],a=s[0],c=s[1],l=a.exec(n);if(l)return c(l)}return[null,null]}function Hi(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return function(r,i){var o={},s;for(s=0;s<e.length;s++)o[e[s]]=V(r[i+s]);return[o,null,i+s]}}var $i=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,pn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ji=RegExp(""+pn.source+$i.source+"?"),mn=RegExp("(?:T"+ji.source+")?"),za=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,qa=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Za=/(\d{4})-?(\d{3})/,Wa=Hi("weekYear","weekNumber","weekDay"),Ya=Hi("year","ordinal"),Ka=/(\d{4})-(\d\d)-(\d\d)/,zi=RegExp(pn.source+" ?(?:"+$i.source+"|("+Fi.source+"))?"),Ja=RegExp("(?: "+zi.source+")?");function Je(n,e,t){var r=n[e];return A(r)?t:V(r)}function qi(n,e){var t={year:Je(n,e),month:Je(n,e+1,1),day:Je(n,e+2,1)};return[t,null,e+3]}function Re(n,e){var t={hours:Je(n,e,0),minutes:Je(n,e+1,0),seconds:Je(n,e+2,0),milliseconds:dn(n[e+3])};return[t,null,e+4]}function rt(n,e){var t=!n[e]&&!n[e+1],r=ar(n[e+1],n[e+2]),i=t?null:$.instance(r);return[{},i,e+3]}function Zi(n,e){var t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}var Qa=RegExp("^T?"+pn.source+"$"),Xa=/^-?P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,9}))?S)?)?)$/;function eu(n){var e=n[0],t=n[1],r=n[2],i=n[3],o=n[4],s=n[5],a=n[6],c=n[7],l=n[8],u=e[0]==="-",d=c&&c[0]==="-",f=function(g,v){return v===void 0&&(v=!1),g!==void 0&&(v||g&&u)?-g:g};return[{years:f(V(t)),months:f(V(r)),weeks:f(V(i)),days:f(V(o)),hours:f(V(s)),minutes:f(V(a)),seconds:f(V(c),c==="-0"),milliseconds:f(dn(l),d)}]}var tu={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function gn(n,e,t,r,i,o,s){var a={year:e.length===2?Lr(V(e)):V(e),month:Pi.indexOf(t)+1,day:V(r),hour:V(i),minute:V(o)};return s&&(a.second=V(s)),n&&(a.weekday=n.length>3?_i.indexOf(n)+1:Ri.indexOf(n)+1),a}var ru=/^(?:(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 nu(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=n[8],l=n[9],u=n[10],d=n[11],f=gn(e,i,r,t,o,s,a),p;return c?p=tu[c]:l?p=0:p=ar(u,d),[f,new $(p)]}function iu(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var ou=/^(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$/,su=/^(Monday|Tuesday|Wedsday|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$/,au=/^(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 di(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=gn(e,i,r,t,o,s,a);return[c,$.utcInstance]}function uu(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=gn(e,a,t,r,i,o,s);return[c,$.utcInstance]}var lu=et(za,mn),cu=et(qa,mn),du=et(Za,mn),fu=et(ji),hu=_e(qi,Re,rt),pu=_e(Wa,Re,rt),mu=_e(Ya,Re,rt),gu=_e(Re,rt);function yu(n){return tt(n,[lu,hu],[cu,pu],[du,mu],[fu,gu])}function vu(n){return tt(iu(n),[ru,nu])}function wu(n){return tt(n,[ou,di],[su,di],[au,uu])}function Eu(n){return tt(n,[Xa,eu])}var Tu=_e(Re);function Au(n){return tt(n,[Qa,Tu])}var bu=et(Ka,Ja),Cu=et(zi),Du=_e(qi,Re,rt,Zi),Su=_e(Re,rt,Zi);function Iu(n){return tt(n,[bu,Du],[Cu,Su])}var ku="Invalid Duration",Wi={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Ou=Object.assign({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:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3}},Wi),W=146097/400,Ze=146097/4800,xu=Object.assign({years:{quarters:4,months:12,weeks:W/7,days:W,hours:W*24,minutes:W*24*60,seconds:W*24*60*60,milliseconds:W*24*60*60*1e3},quarters:{months:3,weeks:W/28,days:W/4,hours:W*24/4,minutes:W*24*60/4,seconds:W*24*60*60/4,milliseconds:W*24*60*60*1e3/4},months:{weeks:Ze/7,days:Ze,hours:Ze*24,minutes:Ze*24*60,seconds:Ze*24*60*60,milliseconds:Ze*24*60*60*1e3}},Wi),We=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Nu=We.slice(0).reverse();function xe(n,e,t){t===void 0&&(t=!1);var r={values:t?e.values:Object.assign({},n.values,e.values||{}),loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy};return new H(r)}function Mu(n){return n<0?Math.floor(n):Math.ceil(n)}function Yi(n,e,t,r,i){var o=n[i][t],s=e[t]/o,a=Math.sign(s)===Math.sign(r[i]),c=!a&&r[i]!==0&&Math.abs(s)<=1?Mu(s):Math.trunc(s);r[i]+=c,e[t]-=c*o}function Fu(n,e){Nu.reduce(function(t,r){return A(e[r])?t:(t&&Yi(n,e,t,e,r),r)},null)}var H=(function(){function n(t){var r=t.conversionAccuracy==="longterm"||!1;this.values=t.values,this.loc=t.loc||B.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=r?xu:Ou,this.isLuxonDuration=!0}n.fromMillis=function(r,i){return n.fromObject(Object.assign({milliseconds:r},i))},n.fromObject=function(r){if(r==null||typeof r!="object")throw new Y("Duration.fromObject: argument expected to be an object, got "+(r===null?"null":typeof r));return new n({values:ir(r,n.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:B.fromObject(r),conversionAccuracy:r.conversionAccuracy})},n.fromISO=function(r,i){var o=Eu(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.fromISOTime=function(r,i){var o=Au(r),s=o[0];if(s){var a=Object.assign(s,i);return n.fromObject(a)}else return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new Y("need to specify a reason the Duration is invalid");var o=r instanceof ie?r:new ie(r,i);if(x.throwOnInvalid)throw new da(o);return new n({invalid:o})},n.normalizeUnit=function(r){var i={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"}[r&&r.toLowerCase()];if(!i)throw new Si(r);return i},n.isDuration=function(r){return r&&r.isLuxonDuration||!1};var e=n.prototype;return e.toFormat=function(r,i){i===void 0&&(i={});var o=Object.assign({},i,{floor:i.round!==!1&&i.floor!==!1});return this.isValid?le.create(this.loc,o).formatDurationFromString(this,r):ku},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.values);return r.includeConfig&&(i.conversionAccuracy=this.conversionAccuracy,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toISO=function(){if(!this.isValid)return null;var r="P";return this.years!==0&&(r+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(r+=this.months+this.quarters*3+"M"),this.weeks!==0&&(r+=this.weeks+"W"),this.days!==0&&(r+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(r+="T"),this.hours!==0&&(r+=this.hours+"H"),this.minutes!==0&&(r+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(r+=fn(this.seconds+this.milliseconds/1e3,3)+"S"),r==="P"&&(r+="T0S"),r},e.toISOTime=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=this.toMillis();if(i<0||i>=864e5)return null;r=Object.assign({suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended"},r);var o=this.shiftTo("hours","minutes","seconds","milliseconds"),s=r.format==="basic"?"hhmm":"hh:mm";(!r.suppressSeconds||o.seconds!==0||o.milliseconds!==0)&&(s+=r.format==="basic"?"ss":":ss",(!r.suppressMilliseconds||o.milliseconds!==0)&&(s+=".SSS"));var a=o.toFormat(s);return r.includePrefix&&(a="T"+a),a},e.toJSON=function(){return this.toISO()},e.toString=function(){return this.toISO()},e.toMillis=function(){return this.as("milliseconds")},e.valueOf=function(){return this.toMillis()},e.plus=function(r){if(!this.isValid)return this;for(var i=Fe(r),o={},s=Ae(We),a;!(a=s()).done;){var c=a.value;(Qe(i.values,c)||Qe(this.values,c))&&(o[c]=i.get(c)+this.get(c))}return xe(this,{values:o},!0)},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r);return this.plus(i.negate())},e.mapUnits=function(r){if(!this.isValid)return this;for(var i={},o=0,s=Object.keys(this.values);o<s.length;o++){var a=s[o];i[a]=Mi(r(this.values[a],a))}return xe(this,{values:i},!0)},e.get=function(r){return this[n.normalizeUnit(r)]},e.set=function(r){if(!this.isValid)return this;var i=Object.assign(this.values,ir(r,n.normalizeUnit,[]));return xe(this,{values:i})},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.conversionAccuracy,c=this.loc.clone({locale:o,numberingSystem:s}),l={loc:c};return a&&(l.conversionAccuracy=a),xe(this,l)},e.as=function(r){return this.isValid?this.shiftTo(r).get(r):NaN},e.normalize=function(){if(!this.isValid)return this;var r=this.toObject();return Fu(this.matrix,r),xe(this,{values:r},!0)},e.shiftTo=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!this.isValid)return this;if(i.length===0)return this;i=i.map(function(S){return n.normalizeUnit(S)});for(var s={},a={},c=this.toObject(),l,u=Ae(We),d;!(d=u()).done;){var f=d.value;if(i.indexOf(f)>=0){l=f;var p=0;for(var g in a)p+=this.matrix[g][f]*a[g],a[g]=0;Pe(c[f])&&(p+=c[f]);var v=Math.trunc(p);s[f]=v,a[f]=p-v;for(var w in c)We.indexOf(w)>We.indexOf(f)&&Yi(this.matrix,c,w,s,f)}else Pe(c[f])&&(a[f]=c[f])}for(var y in a)a[y]!==0&&(s[l]+=y===l?a[y]:a[y]/this.matrix[l][y]);return xe(this,{values:s},!0).normalize()},e.negate=function(){if(!this.isValid)return this;for(var r={},i=0,o=Object.keys(this.values);i<o.length;i++){var s=o[i];r[s]=-this.values[s]}return xe(this,{values:r},!0)},e.equals=function(r){if(!this.isValid||!r.isValid||!this.loc.equals(r.loc))return!1;function i(c,l){return c===void 0||c===0?l===void 0||l===0:c===l}for(var o=Ae(We),s;!(s=o()).done;){var a=s.value;if(!i(this.values[a],r.values[a]))return!1}return!0},oe(n,[{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"years",get:function(){return this.isValid?this.values.years||0:NaN}},{key:"quarters",get:function(){return this.isValid?this.values.quarters||0:NaN}},{key:"months",get:function(){return this.isValid?this.values.months||0:NaN}},{key:"weeks",get:function(){return this.isValid?this.values.weeks||0:NaN}},{key:"days",get:function(){return this.isValid?this.values.days||0:NaN}},{key:"hours",get:function(){return this.isValid?this.values.hours||0:NaN}},{key:"minutes",get:function(){return this.isValid?this.values.minutes||0:NaN}},{key:"seconds",get:function(){return this.isValid?this.values.seconds||0:NaN}},{key:"milliseconds",get:function(){return this.isValid?this.values.milliseconds||0:NaN}},{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})();function Fe(n){if(Pe(n))return H.fromMillis(n);if(H.isDuration(n))return n;if(typeof n=="object")return H.fromObject(n);throw new Y("Unknown duration argument "+n+" of type "+typeof n)}var St="Invalid Interval";function Pu(n,e){return!n||!n.isValid?Ft.invalid("missing or invalid start"):!e||!e.isValid?Ft.invalid("missing or invalid end"):e<n?Ft.invalid("end before start","The end of an interval must be after its start, but you had start="+n.toISO()+" and end="+e.toISO()):null}var Ft=(function(){function n(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new Y("need to specify a reason the Interval is invalid");var o=r instanceof ie?r:new ie(r,i);if(x.throwOnInvalid)throw new ca(o);return new n({invalid:o})},n.fromDateTimes=function(r,i){var o=Ot(r),s=Ot(i),a=Pu(o,s);return a==null?new n({start:o,end:s}):a},n.after=function(r,i){var o=Fe(i),s=Ot(r);return n.fromDateTimes(s,s.plus(o))},n.before=function(r,i){var o=Fe(i),s=Ot(r);return n.fromDateTimes(s.minus(o),s)},n.fromISO=function(r,i){var o=(r||"").split("/",2),s=o[0],a=o[1];if(s&&a){var c,l;try{c=M.fromISO(s,i),l=c.isValid}catch(g){l=!1}var u,d;try{u=M.fromISO(a,i),d=u.isValid}catch(g){d=!1}if(l&&d)return n.fromDateTimes(c,u);if(l){var f=H.fromISO(a,i);if(f.isValid)return n.after(c,f)}else if(d){var p=H.fromISO(s,i);if(p.isValid)return n.before(u,p)}}return n.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},n.isInterval=function(r){return r&&r.isLuxonInterval||!1};var e=n.prototype;return e.length=function(r){return r===void 0&&(r="milliseconds"),this.isValid?this.toDuration.apply(this,[r]).get(r):NaN},e.count=function(r){if(r===void 0&&(r="milliseconds"),!this.isValid)return NaN;var i=this.start.startOf(r),o=this.end.startOf(r);return Math.floor(o.diff(i,r).get(r))+1},e.hasSame=function(r){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,r):!1},e.isEmpty=function(){return this.s.valueOf()===this.e.valueOf()},e.isAfter=function(r){return this.isValid?this.s>r:!1},e.isBefore=function(r){return this.isValid?this.e<=r:!1},e.contains=function(r){return this.isValid?this.s<=r&&this.e>r:!1},e.set=function(r){var i=r===void 0?{}:r,o=i.start,s=i.end;return this.isValid?n.fromDateTimes(o||this.s,s||this.e):this},e.splitAt=function(){var r=this;if(!this.isValid)return[];for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];for(var a=o.map(Ot).filter(function(p){return r.contains(p)}).sort(),c=[],l=this.s,u=0;l<this.e;){var d=a[u]||this.e,f=+d>+this.e?this.e:d;c.push(n.fromDateTimes(l,f)),l=f,u+=1}return c},e.splitBy=function(r){var i=Fe(r);if(!this.isValid||!i.isValid||i.as("milliseconds")===0)return[];for(var o=this.s,s=1,a,c=[];o<this.e;){var l=this.start.plus(i.mapUnits(function(u){return u*s}));a=+l>+this.e?this.e:l,c.push(n.fromDateTimes(o,a)),o=a,s+=1}return c},e.divideEqually=function(r){return this.isValid?this.splitBy(this.length()/r).slice(0,r):[]},e.overlaps=function(r){return this.e>r.s&&this.s<r.e},e.abutsStart=function(r){return this.isValid?+this.e==+r.s:!1},e.abutsEnd=function(r){return this.isValid?+r.e==+this.s:!1},e.engulfs=function(r){return this.isValid?this.s<=r.s&&this.e>=r.e:!1},e.equals=function(r){return!this.isValid||!r.isValid?!1:this.s.equals(r.s)&&this.e.equals(r.e)},e.intersection=function(r){if(!this.isValid)return this;var i=this.s>r.s?this.s:r.s,o=this.e<r.e?this.e:r.e;return i>=o?null:n.fromDateTimes(i,o)},e.union=function(r){if(!this.isValid)return this;var i=this.s<r.s?this.s:r.s,o=this.e>r.e?this.e:r.e;return n.fromDateTimes(i,o)},n.merge=function(r){var i=r.sort(function(a,c){return a.s-c.s}).reduce(function(a,c){var l=a[0],u=a[1];return u?u.overlaps(c)||u.abutsStart(c)?[l,u.union(c)]:[l.concat([u]),c]:[l,c]},[[],null]),o=i[0],s=i[1];return s&&o.push(s),o},n.xor=function(r){for(var i,o=null,s=0,a=[],c=r.map(function(g){return[{time:g.s,type:"s"},{time:g.e,type:"e"}]}),l=(i=Array.prototype).concat.apply(i,c),u=l.sort(function(g,v){return g.time-v.time}),d=Ae(u),f;!(f=d()).done;){var p=f.value;s+=p.type==="s"?1:-1,s===1?o=p.time:(o&&+o!=+p.time&&a.push(n.fromDateTimes(o,p.time)),o=null)}return n.merge(a)},e.difference=function(){for(var r=this,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return n.xor([this].concat(o)).map(function(a){return r.intersection(a)}).filter(function(a){return a&&!a.isEmpty()})},e.toString=function(){return this.isValid?"["+this.s.toISO()+" \u2013 "+this.e.toISO()+")":St},e.toISO=function(r){return this.isValid?this.s.toISO(r)+"/"+this.e.toISO(r):St},e.toISODate=function(){return this.isValid?this.s.toISODate()+"/"+this.e.toISODate():St},e.toISOTime=function(r){return this.isValid?this.s.toISOTime(r)+"/"+this.e.toISOTime(r):St},e.toFormat=function(r,i){var o=i===void 0?{}:i,s=o.separator,a=s===void 0?" \u2013 ":s;return this.isValid?""+this.s.toFormat(r)+a+this.e.toFormat(r):St},e.toDuration=function(r,i){return this.isValid?this.e.diff(this.s,r,i):H.invalid(this.invalidReason)},e.mapEndpoints=function(r){return n.fromDateTimes(r(this.s),r(this.e))},oe(n,[{key:"start",get:function(){return this.isValid?this.s:null}},{key:"end",get:function(){return this.isValid?this.e:null}},{key:"isValid",get:function(){return this.invalidReason===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}}]),n})(),Nt=(function(){function n(){}return n.hasDST=function(t){t===void 0&&(t=x.defaultZone);var r=M.now().setZone(t).set({month:12});return!t.universal&&r.offset!==r.set({month:6}).offset},n.isValidIANAZone=function(t){return ce.isValidSpecifier(t)&&ce.isValidZone(t)},n.normalizeZone=function(t){return Me(t,x.defaultZone)},n.months=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t)},n.monthsFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l,d=i.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t,!0)},n.weekdays=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t)},n.weekdaysFormat=function(t,r){t===void 0&&(t="long");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o,a=i.numberingSystem,c=a===void 0?null:a,l=i.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t,!0)},n.meridiems=function(t){var r=t===void 0?{}:t,i=r.locale,o=i===void 0?null:i;return B.create(o).meridiems()},n.eras=function(t,r){t===void 0&&(t="short");var i=r===void 0?{}:r,o=i.locale,s=o===void 0?null:o;return B.create(s,null,"gregory").eras(t)},n.features=function(){var t=!1,r=!1,i=!1,o=!1;if(de()){t=!0,r=Pt(),o=Oi();try{i=new Intl.DateTimeFormat("en",{timeZone:"America/New_York"}).resolvedOptions().timeZone==="America/New_York"}catch(s){i=!1}}return{intl:t,intlTokens:r,zones:i,relative:o}},n})();function fi(n,e){var t=function(o){return o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf()},r=t(e)-t(n);return Math.floor(H.fromMillis(r).as("days"))}function Bu(n,e,t){for(var r=[["years",function(v,w){return w.year-v.year}],["quarters",function(v,w){return w.quarter-v.quarter}],["months",function(v,w){return w.month-v.month+(w.year-v.year)*12}],["weeks",function(v,w){var y=fi(v,w);return(y-y%7)/7}],["days",fi]],i={},o,s,a=0,c=r;a<c.length;a++){var l=c[a],u=l[0],d=l[1];if(t.indexOf(u)>=0){var f;o=u;var p=d(n,e);if(s=n.plus((f={},f[u]=p,f)),s>e){var g;n=n.plus((g={},g[u]=p-1,g)),p-=1}else n=s;i[u]=p}}return[n,i,s,o]}function _u(n,e,t,r){var i=Bu(n,e,t),o=i[0],s=i[1],a=i[2],c=i[3],l=e-o,u=t.filter(function(g){return["hours","minutes","seconds","milliseconds"].indexOf(g)>=0});if(u.length===0){if(a<e){var d;a=o.plus((d={},d[c]=1,d))}a!==o&&(s[c]=(s[c]||0)+l/(a-o))}var f=H.fromObject(Object.assign(s,r));if(u.length>0){var p;return(p=H.fromMillis(l,r)).shiftTo.apply(p,u).plus(f)}else return f}var yn={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"},hi={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]},Ru=yn.hanidec.replace(/[\[|\]]/g,"").split("");function Lu(n){var e=parseInt(n,10);if(isNaN(e)){e="";for(var t=0;t<n.length;t++){var r=n.charCodeAt(t);if(n[t].search(yn.hanidec)!==-1)e+=Ru.indexOf(n[t]);else for(var i in hi){var o=hi[i],s=o[0],a=o[1];r>=s&&r<=a&&(e+=r-s)}}return parseInt(e,10)}else return e}function re(n,e){var t=n.numberingSystem;return e===void 0&&(e=""),new RegExp(""+yn[t||"latn"]+e)}var Uu="missing Intl.DateTimeFormat.formatToParts support";function b(n,e){return e===void 0&&(e=function(r){return r}),{regex:n,deser:function(r){var i=r[0];return e(Lu(i))}}}var Gu="\xA0",Ki="( |"+Gu+")",Ji=new RegExp(Ki,"g");function Vu(n){return n.replace(/\./g,"\\.?").replace(Ji,Ki)}function pi(n){return n.replace(/\./g,"").replace(Ji," ").toLowerCase()}function ne(n,e){return n===null?null:{regex:RegExp(n.map(Vu).join("|")),deser:function(r){var i=r[0];return n.findIndex(function(o){return pi(i)===pi(o)})+e}}}function mi(n,e){return{regex:n,deser:function(r){var i=r[1],o=r[2];return ar(i,o)},groups:e}}function gi(n){return{regex:n,deser:function(t){var r=t[0];return r}}}function Hu(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function $u(n,e){var t=re(e),r=re(e,"{2}"),i=re(e,"{3}"),o=re(e,"{4}"),s=re(e,"{6}"),a=re(e,"{1,2}"),c=re(e,"{1,3}"),l=re(e,"{1,6}"),u=re(e,"{1,9}"),d=re(e,"{2,4}"),f=re(e,"{4,6}"),p=function(y){return{regex:RegExp(Hu(y.val)),deser:function(ae){var D=ae[0];return D},literal:!0}},g=function(y){if(n.literal)return p(y);switch(y.val){case"G":return ne(e.eras("short",!1),0);case"GG":return ne(e.eras("long",!1),0);case"y":return b(l);case"yy":return b(d,Lr);case"yyyy":return b(o);case"yyyyy":return b(f);case"yyyyyy":return b(s);case"M":return b(a);case"MM":return b(r);case"MMM":return ne(e.months("short",!0,!1),1);case"MMMM":return ne(e.months("long",!0,!1),1);case"L":return b(a);case"LL":return b(r);case"LLL":return ne(e.months("short",!1,!1),1);case"LLLL":return ne(e.months("long",!1,!1),1);case"d":return b(a);case"dd":return b(r);case"o":return b(c);case"ooo":return b(i);case"HH":return b(r);case"H":return b(a);case"hh":return b(r);case"h":return b(a);case"mm":return b(r);case"m":return b(a);case"q":return b(a);case"qq":return b(r);case"s":return b(a);case"ss":return b(r);case"S":return b(c);case"SSS":return b(i);case"u":return gi(u);case"a":return ne(e.meridiems(),0);case"kkkk":return b(o);case"kk":return b(d,Lr);case"W":return b(a);case"WW":return b(r);case"E":case"c":return b(t);case"EEE":return ne(e.weekdays("short",!1,!1),1);case"EEEE":return ne(e.weekdays("long",!1,!1),1);case"ccc":return ne(e.weekdays("short",!0,!1),1);case"cccc":return ne(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return mi(new RegExp("([+-]"+a.source+")(?::("+r.source+"))?"),2);case"ZZZ":return mi(new RegExp("([+-]"+a.source+")("+r.source+")?"),2);case"z":return gi(/[a-z_+-/]{1,256}?/i);default:return p(y)}},v=g(n)||{invalidReason:Uu};return v.token=n,v}var ju={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",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"}};function zu(n,e,t){var r=n.type,i=n.value;if(r==="literal")return{literal:!0,val:i};var o=t[r],s=ju[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function qu(n){var e=n.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",n]}function Zu(n,e,t){var r=n.match(e);if(r){var i={},o=1;for(var s in t)if(Qe(t,s)){var a=t[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(i[a.token.val[0]]=a.deser(r.slice(o,o+c))),o+=c}return[r,i]}else return[r,{}]}function Wu(n){var e=function(o){switch(o){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}},t;A(n.Z)?A(n.z)?t=null:t=ce.create(n.z):t=new $(n.Z),A(n.q)||(n.M=(n.q-1)*3+1),A(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),A(n.u)||(n.S=dn(n.u));var r=Object.keys(n).reduce(function(i,o){var s=e(o);return s&&(i[s]=n[o]),i},{});return[r,t]}var Mr=null;function Yu(){return Mr||(Mr=M.fromMillis(1555555555555)),Mr}function Ku(n,e){if(n.literal)return n;var t=le.macroTokenToFormatOpts(n.val);if(!t)return n;var r=le.create(e,t),i=r.formatDateTimeParts(Yu()),o=i.map(function(s){return zu(s,e,t)});return o.includes(void 0)?n:o}function Ju(n,e){var t;return(t=Array.prototype).concat.apply(t,n.map(function(r){return Ku(r,e)}))}function Qi(n,e,t){var r=Ju(le.parseFormat(t),n),i=r.map(function(w){return $u(w,n)}),o=i.find(function(w){return w.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=qu(i),a=s[0],c=s[1],l=RegExp(a,"i"),u=Zu(e,l,c),d=u[0],f=u[1],p=f?Wu(f):[null,null],g=p[0],v=p[1];if(Qe(f,"a")&&Qe(f,"H"))throw new xt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:l,rawMatches:d,matches:f,result:g,zone:v}}function Qu(n,e,t){var r=Qi(n,e,t),i=r.result,o=r.zone,s=r.invalidReason;return[i,o,s]}var Xi=[0,31,59,90,120,151,181,212,243,273,304,334],eo=[0,31,60,91,121,152,182,213,244,274,305,335];function K(n,e){return new ie("unit out of range","you specified "+e+" (of type "+typeof e+") as a "+n+", which is invalid")}function to(n,e,t){var r=new Date(Date.UTC(n,e-1,t)).getUTCDay();return r===0?7:r}function ro(n,e,t){return t+(Bt(n)?eo:Xi)[e-1]}function no(n,e){var t=Bt(n)?eo:Xi,r=t.findIndex(function(o){return o<e}),i=e-t[r];return{month:r+1,day:i}}function jr(n){var e=n.year,t=n.month,r=n.day,i=ro(e,t,r),o=to(e,t,r),s=Math.floor((i-o+10)/7),a;return s<1?(a=e-1,s=nr(a)):s>nr(e)?(a=e+1,s=1):a=e,Object.assign({weekYear:a,weekNumber:s,weekday:o},ur(n))}function yi(n){var e=n.weekYear,t=n.weekNumber,r=n.weekday,i=to(e,1,4),o=Mt(e),s=t*7+r-i-3,a;s<1?(a=e-1,s+=Mt(a)):s>o?(a=e+1,s-=Mt(e)):a=e;var c=no(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},ur(n))}function Fr(n){var e=n.year,t=n.month,r=n.day,i=ro(e,t,r);return Object.assign({year:e,ordinal:i},ur(n))}function vi(n){var e=n.year,t=n.ordinal,r=no(e,t),i=r.month,o=r.day;return Object.assign({year:e,month:i,day:o},ur(n))}function Xu(n){var e=sr(n.weekYear),t=me(n.weekNumber,1,nr(n.weekYear)),r=me(n.weekday,1,7);return e?t?r?!1:K("weekday",n.weekday):K("week",n.week):K("weekYear",n.weekYear)}function el(n){var e=sr(n.year),t=me(n.ordinal,1,Mt(n.year));return e?t?!1:K("ordinal",n.ordinal):K("year",n.year)}function io(n){var e=sr(n.year),t=me(n.month,1,12),r=me(n.day,1,rr(n.year,n.month));return e?t?r?!1:K("day",n.day):K("month",n.month):K("year",n.year)}function oo(n){var e=n.hour,t=n.minute,r=n.second,i=n.millisecond,o=me(e,0,23)||e===24&&t===0&&r===0&&i===0,s=me(t,0,59),a=me(r,0,59),c=me(i,0,999);return o?s?a?c?!1:K("millisecond",i):K("second",r):K("minute",t):K("hour",e)}var Pr="Invalid DateTime",wi=864e13;function Kt(n){return new ie("unsupported zone",'the zone "'+n.name+'" is not supported')}function Br(n){return n.weekData===null&&(n.weekData=jr(n.c)),n.weekData}function It(n,e){var t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new M(Object.assign({},t,e,{old:t}))}function so(n,e,t){var r=n-e*60*1e3,i=t.offset(r);if(e===i)return[r,e];r-=(i-e)*60*1e3;var o=t.offset(r);return i===o?[r,i]:[n-Math.min(i,o)*60*1e3,Math.max(i,o)]}function Ei(n,e){n+=e*60*1e3;var t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Xt(n,e,t){return so(hn(n),e,t)}function Ti(n,e){var t=n.o,r=n.c.year+Math.trunc(e.years),i=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o=Object.assign({},n.c,{year:r,month:i,day:Math.min(n.c.day,rr(r,i))+Math.trunc(e.days)+Math.trunc(e.weeks)*7}),s=H.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=hn(o),c=so(a,t,n.zone),l=c[0],u=c[1];return s!==0&&(l+=s,u=n.zone.offset(l)),{ts:l,o:u}}function kt(n,e,t,r,i){var o=t.setZone,s=t.zone;if(n&&Object.keys(n).length!==0){var a=e||s,c=M.fromObject(Object.assign(n,t,{zone:a,setZone:void 0}));return o?c:c.setZone(s)}else return M.invalid(new ie("unparsable",'the input "'+i+`" can't be parsed as `+r))}function Ye(n,e,t){return t===void 0&&(t=!0),n.isValid?le.create(B.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Ai(n,e){var t=e.suppressSeconds,r=t===void 0?!1:t,i=e.suppressMilliseconds,o=i===void 0?!1:i,s=e.includeOffset,a=e.includePrefix,c=a===void 0?!1:a,l=e.includeZone,u=l===void 0?!1:l,d=e.spaceZone,f=d===void 0?!1:d,p=e.format,g=p===void 0?"extended":p,v=g==="basic"?"HHmm":"HH:mm";(!r||n.second!==0||n.millisecond!==0)&&(v+=g==="basic"?"ss":":ss",(!o||n.millisecond!==0)&&(v+=".SSS")),(u||s)&&f&&(v+=" "),u?v+="z":s&&(v+=g==="basic"?"ZZZ":"ZZ");var w=Ye(n,v);return c&&(w="T"+w),w}var ao={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},tl={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},rl={ordinal:1,hour:0,minute:0,second:0,millisecond:0},uo=["year","month","day","hour","minute","second","millisecond"],nl=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],il=["year","ordinal","hour","minute","second","millisecond"];function bi(n){var e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Si(n);return e}function Ci(n,e){for(var t=Ae(uo),r;!(r=t()).done;){var i=r.value;A(n[i])&&(n[i]=ao[i])}var o=io(n)||oo(n);if(o)return M.invalid(o);var s=x.now(),a=e.offset(s),c=Xt(n,a,e),l=c[0],u=c[1];return new M({ts:l,zone:e,o:u})}function Di(n,e,t){var r=A(t.round)?!0:t.round,i=function(d,f){d=fn(d,r||t.calendary?0:2,!0);var p=e.loc.clone(t).relFormatter(t);return p.format(d,f)},o=function(d){return t.calendary?e.hasSame(n,d)?0:e.startOf(d).diff(n.startOf(d),d).get(d):e.diff(n,d).get(d)};if(t.unit)return i(o(t.unit),t.unit);for(var s=Ae(t.units),a;!(a=s()).done;){var c=a.value,l=o(c);if(Math.abs(l)>=1)return i(l,c)}return i(n>e?-0:0,t.units[t.units.length-1])}var M=(function(){function n(t){var r=t.zone||x.defaultZone,i=t.invalid||(Number.isNaN(t.ts)?new ie("invalid input"):null)||(r.isValid?null:Kt(r));this.ts=A(t.ts)?x.now():t.ts;var o=null,s=null;if(!i){var a=t.old&&t.old.ts===this.ts&&t.old.zone.equals(r);if(a){var c=[t.old.c,t.old.o];o=c[0],s=c[1]}else{var l=r.offset(this.ts);o=Ei(this.ts,l),i=Number.isNaN(o.year)?new ie("invalid input"):null,o=i?null:o,s=i?null:l}}this._zone=r,this.loc=t.loc||B.create(),this.invalid=i,this.weekData=null,this.c=o,this.o=s,this.isLuxonDateTime=!0}n.now=function(){return new n({})},n.local=function(r,i,o,s,a,c,l){return A(r)?n.now():Ci({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},x.defaultZone)},n.utc=function(r,i,o,s,a,c,l){return A(r)?new n({ts:x.now(),zone:$.utcInstance}):Ci({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},$.utcInstance)},n.fromJSDate=function(r,i){i===void 0&&(i={});var o=ha(r)?r.valueOf():NaN;if(Number.isNaN(o))return n.invalid("invalid input");var s=Me(i.zone,x.defaultZone);return s.isValid?new n({ts:o,zone:s,loc:B.fromObject(i)}):n.invalid(Kt(s))},n.fromMillis=function(r,i){if(i===void 0&&(i={}),Pe(r))return r<-wi||r>wi?n.invalid("Timestamp out of range"):new n({ts:r,zone:Me(i.zone,x.defaultZone),loc:B.fromObject(i)});throw new Y("fromMillis requires a numerical input, but received a "+typeof r+" with value "+r)},n.fromSeconds=function(r,i){if(i===void 0&&(i={}),Pe(r))return new n({ts:r*1e3,zone:Me(i.zone,x.defaultZone),loc:B.fromObject(i)});throw new Y("fromSeconds requires a numerical input")},n.fromObject=function(r){var i=Me(r.zone,x.defaultZone);if(!i.isValid)return n.invalid(Kt(i));var o=x.now(),s=i.offset(o),a=ir(r,bi,["zone","locale","outputCalendar","numberingSystem"]),c=!A(a.ordinal),l=!A(a.year),u=!A(a.month)||!A(a.day),d=l||u,f=a.weekYear||a.weekNumber,p=B.fromObject(r);if((d||c)&&f)throw new xt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new xt("Can't mix ordinal dates with month/day");var g=f||a.weekday&&!d,v,w,y=Ei(o,s);g?(v=nl,w=tl,y=jr(y)):c?(v=il,w=rl,y=Fr(y)):(v=uo,w=ao);for(var S=!1,ae=Ae(v),D;!(D=ae()).done;){var L=D.value,Ir=a[L];A(Ir)?S?a[L]=w[L]:a[L]=y[L]:S=!0}var $s=g?Xu(a):c?el(a):io(a),_n=$s||oo(a);if(_n)return n.invalid(_n);var js=g?yi(a):c?vi(a):a,Rn=Xt(js,s,i),zs=Rn[0],qs=Rn[1],kr=new n({ts:zs,zone:i,o:qs,loc:p});return a.weekday&&d&&r.weekday!==kr.weekday?n.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+kr.toISO()):kr},n.fromISO=function(r,i){i===void 0&&(i={});var o=yu(r),s=o[0],a=o[1];return kt(s,a,i,"ISO 8601",r)},n.fromRFC2822=function(r,i){i===void 0&&(i={});var o=vu(r),s=o[0],a=o[1];return kt(s,a,i,"RFC 2822",r)},n.fromHTTP=function(r,i){i===void 0&&(i={});var o=wu(r),s=o[0],a=o[1];return kt(s,a,i,"HTTP",i)},n.fromFormat=function(r,i,o){if(o===void 0&&(o={}),A(r)||A(i))throw new Y("fromFormat requires an input string and a format");var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0}),f=Qu(d,r,i),p=f[0],g=f[1],v=f[2];return v?n.invalid(v):kt(p,g,o,"format "+i,r)},n.fromString=function(r,i,o){return o===void 0&&(o={}),n.fromFormat(r,i,o)},n.fromSQL=function(r,i){i===void 0&&(i={});var o=Iu(r),s=o[0],a=o[1];return kt(s,a,i,"SQL",r)},n.invalid=function(r,i){if(i===void 0&&(i=null),!r)throw new Y("need to specify a reason the DateTime is invalid");var o=r instanceof ie?r:new ie(r,i);if(x.throwOnInvalid)throw new la(o);return new n({invalid:o})},n.isDateTime=function(r){return r&&r.isLuxonDateTime||!1};var e=n.prototype;return e.get=function(r){return this[r]},e.resolvedLocaleOpts=function(r){r===void 0&&(r={});var i=le.create(this.loc.clone(r),r).resolvedOptions(this),o=i.locale,s=i.numberingSystem,a=i.calendar;return{locale:o,numberingSystem:s,outputCalendar:a}},e.toUTC=function(r,i){return r===void 0&&(r=0),i===void 0&&(i={}),this.setZone($.instance(r),i)},e.toLocal=function(){return this.setZone(x.defaultZone)},e.setZone=function(r,i){var o=i===void 0?{}:i,s=o.keepLocalTime,a=s===void 0?!1:s,c=o.keepCalendarTime,l=c===void 0?!1:c;if(r=Me(r,x.defaultZone),r.equals(this.zone))return this;if(r.isValid){var u=this.ts;if(a||l){var d=r.offset(this.ts),f=this.toObject(),p=Xt(f,d,r);u=p[0]}return It(this,{ts:u,zone:r})}else return n.invalid(Kt(r))},e.reconfigure=function(r){var i=r===void 0?{}:r,o=i.locale,s=i.numberingSystem,a=i.outputCalendar,c=this.loc.clone({locale:o,numberingSystem:s,outputCalendar:a});return It(this,{loc:c})},e.setLocale=function(r){return this.reconfigure({locale:r})},e.set=function(r){if(!this.isValid)return this;var i=ir(r,bi,[]),o=!A(i.weekYear)||!A(i.weekNumber)||!A(i.weekday),s=!A(i.ordinal),a=!A(i.year),c=!A(i.month)||!A(i.day),l=a||c,u=i.weekYear||i.weekNumber;if((l||s)&&u)throw new xt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new xt("Can't mix ordinal dates with month/day");var d;o?d=yi(Object.assign(jr(this.c),i)):A(i.ordinal)?(d=Object.assign(this.toObject(),i),A(i.day)&&(d.day=Math.min(rr(d.year,d.month),d.day))):d=vi(Object.assign(Fr(this.c),i));var f=Xt(d,this.o,this.zone),p=f[0],g=f[1];return It(this,{ts:p,o:g})},e.plus=function(r){if(!this.isValid)return this;var i=Fe(r);return It(this,Ti(this,i))},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r).negate();return It(this,Ti(this,i))},e.startOf=function(r){if(!this.isValid)return this;var i={},o=H.normalizeUnit(r);switch(o){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(o==="weeks"&&(i.weekday=1),o==="quarters"){var s=Math.ceil(this.month/3);i.month=(s-1)*3+1}return this.set(i)},e.endOf=function(r){var i;return this.isValid?this.plus((i={},i[r]=1,i)).startOf(r).minus(1):this},e.toFormat=function(r,i){return i===void 0&&(i={}),this.isValid?le.create(this.loc.redefaultToEN(i)).formatDateTimeFromString(this,r):Pr},e.toLocaleString=function(r){return r===void 0&&(r=tr),this.isValid?le.create(this.loc.clone(r),r).formatDateTime(this):Pr},e.toLocaleParts=function(r){return r===void 0&&(r={}),this.isValid?le.create(this.loc.clone(r),r).formatDateTimeParts(this):[]},e.toISO=function(r){return r===void 0&&(r={}),this.isValid?this.toISODate(r)+"T"+this.toISOTime(r):null},e.toISODate=function(r){var i=r===void 0?{}:r,o=i.format,s=o===void 0?"extended":o,a=s==="basic"?"yyyyMMdd":"yyyy-MM-dd";return this.year>9999&&(a="+"+a),Ye(this,a)},e.toISOWeekDate=function(){return Ye(this,"kkkk-'W'WW-c")},e.toISOTime=function(r){var i=r===void 0?{}:r,o=i.suppressMilliseconds,s=o===void 0?!1:o,a=i.suppressSeconds,c=a===void 0?!1:a,l=i.includeOffset,u=l===void 0?!0:l,d=i.includePrefix,f=d===void 0?!1:d,p=i.format,g=p===void 0?"extended":p;return Ai(this,{suppressSeconds:c,suppressMilliseconds:s,includeOffset:u,includePrefix:f,format:g})},e.toRFC2822=function(){return Ye(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)},e.toHTTP=function(){return Ye(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")},e.toSQLDate=function(){return Ye(this,"yyyy-MM-dd")},e.toSQLTime=function(r){var i=r===void 0?{}:r,o=i.includeOffset,s=o===void 0?!0:o,a=i.includeZone,c=a===void 0?!1:a;return Ai(this,{includeOffset:s,includeZone:c,spaceZone:!0})},e.toSQL=function(r){return r===void 0&&(r={}),this.isValid?this.toSQLDate()+" "+this.toSQLTime(r):null},e.toString=function(){return this.isValid?this.toISO():Pr},e.valueOf=function(){return this.toMillis()},e.toMillis=function(){return this.isValid?this.ts:NaN},e.toSeconds=function(){return this.isValid?this.ts/1e3:NaN},e.toJSON=function(){return this.toISO()},e.toBSON=function(){return this.toJSDate()},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var i=Object.assign({},this.c);return r.includeConfig&&(i.outputCalendar=this.outputCalendar,i.numberingSystem=this.loc.numberingSystem,i.locale=this.loc.locale),i},e.toJSDate=function(){return new Date(this.isValid?this.ts:NaN)},e.diff=function(r,i,o){if(i===void 0&&(i="milliseconds"),o===void 0&&(o={}),!this.isValid||!r.isValid)return H.invalid(this.invalid||r.invalid,"created by diffing an invalid DateTime");var s=Object.assign({locale:this.locale,numberingSystem:this.numberingSystem},o),a=pa(i).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=_u(l,u,a,s);return c?d.negate():d},e.diffNow=function(r,i){return r===void 0&&(r="milliseconds"),i===void 0&&(i={}),this.diff(n.now(),r,i)},e.until=function(r){return this.isValid?Ft.fromDateTimes(this,r):this},e.hasSame=function(r,i){if(!this.isValid)return!1;var o=r.valueOf(),s=this.setZone(r.zone,{keepLocalTime:!0});return s.startOf(i)<=o&&o<=s.endOf(i)},e.equals=function(r){return this.isValid&&r.isValid&&this.valueOf()===r.valueOf()&&this.zone.equals(r.zone)&&this.loc.equals(r.loc)},e.toRelative=function(r){if(r===void 0&&(r={}),!this.isValid)return null;var i=r.base||n.fromObject({zone:this.zone}),o=r.padding?this<i?-r.padding:r.padding:0,s=["years","months","days","hours","minutes","seconds"],a=r.unit;return Array.isArray(r.unit)&&(s=r.unit,a=void 0),Di(i,this.plus(o),Object.assign(r,{numeric:"always",units:s,unit:a}))},e.toRelativeCalendar=function(r){return r===void 0&&(r={}),this.isValid?Di(r.base||n.fromObject({zone:this.zone}),this,Object.assign(r,{numeric:"auto",units:["years","months","days"],calendary:!0})):null},n.min=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new Y("min requires all arguments be DateTimes");return ii(i,function(s){return s.valueOf()},Math.min)},n.max=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];if(!i.every(n.isDateTime))throw new Y("max requires all arguments be DateTimes");return ii(i,function(s){return s.valueOf()},Math.max)},n.fromFormatExplain=function(r,i,o){o===void 0&&(o={});var s=o,a=s.locale,c=a===void 0?null:a,l=s.numberingSystem,u=l===void 0?null:l,d=B.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0});return Qi(d,r,i)},n.fromStringExplain=function(r,i,o){return o===void 0&&(o={}),n.fromFormatExplain(r,i,o)},oe(n,[{key:"isValid",get:function(){return this.invalid===null}},{key:"invalidReason",get:function(){return this.invalid?this.invalid.reason:null}},{key:"invalidExplanation",get:function(){return this.invalid?this.invalid.explanation:null}},{key:"locale",get:function(){return this.isValid?this.loc.locale:null}},{key:"numberingSystem",get:function(){return this.isValid?this.loc.numberingSystem:null}},{key:"outputCalendar",get:function(){return this.isValid?this.loc.outputCalendar:null}},{key:"zone",get:function(){return this._zone}},{key:"zoneName",get:function(){return this.isValid?this.zone.name:null}},{key:"year",get:function(){return this.isValid?this.c.year:NaN}},{key:"quarter",get:function(){return this.isValid?Math.ceil(this.c.month/3):NaN}},{key:"month",get:function(){return this.isValid?this.c.month:NaN}},{key:"day",get:function(){return this.isValid?this.c.day:NaN}},{key:"hour",get:function(){return this.isValid?this.c.hour:NaN}},{key:"minute",get:function(){return this.isValid?this.c.minute:NaN}},{key:"second",get:function(){return this.isValid?this.c.second:NaN}},{key:"millisecond",get:function(){return this.isValid?this.c.millisecond:NaN}},{key:"weekYear",get:function(){return this.isValid?Br(this).weekYear:NaN}},{key:"weekNumber",get:function(){return this.isValid?Br(this).weekNumber:NaN}},{key:"weekday",get:function(){return this.isValid?Br(this).weekday:NaN}},{key:"ordinal",get:function(){return this.isValid?Fr(this.c).ordinal:NaN}},{key:"monthShort",get:function(){return this.isValid?Nt.months("short",{locObj:this.loc})[this.month-1]:null}},{key:"monthLong",get:function(){return this.isValid?Nt.months("long",{locObj:this.loc})[this.month-1]:null}},{key:"weekdayShort",get:function(){return this.isValid?Nt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}},{key:"weekdayLong",get:function(){return this.isValid?Nt.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}},{key:"offset",get:function(){return this.isValid?+this.o:NaN}},{key:"offsetNameShort",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}},{key:"offsetNameLong",get:function(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}},{key:"isOffsetFixed",get:function(){return this.isValid?this.zone.universal:null}},{key:"isInDST",get:function(){return this.isOffsetFixed?!1:this.offset>this.set({month:1}).offset||this.offset>this.set({month:5}).offset}},{key:"isInLeapYear",get:function(){return Bt(this.year)}},{key:"daysInMonth",get:function(){return rr(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?Mt(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?nr(this.weekYear):NaN}}],[{key:"DATE_SHORT",get:function(){return tr}},{key:"DATE_MED",get:function(){return zr}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return Ii}},{key:"DATE_FULL",get:function(){return qr}},{key:"DATE_HUGE",get:function(){return Zr}},{key:"TIME_SIMPLE",get:function(){return Wr}},{key:"TIME_WITH_SECONDS",get:function(){return Yr}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return Kr}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return Jr}},{key:"TIME_24_SIMPLE",get:function(){return Qr}},{key:"TIME_24_WITH_SECONDS",get:function(){return Xr}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return en}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return tn}},{key:"DATETIME_SHORT",get:function(){return rn}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return nn}},{key:"DATETIME_MED",get:function(){return on}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return sn}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return ki}},{key:"DATETIME_FULL",get:function(){return an}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return un}},{key:"DATETIME_HUGE",get:function(){return ln}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return cn}}]),n})();function Ot(n){if(M.isDateTime(n))return n;if(n&&n.valueOf&&Pe(n.valueOf()))return M.fromJSDate(n);if(n&&typeof n=="object")return M.fromObject(n);throw new Y("Unknown datetime argument: "+n+", of type "+typeof n)}var ol="1.28.1";z.DateTime=M;z.Duration=H;z.FixedOffsetZone=$;z.IANAZone=ce;z.Info=Nt;z.Interval=Ft;z.InvalidZone=Ur;z.LocalZone=Vi;z.Settings=x;z.VERSION=ol;z.Zone=Xe});var Dl={};Xs(Dl,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>ut,Agent:()=>lt,Amount:()=>E,App:()=>we,Backlog:()=>Tt,Balance:()=>ke,BalanceType:()=>be,BalancesDataTableBuilder:()=>pe,BalancesReport:()=>wt,Billing:()=>ht,Bkper:()=>k,BkperError:()=>ue,Book:()=>X,BooksDataTableBuilder:()=>Sr,BotResponse:()=>ft,BotResponseType:()=>ot,Collaborator:()=>ct,Collection:()=>Se,Connection:()=>je,DecimalSeparator:()=>He,Event:()=>pt,EventList:()=>mt,EventType:()=>hr,File:()=>he,FileList:()=>gt,Group:()=>Q,GroupsDataTableBuilder:()=>At,Integration:()=>ee,MenuOpenMode:()=>it,Month:()=>fr,Period:()=>dr,Periodicity:()=>Lt,Permission:()=>nt,Query:()=>Et,Template:()=>Ct,Transaction:()=>Z,TransactionList:()=>yt,TransactionStatus:()=>ge,TransactionsDataTableBuilder:()=>bt,User:()=>Ie,Visibility:()=>cr});var ue=class extends Error{constructor(e,t,r){super(t),this.name="BkperError",this.code=e,this.reason=r}};var ra=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},qe=class{constructor(e){this.params=[],this.headers={},this.method="GET",this.payload=null,this.url=e}setMethod(e){return this.method=e,this}setHeader(e,t){return this.headers[e]=t,this}addParam(e,t){return this.params.push({name:e,value:t}),this}setPayload(e){return this.payload=e,this}getUrl(){let e=this.url;if(this.params!=null){let i=0;e.indexOf("?")<0?e+="?":i++;for(let o of this.params){i>0&&(e+="&");var t=o.name,r=o.value;r!=null&&(e+=t+"="+encodeURIComponent(r),i++)}}return e}execute(){return ra(this,void 0,void 0,function*(){let e=this.getUrl(),t={method:this.method,headers:this.headers};this.payload&&this.method!=="GET"&&(typeof this.payload=="string"?t.body=this.payload:(t.body=JSON.stringify(this.payload),!this.headers["Content-Type"]&&!this.headers["content-type"]&&(t.headers=Object.assign(Object.assign({},this.headers),{"Content-Type":"application/json"}))));let r=yield fetch(e,t),i,o=r.headers.get("content-type");return o&&o.includes("application/json")?i=yield r.json():i=yield r.text(),{data:i,status:r.status,headers:r.headers}})}};var Dt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},na="https://api.bkper.app";function ia(n){return n.apiBaseUrl?n.apiBaseUrl:na}var te=class extends qe{constructor(e,t){let r=ia(t);super(`${r}/${e}`),this.retry=0,this.config=t,this.requestPath=e}fetch(){let e=Object.create(null,{execute:{get:()=>super.execute}});return Dt(this,void 0,void 0,function*(){this.addCustomHeaders(),yield this.addAgentIdHeader();let t=yield this.getAccessToken();t&&this.setHeader("Authorization",`Bearer ${t}`),yield this.addApiKeyHeader();try{let r=yield e.execute.call(this);if(r.status>=200&&r.status<300)return r;if(r.status==404){let i={response:{status:r.status,data:r.data}};throw this.handleError(i)}else if(this.shouldRetry(r.status)&&this.retry<3){this.retry++;let i=this.config;return i.requestRetryHandler?yield i.requestRetryHandler(r.status,r.data,this.retry):console.log(`${JSON.stringify(r.data)} - Retrying ${this.retry}/3... `),yield this.fetch()}else{let i={response:{status:r.status,data:r.data}};throw this.handleError(i)}}catch(r){if(r instanceof ue||r.response)throw r;if(this.isNetworkError(r)&&this.retry<3){this.retry++;let i=this.config;return i.requestRetryHandler?yield i.requestRetryHandler(520,r,this.retry):console.log(`${this.formatNetworkErrorMessage(r)} - Retrying ${this.retry}/3... `),yield this.fetch()}throw this.handleError(r)}})}shouldRetry(e){return e==401||e==403||e==408||e==429||e!=null&&e>=500}isNetworkError(e){return e instanceof TypeError&&e.message.toLowerCase().includes("fetch")}formatNetworkErrorMessage(e){var t,r,i,o,s;let a=[];return!((t=e.cause)===null||t===void 0)&&t.code&&a.push(e.cause.code),!((r=e.cause)===null||r===void 0)&&r.hostname?a.push(e.cause.hostname):!((i=e.cause)===null||i===void 0)&&i.address&&a.push(e.cause.address),((o=e.cause)===null||o===void 0?void 0:o.port)!==void 0&&a.push(`port=${e.cause.port}`),!((s=e.cause)===null||s===void 0)&&s.syscall&&a.push(`syscall=${e.cause.syscall}`),a.length>0?`Network error calling ${this.requestPath}: ${e.message} (${a.join(", ")})`:`Network error calling ${this.requestPath}: ${e.message}`}handleError(e){var t,r,i,o,s,a,c,l,u;let d=this.config,f=d.requestErrorHandler?d.requestErrorHandler(e):void 0;if(f)return f;if(e instanceof ue)return e;if(this.isNetworkError(e))return new ue(((t=e.response)===null||t===void 0?void 0:t.status)||((r=e.response)===null||r===void 0?void 0:r.code)||e.status||e.code||0,this.formatNetworkErrorMessage(e),void 0);{let p=((o=(i=e.response)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.error)||((s=e.data)===null||s===void 0?void 0:s.error)||e.error;return p?new ue(p.code,p.message,(c=(a=p.errors)===null||a===void 0?void 0:a[0])===null||c===void 0?void 0:c.reason):new ue(((l=e.response)===null||l===void 0?void 0:l.status)||((u=e.response)===null||u===void 0?void 0:u.code)||e.status||e.code||0,e.message||String(e),void 0)}}addCustomHeaders(){return Dt(this,void 0,void 0,function*(){let e=this.config;if(e.requestHeadersProvider){let t=yield e.requestHeadersProvider();Object.entries(t).forEach(([r,i])=>this.setHeader(r,i))}})}addAgentIdHeader(){return Dt(this,void 0,void 0,function*(){let e=this.config;if(e.agentIdProvider){let t=yield e.agentIdProvider();t&&this.setHeader("bkper-agent-id",t)}})}addApiKeyHeader(){return Dt(this,void 0,void 0,function*(){let e=this.config;if(e.apiKeyProvider){let t=yield e.apiKeyProvider();t&&this.setHeader("bkper-api-key",t)}})}getAccessToken(){return Dt(this,void 0,void 0,function*(){let e,t=this.config;return t.oauthTokenProvider&&(e=yield t.oauthTokenProvider()),e&&(e=e.replace("Bearer ",""),e=e.replace("bearer ","")),e})}},m=class extends te{constructor(e,t){super(`v5/books/${e}`,t)}},O=class extends te{constructor(e,t){super(`v5/${e}`,t)}};var Ee=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Un(n,e,t){return Ee(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Gn(n,e,t){return Ee(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Vn(n,e,t){return Ee(this,void 0,void 0,function*(){var r=e,i=yield new m(`${n}/accounts`,t).setMethod("PUT").setPayload(r).fetch();return i.data})}function Hn(n,e,t){return Ee(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/batch`,t).setMethod("PUT").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function $n(n,e,t){return Ee(this,void 0,void 0,function*(){var r=yield new m(`${n}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function jn(n,e,t){return Ee(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/accounts/delete/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function zn(n,e,t){return Ee(this,void 0,void 0,function*(){return(yield new m(`${n}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function qn(n,e){return Ee(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/accounts`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var Oe=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Wn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Yn(n,e,t){return Oe(this,void 0,void 0,function*(){var r;return((r=(yield new m(`${n}/groups/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Kn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Jn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Qn(n,e){return Oe(this,void 0,void 0,function*(){var t=yield new m(`${n}/groups`,e).setMethod("GET").fetch(),r=t.data;return r!=null&&r.items?r.items:[]})}function Xn(n,e,t){return Oe(this,void 0,void 0,function*(){var r=yield new m(`${n}/groups/${encodeURIComponent(e)}`,t).setMethod("GET").fetch();return r.data})}function ei(n,e,t){return Oe(this,void 0,void 0,function*(){if(!e)return[];var r=yield new m(`${n}/groups/${encodeURIComponent(e)}/accounts`,t).setMethod("GET").fetch(),i=r.data;return i!=null&&i.items?i.items:[]})}var Ut=ea(lo(),1);var sl=20,al=1,Le=1e6,co=1e6,ul=-7,ll=21,cl=!1,_t="[big.js] ",Ue=_t+"Invalid ",lr=Ue+"decimal places",dl=Ue+"rounding mode",fo=_t+"Division by zero",C={},fe=void 0,fl=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function ho(){function n(e){var t=this;if(!(t instanceof n))return e===fe?ho():new n(e);if(e instanceof n)t.s=e.s,t.e=e.e,t.c=e.c.slice();else{if(typeof e!="string"){if(n.strict===!0&&typeof e!="bigint")throw TypeError(Ue+"value");e=e===0&&1/e<0?"-0":String(e)}hl(t,e)}t.constructor=n}return n.prototype=C,n.DP=sl,n.RM=al,n.NE=ul,n.PE=ll,n.strict=cl,n.roundDown=0,n.roundHalfUp=1,n.roundHalfEven=2,n.roundUp=3,n}function hl(n,e){var t,r,i;if(!fl.test(e))throw Error(Ue+"number");for(n.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(t=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(t<0&&(t=r),t+=+e.slice(r+1),e=e.substring(0,r)):t<0&&(t=e.length),i=e.length,r=0;r<i&&e.charAt(r)=="0";)++r;if(r==i)n.c=[n.e=0];else{for(;i>0&&e.charAt(--i)=="0";);for(n.e=t-r-1,n.c=[],t=0;r<=i;)n.c[t++]=+e.charAt(r++)}return n}function Ge(n,e,t,r){var i=n.c;if(t===fe&&(t=n.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(dl);if(e<1)r=t===3&&(r||!!i[0])||e===0&&(t===1&&i[0]>=5||t===2&&(i[0]>5||i[0]===5&&(r||i[1]!==fe))),i.length=1,r?(n.e=n.e-e+1,i[0]=1):i[0]=n.e=0;else if(e<i.length){if(r=t===1&&i[e]>=5||t===2&&(i[e]>5||i[e]===5&&(r||i[e+1]!==fe||i[e-1]&1))||t===3&&(r||!!i[0]),i.length=e,r){for(;++i[--e]>9;)if(i[e]=0,e===0){++n.e,i.unshift(1);break}}for(e=i.length;!i[--e];)i.pop()}return n}function Ve(n,e,t){var r=n.e,i=n.c.join(""),o=i.length;if(e)i=i.charAt(0)+(o>1?"."+i.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)i="0"+i;i="0."+i}else if(r>0)if(++r>o)for(r-=o;r--;)i+="0";else r<o&&(i=i.slice(0,r)+"."+i.slice(r));else o>1&&(i=i.charAt(0)+"."+i.slice(1));return n.s<0&&t?"-"+i:i}C.abs=function(){var n=new this.constructor(this);return n.s=1,n};C.cmp=function(n){var e,t=this,r=t.c,i=(n=new t.constructor(n)).c,o=t.s,s=n.s,a=t.e,c=n.e;if(!r[0]||!i[0])return r[0]?o:i[0]?-s:0;if(o!=s)return o;if(e=o<0,a!=c)return a>c^e?1:-1;for(s=(a=r.length)<(c=i.length)?a:c,o=-1;++o<s;)if(r[o]!=i[o])return r[o]>i[o]^e?1:-1;return a==c?0:a>c^e?1:-1};C.div=function(n){var e=this,t=e.constructor,r=e.c,i=(n=new t(n)).c,o=e.s==n.s?1:-1,s=t.DP;if(s!==~~s||s<0||s>Le)throw Error(lr);if(!i[0])throw Error(fo);if(!r[0])return n.s=o,n.c=[n.e=0],n;var a,c,l,u,d,f=i.slice(),p=a=i.length,g=r.length,v=r.slice(0,a),w=v.length,y=n,S=y.c=[],ae=0,D=s+(y.e=e.e-n.e)+1;for(y.s=o,o=D<0?0:D,f.unshift(0);w++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(w=v.length))u=a>w?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=v[d]){u=i[d]>v[d]?1:-1;break}if(u<0){for(c=w==a?i:f;w;){if(v[--w]<c[w]){for(d=w;d&&!v[--d];)v[d]=9;--v[d],v[w]+=10}v[w]-=c[w]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[w]=r[p]||0:v=[r[p]]}while((p++<g||v[0]!==fe)&&o--);return!S[0]&&ae!=1&&(S.shift(),y.e--,D--),ae>D&&Ge(y,D,t.RM,v[0]!==fe),y};C.eq=function(n){return this.cmp(n)===0};C.gt=function(n){return this.cmp(n)>0};C.gte=function(n){return this.cmp(n)>-1};C.lt=function(n){return this.cmp(n)<0};C.lte=function(n){return this.cmp(n)<1};C.minus=C.sub=function(n){var e,t,r,i,o=this,s=o.constructor,a=o.s,c=(n=new s(n)).s;if(a!=c)return n.s=-c,o.plus(n);var l=o.c.slice(),u=o.e,d=n.c,f=n.e;if(!l[0]||!d[0])return d[0]?n.s=-c:l[0]?n=new s(o):n.s=1,n;if(a=u-f){for((i=a<0)?(a=-a,r=l):(f=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(t=((i=l.length<d.length)?l:d).length,a=c=0;c<t;c++)if(l[c]!=d[c]){i=l[c]<d[c];break}if(i&&(r=l,l=d,d=r,n.s=-n.s),(c=(t=d.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;t>a;){if(l[--t]<d[t]){for(e=t;e&&!l[--e];)l[e]=9;--l[e],l[t]+=10}l[t]-=d[t]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--f;return l[0]||(n.s=1,l=[f=0]),n.c=l,n.e=f,n};C.mod=function(n){var e,t=this,r=t.constructor,i=t.s,o=(n=new r(n)).s;if(!n.c[0])throw Error(fo);return t.s=n.s=1,e=n.cmp(t)==1,t.s=i,n.s=o,e?new r(t):(i=r.DP,o=r.RM,r.DP=r.RM=0,t=t.div(n),r.DP=i,r.RM=o,this.minus(t.times(n)))};C.neg=function(){var n=new this.constructor(this);return n.s=-n.s,n};C.plus=C.add=function(n){var e,t,r,i=this,o=i.constructor;if(n=new o(n),i.s!=n.s)return n.s=-n.s,i.minus(n);var s=i.e,a=i.c,c=n.e,l=n.c;if(!a[0]||!l[0])return l[0]||(a[0]?n=new o(i):n.s=i.s),n;if(a=a.slice(),e=s-c){for(e>0?(c=s,r=l):(e=-e,r=a),r.reverse();e--;)r.push(0);r.reverse()}for(a.length-l.length<0&&(r=l,l=a,a=r),e=l.length,t=0;e;a[e]%=10)t=(a[--e]=a[e]+l[e]+t)/10|0;for(t&&(a.unshift(t),++c),e=a.length;a[--e]===0;)a.pop();return n.c=a,n.e=c,n};C.pow=function(n){var e=this,t=new e.constructor("1"),r=t,i=n<0;if(n!==~~n||n<-co||n>co)throw Error(Ue+"exponent");for(i&&(n=-n);n&1&&(r=r.times(e)),n>>=1,!!n;)e=e.times(e);return i?t.div(r):r};C.prec=function(n,e){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");return Ge(new this.constructor(this),n,e)};C.round=function(n,e){if(n===fe)n=0;else if(n!==~~n||n<-Le||n>Le)throw Error(lr);return Ge(new this.constructor(this),n+this.e+1,e)};C.sqrt=function(){var n,e,t,r=this,i=r.constructor,o=r.s,s=r.e,a=new i("0.5");if(!r.c[0])return new i(r);if(o<0)throw Error(_t+"No square root");o=Math.sqrt(+Ve(r,!0,!0)),o===0||o===1/0?(e=r.c.join(""),e.length+s&1||(e+="0"),o=Math.sqrt(e),s=((s+1)/2|0)-(s<0||s&1),n=new i((o==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):n=new i(o+""),s=n.e+(i.DP+=4);do t=n,n=a.times(t.plus(r.div(t)));while(t.c.slice(0,s).join("")!==n.c.slice(0,s).join(""));return Ge(n,(i.DP-=4)+n.e+1,i.RM)};C.times=C.mul=function(n){var e,t=this,r=t.constructor,i=t.c,o=(n=new r(n)).c,s=i.length,a=o.length,c=t.e,l=n.e;if(n.s=t.s==n.s?1:-1,!i[0]||!o[0])return n.c=[n.e=0],n;for(n.e=c+l,s<a&&(e=i,i=o,o=e,l=s,s=a,a=l),e=new Array(l=s+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=s+c;l>c;)a=e[l]+o[c]*i[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++n.e:e.shift(),c=e.length;!e[--c];)e.pop();return n.c=e,n};C.toExponential=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(lr);for(t=Ge(new t.constructor(t),++n,e);t.c.length<n;)t.c.push(0)}return Ve(t,!0,!!r)};C.toFixed=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Le)throw Error(lr);for(t=Ge(new t.constructor(t),n+t.e+1,e),n=n+t.e+1;t.c.length<n;)t.c.push(0)}return Ve(t,!1,!!r)};C[Symbol.for("nodejs.util.inspect.custom")]=C.toJSON=C.toString=function(){var n=this,e=n.constructor;return Ve(n,n.e<=e.NE||n.e>=e.PE,!!n.c[0])};C.toNumber=function(){var n=+Ve(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(n.toString()))throw Error(_t+"Imprecise conversion");return n};C.toPrecision=function(n,e){var t=this,r=t.constructor,i=t.c[0];if(n!==fe){if(n!==~~n||n<1||n>Le)throw Error(Ue+"precision");for(t=Ge(new r(t),n,e);t.c.length<n;)t.c.push(0)}return Ve(t,n<=t.e||t.e<=r.NE||t.e>=r.PE,!!i)};C.valueOf=function(){var n=this,e=n.constructor;if(e.strict===!0)throw Error(_t+"valueOf disallowed");return Ve(n,n.e<=e.NE||n.e>=e.PE,!0)};var pl=ho(),Rt=pl;var E=class n{constructor(e){this.checkNumberNotNull(e),typeof e=="string"?this.big=new Rt(e):e instanceof n?this.big=new Rt(e.big):e.toString?this.big=new Rt(e.toString()):this.big=new Rt(+e)}abs(){let e=this.big.abs();return this.wrap(e)}cmp(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.cmp(e):e instanceof n?this.big.cmp(e.big):e.toString?this.big.cmp(e.toString()):this.big.cmp(+e)}div(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.div(e):e instanceof n?t=this.big.div(e.big):e.toString?t=this.big.div(e.toString()):t=this.big.div(+e),this.wrap(t)}eq(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.eq(e):e instanceof n?this.big.eq(e.big):e.toString?this.big.eq(e.toString()):this.big.eq(+e)}gt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gt(e):e instanceof n?this.big.gt(e.big):e.toString?this.big.gt(e.toString()):this.big.gt(+e)}gte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.gte(e):e instanceof n?this.big.gte(e.big):e.toString?this.big.gte(e.toString()):this.big.gte(+e)}lt(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lt(e):e instanceof n?this.big.lt(e.big):e.toString?this.big.lt(e.toString()):this.big.lt(+e)}lte(e){return this.checkNumberNotNull(e),typeof e=="string"?this.big.lte(e):e instanceof n?this.big.lte(e.big):e.toString?this.big.lte(e.toString()):this.big.lte(+e)}plus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.plus(e):e instanceof n?t=this.big.plus(e.big):e.toString?t=this.big.plus(e.toString()):t=this.big.plus(+e),this.wrap(t)}minus(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.minus(e):e instanceof n?t=this.big.minus(e.big):e.toString?t=this.big.minus(e.toString()):t=this.big.minus(+e),this.wrap(t)}mod(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.mod(e):e instanceof n?t=this.big.mod(e.big):e.toString?t=this.big.mod(e.toString()):t=this.big.mod(+e),this.wrap(t)}round(e){let t=this.big.round(e);return this.wrap(t)}times(e){this.checkNumberNotNull(e);let t;return typeof e=="string"?t=this.big.times(e):e instanceof n?t=this.big.times(e.big):e.toString?t=this.big.times(e.toString()):t=this.big.times(+e),this.wrap(t)}toFixed(e){return this.big.toFixed(e)}toString(){return this.big.toString()}toNumber(){return this.big.toNumber()}checkNumberNotNull(e){if(e==null)throw new Error("Invalid number: null")}static create(){return Object.create(this.prototype)}wrap(e){let t=n.create();return t.big=e,t}};var Lt;(function(n){n.DAILY="DAILY",n.MONTHLY="MONTHLY",n.YEARLY="YEARLY"})(Lt||(Lt={}));var He;(function(n){n.COMMA="COMMA",n.DOT="DOT"})(He||(He={}));var nt;(function(n){n.NONE="NONE",n.VIEWER="VIEWER",n.RECORDER="RECORDER",n.POSTER="POSTER",n.EDITOR="EDITOR",n.OWNER="OWNER"})(nt||(nt={}));var cr;(function(n){n.PUBLIC="PUBLIC",n.PRIVATE="PRIVATE"})(cr||(cr={}));var F;(function(n){n.ASSET="ASSET",n.LIABILITY="LIABILITY",n.INCOMING="INCOMING",n.OUTGOING="OUTGOING"})(F||(F={}));var be;(function(n){n.TOTAL="TOTAL",n.PERIOD="PERIOD",n.CUMULATIVE="CUMULATIVE"})(be||(be={}));var dr;(function(n){n.MONTH="MONTH",n.QUARTER="QUARTER",n.YEAR="YEAR"})(dr||(dr={}));var fr;(function(n){n.JANUARY="JANUARY",n.FEBRUARY="FEBRUARY",n.MARCH="MARCH",n.APRIL="APRIL",n.MAY="MAY",n.JUNE="JUNE",n.JULY="JULY",n.AUGUST="AUGUST",n.SEPTEMBER="SEPTEMBER",n.OCTOBER="OCTOBER",n.NOVEMBER="NOVEMBER",n.DECEMBER="DECEMBER"})(fr||(fr={}));var ge;(function(n){n.TRASHED="TRASHED",n.DRAFT="DRAFT",n.UNCHECKED="UNCHECKED",n.CHECKED="CHECKED"})(ge||(ge={}));var it;(function(n){n.SIDEBAR="SIDEBAR",n.EXPANDED="EXPANDED",n.NEW_TAB="NEW_TAB"})(it||(it={}));var ot;(function(n){n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR"})(ot||(ot={}));var hr;(function(n){n.FILE_CREATED="FILE_CREATED",n.FILE_UPDATED="FILE_UPDATED",n.TRANSACTION_CREATED="TRANSACTION_CREATED",n.TRANSACTION_UPDATED="TRANSACTION_UPDATED",n.TRANSACTION_DELETED="TRANSACTION_DELETED",n.TRANSACTION_POSTED="TRANSACTION_POSTED",n.TRANSACTION_CHECKED="TRANSACTION_CHECKED",n.TRANSACTION_UNCHECKED="TRANSACTION_UNCHECKED",n.TRANSACTION_RESTORED="TRANSACTION_RESTORED",n.ACCOUNT_CREATED="ACCOUNT_CREATED",n.ACCOUNT_UPDATED="ACCOUNT_UPDATED",n.ACCOUNT_DELETED="ACCOUNT_DELETED",n.QUERY_CREATED="QUERY_CREATED",n.QUERY_UPDATED="QUERY_UPDATED",n.QUERY_DELETED="QUERY_DELETED",n.GROUP_CREATED="GROUP_CREATED",n.GROUP_UPDATED="GROUP_UPDATED",n.GROUP_DELETED="GROUP_DELETED",n.COMMENT_CREATED="COMMENT_CREATED",n.COMMENT_DELETED="COMMENT_DELETED",n.COLLABORATOR_ADDED="COLLABORATOR_ADDED",n.COLLABORATOR_UPDATED="COLLABORATOR_UPDATED",n.COLLABORATOR_REMOVED="COLLABORATOR_REMOVED",n.INTEGRATION_CREATED="INTEGRATION_CREATED",n.INTEGRATION_UPDATED="INTEGRATION_UPDATED",n.INTEGRATION_DELETED="INTEGRATION_DELETED",n.BOOK_AUDITED="BOOK_AUDITED",n.BOOK_CREATED="BOOK_CREATED",n.BOOK_UPDATED="BOOK_UPDATED",n.BOOK_DELETED="BOOK_DELETED"})(hr||(hr={}));function mr(n,e){return e<=0?"":e===1?n:n+mr(n,e-1)}function mo(n){if(!n||typeof n!="string")return[];let e=/#([a-zA-Z0-9_]+)/g,t=new Set,r;for(;(r=e.exec(n))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}var pr=null;function gr(n,e){return n==null&&(n=new E("0")),e?new E(n).round(e):new E(n).round(2)}function ye(n,e,t){if(n==null)return"";if(typeof n=="string"){if(n.trim()=="")return"";n=new E(n)}if(n==null)return"";t==null&&(t=2);var r=n.toFixed(t)+"";return e==He.DOT?r.replace(/\,/g,"."):r.replace(/\./g,",")}function yr(n,e){if(n!=null){if(!isNaN(+n)&&isFinite(+n))return new E(n);e==He.DOT?n=n.replace(/\,/g,""):n=n.replace(/\./g,"").replace(/\,/g,".");try{return new E(n)}catch(t){return}}}function go(n,e){if(!n)return new Date;var t=n/1e4,r=n/100%100,i=n%100,o=wn(t,r,i,e);return o}function wn(n,e,t,r){var i=new Date(n,e-1,t);return r||(r=0),i.setTime(i.getTime()+r*60*1e3),i}function Gt(n,e,t){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!t||t=="")&&(t="UTC"),e?Ut.DateTime.fromJSDate(n,{zone:t}).toFormat(e):$e(n,t))}function $e(n,e){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!e||e=="")&&(e="UTC"),Ut.DateTime.fromJSDate(n,{zone:e}).toISODate())}function st(n){return+n.replace(/-/g,"")}function vr(n,e,t){e||(e="yyyy-MM-dd");let r=Ut.DateTime.fromFormat(n,e,{zone:t}).toJSDate();return r instanceof Date&&!isNaN(r.getTime())?r:Ut.DateTime.fromFormat(n,"yyyy-MM-dd",{zone:t}).toJSDate()}function q(n,e){return n==null?new E(0):e!=null&&!e?n.times(-1):n}function Ce(n){for(var e=0,t=0;t<n.length;t++)n[t].length>e&&(e=n[t].length);for(var t=0;t<n.length;t++)for(;n[t].length<e;)n[t].push(null);return n}function ve(n){return Vt(n,"_")}function Vt(n,e){return!n||typeof n!="string"?"":(e&&(n=n.replace(new RegExp(e,"g")," ")),n=n.replace(new RegExp("-","g")," "),n=n.replace(/ +(?= )/g,""),n=ml(n.trim().toLowerCase()),e&&(n=n.replace(new RegExp(" ","g"),e)),n)}function ml(n){for(var e=n.split(""),t="",r=0;r<e.length;r++)t+=e[r]in po()?po()[e[r]]:e[r];return t}function po(){if(pr==null){pr={};for(var n=0;n<vn.length;n++)for(var e=vn[n].letters.split(""),t=0;t<e.length;t++)pr[e[t]]=vn[n].base}return pr}var vn=[{base:"A",letters:"A\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"},{base:"AA",letters:"\uA732"},{base:"AE",letters:"\xC6\u01FC\u01E2"},{base:"AO",letters:"\uA734"},{base:"AU",letters:"\uA736"},{base:"AV",letters:"\uA738\uA73A"},{base:"AY",letters:"\uA73C"},{base:"B",letters:"B\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181"},{base:"C",letters:"C\u24B8\uFF23\u0106\u0108\u010A\u010C\xC7\u1E08\u0187\u023B\uA73E"},{base:"D",letters:"D\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779"},{base:"DZ",letters:"\u01F1\u01C4"},{base:"Dz",letters:"\u01F2\u01C5"},{base:"E",letters:"E\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E"},{base:"F",letters:"F\u24BB\uFF26\u1E1E\u0191\uA77B"},{base:"G",letters:"G\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E"},{base:"H",letters:"H\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"},{base:"I",letters:"I\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"},{base:"J",letters:"J\u24BF\uFF2A\u0134\u0248"},{base:"K",letters:"K\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"},{base:"L",letters:"L\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"},{base:"LJ",letters:"\u01C7"},{base:"Lj",letters:"\u01C8"},{base:"M",letters:"M\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C"},{base:"N",letters:"N\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4"},{base:"NJ",letters:"\u01CA"},{base:"Nj",letters:"\u01CB"},{base:"O",letters:"O\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"},{base:"OI",letters:"\u01A2"},{base:"OO",letters:"\uA74E"},{base:"OU",letters:"\u0222"},{base:"P",letters:"P\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"},{base:"Q",letters:"Q\u24C6\uFF31\uA756\uA758\u024A"},{base:"R",letters:"R\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"},{base:"S",letters:"S\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"},{base:"T",letters:"T\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"},{base:"TZ",letters:"\uA728"},{base:"U",letters:"U\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"},{base:"V",letters:"V\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"},{base:"VY",letters:"\uA760"},{base:"W",letters:"W\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"},{base:"X",letters:"X\u24CD\uFF38\u1E8A\u1E8C"},{base:"Y",letters:"Y\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"},{base:"Z",letters:"Z\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"},{base:"a",letters:"a\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250"},{base:"aa",letters:"\uA733"},{base:"ae",letters:"\xE6\u01FD\u01E3"},{base:"ao",letters:"\uA735"},{base:"au",letters:"\uA737"},{base:"av",letters:"\uA739\uA73B"},{base:"ay",letters:"\uA73D"},{base:"b",letters:"b\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253"},{base:"c",letters:"c\u24D2\uFF43\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"},{base:"d",letters:"d\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A"},{base:"dz",letters:"\u01F3\u01C6"},{base:"e",letters:"e\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD"},{base:"f",letters:"f\u24D5\uFF46\u1E1F\u0192\uA77C"},{base:"g",letters:"g\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F"},{base:"h",letters:"h\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"},{base:"hv",letters:"\u0195"},{base:"i",letters:"i\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"},{base:"j",letters:"j\u24D9\uFF4A\u0135\u01F0\u0249"},{base:"k",letters:"k\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"},{base:"l",letters:"l\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747"},{base:"lj",letters:"\u01C9"},{base:"m",letters:"m\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"},{base:"n",letters:"n\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5"},{base:"nj",letters:"\u01CC"},{base:"o",letters:"o\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\u0254\uA74B\uA74D\u0275"},{base:"oi",letters:"\u01A3"},{base:"ou",letters:"\u0223"},{base:"oo",letters:"\uA74F"},{base:"p",letters:"p\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755"},{base:"q",letters:"q\u24E0\uFF51\u024B\uA757\uA759"},{base:"r",letters:"r\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"},{base:"s",letters:"s\u24E2\uFF53\xDF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B"},{base:"t",letters:"t\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"},{base:"tz",letters:"\uA729"},{base:"u",letters:"u\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"},{base:"v",letters:"v\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"},{base:"vy",letters:"\uA761"},{base:"w",letters:"w\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"},{base:"x",letters:"x\u24E7\uFF58\u1E8B\u1E8D"},{base:"y",letters:"y\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"},{base:"z",letters:"z\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"}];var P=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}};var U=class extends P{isHiddenProperty(e){return e.endsWith("_")}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}setProperties(e){return this.payload.properties=Object.assign({},e),this}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}setProperty(e,t){return e==null||e.trim()==""?this:(this.payload.properties==null&&(this.payload.properties={}),t||(t=""),this.payload.properties[e]=t,this)}deleteProperty(e){return this.setProperty(e,null),this}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}setVisibleProperty(e,t){return this.isHiddenProperty(e)?this:this.setProperty(e,t)}setVisibleProperties(e){if(e==null)return this;let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return this.setProperties(t)}getVisibleProperties(){let e=this.getProperties(),t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.isHiddenProperty(r)||(t[r]=e[r]));return t}};var Ht=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Q=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.children=new Map,this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return Ht(this,void 0,void 0,function*(){let e=yield this.getAccounts();for(let t of e)if(!t.isBalanceVerified())return!1;return!0})}isLocked(){return this.payload.locked==null?!1:this.payload.locked}setLocked(e){return this.payload.locked=e,this}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Vt(this.getName())}getAccounts(){return Ht(this,void 0,void 0,function*(){if(this.accounts)return Array.from(this.accounts.values());let e=this.getId();if(!e)return[];let t=yield ei(this.book.getId(),e,this.getConfig());return t?t.map(i=>new G(this.book,i)):[]})}getType(){return this.payload.type}isHidden(){return this.payload.hidden}setHidden(e){return this.payload.hidden=e,this}isCredit(){return this.payload.credit}isMixed(){return this.payload.mixed}isPermanent(){return this.payload.permanent}getParent(){return this.parent}setParent(e){return e?this.payload.parent={id:e.getId(),name:e.getName(),normalizedName:e.getNormalizedName()}:this.payload.parent=void 0,this}hasParent(){return this.payload.parent!=null}getChildren(){return Array.from(this.children.values())||[]}addChild(e){let t=e.getId();t&&this.children.set(t,e)}getDescendants(){let e=new Set;return this.traverseDescendants(this,e),e}getDescendantTreeIds(){return new Set(Array.from(this.getDescendants()).map(e=>e.getId()||""))}hasChildren(){return this.getChildren().length>0}isLeaf(){return this.getChildren().length===0}isRoot(){return this.getParent()==null}getDepth(){return this.depth==null&&(this.parent?this.depth=this.parent.getDepth()+1:this.depth=0),this.depth}getRoot(){return this.root==null&&(this.parent!=null?this.root=this.parent.getRoot():this.root=this),this.root}getRootName(){let e=this.getRoot();return e!=null&&e.getName()||""}traverseDescendants(e,t){t.add(e);let r=e.getChildren();if(r.length>0)for(let i of r)this.traverseDescendants(i,t)}buildGroupTree(e){if(this.parent=void 0,this.depth=void 0,this.root=void 0,this.payload.parent){let t=e.get(this.payload.parent.id||"");t&&(this.parent=t,t.addChild(this))}}addAccount(e){let t=e==null?void 0:e.getId();t&&(this.accounts||(this.accounts=new Map),this.accounts.set(t,e))}hasAccounts(){return this.payload.hasAccounts}create(){return Ht(this,void 0,void 0,function*(){return this.payload=yield Wn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return Ht(this,void 0,void 0,function*(){return this.payload=yield Kn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return Ht(this,void 0,void 0,function*(){return this.payload=yield Jn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(!0),this})}updateGroupCache(e){this.book.setGroup(this.payload,e),this.book.clearCache()}};var at=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},G=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}isBalanceVerified(){return this.payload.balanceVerified}getNormalizedName(){return this.payload.normalizedName?this.payload.normalizedName:Vt(this.getName())}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}isArchived(){return this.payload.archived}setArchived(e){return this.payload.archived=e,this}hasTransactionPosted(){return this.payload.hasTransactionPosted}isPermanent(){return this.payload.permanent}isCredit(){return this.payload.credit}getGroups(){return at(this,void 0,void 0,function*(){if(!this.getId())return[];if(yield this.book.getGroups(),this.payload.groups!=null){let t=[];for(let r of this.payload.groups){let i=yield this.book.getGroup(r.id);i&&t.push(i)}return t}return[]})}setGroups(e){return this.payload.groups=void 0,e!=null&&e.forEach(t=>this.addGroup(t)),this}addGroup(e){return this.payload.groups||(this.payload.groups=[]),e instanceof Q?this.payload.groups.push(e.json()):this.payload.groups.push(e),this}removeGroup(e){return at(this,void 0,void 0,function*(){if(this.payload.groups!=null){let t;if(e instanceof Q?t=e:typeof e=="string"&&(t=yield this.book.getGroup(e)),t)for(let r=0;r<this.payload.groups.length;r++)this.payload.groups[r].id==t.getId()&&this.payload.groups.splice(r,1)}return this})}isInGroup(e){return at(this,void 0,void 0,function*(){if(e==null)return!1;if(e instanceof Q)return this.isInGroupObject_(e);var t=yield this.book.getGroup(e);return t==null?!1:this.isInGroupObject_(t)})}isInGroupObject_(e){if(this.payload.groups==null)return!1;for(var t=0;t<this.payload.groups.length;t++)if(this.payload.groups[t]==e.getId())return!0;return!1}create(){return at(this,void 0,void 0,function*(){return this.payload=yield Un(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}update(){return at(this,void 0,void 0,function*(){return this.payload=yield Vn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}remove(){return at(this,void 0,void 0,function*(){return this.payload=yield $n(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(!0),this})}updateAccountCache(e){this.book.setAccount(this.payload,e),this.book.clearCache()}};var yo=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ut=class{constructor(e){this.accounts=e,this.shouldIncludeArchived=!1,this.shouldAddGroups=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[]}archived(e){return this.shouldIncludeArchived=e,this}groups(e){return this.shouldAddGroups=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}getPropertyKeys(){if(this.propertyKeys.length===0){for(let e of this.accounts)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getTypeIndex(e){return e===F.ASSET?0:e===F.LIABILITY?1:e===F.INCOMING?2:3}getMaxNumberOfGroups(){return yo(this,void 0,void 0,function*(){let e=0;for(let t of this.accounts){let r=yield t.getGroups();r.length>e&&(e=r.length)}return e})}sortGroupsHierarchyPath_(e){let t=[],r=[];for(let a of e)a.getParent()!=null||a.hasChildren()?t.push(a):r.push(a);let i=new Map;for(let a of t){let l=a.getRoot().getId()||"";i.has(l)||i.set(l,[]),i.get(l).push(a)}let o=Array.from(i.entries()).sort((a,c)=>{let l=a[1][0].getRoot(),u=c[1][0].getRoot();return l.getNormalizedName().localeCompare(u.getNormalizedName())}).map(([a,c])=>c.sort((l,u)=>l.getDepth()-u.getDepth()));r.sort((a,c)=>a.getNormalizedName().localeCompare(c.getNormalizedName()));let s=[];for(let a of o)s.push(...a);return s.push(...r),s}build(){return yo(this,void 0,void 0,function*(){let e=new Array,t=this.accounts;this.shouldIncludeArchived||(t=this.accounts.filter(o=>!o.isArchived()));let r=[];if(this.shouldAddIds&&r.push("Account Id"),r.push("Name"),r.push("Type"),this.shouldAddGroups){let o=yield this.getMaxNumberOfGroups();for(let s=0;s<o;s++)r.push("Group")}t.sort((o,s)=>{let a=this.getTypeIndex(o.getType())-this.getTypeIndex(s.getType());return a===0&&(a=o.getNormalizedName().localeCompare(s.getNormalizedName())),a});let i=[];this.shouldAddProperties&&(i=this.getPropertyKeys());for(let o of t){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()),s.push(o.getType()),this.shouldAddGroups){let a=this.sortGroupsHierarchyPath_(yield o.getGroups());for(let c of a)s.push(c.getName())}if(this.shouldAddGroups&&this.shouldAddProperties){let a=r.length-s.length;for(let c=0;c<a;c++)s.push("")}if(this.shouldAddProperties){let a=o.getProperties();for(let c of i){let l=a[c];if(l){s.push(l);continue}s.push("")}}e.push(s)}return this.shouldAddProperties&&(r=r.concat(i)),e.unshift(r),Ce(e),e})}};var lt=class{constructor(e){this.payload=e||{}}json(){return Object.assign({},this.payload)}getId(){return this.payload.id}getName(){return this.payload.name}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}};var Er=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function vo(n){return Er(this,void 0,void 0,function*(){let e=yield new te("v5/apps",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}function wo(n,e){return Er(this,void 0,void 0,function*(){return(yield new te(`v5/apps/${n}`,e).setMethod("GET").fetch()).data})}function Eo(n,e){return Er(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("POST").setPayload(n).fetch();return t.data})}function To(n,e){return Er(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("PUT").setPayload(n).fetch();return t.data})}var De=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function bo(n,e){return De(this,void 0,void 0,function*(){let t=new m("",e);n&&t.addParam("query",n);let r=yield t.fetch();if(r.data==null)return[];let o=r.data.items;return o==null?[]:o})}function Co(n,e,t,r){return De(this,void 0,void 0,function*(){if(n==null)throw new Error("Book id null!");return e=e||!1,t=t||!1,(yield new m(n,r).addParam("loadAccounts",e).addParam("loadGroups",t).fetch()).data})}function Do(n,e){return De(this,void 0,void 0,function*(){return(yield new m("",e).setMethod("POST").setPayload(n).fetch()).data})}function So(n,e,t){return De(this,void 0,void 0,function*(){var r=yield new m(`${n}`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Io(n,e){return De(this,void 0,void 0,function*(){new m(`${n}/audit`,e).setMethod("PATCH").fetch()})}function ko(n,e){return De(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/apps`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Oo(n,e,t,r,i){return De(this,void 0,void 0,function*(){let o=new m(`${n}/copy`,i).setMethod("POST").addParam("name",e);return t&&(o.addParam("copyTransactions",t),r&&o.addParam("fromDate",r)),(yield o.fetch()).data})}function xo(n,e){return De(this,void 0,void 0,function*(){return(yield new m(`${n}`,e).setMethod("DELETE").fetch()).data})}var Tr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Mo(n,e){return Tr(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/queries`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Fo(n,e,t){return Tr(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Po(n,e,t){return Tr(this,void 0,void 0,function*(){return(yield new m(`${n}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function Bo(n,e,t){return Tr(this,void 0,void 0,function*(){return(yield new m(`${n}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}var gl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ro(n,e,t){return gl(this,void 0,void 0,function*(){var r;let i=yield new m(`${n}/balances`,t).addParam("query",e).addParam("time",Date.now()).fetch(),o=(r=i.data)===null||r===void 0?void 0:r.balancesUrl;if(o){let s=yield new qe(o).setMethod("GET").execute();i={data:s.data,status:s.status}}return i.data})}var Ar=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Lo(n,e,t){return Ar(this,void 0,void 0,function*(){var r=yield new m(`${n}/files`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function br(n,e,t){return Ar(this,void 0,void 0,function*(){var r=yield new m(`${n}/files/${e}`,t).setMethod("GET").fetch();return r.data})}function Uo(n,e,t,r){return Ar(this,void 0,void 0,function*(){e||(e=100);let i=new m(`${n}/files`,r);return i.addParam("limit",e),t!=null&&i.setHeader("cursor",t),(yield i.fetch()).data})}function Go(n,e,t){return Ar(this,void 0,void 0,function*(){return(yield new m(`${n}/files`,t).setMethod("PUT").setPayload(e).fetch()).data})}var Cr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Ho(n,e){return Cr(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function En(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("POST").fetch()).data})}function Tn(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function $o(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new m(`${n}/integrations/${e}`,t).setMethod("DELETE").fetch()).data})}var _=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function zo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function qo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Zo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;return r=yield(yield new m(`${n}/transactions/batch`,t).setMethod("POST").setPayload(i).fetch()).data,r!=null&&r.items!=null?r.items:[]})}function Wo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;return i=yield(yield new m(`${n}/transactions/batch`,r).setMethod("PUT").setPayload(o).addParam("updateChecked",t).fetch()).data,i!=null&&i.items!=null?i.items:[]})}function Yo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Ko(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new m(`${n}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Jo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;i=yield(yield new m(`${n}/transactions/trash/batch`,r).setMethod("PATCH").setPayload(o).addParam("trashChecked",t).fetch()).data})}function Qo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;r=yield(yield new m(`${n}/transactions/untrash/batch`,t).setMethod("PATCH").setPayload(i).fetch()).data})}function Xo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function es(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/post`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ts(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/check`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function rs(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/uncheck`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ns(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/trash`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function is(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function os(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new m(`${n}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function ss(n,e,t,r,i){return _(this,void 0,void 0,function*(){e||(e=""),t||(t=100);var o=new m(`${n}/transactions`,i);o.addParam("query",e),o.addParam("limit",t),r!=null&&o.setHeader("cursor",r);var s=yield o.fetch();return s.data})}function as(n,e,t){return _(this,void 0,void 0,function*(){let r=Object.assign({},e);return(yield new m(`${n}/transactions/merge`,t).setMethod("PATCH").setPayload(r).fetch()).data})}function us(n,e,t){return _(this,void 0,void 0,function*(){return(yield new m(`${n}/transactions/count`,t).setMethod("GET").addParam("query",e).fetch()).data})}var $t=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function cs(n,e,t,r,i,o,s,a){return $t(this,void 0,void 0,function*(){let c=new m(`${n.getId()}/events`,a);c.addParam("after",e),c.addParam("before",t),c.addParam("error",r),c.addParam("resoureId",i),c.addParam("limit",o),s!=null&&c.setHeader("cursor",s);var l=yield c.fetch();return l.data})}function ds(n,e,t,r){return $t(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("PUT").fetch()).data})}function fs(n,e,t,r){return $t(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("DELETE").fetch()).data})}function hs(n,e,t,r){return $t(this,void 0,void 0,function*(){let i=new m(`${n.getId()}/events/replay/batch`,r).setMethod("PATCH").setPayload(e);t&&i.addParam("errorsOnly",t),yield i.fetch()})}function ps(n,e){return $t(this,void 0,void 0,function*(){return(yield new m(`${n.getId()}/events/backlog`,e).setMethod("GET").fetch()).data})}var An=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function gs(n,e){return An(this,void 0,void 0,function*(){var t;let r=yield new m(`${n}/collaborators`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function bn(n,e,t,r){return An(this,void 0,void 0,function*(){let i=new m(`${n}/collaborators`,r).setMethod("POST").setPayload(e);return t&&(i=i.addParam("message",t)),(yield i.fetch()).data})}function ys(n,e,t){return An(this,void 0,void 0,function*(){return(yield new m(`${n}/collaborators/${e}`,t).setMethod("DELETE").fetch()).data})}var Cn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ct=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getEmail(){return this.payload.email}setEmail(e){return this.payload.email=e,this}getPermission(){return this.payload.permission}setPermission(e){return this.payload.permission=e,this}create(e){return Cn(this,void 0,void 0,function*(){return this.payload=yield bn(this.book.getId(),this.payload,e,this.getConfig()),this.book.clearCollaboratorCache(),this})}update(){return Cn(this,void 0,void 0,function*(){return this.payload=yield bn(this.book.getId(),this.payload,void 0,this.getConfig()),this.book.clearCollaboratorCache(),this})}remove(){return Cn(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield ys(this.book.getId(),e,this.getConfig()),this.book.clearCollaboratorCache(),this})}};var dt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function ws(n){return dt(this,void 0,void 0,function*(){var e;let t=yield new O("collections",n).fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function Es(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("POST").setPayload(n).fetch()).data})}function Ts(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("PUT").setPayload(n).fetch()).data})}function As(n,e){return dt(this,void 0,void 0,function*(){var t;let r=yield new O(`collections/${n.id}`,e).setMethod("DELETE").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function bs(n,e,t){return dt(this,void 0,void 0,function*(){var r;let i=yield new O(`collections/${n}/books/add`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}function Cs(n,e,t){return dt(this,void 0,void 0,function*(){var r;let i=yield new O(`collections/${n}/books/remove`,t).setMethod("PATCH").setPayload(e).fetch();return((r=i==null?void 0:i.data)===null||r===void 0?void 0:r.items)||[]})}var jt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Se=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getOwnerUsername(){return this.payload.ownerUsername}getPermission(){return this.payload.permission?this.payload.permission:void 0}getBooks(){let e=[];if(this.payload.books==null)return e;for(let t of this.payload.books){let r=new X(t,this.config);e.push(r)}return e}addBooks(e){return jt(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield bs(t,r,this.getConfig())).map(o=>new X(o,this.config))}return[]})}removeBooks(e){return jt(this,void 0,void 0,function*(){let t=this.getId();if(t&&e.length>0){let r={items:e.map(o=>o.json())};return(yield Cs(t,r,this.getConfig())).map(o=>new X(o,this.config))}return[]})}getUpdatedAt(){return this.payload.updatedAt}create(){return jt(this,void 0,void 0,function*(){return this.payload=yield Es(this.payload,this.getConfig()),this})}update(){return jt(this,void 0,void 0,function*(){return this.payload=yield Ts(this.payload,this.getConfig()),this})}remove(){return jt(this,void 0,void 0,function*(){return(yield As(this.payload,this.getConfig())).map(t=>new X(t,this.config))})}};var Ss=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ft=class{constructor(e,t){this.event=e,this.payload=t||{}}getType(){return this.payload.type}getAgentId(){return this.payload.agentId}getMessage(){return this.payload.message}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getEvent(){return this.event}replay(){return Ss(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield ds(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}remove(){return Ss(this,void 0,void 0,function*(){let e=this.event.getId();if(e==null)throw new Error("Event id null!");let t=this.getAgentId();if(t==null)throw new Error("Agent id null!");let r=yield fs(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}updateCache(e){var t;this.event.payload=e,this.event.clearCache();let r=(t=e==null?void 0:e.botResponses)===null||t===void 0?void 0:t.find(i=>i.agentId&&i.agentId===this.getAgentId());this.payload=r||{}}};var zt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Is(n,e){return zt(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("GET").fetch()).data})}function ks(n){return zt(this,void 0,void 0,function*(){var e;let t=yield new O("user/connections",n).setMethod("GET").fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function Os(n,e){return zt(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("POST").fetch()).data})}function xs(n,e){return zt(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("DELETE").fetch()).data})}function Ns(n,e){return zt(this,void 0,void 0,function*(){var t;let r=yield new O(`user/connections/${n}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var vl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ee=class extends U{constructor(e,t){super(e||{}),this.config=t}getConfig(){return this.config||k.globalConfig}getBookId(){return this.payload.bookId}getId(){return this.payload.id}getName(){return this.payload.name}getAddedBy(){return this.payload.addedBy}getAgentId(){return this.payload.agentId}getLogo(){return this.payload.logo}getLogoUrl(){return this.payload.logo}getLogoUrlDark(){return this.payload.logoDark}getDateAddedMs(){return this.payload.dateAddedMs}getLastUpdateMs(){return this.payload.lastUpdateMs}remove(){return vl(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield $o(e,t,this.getConfig())),this})}};var Dn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},je=class extends U{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}setAgentId(e){return this.payload.agentId=e,this}getName(){return this.payload.name}getLogo(){return this.payload.logo}getDateAddedMs(){return this.payload.dateAddedMs}getEmail(){return this.payload.email}setName(e){return this.payload.name=e,this}setUUID(e){return this.payload.uuid=e,this}getUUID(){return this.payload.uuid}getType(){return this.payload.type}setType(e){return this.payload.type=e,this}clearTokenProperties(){this.getPropertyKeys().filter(e=>e.includes("token")).forEach(e=>this.deleteProperty(e))}getIntegrations(){return Dn(this,void 0,void 0,function*(){let e=this.getId();return e?(yield Ns(e,this.getConfig())).map(i=>new ee(i,this.config)):[]})}create(){return Dn(this,void 0,void 0,function*(){return this.payload=yield Os(this.payload,this.getConfig()),this})}remove(){return Dn(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield xs(e,this.getConfig())),this})}};var qt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Fs(n){return qt(this,void 0,void 0,function*(){return(yield new O("user",n).setMethod("GET").fetch()).data})}function Ps(n){return qt(this,void 0,void 0,function*(){return(yield new O("user/billing",n).setMethod("GET").fetch()).data})}function Bs(n){return qt(this,void 0,void 0,function*(){return(yield new O("user/billing/counts",n).setMethod("GET").fetch()).data})}function _s(n,e){return qt(this,void 0,void 0,function*(){return(yield new O("user/billing/portal",e).addParam("returnUrl",n).fetch()).data})}function Rs(n,e,t,r,i){return qt(this,void 0,void 0,function*(){let o=new O("user/billing/checkout",i).addParam("plan",n);return r&&o.addParam("cycle",r),e&&o.addParam("successUrl",e),t&&o.addParam("cancelUrl",t),(yield o.fetch()).data})}var In=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ht=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}isEnabled(){return this.payload.enabled}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getPlan(){return this.payload.plan}isPlanOverdue(){return this.payload.planOverdue}getAdminEmail(){return this.payload.adminEmail}hasStartedTrial(){return this.payload.startedTrial}getDaysLeftInTrial(){return this.payload.daysLeftInTrial}getTotalTransactionsThisMonth(){return this.payload.totalTransactionsThisMonth}getTotalTransactionsThisYear(){return this.payload.totalTransactionsThisYear}getCounts(){return In(this,void 0,void 0,function*(){return yield Bs(this.getConfig())})}getPortalUrl(e){return In(this,void 0,void 0,function*(){let t=yield _s(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,i){return In(this,void 0,void 0,function*(){let o=yield Rs(e,t,r,i,this.getConfig());return o==null?void 0:o.url})}};var kn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Ie=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id}getGivenName(){return this.payload.givenName}getName(){return this.payload.name}getAvatarUrl(){return this.payload.avatarUrl}getFullName(){return this.payload.fullName}getEmail(){return this.payload.email}getHostedDomain(){return this.payload.hostedDomain}getUsername(){return this.payload.username}getBilling(){return kn(this,void 0,void 0,function*(){let e=yield Ps(this.getConfig());return new ht(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return kn(this,void 0,void 0,function*(){return(yield ks(this.getConfig())).map(t=>new je(t,this.config))})}getConnection(e){return kn(this,void 0,void 0,function*(){let t=yield Is(e,this.getConfig());return new je(t,this.config)})}};var pt=class{constructor(e,t){this.book=e,this.payload=t||{}}json(){return Object.assign({},this.payload)}getBook(){return this.book}getId(){return this.payload.id}getUser(){return this.payload.user?new Ie(this.payload.user,this.book.getConfig()):void 0}getAgent(){return this.payload.agent?new lt(this.payload.agent):void 0}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}getType(){return this.payload.type}getBotResponses(){if(this.botResponses!==void 0)return this.botResponses;let e=[];if(this.payload.botResponses)for(let t of this.payload.botResponses)e.push(new ft(this,t));return this.botResponses=e,this.botResponses}hasErrorResponse(){let e=this.getBotResponses();for(let t of e)if(t.getType()===ot.ERROR)return!0;return!1}clearCache(){this.botResponses=void 0}};var mt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.map(t=>new pt(this.book,t)))||[]}};var On=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},he=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.book=e}getBook(){return this.book}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getContentType(){return this.payload.contentType}setContentType(e){return this.payload.contentType=e,this}getContent(){return On(this,void 0,void 0,function*(){let e=this.getId();return this.getId()!=null&&(this.payload==null||this.payload.content==null)&&this.book&&e&&(this.payload=yield br(this.book.getId(),e,this.getConfig())),this.payload.content})}setContent(e){return this.payload.content=e,this}getUrl(){return this.payload.url}getSize(){return this.payload.size}create(){return On(this,void 0,void 0,function*(){return this.payload=yield Lo(this.book.getId(),this.payload,this.getConfig()),this})}update(){return On(this,void 0,void 0,function*(){return this.payload=yield Go(this.book.getId(),this.payload,this.getConfig()),this})}};var gt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;let t=[];for(let r of(e=this.payload.items)!==null&&e!==void 0?e:[])t.push(new he(this.book,r));return t}};var R=[];for(let n=0;n<256;++n)R.push((n+256).toString(16).slice(1));function Ls(n,e=0){return(R[n[e+0]]+R[n[e+1]]+R[n[e+2]]+R[n[e+3]]+"-"+R[n[e+4]]+R[n[e+5]]+"-"+R[n[e+6]]+R[n[e+7]]+"-"+R[n[e+8]]+R[n[e+9]]+"-"+R[n[e+10]]+R[n[e+11]]+R[n[e+12]]+R[n[e+13]]+R[n[e+14]]+R[n[e+15]]).toLowerCase()}var xn,wl=new Uint8Array(16);function Nn(){if(!xn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");xn=crypto.getRandomValues.bind(crypto)}return xn(wl)}var El=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mn={randomUUID:El};function Tl(n,e,t){var i,o,s;if(Mn.randomUUID&&!e&&!n)return Mn.randomUUID();n=n||{};let r=(s=(o=n.random)!=null?o:(i=n.rng)==null?void 0:i.call(n))!=null?s:Nn();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[t+a]=r[a];return e}return Ls(r)}var Fn=Tl;var N=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Z=class extends U{constructor(e,t){super(t||{createdAt:`${Date.now()}`}),this.pendingFiles=new Map,this.book=e}getConfig(){return this.book.getConfig()}getBook(){return this.book}getId(){return this.payload.id}getAgentId(){return this.payload.agentId}getAgentName(){return this.payload.agentName}getAgentLogoUrl(){return this.payload.agentLogo}getAgentLogoUrlDark(){return this.payload.agentLogoDark}getRemoteIds(){return this.payload.remoteIds||[]}addRemoteId(e){return this.payload.remoteIds==null&&(this.payload.remoteIds=[]),e&&this.payload.remoteIds.push(e),this}isPosted(){return this.payload.posted}isChecked(){return this.payload.checked}setChecked(e){return this.payload.checked=e,this}isTrashed(){return this.payload.trashed}isLocked(){let e=this.getDate()||$e(new Date,this.book.getTimeZone()),t=this.book.getMostRecentLockDate_();return t!=null&&st(t)>=st(e)}getStatus(){return this.isTrashed()?ge.TRASHED:this.isPosted()?this.isChecked()?ge.CHECKED:ge.UNCHECKED:ge.DRAFT}getTags(){if(this.payload.tags&&this.payload.tags.length>0)return this.payload.tags;let e=this.getDescription();return e&&e.includes("#")?mo(e):[]}getUrls(){return this.payload.urls||[]}setUrls(e){return this.payload.urls=void 0,e&&e.forEach(t=>{this.addUrl(t)}),this}addUrl(e){return this.payload.urls==null&&(this.payload.urls=[]),e&&this.payload.urls.push(e),this}getFiles(){return this.payload.files&&this.payload.files.length>0?this.payload.files.map(t=>new he(this.book,t)):[]}removeFile(e){let t=e.getId();return t&&(this.payload.files!=null&&(this.payload.files=this.payload.files.filter(r=>r.id!==t)),this.pendingFiles.delete(t)),this}addFile(e){var t;this.payload.files==null&&(this.payload.files=[]);let r=e.getId(),i=(t=e.getBook())===null||t===void 0?void 0:t.getId();return(r==null||i!=this.book.getId())&&(r==null&&(e.payload.id=`temporary_${Fn()}`),this.pendingFiles.set(e.getId(),e)),this.payload.files.push(e.json()),this}createPendingFiles(){return N(this,void 0,void 0,function*(){if(this.pendingFiles.size===0)return;this.payload.files==null&&(this.payload.files=[]);let e=Array.from(this.pendingFiles.entries()).map(r=>N(this,[r],void 0,function*([i,o]){o.book=this.book,o.setProperty("upload_method","attachment");let s=yield o.create();return{fileId:i,createdFile:s}})),t=yield Promise.all(e);for(let{fileId:r,createdFile:i}of t){let o=this.payload.files.findIndex(s=>s.id===r);o>=0?this.payload.files[o]=i.json():this.payload.files.push(i.json())}this.pendingFiles.clear()})}hasTag(e){for(var t=this.getTags(),r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}getCreditAccount(){return N(this,void 0,void 0,function*(){if(this.payload.creditAccount)return yield this.book.getAccount(this.payload.creditAccount.id)})}getCreditAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getCreditAccount())!=null?(e=yield this.getCreditAccount())===null||e===void 0?void 0:e.getName():""})}setCreditAccount(e){return e==null?(this.payload.creditAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.creditAccount=e.json()):e.id!=null&&(this.payload.creditAccount=e),this)}from(e){return this.setCreditAccount(e)}getDebitAccount(){return N(this,void 0,void 0,function*(){if(this.payload.debitAccount)return yield this.book.getAccount(this.payload.debitAccount.id)})}getDebitAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getDebitAccount())!=null?(e=yield this.getDebitAccount())===null||e===void 0?void 0:e.getName():""})}setDebitAccount(e){return e==null?(this.payload.debitAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.debitAccount={id:e.getId(),name:e.getName()}):e.id!=null&&(this.payload.debitAccount={id:e.id,name:e.name}),this)}to(e){return this.setDebitAccount(e)}getAmount(){return this.payload.amount!=null&&this.payload.amount.trim()!=""?new E(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=yr(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new E(e),e.eq(0)?(this.payload.amount=void 0,this):(this.payload.amount=e.abs().toString(),this))}getCreditAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return this.getAmount()})}getDebitAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isDebit(t))return this.getAmount()})}getOtherAccount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return yield this.getDebitAccount();if(yield this.isDebit(t))return yield this.getCreditAccount()})}getOtherAccountName(e){return N(this,void 0,void 0,function*(){var t=yield this.getOtherAccount(e);return t!=null?t.getName():""})}isCredit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getCreditAccount())!=null&&e!=null&&((t=yield this.getCreditAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}isDebit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getDebitAccount())!=null&&e!=null&&((t=yield this.getDebitAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}getAccount_(e){return N(this,void 0,void 0,function*(){return e==null||e instanceof G?e:yield this.book.getAccount(e)})}getDescription(){return this.payload.description==null?"":this.payload.description}setDescription(e){return this.payload.description=e,this}getDate(){return this.payload.date}setDate(e){if(typeof e=="string")if(e.indexOf("/")>0){let t=vr(e,this.book.getDatePattern(),this.book.getTimeZone());this.payload.date=$e(t,this.book.getTimeZone())}else e.indexOf("-")>=0&&(this.payload.date=e);else Object.prototype.toString.call(e)==="[object Date]"&&(this.payload.date=$e(e,this.book.getTimeZone()));return this}getDateObject(){return go(this.getDateValue(),this.book.getTimeZoneOffset())}getDateValue(){return this.payload.dateValue}getDateFormatted(){return this.payload.dateFormatted}getCreatedAt(){return new Date(new Number(this.payload.createdAt).valueOf())}getCreatedAtFormatted(){return Gt(this.getCreatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCreatedBy(){return this.payload.createdBy}getUpdatedAt(){return new Date(new Number(this.payload.updatedAt).valueOf())}getUpdatedAtFormatted(){return Gt(this.getUpdatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCaEvolvedBalance_(){return this.payload.creditAccount!=null&&this.payload.creditAccount.balance!=null?new E(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new E(this.payload.debitAccount.balance):void 0}getAccountBalance(e){return N(this,void 0,void 0,function*(){var t=this.getCaEvolvedBalance_(),r=!0;if(t==null&&(t=this.getDaEvolvedBalance_(),r=!1),t!=null){if(!e){var i=r?yield this.getCreditAccount():yield this.getDebitAccount();t=q(t,i==null?void 0:i.isCredit())}return gr(t,this.book.getFractionDigits())}else return})}create(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield zo(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}update(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield Xo(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}check(){return N(this,void 0,void 0,function*(){var e;let t=yield ts(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}uncheck(){return N(this,void 0,void 0,function*(){var e;let t=yield rs(this.book.getId(),this.payload,this.getConfig());return this.payload.checked=(e=t.transaction)===null||e===void 0?void 0:e.checked,this})}post(){return N(this,void 0,void 0,function*(){yield this.createPendingFiles();let e=yield es(this.book.getId(),this.payload,this.getConfig());return this.payload=e.transaction||{},this})}trash(){return N(this,void 0,void 0,function*(){var e;let t=yield ns(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}untrash(){return N(this,void 0,void 0,function*(){var e;let t=yield is(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}};var Al=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},yt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getAccount(){return Al(this,void 0,void 0,function*(){if(this.payload.account)return yield this.book.getAccount(this.payload.account)})}getFirst(){let e=this.getItems();return e.length>0?e[0]:void 0}size(){var e;return((e=this.payload.items)===null||e===void 0?void 0:e.length)||0}getItems(){var e;let t=[];for(let r of(e=this.payload.items)!==null&&e!==void 0?e:[])t.push(new Z(this.book,r));return t}};var ke=class{constructor(e,t){this.container=e,this.payload=t}getDay(){return this.payload.day}getMonth(){return this.payload.month}getYear(){return this.payload.year}getDate(){var e=this.getYear(),t=this.getMonth(),r=this.getDay();(t==null||t==0)&&e++,(r==null||r==0)&&t++;var i=wn(e,t,r,this.container.getBalancesReport().getBook().getTimeZoneOffset());return i}getFuzzyDate(){return this.payload.fuzzyDate}getCumulativeBalance(){return q(this.getCumulativeBalanceRaw(),this.container.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit)}getPeriodBalance(){return q(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance)}getPeriodCredit(){return new E(this.payload.periodCredit)}getPeriodDebit(){return new E(this.payload.periodDebit)}};var pe=class{constructor(e,t,r){this.maxDepth=0,this.expandAllAccounts=!1,this.expandAllGroups=!1,this.skipRoot=!1,this.book=e,this.balancesContainers=t,this.periodicity=r,this.balanceType=be.TOTAL,this.shouldFormatDate=!1,this.shouldHideDates=!1,this.shouldHideNames=!1,this.shouldFormatValue=!1,this.shouldTranspose=!1,this.shouldTrial=!1,this.shouldPeriod=!1,this.shouldRaw=!1,this.shouldAddProperties=!1,this.shouldAddHiddenProperties=!1}getBalance(e,t){return this.getRepresentativeBalance(e,t).toNumber()}getRepresentativeBalance(e,t){return e==null?new E(0):t?e.times(-1):e}getBalanceText(e,t){return this.book.formatValue(this.getRepresentativeBalance(e,t))}formatDates(e){return this.shouldFormatDate=e,this}formatValues(e){return this.shouldFormatValue=e,this}expanded(e){return typeof e=="boolean"&&e==!0?(this.maxDepth=1,this.skipRoot=!0):e==-1?this.expandAllGroups=!0:e==-2?this.expandAllAccounts=!0:typeof e=="number"&&e>0&&(this.maxDepth=e),this}type(e){return this.balanceType=e,this}transposed(e){return this.shouldTranspose=e,this}hideDates(e){return this.shouldHideDates=e,this}hideNames(e){return this.shouldHideNames=e,this}properties(e){return this.shouldAddProperties=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}trial(e){return this.shouldTrial=e,this}period(e){return this.shouldPeriod=e,this}raw(e){return this.shouldRaw=e,this}build(){return this.balanceType==be.TOTAL?this.buildTotalDataTable_():this.buildTimeDataTable_()}addPropertyKeys(e,t){for(let r of t.getPropertyKeys())!this.shouldAddHiddenProperties&&r.endsWith("_")||e.indexOf(r)<=-1&&e.push(r)}flattenContainers(e,t){for(let r of this.balancesContainers)this.expandAllAccounts?(this.flattenAllAccounts(r,e,t),e.sort(this.sortContainersFunction)):r.isFromGroup()&&this.expandAllGroups?this.flattenAllGroups(r,e,t):this.flattenMaxDepth(r,e,t)}flattenAllAccounts(e,t,r){if(e.isFromGroup())for(let i of e.getBalancesContainers())this.flattenAllAccounts(i,t,r);else t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e)}sortContainersFunction(e,t){let r=0;e.isPermanent()&&!t.isPermanent()?r=-1:!e.isPermanent()&&t.isPermanent()&&(r=1),r==0&&(e.getParent()&&!t.getParent()?r=-1:!e.getParent()&&t.getParent()&&(r=1)),r==0&&(r=i(e)-i(t)),r==0&&(r=e.getName().toLowerCase().localeCompare(t.getName().toLowerCase()));function i(o){return o.isPermanent()&&!o.isCredit()?0:o.isPermanent()&&o.isCredit()?1:!o.isPermanent()&&o.isCredit()?2:!o.isPermanent()&&!o.isCredit()?3:4}return r}flattenMaxDepth(e,t,r){let i=e.getDepth();if(i<=this.maxDepth){!this.skipRoot&&!this.shouldTranspose&&(e.payload.name=mr(" ",i*4)+e.payload.name),(!this.skipRoot||i!=0)&&(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e));let o=e.getBalancesContainers();if(o&&o.length>0){o.sort(this.sortContainersFunction);for(let s of o)this.flattenMaxDepth(s,t,r)}}}flattenAllGroups(e,t,r){if(e.isFromGroup()){if(!this.shouldTranspose){let i=e.getDepth();e.payload.name=mr(" ",i*4)+e.payload.name}if(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e),e.hasGroupBalances()){let i=e.getBalancesContainers();i.sort(this.sortContainersFunction);for(let o of i)this.flattenAllGroups(o,t,r)}}}buildTotalDataTable_(){var e=new Array;if(this.balancesContainers==null)return e;this.balancesContainers.sort((c,l)=>c!=null&&l!=null?c.getName().toLowerCase().localeCompare(l.getName().toLowerCase()):-1);let t=[],r=new Array;if(this.flattenContainers(r,t),this.shouldAddProperties){t.sort();let c=["name","balance"];for(let l of t)c.push(l);e.push(c)}for(var i=0;i<r.length;i++){var o=r[i];if(o!=null){var s=new Array,a=o.getName();if(s.push(a),this.shouldTrial?this.shouldFormatValue?this.shouldPeriod?(s.push(o.getPeriodDebitText()),s.push(o.getPeriodCreditText())):(s.push(o.getCumulativeDebitText()),s.push(o.getCumulativeCreditText())):this.shouldPeriod?(s.push(o.getPeriodDebit().toNumber()),s.push(o.getPeriodCredit().toNumber())):(s.push(o.getCumulativeDebit().toNumber()),s.push(o.getCumulativeCredit().toNumber())):this.shouldFormatValue?this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRawText()):s.push(this.getBalanceText(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRawText()):s.push(this.getBalanceText(o.getCumulativeBalanceRaw(),o.isPermanent())):this.shouldPeriod?this.shouldRaw?s.push(o.getPeriodBalanceRaw().toNumber()):s.push(this.getBalance(o.getPeriodBalanceRaw(),o.isPermanent())):this.shouldRaw?s.push(o.getCumulativeBalanceRaw().toNumber()):s.push(this.getBalance(o.getCumulativeBalanceRaw(),o.isPermanent())),this.shouldAddProperties){let c=o.getProperties();for(let l of t){let u=c[l];if(u){s.push(u);continue}s.push("")}}e.push(s)}}return this.shouldHideNames&&(e=e.map(c=>c.slice(1))),this.shouldTranspose&&e.length>0&&(e=e[0].map((c,l)=>e.map(u=>u[l]))),e}buildTimeDataTable_(){var e=new Array,t=new Object,r=this.balanceType==be.CUMULATIVE,i=new Array;if(i.push(""),this.balancesContainers==null)return e;let o=[],s=new Array;this.flattenContainers(s,o);for(let D of s){i.push(D.getName());var a=D.getBalances();if(a!=null)for(let L of a){var c=L.getFuzzyDate(),l=t[c];l==null&&(l={},l.date=L.getDate(),t[c]=l);var u;r?u=L.getCumulativeBalanceRaw():u=L.getPeriodBalanceRaw(),l[D.getName()]=this.shouldRaw?u:this.getRepresentativeBalance(u,D.isPermanent())}}e.push(i);var d=new Array;for(var f in t){var p=t[f],g=new Array;g.push(p.date);for(let D of s){var u=p[D.getName()];u==null?u="null_amount":(u=new E(u),this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber()),g.push(u)}d.push(g)}d.sort(function(D,L){return D[0].getTime()-L[0].getTime()});for(var v=null,w=0;w<d.length;w++){var g=d[w];if(w==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}else for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"&&r)v&&(g[y]=v[y]);else if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}v=g,e.push(g)}if(this.shouldFormatDate&&e.length>0)for(var y=1;y<e.length;y++){var g=e[y];g.length>0&&(g[0]=$e(g[0],this.book.getTimeZone()))}if(this.shouldAddProperties){o.sort();for(let D of o){var ae=[D];for(let L of s)ae.push(L.getProperty(D)||"");e.push(ae)}}return this.shouldHideNames&&e.shift(),this.shouldHideDates&&(e=e.map(D=>D.slice(1))),!this.shouldTranspose&&e.length>0&&(e=e[0].map((D,L)=>e.map(Ir=>Ir[L]))),e}};var Us=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},vt=class{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return Us(this,void 0,void 0,function*(){return null})}getAccount(){return Us(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getAccount(this.getNormalizedName()))||null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!0}isFromGroup(){return!1}hasGroupBalances(){return!1}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}createDataTable(){return new pe(this.balancesReport.getBook(),[this],this.balancesReport.getPeriodicity())}getBalancesContainers(){return[]}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainer(e){let t=ve(e);if(this.getNormalizedName()==t)return this;throw`${e} does not match ${this.getName()}`}};var Gs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Dr=class n{constructor(e,t,r){this.parent=e,this.balancesReport=t,this.payload=r}getBalancesReport(){return this.balancesReport}getName(){return this.payload.name}getNormalizedName(){return this.payload.normalizedName}getGroup(){return Gs(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getGroup(this.getNormalizedName()))||null})}getAccount(){return Gs(this,void 0,void 0,function*(){return null})}getParent(){return this.parent}getDepth(){if(this.depth==null){let e=this.getParent();this.depth=e!=null?e.getDepth()+1:0}return this.depth}isCredit(){return this.payload.credit||!1}isPermanent(){return this.payload.permanent||!1}isFromAccount(){return!1}isFromGroup(){return!0}hasGroupBalances(){let e=this.getGroupContainers();return e!=null&&e.length>0}getCumulativeBalance(){return q(new E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return q(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}createDataTable(){return new pe(this.balancesReport.getBook(),this.getBalancesContainers(),this.balancesReport.getPeriodicity())}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainers(){let e=[],t=this.getGroupContainers();t&&t.length>0&&(e=e.concat(t));let r=this.getAccountContainers();return r&&r.length>0&&(e=e.concat(r)),e}getGroupContainers(){let e=this.payload.groupBalances;if(this.groupBalances==null&&e!=null){this.groupBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.groupBalances.push(new n(this,this.balancesReport,r))}}return this.groupBalances||[]}getAccountContainers(){let e=this.payload.accountBalances;if(this.accountBalances==null&&e!=null){this.accountBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.accountBalances.push(new vt(this,this.balancesReport,r))}}return this.accountBalances||[]}getBalancesContainer(e){var t;let r=ve(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found on group ${this.getName()}`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found on group ${this.getName()}`;return o}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var wt=class{constructor(e,t){this.book=e,this.payload=t}getBook(){return this.book}createDataTable(){return new pe(this.book,this.getBalancesContainers(),this.getPeriodicity())}getPeriodicity(){return this.payload.periodicity}getBalancesContainers(){let e=[],t=this.getRootAccountBalancesContainers();t!=null&&t.length>0&&(e=e.concat(t));let r=this.getGroupBalancesContainers();return r!=null&&r.length>0&&(e=e.concat(r)),e}getBalancesContainer(e){var t;let r=ve(e),i=this.getBalancesContainers();if(i==null||i.length===0)throw`${e} not found`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,i));let o=(t=this.balancesContainersMap)===null||t===void 0?void 0:t.get(r);if(!o)throw`${e} not found`;return o}getRootAccountBalancesContainers(){if(this.accountBalancesContainers==null&&this.payload.accountBalances!=null){this.accountBalancesContainers=[];for(let e=0;e<this.payload.accountBalances.length;e++){let t=this.payload.accountBalances[e],r=new vt(null,this,t);this.accountBalancesContainers.push(r)}}return this.accountBalancesContainers||[]}getGroupBalancesContainers(){if(this.groupBalancesContainers==null&&this.payload.groupBalances!=null){this.groupBalancesContainers=[];for(let e=0;e<this.payload.groupBalances.length;e++){let t=this.payload.groupBalances[e],r=new Dr(null,this,t);this.groupBalancesContainers.push(r)}}return this.groupBalancesContainers||[]}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let i=t[r],o=i.getNormalizedName();o&&(e.has(o)||e.set(o,i));let s=i.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var Pn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},Et=class extends P{constructor(e,t){super(t),this.book=e}getConfig(){return this.book.getConfig()}getId(){return this.payload.id}getTitle(){return this.payload.title}setTitle(e){return this.payload.title=e,this}getQuery(){return this.payload.query}setQuery(e){return this.payload.query=e,this}create(){return Pn(this,void 0,void 0,function*(){return this.payload=yield Fo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}update(){return Pn(this,void 0,void 0,function*(){return this.payload=yield Po(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}remove(){return Pn(this,void 0,void 0,function*(){let e=this.getId();if(!e)throw new Error("Query id null!");return this.payload=yield Bo(this.book.getId(),e,this.getConfig()),this.updateQueryCache(!0),this})}updateQueryCache(e){this.book.queries&&(this.book.queries=this.book.queries.filter(t=>t.getId()!==this.getId()),e||this.book.queries.push(this))}};var Tt=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getCount(){return this.payload.count}};var At=class{constructor(e){this.COMPARATOR=(t,r)=>{let i=this.getTypeIndex(this.getStringType(t))-this.getTypeIndex(this.getStringType(r));return i===0&&(i=this.getHasChildrenIndex(t.hasChildren())-this.getHasChildrenIndex(r.hasChildren())),i===0&&(i=t.getNormalizedName().localeCompare(r.getNormalizedName())),i},this.groups=e,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.shouldShowTree=!1,this.propertyKeys=[]}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}tree(e){return this.shouldShowTree=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.groups)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}getStringType(e){let t=e.getType()?e.getType()+"":void 0;return t||(t=e.isPermanent()?F.ASSET+"_"+F.LIABILITY:F.INCOMING+"_"+F.OUTGOING),t}getTypeIndex(e){return e===F.ASSET+"_"+F.LIABILITY?0:e===F.ASSET?1:e===F.LIABILITY?2:e===F.INCOMING+"_"+F.OUTGOING?3:e===F.INCOMING?4:5}getHasChildrenIndex(e){return e?0:1}build(){let e=new Array,t=this.groups;t.sort(this.COMPARATOR);let r=[];this.shouldAddIds&&r.push("Group Id"),r.push("Name"),r.push("Type"),this.shouldShowTree||r.push("Parent"),this.shouldAddProperties&&this.mapPropertyKeys();for(let i of t)i.isHidden()||i.getParent()||(e.push(this.buildGroupLine(i,0)),e=this.traverse(i,e,1));return this.shouldAddProperties&&(r=r.concat(this.propertyKeys)),e.unshift(r),Ce(e),e}buildGroupLine(e,t){let r=[];this.shouldAddIds&&r.push(e.getId());let i=this.shouldShowTree?" ".repeat(t)+e.getName():e.getName();if(r.push(i),r.push(this.getStringType(e)),!this.shouldShowTree){let o=e.getParent()?e.getParent().getName():"";r.push(o)}if(this.shouldAddProperties){let o=e.getProperties();for(let s of this.propertyKeys){let a=o[s];if(a){r.push(a);continue}r.push("")}}return r}traverse(e,t,r){let i=e.getChildren();i.sort(this.COMPARATOR);for(let o of i)t.push(this.buildGroupLine(o,r)),o.hasChildren()&&this.traverse(o,t,r+1);return t}};var Bn=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},bt=class{constructor(e,t,r){this.shouldFormatDates=!1,this.shouldFormatValues=!1,this.shouldAddUrls=!1,this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddRecordedAt=!0,this.shouldAddHiddenProperties=!1,this.book=e,this.transactions=t,this.account=r}formatDates(e){return this.shouldFormatDates=e,this}formatValues(e){return this.shouldFormatValues=e,this}urls(e){return this.shouldAddUrls=e,this}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}recordedAt(e){return this.shouldAddRecordedAt=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}includeUrls(e){return this.urls(e)}includeProperties(e){return this.properties(e)}includeIds(e){return this.ids(e)}getAccount(){return this.account}build(){return Bn(this,void 0,void 0,function*(){let e=this.getHeaderLine(),t=yield this.get2DArray_();return t.length>0?(t.splice(0,0,e),Ce(t),t):[e]})}getHeaderLine(){let e=[];if(this.shouldAddIds&&e.push("Transaction Id"),e.push("Status"),e.push("Date"),e.push("Origin"),e.push("Destination"),e.push("Description"),e.push("Amount"),this.shouldShowBalances()&&e.push("Balance"),this.shouldAddRecordedAt&&e.push("Recorded at"),this.shouldAddProperties)for(let t of this.getPropertyKeys())e.push(t);if(this.shouldAddIds)for(let t of this.getRemoteIdHeaders())e.push(t);if(this.shouldAddUrls)for(let t of this.getAttachmentHeaders())e.push(t);return e}get2DArray_(){return Bn(this,void 0,void 0,function*(){let e=[];for(let t of this.transactions){let r=[];this.shouldAddIds&&r.push(t.getId()),r.push(t.getStatus()),this.shouldFormatDates?r.push(t.getDateFormatted()):r.push(t.getDateObject()),r.push(yield t.getCreditAccountName()),r.push(yield t.getDebitAccountName()),r.push(t.getDescription());let i=t.getAmount();if(i!=null){if(this.shouldShowBalances()&&this.account){let o=yield this.isCreditOnTransaction_(t,this.account);i=q(i,!o)}this.shouldFormatValues?r.push(ye(i,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(i.toNumber())}else r.push("");if(this.shouldShowBalances()){let o=yield t.getAccountBalance();o!=null?this.shouldFormatValues?r.push(ye(o,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(o.toNumber()):r.push("")}this.shouldAddRecordedAt&&(this.shouldFormatDates?r.push(t.getCreatedAtFormatted()):r.push(t.getCreatedAt())),this.shouldAddProperties&&this.addPropertiesToLine(r,t),this.shouldAddIds&&this.addRemoteIdsToLine(r,t),this.shouldAddUrls&&this.addUrlsToLine(r,t),e.push(r)}return e})}shouldShowBalances(){return this.account!=null&&this.account.isPermanent()===!0}isCreditOnTransaction_(e,t){return Bn(this,void 0,void 0,function*(){let r=yield e.getCreditAccount();return t==null||r==null?!1:r.getId()===t.getId()})}getPropertyKeys(){if(this.propertyKeys==null){this.propertyKeys=[];for(let e of this.transactions)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}return this.propertyKeys}getAttachmentHeaders(){if(this.attachmentHeaders==null){this.attachmentHeaders=[];for(let e of this.transactions){let t=this.getUrls(e);t.length>this.attachmentHeaders.length&&(this.attachmentHeaders=[],t.forEach(()=>this.attachmentHeaders.push("Attachment")))}}return this.attachmentHeaders}getRemoteIdHeaders(){if(this.remoteIdHeaders==null){this.remoteIdHeaders=[];for(let e of this.transactions){let t=e.getRemoteIds();t&&t.length>this.remoteIdHeaders.length&&(this.remoteIdHeaders=[],t.forEach(()=>this.remoteIdHeaders.push("Remote Id")))}}return this.remoteIdHeaders}addPropertiesToLine(e,t){let r=e.length;for(let i of this.getPropertyKeys())e.push("");for(let i of t.getPropertyKeys()){if(!this.shouldAddHiddenProperties&&i.endsWith("_"))continue;let o=this.getPropertyKeys().indexOf(i)+r;e[o]=t.getProperty(i)}}addRemoteIdsToLine(e,t){let r=e.length;for(let o of this.getRemoteIdHeaders())e.push("");let i=t.getRemoteIds();if(i)for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}addUrlsToLine(e,t){let r=e.length;for(let o of this.getAttachmentHeaders())e.push("");let i=this.getUrls(t);for(let o=r;o<r+i.length;o++)e[o]=i[o-r]}getUrls(e){let t=e.getUrls();t==null&&(t=[]);let r=e.getFiles();return r!=null&&(t=t.concat(r.map(i=>i.getUrl()).filter(i=>i!=null))),t}};var T=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},X=class n extends U{constructor(e,t){super(e),this.allGroupsLoaded=!1,this.allAccountsLoaded=!1,this.config=t,this.payload.permission==nt.RECORDER&&(this.payload.groups=this.payload.groups||[],this.payload.accounts=this.payload.accounts||[]),this.allGroupsLoaded=this.mapGroups(this.payload.groups),this.allAccountsLoaded=this.mapAccounts(this.payload.accounts)}getConfig(){return this.config||k.globalConfig}getId(){return this.payload.id||""}getName(){return this.payload.name}setName(e){return this.payload.name=e,this}getFractionDigits(){return this.payload.fractionDigits}getDecimalPlaces(){return this.getFractionDigits()}setFractionDigits(e){return this.payload.fractionDigits=e,this}getPeriod(){return this.payload.period}setPeriod(e){return this.payload.period=e,this}getPeriodStartMonth(){return this.payload.periodStartMonth}setPeriodStartMonth(e){return this.payload.periodStartMonth=e,this}getPageSize(){return this.payload.pageSize}setPageSize(e){return this.payload.pageSize=e,this}getOwnerName(){return this.payload.ownerName}getLogoUrl(){return this.payload.logoUrl}getPermission(){return this.payload.permission}getCollection(){return this.payload.collection!=null&&this.collection==null&&(this.collection=new Se(this.payload.collection,this.config)),this.collection}getDatePattern(){return this.payload.datePattern}setDatePattern(e){return this.payload.datePattern=e,this}getLockDate(){return this.payload.lockDate}setLockDate(e){return e==null&&(e="1900-00-00"),this.payload.lockDate=e,this}getClosingDate(){return this.payload.closingDate}setClosingDate(e){return e==null&&(e="1900-00-00"),this.payload.closingDate=e,this}getDecimalSeparator(){return this.payload.decimalSeparator}setDecimalSeparator(e){return this.payload.decimalSeparator=e,this}getTimeZone(){return this.payload.timeZone}setTimeZone(e){return this.payload.timeZone=e,this}getTimeZoneOffset(){return this.payload.timeZoneOffset}getAutoPost(){return this.payload.autoPost}setAutoPost(e){return this.payload.autoPost=e,this}getLastUpdateMs(){return this.payload.lastUpdateMs?+this.payload.lastUpdateMs:void 0}getTotalTransactions(){return this.payload.totalTransactions?+this.payload.totalTransactions:0}getTotalTransactionsCurrentMonth(){return this.payload.totalTransactionsCurrentMonth?+this.payload.totalTransactionsCurrentMonth:0}getTotalTransactionsCurrentYear(){return this.payload.totalTransactionsCurrentYear?+this.payload.totalTransactionsCurrentYear:0}getVisibility(){return this.payload.visibility}setVisibility(e){return this.payload.visibility=e,this}formatDate(e,t){return(t==null||t.trim()=="")&&(t=this.getTimeZone()),Gt(e,this.getDatePattern(),t)}parseDate(e){return vr(e,this.getDatePattern(),this.getTimeZone())}formatValue(e){return e?ye(e,this.getDecimalSeparator(),this.getFractionDigits()):""}parseValue(e){return yr(e,this.getDecimalSeparator())}round(e){return gr(e,this.getFractionDigits())}batchCreateTransactions(e){return T(this,void 0,void 0,function*(){let t=[];return e.forEach(r=>t.push(r.json())),t=yield Zo(this.getId(),t,this.getConfig()),e=t.map(r=>new Z(this,r)),e})}batchPostTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield qo(this.getId(),t,this.getConfig())})}batchUpdateTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];return e.forEach(i=>r.push(i.json())),r=yield Wo(this.getId(),r,t,this.getConfig()),e=r.map(i=>new Z(this,i)),e})}batchCheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Yo(this.getId(),t,this.getConfig())})}batchUncheckTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Ko(this.getId(),t,this.getConfig())})}batchTrashTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];e.forEach(i=>r.push(i.json())),yield Jo(this.getId(),r,t,this.getConfig())})}batchUntrashTransactions(e){return T(this,void 0,void 0,function*(){let t=[];e.forEach(r=>t.push(r.json())),yield Qo(this.getId(),t,this.getConfig())})}mergeTransactions(e,t){return T(this,void 0,void 0,function*(){let r=typeof e=="string"?e:e instanceof Z?e.getId():e.id;if(r==null||r.trim()==="")throw new Error("The first transaction must provide an id for merge.");let i=typeof t=="string"?t:t instanceof Z?t.getId():t.id;if(i==null||i.trim()==="")throw new Error("The second transaction must provide an id for merge.");let o={items:[{id:r},{id:i}]},s=yield as(this.getId(),o,this.getConfig());return new Z(this,s.transaction||{})})}batchReplayEvents(e,t){return T(this,void 0,void 0,function*(){let o={items:e.map(s=>s.getId()).map(s=>({id:s}))};yield hs(this,o,t,this.getConfig())})}batchCreateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:yield Promise.all(e.map(o=>this.normalizeAccountPayloadForBatchCreate_(o)))},r=yield Gn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}normalizeAccountPayloadForBatchCreate_(e){return T(this,void 0,void 0,function*(){let t=e.json();if(!t.groups||t.groups.length===0)return t;let r=[];for(let i of t.groups){let o=i.id||i.name;if(!o||o.trim()==="")throw new Error("Account group reference must include id or name");let s=yield this.getGroup(o);if(!s)throw new Error(`Group not found: ${o}`);r.push(s.json())}return t.groups=r,t})}batchUpdateAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Hn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}batchDeleteAccounts(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield jn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o,!0)}return this.clearCache(),i}return[]})}batchCreateGroups(e){return T(this,void 0,void 0,function*(){if(e.length>0){let t={items:e.map(o=>o.json())},r=yield Yn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new Q(this,o);i.push(s),this.setGroup(o)}return this.clearCache(),i}return[]})}audit(){Io(this.getId(),this.getConfig())}getApps(){return T(this,void 0,void 0,function*(){if(this.apps!=null)return this.apps;let e=yield ko(this.getId(),this.getConfig());return this.apps=e.map(t=>new we(t,this.config)),this.apps})}getIntegrations(){return T(this,void 0,void 0,function*(){return(yield Ho(this.getId(),this.getConfig())).map(r=>new ee(r,this.config))})}createIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof ee?e=yield En(this.getId(),e.json(),this.getConfig()):e=yield En(this.getId(),e,this.getConfig()),new ee(e,this.config)})}updateIntegration(e){return T(this,void 0,void 0,function*(){return e instanceof ee?e=yield Tn(this.getId(),e.json(),this.getConfig()):e=yield Tn(this.getId(),e,this.getConfig()),new ee(e,this.config)})}getAccount(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idAccountMap&&(t=this.idAccountMap.get(e)),!t&&this.nameAccountMap&&(t=this.nameAccountMap.get(ve(e))),!t){let r=yield zn(this.getId(),e,this.getConfig());r&&(t=new G(this,r),this.updateAccountCache(t))}return t})}updateGroupCache(e){this.updateGroupIdMap(e),this.updateGroupNameMap(e)}updateGroupIdMap(e){this.idGroupMap=this.idGroupMap||new Map;let t=e.getId();t&&this.idGroupMap.set(t,e)}updateGroupNameMap(e){this.nameGroupMap=this.nameGroupMap||new Map;let t=e.getNormalizedName();t&&this.nameGroupMap.set(t,e)}updateAccountCache(e){this.updateAccountIdMap(e),this.updateAccountNameMap(e)}updateAccountIdMap(e){this.idAccountMap=this.idAccountMap||new Map;let t=e.getId();t&&this.idAccountMap.set(t,e)}updateAccountNameMap(e){this.nameAccountMap=this.nameAccountMap||new Map;let t=e.getNormalizedName();t&&this.nameAccountMap.set(t,e)}getMostRecentLockDate_(){let e=this.getClosingDate(),t=this.getLockDate();return!e&&!t?null:!e&&t?t:e&&!t||st(e)>st(t)?e:t}getGroup(e){return T(this,void 0,void 0,function*(){if(!e||e.trim()=="")return;let t;if(this.idGroupMap&&(t=this.idGroupMap.get(e)),!t&&this.nameGroupMap&&(t=this.nameGroupMap.get(ve(e))),!t){let r=yield Xn(this.getId(),e,this.getConfig());r&&(t=new Q(this,r),this.updateGroupCache(t))}return t})}getGroups(){return T(this,void 0,void 0,function*(){var e,t;if(this.idGroupMap&&this.allGroupsLoaded)return Array.from(((e=this.idGroupMap)===null||e===void 0?void 0:e.values())||[]);let r=yield Qn(this.getId(),this.getConfig());return this.allGroupsLoaded=this.mapGroups(r),Array.from(((t=this.idGroupMap)===null||t===void 0?void 0:t.values())||[])})}mapGroups(e){if(!e)return!1;let t=e.map(r=>new Q(this,r));this.idGroupMap=new Map,this.nameGroupMap=new Map;for(let r of t)this.updateGroupCache(r),r.buildGroupTree(this.idGroupMap);for(let r of t)r.buildGroupTree(this.idGroupMap);return!0}getAccounts(){return T(this,void 0,void 0,function*(){var e,t;if(this.idAccountMap&&this.allAccountsLoaded)return Array.from(((e=this.idAccountMap)===null||e===void 0?void 0:e.values())||[]);yield this.getGroups();let r=yield qn(this.getId(),this.getConfig());return this.allAccountsLoaded=this.mapAccounts(r),Array.from(((t=this.idAccountMap)===null||t===void 0?void 0:t.values())||[])})}mapAccounts(e){if(!e)return!1;let t=e.map(r=>new G(this,r));this.idAccountMap=new Map,this.nameAccountMap=new Map;for(let r of t)this.updateAccountCache(r),this.linkAccountsAndGroups(r);return this.ensureGroupsAccountMapsLoaded(),!0}linkAccountsAndGroups(e){var t;let r=e.json().groups||[];for(let i of r){let o=(t=this.idGroupMap)===null||t===void 0?void 0:t.get(i.id||"");o!=null&&o.addAccount(e)}}ensureGroupsAccountMapsLoaded(){if(this.idGroupMap)for(let e of this.idGroupMap.values())e.accounts==null&&(e.accounts=new Map)}clearCache(){this.clearGroupCache(),this.clearAccountCache()}clearGroupCache(){this.allGroupsLoaded=!1,this.idGroupMap=void 0,this.nameGroupMap=void 0}clearAccountCache(){this.allAccountsLoaded=!1,this.idAccountMap=void 0,this.nameAccountMap=void 0}clearCollaboratorCache(){this.collaborators=void 0}setAccount(e,t){let r=this.payload.accounts||[];t?this.payload.accounts=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.accounts=r.map(o=>o.id===e.id?e:o):this.payload.accounts=[...r,e]}setGroup(e,t){let r=this.payload.groups||[];t?this.payload.groups=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.groups=r.map(o=>o.id===e.id?e:o):this.payload.groups=[...r,e]}listTransactions(e,t,r){return T(this,void 0,void 0,function*(){let i=yield ss(this.getId(),e,t,r,this.getConfig());return new yt(this,i)})}listFiles(e,t){return T(this,void 0,void 0,function*(){let r=yield Uo(this.getId(),e,t,this.getConfig());return new gt(this,r)})}countTransactions(e){return T(this,void 0,void 0,function*(){return(yield us(this.getId(),e,this.getConfig())).total})}listEvents(e,t,r,i,o,s){return T(this,void 0,void 0,function*(){let a=yield cs(this,e,t,r,i,o,s,this.getConfig());return new mt(this,a)})}getTransaction(e){return T(this,void 0,void 0,function*(){let t=yield os(this.getId(),e,this.getConfig());return t?new Z(this,t):void 0})}getFile(e){return T(this,void 0,void 0,function*(){let t=yield br(this.getId(),e,this.getConfig());return t?new he(this,t):void 0})}create(){return T(this,void 0,void 0,function*(){return this.payload=yield Do(this.payload,this.getConfig()),this})}copy(e,t,r){return T(this,void 0,void 0,function*(){let i=yield Oo(this.getId(),e,t,r,this.getConfig());return new n(i,this.config)})}update(){return T(this,void 0,void 0,function*(){return this.payload=yield So(this.getId(),this.payload,this.getConfig()),this})}remove(){return T(this,void 0,void 0,function*(){return this.payload=yield xo(this.getId(),this.getConfig()),this})}getBalancesReport(e){return T(this,void 0,void 0,function*(){let t=yield Ro(this.getId(),e,this.getConfig());return new wt(this,t)})}getSavedQueries(){return T(this,void 0,void 0,function*(){if(this.queries==null){let e=yield Mo(this.getId(),this.getConfig());this.queries=e.map(t=>new Et(this,t))}return this.queries})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield gs(this.getId(),this.getConfig());this.collaborators=e.map(t=>new ct(this,t))}return this.collaborators})}getBacklog(){return T(this,void 0,void 0,function*(){let e=yield ps(this,this.getConfig());return new Tt(e,this.config)})}createAccountsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getAccounts()),new ut(e)})}createGroupsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getGroups()),new At(e)})}createTransactionsDataTable(e,t){return new bt(this,e,t)}};var bl=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Vs(n){return bl(this,void 0,void 0,function*(){let e=yield new te("v5/templates",n).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}var Ct=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getName(){return this.payload.name}getDescription(){return this.payload.description}getImageUrl(){return this.payload.imageUrl}getCategory(){return this.payload.category}getTimesUsed(){return this.payload.timesUsed||0}getBookId(){return this.payload.bookId}getBookLink(){return this.payload.bookLink}getSheetsLink(){return this.payload.sheetsLink}};var ze=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},k=class n{static setConfig(e){n.globalConfig=e}constructor(e){this.config=e||n.globalConfig}getConfig(){return this.config}getBook(e,t,r){return ze(this,void 0,void 0,function*(){let i=yield Co(e,t,r,this.config);return new X(i,this.config)})}getBooks(e){return ze(this,void 0,void 0,function*(){return(yield bo(e,this.config)).map(r=>new X(r,this.config))})}getCollections(){return ze(this,void 0,void 0,function*(){return(yield ws(this.config)).map(t=>new Se(t,this.config))})}getApps(){return ze(this,void 0,void 0,function*(){return(yield vo(this.config)).map(t=>new we(t,this.config))})}getApp(e){return ze(this,void 0,void 0,function*(){let t=yield wo(e,this.config);return new we(t,this.config)})}getTemplates(){return ze(this,void 0,void 0,function*(){return(yield Vs(this.config)).map(t=>new Ct(t,this.config))})}getUser(){return ze(this,void 0,void 0,function*(){let e=yield Fs(this.config);return new Ie(e,this.config)})}};k.globalConfig={};var Hs=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},we=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}setWebhookUrlDev(e){return this.payload.webhookUrlDev=e,this}getId(){return this.payload.id}getName(){return this.payload.name}hasEvents(){return(this.getEvents()||[]).length>0}getEvents(){return this.payload.events}isPublished(){return this.payload.published||!1}isInstallable(){return this.payload.installable||!1}getLogoUrl(){return this.payload.logoUrl}getLogoUrlDark(){return this.payload.logoUrlDark}getDescription(){return this.payload.description}setUsers(e){return this.payload.users=e,this}getUsers(){return this.payload.users}getMenuUrl(){return this.payload.menuUrl}getMenuUrlDev(){return this.payload.menuUrlDev}getMenuText(){return this.payload.menuText}getMenuOpenMode(){return this.payload.menuOpenMode||it.SIDEBAR}setMenuOpenMode(e){return this.payload.menuOpenMode=e,this}getMenuPopupWidth(){return this.payload.menuPopupWidth}getMenuPopupHeight(){return this.payload.menuPopupHeight}getOwnerName(){return this.payload.ownerName}getOwnerLogoUrl(){return this.payload.ownerLogoUrl}getOwnerWebsiteUrl(){return this.payload.ownerWebsite}getFilePatterns(){return this.payload.filePatterns}setDevelopers(e){return this.payload.developers=e,this}getDevelopers(){return this.payload.developers}setClientSecret(e){return this.payload.clientSecret=e,this}getWebsiteUrl(){return this.payload.website}isRepositoryPrivate(){return this.payload.repoPrivate}getRepositoryUrl(){return this.payload.repoUrl}getReadme(){return this.payload.readmeMd||this.payload.readme}setReadme(e){return this.payload.readmeMd=e,this}create(){return Hs(this,void 0,void 0,function*(){return yield Eo(this.payload,this.getConfig()),this})}update(){return Hs(this,void 0,void 0,function*(){return yield To(this.payload,this.getConfig()),this})}};var Sr=class{constructor(e){this.shouldAddProperties=!1,this.shouldAddIds=!1,this.shouldAddHiddenProperties=!1,this.propertyKeys=[],this.books=e}properties(e){return this.shouldAddProperties=e,this}ids(e){return this.shouldAddIds=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}mapPropertyKeys(){this.propertyKeys=[];for(let e of this.books)for(let t of e.getPropertyKeys())!this.shouldAddHiddenProperties&&t.endsWith("_")||this.propertyKeys.indexOf(t)<=-1&&this.propertyKeys.push(t);this.propertyKeys=this.propertyKeys.sort()}build(){var e,t;let r=new Array;this.books.sort((o,s)=>{var a,c;let l=(a=o.getCollection())===null||a===void 0?void 0:a.getName(),u=(c=s.getCollection())===null||c===void 0?void 0:c.getName();if(l&&!u)return-1;if(!l&&u)return 1;let d=(l||"").localeCompare(u||"");return d===0&&(d=(o.getName()||"").localeCompare(s.getName()||"")),d});let i=[];this.shouldAddIds&&i.push("Book Id"),i.push("Name"),i.push("Collection"),i.push("Date Pattern"),i.push("Decimal Separator"),i.push("Fraction Digits"),i.push("Period"),i.push("Owner"),this.shouldAddProperties&&(this.mapPropertyKeys(),i=i.concat(this.propertyKeys));for(let o of this.books){let s=[];if(this.shouldAddIds&&s.push(o.getId()),s.push(o.getName()||""),s.push(((e=o.getCollection())===null||e===void 0?void 0:e.getName())||""),s.push(o.getDatePattern()||""),s.push(o.getDecimalSeparator()||""),s.push((t=o.getFractionDigits())!==null&&t!==void 0?t:""),s.push(o.getPeriod()||""),s.push(o.getOwnerName()||""),this.shouldAddProperties){let a=o.getProperties();for(let c of this.propertyKeys)s.push(a[c]||"")}r.push(s)}return r.unshift(i),Ce(r),r}};return ta(Dl);})();
|
|
3
3
|
//# sourceMappingURL=bkper.min.js.map
|