bkper-js 2.41.1 → 2.42.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/dist/bkper.min.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";var bkperjs=(()=>{var Ks=Object.create;var Yt=Object.defineProperty;var Js=Object.getOwnPropertyDescriptor;var Qs=Object.getOwnPropertyNames;var Xs=Object.getPrototypeOf,ea=Object.prototype.hasOwnProperty;var ta=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),ra=(n,e)=>{for(var t in e)Yt(n,t,{get:e[t],enumerable:!0})},Ln=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qs(e))!ea.call(n,i)&&i!==t&&Yt(n,i,{get:()=>e[i],enumerable:!(r=Js(e,i))||r.enumerable});return n};var na=(n,e,t)=>(t=n!=null?Ks(Xs(n)):{},Ln(e||!n||!n.__esModule?Yt(t,"default",{value:n,enumerable:!0}):t,n)),ia=n=>Ln(Yt({},"__esModule",{value:!0}),n);var lo=ta(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 Ur(n){return Ur=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ur(n)}function rr(n,e){return rr=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},rr(n,e)}function ua(){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 Xt(n,e,t){return ua()?Xt=Reflect.construct:Xt=function(i,o,s){var a=[null];a.push.apply(a,o);var c=Function.bind.apply(i,a),l=new c;return s&&rr(l,s.prototype),l},Xt.apply(null,arguments)}function la(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Gr(n){var e=typeof Map=="function"?new Map:void 0;return Gr=function(r){if(r===null||!la(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 Xt(r,arguments,Ur(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),rr(i,r)},Gr(n)}function ca(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 da(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=da(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})(Gr(Error)),fa=(function(n){J(e,n);function e(t){return n.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(Be),ha=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(Be),pa=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(Be),Nt=(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),p="numeric",se="short",j="long",nr={year:p,month:p,day:p},Wr={year:p,month:se,day:p},Ii={year:p,month:se,day:p,weekday:se},Yr={year:p,month:j,day:p},Kr={year:p,month:j,day:p,weekday:j},Jr={hour:p,minute:p},Qr={hour:p,minute:p,second:p},Xr={hour:p,minute:p,second:p,timeZoneName:se},en={hour:p,minute:p,second:p,timeZoneName:j},tn={hour:p,minute:p,hour12:!1},rn={hour:p,minute:p,second:p,hour12:!1},nn={hour:p,minute:p,second:p,hour12:!1,timeZoneName:se},on={hour:p,minute:p,second:p,hour12:!1,timeZoneName:j},sn={year:p,month:p,day:p,hour:p,minute:p},an={year:p,month:p,day:p,hour:p,minute:p,second:p},un={year:p,month:se,day:p,hour:p,minute:p},ln={year:p,month:se,day:p,hour:p,minute:p,second:p},ki={year:p,month:se,day:p,weekday:se,hour:p,minute:p},cn={year:p,month:j,day:p,hour:p,minute:p,timeZoneName:se},dn={year:p,month:j,day:p,hour:p,minute:p,second:p,timeZoneName:se},fn={year:p,month:j,day:p,weekday:j,hour:p,minute:p,timeZoneName:j},hn={year:p,month:j,day:p,weekday:j,hour:p,minute:p,second:p,timeZoneName:j};function A(n){return typeof n=="undefined"}function Pe(n){return typeof n=="number"}function ur(n){return typeof n=="number"&&n%1===0}function ma(n){return typeof n=="string"}function ga(n){return Object.prototype.toString.call(n)==="[object Date]"}function de(){try{return typeof Intl!="undefined"&&Intl.DateTimeFormat}catch(n){return!1}}function Bt(){return!A(Intl.DateTimeFormat.prototype.formatToParts)}function Oi(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function ya(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 ur(n)&&n>=e&&n<=t}function va(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 pn(n){if(!(A(n)||n===null||n==="")){var e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function mn(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 _t(n){return n%4===0&&(n%100!==0||n%400===0)}function Ft(n){return _t(n)?366:365}function ir(n,e){var t=va(e-1,12)+1,r=n+(e-t)/12;return t===2?_t(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function gn(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 or(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 Vr(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&&Bt()){var c=new Intl.DateTimeFormat(t,s).formatToParts(i).find(function(m){return m.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 lr(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 sr(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 ar(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 cr(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 Ea=["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"],wa=["J","F","M","A","M","J","J","A","S","O","N","D"];function Bi(n){switch(n){case"narrow":return[].concat(wa);case"short":return[].concat(Pi);case"long":return[].concat(Ea);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"],Ta=["M","T","W","T","F","S","S"];function Li(n){switch(n){case"narrow":return[].concat(Ta);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"],Aa=["Before Christ","Anno Domini"],ba=["BC","AD"],Ca=["B","A"];function Gi(n){switch(n){case"narrow":return[].concat(Ca);case"short":return[].concat(ba);case"long":return[].concat(Aa);default:return null}}function Da(n){return Ui[n.hour<12?0:1]}function Sa(n,e){return Li(e)[n.weekday-1]}function Ia(n,e){return Bi(e)[n.month-1]}function ka(n,e){return Gi(e)[n.year<0?0:1]}function Oa(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 xa(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(nr):return"M/d/yyyy";case I(Wr):return"LLL d, yyyy";case I(Ii):return"EEE, LLL d, yyyy";case I(Yr):return"LLLL d, yyyy";case I(Kr):return"EEEE, LLLL d, yyyy";case I(Jr):return"h:mm a";case I(Qr):return"h:mm:ss a";case I(Xr):return"h:mm a";case I(en):return"h:mm a";case I(tn):return"HH:mm";case I(rn):return"HH:mm:ss";case I(nn):return"HH:mm";case I(on):return"HH:mm";case I(sn):return"M/d/yyyy, h:mm a";case I(un):return"LLL d, yyyy, h:mm a";case I(cn):return"LLLL d, yyyy, h:mm a";case I(fn):return r;case I(an):return"M/d/yyyy, h:mm:ss a";case I(ln):return"LLL d, yyyy, h:mm:ss a";case I(ki):return"EEE, d LLL yyyy, h:mm a";case I(dn):return"LLLL d, yyyy, h:mm:ss a";case I(hn):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 Na={D:nr,DD:Wr,DDD:Yr,DDDD:Kr,t:Jr,tt:Qr,ttt:Xr,tttt:en,T:tn,TT:rn,TTT:nn,TTTT:on,f:sn,ff:un,fff:cn,ffff:fn,F:an,FF:ln,FFF:dn,FFFF:hn},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 Na[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"&&Bt(),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?Da(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?Ia(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?Sa(r,y):c(S?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday")},m=function(y){var S=n.macroTokenToFormatOpts(y);return S?o.formatWithSystemDefault(r,S):y},g=function(y){return s?ka(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 m(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(m){var g=s(m);return g?o.num(f.get(g),m.length):m}},c=n.parseFormat(i),l=c.reduce(function(d,f){var m=f.literal,g=f.val;return m?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})(),Mr=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 ar(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 Mr===null&&(Mr=new e),Mr}}]),e})(Xe),Ma=RegExp("^"+Fi.source+"$"),er={};function Fa(n){return er[n]||(er[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"})),er[n]}var Pa={year:0,month:1,day:2,hour:3,minute:4,second:5};function Ba(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 _a(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=Pa[s];A(c)||(r[c]=parseInt(a,10))}return r}var Kt={},ce=(function(n){J(e,n),e.create=function(i){return Kt[i]||(Kt[i]=new e(i)),Kt[i]},e.resetCache=function(){Kt={},er={}},e.isValidSpecifier=function(i){return!!(i&&i.match(Ma))},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 ar(this.offset(i),o)},t.offset=function(i){var o=new Date(i);if(isNaN(o))return NaN;var s=Fa(this.name),a=s.formatToParts?_a(s,o):Ba(s,o),c=a[0],l=a[1],u=a[2],d=a[3],f=a[4],m=a[5],g=d===24?0:d,v=gn({year:c,month:l,day:u,hour:g,minute:f,second:m,millisecond:0}),E=+o,y=E%1e3;return E-=y>=0?y:1e3+y,(v-E)/(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),Fr=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(lr(o[1],o[2]))}return null},oe(e,null,[{key:"utcInstance",get:function(){return Fr===null&&(Fr=new e(0)),Fr}}]);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 ar(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"+ar(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(Xe),Hr=(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(ma(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 Hr(n)}else return Pe(n)?$.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new Hr(n)}var si=function(){return Date.now()},Pr=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?Pr=Me(t):Pr=null}},{key:"defaultZone",get:function(){return Pr||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})(),$r={};function jr(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=$r[t];return r||(r=new Intl.DateTimeFormat(n,e),$r[t]=r),r}var zr={};function Ra(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=zr[t];return r||(r=new Intl.NumberFormat(n,e),zr[t]=r),r}var qr={};function La(n,e){e===void 0&&(e={});var t=e,r=t.base,i=ca(t,["base"]),o=JSON.stringify([n,i]),s=qr[o];return s||(s=new Intl.RelativeTimeFormat(n,e),qr[o]=s),s}var Ne=null;function Ua(){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 Ga(n){var e=n.indexOf("-u-");if(e===-1)return[n];var t,r=n.substring(0,e);try{t=jr(n).resolvedOptions()}catch(a){t=jr(r).resolvedOptions()}var i=t,o=i.numberingSystem,s=i.calendar;return[r,o,s]}function Va(n,e,t){return de()?((t||e)&&(n+="-u",t&&(n+="-ca-"+t),e&&(n+="-nu-"+e)),n):[]}function Ha(n){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(n(r))}return e}function $a(n){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(n(r))}return e}function Jt(n,e,t,r,i){var o=n.listingMode(t);return o==="error"?null:o==="en"?r(e):i(e)}function ja(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 za=(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=Ra(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):mn(r,3);return Ke(o,this.padTo)}},n})(),qa=(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=jr(r,l)}}var e=n.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=xa(this.opts),i=B.create("en-US");return le.create(i).formatDateTimeFromString(this.dt,r)},e.formatToParts=function(){return this.hasIntl&&Bt()?this.dtf.formatToParts(this.dt.toJSDate()):[]},e.resolvedOptions=function(){return this.hasIntl?this.dtf.resolvedOptions():{locale:"en-US",numberingSystem:"latn",outputCalendar:"gregory"}},n})(),Za=(function(){function n(t,r,i){this.opts=Object.assign({style:"long"},i),!r&&Oi()&&(this.rtf=La(t,i))}var e=n.prototype;return e.format=function(r,i){return this.rtf?this.rtf.format(r,i):Oa(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":Ua()),l=i||x.defaultNumberingSystem,u=o||x.defaultOutputCalendar;return new n(c,l,u,a)},n.resetCache=function(){Ne=null,$r={},zr={},qr={}},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=Ga(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=Va(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&&Bt(),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),Jt(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]=Ha(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),Jt(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]=$a(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),Jt(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),Jt(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 za(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,i){return i===void 0&&(i={}),new qa(r,this.intl,i)},e.relFormatter=function(r){return r===void 0&&(r={}),new Za(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=ja(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))?)/,yn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,ji=RegExp(""+yn.source+$i.source+"?"),vn=RegExp("(?:T"+ji.source+")?"),Wa=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ya=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Ka=/(\d{4})-?(\d{3})/,Ja=Hi("weekYear","weekNumber","weekDay"),Qa=Hi("year","ordinal"),Xa=/(\d{4})-(\d\d)-(\d\d)/,zi=RegExp(yn.source+" ?(?:"+$i.source+"|("+Fi.source+"))?"),eu=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:pn(n[e+3])};return[t,null,e+4]}function rt(n,e){var t=!n[e]&&!n[e+1],r=lr(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 tu=RegExp("^T?"+yn.source+"$"),ru=/^-?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 nu(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(pn(l),d)}]}var iu={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function En(n,e,t,r,i,o,s){var a={year:e.length===2?Vr(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 ou=/^(?:(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 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=n[8],l=n[9],u=n[10],d=n[11],f=En(e,i,r,t,o,s,a),m;return c?m=iu[c]:l?m=0:m=lr(u,d),[f,new $(m)]}function au(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var uu=/^(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$/,lu=/^(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$/,cu=/^(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=En(e,i,r,t,o,s,a);return[c,$.utcInstance]}function du(n){var e=n[1],t=n[2],r=n[3],i=n[4],o=n[5],s=n[6],a=n[7],c=En(e,a,t,r,i,o,s);return[c,$.utcInstance]}var fu=et(Wa,vn),hu=et(Ya,vn),pu=et(Ka,vn),mu=et(ji),gu=_e(qi,Re,rt),yu=_e(Ja,Re,rt),vu=_e(Qa,Re,rt),Eu=_e(Re,rt);function wu(n){return tt(n,[fu,gu],[hu,yu],[pu,vu],[mu,Eu])}function Tu(n){return tt(au(n),[ou,su])}function Au(n){return tt(n,[uu,di],[lu,di],[cu,du])}function bu(n){return tt(n,[ru,nu])}var Cu=_e(Re);function Du(n){return tt(n,[tu,Cu])}var Su=et(Xa,eu),Iu=et(zi),ku=_e(qi,Re,rt,Zi),Ou=_e(Re,rt,Zi);function xu(n){return tt(n,[Su,ku],[Iu,Ou])}var Nu="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}},Mu=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,Fu=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"],Pu=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 Bu(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?Bu(s):Math.trunc(s);r[i]+=c,e[t]-=c*o}function _u(n,e){Pu.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?Fu:Mu,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:sr(r,n.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:B.fromObject(r),conversionAccuracy:r.conversionAccuracy})},n.fromISO=function(r,i){var o=bu(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=Du(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 pa(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):Nu},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+=mn(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,sr(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 _u(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 m=0;for(var g in a)m+=this.matrix[g][f]*a[g],a[g]=0;Pe(c[f])&&(m+=c[f]);var v=Math.trunc(m);s[f]=v,a[f]=m-v;for(var E in c)We.indexOf(E)>We.indexOf(f)&&Yi(this.matrix,c,E,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 It="Invalid Interval";function Ru(n,e){return!n||!n.isValid?Pt.invalid("missing or invalid start"):!e||!e.isValid?Pt.invalid("missing or invalid end"):e<n?Pt.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 Pt=(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 ha(o);return new n({invalid:o})},n.fromDateTimes=function(r,i){var o=xt(r),s=xt(i),a=Ru(o,s);return a==null?new n({start:o,end:s}):a},n.after=function(r,i){var o=Fe(i),s=xt(r);return n.fromDateTimes(s,s.plus(o))},n.before=function(r,i){var o=Fe(i),s=xt(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 m=H.fromISO(s,i);if(m.isValid)return n.before(u,m)}}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(xt).filter(function(m){return r.contains(m)}).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 m=f.value;s+=m.type==="s"?1:-1,s===1?o=m.time:(o&&+o!=+m.time&&a.push(n.fromDateTimes(o,m.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()+")":It},e.toISO=function(r){return this.isValid?this.s.toISO(r)+"/"+this.e.toISO(r):It},e.toISODate=function(){return this.isValid?this.s.toISODate()+"/"+this.e.toISODate():It},e.toISOTime=function(r){return this.isValid?this.s.toISOTime(r)+"/"+this.e.toISOTime(r):It},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):It},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})(),Mt=(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=Bt(),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 Lu(n,e,t){for(var r=[["years",function(v,E){return E.year-v.year}],["quarters",function(v,E){return E.quarter-v.quarter}],["months",function(v,E){return E.month-v.month+(E.year-v.year)*12}],["weeks",function(v,E){var y=fi(v,E);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 m=d(n,e);if(s=n.plus((f={},f[u]=m,f)),s>e){var g;n=n.plus((g={},g[u]=m-1,g)),m-=1}else n=s;i[u]=m}}return[n,i,s,o]}function Uu(n,e,t,r){var i=Lu(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 m;return(m=H.fromMillis(l,r)).shiftTo.apply(m,u).plus(f)}else return f}var wn={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]},Gu=wn.hanidec.replace(/[\[|\]]/g,"").split("");function Vu(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(wn.hanidec)!==-1)e+=Gu.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(""+wn[t||"latn"]+e)}var Hu="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(Vu(i))}}}var $u="\xA0",Ki="( |"+$u+")",Ji=new RegExp(Ki,"g");function ju(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(ju).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 lr(i,o)},groups:e}}function gi(n){return{regex:n,deser:function(t){var r=t[0];return r}}}function zu(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function qu(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}"),m=function(y){return{regex:RegExp(zu(y.val)),deser:function(ae){var D=ae[0];return D},literal:!0}},g=function(y){if(n.literal)return m(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,Vr);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,Vr);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 m(y)}},v=g(n)||{invalidReason:Hu};return v.token=n,v}var Zu={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 Wu(n,e,t){var r=n.type,i=n.value;if(r==="literal")return{literal:!0,val:i};var o=t[r],s=Zu[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function Yu(n){var e=n.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",n]}function Ku(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 Ju(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=pn(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 Br=null;function Qu(){return Br||(Br=M.fromMillis(1555555555555)),Br}function Xu(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(Qu()),o=i.map(function(s){return Wu(s,e,t)});return o.includes(void 0)?n:o}function el(n,e){var t;return(t=Array.prototype).concat.apply(t,n.map(function(r){return Xu(r,e)}))}function Qi(n,e,t){var r=el(le.parseFormat(t),n),i=r.map(function(E){return qu(E,n)}),o=i.find(function(E){return E.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=Yu(i),a=s[0],c=s[1],l=RegExp(a,"i"),u=Ku(e,l,c),d=u[0],f=u[1],m=f?Ju(f):[null,null],g=m[0],v=m[1];if(Qe(f,"a")&&Qe(f,"H"))throw new Nt("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 tl(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+(_t(n)?eo:Xi)[e-1]}function no(n,e){var t=_t(n)?eo:Xi,r=t.findIndex(function(o){return o<e}),i=e-t[r];return{month:r+1,day:i}}function Zr(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=or(a)):s>or(e)?(a=e+1,s=1):a=e,Object.assign({weekYear:a,weekNumber:s,weekday:o},cr(n))}function yi(n){var e=n.weekYear,t=n.weekNumber,r=n.weekday,i=to(e,1,4),o=Ft(e),s=t*7+r-i-3,a;s<1?(a=e-1,s+=Ft(a)):s>o?(a=e+1,s-=Ft(e)):a=e;var c=no(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},cr(n))}function _r(n){var e=n.year,t=n.month,r=n.day,i=ro(e,t,r);return Object.assign({year:e,ordinal:i},cr(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},cr(n))}function rl(n){var e=ur(n.weekYear),t=me(n.weekNumber,1,or(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 nl(n){var e=ur(n.year),t=me(n.ordinal,1,Ft(n.year));return e?t?!1:K("ordinal",n.ordinal):K("year",n.year)}function io(n){var e=ur(n.year),t=me(n.month,1,12),r=me(n.day,1,ir(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 Rr="Invalid DateTime",Ei=864e13;function Qt(n){return new ie("unsupported zone",'the zone "'+n.name+'" is not supported')}function Lr(n){return n.weekData===null&&(n.weekData=Zr(n.c)),n.weekData}function kt(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 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 tr(n,e,t){return so(gn(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,ir(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=gn(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 Ot(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,m=e.format,g=m===void 0?"extended":m,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 E=Ye(n,v);return c&&(E="T"+E),E}var ao={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},il={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ol={ordinal:1,hour:0,minute:0,second:0,millisecond:0},uo=["year","month","day","hour","minute","second","millisecond"],sl=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],al=["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=tr(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=mn(d,r||t.calendary?0:2,!0);var m=e.loc.clone(t).relFormatter(t);return m.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:Qt(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():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=ga(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(Qt(s))},n.fromMillis=function(r,i){if(i===void 0&&(i={}),Pe(r))return r<-Ei||r>Ei?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(Qt(i));var o=x.now(),s=i.offset(o),a=sr(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,m=B.fromObject(r);if((d||c)&&f)throw new Nt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new Nt("Can't mix ordinal dates with month/day");var g=f||a.weekday&&!d,v,E,y=wi(o,s);g?(v=sl,E=il,y=Zr(y)):c?(v=al,E=ol,y=_r(y)):(v=uo,E=ao);for(var S=!1,ae=Ae(v),D;!(D=ae()).done;){var L=D.value,xr=a[L];A(xr)?S?a[L]=E[L]:a[L]=y[L]:S=!0}var qs=g?rl(a):c?nl(a):io(a),_n=qs||oo(a);if(_n)return n.invalid(_n);var Zs=g?yi(a):c?vi(a):a,Rn=tr(Zs,s,i),Ws=Rn[0],Ys=Rn[1],Nr=new n({ts:Ws,zone:i,o:Ys,loc:m});return a.weekday&&d&&r.weekday!==Nr.weekday?n.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+Nr.toISO()):Nr},n.fromISO=function(r,i){i===void 0&&(i={});var o=wu(r),s=o[0],a=o[1];return Ot(s,a,i,"ISO 8601",r)},n.fromRFC2822=function(r,i){i===void 0&&(i={});var o=Tu(r),s=o[0],a=o[1];return Ot(s,a,i,"RFC 2822",r)},n.fromHTTP=function(r,i){i===void 0&&(i={});var o=Au(r),s=o[0],a=o[1];return Ot(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=tl(d,r,i),m=f[0],g=f[1],v=f[2];return v?n.invalid(v):Ot(m,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=xu(r),s=o[0],a=o[1];return Ot(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 fa(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(),m=tr(f,d,r);u=m[0]}return kt(this,{ts:u,zone:r})}else return n.invalid(Qt(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 kt(this,{loc:c})},e.setLocale=function(r){return this.reconfigure({locale:r})},e.set=function(r){if(!this.isValid)return this;var i=sr(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 Nt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new Nt("Can't mix ordinal dates with month/day");var d;o?d=yi(Object.assign(Zr(this.c),i)):A(i.ordinal)?(d=Object.assign(this.toObject(),i),A(i.day)&&(d.day=Math.min(ir(d.year,d.month),d.day))):d=vi(Object.assign(_r(this.c),i));var f=tr(d,this.o,this.zone),m=f[0],g=f[1];return kt(this,{ts:m,o:g})},e.plus=function(r){if(!this.isValid)return this;var i=Fe(r);return kt(this,Ti(this,i))},e.minus=function(r){if(!this.isValid)return this;var i=Fe(r).negate();return kt(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):Rr},e.toLocaleString=function(r){return r===void 0&&(r=nr),this.isValid?le.create(this.loc.clone(r),r).formatDateTime(this):Rr},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,m=i.format,g=m===void 0?"extended":m;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():Rr},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=ya(i).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=Uu(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?Pt.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?Lr(this).weekYear:NaN}},{key:"weekNumber",get:function(){return this.isValid?Lr(this).weekNumber:NaN}},{key:"weekday",get:function(){return this.isValid?Lr(this).weekday:NaN}},{key:"ordinal",get:function(){return this.isValid?_r(this.c).ordinal:NaN}},{key:"monthShort",get:function(){return this.isValid?Mt.months("short",{locObj:this.loc})[this.month-1]:null}},{key:"monthLong",get:function(){return this.isValid?Mt.months("long",{locObj:this.loc})[this.month-1]:null}},{key:"weekdayShort",get:function(){return this.isValid?Mt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}},{key:"weekdayLong",get:function(){return this.isValid?Mt.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 _t(this.year)}},{key:"daysInMonth",get:function(){return ir(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?Ft(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?or(this.weekYear):NaN}}],[{key:"DATE_SHORT",get:function(){return nr}},{key:"DATE_MED",get:function(){return Wr}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return Ii}},{key:"DATE_FULL",get:function(){return Yr}},{key:"DATE_HUGE",get:function(){return Kr}},{key:"TIME_SIMPLE",get:function(){return Jr}},{key:"TIME_WITH_SECONDS",get:function(){return Qr}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return Xr}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return en}},{key:"TIME_24_SIMPLE",get:function(){return tn}},{key:"TIME_24_WITH_SECONDS",get:function(){return rn}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return nn}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return on}},{key:"DATETIME_SHORT",get:function(){return sn}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return an}},{key:"DATETIME_MED",get:function(){return un}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return ln}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return ki}},{key:"DATETIME_FULL",get:function(){return cn}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return dn}},{key:"DATETIME_HUGE",get:function(){return fn}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return hn}}]),n})();function xt(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 ul="1.28.1";z.DateTime=M;z.Duration=H;z.FixedOffsetZone=$;z.IANAZone=ce;z.Info=Mt;z.Interval=Pt;z.InvalidZone=Hr;z.LocalZone=Vi;z.Settings=x;z.VERSION=ul;z.Zone=Xe});var Il={};ra(Il,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>ut,Agent:()=>lt,Amount:()=>w,App:()=>Ee,Backlog:()=>At,Balance:()=>ke,BalanceType:()=>be,BalancesDataTableBuilder:()=>pe,BalancesReport:()=>wt,Billing:()=>pt,Bkper:()=>k,BkperError:()=>ue,Book:()=>X,BooksDataTableBuilder:()=>Or,BotResponse:()=>ft,BotResponseType:()=>ot,Collaborator:()=>ct,Collection:()=>Se,Connection:()=>je,DecimalSeparator:()=>He,Event:()=>mt,EventList:()=>gt,EventType:()=>mr,File:()=>he,FileList:()=>yt,Group:()=>Q,GroupsDataTableBuilder:()=>bt,Integration:()=>ee,MenuOpenMode:()=>it,Month:()=>pr,Period:()=>hr,Periodicity:()=>Ut,Permission:()=>nt,Query:()=>Tt,Template:()=>Dt,Transaction:()=>Z,TransactionList:()=>vt,TransactionStatus:()=>ge,TransactionsDataTableBuilder:()=>Ct,User:()=>Ie,Visibility:()=>fr});var ue=class extends Error{constructor(e,t,r){super(t),this.name="BkperError",this.code=e,this.reason=r}};var oa=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 oa(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 St=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())})},sa="https://api.bkper.app";function aa(n){return n.apiBaseUrl?n.apiBaseUrl:sa}var te=class extends qe{constructor(e,t){let r=aa(t);super(`${r}/${e}`),this.retry=0,this.config=t,this.requestPath=e}fetch(){let e=Object.create(null,{execute:{get:()=>super.execute}});return St(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 m=((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 m?new ue(m.code,m.message,(c=(a=m.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 St(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 St(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 St(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 St(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})}},h=class extends te{constructor(e,t){super(`v5/books/${e}`,t)}},O=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 Un(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new h(`${n}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Gn(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new h(`${n}/accounts/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Vn(n,e,t){return we(this,void 0,void 0,function*(){var r=e,i=yield new h(`${n}/accounts`,t).setMethod("PUT").setPayload(r).fetch();return i.data})}function Hn(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new h(`${n}/accounts/batch`,t).setMethod("PUT").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function $n(n,e,t){return we(this,void 0,void 0,function*(){var r=yield new h(`${n}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function jn(n,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new h(`${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 we(this,void 0,void 0,function*(){return(yield new h(`${n}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function qn(n,e){return we(this,void 0,void 0,function*(){var t;let r=yield new h(`${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 h(`${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 h(`${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 h(`${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 h(`${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 h(`${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 h(`${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 h(`${n}/groups/${encodeURIComponent(e)}/accounts`,t).setMethod("GET").fetch(),i=r.data;return i!=null&&i.items?i.items:[]})}var Gt=na(lo(),1);var ll=20,cl=1,Le=1e6,co=1e6,dl=-7,fl=21,hl=!1,Rt="[big.js] ",Ue=Rt+"Invalid ",dr=Ue+"decimal places",pl=Ue+"rounding mode",fo=Rt+"Division by zero",C={},fe=void 0,ml=/^-?(\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)}gl(t,e)}t.constructor=n}return n.prototype=C,n.DP=ll,n.RM=cl,n.NE=dl,n.PE=fl,n.strict=hl,n.roundDown=0,n.roundHalfUp=1,n.roundHalfEven=2,n.roundUp=3,n}function gl(n,e){var t,r,i;if(!ml.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(pl);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(dr);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(),m=a=i.length,g=r.length,v=r.slice(0,a),E=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);E++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(E=v.length))u=a>E?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=E==a?i:f;E;){if(v[--E]<c[E]){for(d=E;d&&!v[--d];)v[d]=9;--v[d],v[E]+=10}v[E]-=c[E]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[E]=r[m]||0:v=[r[m]]}while((m++<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(dr);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(Rt+"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(dr);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(dr);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(Rt+"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(Rt+"valueOf disallowed");return Ve(n,n.e<=e.NE||n.e>=e.PE,!0)};var yl=ho(),Lt=yl;var w=class n{constructor(e){this.checkNumberNotNull(e),typeof e=="string"?this.big=new Lt(e):e instanceof n?this.big=new Lt(e.big):e.toString?this.big=new Lt(e.toString()):this.big=new Lt(+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 Ut;(function(n){n.DAILY="DAILY",n.MONTHLY="MONTHLY",n.YEARLY="YEARLY"})(Ut||(Ut={}));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 fr;(function(n){n.PUBLIC="PUBLIC",n.PRIVATE="PRIVATE"})(fr||(fr={}));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 hr;(function(n){n.MONTH="MONTH",n.QUARTER="QUARTER",n.YEAR="YEAR"})(hr||(hr={}));var pr;(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"})(pr||(pr={}));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 mr;(function(n){n.FILE_CREATED="FILE_CREATED",n.FILE_UPDATED="FILE_UPDATED",n.FILE_DELETED="FILE_DELETED",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"})(mr||(mr={}));function yr(n,e){return e<=0?"":e===1?n:n+yr(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 gr=null;function vr(n,e){return n==null&&(n=new w("0")),e?new w(n).round(e):new w(n).round(2)}function ye(n,e,t){if(n==null)return"";if(typeof n=="string"){if(n.trim()=="")return"";n=new w(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 Er(n,e){if(n!=null){if(!isNaN(+n)&&isFinite(+n))return new w(n);e==He.DOT?n=n.replace(/\,/g,""):n=n.replace(/\./g,"").replace(/\,/g,".");try{return new w(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=An(t,r,i,e);return o}function An(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 Vt(n,e,t){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!t||t=="")&&(t="UTC"),e?Gt.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"),Gt.DateTime.fromJSDate(n,{zone:e}).toISODate())}function st(n){return+n.replace(/-/g,"")}function wr(n,e,t){e||(e="yyyy-MM-dd");let r=Gt.DateTime.fromFormat(n,e,{zone:t}).toJSDate();return r instanceof Date&&!isNaN(r.getTime())?r:Gt.DateTime.fromFormat(n,"yyyy-MM-dd",{zone:t}).toJSDate()}function q(n,e){return n==null?new w(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 Ht(n,"_")}function Ht(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=vl(n.trim().toLowerCase()),e&&(n=n.replace(new RegExp(" ","g"),e)),n)}function vl(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(gr==null){gr={};for(var n=0;n<Tn.length;n++)for(var e=Tn[n].letters.split(""),t=0;t<e.length;t++)gr[e[t]]=Tn[n].base}return gr}var Tn=[{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 $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())})},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 $t(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:Ht(this.getName())}getAccounts(){return $t(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 $t(this,void 0,void 0,function*(){return this.payload=yield Wn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return $t(this,void 0,void 0,function*(){return this.payload=yield Kn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return $t(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:Ht(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 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 vo(n){return Ar(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 Eo(n,e){return Ar(this,void 0,void 0,function*(){return(yield new te(`v5/apps/${n}`,e).setMethod("GET").fetch()).data})}function wo(n,e){return Ar(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 Ar(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 h("",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 h(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 h("",e).setMethod("POST").setPayload(n).fetch()).data})}function So(n,e,t){return De(this,void 0,void 0,function*(){var r=yield new h(`${n}`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Io(n,e){return De(this,void 0,void 0,function*(){new h(`${n}/audit`,e).setMethod("PATCH").fetch()})}function ko(n,e){return De(this,void 0,void 0,function*(){var t;let r=yield new h(`${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 h(`${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 h(`${n}`,e).setMethod("DELETE").fetch()).data})}var br=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 br(this,void 0,void 0,function*(){var t;let r=yield new h(`${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 br(this,void 0,void 0,function*(){return(yield new h(`${n}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Po(n,e,t){return br(this,void 0,void 0,function*(){return(yield new h(`${n}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function Bo(n,e,t){return br(this,void 0,void 0,function*(){return(yield new h(`${n}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}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())})};function Ro(n,e,t){return El(this,void 0,void 0,function*(){var r;let i=yield new h(`${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 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 Lo(n,e,t){return jt(this,void 0,void 0,function*(){var r=yield new h(`${n}/files`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Cr(n,e,t){return jt(this,void 0,void 0,function*(){var r=yield new h(`${n}/files/${e}`,t).setMethod("GET").fetch();return r.data})}function Uo(n,e,t,r){return jt(this,void 0,void 0,function*(){e||(e=100);let i=new h(`${n}/files`,r);return i.addParam("limit",e),t!=null&&i.setHeader("cursor",t),(yield i.fetch()).data})}function Go(n,e,t){return jt(this,void 0,void 0,function*(){return(yield new h(`${n}/files`,t).setMethod("PUT").setPayload(e).fetch()).data})}function Vo(n,e,t){return jt(this,void 0,void 0,function*(){return(yield new h(`${n}/files/${e.id}`,t).setMethod("DELETE").fetch()).data})}var Dr=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){return Dr(this,void 0,void 0,function*(){var t;let r=yield new h(`${n}/integrations`,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){return Dr(this,void 0,void 0,function*(){return(yield new h(`${n}/integrations`,t).setPayload(e).setMethod("POST").fetch()).data})}function zt(n,e,t){return Dr(this,void 0,void 0,function*(){return(yield new h(`${n}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function jo(n,e,t){return Dr(this,void 0,void 0,function*(){return(yield new h(`${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 qo(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Zo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Wo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;return r=yield(yield new h(`${n}/transactions/batch`,t).setMethod("POST").setPayload(i).fetch()).data,r!=null&&r.items!=null?r.items:[]})}function Yo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;return i=yield(yield new h(`${n}/transactions/batch`,r).setMethod("PUT").setPayload(o).addParam("updateChecked",t).fetch()).data,i!=null&&i.items!=null?i.items:[]})}function Ko(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Jo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Qo(n,e,t,r){return _(this,void 0,void 0,function*(){let i={items:e},o=i;i=yield(yield new h(`${n}/transactions/trash/batch`,r).setMethod("PATCH").setPayload(o).addParam("trashChecked",t).fetch()).data})}function Xo(n,e,t){return _(this,void 0,void 0,function*(){let r={items:e},i=r;r=yield(yield new h(`${n}/transactions/untrash/batch`,t).setMethod("PATCH").setPayload(i).fetch()).data})}function es(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function ts(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/post`,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 h(`${n}/transactions/check`,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 h(`${n}/transactions/uncheck`,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 h(`${n}/transactions/trash`,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 h(`${n}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ss(n,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function as(n,e,t,r,i){return _(this,void 0,void 0,function*(){e||(e=""),t||(t=100);var o=new h(`${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 us(n,e,t){return _(this,void 0,void 0,function*(){let r=Object.assign({},e);return(yield new h(`${n}/transactions/merge`,t).setMethod("PATCH").setPayload(r).fetch()).data})}function ls(n,e,t){return _(this,void 0,void 0,function*(){return(yield new h(`${n}/transactions/count`,t).setMethod("GET").addParam("query",e).fetch()).data})}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 ds(n,e,t,r,i,o,s,a,c){return qt(this,void 0,void 0,function*(){let l=new h(`${n.getId()}/events`,c);l.addParam("after",e),l.addParam("before",t),l.addParam("error",r),l.addParam("resoureId",i),l.addParam("type",o),l.addParam("limit",s),a!=null&&l.setHeader("cursor",a);var u=yield l.fetch();return u.data})}function fs(n,e,t,r){return qt(this,void 0,void 0,function*(){return(yield new h(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("PUT").fetch()).data})}function hs(n,e,t,r){return qt(this,void 0,void 0,function*(){return(yield new h(`${n.getId()}/events/${e}/responses/${t}`,r).setMethod("DELETE").fetch()).data})}function ps(n,e,t,r){return qt(this,void 0,void 0,function*(){let i=new h(`${n.getId()}/events/replay/batch`,r).setMethod("PATCH").setPayload(e);t&&i.addParam("errorsOnly",t),yield i.fetch()})}function ms(n,e){return qt(this,void 0,void 0,function*(){return(yield new h(`${n.getId()}/events/backlog`,e).setMethod("GET").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())})};function ys(n,e){return Cn(this,void 0,void 0,function*(){var t;let r=yield new h(`${n}/collaborators`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Dn(n,e,t,r){return Cn(this,void 0,void 0,function*(){let i=new h(`${n}/collaborators`,r).setMethod("POST").setPayload(e);return t&&(i=i.addParam("message",t)),(yield i.fetch()).data})}function vs(n,e,t){return Cn(this,void 0,void 0,function*(){return(yield new h(`${n}/collaborators/${e}`,t).setMethod("DELETE").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())})},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}getAvatarUrl(){return this.payload.avatarUrl}create(e){return Sn(this,void 0,void 0,function*(){return this.payload=yield Dn(this.book.getId(),this.payload,e,this.getConfig()),this.book.clearCollaboratorCache(),this})}update(){return Sn(this,void 0,void 0,function*(){return this.payload=yield Dn(this.book.getId(),this.payload,void 0,this.getConfig()),this.book.clearCollaboratorCache(),this})}remove(){return Sn(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield vs(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 Ts(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("POST").setPayload(n).fetch()).data})}function As(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("PUT").setPayload(n).fetch()).data})}function bs(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 Cs(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 Ds(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 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())})},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 Zt(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[]})}removeBooks(e){return Zt(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 Ds(t,r,this.getConfig())).map(o=>new X(o,this.config))}return[]})}getUpdatedAt(){return this.payload.updatedAt}create(){return Zt(this,void 0,void 0,function*(){return this.payload=yield Ts(this.payload,this.getConfig()),this})}update(){return Zt(this,void 0,void 0,function*(){return this.payload=yield As(this.payload,this.getConfig()),this})}remove(){return Zt(this,void 0,void 0,function*(){return(yield bs(this.payload,this.getConfig())).map(t=>new X(t,this.config))})}};var Is=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 Is(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})}remove(){return Is(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 hs(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 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 ks(n,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("GET").fetch()).data})}function Os(n){return ht(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 xs(n,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("POST").fetch()).data})}function Ns(n,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("PUT").fetch()).data})}function Ms(n,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("DELETE").fetch()).data})}function Fs(n,e){return ht(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 Bs=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}setName(e){return this.payload.name=e,this}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}update(){return Bs(this,void 0,void 0,function*(){let e=this.getBookId();return e&&(this.payload=yield zt(e,this.payload,this.getConfig())),this})}remove(){return Bs(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield jo(e,t,this.getConfig())),this})}};var Sr=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 Sr(this,void 0,void 0,function*(){let e=this.getId();return e?(yield Fs(e,this.getConfig())).map(i=>new ee(i,this.config)):[]})}create(){return Sr(this,void 0,void 0,function*(){return this.payload=yield xs(this.payload,this.getConfig()),this})}update(){return Sr(this,void 0,void 0,function*(){return this.payload=yield Ns(this.payload,this.getConfig()),this})}remove(){return Sr(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield Ms(e,this.getConfig())),this})}};var Wt=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 _s(n){return Wt(this,void 0,void 0,function*(){return(yield new O("user",n).setMethod("GET").fetch()).data})}function Rs(n){return Wt(this,void 0,void 0,function*(){return(yield new O("user/billing",n).setMethod("GET").fetch()).data})}function Ls(n){return Wt(this,void 0,void 0,function*(){return(yield new O("user/billing/counts",n).setMethod("GET").fetch()).data})}function Us(n,e){return Wt(this,void 0,void 0,function*(){return(yield new O("user/billing/portal",e).addParam("returnUrl",n).fetch()).data})}function Gs(n,e,t,r,i){return Wt(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 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())})},pt=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 kn(this,void 0,void 0,function*(){return yield Ls(this.getConfig())})}getPortalUrl(e){return kn(this,void 0,void 0,function*(){let t=yield Us(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,i){return kn(this,void 0,void 0,function*(){let o=yield Gs(e,t,r,i,this.getConfig());return o==null?void 0:o.url})}};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 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}getPlanCycle(){return this.payload.planCycle}getUsername(){return this.payload.username}getBilling(){return On(this,void 0,void 0,function*(){let e=yield Rs(this.getConfig());return new pt(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return On(this,void 0,void 0,function*(){return(yield Os(this.getConfig())).map(t=>new je(t,this.config))})}getConnection(e){return On(this,void 0,void 0,function*(){let t=yield ks(e,this.getConfig());return new je(t,this.config)})}};var mt=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 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;return((e=this.payload.items)===null||e===void 0?void 0:e.map(t=>new mt(this.book,t)))||[]}};var Ir=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 Ir(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 Cr(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}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}create(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Lo(this.book.getId(),this.payload,this.getConfig()),this})}update(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Go(this.book.getId(),this.payload,this.getConfig()),this})}remove(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Vo(this.book.getId(),this.payload,this.getConfig()),this})}};var yt=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 Vs(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,Tl=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(Tl)}var Al=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mn={randomUUID:Al};function bl(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 Vs(r)}var Fn=bl;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 w(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=Er(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new w(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=wr(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 Vt(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 Vt(this.getUpdatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCaEvolvedBalance_(){return this.payload.creditAccount!=null&&this.payload.creditAccount.balance!=null?new w(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new w(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 vr(t,this.book.getFractionDigits())}else return})}create(){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})}update(){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})}check(){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})}uncheck(){return N(this,void 0,void 0,function*(){var e;let t=yield ns(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 ts(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 is(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 os(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}};var Cl=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){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getAccount(){return Cl(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=An(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 w(this.payload.cumulativeBalance)}getCumulativeCredit(){return new w(this.payload.cumulativeCredit)}getCumulativeDebit(){return new w(this.payload.cumulativeDebit)}getPeriodBalance(){return q(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new w(this.payload.periodBalance)}getPeriodCredit(){return new w(this.payload.periodCredit)}getPeriodDebit(){return new w(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 w(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=yr(" ",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=yr(" ",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 m=t[f],g=new Array;g.push(m.date);for(let D of s){var u=m[D.getName()];u==null?u="null_amount":(u=new w(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,E=0;E<d.length;E++){var g=d[E];if(E==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new w(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 w(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(xr=>xr[L]))),e}};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())})},Et=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 Hs(this,void 0,void 0,function*(){return null})}getAccount(){return Hs(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 w(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new w(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new w(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new w(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 w(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new w(this.payload.periodBalance||0)}getPeriodCredit(){return new w(this.payload.periodCredit||0)}getPeriodDebit(){return new w(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 $s=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())})},kr=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 $s(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getGroup(this.getNormalizedName()))||null})}getAccount(){return $s(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 w(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new w(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new w(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new w(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 w(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new w(this.payload.periodBalance||0)}getPeriodCredit(){return new w(this.payload.periodCredit||0)}getPeriodDebit(){return new w(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 Et(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 Et(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 kr(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())})},Tt=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 At=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getCount(){return this.payload.count}};var bt=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())})},Ct=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()),Vt(e,this.getDatePattern(),t)}parseDate(e){return wr(e,this.getDatePattern(),this.getTimeZone())}formatValue(e){return e?ye(e,this.getDecimalSeparator(),this.getFractionDigits()):""}parseValue(e){return Er(e,this.getDecimalSeparator())}round(e){return vr(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 Wo(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 Zo(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 Yo(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 Ko(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 Jo(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 Qo(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 Xo(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 us(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 ps(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 Ee(t,this.config)),this.apps})}getIntegrations(){return T(this,void 0,void 0,function*(){return(yield $o(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 bn(this.getId(),e.json(),this.getConfig()):e=yield bn(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 zt(this.getId(),e.json(),this.getConfig()):e=yield zt(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 as(this.getId(),e,t,r,this.getConfig());return new vt(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 yt(this,r)})}countTransactions(e){return T(this,void 0,void 0,function*(){return(yield ls(this.getId(),e,this.getConfig())).total})}listEvents(e,t,r,i,o,s){return T(this,void 0,void 0,function*(){if(typeof e=="object"&&e!==null)return this.listEventsWithOptions(e);let c={afterDate:e!=null?e:void 0,beforeDate:t!=null?t:void 0,resourceId:i!=null?i:void 0,onError:r!=null?r:void 0,type:void 0,limit:o!=null?o:50,cursor:s};return this.listEventsWithOptions(c)})}listEventsWithOptions(e){return T(this,void 0,void 0,function*(){let t=yield ds(this,e.afterDate,e.beforeDate,e.onError,e.resourceId,e.type,e.limit,e.cursor,this.getConfig());return new gt(this,t)})}getTransaction(e){return T(this,void 0,void 0,function*(){let t=yield ss(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 Cr(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 Tt(this,t))}return this.queries})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield ys(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 ms(this,this.getConfig());return new At(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 bt(e)})}createTransactionsDataTable(e,t){return new Ct(this,e,t)}};var Dl=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 js(n){return Dl(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 Dt=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 Ee(t,this.config))})}getApp(e){return ze(this,void 0,void 0,function*(){let t=yield Eo(e,this.config);return new Ee(t,this.config)})}getTemplates(){return ze(this,void 0,void 0,function*(){return(yield js(this.config)).map(t=>new Dt(t,this.config))})}getUser(){return ze(this,void 0,void 0,function*(){let e=yield _s(this.config);return new Ie(e,this.config)})}};k.globalConfig={};var zs=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 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 zs(this,void 0,void 0,function*(){return yield wo(this.payload,this.getConfig()),this})}update(){return zs(this,void 0,void 0,function*(){return yield To(this.payload,this.getConfig()),this})}};var Or=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 ia(Il);})();
1
+ "use strict";var bkperjs=(()=>{var Qs=Object.create;var Kt=Object.defineProperty;var Xs=Object.getOwnPropertyDescriptor;var ea=Object.getOwnPropertyNames;var ta=Object.getPrototypeOf,ra=Object.prototype.hasOwnProperty;var ia=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),na=(i,e)=>{for(var t in e)Kt(i,t,{get:e[t],enumerable:!0})},Li=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ea(e))!ra.call(i,n)&&n!==t&&Kt(i,n,{get:()=>e[n],enumerable:!(r=Xs(e,n))||r.enumerable});return i};var oa=(i,e,t)=>(t=i!=null?Qs(ta(i)):{},Li(e||!i||!i.__esModule?Kt(t,"default",{value:i,enumerable:!0}):t,i)),sa=i=>Li(Kt({},"__esModule",{value:!0}),i);var co=ia(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});function rn(i,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(i,r.key,r)}}function oe(i,e,t){return e&&rn(i.prototype,e),t&&rn(i,t),i}function J(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.__proto__=e}function Gr(i){return Gr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Gr(i)}function ir(i,e){return ir=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},ir(i,e)}function ca(){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(i){return!1}}function er(i,e,t){return ca()?er=Reflect.construct:er=function(n,o,s){var a=[null];a.push.apply(a,o);var c=Function.bind.apply(n,a),l=new c;return s&&ir(l,s.prototype),l},er.apply(null,arguments)}function da(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function Vr(i){var e=typeof Map=="function"?new Map:void 0;return Vr=function(r){if(r===null||!da(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,n)}function n(){return er(r,arguments,Gr(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ir(n,r)},Vr(i)}function fa(i,e){if(i==null)return{};var t={},r=Object.keys(i),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(t[n]=i[n]);return t}function ha(i,e){if(i){if(typeof i=="string")return nn(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return nn(i,e)}}function nn(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}function Ae(i){var e=0;if(typeof Symbol=="undefined"||i[Symbol.iterator]==null){if(Array.isArray(i)||(i=ha(i)))return function(){return e>=i.length?{done:!0}:{done:!1,value:i[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=i[Symbol.iterator](),e.next.bind(e)}var _e=(function(i){J(e,i);function e(){return i.apply(this,arguments)||this}return e})(Vr(Error)),pa=(function(i){J(e,i);function e(t){return i.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(_e),ma=(function(i){J(e,i);function e(t){return i.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(_e),ga=(function(i){J(e,i);function e(t){return i.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(_e),Nt=(function(i){J(e,i);function e(){return i.apply(this,arguments)||this}return e})(_e),In=(function(i){J(e,i);function e(t){return i.call(this,"Invalid unit "+t)||this}return e})(_e),Y=(function(i){J(e,i);function e(){return i.apply(this,arguments)||this}return e})(_e),Te=(function(i){J(e,i);function e(){return i.call(this,"Zone is an abstract class")||this}return e})(_e),p="numeric",se="short",j="long",nr={year:p,month:p,day:p},Yr={year:p,month:se,day:p},kn={year:p,month:se,day:p,weekday:se},Kr={year:p,month:j,day:p},Jr={year:p,month:j,day:p,weekday:j},Qr={hour:p,minute:p},Xr={hour:p,minute:p,second:p},ei={hour:p,minute:p,second:p,timeZoneName:se},ti={hour:p,minute:p,second:p,timeZoneName:j},ri={hour:p,minute:p,hour12:!1},ii={hour:p,minute:p,second:p,hour12:!1},ni={hour:p,minute:p,second:p,hour12:!1,timeZoneName:se},oi={hour:p,minute:p,second:p,hour12:!1,timeZoneName:j},si={year:p,month:p,day:p,hour:p,minute:p},ai={year:p,month:p,day:p,hour:p,minute:p,second:p},ui={year:p,month:se,day:p,hour:p,minute:p},li={year:p,month:se,day:p,hour:p,minute:p,second:p},On={year:p,month:se,day:p,weekday:se,hour:p,minute:p},ci={year:p,month:j,day:p,hour:p,minute:p,timeZoneName:se},di={year:p,month:j,day:p,hour:p,minute:p,second:p,timeZoneName:se},fi={year:p,month:j,day:p,weekday:j,hour:p,minute:p,timeZoneName:j},hi={year:p,month:j,day:p,weekday:j,hour:p,minute:p,second:p,timeZoneName:j};function A(i){return typeof i=="undefined"}function Be(i){return typeof i=="number"}function lr(i){return typeof i=="number"&&i%1===0}function ya(i){return typeof i=="string"}function va(i){return Object.prototype.toString.call(i)==="[object Date]"}function de(){try{return typeof Intl!="undefined"&&Intl.DateTimeFormat}catch(i){return!1}}function Bt(){return!A(Intl.DateTimeFormat.prototype.formatToParts)}function xn(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(i){return!1}}function Ea(i){return Array.isArray(i)?i:[i]}function on(i,e,t){if(i.length!==0)return i.reduce(function(r,n){var o=[e(n),n];return r&&t(r[0],o[0])===r[0]?r:o},null)[1]}function Nn(i,e){return e.reduce(function(t,r){return t[r]=i[r],t},{})}function Xe(i,e){return Object.prototype.hasOwnProperty.call(i,e)}function me(i,e,t){return lr(i)&&i>=e&&i<=t}function wa(i,e){return i-e*Math.floor(i/e)}function Je(i,e){e===void 0&&(e=2);var t=i<0?"-":"",r=t?i*-1:i,n;return r.toString().length<e?n=("0".repeat(e)+r).slice(-e):n=r.toString(),""+t+n}function V(i){if(!(A(i)||i===null||i===""))return parseInt(i,10)}function pi(i){if(!(A(i)||i===null||i==="")){var e=parseFloat("0."+i)*1e3;return Math.floor(e)}}function mi(i,e,t){t===void 0&&(t=!1);var r=Math.pow(10,e),n=t?Math.trunc:Math.round;return n(i*r)/r}function _t(i){return i%4===0&&(i%100!==0||i%400===0)}function Ft(i){return _t(i)?366:365}function or(i,e){var t=wa(e-1,12)+1,r=i+(e-t)/12;return t===2?_t(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function gi(i){var e=Date.UTC(i.year,i.month-1,i.day,i.hour,i.minute,i.second,i.millisecond);return i.year<100&&i.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function sr(i){var e=(i+Math.floor(i/4)-Math.floor(i/100)+Math.floor(i/400))%7,t=i-1,r=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||r===3?53:52}function Hr(i){return i>99?i:i>60?1900+i:2e3+i}function Mn(i,e,t,r){r===void 0&&(r=null);var n=new Date(i),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&&Bt()){var c=new Intl.DateTimeFormat(t,s).formatToParts(n).find(function(m){return m.type.toLowerCase()==="timezonename"});return c?c.value:null}else if(a){var l=new Intl.DateTimeFormat(t,o).format(n),u=new Intl.DateTimeFormat(t,s).format(n),d=u.substring(l.length),f=d.replace(/^[, \u200e]+/,"");return f}else return null}function cr(i,e){var t=parseInt(i,10);Number.isNaN(t)&&(t=0);var r=parseInt(e,10)||0,n=t<0||Object.is(t,-0)?-r:r;return t*60+n}function Fn(i){var e=Number(i);if(typeof i=="boolean"||i===""||Number.isNaN(e))throw new Y("Invalid unit value "+i);return e}function ar(i,e,t){var r={};for(var n in i)if(Xe(i,n)){if(t.indexOf(n)>=0)continue;var o=i[n];if(o==null)continue;r[e(n)]=Fn(o)}return r}function ur(i,e){var t=Math.trunc(Math.abs(i/60)),r=Math.trunc(Math.abs(i%60)),n=i>=0?"+":"-";switch(e){case"short":return""+n+Je(t,2)+":"+Je(r,2);case"narrow":return""+n+t+(r>0?":"+r:"");case"techie":return""+n+Je(t,2)+Je(r,2);default:throw new RangeError("Value format "+e+" is out of range for property format")}}function dr(i){return Nn(i,["hour","minute","second","millisecond"])}var Pn=/[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/;function I(i){return JSON.stringify(i,Object.keys(i).sort())}var Ta=["January","February","March","April","May","June","July","August","September","October","November","December"],Bn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Aa=["J","F","M","A","M","J","J","A","S","O","N","D"];function _n(i){switch(i){case"narrow":return[].concat(Aa);case"short":return[].concat(Bn);case"long":return[].concat(Ta);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 Rn=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ln=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ba=["M","T","W","T","F","S","S"];function Un(i){switch(i){case"narrow":return[].concat(ba);case"short":return[].concat(Ln);case"long":return[].concat(Rn);case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Gn=["AM","PM"],Ca=["Before Christ","Anno Domini"],Da=["BC","AD"],Sa=["B","A"];function Vn(i){switch(i){case"narrow":return[].concat(Sa);case"short":return[].concat(Da);case"long":return[].concat(Ca);default:return null}}function Ia(i){return Gn[i.hour<12?0:1]}function ka(i,e){return Un(e)[i.weekday-1]}function Oa(i,e){return _n(e)[i.month-1]}function xa(i,e){return Vn(e)[i.year<0?0:1]}function Na(i,e,t,r){t===void 0&&(t="always"),r===void 0&&(r=!1);var n={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(i)===-1;if(t==="auto"&&o){var s=i==="days";switch(e){case 1:return s?"tomorrow":"next "+n[i][0];case-1:return s?"yesterday":"last "+n[i][0];case 0:return s?"today":"this "+n[i][0]}}var a=Object.is(e,-0)||e<0,c=Math.abs(e),l=c===1,u=n[i],d=r?l?u[1]:u[2]||u[1]:l?n[i][0]:i;return a?c+" "+d+" ago":"in "+c+" "+d}function Ma(i){var e=Nn(i,["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(nr):return"M/d/yyyy";case I(Yr):return"LLL d, yyyy";case I(kn):return"EEE, LLL d, yyyy";case I(Kr):return"LLLL d, yyyy";case I(Jr):return"EEEE, LLLL d, yyyy";case I(Qr):return"h:mm a";case I(Xr):return"h:mm:ss a";case I(ei):return"h:mm a";case I(ti):return"h:mm a";case I(ri):return"HH:mm";case I(ii):return"HH:mm:ss";case I(ni):return"HH:mm";case I(oi):return"HH:mm";case I(si):return"M/d/yyyy, h:mm a";case I(ui):return"LLL d, yyyy, h:mm a";case I(ci):return"LLLL d, yyyy, h:mm a";case I(fi):return r;case I(ai):return"M/d/yyyy, h:mm:ss a";case I(li):return"LLL d, yyyy, h:mm:ss a";case I(On):return"EEE, d LLL yyyy, h:mm a";case I(di):return"LLLL d, yyyy, h:mm:ss a";case I(hi):return"EEEE, LLLL d, yyyy, h:mm:ss a";default:return r}}function sn(i,e){for(var t="",r=Ae(i),n;!(n=r()).done;){var o=n.value;o.literal?t+=o.val:t+=e(o.val)}return t}var Fa={D:nr,DD:Yr,DDD:Kr,DDDD:Jr,t:Qr,tt:Xr,ttt:ei,tttt:ti,T:ri,TT:ii,TTT:ni,TTTT:oi,f:si,ff:ui,fff:ci,ffff:fi,F:ai,FF:li,FFF:di,FFFF:hi},le=(function(){i.create=function(r,n){return n===void 0&&(n={}),new i(r,n)},i.parseFormat=function(r){for(var n=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}),n=null,o="",s=!s):s||l===n?o+=l:(o.length>0&&a.push({literal:!1,val:o}),o=l,n=l)}return o.length>0&&a.push({literal:s,val:o}),a},i.macroTokenToFormatOpts=function(r){return Fa[r]};function i(t,r){this.opts=r,this.loc=t,this.systemLoc=null}var e=i.prototype;return e.formatWithSystemDefault=function(r,n){this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem());var o=this.systemLoc.dtFormatter(r,Object.assign({},this.opts,n));return o.format()},e.formatDateTime=function(r,n){n===void 0&&(n={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,n));return o.format()},e.formatDateTimeParts=function(r,n){n===void 0&&(n={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,n));return o.formatToParts()},e.resolvedOptions=function(r,n){n===void 0&&(n={});var o=this.loc.dtFormatter(r,Object.assign({},this.opts,n));return o.resolvedOptions()},e.num=function(r,n){if(n===void 0&&(n=0),this.opts.forceSimple)return Je(r,n);var o=Object.assign({},this.opts);return n>0&&(o.padTo=n),this.loc.numberFormatter(o).format(r)},e.formatDateTimeFromString=function(r,n){var o=this,s=this.loc.listingMode()==="en",a=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory"&&Bt(),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?Ia(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?Oa(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?ka(r,y):c(S?{weekday:y}:{weekday:y,month:"long",day:"numeric"},"weekday")},m=function(y){var S=i.macroTokenToFormatOpts(y);return S?o.formatWithSystemDefault(r,S):y},g=function(y){return s?xa(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 m(y)}};return sn(i.parseFormat(n),v)},e.formatDurationFromString=function(r,n){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(m){var g=s(m);return g?o.num(f.get(g),m.length):m}},c=i.parseFormat(n),l=c.reduce(function(d,f){var m=f.literal,g=f.val;return m?d:d.concat(g)},[]),u=r.shiftTo.apply(r,l.map(s).filter(function(d){return d}));return sn(c,a(u))},i})(),ne=(function(){function i(t,r){this.reason=t,this.explanation=r}var e=i.prototype;return e.toMessage=function(){return this.explanation?this.reason+": "+this.explanation:this.reason},i})(),et=(function(){function i(){}var e=i.prototype;return e.offsetName=function(r,n){throw new Te},e.formatOffset=function(r,n){throw new Te},e.offset=function(r){throw new Te},e.equals=function(r){throw new Te},oe(i,[{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}}]),i})(),Fr=null,Hn=(function(i){J(e,i);function e(){return i.apply(this,arguments)||this}var t=e.prototype;return t.offsetName=function(n,o){var s=o.format,a=o.locale;return Mn(n,s,a)},t.formatOffset=function(n,o){return ur(this.offset(n),o)},t.offset=function(n){return-new Date(n).getTimezoneOffset()},t.equals=function(n){return n.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 Fr===null&&(Fr=new e),Fr}}]),e})(et),Pa=RegExp("^"+Pn.source+"$"),tr={};function Ba(i){return tr[i]||(tr[i]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),tr[i]}var _a={year:0,month:1,day:2,hour:3,minute:4,second:5};function Ra(i,e){var t=i.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t),n=r[1],o=r[2],s=r[3],a=r[4],c=r[5],l=r[6];return[s,n,o,a,c,l]}function La(i,e){for(var t=i.formatToParts(e),r=[],n=0;n<t.length;n++){var o=t[n],s=o.type,a=o.value,c=_a[s];A(c)||(r[c]=parseInt(a,10))}return r}var Jt={},ce=(function(i){J(e,i),e.create=function(n){return Jt[n]||(Jt[n]=new e(n)),Jt[n]},e.resetCache=function(){Jt={},tr={}},e.isValidSpecifier=function(n){return!!(n&&n.match(Pa))},e.isValidZone=function(n){try{return new Intl.DateTimeFormat("en-US",{timeZone:n}).format(),!0}catch(o){return!1}},e.parseGMTOffset=function(n){if(n){var o=n.match(/^Etc\/GMT(0|[+-]\d{1,2})$/i);if(o)return-60*parseInt(o[1])}return null};function e(r){var n;return n=i.call(this)||this,n.zoneName=r,n.valid=e.isValidZone(r),n}var t=e.prototype;return t.offsetName=function(n,o){var s=o.format,a=o.locale;return Mn(n,s,a,this.name)},t.formatOffset=function(n,o){return ur(this.offset(n),o)},t.offset=function(n){var o=new Date(n);if(isNaN(o))return NaN;var s=Ba(this.name),a=s.formatToParts?La(s,o):Ra(s,o),c=a[0],l=a[1],u=a[2],d=a[3],f=a[4],m=a[5],g=d===24?0:d,v=gi({year:c,month:l,day:u,hour:g,minute:f,second:m,millisecond:0}),E=+o,y=E%1e3;return E-=y>=0?y:1e3+y,(v-E)/(60*1e3)},t.equals=function(n){return n.type==="iana"&&n.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})(et),Pr=null,$=(function(i){J(e,i),e.instance=function(n){return n===0?e.utcInstance:new e(n)},e.parseSpecifier=function(n){if(n){var o=n.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(o)return new e(cr(o[1],o[2]))}return null},oe(e,null,[{key:"utcInstance",get:function(){return Pr===null&&(Pr=new e(0)),Pr}}]);function e(r){var n;return n=i.call(this)||this,n.fixed=r,n}var t=e.prototype;return t.offsetName=function(){return this.name},t.formatOffset=function(n,o){return ur(this.fixed,o)},t.offset=function(){return this.fixed},t.equals=function(n){return n.type==="fixed"&&n.fixed===this.fixed},oe(e,[{key:"type",get:function(){return"fixed"}},{key:"name",get:function(){return this.fixed===0?"UTC":"UTC"+ur(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(et),$r=(function(i){J(e,i);function e(r){var n;return n=i.call(this)||this,n.zoneName=r,n}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})(et);function Fe(i,e){var t;if(A(i)||i===null)return e;if(i instanceof et)return i;if(ya(i)){var r=i.toLowerCase();return r==="local"?e:r==="utc"||r==="gmt"?$.utcInstance:(t=ce.parseGMTOffset(i))!=null?$.instance(t):ce.isValidSpecifier(r)?ce.create(i):$.parseSpecifier(r)||new $r(i)}else return Be(i)?$.instance(i):typeof i=="object"&&i.offset&&typeof i.offset=="number"?i:new $r(i)}var an=function(){return Date.now()},Br=null,un=null,ln=null,cn=null,dn=!1,x=(function(){function i(){}return i.resetCaches=function(){B.resetCache(),ce.resetCache()},oe(i,null,[{key:"now",get:function(){return an},set:function(t){an=t}},{key:"defaultZoneName",get:function(){return i.defaultZone.name},set:function(t){t?Br=Fe(t):Br=null}},{key:"defaultZone",get:function(){return Br||Hn.instance}},{key:"defaultLocale",get:function(){return un},set:function(t){un=t}},{key:"defaultNumberingSystem",get:function(){return ln},set:function(t){ln=t}},{key:"defaultOutputCalendar",get:function(){return cn},set:function(t){cn=t}},{key:"throwOnInvalid",get:function(){return dn},set:function(t){dn=t}}]),i})(),jr={};function qr(i,e){e===void 0&&(e={});var t=JSON.stringify([i,e]),r=jr[t];return r||(r=new Intl.DateTimeFormat(i,e),jr[t]=r),r}var zr={};function Ua(i,e){e===void 0&&(e={});var t=JSON.stringify([i,e]),r=zr[t];return r||(r=new Intl.NumberFormat(i,e),zr[t]=r),r}var Zr={};function Ga(i,e){e===void 0&&(e={});var t=e,r=t.base,n=fa(t,["base"]),o=JSON.stringify([i,n]),s=Zr[o];return s||(s=new Intl.RelativeTimeFormat(i,e),Zr[o]=s),s}var Me=null;function Va(){if(Me)return Me;if(de()){var i=new Intl.DateTimeFormat().resolvedOptions().locale;return Me=!i||i==="und"?"en-US":i,Me}else return Me="en-US",Me}function Ha(i){var e=i.indexOf("-u-");if(e===-1)return[i];var t,r=i.substring(0,e);try{t=qr(i).resolvedOptions()}catch(a){t=qr(r).resolvedOptions()}var n=t,o=n.numberingSystem,s=n.calendar;return[r,o,s]}function $a(i,e,t){return de()?((t||e)&&(i+="-u",t&&(i+="-ca-"+t),e&&(i+="-nu-"+e)),i):[]}function ja(i){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(i(r))}return e}function qa(i){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(i(r))}return e}function Qt(i,e,t,r,n){var o=i.listingMode(t);return o==="error"?null:o==="en"?r(e):n(e)}function za(i){return i.numberingSystem&&i.numberingSystem!=="latn"?!1:i.numberingSystem==="latn"||!i.locale||i.locale.startsWith("en")||de()&&new Intl.DateTimeFormat(i.intl).resolvedOptions().numberingSystem==="latn"}var Za=(function(){function i(t,r,n){if(this.padTo=n.padTo||0,this.floor=n.floor||!1,!r&&de()){var o={useGrouping:!1};n.padTo>0&&(o.minimumIntegerDigits=n.padTo),this.inf=Ua(t,o)}}var e=i.prototype;return e.format=function(r){if(this.inf){var n=this.floor?Math.floor(r):r;return this.inf.format(n)}else{var o=this.floor?Math.floor(r):mi(r,3);return Je(o,this.padTo)}},i})(),Wa=(function(){function i(t,r,n){this.opts=n,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",n.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=qr(r,l)}}var e=i.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=Ma(this.opts),n=B.create("en-US");return le.create(n).formatDateTimeFromString(this.dt,r)},e.formatToParts=function(){return this.hasIntl&&Bt()?this.dtf.formatToParts(this.dt.toJSDate()):[]},e.resolvedOptions=function(){return this.hasIntl?this.dtf.resolvedOptions():{locale:"en-US",numberingSystem:"latn",outputCalendar:"gregory"}},i})(),Ya=(function(){function i(t,r,n){this.opts=Object.assign({style:"long"},n),!r&&xn()&&(this.rtf=Ga(t,n))}var e=i.prototype;return e.format=function(r,n){return this.rtf?this.rtf.format(r,n):Na(n,r,this.opts.numeric,this.opts.style!=="long")},e.formatToParts=function(r,n){return this.rtf?this.rtf.formatToParts(r,n):[]},i})(),B=(function(){i.fromOpts=function(r){return i.create(r.locale,r.numberingSystem,r.outputCalendar,r.defaultToEN)},i.create=function(r,n,o,s){s===void 0&&(s=!1);var a=r||x.defaultLocale,c=a||(s?"en-US":Va()),l=n||x.defaultNumberingSystem,u=o||x.defaultOutputCalendar;return new i(c,l,u,a)},i.resetCache=function(){Me=null,jr={},zr={},Zr={}},i.fromObject=function(r){var n=r===void 0?{}:r,o=n.locale,s=n.numberingSystem,a=n.outputCalendar;return i.create(o,s,a)};function i(t,r,n,o){var s=Ha(t),a=s[0],c=s[1],l=s[2];this.locale=a,this.numberingSystem=r||c||null,this.outputCalendar=n||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=i.prototype;return e.listingMode=function(r){r===void 0&&(r=!0);var n=de(),o=n&&Bt(),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:i.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,n,o){var s=this;return n===void 0&&(n=!1),o===void 0&&(o=!0),Qt(this,r,o,_n,function(){var a=n?{month:r,day:"numeric"}:{month:r},c=n?"format":"standalone";return s.monthsCache[c][r]||(s.monthsCache[c][r]=ja(function(l){return s.extract(l,a,"month")})),s.monthsCache[c][r]})},e.weekdays=function(r,n,o){var s=this;return n===void 0&&(n=!1),o===void 0&&(o=!0),Qt(this,r,o,Un,function(){var a=n?{weekday:r,year:"numeric",month:"long",day:"numeric"}:{weekday:r},c=n?"format":"standalone";return s.weekdaysCache[c][r]||(s.weekdaysCache[c][r]=qa(function(l){return s.extract(l,a,"weekday")})),s.weekdaysCache[c][r]})},e.meridiems=function(r){var n=this;return r===void 0&&(r=!0),Qt(this,void 0,r,function(){return Gn},function(){if(!n.meridiemCache){var o={hour:"numeric",hour12:!0};n.meridiemCache=[M.utc(2016,11,13,9),M.utc(2016,11,13,19)].map(function(s){return n.extract(s,o,"dayperiod")})}return n.meridiemCache})},e.eras=function(r,n){var o=this;return n===void 0&&(n=!0),Qt(this,r,n,Vn,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,n,o){var s=this.dtFormatter(r,n),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 Za(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,n){return n===void 0&&(n={}),new Wa(r,this.intl,n)},e.relFormatter=function(r){return r===void 0&&(r={}),new Ya(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(i,[{key:"fastNumbers",get:function(){return this.fastNumbersCached==null&&(this.fastNumbersCached=za(this)),this.fastNumbersCached}}]),i})();function tt(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];var r=e.reduce(function(n,o){return n+o.source},"");return RegExp("^"+r+"$")}function Re(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return function(r){return e.reduce(function(n,o){var s=n[0],a=n[1],c=n[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 rt(i){if(i==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 n=0,o=t;n<o.length;n++){var s=o[n],a=s[0],c=s[1],l=a.exec(i);if(l)return c(l)}return[null,null]}function $n(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return function(r,n){var o={},s;for(s=0;s<e.length;s++)o[e[s]]=V(r[n+s]);return[o,null,n+s]}}var jn=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,yi=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,qn=RegExp(""+yi.source+jn.source+"?"),vi=RegExp("(?:T"+qn.source+")?"),Ka=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ja=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Qa=/(\d{4})-?(\d{3})/,Xa=$n("weekYear","weekNumber","weekDay"),eu=$n("year","ordinal"),tu=/(\d{4})-(\d\d)-(\d\d)/,zn=RegExp(yi.source+" ?(?:"+jn.source+"|("+Pn.source+"))?"),ru=RegExp("(?: "+zn.source+")?");function Qe(i,e,t){var r=i[e];return A(r)?t:V(r)}function Zn(i,e){var t={year:Qe(i,e),month:Qe(i,e+1,1),day:Qe(i,e+2,1)};return[t,null,e+3]}function Le(i,e){var t={hours:Qe(i,e,0),minutes:Qe(i,e+1,0),seconds:Qe(i,e+2,0),milliseconds:pi(i[e+3])};return[t,null,e+4]}function it(i,e){var t=!i[e]&&!i[e+1],r=cr(i[e+1],i[e+2]),n=t?null:$.instance(r);return[{},n,e+3]}function Wn(i,e){var t=i[e]?ce.create(i[e]):null;return[{},t,e+1]}var iu=RegExp("^T?"+yi.source+"$"),nu=/^-?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 ou(i){var e=i[0],t=i[1],r=i[2],n=i[3],o=i[4],s=i[5],a=i[6],c=i[7],l=i[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(n)),days:f(V(o)),hours:f(V(s)),minutes:f(V(a)),seconds:f(V(c),c==="-0"),milliseconds:f(pi(l),d)}]}var su={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ei(i,e,t,r,n,o,s){var a={year:e.length===2?Hr(V(e)):V(e),month:Bn.indexOf(t)+1,day:V(r),hour:V(n),minute:V(o)};return s&&(a.second=V(s)),i&&(a.weekday=i.length>3?Rn.indexOf(i)+1:Ln.indexOf(i)+1),a}var au=/^(?:(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 uu(i){var e=i[1],t=i[2],r=i[3],n=i[4],o=i[5],s=i[6],a=i[7],c=i[8],l=i[9],u=i[10],d=i[11],f=Ei(e,n,r,t,o,s,a),m;return c?m=su[c]:l?m=0:m=cr(u,d),[f,new $(m)]}function lu(i){return i.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var cu=/^(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$/,du=/^(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$/,fu=/^(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 fn(i){var e=i[1],t=i[2],r=i[3],n=i[4],o=i[5],s=i[6],a=i[7],c=Ei(e,n,r,t,o,s,a);return[c,$.utcInstance]}function hu(i){var e=i[1],t=i[2],r=i[3],n=i[4],o=i[5],s=i[6],a=i[7],c=Ei(e,a,t,r,n,o,s);return[c,$.utcInstance]}var pu=tt(Ka,vi),mu=tt(Ja,vi),gu=tt(Qa,vi),yu=tt(qn),vu=Re(Zn,Le,it),Eu=Re(Xa,Le,it),wu=Re(eu,Le,it),Tu=Re(Le,it);function Au(i){return rt(i,[pu,vu],[mu,Eu],[gu,wu],[yu,Tu])}function bu(i){return rt(lu(i),[au,uu])}function Cu(i){return rt(i,[cu,fn],[du,fn],[fu,hu])}function Du(i){return rt(i,[nu,ou])}var Su=Re(Le);function Iu(i){return rt(i,[iu,Su])}var ku=tt(tu,ru),Ou=tt(zn),xu=Re(Zn,Le,it,Wn),Nu=Re(Le,it,Wn);function Mu(i){return rt(i,[ku,xu],[Ou,Nu])}var Fu="Invalid Duration",Yn={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}},Pu=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}},Yn),W=146097/400,We=146097/4800,Bu=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:We/7,days:We,hours:We*24,minutes:We*24*60,seconds:We*24*60*60,milliseconds:We*24*60*60*1e3}},Yn),Ye=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],_u=Ye.slice(0).reverse();function Ne(i,e,t){t===void 0&&(t=!1);var r={values:t?e.values:Object.assign({},i.values,e.values||{}),loc:i.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||i.conversionAccuracy};return new H(r)}function Ru(i){return i<0?Math.floor(i):Math.ceil(i)}function Kn(i,e,t,r,n){var o=i[n][t],s=e[t]/o,a=Math.sign(s)===Math.sign(r[n]),c=!a&&r[n]!==0&&Math.abs(s)<=1?Ru(s):Math.trunc(s);r[n]+=c,e[t]-=c*o}function Lu(i,e){_u.reduce(function(t,r){return A(e[r])?t:(t&&Kn(i,e,t,e,r),r)},null)}var H=(function(){function i(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?Bu:Pu,this.isLuxonDuration=!0}i.fromMillis=function(r,n){return i.fromObject(Object.assign({milliseconds:r},n))},i.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 i({values:ar(r,i.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:B.fromObject(r),conversionAccuracy:r.conversionAccuracy})},i.fromISO=function(r,n){var o=Du(r),s=o[0];if(s){var a=Object.assign(s,n);return i.fromObject(a)}else return i.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},i.fromISOTime=function(r,n){var o=Iu(r),s=o[0];if(s){var a=Object.assign(s,n);return i.fromObject(a)}else return i.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},i.invalid=function(r,n){if(n===void 0&&(n=null),!r)throw new Y("need to specify a reason the Duration is invalid");var o=r instanceof ne?r:new ne(r,n);if(x.throwOnInvalid)throw new ga(o);return new i({invalid:o})},i.normalizeUnit=function(r){var n={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[r&&r.toLowerCase()];if(!n)throw new In(r);return n},i.isDuration=function(r){return r&&r.isLuxonDuration||!1};var e=i.prototype;return e.toFormat=function(r,n){n===void 0&&(n={});var o=Object.assign({},n,{floor:n.round!==!1&&n.floor!==!1});return this.isValid?le.create(this.loc,o).formatDurationFromString(this,r):Fu},e.toObject=function(r){if(r===void 0&&(r={}),!this.isValid)return{};var n=Object.assign({},this.values);return r.includeConfig&&(n.conversionAccuracy=this.conversionAccuracy,n.numberingSystem=this.loc.numberingSystem,n.locale=this.loc.locale),n},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+=mi(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 n=this.toMillis();if(n<0||n>=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 n=Pe(r),o={},s=Ae(Ye),a;!(a=s()).done;){var c=a.value;(Xe(n.values,c)||Xe(this.values,c))&&(o[c]=n.get(c)+this.get(c))}return Ne(this,{values:o},!0)},e.minus=function(r){if(!this.isValid)return this;var n=Pe(r);return this.plus(n.negate())},e.mapUnits=function(r){if(!this.isValid)return this;for(var n={},o=0,s=Object.keys(this.values);o<s.length;o++){var a=s[o];n[a]=Fn(r(this.values[a],a))}return Ne(this,{values:n},!0)},e.get=function(r){return this[i.normalizeUnit(r)]},e.set=function(r){if(!this.isValid)return this;var n=Object.assign(this.values,ar(r,i.normalizeUnit,[]));return Ne(this,{values:n})},e.reconfigure=function(r){var n=r===void 0?{}:r,o=n.locale,s=n.numberingSystem,a=n.conversionAccuracy,c=this.loc.clone({locale:o,numberingSystem:s}),l={loc:c};return a&&(l.conversionAccuracy=a),Ne(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 Lu(this.matrix,r),Ne(this,{values:r},!0)},e.shiftTo=function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];if(!this.isValid)return this;if(n.length===0)return this;n=n.map(function(S){return i.normalizeUnit(S)});for(var s={},a={},c=this.toObject(),l,u=Ae(Ye),d;!(d=u()).done;){var f=d.value;if(n.indexOf(f)>=0){l=f;var m=0;for(var g in a)m+=this.matrix[g][f]*a[g],a[g]=0;Be(c[f])&&(m+=c[f]);var v=Math.trunc(m);s[f]=v,a[f]=m-v;for(var E in c)Ye.indexOf(E)>Ye.indexOf(f)&&Kn(this.matrix,c,E,s,f)}else Be(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 Ne(this,{values:s},!0).normalize()},e.negate=function(){if(!this.isValid)return this;for(var r={},n=0,o=Object.keys(this.values);n<o.length;n++){var s=o[n];r[s]=-this.values[s]}return Ne(this,{values:r},!0)},e.equals=function(r){if(!this.isValid||!r.isValid||!this.loc.equals(r.loc))return!1;function n(c,l){return c===void 0||c===0?l===void 0||l===0:c===l}for(var o=Ae(Ye),s;!(s=o()).done;){var a=s.value;if(!n(this.values[a],r.values[a]))return!1}return!0},oe(i,[{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}}]),i})();function Pe(i){if(Be(i))return H.fromMillis(i);if(H.isDuration(i))return i;if(typeof i=="object")return H.fromObject(i);throw new Y("Unknown duration argument "+i+" of type "+typeof i)}var It="Invalid Interval";function Uu(i,e){return!i||!i.isValid?Pt.invalid("missing or invalid start"):!e||!e.isValid?Pt.invalid("missing or invalid end"):e<i?Pt.invalid("end before start","The end of an interval must be after its start, but you had start="+i.toISO()+" and end="+e.toISO()):null}var Pt=(function(){function i(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}i.invalid=function(r,n){if(n===void 0&&(n=null),!r)throw new Y("need to specify a reason the Interval is invalid");var o=r instanceof ne?r:new ne(r,n);if(x.throwOnInvalid)throw new ma(o);return new i({invalid:o})},i.fromDateTimes=function(r,n){var o=xt(r),s=xt(n),a=Uu(o,s);return a==null?new i({start:o,end:s}):a},i.after=function(r,n){var o=Pe(n),s=xt(r);return i.fromDateTimes(s,s.plus(o))},i.before=function(r,n){var o=Pe(n),s=xt(r);return i.fromDateTimes(s.minus(o),s)},i.fromISO=function(r,n){var o=(r||"").split("/",2),s=o[0],a=o[1];if(s&&a){var c,l;try{c=M.fromISO(s,n),l=c.isValid}catch(g){l=!1}var u,d;try{u=M.fromISO(a,n),d=u.isValid}catch(g){d=!1}if(l&&d)return i.fromDateTimes(c,u);if(l){var f=H.fromISO(a,n);if(f.isValid)return i.after(c,f)}else if(d){var m=H.fromISO(s,n);if(m.isValid)return i.before(u,m)}}return i.invalid("unparsable",'the input "'+r+`" can't be parsed as ISO 8601`)},i.isInterval=function(r){return r&&r.isLuxonInterval||!1};var e=i.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 n=this.start.startOf(r),o=this.end.startOf(r);return Math.floor(o.diff(n,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 n=r===void 0?{}:r,o=n.start,s=n.end;return this.isValid?i.fromDateTimes(o||this.s,s||this.e):this},e.splitAt=function(){var r=this;if(!this.isValid)return[];for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];for(var a=o.map(xt).filter(function(m){return r.contains(m)}).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(i.fromDateTimes(l,f)),l=f,u+=1}return c},e.splitBy=function(r){var n=Pe(r);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];for(var o=this.s,s=1,a,c=[];o<this.e;){var l=this.start.plus(n.mapUnits(function(u){return u*s}));a=+l>+this.e?this.e:l,c.push(i.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 n=this.s>r.s?this.s:r.s,o=this.e<r.e?this.e:r.e;return n>=o?null:i.fromDateTimes(n,o)},e.union=function(r){if(!this.isValid)return this;var n=this.s<r.s?this.s:r.s,o=this.e>r.e?this.e:r.e;return i.fromDateTimes(n,o)},i.merge=function(r){var n=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=n[0],s=n[1];return s&&o.push(s),o},i.xor=function(r){for(var n,o=null,s=0,a=[],c=r.map(function(g){return[{time:g.s,type:"s"},{time:g.e,type:"e"}]}),l=(n=Array.prototype).concat.apply(n,c),u=l.sort(function(g,v){return g.time-v.time}),d=Ae(u),f;!(f=d()).done;){var m=f.value;s+=m.type==="s"?1:-1,s===1?o=m.time:(o&&+o!=+m.time&&a.push(i.fromDateTimes(o,m.time)),o=null)}return i.merge(a)},e.difference=function(){for(var r=this,n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return i.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()+")":It},e.toISO=function(r){return this.isValid?this.s.toISO(r)+"/"+this.e.toISO(r):It},e.toISODate=function(){return this.isValid?this.s.toISODate()+"/"+this.e.toISODate():It},e.toISOTime=function(r){return this.isValid?this.s.toISOTime(r)+"/"+this.e.toISOTime(r):It},e.toFormat=function(r,n){var o=n===void 0?{}:n,s=o.separator,a=s===void 0?" \u2013 ":s;return this.isValid?""+this.s.toFormat(r)+a+this.e.toFormat(r):It},e.toDuration=function(r,n){return this.isValid?this.e.diff(this.s,r,n):H.invalid(this.invalidReason)},e.mapEndpoints=function(r){return i.fromDateTimes(r(this.s),r(this.e))},oe(i,[{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}}]),i})(),Mt=(function(){function i(){}return i.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},i.isValidIANAZone=function(t){return ce.isValidSpecifier(t)&&ce.isValidZone(t)},i.normalizeZone=function(t){return Fe(t,x.defaultZone)},i.months=function(t,r){t===void 0&&(t="long");var n=r===void 0?{}:r,o=n.locale,s=o===void 0?null:o,a=n.numberingSystem,c=a===void 0?null:a,l=n.locObj,u=l===void 0?null:l,d=n.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t)},i.monthsFormat=function(t,r){t===void 0&&(t="long");var n=r===void 0?{}:r,o=n.locale,s=o===void 0?null:o,a=n.numberingSystem,c=a===void 0?null:a,l=n.locObj,u=l===void 0?null:l,d=n.outputCalendar,f=d===void 0?"gregory":d;return(u||B.create(s,c,f)).months(t,!0)},i.weekdays=function(t,r){t===void 0&&(t="long");var n=r===void 0?{}:r,o=n.locale,s=o===void 0?null:o,a=n.numberingSystem,c=a===void 0?null:a,l=n.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t)},i.weekdaysFormat=function(t,r){t===void 0&&(t="long");var n=r===void 0?{}:r,o=n.locale,s=o===void 0?null:o,a=n.numberingSystem,c=a===void 0?null:a,l=n.locObj,u=l===void 0?null:l;return(u||B.create(s,c,null)).weekdays(t,!0)},i.meridiems=function(t){var r=t===void 0?{}:t,n=r.locale,o=n===void 0?null:n;return B.create(o).meridiems()},i.eras=function(t,r){t===void 0&&(t="short");var n=r===void 0?{}:r,o=n.locale,s=o===void 0?null:o;return B.create(s,null,"gregory").eras(t)},i.features=function(){var t=!1,r=!1,n=!1,o=!1;if(de()){t=!0,r=Bt(),o=xn();try{n=new Intl.DateTimeFormat("en",{timeZone:"America/New_York"}).resolvedOptions().timeZone==="America/New_York"}catch(s){n=!1}}return{intl:t,intlTokens:r,zones:n,relative:o}},i})();function hn(i,e){var t=function(o){return o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf()},r=t(e)-t(i);return Math.floor(H.fromMillis(r).as("days"))}function Gu(i,e,t){for(var r=[["years",function(v,E){return E.year-v.year}],["quarters",function(v,E){return E.quarter-v.quarter}],["months",function(v,E){return E.month-v.month+(E.year-v.year)*12}],["weeks",function(v,E){var y=hn(v,E);return(y-y%7)/7}],["days",hn]],n={},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 m=d(i,e);if(s=i.plus((f={},f[u]=m,f)),s>e){var g;i=i.plus((g={},g[u]=m-1,g)),m-=1}else i=s;n[u]=m}}return[i,n,s,o]}function Vu(i,e,t,r){var n=Gu(i,e,t),o=n[0],s=n[1],a=n[2],c=n[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 m;return(m=H.fromMillis(l,r)).shiftTo.apply(m,u).plus(f)}else return f}var wi={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"},pn={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]},Hu=wi.hanidec.replace(/[\[|\]]/g,"").split("");function $u(i){var e=parseInt(i,10);if(isNaN(e)){e="";for(var t=0;t<i.length;t++){var r=i.charCodeAt(t);if(i[t].search(wi.hanidec)!==-1)e+=Hu.indexOf(i[t]);else for(var n in pn){var o=pn[n],s=o[0],a=o[1];r>=s&&r<=a&&(e+=r-s)}}return parseInt(e,10)}else return e}function re(i,e){var t=i.numberingSystem;return e===void 0&&(e=""),new RegExp(""+wi[t||"latn"]+e)}var ju="missing Intl.DateTimeFormat.formatToParts support";function b(i,e){return e===void 0&&(e=function(r){return r}),{regex:i,deser:function(r){var n=r[0];return e($u(n))}}}var qu="\xA0",Jn="( |"+qu+")",Qn=new RegExp(Jn,"g");function zu(i){return i.replace(/\./g,"\\.?").replace(Qn,Jn)}function mn(i){return i.replace(/\./g,"").replace(Qn," ").toLowerCase()}function ie(i,e){return i===null?null:{regex:RegExp(i.map(zu).join("|")),deser:function(r){var n=r[0];return i.findIndex(function(o){return mn(n)===mn(o)})+e}}}function gn(i,e){return{regex:i,deser:function(r){var n=r[1],o=r[2];return cr(n,o)},groups:e}}function yn(i){return{regex:i,deser:function(t){var r=t[0];return r}}}function Zu(i){return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Wu(i,e){var t=re(e),r=re(e,"{2}"),n=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}"),m=function(y){return{regex:RegExp(Zu(y.val)),deser:function(ae){var D=ae[0];return D},literal:!0}},g=function(y){if(i.literal)return m(y);switch(y.val){case"G":return ie(e.eras("short",!1),0);case"GG":return ie(e.eras("long",!1),0);case"y":return b(l);case"yy":return b(d,Hr);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 ie(e.months("short",!0,!1),1);case"MMMM":return ie(e.months("long",!0,!1),1);case"L":return b(a);case"LL":return b(r);case"LLL":return ie(e.months("short",!1,!1),1);case"LLLL":return ie(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(n);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(n);case"u":return yn(u);case"a":return ie(e.meridiems(),0);case"kkkk":return b(o);case"kk":return b(d,Hr);case"W":return b(a);case"WW":return b(r);case"E":case"c":return b(t);case"EEE":return ie(e.weekdays("short",!1,!1),1);case"EEEE":return ie(e.weekdays("long",!1,!1),1);case"ccc":return ie(e.weekdays("short",!0,!1),1);case"cccc":return ie(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return gn(new RegExp("([+-]"+a.source+")(?::("+r.source+"))?"),2);case"ZZZ":return gn(new RegExp("([+-]"+a.source+")("+r.source+")?"),2);case"z":return yn(/[a-z_+-/]{1,256}?/i);default:return m(y)}},v=g(i)||{invalidReason:ju};return v.token=i,v}var Yu={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 Ku(i,e,t){var r=i.type,n=i.value;if(r==="literal")return{literal:!0,val:n};var o=t[r],s=Yu[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function Ju(i){var e=i.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",i]}function Qu(i,e,t){var r=i.match(e);if(r){var n={},o=1;for(var s in t)if(Xe(t,s)){var a=t[s],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(n[a.token.val[0]]=a.deser(r.slice(o,o+c))),o+=c}return[r,n]}else return[r,{}]}function Xu(i){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(i.Z)?A(i.z)?t=null:t=ce.create(i.z):t=new $(i.Z),A(i.q)||(i.M=(i.q-1)*3+1),A(i.h)||(i.h<12&&i.a===1?i.h+=12:i.h===12&&i.a===0&&(i.h=0)),i.G===0&&i.y&&(i.y=-i.y),A(i.u)||(i.S=pi(i.u));var r=Object.keys(i).reduce(function(n,o){var s=e(o);return s&&(n[s]=i[o]),n},{});return[r,t]}var _r=null;function el(){return _r||(_r=M.fromMillis(1555555555555)),_r}function tl(i,e){if(i.literal)return i;var t=le.macroTokenToFormatOpts(i.val);if(!t)return i;var r=le.create(e,t),n=r.formatDateTimeParts(el()),o=n.map(function(s){return Ku(s,e,t)});return o.includes(void 0)?i:o}function rl(i,e){var t;return(t=Array.prototype).concat.apply(t,i.map(function(r){return tl(r,e)}))}function Xn(i,e,t){var r=rl(le.parseFormat(t),i),n=r.map(function(E){return Wu(E,i)}),o=n.find(function(E){return E.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=Ju(n),a=s[0],c=s[1],l=RegExp(a,"i"),u=Qu(e,l,c),d=u[0],f=u[1],m=f?Xu(f):[null,null],g=m[0],v=m[1];if(Xe(f,"a")&&Xe(f,"H"))throw new Nt("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 il(i,e,t){var r=Xn(i,e,t),n=r.result,o=r.zone,s=r.invalidReason;return[n,o,s]}var eo=[0,31,59,90,120,151,181,212,243,273,304,334],to=[0,31,60,91,121,152,182,213,244,274,305,335];function K(i,e){return new ne("unit out of range","you specified "+e+" (of type "+typeof e+") as a "+i+", which is invalid")}function ro(i,e,t){var r=new Date(Date.UTC(i,e-1,t)).getUTCDay();return r===0?7:r}function io(i,e,t){return t+(_t(i)?to:eo)[e-1]}function no(i,e){var t=_t(i)?to:eo,r=t.findIndex(function(o){return o<e}),n=e-t[r];return{month:r+1,day:n}}function Wr(i){var e=i.year,t=i.month,r=i.day,n=io(e,t,r),o=ro(e,t,r),s=Math.floor((n-o+10)/7),a;return s<1?(a=e-1,s=sr(a)):s>sr(e)?(a=e+1,s=1):a=e,Object.assign({weekYear:a,weekNumber:s,weekday:o},dr(i))}function vn(i){var e=i.weekYear,t=i.weekNumber,r=i.weekday,n=ro(e,1,4),o=Ft(e),s=t*7+r-n-3,a;s<1?(a=e-1,s+=Ft(a)):s>o?(a=e+1,s-=Ft(e)):a=e;var c=no(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},dr(i))}function Rr(i){var e=i.year,t=i.month,r=i.day,n=io(e,t,r);return Object.assign({year:e,ordinal:n},dr(i))}function En(i){var e=i.year,t=i.ordinal,r=no(e,t),n=r.month,o=r.day;return Object.assign({year:e,month:n,day:o},dr(i))}function nl(i){var e=lr(i.weekYear),t=me(i.weekNumber,1,sr(i.weekYear)),r=me(i.weekday,1,7);return e?t?r?!1:K("weekday",i.weekday):K("week",i.week):K("weekYear",i.weekYear)}function ol(i){var e=lr(i.year),t=me(i.ordinal,1,Ft(i.year));return e?t?!1:K("ordinal",i.ordinal):K("year",i.year)}function oo(i){var e=lr(i.year),t=me(i.month,1,12),r=me(i.day,1,or(i.year,i.month));return e?t?r?!1:K("day",i.day):K("month",i.month):K("year",i.year)}function so(i){var e=i.hour,t=i.minute,r=i.second,n=i.millisecond,o=me(e,0,23)||e===24&&t===0&&r===0&&n===0,s=me(t,0,59),a=me(r,0,59),c=me(n,0,999);return o?s?a?c?!1:K("millisecond",n):K("second",r):K("minute",t):K("hour",e)}var Lr="Invalid DateTime",wn=864e13;function Xt(i){return new ne("unsupported zone",'the zone "'+i.name+'" is not supported')}function Ur(i){return i.weekData===null&&(i.weekData=Wr(i.c)),i.weekData}function kt(i,e){var t={ts:i.ts,zone:i.zone,c:i.c,o:i.o,loc:i.loc,invalid:i.invalid};return new M(Object.assign({},t,e,{old:t}))}function ao(i,e,t){var r=i-e*60*1e3,n=t.offset(r);if(e===n)return[r,e];r-=(n-e)*60*1e3;var o=t.offset(r);return n===o?[r,n]:[i-Math.min(n,o)*60*1e3,Math.max(n,o)]}function Tn(i,e){i+=e*60*1e3;var t=new Date(i);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function rr(i,e,t){return ao(gi(i),e,t)}function An(i,e){var t=i.o,r=i.c.year+Math.trunc(e.years),n=i.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,o=Object.assign({},i.c,{year:r,month:n,day:Math.min(i.c.day,or(r,n))+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=gi(o),c=ao(a,t,i.zone),l=c[0],u=c[1];return s!==0&&(l+=s,u=i.zone.offset(l)),{ts:l,o:u}}function Ot(i,e,t,r,n){var o=t.setZone,s=t.zone;if(i&&Object.keys(i).length!==0){var a=e||s,c=M.fromObject(Object.assign(i,t,{zone:a,setZone:void 0}));return o?c:c.setZone(s)}else return M.invalid(new ne("unparsable",'the input "'+n+`" can't be parsed as `+r))}function Ke(i,e,t){return t===void 0&&(t=!0),i.isValid?le.create(B.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(i,e):null}function bn(i,e){var t=e.suppressSeconds,r=t===void 0?!1:t,n=e.suppressMilliseconds,o=n===void 0?!1:n,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,m=e.format,g=m===void 0?"extended":m,v=g==="basic"?"HHmm":"HH:mm";(!r||i.second!==0||i.millisecond!==0)&&(v+=g==="basic"?"ss":":ss",(!o||i.millisecond!==0)&&(v+=".SSS")),(u||s)&&f&&(v+=" "),u?v+="z":s&&(v+=g==="basic"?"ZZZ":"ZZ");var E=Ke(i,v);return c&&(E="T"+E),E}var uo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},sl={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},al={ordinal:1,hour:0,minute:0,second:0,millisecond:0},lo=["year","month","day","hour","minute","second","millisecond"],ul=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],ll=["year","ordinal","hour","minute","second","millisecond"];function Cn(i){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"}[i.toLowerCase()];if(!e)throw new In(i);return e}function Dn(i,e){for(var t=Ae(lo),r;!(r=t()).done;){var n=r.value;A(i[n])&&(i[n]=uo[n])}var o=oo(i)||so(i);if(o)return M.invalid(o);var s=x.now(),a=e.offset(s),c=rr(i,a,e),l=c[0],u=c[1];return new M({ts:l,zone:e,o:u})}function Sn(i,e,t){var r=A(t.round)?!0:t.round,n=function(d,f){d=mi(d,r||t.calendary?0:2,!0);var m=e.loc.clone(t).relFormatter(t);return m.format(d,f)},o=function(d){return t.calendary?e.hasSame(i,d)?0:e.startOf(d).diff(i.startOf(d),d).get(d):e.diff(i,d).get(d)};if(t.unit)return n(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 n(l,c)}return n(i>e?-0:0,t.units[t.units.length-1])}var M=(function(){function i(t){var r=t.zone||x.defaultZone,n=t.invalid||(Number.isNaN(t.ts)?new ne("invalid input"):null)||(r.isValid?null:Xt(r));this.ts=A(t.ts)?x.now():t.ts;var o=null,s=null;if(!n){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=Tn(this.ts,l),n=Number.isNaN(o.year)?new ne("invalid input"):null,o=n?null:o,s=n?null:l}}this._zone=r,this.loc=t.loc||B.create(),this.invalid=n,this.weekData=null,this.c=o,this.o=s,this.isLuxonDateTime=!0}i.now=function(){return new i({})},i.local=function(r,n,o,s,a,c,l){return A(r)?i.now():Dn({year:r,month:n,day:o,hour:s,minute:a,second:c,millisecond:l},x.defaultZone)},i.utc=function(r,n,o,s,a,c,l){return A(r)?new i({ts:x.now(),zone:$.utcInstance}):Dn({year:r,month:n,day:o,hour:s,minute:a,second:c,millisecond:l},$.utcInstance)},i.fromJSDate=function(r,n){n===void 0&&(n={});var o=va(r)?r.valueOf():NaN;if(Number.isNaN(o))return i.invalid("invalid input");var s=Fe(n.zone,x.defaultZone);return s.isValid?new i({ts:o,zone:s,loc:B.fromObject(n)}):i.invalid(Xt(s))},i.fromMillis=function(r,n){if(n===void 0&&(n={}),Be(r))return r<-wn||r>wn?i.invalid("Timestamp out of range"):new i({ts:r,zone:Fe(n.zone,x.defaultZone),loc:B.fromObject(n)});throw new Y("fromMillis requires a numerical input, but received a "+typeof r+" with value "+r)},i.fromSeconds=function(r,n){if(n===void 0&&(n={}),Be(r))return new i({ts:r*1e3,zone:Fe(n.zone,x.defaultZone),loc:B.fromObject(n)});throw new Y("fromSeconds requires a numerical input")},i.fromObject=function(r){var n=Fe(r.zone,x.defaultZone);if(!n.isValid)return i.invalid(Xt(n));var o=x.now(),s=n.offset(o),a=ar(r,Cn,["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,m=B.fromObject(r);if((d||c)&&f)throw new Nt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new Nt("Can't mix ordinal dates with month/day");var g=f||a.weekday&&!d,v,E,y=Tn(o,s);g?(v=ul,E=sl,y=Wr(y)):c?(v=ll,E=al,y=Rr(y)):(v=lo,E=uo);for(var S=!1,ae=Ae(v),D;!(D=ae()).done;){var L=D.value,Nr=a[L];A(Nr)?S?a[L]=E[L]:a[L]=y[L]:S=!0}var Ws=g?nl(a):c?ol(a):oo(a),_i=Ws||so(a);if(_i)return i.invalid(_i);var Ys=g?vn(a):c?En(a):a,Ri=rr(Ys,s,n),Ks=Ri[0],Js=Ri[1],Mr=new i({ts:Ks,zone:n,o:Js,loc:m});return a.weekday&&d&&r.weekday!==Mr.weekday?i.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+Mr.toISO()):Mr},i.fromISO=function(r,n){n===void 0&&(n={});var o=Au(r),s=o[0],a=o[1];return Ot(s,a,n,"ISO 8601",r)},i.fromRFC2822=function(r,n){n===void 0&&(n={});var o=bu(r),s=o[0],a=o[1];return Ot(s,a,n,"RFC 2822",r)},i.fromHTTP=function(r,n){n===void 0&&(n={});var o=Cu(r),s=o[0],a=o[1];return Ot(s,a,n,"HTTP",n)},i.fromFormat=function(r,n,o){if(o===void 0&&(o={}),A(r)||A(n))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=il(d,r,n),m=f[0],g=f[1],v=f[2];return v?i.invalid(v):Ot(m,g,o,"format "+n,r)},i.fromString=function(r,n,o){return o===void 0&&(o={}),i.fromFormat(r,n,o)},i.fromSQL=function(r,n){n===void 0&&(n={});var o=Mu(r),s=o[0],a=o[1];return Ot(s,a,n,"SQL",r)},i.invalid=function(r,n){if(n===void 0&&(n=null),!r)throw new Y("need to specify a reason the DateTime is invalid");var o=r instanceof ne?r:new ne(r,n);if(x.throwOnInvalid)throw new pa(o);return new i({invalid:o})},i.isDateTime=function(r){return r&&r.isLuxonDateTime||!1};var e=i.prototype;return e.get=function(r){return this[r]},e.resolvedLocaleOpts=function(r){r===void 0&&(r={});var n=le.create(this.loc.clone(r),r).resolvedOptions(this),o=n.locale,s=n.numberingSystem,a=n.calendar;return{locale:o,numberingSystem:s,outputCalendar:a}},e.toUTC=function(r,n){return r===void 0&&(r=0),n===void 0&&(n={}),this.setZone($.instance(r),n)},e.toLocal=function(){return this.setZone(x.defaultZone)},e.setZone=function(r,n){var o=n===void 0?{}:n,s=o.keepLocalTime,a=s===void 0?!1:s,c=o.keepCalendarTime,l=c===void 0?!1:c;if(r=Fe(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(),m=rr(f,d,r);u=m[0]}return kt(this,{ts:u,zone:r})}else return i.invalid(Xt(r))},e.reconfigure=function(r){var n=r===void 0?{}:r,o=n.locale,s=n.numberingSystem,a=n.outputCalendar,c=this.loc.clone({locale:o,numberingSystem:s,outputCalendar:a});return kt(this,{loc:c})},e.setLocale=function(r){return this.reconfigure({locale:r})},e.set=function(r){if(!this.isValid)return this;var n=ar(r,Cn,[]),o=!A(n.weekYear)||!A(n.weekNumber)||!A(n.weekday),s=!A(n.ordinal),a=!A(n.year),c=!A(n.month)||!A(n.day),l=a||c,u=n.weekYear||n.weekNumber;if((l||s)&&u)throw new Nt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&s)throw new Nt("Can't mix ordinal dates with month/day");var d;o?d=vn(Object.assign(Wr(this.c),n)):A(n.ordinal)?(d=Object.assign(this.toObject(),n),A(n.day)&&(d.day=Math.min(or(d.year,d.month),d.day))):d=En(Object.assign(Rr(this.c),n));var f=rr(d,this.o,this.zone),m=f[0],g=f[1];return kt(this,{ts:m,o:g})},e.plus=function(r){if(!this.isValid)return this;var n=Pe(r);return kt(this,An(this,n))},e.minus=function(r){if(!this.isValid)return this;var n=Pe(r).negate();return kt(this,An(this,n))},e.startOf=function(r){if(!this.isValid)return this;var n={},o=H.normalizeUnit(r);switch(o){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(o==="weeks"&&(n.weekday=1),o==="quarters"){var s=Math.ceil(this.month/3);n.month=(s-1)*3+1}return this.set(n)},e.endOf=function(r){var n;return this.isValid?this.plus((n={},n[r]=1,n)).startOf(r).minus(1):this},e.toFormat=function(r,n){return n===void 0&&(n={}),this.isValid?le.create(this.loc.redefaultToEN(n)).formatDateTimeFromString(this,r):Lr},e.toLocaleString=function(r){return r===void 0&&(r=nr),this.isValid?le.create(this.loc.clone(r),r).formatDateTime(this):Lr},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 n=r===void 0?{}:r,o=n.format,s=o===void 0?"extended":o,a=s==="basic"?"yyyyMMdd":"yyyy-MM-dd";return this.year>9999&&(a="+"+a),Ke(this,a)},e.toISOWeekDate=function(){return Ke(this,"kkkk-'W'WW-c")},e.toISOTime=function(r){var n=r===void 0?{}:r,o=n.suppressMilliseconds,s=o===void 0?!1:o,a=n.suppressSeconds,c=a===void 0?!1:a,l=n.includeOffset,u=l===void 0?!0:l,d=n.includePrefix,f=d===void 0?!1:d,m=n.format,g=m===void 0?"extended":m;return bn(this,{suppressSeconds:c,suppressMilliseconds:s,includeOffset:u,includePrefix:f,format:g})},e.toRFC2822=function(){return Ke(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)},e.toHTTP=function(){return Ke(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")},e.toSQLDate=function(){return Ke(this,"yyyy-MM-dd")},e.toSQLTime=function(r){var n=r===void 0?{}:r,o=n.includeOffset,s=o===void 0?!0:o,a=n.includeZone,c=a===void 0?!1:a;return bn(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():Lr},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 n=Object.assign({},this.c);return r.includeConfig&&(n.outputCalendar=this.outputCalendar,n.numberingSystem=this.loc.numberingSystem,n.locale=this.loc.locale),n},e.toJSDate=function(){return new Date(this.isValid?this.ts:NaN)},e.diff=function(r,n,o){if(n===void 0&&(n="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=Ea(n).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=Vu(l,u,a,s);return c?d.negate():d},e.diffNow=function(r,n){return r===void 0&&(r="milliseconds"),n===void 0&&(n={}),this.diff(i.now(),r,n)},e.until=function(r){return this.isValid?Pt.fromDateTimes(this,r):this},e.hasSame=function(r,n){if(!this.isValid)return!1;var o=r.valueOf(),s=this.setZone(r.zone,{keepLocalTime:!0});return s.startOf(n)<=o&&o<=s.endOf(n)},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 n=r.base||i.fromObject({zone:this.zone}),o=r.padding?this<n?-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),Sn(n,this.plus(o),Object.assign(r,{numeric:"always",units:s,unit:a}))},e.toRelativeCalendar=function(r){return r===void 0&&(r={}),this.isValid?Sn(r.base||i.fromObject({zone:this.zone}),this,Object.assign(r,{numeric:"auto",units:["years","months","days"],calendary:!0})):null},i.min=function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];if(!n.every(i.isDateTime))throw new Y("min requires all arguments be DateTimes");return on(n,function(s){return s.valueOf()},Math.min)},i.max=function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];if(!n.every(i.isDateTime))throw new Y("max requires all arguments be DateTimes");return on(n,function(s){return s.valueOf()},Math.max)},i.fromFormatExplain=function(r,n,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 Xn(d,r,n)},i.fromStringExplain=function(r,n,o){return o===void 0&&(o={}),i.fromFormatExplain(r,n,o)},oe(i,[{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?Ur(this).weekYear:NaN}},{key:"weekNumber",get:function(){return this.isValid?Ur(this).weekNumber:NaN}},{key:"weekday",get:function(){return this.isValid?Ur(this).weekday:NaN}},{key:"ordinal",get:function(){return this.isValid?Rr(this.c).ordinal:NaN}},{key:"monthShort",get:function(){return this.isValid?Mt.months("short",{locObj:this.loc})[this.month-1]:null}},{key:"monthLong",get:function(){return this.isValid?Mt.months("long",{locObj:this.loc})[this.month-1]:null}},{key:"weekdayShort",get:function(){return this.isValid?Mt.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}},{key:"weekdayLong",get:function(){return this.isValid?Mt.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 _t(this.year)}},{key:"daysInMonth",get:function(){return or(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?Ft(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?sr(this.weekYear):NaN}}],[{key:"DATE_SHORT",get:function(){return nr}},{key:"DATE_MED",get:function(){return Yr}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return kn}},{key:"DATE_FULL",get:function(){return Kr}},{key:"DATE_HUGE",get:function(){return Jr}},{key:"TIME_SIMPLE",get:function(){return Qr}},{key:"TIME_WITH_SECONDS",get:function(){return Xr}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return ei}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return ti}},{key:"TIME_24_SIMPLE",get:function(){return ri}},{key:"TIME_24_WITH_SECONDS",get:function(){return ii}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return ni}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return oi}},{key:"DATETIME_SHORT",get:function(){return si}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return ai}},{key:"DATETIME_MED",get:function(){return ui}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return li}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return On}},{key:"DATETIME_FULL",get:function(){return ci}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return di}},{key:"DATETIME_HUGE",get:function(){return fi}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return hi}}]),i})();function xt(i){if(M.isDateTime(i))return i;if(i&&i.valueOf&&Be(i.valueOf()))return M.fromJSDate(i);if(i&&typeof i=="object")return M.fromObject(i);throw new Y("Unknown datetime argument: "+i+", of type "+typeof i)}var cl="1.28.1";q.DateTime=M;q.Duration=H;q.FixedOffsetZone=$;q.IANAZone=ce;q.Info=Mt;q.Interval=Pt;q.InvalidZone=$r;q.LocalZone=Hn;q.Settings=x;q.VERSION=cl;q.Zone=et});var Ol={};na(Ol,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>lt,Agent:()=>ct,Amount:()=>w,App:()=>Ee,Backlog:()=>At,Balance:()=>ke,BalanceType:()=>be,BalancesDataTableBuilder:()=>pe,BalancesReport:()=>wt,Billing:()=>pt,Bkper:()=>k,BkperError:()=>ue,Book:()=>X,BooksDataTableBuilder:()=>xr,BotResponse:()=>ft,BotResponseType:()=>st,Collaborator:()=>qe,Collection:()=>Se,Connection:()=>ze,DecimalSeparator:()=>$e,Event:()=>mt,EventList:()=>gt,EventType:()=>gr,File:()=>he,FileList:()=>yt,Group:()=>Q,GroupsDataTableBuilder:()=>bt,Integration:()=>ee,MenuOpenMode:()=>ot,Month:()=>mr,Period:()=>pr,Periodicity:()=>Ut,Permission:()=>nt,Query:()=>Tt,Template:()=>Dt,Transaction:()=>Z,TransactionList:()=>vt,TransactionStatus:()=>ge,TransactionsDataTableBuilder:()=>Ct,User:()=>Ie,Visibility:()=>hr});var ue=class extends Error{constructor(e,t,r){super(t),this.name="BkperError",this.code=e,this.reason=r}};var aa=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},Ze=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 n=0;e.indexOf("?")<0?e+="?":n++;for(let o of this.params){n>0&&(e+="&");var t=o.name,r=o.value;r!=null&&(e+=t+"="+encodeURIComponent(r),n++)}}return e}execute(){return aa(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),n,o=r.headers.get("content-type");return o&&o.includes("application/json")?n=yield r.json():n=yield r.text(),{data:n,status:r.status,headers:r.headers}})}};var St=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},ua="https://api.bkper.app";function la(i){return i.apiBaseUrl?i.apiBaseUrl:ua}var te=class extends Ze{constructor(e,t){let r=la(t);super(`${r}/${e}`),this.retry=0,this.config=t,this.requestPath=e}fetch(){let e=Object.create(null,{execute:{get:()=>super.execute}});return St(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 n={response:{status:r.status,data:r.data}};throw this.handleError(n)}else if(this.shouldRetry(r.status)&&this.retry<3){this.retry++;let n=this.config;return n.requestRetryHandler?yield n.requestRetryHandler(r.status,r.data,this.retry):console.log(`${JSON.stringify(r.data)} - Retrying ${this.retry}/3... `),yield this.fetch()}else{let n={response:{status:r.status,data:r.data}};throw this.handleError(n)}}catch(r){if(r instanceof ue||r.response)throw r;if(this.isNetworkError(r)&&this.retry<3){this.retry++;let n=this.config;return n.requestRetryHandler?yield n.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,n,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):!((n=e.cause)===null||n===void 0)&&n.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,n,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 m=((o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)||((s=e.data)===null||s===void 0?void 0:s.error)||e.error;return m?new ue(m.code,m.message,(c=(a=m.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 St(this,void 0,void 0,function*(){let e=this.config;if(e.requestHeadersProvider){let t=yield e.requestHeadersProvider();Object.entries(t).forEach(([r,n])=>this.setHeader(r,n))}})}addAgentIdHeader(){return St(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 St(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 St(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})}},h=class extends te{constructor(e,t){super(`v5/books/${e}`,t)}},O=class extends te{constructor(e,t){super(`v5/${e}`,t)}};var we=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Ui(i,e,t){return we(this,void 0,void 0,function*(){var r=yield new h(`${i}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Gi(i,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new h(`${i}/accounts/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Vi(i,e,t){return we(this,void 0,void 0,function*(){var r=e,n=yield new h(`${i}/accounts`,t).setMethod("PUT").setPayload(r).fetch();return n.data})}function Hi(i,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new h(`${i}/accounts/batch`,t).setMethod("PUT").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function $i(i,e,t){return we(this,void 0,void 0,function*(){var r=yield new h(`${i}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function ji(i,e,t){return we(this,void 0,void 0,function*(){var r;return((r=(yield new h(`${i}/accounts/delete/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function qi(i,e,t){return we(this,void 0,void 0,function*(){return(yield new h(`${i}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function zi(i,e){return we(this,void 0,void 0,function*(){var t;let r=yield new h(`${i}/accounts`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var xe=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Wi(i,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${i}/groups`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Yi(i,e,t){return xe(this,void 0,void 0,function*(){var r;return((r=(yield new h(`${i}/groups/batch`,t).setMethod("POST").setPayload(e).fetch()).data)===null||r===void 0?void 0:r.items)||[]})}function Ki(i,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${i}/groups`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Ji(i,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${i}/groups/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Qi(i,e){return xe(this,void 0,void 0,function*(){var t=yield new h(`${i}/groups`,e).setMethod("GET").fetch(),r=t.data;return r!=null&&r.items?r.items:[]})}function Xi(i,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${i}/groups/${encodeURIComponent(e)}`,t).setMethod("GET").fetch();return r.data})}function en(i,e,t){return xe(this,void 0,void 0,function*(){if(!e)return[];var r=yield new h(`${i}/groups/${encodeURIComponent(e)}/accounts`,t).setMethod("GET").fetch(),n=r.data;return n!=null&&n.items?n.items:[]})}var Gt=oa(co(),1);var dl=20,fl=1,Ue=1e6,fo=1e6,hl=-7,pl=21,ml=!1,Rt="[big.js] ",Ge=Rt+"Invalid ",fr=Ge+"decimal places",gl=Ge+"rounding mode",ho=Rt+"Division by zero",C={},fe=void 0,yl=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function po(){function i(e){var t=this;if(!(t instanceof i))return e===fe?po():new i(e);if(e instanceof i)t.s=e.s,t.e=e.e,t.c=e.c.slice();else{if(typeof e!="string"){if(i.strict===!0&&typeof e!="bigint")throw TypeError(Ge+"value");e=e===0&&1/e<0?"-0":String(e)}vl(t,e)}t.constructor=i}return i.prototype=C,i.DP=dl,i.RM=fl,i.NE=hl,i.PE=pl,i.strict=ml,i.roundDown=0,i.roundHalfUp=1,i.roundHalfEven=2,i.roundUp=3,i}function vl(i,e){var t,r,n;if(!yl.test(e))throw Error(Ge+"number");for(i.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),n=e.length,r=0;r<n&&e.charAt(r)=="0";)++r;if(r==n)i.c=[i.e=0];else{for(;n>0&&e.charAt(--n)=="0";);for(i.e=t-r-1,i.c=[],t=0;r<=n;)i.c[t++]=+e.charAt(r++)}return i}function Ve(i,e,t,r){var n=i.c;if(t===fe&&(t=i.constructor.RM),t!==0&&t!==1&&t!==2&&t!==3)throw Error(gl);if(e<1)r=t===3&&(r||!!n[0])||e===0&&(t===1&&n[0]>=5||t===2&&(n[0]>5||n[0]===5&&(r||n[1]!==fe))),n.length=1,r?(i.e=i.e-e+1,n[0]=1):n[0]=i.e=0;else if(e<n.length){if(r=t===1&&n[e]>=5||t===2&&(n[e]>5||n[e]===5&&(r||n[e+1]!==fe||n[e-1]&1))||t===3&&(r||!!n[0]),n.length=e,r){for(;++n[--e]>9;)if(n[e]=0,e===0){++i.e,n.unshift(1);break}}for(e=n.length;!n[--e];)n.pop()}return i}function He(i,e,t){var r=i.e,n=i.c.join(""),o=n.length;if(e)n=n.charAt(0)+(o>1?"."+n.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)n="0"+n;n="0."+n}else if(r>0)if(++r>o)for(r-=o;r--;)n+="0";else r<o&&(n=n.slice(0,r)+"."+n.slice(r));else o>1&&(n=n.charAt(0)+"."+n.slice(1));return i.s<0&&t?"-"+n:n}C.abs=function(){var i=new this.constructor(this);return i.s=1,i};C.cmp=function(i){var e,t=this,r=t.c,n=(i=new t.constructor(i)).c,o=t.s,s=i.s,a=t.e,c=i.e;if(!r[0]||!n[0])return r[0]?o:n[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=n.length)?a:c,o=-1;++o<s;)if(r[o]!=n[o])return r[o]>n[o]^e?1:-1;return a==c?0:a>c^e?1:-1};C.div=function(i){var e=this,t=e.constructor,r=e.c,n=(i=new t(i)).c,o=e.s==i.s?1:-1,s=t.DP;if(s!==~~s||s<0||s>Ue)throw Error(fr);if(!n[0])throw Error(ho);if(!r[0])return i.s=o,i.c=[i.e=0],i;var a,c,l,u,d,f=n.slice(),m=a=n.length,g=r.length,v=r.slice(0,a),E=v.length,y=i,S=y.c=[],ae=0,D=s+(y.e=e.e-i.e)+1;for(y.s=o,o=D<0?0:D,f.unshift(0);E++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(E=v.length))u=a>E?1:-1;else for(d=-1,u=0;++d<a;)if(n[d]!=v[d]){u=n[d]>v[d]?1:-1;break}if(u<0){for(c=E==a?n:f;E;){if(v[--E]<c[E]){for(d=E;d&&!v[--d];)v[d]=9;--v[d],v[E]+=10}v[E]-=c[E]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[E]=r[m]||0:v=[r[m]]}while((m++<g||v[0]!==fe)&&o--);return!S[0]&&ae!=1&&(S.shift(),y.e--,D--),ae>D&&Ve(y,D,t.RM,v[0]!==fe),y};C.eq=function(i){return this.cmp(i)===0};C.gt=function(i){return this.cmp(i)>0};C.gte=function(i){return this.cmp(i)>-1};C.lt=function(i){return this.cmp(i)<0};C.lte=function(i){return this.cmp(i)<1};C.minus=C.sub=function(i){var e,t,r,n,o=this,s=o.constructor,a=o.s,c=(i=new s(i)).s;if(a!=c)return i.s=-c,o.plus(i);var l=o.c.slice(),u=o.e,d=i.c,f=i.e;if(!l[0]||!d[0])return d[0]?i.s=-c:l[0]?i=new s(o):i.s=1,i;if(a=u-f){for((n=a<0)?(a=-a,r=l):(f=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(t=((n=l.length<d.length)?l:d).length,a=c=0;c<t;c++)if(l[c]!=d[c]){n=l[c]<d[c];break}if(n&&(r=l,l=d,d=r,i.s=-i.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]||(i.s=1,l=[f=0]),i.c=l,i.e=f,i};C.mod=function(i){var e,t=this,r=t.constructor,n=t.s,o=(i=new r(i)).s;if(!i.c[0])throw Error(ho);return t.s=i.s=1,e=i.cmp(t)==1,t.s=n,i.s=o,e?new r(t):(n=r.DP,o=r.RM,r.DP=r.RM=0,t=t.div(i),r.DP=n,r.RM=o,this.minus(t.times(i)))};C.neg=function(){var i=new this.constructor(this);return i.s=-i.s,i};C.plus=C.add=function(i){var e,t,r,n=this,o=n.constructor;if(i=new o(i),n.s!=i.s)return i.s=-i.s,n.minus(i);var s=n.e,a=n.c,c=i.e,l=i.c;if(!a[0]||!l[0])return l[0]||(a[0]?i=new o(n):i.s=n.s),i;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 i.c=a,i.e=c,i};C.pow=function(i){var e=this,t=new e.constructor("1"),r=t,n=i<0;if(i!==~~i||i<-fo||i>fo)throw Error(Ge+"exponent");for(n&&(i=-i);i&1&&(r=r.times(e)),i>>=1,!!i;)e=e.times(e);return n?t.div(r):r};C.prec=function(i,e){if(i!==~~i||i<1||i>Ue)throw Error(Ge+"precision");return Ve(new this.constructor(this),i,e)};C.round=function(i,e){if(i===fe)i=0;else if(i!==~~i||i<-Ue||i>Ue)throw Error(fr);return Ve(new this.constructor(this),i+this.e+1,e)};C.sqrt=function(){var i,e,t,r=this,n=r.constructor,o=r.s,s=r.e,a=new n("0.5");if(!r.c[0])return new n(r);if(o<0)throw Error(Rt+"No square root");o=Math.sqrt(+He(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),i=new n((o==1/0?"5e":(o=o.toExponential()).slice(0,o.indexOf("e")+1))+s)):i=new n(o+""),s=i.e+(n.DP+=4);do t=i,i=a.times(t.plus(r.div(t)));while(t.c.slice(0,s).join("")!==i.c.slice(0,s).join(""));return Ve(i,(n.DP-=4)+i.e+1,n.RM)};C.times=C.mul=function(i){var e,t=this,r=t.constructor,n=t.c,o=(i=new r(i)).c,s=n.length,a=o.length,c=t.e,l=i.e;if(i.s=t.s==i.s?1:-1,!n[0]||!o[0])return i.c=[i.e=0],i;for(i.e=c+l,s<a&&(e=n,n=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]*n[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++i.e:e.shift(),c=e.length;!e[--c];)e.pop();return i.c=e,i};C.toExponential=function(i,e){var t=this,r=t.c[0];if(i!==fe){if(i!==~~i||i<0||i>Ue)throw Error(fr);for(t=Ve(new t.constructor(t),++i,e);t.c.length<i;)t.c.push(0)}return He(t,!0,!!r)};C.toFixed=function(i,e){var t=this,r=t.c[0];if(i!==fe){if(i!==~~i||i<0||i>Ue)throw Error(fr);for(t=Ve(new t.constructor(t),i+t.e+1,e),i=i+t.e+1;t.c.length<i;)t.c.push(0)}return He(t,!1,!!r)};C[Symbol.for("nodejs.util.inspect.custom")]=C.toJSON=C.toString=function(){var i=this,e=i.constructor;return He(i,i.e<=e.NE||i.e>=e.PE,!!i.c[0])};C.toNumber=function(){var i=+He(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(i.toString()))throw Error(Rt+"Imprecise conversion");return i};C.toPrecision=function(i,e){var t=this,r=t.constructor,n=t.c[0];if(i!==fe){if(i!==~~i||i<1||i>Ue)throw Error(Ge+"precision");for(t=Ve(new r(t),i,e);t.c.length<i;)t.c.push(0)}return He(t,i<=t.e||t.e<=r.NE||t.e>=r.PE,!!n)};C.valueOf=function(){var i=this,e=i.constructor;if(e.strict===!0)throw Error(Rt+"valueOf disallowed");return He(i,i.e<=e.NE||i.e>=e.PE,!0)};var El=po(),Lt=El;var w=class i{constructor(e){this.checkNumberNotNull(e),typeof e=="string"?this.big=new Lt(e):e instanceof i?this.big=new Lt(e.big):e.toString?this.big=new Lt(e.toString()):this.big=new Lt(+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 i?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 i?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 i?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 i?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 i?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 i?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 i?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 i?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 i?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 i?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 i?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=i.create();return t.big=e,t}};var Ut;(function(i){i.DAILY="DAILY",i.MONTHLY="MONTHLY",i.YEARLY="YEARLY"})(Ut||(Ut={}));var $e;(function(i){i.COMMA="COMMA",i.DOT="DOT"})($e||($e={}));var nt;(function(i){i.NONE="NONE",i.VIEWER="VIEWER",i.RECORDER="RECORDER",i.POSTER="POSTER",i.EDITOR="EDITOR",i.OWNER="OWNER"})(nt||(nt={}));var hr;(function(i){i.PUBLIC="PUBLIC",i.PRIVATE="PRIVATE"})(hr||(hr={}));var F;(function(i){i.ASSET="ASSET",i.LIABILITY="LIABILITY",i.INCOMING="INCOMING",i.OUTGOING="OUTGOING"})(F||(F={}));var be;(function(i){i.TOTAL="TOTAL",i.PERIOD="PERIOD",i.CUMULATIVE="CUMULATIVE"})(be||(be={}));var pr;(function(i){i.MONTH="MONTH",i.QUARTER="QUARTER",i.YEAR="YEAR"})(pr||(pr={}));var mr;(function(i){i.JANUARY="JANUARY",i.FEBRUARY="FEBRUARY",i.MARCH="MARCH",i.APRIL="APRIL",i.MAY="MAY",i.JUNE="JUNE",i.JULY="JULY",i.AUGUST="AUGUST",i.SEPTEMBER="SEPTEMBER",i.OCTOBER="OCTOBER",i.NOVEMBER="NOVEMBER",i.DECEMBER="DECEMBER"})(mr||(mr={}));var ge;(function(i){i.TRASHED="TRASHED",i.DRAFT="DRAFT",i.UNCHECKED="UNCHECKED",i.CHECKED="CHECKED"})(ge||(ge={}));var ot;(function(i){i.SIDEBAR="SIDEBAR",i.EXPANDED="EXPANDED",i.NEW_TAB="NEW_TAB"})(ot||(ot={}));var st;(function(i){i.INFO="INFO",i.WARNING="WARNING",i.ERROR="ERROR"})(st||(st={}));var gr;(function(i){i.FILE_CREATED="FILE_CREATED",i.FILE_UPDATED="FILE_UPDATED",i.FILE_DELETED="FILE_DELETED",i.TRANSACTION_CREATED="TRANSACTION_CREATED",i.TRANSACTION_UPDATED="TRANSACTION_UPDATED",i.TRANSACTION_DELETED="TRANSACTION_DELETED",i.TRANSACTION_POSTED="TRANSACTION_POSTED",i.TRANSACTION_CHECKED="TRANSACTION_CHECKED",i.TRANSACTION_UNCHECKED="TRANSACTION_UNCHECKED",i.TRANSACTION_RESTORED="TRANSACTION_RESTORED",i.ACCOUNT_CREATED="ACCOUNT_CREATED",i.ACCOUNT_UPDATED="ACCOUNT_UPDATED",i.ACCOUNT_DELETED="ACCOUNT_DELETED",i.QUERY_CREATED="QUERY_CREATED",i.QUERY_UPDATED="QUERY_UPDATED",i.QUERY_DELETED="QUERY_DELETED",i.GROUP_CREATED="GROUP_CREATED",i.GROUP_UPDATED="GROUP_UPDATED",i.GROUP_DELETED="GROUP_DELETED",i.COMMENT_CREATED="COMMENT_CREATED",i.COMMENT_DELETED="COMMENT_DELETED",i.COLLABORATOR_ADDED="COLLABORATOR_ADDED",i.COLLABORATOR_UPDATED="COLLABORATOR_UPDATED",i.COLLABORATOR_REMOVED="COLLABORATOR_REMOVED",i.INTEGRATION_CREATED="INTEGRATION_CREATED",i.INTEGRATION_UPDATED="INTEGRATION_UPDATED",i.INTEGRATION_DELETED="INTEGRATION_DELETED",i.BOOK_AUDITED="BOOK_AUDITED",i.BOOK_CREATED="BOOK_CREATED",i.BOOK_UPDATED="BOOK_UPDATED",i.BOOK_DELETED="BOOK_DELETED"})(gr||(gr={}));function vr(i,e){return e<=0?"":e===1?i:i+vr(i,e-1)}function go(i){if(!i||typeof i!="string")return[];let e=/#([a-zA-Z0-9_]+)/g,t=new Set,r;for(;(r=e.exec(i))!==null;)r[1]&&t.add(r[1]);return Array.from(t)}var yr=null;function Er(i,e){return i==null&&(i=new w("0")),e?new w(i).round(e):new w(i).round(2)}function ye(i,e,t){if(i==null)return"";if(typeof i=="string"){if(i.trim()=="")return"";i=new w(i)}if(i==null)return"";t==null&&(t=2);var r=i.toFixed(t)+"";return e==$e.DOT?r.replace(/\,/g,"."):r.replace(/\./g,",")}function wr(i,e){if(i!=null){if(!isNaN(+i)&&isFinite(+i))return new w(i);e==$e.DOT?i=i.replace(/\,/g,""):i=i.replace(/\./g,"").replace(/\,/g,".");try{return new w(i)}catch(t){return}}}function yo(i,e){if(!i)return new Date;var t=i/1e4,r=i/100%100,n=i%100,o=Ai(t,r,n,e);return o}function Ai(i,e,t,r){var n=new Date(i,e-1,t);return r||(r=0),n.setTime(n.getTime()+r*60*1e3),n}function Vt(i,e,t){return i==null||Object.prototype.toString.call(i)!=="[object Date]"?"":((!t||t=="")&&(t="UTC"),e?Gt.DateTime.fromJSDate(i,{zone:t}).toFormat(e):je(i,t))}function je(i,e){return i==null||Object.prototype.toString.call(i)!=="[object Date]"?"":((!e||e=="")&&(e="UTC"),Gt.DateTime.fromJSDate(i,{zone:e}).toISODate())}function at(i){return+i.replace(/-/g,"")}function Tr(i,e,t){e||(e="yyyy-MM-dd");let r=Gt.DateTime.fromFormat(i,e,{zone:t}).toJSDate();return r instanceof Date&&!isNaN(r.getTime())?r:Gt.DateTime.fromFormat(i,"yyyy-MM-dd",{zone:t}).toJSDate()}function z(i,e){return i==null?new w(0):e!=null&&!e?i.times(-1):i}function Ce(i){for(var e=0,t=0;t<i.length;t++)i[t].length>e&&(e=i[t].length);for(var t=0;t<i.length;t++)for(;i[t].length<e;)i[t].push(null);return i}function ve(i){return Ht(i,"_")}function Ht(i,e){return!i||typeof i!="string"?"":(e&&(i=i.replace(new RegExp(e,"g")," ")),i=i.replace(new RegExp("-","g")," "),i=i.replace(/ +(?= )/g,""),i=wl(i.trim().toLowerCase()),e&&(i=i.replace(new RegExp(" ","g"),e)),i)}function wl(i){for(var e=i.split(""),t="",r=0;r<e.length;r++)t+=e[r]in mo()?mo()[e[r]]:e[r];return t}function mo(){if(yr==null){yr={};for(var i=0;i<Ti.length;i++)for(var e=Ti[i].letters.split(""),t=0;t<e.length;t++)yr[e[t]]=Ti[i].base}return yr}var Ti=[{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],n=this.payload.properties!=null?this.payload.properties[r]:null;if(n!=null&&n.trim()!="")return n}}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 $t=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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 $t(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:Ht(this.getName())}getAccounts(){return $t(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 en(this.book.getId(),e,this.getConfig());return t?t.map(n=>new G(this.book,n)):[]})}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 n of r)this.traverseDescendants(n,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 $t(this,void 0,void 0,function*(){return this.payload=yield Wi(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return $t(this,void 0,void 0,function*(){return this.payload=yield Ki(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return $t(this,void 0,void 0,function*(){return this.payload=yield Ji(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(!0),this})}updateGroupCache(e){this.book.setGroup(this.payload,e),this.book.clearCache()}};var ut=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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:Ht(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 ut(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 n=yield this.book.getGroup(r.id);n&&t.push(n)}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 ut(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 ut(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 ut(this,void 0,void 0,function*(){return this.payload=yield Ui(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}update(){return ut(this,void 0,void 0,function*(){return this.payload=yield Vi(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}remove(){return ut(this,void 0,void 0,function*(){return this.payload=yield $i(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(!0),this})}updateAccountCache(e){this.book.setAccount(this.payload,e),this.book.clearCache()}};var vo=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},lt=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 vo(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 n=new Map;for(let a of t){let l=a.getRoot().getId()||"";n.has(l)||n.set(l,[]),n.get(l).push(a)}let o=Array.from(n.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 vo(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 n=[];this.shouldAddProperties&&(n=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 n){let l=a[c];if(l){s.push(l);continue}s.push("")}}e.push(s)}return this.shouldAddProperties&&(r=r.concat(n)),e.unshift(r),Ce(e),e})}};var ct=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 br=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Eo(i){return br(this,void 0,void 0,function*(){let e=yield new te("v5/apps",i).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}function wo(i,e){return br(this,void 0,void 0,function*(){return(yield new te(`v5/apps/${i}`,e).setMethod("GET").fetch()).data})}function To(i,e){return br(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("POST").setPayload(i).fetch();return t.data})}function Ao(i,e){return br(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("PUT").setPayload(i).fetch();return t.data})}var De=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Co(i,e){return De(this,void 0,void 0,function*(){let t=new h("",e);i&&t.addParam("query",i);let r=yield t.fetch();if(r.data==null)return[];let o=r.data.items;return o==null?[]:o})}function Do(i,e,t,r){return De(this,void 0,void 0,function*(){if(i==null)throw new Error("Book id null!");return e=e||!1,t=t||!1,(yield new h(i,r).addParam("loadAccounts",e).addParam("loadGroups",t).fetch()).data})}function So(i,e){return De(this,void 0,void 0,function*(){return(yield new h("",e).setMethod("POST").setPayload(i).fetch()).data})}function Io(i,e,t){return De(this,void 0,void 0,function*(){var r=yield new h(`${i}`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function ko(i,e){return De(this,void 0,void 0,function*(){new h(`${i}/audit`,e).setMethod("PATCH").fetch()})}function Oo(i,e){return De(this,void 0,void 0,function*(){var t;let r=yield new h(`${i}/apps`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function xo(i,e,t,r,n){return De(this,void 0,void 0,function*(){let o=new h(`${i}/copy`,n).setMethod("POST").addParam("name",e);return t&&(o.addParam("copyTransactions",t),r&&o.addParam("fromDate",r)),(yield o.fetch()).data})}function No(i,e){return De(this,void 0,void 0,function*(){return(yield new h(`${i}`,e).setMethod("DELETE").fetch()).data})}var Cr=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Fo(i,e){return Cr(this,void 0,void 0,function*(){var t;let r=yield new h(`${i}/queries`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Po(i,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${i}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Bo(i,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${i}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function _o(i,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${i}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}var Tl=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Lo(i,e,t){return Tl(this,void 0,void 0,function*(){var r;let n=yield new h(`${i}/balances`,t).addParam("query",e).addParam("time",Date.now()).fetch(),o=(r=n.data)===null||r===void 0?void 0:r.balancesUrl;if(o){let s=yield new Ze(o).setMethod("GET").execute();n={data:s.data,status:s.status}}return n.data})}var jt=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Uo(i,e,t){return jt(this,void 0,void 0,function*(){var r=yield new h(`${i}/files`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Dr(i,e,t){return jt(this,void 0,void 0,function*(){var r=yield new h(`${i}/files/${e}`,t).setMethod("GET").fetch();return r.data})}function Go(i,e,t,r){return jt(this,void 0,void 0,function*(){e||(e=100);let n=new h(`${i}/files`,r);return n.addParam("limit",e),t!=null&&n.setHeader("cursor",t),(yield n.fetch()).data})}function Vo(i,e,t){return jt(this,void 0,void 0,function*(){return(yield new h(`${i}/files`,t).setMethod("PUT").setPayload(e).fetch()).data})}function Ho(i,e,t){return jt(this,void 0,void 0,function*(){return(yield new h(`${i}/files/${e.id}`,t).setMethod("DELETE").fetch()).data})}var Sr=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function jo(i,e){return Sr(this,void 0,void 0,function*(){var t;let r=yield new h(`${i}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function bi(i,e,t){return Sr(this,void 0,void 0,function*(){return(yield new h(`${i}/integrations`,t).setPayload(e).setMethod("POST").fetch()).data})}function qt(i,e,t){return Sr(this,void 0,void 0,function*(){return(yield new h(`${i}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function qo(i,e,t){return Sr(this,void 0,void 0,function*(){return(yield new h(`${i}/integrations/${e}`,t).setMethod("DELETE").fetch()).data})}var _=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Zo(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Wo(i,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new h(`${i}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Yo(i,e,t){return _(this,void 0,void 0,function*(){let r={items:e},n=r;return r=yield(yield new h(`${i}/transactions/batch`,t).setMethod("POST").setPayload(n).fetch()).data,r!=null&&r.items!=null?r.items:[]})}function Ko(i,e,t,r){return _(this,void 0,void 0,function*(){let n={items:e},o=n;return n=yield(yield new h(`${i}/transactions/batch`,r).setMethod("PUT").setPayload(o).addParam("updateChecked",t).fetch()).data,n!=null&&n.items!=null?n.items:[]})}function Jo(i,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new h(`${i}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Qo(i,e,t){return _(this,void 0,void 0,function*(){let r={items:e};yield new h(`${i}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Xo(i,e,t,r){return _(this,void 0,void 0,function*(){let n={items:e},o=n;n=yield(yield new h(`${i}/transactions/trash/batch`,r).setMethod("PATCH").setPayload(o).addParam("trashChecked",t).fetch()).data})}function es(i,e,t){return _(this,void 0,void 0,function*(){let r={items:e},n=r;r=yield(yield new h(`${i}/transactions/untrash/batch`,t).setMethod("PATCH").setPayload(n).fetch()).data})}function ts(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function rs(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions/post`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function is(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions/check`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ns(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions/uncheck`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function os(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions/trash`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ss(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function as(i,e,t){return _(this,void 0,void 0,function*(){var r=yield new h(`${i}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function us(i,e,t,r,n){return _(this,void 0,void 0,function*(){e||(e=""),t||(t=100);var o=new h(`${i}/transactions`,n);o.addParam("query",e),o.addParam("limit",t),r!=null&&o.setHeader("cursor",r);var s=yield o.fetch();return s.data})}function ls(i,e,t){return _(this,void 0,void 0,function*(){let r=Object.assign({},e);return(yield new h(`${i}/transactions/merge`,t).setMethod("PATCH").setPayload(r).fetch()).data})}function cs(i,e,t){return _(this,void 0,void 0,function*(){return(yield new h(`${i}/transactions/count`,t).setMethod("GET").addParam("query",e).fetch()).data})}var zt=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function fs(i,e,t,r,n,o,s,a,c){return zt(this,void 0,void 0,function*(){let l=new h(`${i.getId()}/events`,c);l.addParam("after",e),l.addParam("before",t),l.addParam("error",r),l.addParam("resoureId",n),l.addParam("type",o),l.addParam("limit",s),a!=null&&l.setHeader("cursor",a);var u=yield l.fetch();return u.data})}function hs(i,e,t,r){return zt(this,void 0,void 0,function*(){return(yield new h(`${i.getId()}/events/${e}/responses/${t}`,r).setMethod("PUT").fetch()).data})}function ps(i,e,t,r){return zt(this,void 0,void 0,function*(){return(yield new h(`${i.getId()}/events/${e}/responses/${t}`,r).setMethod("DELETE").fetch()).data})}function ms(i,e,t,r){return zt(this,void 0,void 0,function*(){let n=new h(`${i.getId()}/events/replay/batch`,r).setMethod("PATCH").setPayload(e);t&&n.addParam("errorsOnly",t),yield n.fetch()})}function gs(i,e){return zt(this,void 0,void 0,function*(){return(yield new h(`${i.getId()}/events/backlog`,e).setMethod("GET").fetch()).data})}var Zt=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function vs(i,e,t,r){return Zt(this,void 0,void 0,function*(){let n=new h(`${i}/collaborators/request`,r).setMethod("POST").addParam("permission",e);t&&(n=n.addParam("message",t)),yield n.fetch()})}function Es(i,e,t){return Zt(this,void 0,void 0,function*(){return(yield new h(`${i}/collaborators/request/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function ws(i,e){return Zt(this,void 0,void 0,function*(){var t;let r=yield new h(`${i}/collaborators`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Ci(i,e,t,r){return Zt(this,void 0,void 0,function*(){let n=new h(`${i}/collaborators`,r).setMethod("POST").setPayload(e);return t&&(n=n.addParam("message",t)),(yield n.fetch()).data})}function Ts(i,e,t){return Zt(this,void 0,void 0,function*(){return(yield new h(`${i}/collaborators/${e}`,t).setMethod("DELETE").fetch()).data})}var Si=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},qe=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}getAvatarUrl(){return this.payload.avatarUrl}create(e){return Si(this,void 0,void 0,function*(){return this.payload=yield Ci(this.book.getId(),this.payload,e,this.getConfig()),this.book.clearCollaboratorCache(),this})}update(){return Si(this,void 0,void 0,function*(){return this.payload=yield Ci(this.book.getId(),this.payload,void 0,this.getConfig()),this.book.clearCollaboratorCache(),this})}remove(){return Si(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield Ts(this.book.getId(),e,this.getConfig()),this.book.clearCollaboratorCache(),this})}};var dt=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function As(i){return dt(this,void 0,void 0,function*(){var e;let t=yield new O("collections",i).fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function bs(i,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("POST").setPayload(i).fetch()).data})}function Cs(i,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("PUT").setPayload(i).fetch()).data})}function Ds(i,e){return dt(this,void 0,void 0,function*(){var t;let r=yield new O(`collections/${i.id}`,e).setMethod("DELETE").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}function Ss(i,e,t){return dt(this,void 0,void 0,function*(){var r;let n=yield new O(`collections/${i}/books/add`,t).setMethod("PATCH").setPayload(e).fetch();return((r=n==null?void 0:n.data)===null||r===void 0?void 0:r.items)||[]})}function Is(i,e,t){return dt(this,void 0,void 0,function*(){var r;let n=yield new O(`collections/${i}/books/remove`,t).setMethod("PATCH").setPayload(e).fetch();return((r=n==null?void 0:n.data)===null||r===void 0?void 0:r.items)||[]})}var Wt=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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 Wt(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 Ss(t,r,this.getConfig())).map(o=>new X(o,this.config))}return[]})}removeBooks(e){return Wt(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 Is(t,r,this.getConfig())).map(o=>new X(o,this.config))}return[]})}getUpdatedAt(){return this.payload.updatedAt}create(){return Wt(this,void 0,void 0,function*(){return this.payload=yield bs(this.payload,this.getConfig()),this})}update(){return Wt(this,void 0,void 0,function*(){return this.payload=yield Cs(this.payload,this.getConfig()),this})}remove(){return Wt(this,void 0,void 0,function*(){return(yield Ds(this.payload,this.getConfig())).map(t=>new X(t,this.config))})}};var Os=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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 Os(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 hs(this.event.getBook(),e,t,this.event.getBook().getConfig());return this.updateCache(r),this})}remove(){return Os(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 ps(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(n=>n.agentId&&n.agentId===this.getAgentId());this.payload=r||{}}};var ht=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function xs(i,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${i}`,e).setMethod("GET").fetch()).data})}function Ns(i){return ht(this,void 0,void 0,function*(){var e;let t=yield new O("user/connections",i).setMethod("GET").fetch();return((e=t==null?void 0:t.data)===null||e===void 0?void 0:e.items)||[]})}function Ms(i,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(i).setMethod("POST").fetch()).data})}function Fs(i,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(i).setMethod("PUT").fetch()).data})}function Ps(i,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${i}`,e).setMethod("DELETE").fetch()).data})}function Bs(i,e){return ht(this,void 0,void 0,function*(){var t;let r=yield new O(`user/connections/${i}/integrations`,e).setMethod("GET").fetch();return((t=r==null?void 0:r.data)===null||t===void 0?void 0:t.items)||[]})}var Rs=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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}setName(e){return this.payload.name=e,this}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}update(){return Rs(this,void 0,void 0,function*(){let e=this.getBookId();return e&&(this.payload=yield qt(e,this.payload,this.getConfig())),this})}remove(){return Rs(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield qo(e,t,this.getConfig())),this})}};var Ir=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},ze=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 Ir(this,void 0,void 0,function*(){let e=this.getId();return e?(yield Bs(e,this.getConfig())).map(n=>new ee(n,this.config)):[]})}create(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Ms(this.payload,this.getConfig()),this})}update(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Fs(this.payload,this.getConfig()),this})}remove(){return Ir(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield Ps(e,this.getConfig())),this})}};var Yt=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function Ls(i){return Yt(this,void 0,void 0,function*(){return(yield new O("user",i).setMethod("GET").fetch()).data})}function Us(i){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing",i).setMethod("GET").fetch()).data})}function Gs(i){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing/counts",i).setMethod("GET").fetch()).data})}function Vs(i,e){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing/portal",e).addParam("returnUrl",i).fetch()).data})}function Hs(i,e,t,r,n){return Yt(this,void 0,void 0,function*(){let o=new O("user/billing/checkout",n).addParam("plan",i);return r&&o.addParam("cycle",r),e&&o.addParam("successUrl",e),t&&o.addParam("cancelUrl",t),(yield o.fetch()).data})}var ki=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},pt=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 ki(this,void 0,void 0,function*(){return yield Gs(this.getConfig())})}getPortalUrl(e){return ki(this,void 0,void 0,function*(){let t=yield Vs(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,n){return ki(this,void 0,void 0,function*(){let o=yield Hs(e,t,r,n,this.getConfig());return o==null?void 0:o.url})}};var Oi=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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}getPlanCycle(){return this.payload.planCycle}getUsername(){return this.payload.username}getBilling(){return Oi(this,void 0,void 0,function*(){let e=yield Us(this.getConfig());return new pt(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return Oi(this,void 0,void 0,function*(){return(yield Ns(this.getConfig())).map(t=>new ze(t,this.config))})}getConnection(e){return Oi(this,void 0,void 0,function*(){let t=yield xs(e,this.getConfig());return new ze(t,this.config)})}};var mt=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 ct(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()===st.ERROR)return!0;return!1}clearCache(){this.botResponses=void 0}};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;return((e=this.payload.items)===null||e===void 0?void 0:e.map(t=>new mt(this.book,t)))||[]}};var kr=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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 kr(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 Dr(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}getCreatedAt(){return this.payload.createdAt?new Date(new Number(this.payload.createdAt).valueOf()):void 0}create(){return kr(this,void 0,void 0,function*(){return this.payload=yield Uo(this.book.getId(),this.payload,this.getConfig()),this})}update(){return kr(this,void 0,void 0,function*(){return this.payload=yield Vo(this.book.getId(),this.payload,this.getConfig()),this})}remove(){return kr(this,void 0,void 0,function*(){return this.payload=yield Ho(this.book.getId(),this.payload,this.getConfig()),this})}};var yt=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 i=0;i<256;++i)R.push((i+256).toString(16).slice(1));function $s(i,e=0){return(R[i[e+0]]+R[i[e+1]]+R[i[e+2]]+R[i[e+3]]+"-"+R[i[e+4]]+R[i[e+5]]+"-"+R[i[e+6]]+R[i[e+7]]+"-"+R[i[e+8]]+R[i[e+9]]+"-"+R[i[e+10]]+R[i[e+11]]+R[i[e+12]]+R[i[e+13]]+R[i[e+14]]+R[i[e+15]]).toLowerCase()}var xi,bl=new Uint8Array(16);function Ni(){if(!xi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");xi=crypto.getRandomValues.bind(crypto)}return xi(bl)}var Cl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mi={randomUUID:Cl};function Dl(i,e,t){var n,o,s;if(Mi.randomUUID&&!e&&!i)return Mi.randomUUID();i=i||{};let r=(s=(o=i.random)!=null?o:(n=i.rng)==null?void 0:n.call(i))!=null?s:Ni();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 Fi=Dl;var N=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,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()||je(new Date,this.book.getTimeZone()),t=this.book.getMostRecentLockDate_();return t!=null&&at(t)>=at(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("#")?go(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(),n=(t=e.getBook())===null||t===void 0?void 0:t.getId();return(r==null||n!=this.book.getId())&&(r==null&&(e.payload.id=`temporary_${Fi()}`),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*([n,o]){o.book=this.book,o.setProperty("upload_method","attachment");let s=yield o.create();return{fileId:n,createdFile:s}})),t=yield Promise.all(e);for(let{fileId:r,createdFile:n}of t){let o=this.payload.files.findIndex(s=>s.id===r);o>=0?this.payload.files[o]=n.json():this.payload.files.push(n.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 w(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=wr(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new w(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=Tr(e,this.book.getDatePattern(),this.book.getTimeZone());this.payload.date=je(t,this.book.getTimeZone())}else e.indexOf("-")>=0&&(this.payload.date=e);else Object.prototype.toString.call(e)==="[object Date]"&&(this.payload.date=je(e,this.book.getTimeZone()));return this}getDateObject(){return yo(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 Vt(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 Vt(this.getUpdatedAt(),this.book.getDatePattern()+" HH:mm:ss",this.book.getTimeZone())}getCaEvolvedBalance_(){return this.payload.creditAccount!=null&&this.payload.creditAccount.balance!=null?new w(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new w(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 n=r?yield this.getCreditAccount():yield this.getDebitAccount();t=z(t,n==null?void 0:n.isCredit())}return Er(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 ts(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 is(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 ns(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 rs(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 os(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 ss(this.book.getId(),this.payload,this.getConfig());return this.payload.trashed=(e=t.transaction)===null||e===void 0?void 0:e.trashed,this})}};var Sl=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},vt=class{constructor(e,t){this.book=e,this.payload=t||{}}getCursor(){return this.payload.cursor}getAccount(){return Sl(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 n=Ai(e,t,r,this.container.getBalancesReport().getBook().getTimeZoneOffset());return n}getFuzzyDate(){return this.payload.fuzzyDate}getCumulativeBalance(){return z(this.getCumulativeBalanceRaw(),this.container.isCredit())}getCumulativeBalanceRaw(){return new w(this.payload.cumulativeBalance)}getCumulativeCredit(){return new w(this.payload.cumulativeCredit)}getCumulativeDebit(){return new w(this.payload.cumulativeDebit)}getPeriodBalance(){return z(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new w(this.payload.periodBalance)}getPeriodCredit(){return new w(this.payload.periodCredit)}getPeriodDebit(){return new w(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 w(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 n of e.getBalancesContainers())this.flattenAllAccounts(n,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=n(e)-n(t)),r==0&&(r=e.getName().toLowerCase().localeCompare(t.getName().toLowerCase()));function n(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 n=e.getDepth();if(n<=this.maxDepth){!this.skipRoot&&!this.shouldTranspose&&(e.payload.name=vr(" ",n*4)+e.payload.name),(!this.skipRoot||n!=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 n=e.getDepth();e.payload.name=vr(" ",n*4)+e.payload.name}if(t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e),e.hasGroupBalances()){let n=e.getBalancesContainers();n.sort(this.sortContainersFunction);for(let o of n)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 n=0;n<r.length;n++){var o=r[n];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,n=new Array;if(n.push(""),this.balancesContainers==null)return e;let o=[],s=new Array;this.flattenContainers(s,o);for(let D of s){n.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(n);var d=new Array;for(var f in t){var m=t[f],g=new Array;g.push(m.date);for(let D of s){var u=m[D.getName()];u==null?u="null_amount":(u=new w(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,E=0;E<d.length;E++){var g=d[E];if(E==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new w(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 w(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]=je(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(Nr=>Nr[L]))),e}};var js=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},Et=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 js(this,void 0,void 0,function*(){return null})}getAccount(){return js(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 z(new w(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new w(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new w(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new w(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 z(new w(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new w(this.payload.periodBalance||0)}getPeriodCredit(){return new w(this.payload.periodCredit||0)}getPeriodDebit(){return new w(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],n=this.payload.properties!=null?this.payload.properties[r]:null;if(n!=null&&n.trim()!="")return n}}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 qs=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},Or=class i{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 qs(this,void 0,void 0,function*(){return(yield this.balancesReport.getBook().getGroup(this.getNormalizedName()))||null})}getAccount(){return qs(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 z(new w(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new w(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new w(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new w(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 z(new w(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new w(this.payload.periodBalance||0)}getPeriodCredit(){return new w(this.payload.periodCredit||0)}getPeriodDebit(){return new w(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],n=this.payload.properties!=null?this.payload.properties[r]:null;if(n!=null&&n.trim()!="")return n}}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 i(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 Et(this,this.balancesReport,r))}}return this.accountBalances||[]}getBalancesContainer(e){var t;let r=ve(e),n=this.getBalancesContainers();if(n==null||n.length===0)throw`${e} not found on group ${this.getName()}`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,n));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 n=t[r],o=n.getNormalizedName();o&&(e.has(o)||e.set(o,n));let s=n.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),n=this.getBalancesContainers();if(n==null||n.length===0)throw`${e} not found`;this.balancesContainersMap==null&&(this.balancesContainersMap=this.fillBalancesContainersMap(new Map,n));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 Et(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 Or(null,this,t);this.groupBalancesContainers.push(r)}}return this.groupBalancesContainers||[]}fillBalancesContainersMap(e,t){for(let r=0;r<t.length;r++){let n=t[r],o=n.getNormalizedName();o&&(e.has(o)||e.set(o,n));let s=n.getBalancesContainers();s&&s.length>0&&this.fillBalancesContainersMap(e,s)}return e}};var Pi=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},Tt=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 Pi(this,void 0,void 0,function*(){return this.payload=yield Po(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}update(){return Pi(this,void 0,void 0,function*(){return this.payload=yield Bo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}remove(){return Pi(this,void 0,void 0,function*(){let e=this.getId();if(!e)throw new Error("Query id null!");return this.payload=yield _o(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 At=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}getCount(){return this.payload.count}};var bt=class{constructor(e){this.COMPARATOR=(t,r)=>{let n=this.getTypeIndex(this.getStringType(t))-this.getTypeIndex(this.getStringType(r));return n===0&&(n=this.getHasChildrenIndex(t.hasChildren())-this.getHasChildrenIndex(r.hasChildren())),n===0&&(n=t.getNormalizedName().localeCompare(r.getNormalizedName())),n},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 n of t)n.isHidden()||n.getParent()||(e.push(this.buildGroupLine(n,0)),e=this.traverse(n,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 n=this.shouldShowTree?" ".repeat(t)+e.getName():e.getName();if(r.push(n),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 n=e.getChildren();n.sort(this.COMPARATOR);for(let o of n)t.push(this.buildGroupLine(o,r)),o.hasChildren()&&this.traverse(o,t,r+1);return t}};var Bi=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},Ct=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 Bi(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 Bi(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 n=t.getAmount();if(n!=null){if(this.shouldShowBalances()&&this.account){let o=yield this.isCreditOnTransaction_(t,this.account);n=z(n,!o)}this.shouldFormatValues?r.push(ye(n,this.book.getDecimalSeparator(),this.book.getFractionDigits())):r.push(n.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 Bi(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 n of this.getPropertyKeys())e.push("");for(let n of t.getPropertyKeys()){if(!this.shouldAddHiddenProperties&&n.endsWith("_"))continue;let o=this.getPropertyKeys().indexOf(n)+r;e[o]=t.getProperty(n)}}addRemoteIdsToLine(e,t){let r=e.length;for(let o of this.getRemoteIdHeaders())e.push("");let n=t.getRemoteIds();if(n)for(let o=r;o<r+n.length;o++)e[o]=n[o-r]}addUrlsToLine(e,t){let r=e.length;for(let o of this.getAttachmentHeaders())e.push("");let n=this.getUrls(t);for(let o=r;o<r+n.length;o++)e[o]=n[o-r]}getUrls(e){let t=e.getUrls();t==null&&(t=[]);let r=e.getFiles();return r!=null&&(t=t.concat(r.map(n=>n.getUrl()).filter(n=>n!=null))),t}};var T=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},X=class i 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()),Vt(e,this.getDatePattern(),t)}parseDate(e){return Tr(e,this.getDatePattern(),this.getTimeZone())}formatValue(e){return e?ye(e,this.getDecimalSeparator(),this.getFractionDigits()):""}parseValue(e){return wr(e,this.getDecimalSeparator())}round(e){return Er(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 Yo(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 Wo(this.getId(),t,this.getConfig())})}batchUpdateTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];return e.forEach(n=>r.push(n.json())),r=yield Ko(this.getId(),r,t,this.getConfig()),e=r.map(n=>new Z(this,n)),e})}batchCheckTransactions(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())})}batchUncheckTransactions(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())})}batchTrashTransactions(e,t){return T(this,void 0,void 0,function*(){let r=[];e.forEach(n=>r.push(n.json())),yield Xo(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 es(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 n=typeof t=="string"?t:t instanceof Z?t.getId():t.id;if(n==null||n.trim()==="")throw new Error("The second transaction must provide an id for merge.");let o={items:[{id:r},{id:n}]},s=yield ls(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 ms(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 Gi(this.getId(),t,this.getConfig()),n=[];for(let o of r){let s=new G(this,o);n.push(s),this.setAccount(o)}return this.clearCache(),n}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 n of t.groups){let o=n.id||n.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 Hi(this.getId(),t,this.getConfig()),n=[];for(let o of r){let s=new G(this,o);n.push(s),this.setAccount(o)}return this.clearCache(),n}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 ji(this.getId(),t,this.getConfig()),n=[];for(let o of r){let s=new G(this,o);n.push(s),this.setAccount(o,!0)}return this.clearCache(),n}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 Yi(this.getId(),t,this.getConfig()),n=[];for(let o of r){let s=new Q(this,o);n.push(s),this.setGroup(o)}return this.clearCache(),n}return[]})}audit(){ko(this.getId(),this.getConfig())}getApps(){return T(this,void 0,void 0,function*(){if(this.apps!=null)return this.apps;let e=yield Oo(this.getId(),this.getConfig());return this.apps=e.map(t=>new Ee(t,this.config)),this.apps})}getIntegrations(){return T(this,void 0,void 0,function*(){return(yield jo(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 bi(this.getId(),e.json(),this.getConfig()):e=yield bi(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 qt(this.getId(),e.json(),this.getConfig()):e=yield qt(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 qi(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||at(e)>at(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 Xi(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 Qi(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 zi(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 n of r){let o=(t=this.idGroupMap)===null||t===void 0?void 0:t.get(n.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(n=>n.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(n=>n.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 n=yield us(this.getId(),e,t,r,this.getConfig());return new vt(this,n)})}listFiles(e,t){return T(this,void 0,void 0,function*(){let r=yield Go(this.getId(),e,t,this.getConfig());return new yt(this,r)})}countTransactions(e){return T(this,void 0,void 0,function*(){return(yield cs(this.getId(),e,this.getConfig())).total})}listEvents(e,t,r,n,o,s){return T(this,void 0,void 0,function*(){if(typeof e=="object"&&e!==null)return this.listEventsWithOptions(e);let c={afterDate:e!=null?e:void 0,beforeDate:t!=null?t:void 0,resourceId:n!=null?n:void 0,onError:r!=null?r:void 0,type:void 0,limit:o!=null?o:50,cursor:s};return this.listEventsWithOptions(c)})}listEventsWithOptions(e){return T(this,void 0,void 0,function*(){let t=yield fs(this,e.afterDate,e.beforeDate,e.onError,e.resourceId,e.type,e.limit,e.cursor,this.getConfig());return new gt(this,t)})}getTransaction(e){return T(this,void 0,void 0,function*(){let t=yield as(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 Dr(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 So(this.payload,this.getConfig()),this})}copy(e,t,r){return T(this,void 0,void 0,function*(){let n=yield xo(this.getId(),e,t,r,this.getConfig());return new i(n,this.config)})}update(){return T(this,void 0,void 0,function*(){return this.payload=yield Io(this.getId(),this.payload,this.getConfig()),this})}remove(){return T(this,void 0,void 0,function*(){return this.payload=yield No(this.getId(),this.getConfig()),this})}getBalancesReport(e){return T(this,void 0,void 0,function*(){let t=yield Lo(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 Fo(this.getId(),this.getConfig());this.queries=e.map(t=>new Tt(this,t))}return this.queries})}resolveAccessRequest(e){return T(this,void 0,void 0,function*(){let t=yield Es(this.getId(),e,this.getConfig());return new qe(this,t)})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield ws(this.getId(),this.getConfig());this.collaborators=e.map(t=>new qe(this,t))}return this.collaborators})}getBacklog(){return T(this,void 0,void 0,function*(){let e=yield gs(this,this.getConfig());return new At(e,this.config)})}createAccountsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getAccounts()),new lt(e)})}createGroupsDataTable(e){return T(this,void 0,void 0,function*(){return e||(e=yield this.getGroups()),new bt(e)})}createTransactionsDataTable(e,t){return new Ct(this,e,t)}};var Il=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})};function zs(i){return Il(this,void 0,void 0,function*(){let e=yield new te("v5/templates",i).setMethod("GET").fetch();if(e.data==null)return[];let r=e.data.items;return r==null?[]:r})}var Dt=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 Oe=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},k=class i{static setConfig(e){i.globalConfig=e}constructor(e){this.config=e||i.globalConfig}getConfig(){return this.config}getBook(e,t,r){return Oe(this,void 0,void 0,function*(){let n=yield Do(e,t,r,this.config);return new X(n,this.config)})}getBooks(e){return Oe(this,void 0,void 0,function*(){return(yield Co(e,this.config)).map(r=>new X(r,this.config))})}requestBookAccess(e,t,r){return Oe(this,void 0,void 0,function*(){let n=r==null?void 0:r.trim();yield vs(e,t,n||void 0,this.config)})}getCollections(){return Oe(this,void 0,void 0,function*(){return(yield As(this.config)).map(t=>new Se(t,this.config))})}getApps(){return Oe(this,void 0,void 0,function*(){return(yield Eo(this.config)).map(t=>new Ee(t,this.config))})}getApp(e){return Oe(this,void 0,void 0,function*(){let t=yield wo(e,this.config);return new Ee(t,this.config)})}getTemplates(){return Oe(this,void 0,void 0,function*(){return(yield zs(this.config)).map(t=>new Dt(t,this.config))})}getUser(){return Oe(this,void 0,void 0,function*(){let e=yield Ls(this.config);return new Ie(e,this.config)})}};k.globalConfig={};var Zs=function(i,e,t,r){function n(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):n(u.value).then(a,c)}l((r=r.apply(i,e||[])).next())})},Ee=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||ot.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 Zs(this,void 0,void 0,function*(){return yield To(this.payload,this.getConfig()),this})}update(){return Zs(this,void 0,void 0,function*(){return yield Ao(this.payload,this.getConfig()),this})}};var xr=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 n=[];this.shouldAddIds&&n.push("Book Id"),n.push("Name"),n.push("Collection"),n.push("Date Pattern"),n.push("Decimal Separator"),n.push("Fraction Digits"),n.push("Period"),n.push("Owner"),this.shouldAddProperties&&(this.mapPropertyKeys(),n=n.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(n),Ce(r),r}};return sa(Ol);})();
3
3
  //# sourceMappingURL=bkper.min.js.map