bkper-js 2.45.0 → 2.46.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 +1 -1
- package/dist/bkper.min.js.map +3 -3
- package/lib/index.d.ts +6 -0
- package/lib/model/App.js +8 -0
- package/lib/model/Billing.js +6 -2
- package/lib/model/Book.js +2 -1
- package/package.json +2 -2
package/dist/bkper.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";var bkperjs=(()=>{var Xs=Object.create;var Kt=Object.defineProperty;var ea=Object.getOwnPropertyDescriptor;var ta=Object.getOwnPropertyNames;var ra=Object.getPrototypeOf,na=Object.prototype.hasOwnProperty;var ia=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),oa=(n,e)=>{for(var t in e)Kt(n,t,{get:e[t],enumerable:!0})},Un=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ta(e))!na.call(n,i)&&i!==t&&Kt(n,i,{get:()=>e[i],enumerable:!(r=ea(e,i))||r.enumerable});return n};var sa=(n,e,t)=>(t=n!=null?Xs(ra(n)):{},Un(e||!n||!n.__esModule?Kt(t,"default",{value:n,enumerable:!0}):t,n)),aa=n=>Un(Kt({},"__esModule",{value:!0}),n);var co=ia(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});function ni(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&&ni(n.prototype,e),t&&ni(n,t),n}function J(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}function Gr(n){return Gr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Gr(n)}function nr(n,e){return nr=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},nr(n,e)}function da(){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 er(n,e,t){return da()?er=Reflect.construct:er=function(i,o,s){var a=[null];a.push.apply(a,o);var c=Function.bind.apply(i,a),l=new c;return s&&nr(l,s.prototype),l},er.apply(null,arguments)}function fa(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Vr(n){var e=typeof Map=="function"?new Map:void 0;return Vr=function(r){if(r===null||!fa(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 er(r,arguments,Gr(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),nr(i,r)},Vr(n)}function ha(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 pa(n,e){if(n){if(typeof n=="string")return ii(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 ii(n,e)}}function ii(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=pa(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 _e=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Vr(Error)),ma=(function(n){J(e,n);function e(t){return n.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(_e),ga=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(_e),ya=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(_e),Nt=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(_e),Ii=(function(n){J(e,n);function e(t){return n.call(this,"Invalid unit "+t)||this}return e})(_e),Y=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(_e),Te=(function(n){J(e,n);function e(){return n.call(this,"Zone is an abstract class")||this}return e})(_e),p="numeric",se="short",z="long",ir={year:p,month:p,day:p},Yr={year:p,month:se,day:p},ki={year:p,month:se,day:p,weekday:se},Kr={year:p,month:z,day:p},Jr={year:p,month:z,day:p,weekday:z},Qr={hour:p,minute:p},Xr={hour:p,minute:p,second:p},en={hour:p,minute:p,second:p,timeZoneName:se},tn={hour:p,minute:p,second:p,timeZoneName:z},rn={hour:p,minute:p,hour12:!1},nn={hour:p,minute:p,second:p,hour12:!1},on={hour:p,minute:p,second:p,hour12:!1,timeZoneName:se},sn={hour:p,minute:p,second:p,hour12:!1,timeZoneName:z},an={year:p,month:p,day:p,hour:p,minute:p},un={year:p,month:p,day:p,hour:p,minute:p,second:p},ln={year:p,month:se,day:p,hour:p,minute:p},cn={year:p,month:se,day:p,hour:p,minute:p,second:p},Oi={year:p,month:se,day:p,weekday:se,hour:p,minute:p},dn={year:p,month:z,day:p,hour:p,minute:p,timeZoneName:se},fn={year:p,month:z,day:p,hour:p,minute:p,second:p,timeZoneName:se},hn={year:p,month:z,day:p,weekday:z,hour:p,minute:p,timeZoneName:z},pn={year:p,month:z,day:p,weekday:z,hour:p,minute:p,second:p,timeZoneName:z};function A(n){return typeof n=="undefined"}function Be(n){return typeof n=="number"}function lr(n){return typeof n=="number"&&n%1===0}function va(n){return typeof n=="string"}function wa(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 xi(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function Ea(n){return Array.isArray(n)?n:[n]}function oi(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 Ni(n,e){return e.reduce(function(t,r){return t[r]=n[r],t},{})}function Xe(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function me(n,e,t){return lr(n)&&n>=e&&n<=t}function Ta(n,e){return n-e*Math.floor(n/e)}function Je(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 mn(n){if(!(A(n)||n===null||n==="")){var e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function gn(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 or(n,e){var t=Ta(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 yn(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 sr(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 Hr(n){return n>99?n:n>60?1900+n:2e3+n}function Mi(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 cr(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 Fi(n){var e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new Y("Invalid unit value "+n);return e}function ar(n,e,t){var r={};for(var i in n)if(Xe(n,i)){if(t.indexOf(i)>=0)continue;var o=n[i];if(o==null)continue;r[e(i)]=Fi(o)}return r}function ur(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+Je(t,2)+":"+Je(r,2);case"narrow":return""+i+t+(r>0?":"+r:"");case"techie":return""+i+Je(t,2)+Je(r,2);default:throw new RangeError("Value format "+e+" is out of range for property format")}}function dr(n){return Ni(n,["hour","minute","second","millisecond"])}var Pi=/[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 Aa=["January","February","March","April","May","June","July","August","September","October","November","December"],Bi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ba=["J","F","M","A","M","J","J","A","S","O","N","D"];function _i(n){switch(n){case"narrow":return[].concat(ba);case"short":return[].concat(Bi);case"long":return[].concat(Aa);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 Ri=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Li=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ca=["M","T","W","T","F","S","S"];function Ui(n){switch(n){case"narrow":return[].concat(Ca);case"short":return[].concat(Li);case"long":return[].concat(Ri);case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Gi=["AM","PM"],Da=["Before Christ","Anno Domini"],Sa=["BC","AD"],Ia=["B","A"];function Vi(n){switch(n){case"narrow":return[].concat(Ia);case"short":return[].concat(Sa);case"long":return[].concat(Da);default:return null}}function ka(n){return Gi[n.hour<12?0:1]}function Oa(n,e){return Ui(e)[n.weekday-1]}function xa(n,e){return _i(e)[n.month-1]}function Na(n,e){return Vi(e)[n.year<0?0:1]}function Ma(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 Fa(n){var e=Ni(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(ir):return"M/d/yyyy";case I(Yr):return"LLL d, yyyy";case I(ki):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(en):return"h:mm a";case I(tn):return"h:mm a";case I(rn):return"HH:mm";case I(nn):return"HH:mm:ss";case I(on):return"HH:mm";case I(sn):return"HH:mm";case I(an):return"M/d/yyyy, h:mm a";case I(ln):return"LLL d, yyyy, h:mm a";case I(dn):return"LLLL d, yyyy, h:mm a";case I(hn):return r;case I(un):return"M/d/yyyy, h:mm:ss a";case I(cn):return"LLL d, yyyy, h:mm:ss a";case I(Oi):return"EEE, d LLL yyyy, h:mm a";case I(fn):return"LLLL d, yyyy, h:mm:ss a";case I(pn):return"EEEE, LLLL d, yyyy, h:mm:ss a";default:return r}}function si(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 Pa={D:ir,DD:Yr,DDD:Kr,DDDD:Jr,t:Qr,tt:Xr,ttt:en,tttt:tn,T:rn,TT:nn,TTT:on,TTTT:sn,f:an,ff:ln,fff:dn,ffff:hn,F:un,FF:cn,FFF:fn,FFFF:pn},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 Pa[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 Je(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?ka(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?xa(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?Oa(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?Na(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 si(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 si(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})(),et=(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})(),Fr=null,Hi=(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 Mi(i,s,a)},t.formatOffset=function(i,o){return ur(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 Fr===null&&(Fr=new e),Fr}}]),e})(et),Ba=RegExp("^"+Pi.source+"$"),tr={};function _a(n){return tr[n]||(tr[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"})),tr[n]}var Ra={year:0,month:1,day:2,hour:3,minute:4,second:5};function La(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 Ua(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=Ra[s];A(c)||(r[c]=parseInt(a,10))}return r}var Jt={},ce=(function(n){J(e,n),e.create=function(i){return Jt[i]||(Jt[i]=new e(i)),Jt[i]},e.resetCache=function(){Jt={},tr={}},e.isValidSpecifier=function(i){return!!(i&&i.match(Ba))},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 Mi(i,s,a,this.name)},t.formatOffset=function(i,o){return ur(this.offset(i),o)},t.offset=function(i){var o=new Date(i);if(isNaN(o))return NaN;var s=_a(this.name),a=s.formatToParts?Ua(s,o):La(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=yn({year:c,month:l,day:u,hour:g,minute:f,second:m,millisecond:0}),w=+o,y=w%1e3;return w-=y>=0?y:1e3+y,(v-w)/(60*1e3)},t.equals=function(i){return i.type==="iana"&&i.name===this.name},oe(e,[{key:"type",get:function(){return"iana"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return this.valid}}]),e})(et),Pr=null,j=(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(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 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 ur(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"+ur(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(et),$r=(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})(et);function Fe(n,e){var t;if(A(n)||n===null)return e;if(n instanceof et)return n;if(va(n)){var r=n.toLowerCase();return r==="local"?e:r==="utc"||r==="gmt"?j.utcInstance:(t=ce.parseGMTOffset(n))!=null?j.instance(t):ce.isValidSpecifier(r)?ce.create(n):j.parseSpecifier(r)||new $r(n)}else return Be(n)?j.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new $r(n)}var ai=function(){return Date.now()},Br=null,ui=null,li=null,ci=null,di=!1,x=(function(){function n(){}return n.resetCaches=function(){_.resetCache(),ce.resetCache()},oe(n,null,[{key:"now",get:function(){return ai},set:function(t){ai=t}},{key:"defaultZoneName",get:function(){return n.defaultZone.name},set:function(t){t?Br=Fe(t):Br=null}},{key:"defaultZone",get:function(){return Br||Hi.instance}},{key:"defaultLocale",get:function(){return ui},set:function(t){ui=t}},{key:"defaultNumberingSystem",get:function(){return li},set:function(t){li=t}},{key:"defaultOutputCalendar",get:function(){return ci},set:function(t){ci=t}},{key:"throwOnInvalid",get:function(){return di},set:function(t){di=t}}]),n})(),jr={};function zr(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=jr[t];return r||(r=new Intl.DateTimeFormat(n,e),jr[t]=r),r}var qr={};function Ga(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=qr[t];return r||(r=new Intl.NumberFormat(n,e),qr[t]=r),r}var Zr={};function Va(n,e){e===void 0&&(e={});var t=e,r=t.base,i=ha(t,["base"]),o=JSON.stringify([n,i]),s=Zr[o];return s||(s=new Intl.RelativeTimeFormat(n,e),Zr[o]=s),s}var Me=null;function Ha(){if(Me)return Me;if(de()){var n=new Intl.DateTimeFormat().resolvedOptions().locale;return Me=!n||n==="und"?"en-US":n,Me}else return Me="en-US",Me}function $a(n){var e=n.indexOf("-u-");if(e===-1)return[n];var t,r=n.substring(0,e);try{t=zr(n).resolvedOptions()}catch(a){t=zr(r).resolvedOptions()}var i=t,o=i.numberingSystem,s=i.calendar;return[r,o,s]}function ja(n,e,t){return de()?((t||e)&&(n+="-u",t&&(n+="-ca-"+t),e&&(n+="-nu-"+e)),n):[]}function za(n){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(n(r))}return e}function qa(n){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(n(r))}return e}function Qt(n,e,t,r,i){var o=n.listingMode(t);return o==="error"?null:o==="en"?r(e):i(e)}function Za(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 Wa=(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=Ga(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):gn(r,3);return Je(o,this.padTo)}},n})(),Ya=(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=zr(r,l)}}var e=n.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=Fa(this.opts),i=_.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})(),Ka=(function(){function n(t,r,i){this.opts=Object.assign({style:"long"},i),!r&&xi()&&(this.rtf=Va(t,i))}var e=n.prototype;return e.format=function(r,i){return this.rtf?this.rtf.format(r,i):Ma(i,r,this.opts.numeric,this.opts.style!=="long")},e.formatToParts=function(r,i){return this.rtf?this.rtf.formatToParts(r,i):[]},n})(),_=(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":Ha()),l=i||x.defaultNumberingSystem,u=o||x.defaultOutputCalendar;return new n(c,l,u,a)},n.resetCache=function(){Me=null,jr={},qr={},Zr={}},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=$a(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=ja(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),Qt(this,r,o,_i,function(){var a=i?{month:r,day:"numeric"}:{month:r},c=i?"format":"standalone";return s.monthsCache[c][r]||(s.monthsCache[c][r]=za(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),Qt(this,r,o,Ui,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]=qa(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),Qt(this,void 0,r,function(){return Gi},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),Qt(this,r,i,Vi,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 Wa(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,i){return i===void 0&&(i={}),new Ya(r,this.intl,i)},e.relFormatter=function(r){return r===void 0&&(r={}),new Ka(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=Za(this)),this.fastNumbersCached}}]),n})();function tt(){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 Re(){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 rt(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 $i(){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 ji=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,vn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,zi=RegExp(""+vn.source+ji.source+"?"),wn=RegExp("(?:T"+zi.source+")?"),Ja=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Qa=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Xa=/(\d{4})-?(\d{3})/,eu=$i("weekYear","weekNumber","weekDay"),tu=$i("year","ordinal"),ru=/(\d{4})-(\d\d)-(\d\d)/,qi=RegExp(vn.source+" ?(?:"+ji.source+"|("+Pi.source+"))?"),nu=RegExp("(?: "+qi.source+")?");function Qe(n,e,t){var r=n[e];return A(r)?t:V(r)}function Zi(n,e){var t={year:Qe(n,e),month:Qe(n,e+1,1),day:Qe(n,e+2,1)};return[t,null,e+3]}function Le(n,e){var t={hours:Qe(n,e,0),minutes:Qe(n,e+1,0),seconds:Qe(n,e+2,0),milliseconds:mn(n[e+3])};return[t,null,e+4]}function nt(n,e){var t=!n[e]&&!n[e+1],r=cr(n[e+1],n[e+2]),i=t?null:j.instance(r);return[{},i,e+3]}function Wi(n,e){var t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}var iu=RegExp("^T?"+vn.source+"$"),ou=/^-?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 su(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(mn(l),d)}]}var au={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?Hr(V(e)):V(e),month:Bi.indexOf(t)+1,day:V(r),hour:V(i),minute:V(o)};return s&&(a.second=V(s)),n&&(a.weekday=n.length>3?Ri.indexOf(n)+1:Li.indexOf(n)+1),a}var uu=/^(?:(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 lu(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=au[c]:l?m=0:m=cr(u,d),[f,new j(m)]}function cu(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var du=/^(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$/,fu=/^(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$/,hu=/^(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 fi(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,j.utcInstance]}function pu(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,j.utcInstance]}var mu=tt(Ja,wn),gu=tt(Qa,wn),yu=tt(Xa,wn),vu=tt(zi),wu=Re(Zi,Le,nt),Eu=Re(eu,Le,nt),Tu=Re(tu,Le,nt),Au=Re(Le,nt);function bu(n){return rt(n,[mu,wu],[gu,Eu],[yu,Tu],[vu,Au])}function Cu(n){return rt(cu(n),[uu,lu])}function Du(n){return rt(n,[du,fi],[fu,fi],[hu,pu])}function Su(n){return rt(n,[ou,su])}var Iu=Re(Le);function ku(n){return rt(n,[iu,Iu])}var Ou=tt(ru,nu),xu=tt(qi),Nu=Re(Zi,Le,nt,Wi),Mu=Re(Le,nt,Wi);function Fu(n){return rt(n,[Ou,Nu],[xu,Mu])}var Pu="Invalid Duration",Yi={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}},Bu=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}},Yi),W=146097/400,We=146097/4800,_u=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}},Yi),Ye=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ru=Ye.slice(0).reverse();function Ne(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 Lu(n){return n<0?Math.floor(n):Math.ceil(n)}function Ki(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?Lu(s):Math.trunc(s);r[i]+=c,e[t]-=c*o}function Uu(n,e){Ru.reduce(function(t,r){return A(e[r])?t:(t&&Ki(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||_.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=r?_u:Bu,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:ar(r,n.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:_.fromObject(r),conversionAccuracy:r.conversionAccuracy})},n.fromISO=function(r,i){var o=Su(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=ku(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 ya(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 Ii(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):Pu},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+=gn(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=Pe(r),o={},s=Ae(Ye),a;!(a=s()).done;){var c=a.value;(Xe(i.values,c)||Xe(this.values,c))&&(o[c]=i.get(c)+this.get(c))}return Ne(this,{values:o},!0)},e.minus=function(r){if(!this.isValid)return this;var i=Pe(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]=Fi(r(this.values[a],a))}return Ne(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,ar(r,n.normalizeUnit,[]));return Ne(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),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 Uu(this.matrix,r),Ne(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(Ye),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;Be(c[f])&&(m+=c[f]);var v=Math.trunc(m);s[f]=v,a[f]=m-v;for(var w in c)Ye.indexOf(w)>Ye.indexOf(f)&&Ki(this.matrix,c,w,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={},i=0,o=Object.keys(this.values);i<o.length;i++){var s=o[i];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 i(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(!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 Pe(n){if(Be(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 Gu(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 ga(o);return new n({invalid:o})},n.fromDateTimes=function(r,i){var o=xt(r),s=xt(i),a=Gu(o,s);return a==null?new n({start:o,end:s}):a},n.after=function(r,i){var o=Pe(i),s=xt(r);return n.fromDateTimes(s,s.plus(o))},n.before=function(r,i){var o=Pe(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=Pe(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 Fe(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||_.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||_.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||_.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||_.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 _.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 _.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=xi();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 hi(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 Vu(n,e,t){for(var r=[["years",function(v,w){return w.year-v.year}],["quarters",function(v,w){return w.quarter-v.quarter}],["months",function(v,w){return w.month-v.month+(w.year-v.year)*12}],["weeks",function(v,w){var y=hi(v,w);return(y-y%7)/7}],["days",hi]],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 Hu(n,e,t,r){var i=Vu(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 Tn={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"},pi={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]},$u=Tn.hanidec.replace(/[\[|\]]/g,"").split("");function ju(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(Tn.hanidec)!==-1)e+=$u.indexOf(n[t]);else for(var i in pi){var o=pi[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(""+Tn[t||"latn"]+e)}var zu="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(ju(i))}}}var qu="\xA0",Ji="( |"+qu+")",Qi=new RegExp(Ji,"g");function Zu(n){return n.replace(/\./g,"\\.?").replace(Qi,Ji)}function mi(n){return n.replace(/\./g,"").replace(Qi," ").toLowerCase()}function ne(n,e){return n===null?null:{regex:RegExp(n.map(Zu).join("|")),deser:function(r){var i=r[0];return n.findIndex(function(o){return mi(i)===mi(o)})+e}}}function gi(n,e){return{regex:n,deser:function(r){var i=r[1],o=r[2];return cr(i,o)},groups:e}}function yi(n){return{regex:n,deser:function(t){var r=t[0];return r}}}function Wu(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Yu(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(Wu(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,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 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 yi(u);case"a":return ne(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 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 gi(new RegExp("([+-]"+a.source+")(?::("+r.source+"))?"),2);case"ZZZ":return gi(new RegExp("([+-]"+a.source+")("+r.source+")?"),2);case"z":return yi(/[a-z_+-/]{1,256}?/i);default:return m(y)}},v=g(n)||{invalidReason:zu};return v.token=n,v}var Ku={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 Ju(n,e,t){var r=n.type,i=n.value;if(r==="literal")return{literal:!0,val:i};var o=t[r],s=Ku[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function Qu(n){var e=n.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",n]}function Xu(n,e,t){var r=n.match(e);if(r){var i={},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&&(i[a.token.val[0]]=a.deser(r.slice(o,o+c))),o+=c}return[r,i]}else return[r,{}]}function el(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 j(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=mn(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 _r=null;function tl(){return _r||(_r=M.fromMillis(1555555555555)),_r}function rl(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(tl()),o=i.map(function(s){return Ju(s,e,t)});return o.includes(void 0)?n:o}function nl(n,e){var t;return(t=Array.prototype).concat.apply(t,n.map(function(r){return rl(r,e)}))}function Xi(n,e,t){var r=nl(le.parseFormat(t),n),i=r.map(function(w){return Yu(w,n)}),o=i.find(function(w){return w.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=Qu(i),a=s[0],c=s[1],l=RegExp(a,"i"),u=Xu(e,l,c),d=u[0],f=u[1],m=f?el(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(n,e,t){var r=Xi(n,e,t),i=r.result,o=r.zone,s=r.invalidReason;return[i,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(n,e){return new ie("unit out of range","you specified "+e+" (of type "+typeof e+") as a "+n+", which is invalid")}function ro(n,e,t){var r=new Date(Date.UTC(n,e-1,t)).getUTCDay();return r===0?7:r}function no(n,e,t){return t+(_t(n)?to:eo)[e-1]}function io(n,e){var t=_t(n)?to:eo,r=t.findIndex(function(o){return o<e}),i=e-t[r];return{month:r+1,day:i}}function Wr(n){var e=n.year,t=n.month,r=n.day,i=no(e,t,r),o=ro(e,t,r),s=Math.floor((i-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(n))}function vi(n){var e=n.weekYear,t=n.weekNumber,r=n.weekday,i=ro(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=io(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},dr(n))}function Rr(n){var e=n.year,t=n.month,r=n.day,i=no(e,t,r);return Object.assign({year:e,ordinal:i},dr(n))}function wi(n){var e=n.year,t=n.ordinal,r=io(e,t),i=r.month,o=r.day;return Object.assign({year:e,month:i,day:o},dr(n))}function ol(n){var e=lr(n.weekYear),t=me(n.weekNumber,1,sr(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 sl(n){var e=lr(n.year),t=me(n.ordinal,1,Ft(n.year));return e?t?!1:K("ordinal",n.ordinal):K("year",n.year)}function oo(n){var e=lr(n.year),t=me(n.month,1,12),r=me(n.day,1,or(n.year,n.month));return e?t?r?!1:K("day",n.day):K("month",n.month):K("year",n.year)}function so(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 Lr="Invalid DateTime",Ei=864e13;function Xt(n){return new ie("unsupported zone",'the zone "'+n.name+'" is not supported')}function Ur(n){return n.weekData===null&&(n.weekData=Wr(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 ao(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 Ti(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 rr(n,e,t){return ao(yn(n),e,t)}function Ai(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,or(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=yn(o),c=ao(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 Ke(n,e,t){return t===void 0&&(t=!0),n.isValid?le.create(_.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function bi(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 w=Ke(n,v);return c&&(w="T"+w),w}var uo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},al={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ul={ordinal:1,hour:0,minute:0,second:0,millisecond:0},lo=["year","month","day","hour","minute","second","millisecond"],ll=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],cl=["year","ordinal","hour","minute","second","millisecond"];function Ci(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 Ii(n);return e}function Di(n,e){for(var t=Ae(lo),r;!(r=t()).done;){var i=r.value;A(n[i])&&(n[i]=uo[i])}var o=oo(n)||so(n);if(o)return M.invalid(o);var s=x.now(),a=e.offset(s),c=rr(n,a,e),l=c[0],u=c[1];return new M({ts:l,zone:e,o:u})}function Si(n,e,t){var r=A(t.round)?!0:t.round,i=function(d,f){d=gn(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:Xt(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=Ti(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||_.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():Di({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:j.utcInstance}):Di({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},j.utcInstance)},n.fromJSDate=function(r,i){i===void 0&&(i={});var o=wa(r)?r.valueOf():NaN;if(Number.isNaN(o))return n.invalid("invalid input");var s=Fe(i.zone,x.defaultZone);return s.isValid?new n({ts:o,zone:s,loc:_.fromObject(i)}):n.invalid(Xt(s))},n.fromMillis=function(r,i){if(i===void 0&&(i={}),Be(r))return r<-Ei||r>Ei?n.invalid("Timestamp out of range"):new n({ts:r,zone:Fe(i.zone,x.defaultZone),loc:_.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={}),Be(r))return new n({ts:r*1e3,zone:Fe(i.zone,x.defaultZone),loc:_.fromObject(i)});throw new Y("fromSeconds requires a numerical input")},n.fromObject=function(r){var i=Fe(r.zone,x.defaultZone);if(!i.isValid)return n.invalid(Xt(i));var o=x.now(),s=i.offset(o),a=ar(r,Ci,["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=_.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,w,y=Ti(o,s);g?(v=ll,w=al,y=Wr(y)):c?(v=cl,w=ul,y=Rr(y)):(v=lo,w=uo);for(var S=!1,ae=Ae(v),D;!(D=ae()).done;){var L=D.value,Nr=a[L];A(Nr)?S?a[L]=w[L]:a[L]=y[L]:S=!0}var Ys=g?ol(a):c?sl(a):oo(a),Rn=Ys||so(a);if(Rn)return n.invalid(Rn);var Ks=g?vi(a):c?wi(a):a,Ln=rr(Ks,s,i),Js=Ln[0],Qs=Ln[1],Mr=new n({ts:Js,zone:i,o:Qs,loc:m});return a.weekday&&d&&r.weekday!==Mr.weekday?n.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+Mr.toISO()):Mr},n.fromISO=function(r,i){i===void 0&&(i={});var o=bu(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=Cu(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=Du(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=_.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0}),f=il(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=Fu(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 ma(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(j.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=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 n.invalid(Xt(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=ar(r,Ci,[]),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=vi(Object.assign(Wr(this.c),i)):A(i.ordinal)?(d=Object.assign(this.toObject(),i),A(i.day)&&(d.day=Math.min(or(d.year,d.month),d.day))):d=wi(Object.assign(Rr(this.c),i));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 i=Pe(r);return kt(this,Ai(this,i))},e.minus=function(r){if(!this.isValid)return this;var i=Pe(r).negate();return kt(this,Ai(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):Lr},e.toLocaleString=function(r){return r===void 0&&(r=ir),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 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),Ke(this,a)},e.toISOWeekDate=function(){return Ke(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 bi(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 i=r===void 0?{}:r,o=i.includeOffset,s=o===void 0?!0:o,a=i.includeZone,c=a===void 0?!1:a;return bi(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 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=Ea(i).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=Hu(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),Si(i,this.plus(o),Object.assign(r,{numeric:"always",units:s,unit:a}))},e.toRelativeCalendar=function(r){return r===void 0&&(r={}),this.isValid?Si(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 oi(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 oi(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=_.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0});return Xi(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?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 ir}},{key:"DATE_MED",get:function(){return Yr}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return ki}},{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 en}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return tn}},{key:"TIME_24_SIMPLE",get:function(){return rn}},{key:"TIME_24_WITH_SECONDS",get:function(){return nn}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return on}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return sn}},{key:"DATETIME_SHORT",get:function(){return an}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return un}},{key:"DATETIME_MED",get:function(){return ln}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return cn}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return Oi}},{key:"DATETIME_FULL",get:function(){return dn}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return fn}},{key:"DATETIME_HUGE",get:function(){return hn}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return pn}}]),n})();function xt(n){if(M.isDateTime(n))return n;if(n&&n.valueOf&&Be(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 dl="1.28.1";q.DateTime=M;q.Duration=H;q.FixedOffsetZone=j;q.IANAZone=ce;q.Info=Mt;q.Interval=Pt;q.InvalidZone=$r;q.LocalZone=Hi;q.Settings=x;q.VERSION=dl;q.Zone=et});var xl={};oa(xl,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>lt,Agent:()=>ct,Amount:()=>E,App:()=>we,Backlog:()=>At,Balance:()=>ke,BalanceType:()=>be,BalancesDataTableBuilder:()=>pe,BalancesReport:()=>Et,Billing:()=>pt,Bkper:()=>k,BkperError:()=>ue,Book:()=>X,BooksDataTableBuilder:()=>xr,BotResponse:()=>ft,BotResponseType:()=>st,Collaborator:()=>ze,Collection:()=>Se,Connection:()=>qe,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:()=>it,Query:()=>Tt,Template:()=>Dt,Transaction:()=>$,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 ua=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())})},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 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 ua(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())})},la="https://api.bkper.app";function ca(n){return n.apiBaseUrl?n.apiBaseUrl:la}var te=class extends Ze{constructor(e,t){let r=ca(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 Ee=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Gn(n,e,t){return Ee(this,void 0,void 0,function*(){var r=yield new h(`${n}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Vn(n,e,t){return Ee(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 Hn(n,e,t){return Ee(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 $n(n,e,t){return Ee(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 jn(n,e,t){return Ee(this,void 0,void 0,function*(){var r=yield new h(`${n}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function zn(n,e,t){return Ee(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 qn(n,e,t){return Ee(this,void 0,void 0,function*(){return(yield new h(`${n}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function Zn(n,e){return Ee(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 xe=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 Yn(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Kn(n,e,t){return xe(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 Jn(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Qn(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Xn(n,e){return xe(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 ei(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups/${encodeURIComponent(e)}`,t).setMethod("GET").fetch();return r.data})}function ti(n,e,t){return xe(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=sa(co(),1);var fl=20,hl=1,Ue=1e6,fo=1e6,pl=-7,ml=21,gl=!1,Rt="[big.js] ",Ge=Rt+"Invalid ",fr=Ge+"decimal places",yl=Ge+"rounding mode",ho=Rt+"Division by zero",C={},fe=void 0,vl=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function po(){function n(e){var t=this;if(!(t instanceof n))return e===fe?po():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(Ge+"value");e=e===0&&1/e<0?"-0":String(e)}wl(t,e)}t.constructor=n}return n.prototype=C,n.DP=fl,n.RM=hl,n.NE=pl,n.PE=ml,n.strict=gl,n.roundDown=0,n.roundHalfUp=1,n.roundHalfEven=2,n.roundUp=3,n}function wl(n,e){var t,r,i;if(!vl.test(e))throw Error(Ge+"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 Ve(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(yl);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 He(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>Ue)throw Error(fr);if(!i[0])throw Error(ho);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),w=v.length,y=n,S=y.c=[],ae=0,D=s+(y.e=e.e-n.e)+1;for(y.s=o,o=D<0?0:D,f.unshift(0);w++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(w=v.length))u=a>w?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=v[d]){u=i[d]>v[d]?1:-1;break}if(u<0){for(c=w==a?i:f;w;){if(v[--w]<c[w]){for(d=w;d&&!v[--d];)v[d]=9;--v[d],v[w]+=10}v[w]-=c[w]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[w]=r[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(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(ho);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<-fo||n>fo)throw Error(Ge+"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>Ue)throw Error(Ge+"precision");return Ve(new this.constructor(this),n,e)};C.round=function(n,e){if(n===fe)n=0;else if(n!==~~n||n<-Ue||n>Ue)throw Error(fr);return Ve(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(+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),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 Ve(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>Ue)throw Error(fr);for(t=Ve(new t.constructor(t),++n,e);t.c.length<n;)t.c.push(0)}return He(t,!0,!!r)};C.toFixed=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Ue)throw Error(fr);for(t=Ve(new t.constructor(t),n+t.e+1,e),n=n+t.e+1;t.c.length<n;)t.c.push(0)}return He(t,!1,!!r)};C[Symbol.for("nodejs.util.inspect.custom")]=C.toJSON=C.toString=function(){var n=this,e=n.constructor;return He(n,n.e<=e.NE||n.e>=e.PE,!!n.c[0])};C.toNumber=function(){var n=+He(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>Ue)throw Error(Ge+"precision");for(t=Ve(new r(t),n,e);t.c.length<n;)t.c.push(0)}return He(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 He(n,n.e<=e.NE||n.e>=e.PE,!0)};var El=po(),Lt=El;var E=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 $e;(function(n){n.COMMA="COMMA",n.DOT="DOT"})($e||($e={}));var it;(function(n){n.NONE="NONE",n.VIEWER="VIEWER",n.RECORDER="RECORDER",n.POSTER="POSTER",n.EDITOR="EDITOR",n.OWNER="OWNER"})(it||(it={}));var hr;(function(n){n.PUBLIC="PUBLIC",n.PRIVATE="PRIVATE"})(hr||(hr={}));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 pr;(function(n){n.MONTH="MONTH",n.QUARTER="QUARTER",n.YEAR="YEAR"})(pr||(pr={}));var mr;(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"})(mr||(mr={}));var ge;(function(n){n.TRASHED="TRASHED",n.DRAFT="DRAFT",n.UNCHECKED="UNCHECKED",n.CHECKED="CHECKED"})(ge||(ge={}));var ot;(function(n){n.SIDEBAR="SIDEBAR",n.EXPANDED="EXPANDED",n.NEW_TAB="NEW_TAB"})(ot||(ot={}));var st;(function(n){n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR"})(st||(st={}));var gr;(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_OVERNIGHT="BOOK_OVERNIGHT",n.BOOK_CREATED="BOOK_CREATED",n.BOOK_UPDATED="BOOK_UPDATED",n.BOOK_DELETED="BOOK_DELETED"})(gr||(gr={}));function vr(n,e){return e<=0?"":e===1?n:n+vr(n,e-1)}function go(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 yr=null;function wr(n,e){return n==null&&(n=new E("0")),e?new E(n).round(e):new E(n).round(2)}function ye(n,e,t){if(n==null)return"";if(typeof n=="string"){if(n.trim()=="")return"";n=new E(n)}if(n==null)return"";t==null&&(t=2);var r=n.toFixed(t)+"";return e==$e.DOT?r.replace(/\,/g,"."):r.replace(/\./g,",")}function Er(n,e){if(n!=null){if(!isNaN(+n)&&isFinite(+n))return new E(n);e==$e.DOT?n=n.replace(/\,/g,""):n=n.replace(/\./g,"").replace(/\,/g,".");try{return new E(n)}catch(t){return}}}function yo(n,e){if(!n)return new Date;var t=n/1e4,r=n/100%100,i=n%100,o=bn(t,r,i,e);return o}function bn(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):je(n,t))}function je(n,e){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!e||e=="")&&(e="UTC"),Gt.DateTime.fromJSDate(n,{zone:e}).toISODate())}function at(n){return+n.replace(/-/g,"")}function Tr(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 Z(n,e){return n==null?new E(0):e!=null&&!e?n.times(-1):n}function Ce(n){for(var e=0,t=0;t<n.length;t++)n[t].length>e&&(e=n[t].length);for(var t=0;t<n.length;t++)for(;n[t].length<e;)n[t].push(null);return n}function ve(n){return 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=Tl(n.trim().toLowerCase()),e&&(n=n.replace(new RegExp(" ","g"),e)),n)}function Tl(n){for(var e=n.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 n=0;n<An.length;n++)for(var e=An[n].letters.split(""),t=0;t<e.length;t++)yr[e[t]]=An[n].base}return yr}var An=[{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 ti(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 Yn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return $t(this,void 0,void 0,function*(){return this.payload=yield Jn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return $t(this,void 0,void 0,function*(){return this.payload=yield Qn(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(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 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 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 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){let t=e.getId();if(this.payload.groups==null||!t)return!1;for(var r=0;r<this.payload.groups.length;r++)if(this.payload.groups[r].id===t)return!0;return!1}create(){return ut(this,void 0,void 0,function*(){return this.payload=yield Gn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}update(){return ut(this,void 0,void 0,function*(){return this.payload=yield Hn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}remove(){return ut(this,void 0,void 0,function*(){return this.payload=yield jn(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(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())})},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 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 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 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 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(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 wo(n){return br(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 br(this,void 0,void 0,function*(){return(yield new te(`v5/apps/${n}`,e).setMethod("GET").fetch()).data})}function To(n,e){return br(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("POST").setPayload(n).fetch();return t.data})}function Ao(n,e){return br(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 Co(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 Do(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 So(n,e){return De(this,void 0,void 0,function*(){return(yield new h("",e).setMethod("POST").setPayload(n).fetch()).data})}function Io(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 ko(n,e){return De(this,void 0,void 0,function*(){new h(`${n}/audit`,e).setMethod("PATCH").fetch()})}function Oo(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 xo(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 No(n,e){return De(this,void 0,void 0,function*(){return(yield new h(`${n}`,e).setMethod("DELETE").fetch()).data})}var Cr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Fo(n,e){return Cr(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 Po(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${n}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Bo(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${n}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function _o(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${n}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}var Al=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Lo(n,e,t){return Al(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 Ze(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 Uo(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 Dr(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 Go(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 Vo(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 Ho(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 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())})};function jo(n,e){return Sr(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 Cn(n,e,t){return Sr(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 Sr(this,void 0,void 0,function*(){return(yield new h(`${n}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function zo(n,e,t){return Sr(this,void 0,void 0,function*(){return(yield new h(`${n}/integrations/${e}`,t).setMethod("DELETE").fetch()).data})}var B=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Zo(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Wo(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Yo(n,e,t){return B(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 Ko(n,e,t,r){return B(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 Jo(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Qo(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Xo(n,e,t,r){return B(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 es(n,e,t){return B(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 ts(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function rs(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/post`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ns(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/check`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function is(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/uncheck`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function os(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/trash`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ss(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function as(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function us(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e.map(s=>({id:s}))},o=(yield new h(`${n}/transactions/load`,t).setMethod("POST").setPayload(r).fetch()).data;return o!=null&&o.items!=null?o.items:[]})}function ls(n,e,t,r,i){return B(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 cs(n,e,t){return B(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 ds(n,e,t){return B(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 hs(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 ps(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 ms(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 gs(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 ys(n,e){return qt(this,void 0,void 0,function*(){return(yield new h(`${n.getId()}/events/backlog`,e).setMethod("GET").fetch()).data})}var Zt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function ws(n,e,t,r){return Zt(this,void 0,void 0,function*(){let i=new h(`${n}/collaborators/request`,r).setMethod("POST").addParam("permission",e);t&&(i=i.addParam("message",t)),yield i.fetch()})}function Es(n,e,t){return Zt(this,void 0,void 0,function*(){return(yield new h(`${n}/collaborators/request/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function Ts(n,e){return Zt(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 Zt(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 As(n,e,t){return Zt(this,void 0,void 0,function*(){return(yield new h(`${n}/collaborators/${e}`,t).setMethod("DELETE").fetch()).data})}var In=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ze=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 In(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 In(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 In(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield As(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 bs(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 Cs(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("POST").setPayload(n).fetch()).data})}function Ds(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("PUT").setPayload(n).fetch()).data})}function Ss(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 Is(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 ks(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 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())})},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 Is(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 ks(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 Cs(this.payload,this.getConfig()),this})}update(){return Wt(this,void 0,void 0,function*(){return this.payload=yield Ds(this.payload,this.getConfig()),this})}remove(){return Wt(this,void 0,void 0,function*(){return(yield Ss(this.payload,this.getConfig())).map(t=>new X(t,this.config))})}};var xs=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 xs(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})}remove(){return xs(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 ms(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 Ns(n,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("GET").fetch()).data})}function Ms(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 Fs(n,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("POST").fetch()).data})}function Ps(n,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("PUT").fetch()).data})}function Bs(n,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("DELETE").fetch()).data})}function _s(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 Ls=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},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 Ls(this,void 0,void 0,function*(){let e=this.getBookId();return e&&(this.payload=yield zt(e,this.payload,this.getConfig())),this})}remove(){return Ls(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield zo(e,t,this.getConfig())),this})}};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())})},qe=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 _s(e,this.getConfig())).map(i=>new ee(i,this.config)):[]})}create(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Fs(this.payload,this.getConfig()),this})}update(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Ps(this.payload,this.getConfig()),this})}remove(){return Ir(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield Bs(e,this.getConfig())),this})}};var Yt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Us(n){return Yt(this,void 0,void 0,function*(){return(yield new O("user",n).setMethod("GET").fetch()).data})}function Gs(n){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing",n).setMethod("GET").fetch()).data})}function Vs(n){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing/counts",n).setMethod("GET").fetch()).data})}function Hs(n,e){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing/portal",e).addParam("returnUrl",n).fetch()).data})}function $s(n,e,t,r,i){return Yt(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 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())})},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}getTransactionsAverage(){return this.payload.transactionsAverage}getTransactionsCapacity(){return this.payload.transactionsCapacity}getCounts(){return On(this,void 0,void 0,function*(){return yield Vs(this.getConfig())})}getPortalUrl(e){return On(this,void 0,void 0,function*(){let t=yield Hs(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,i){return On(this,void 0,void 0,function*(){let o=yield $s(e,t,r,i,this.getConfig());return o==null?void 0:o.url})}};var xn=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 xn(this,void 0,void 0,function*(){let e=yield Gs(this.getConfig());return new pt(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return xn(this,void 0,void 0,function*(){return(yield Ms(this.getConfig())).map(t=>new qe(t,this.config))})}getConnection(e){return xn(this,void 0,void 0,function*(){let t=yield Ns(e,this.getConfig());return new qe(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(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 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 n=0;n<256;++n)R.push((n+256).toString(16).slice(1));function js(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 Nn,Cl=new Uint8Array(16);function Mn(){if(!Nn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Nn=crypto.getRandomValues.bind(crypto)}return Nn(Cl)}var Dl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Fn={randomUUID:Dl};function Sl(n,e,t){var i,o,s;if(Fn.randomUUID&&!e&&!n)return Fn.randomUUID();n=n||{};let r=(s=(o=n.random)!=null?o:(i=n.rng)==null?void 0:i.call(n))!=null?s:Mn();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 js(r)}var Pn=Sl;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())})},$=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(),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_${Pn()}`),this.pendingFiles.set(e.getId(),e)),this.payload.files.push(e.json()),this}createPendingFiles(){return N(this,void 0,void 0,function*(){if(this.pendingFiles.size===0)return;this.payload.files==null&&(this.payload.files=[]);let e=Array.from(this.pendingFiles.entries()).map(r=>N(this,[r],void 0,function*([i,o]){o.book=this.book,o.setProperty("upload_method","attachment");let s=yield o.create();return{fileId:i,createdFile:s}})),t=yield Promise.all(e);for(let{fileId:r,createdFile:i}of t){let o=this.payload.files.findIndex(s=>s.id===r);o>=0?this.payload.files[o]=i.json():this.payload.files.push(i.json())}this.pendingFiles.clear()})}hasTag(e){for(var t=this.getTags(),r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}getCreditAccount(){return N(this,void 0,void 0,function*(){if(this.payload.creditAccount)return yield this.book.getAccount(this.payload.creditAccount.id)})}getCreditAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getCreditAccount())!=null?(e=yield this.getCreditAccount())===null||e===void 0?void 0:e.getName():""})}setCreditAccount(e){return e==null?(this.payload.creditAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.creditAccount=e.json()):e.id!=null&&(this.payload.creditAccount=e),this)}from(e){return this.setCreditAccount(e)}getDebitAccount(){return N(this,void 0,void 0,function*(){if(this.payload.debitAccount)return yield this.book.getAccount(this.payload.debitAccount.id)})}getDebitAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getDebitAccount())!=null?(e=yield this.getDebitAccount())===null||e===void 0?void 0:e.getName():""})}setDebitAccount(e){return e==null?(this.payload.debitAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.debitAccount={id:e.getId(),name:e.getName()}):e.id!=null&&(this.payload.debitAccount={id:e.id,name:e.name}),this)}to(e){return this.setDebitAccount(e)}getAmount(){return this.payload.amount!=null&&this.payload.amount.trim()!=""?new E(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=Er(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new E(e),e.eq(0)?(this.payload.amount=void 0,this):(this.payload.amount=e.abs().toString(),this))}getCreditAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return this.getAmount()})}getDebitAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isDebit(t))return this.getAmount()})}getOtherAccount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return yield this.getDebitAccount();if(yield this.isDebit(t))return yield this.getCreditAccount()})}getOtherAccountName(e){return N(this,void 0,void 0,function*(){var t=yield this.getOtherAccount(e);return t!=null?t.getName():""})}isCredit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getCreditAccount())!=null&&e!=null&&((t=yield this.getCreditAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}isDebit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getDebitAccount())!=null&&e!=null&&((t=yield this.getDebitAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}getAccount_(e){return N(this,void 0,void 0,function*(){return e==null||e instanceof G?e:yield this.book.getAccount(e)})}getDescription(){return this.payload.description==null?"":this.payload.description}setDescription(e){return this.payload.description=e,this}getDate(){return this.payload.date}setDate(e){if(typeof e=="string")if(e.indexOf("/")>0){let t=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 E(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new E(this.payload.debitAccount.balance):void 0}getAccountBalance(e){return N(this,void 0,void 0,function*(){var t=this.getCaEvolvedBalance_(),r=!0;if(t==null&&(t=this.getDaEvolvedBalance_(),r=!1),t!=null){if(!e){var i=r?yield this.getCreditAccount():yield this.getDebitAccount();t=Z(t,i==null?void 0:i.isCredit())}return wr(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 ns(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 is(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 Il=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 Il(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 $(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=bn(e,t,r,this.container.getBalancesReport().getBook().getTimeZoneOffset());return i}getFuzzyDate(){return this.payload.fuzzyDate}getCumulativeBalance(){return Z(this.getCumulativeBalanceRaw(),this.container.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit)}getPeriodBalance(){return Z(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance)}getPeriodCredit(){return new E(this.payload.periodCredit)}getPeriodDebit(){return new E(this.payload.periodDebit)}};var pe=class{constructor(e,t,r){this.maxDepth=0,this.expandAllAccounts=!1,this.expandAllGroups=!1,this.skipRoot=!1,this.book=e,this.balancesContainers=t,this.periodicity=r,this.balanceType=be.TOTAL,this.shouldFormatDate=!1,this.shouldHideDates=!1,this.shouldHideNames=!1,this.shouldFormatValue=!1,this.shouldTranspose=!1,this.shouldTrial=!1,this.shouldPeriod=!1,this.shouldRaw=!1,this.shouldAddProperties=!1,this.shouldAddHiddenProperties=!1}getBalance(e,t){return this.getRepresentativeBalance(e,t).toNumber()}getRepresentativeBalance(e,t){return e==null?new E(0):t?e.times(-1):e}getBalanceText(e,t){return this.book.formatValue(this.getRepresentativeBalance(e,t))}formatDates(e){return this.shouldFormatDate=e,this}formatValues(e){return this.shouldFormatValue=e,this}expanded(e){return typeof e=="boolean"&&e==!0?(this.maxDepth=1,this.skipRoot=!0):e==-1?this.expandAllGroups=!0:e==-2?this.expandAllAccounts=!0:typeof e=="number"&&e>0&&(this.maxDepth=e),this}type(e){return this.balanceType=e,this}transposed(e){return this.shouldTranspose=e,this}hideDates(e){return this.shouldHideDates=e,this}hideNames(e){return this.shouldHideNames=e,this}properties(e){return this.shouldAddProperties=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}trial(e){return this.shouldTrial=e,this}period(e){return this.shouldPeriod=e,this}raw(e){return this.shouldRaw=e,this}build(){return this.balanceType==be.TOTAL?this.buildTotalDataTable_():this.buildTimeDataTable_()}addPropertyKeys(e,t){for(let r of t.getPropertyKeys())!this.shouldAddHiddenProperties&&r.endsWith("_")||e.indexOf(r)<=-1&&e.push(r)}flattenContainers(e,t){for(let r of this.balancesContainers)this.expandAllAccounts?(this.flattenAllAccounts(r,e,t),e.sort(this.sortContainersFunction)):r.isFromGroup()&&this.expandAllGroups?this.flattenAllGroups(r,e,t):this.flattenMaxDepth(r,e,t)}flattenAllAccounts(e,t,r){if(e.isFromGroup())for(let i of e.getBalancesContainers())this.flattenAllAccounts(i,t,r);else t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e)}sortContainersFunction(e,t){let r=0;e.isPermanent()&&!t.isPermanent()?r=-1:!e.isPermanent()&&t.isPermanent()&&(r=1),r==0&&(e.getParent()&&!t.getParent()?r=-1:!e.getParent()&&t.getParent()&&(r=1)),r==0&&(r=i(e)-i(t)),r==0&&(r=e.getName().toLowerCase().localeCompare(t.getName().toLowerCase()));function i(o){return o.isPermanent()&&!o.isCredit()?0:o.isPermanent()&&o.isCredit()?1:!o.isPermanent()&&o.isCredit()?2:!o.isPermanent()&&!o.isCredit()?3:4}return r}flattenMaxDepth(e,t,r){let i=e.getDepth();if(i<=this.maxDepth){!this.skipRoot&&!this.shouldTranspose&&(e.payload.name=vr(" ",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=vr(" ",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 E(u),this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber()),g.push(u)}d.push(g)}d.sort(function(D,L){return D[0].getTime()-L[0].getTime()});for(var v=null,w=0;w<d.length;w++){var g=d[w];if(w==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}else for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"&&r)v&&(g[y]=v[y]);else if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}v=g,e.push(g)}if(this.shouldFormatDate&&e.length>0)for(var y=1;y<e.length;y++){var g=e[y];g.length>0&&(g[0]=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 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())})},wt=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 zs(this,void 0,void 0,function*(){return null})}getAccount(){return zs(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 E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return Z(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}createDataTable(){return new pe(this.balancesReport.getBook(),[this],this.balancesReport.getPeriodicity())}getBalancesContainers(){return[]}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainer(e){let t=ve(e);if(this.getNormalizedName()==t)return this;throw`${e} does not match ${this.getName()}`}};var qs=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())})},Or=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 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 E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return Z(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}createDataTable(){return new pe(this.balancesReport.getBook(),this.getBalancesContainers(),this.balancesReport.getPeriodicity())}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainers(){let e=[],t=this.getGroupContainers();t&&t.length>0&&(e=e.concat(t));let r=this.getAccountContainers();return r&&r.length>0&&(e=e.concat(r)),e}getGroupContainers(){let e=this.payload.groupBalances;if(this.groupBalances==null&&e!=null){this.groupBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.groupBalances.push(new n(this,this.balancesReport,r))}}return this.groupBalances||[]}getAccountContainers(){let e=this.payload.accountBalances;if(this.accountBalances==null&&e!=null){this.accountBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.accountBalances.push(new wt(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 Et=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 wt(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 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 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())})},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 Bn(this,void 0,void 0,function*(){return this.payload=yield Po(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}update(){return Bn(this,void 0,void 0,function*(){return this.payload=yield Bo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}remove(){return Bn(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 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 _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())})},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 _n(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 _n(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=Z(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 _n(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==it.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 Er(e,this.getDecimalSeparator())}round(e){return wr(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 $(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(i=>r.push(i.json())),r=yield Ko(this.getId(),r,t,this.getConfig()),e=r.map(i=>new $(this,i)),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(i=>r.push(i.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"?{id:e}:e instanceof $?e.json():e;if(r.id==null||r.id.trim()==="")throw new Error("The primary transaction must provide an id for merge.");let i=typeof t=="string"?{id:t}:t instanceof $?t.json():t;if(i.id==null||i.id.trim()==="")throw new Error("The secondary transaction must provide an id for merge.");let o={items:[r,i]},s=yield cs(this.getId(),o,this.getConfig());return new $(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 gs(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 Vn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}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 $n(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 zn(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 Kn(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(){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 we(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 Cn(this.getId(),e.json(),this.getConfig()):e=yield Cn(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 qn(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 ei(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 Xn(this.getId(),this.getConfig());return this.allGroupsLoaded=this.mapGroups(r),Array.from(((t=this.idGroupMap)===null||t===void 0?void 0:t.values())||[])})}mapGroups(e){if(!e)return!1;let t=e.map(r=>new Q(this,r));this.idGroupMap=new Map,this.nameGroupMap=new Map;for(let r of t)this.updateGroupCache(r),r.buildGroupTree(this.idGroupMap);for(let r of t)r.buildGroupTree(this.idGroupMap);return!0}getAccounts(){return T(this,void 0,void 0,function*(){var e,t;if(this.idAccountMap&&this.allAccountsLoaded)return Array.from(((e=this.idAccountMap)===null||e===void 0?void 0:e.values())||[]);yield this.getGroups();let r=yield Zn(this.getId(),this.getConfig());return this.allAccountsLoaded=this.mapAccounts(r),Array.from(((t=this.idAccountMap)===null||t===void 0?void 0:t.values())||[])})}mapAccounts(e){if(!e)return!1;let t=e.map(r=>new G(this,r));this.idAccountMap=new Map,this.nameAccountMap=new Map;for(let r of t)this.updateAccountCache(r),this.linkAccountsAndGroups(r);return this.ensureGroupsAccountMapsLoaded(),!0}linkAccountsAndGroups(e){var t;let r=e.json().groups||[];for(let i of r){let o=(t=this.idGroupMap)===null||t===void 0?void 0:t.get(i.id||"");o!=null&&o.addAccount(e)}}ensureGroupsAccountMapsLoaded(){if(this.idGroupMap)for(let e of this.idGroupMap.values())e.accounts==null&&(e.accounts=new Map)}clearCache(){this.clearGroupCache(),this.clearAccountCache()}clearGroupCache(){this.allGroupsLoaded=!1,this.idGroupMap=void 0,this.nameGroupMap=void 0}clearAccountCache(){this.allAccountsLoaded=!1,this.idAccountMap=void 0,this.nameAccountMap=void 0}clearCollaboratorCache(){this.collaborators=void 0}setAccount(e,t){let r=this.payload.accounts||[];t?this.payload.accounts=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.accounts=r.map(o=>o.id===e.id?e:o):this.payload.accounts=[...r,e]}setGroup(e,t){let r=this.payload.groups||[];t?this.payload.groups=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.groups=r.map(o=>o.id===e.id?e:o):this.payload.groups=[...r,e]}listTransactions(e,t,r){return T(this,void 0,void 0,function*(){let i=yield ls(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 Go(this.getId(),e,t,this.getConfig());return new yt(this,r)})}countTransactions(e){return T(this,void 0,void 0,function*(){return(yield ds(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 hs(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 $(this,t):void 0})}getTransactionsByIds(e){return T(this,void 0,void 0,function*(){if(e==null)throw new Error("Transaction IDs are required.");let t=new Set,r=[];for(let o of e){if(o==null||typeof o!="string"||o.trim()==="")throw new Error("Transaction IDs must be non-blank strings.");let s=o.trim();if(t.has(s))throw new Error(`Duplicate transaction ID: ${s}`);t.add(s),r.push(s)}let i=[];for(let o=0;o<r.length;o+=200){let s=yield us(this.getId(),r.slice(o,o+200),this.getConfig());i.push(...s.map(a=>new $(this,a)))}return i})}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 i=yield xo(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 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 Et(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 ze(this,t)})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield Ts(this.getId(),this.getConfig());this.collaborators=e.map(t=>new ze(this,t))}return this.collaborators})}getBacklog(){return T(this,void 0,void 0,function*(){let e=yield ys(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 kl=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 Zs(n){return kl(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 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())})},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 Oe(this,void 0,void 0,function*(){let i=yield Do(e,t,r,this.config);return new X(i,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 i=r==null?void 0:r.trim();yield ws(e,t,i||void 0,this.config)})}getCollections(){return Oe(this,void 0,void 0,function*(){return(yield bs(this.config)).map(t=>new Se(t,this.config))})}getApps(){return Oe(this,void 0,void 0,function*(){return(yield wo(this.config)).map(t=>new we(t,this.config))})}getApp(e){return Oe(this,void 0,void 0,function*(){let t=yield Eo(e,this.config);return new we(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 Us(this.config);return new Ie(e,this.config)})}};k.globalConfig={};var Ws=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},we=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}setWebhookUrlDev(e){return this.payload.webhookUrlDev=e,this}getId(){return this.payload.id}getName(){return this.payload.name}hasEvents(){return(this.getEvents()||[]).length>0}getEvents(){return this.payload.events}isPublished(){return this.payload.published||!1}isInstallable(){return this.payload.installable||!1}getLogoUrl(){return this.payload.logoUrl}getLogoUrlDark(){return this.payload.logoUrlDark}getDescription(){return this.payload.description}setUsers(e){return this.payload.users=e,this}getUsers(){return this.payload.users}getMenuUrl(){return this.payload.menuUrl}getMenuUrlDev(){return this.payload.menuUrlDev}getMenuText(){return this.payload.menuText}getMenuOpenMode(){return this.payload.menuOpenMode||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 Ws(this,void 0,void 0,function*(){return yield To(this.payload,this.getConfig()),this})}update(){return Ws(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 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 aa(xl);})();
|
|
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 _e=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(Vr(Error)),ma=(function(n){J(e,n);function e(t){return n.call(this,"Invalid DateTime: "+t.toMessage())||this}return e})(_e),ga=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Interval: "+t.toMessage())||this}return e})(_e),ya=(function(n){J(e,n);function e(t){return n.call(this,"Invalid Duration: "+t.toMessage())||this}return e})(_e),Nt=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(_e),Ii=(function(n){J(e,n);function e(t){return n.call(this,"Invalid unit "+t)||this}return e})(_e),Y=(function(n){J(e,n);function e(){return n.apply(this,arguments)||this}return e})(_e),Te=(function(n){J(e,n);function e(){return n.call(this,"Zone is an abstract class")||this}return e})(_e),p="numeric",se="short",z="long",ir={year:p,month:p,day:p},Yr={year:p,month:se,day:p},ki={year:p,month:se,day:p,weekday:se},Kr={year:p,month:z,day:p},Jr={year:p,month:z,day:p,weekday:z},Qr={hour:p,minute:p},Xr={hour:p,minute:p,second:p},en={hour:p,minute:p,second:p,timeZoneName:se},tn={hour:p,minute:p,second:p,timeZoneName:z},rn={hour:p,minute:p,hour12:!1},nn={hour:p,minute:p,second:p,hour12:!1},on={hour:p,minute:p,second:p,hour12:!1,timeZoneName:se},sn={hour:p,minute:p,second:p,hour12:!1,timeZoneName:z},an={year:p,month:p,day:p,hour:p,minute:p},un={year:p,month:p,day:p,hour:p,minute:p,second:p},ln={year:p,month:se,day:p,hour:p,minute:p},cn={year:p,month:se,day:p,hour:p,minute:p,second:p},Oi={year:p,month:se,day:p,weekday:se,hour:p,minute:p},dn={year:p,month:z,day:p,hour:p,minute:p,timeZoneName:se},fn={year:p,month:z,day:p,hour:p,minute:p,second:p,timeZoneName:se},hn={year:p,month:z,day:p,weekday:z,hour:p,minute:p,timeZoneName:z},pn={year:p,month:z,day:p,weekday:z,hour:p,minute:p,second:p,timeZoneName:z};function A(n){return typeof n=="undefined"}function Be(n){return typeof n=="number"}function lr(n){return typeof n=="number"&&n%1===0}function va(n){return typeof n=="string"}function wa(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 xi(){try{return typeof Intl!="undefined"&&!!Intl.RelativeTimeFormat}catch(n){return!1}}function Ea(n){return Array.isArray(n)?n:[n]}function oi(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 Ni(n,e){return e.reduce(function(t,r){return t[r]=n[r],t},{})}function Xe(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function me(n,e,t){return lr(n)&&n>=e&&n<=t}function Ta(n,e){return n-e*Math.floor(n/e)}function Je(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 mn(n){if(!(A(n)||n===null||n==="")){var e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function gn(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 or(n,e){var t=Ta(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 yn(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 sr(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 Hr(n){return n>99?n:n>60?1900+n:2e3+n}function Mi(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 cr(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 Fi(n){var e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new Y("Invalid unit value "+n);return e}function ar(n,e,t){var r={};for(var i in n)if(Xe(n,i)){if(t.indexOf(i)>=0)continue;var o=n[i];if(o==null)continue;r[e(i)]=Fi(o)}return r}function ur(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+Je(t,2)+":"+Je(r,2);case"narrow":return""+i+t+(r>0?":"+r:"");case"techie":return""+i+Je(t,2)+Je(r,2);default:throw new RangeError("Value format "+e+" is out of range for property format")}}function dr(n){return Ni(n,["hour","minute","second","millisecond"])}var Pi=/[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 Aa=["January","February","March","April","May","June","July","August","September","October","November","December"],Bi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ba=["J","F","M","A","M","J","J","A","S","O","N","D"];function _i(n){switch(n){case"narrow":return[].concat(ba);case"short":return[].concat(Bi);case"long":return[].concat(Aa);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 Ri=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Li=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ca=["M","T","W","T","F","S","S"];function Ui(n){switch(n){case"narrow":return[].concat(Ca);case"short":return[].concat(Li);case"long":return[].concat(Ri);case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Gi=["AM","PM"],Da=["Before Christ","Anno Domini"],Sa=["BC","AD"],Ia=["B","A"];function Vi(n){switch(n){case"narrow":return[].concat(Ia);case"short":return[].concat(Sa);case"long":return[].concat(Da);default:return null}}function ka(n){return Gi[n.hour<12?0:1]}function Oa(n,e){return Ui(e)[n.weekday-1]}function xa(n,e){return _i(e)[n.month-1]}function Na(n,e){return Vi(e)[n.year<0?0:1]}function Ma(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 Fa(n){var e=Ni(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(ir):return"M/d/yyyy";case I(Yr):return"LLL d, yyyy";case I(ki):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(en):return"h:mm a";case I(tn):return"h:mm a";case I(rn):return"HH:mm";case I(nn):return"HH:mm:ss";case I(on):return"HH:mm";case I(sn):return"HH:mm";case I(an):return"M/d/yyyy, h:mm a";case I(ln):return"LLL d, yyyy, h:mm a";case I(dn):return"LLLL d, yyyy, h:mm a";case I(hn):return r;case I(un):return"M/d/yyyy, h:mm:ss a";case I(cn):return"LLL d, yyyy, h:mm:ss a";case I(Oi):return"EEE, d LLL yyyy, h:mm a";case I(fn):return"LLLL d, yyyy, h:mm:ss a";case I(pn):return"EEEE, LLLL d, yyyy, h:mm:ss a";default:return r}}function si(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 Pa={D:ir,DD:Yr,DDD:Kr,DDDD:Jr,t:Qr,tt:Xr,ttt:en,tttt:tn,T:rn,TT:nn,TTT:on,TTTT:sn,f:an,ff:ln,fff:dn,ffff:hn,F:un,FF:cn,FFF:fn,FFFF:pn},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 Pa[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 Je(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?ka(r):c({hour:"numeric",hour12:!0},"dayperiod")},d=function(y,S){return s?xa(r,y):c(S?{month:y}:{month:y,day:"numeric"},"month")},f=function(y,S){return s?Oa(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?Na(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 si(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 si(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})(),et=(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})(),Fr=null,Hi=(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 Mi(i,s,a)},t.formatOffset=function(i,o){return ur(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 Fr===null&&(Fr=new e),Fr}}]),e})(et),Ba=RegExp("^"+Pi.source+"$"),tr={};function _a(n){return tr[n]||(tr[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"})),tr[n]}var Ra={year:0,month:1,day:2,hour:3,minute:4,second:5};function La(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 Ua(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=Ra[s];A(c)||(r[c]=parseInt(a,10))}return r}var Jt={},ce=(function(n){J(e,n),e.create=function(i){return Jt[i]||(Jt[i]=new e(i)),Jt[i]},e.resetCache=function(){Jt={},tr={}},e.isValidSpecifier=function(i){return!!(i&&i.match(Ba))},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 Mi(i,s,a,this.name)},t.formatOffset=function(i,o){return ur(this.offset(i),o)},t.offset=function(i){var o=new Date(i);if(isNaN(o))return NaN;var s=_a(this.name),a=s.formatToParts?Ua(s,o):La(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=yn({year:c,month:l,day:u,hour:g,minute:f,second:m,millisecond:0}),w=+o,y=w%1e3;return w-=y>=0?y:1e3+y,(v-w)/(60*1e3)},t.equals=function(i){return i.type==="iana"&&i.name===this.name},oe(e,[{key:"type",get:function(){return"iana"}},{key:"name",get:function(){return this.zoneName}},{key:"universal",get:function(){return!1}},{key:"isValid",get:function(){return this.valid}}]),e})(et),Pr=null,j=(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(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 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 ur(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"+ur(this.fixed,"narrow")}},{key:"universal",get:function(){return!0}},{key:"isValid",get:function(){return!0}}]),e})(et),$r=(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})(et);function Fe(n,e){var t;if(A(n)||n===null)return e;if(n instanceof et)return n;if(va(n)){var r=n.toLowerCase();return r==="local"?e:r==="utc"||r==="gmt"?j.utcInstance:(t=ce.parseGMTOffset(n))!=null?j.instance(t):ce.isValidSpecifier(r)?ce.create(n):j.parseSpecifier(r)||new $r(n)}else return Be(n)?j.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new $r(n)}var ai=function(){return Date.now()},Br=null,ui=null,li=null,ci=null,di=!1,x=(function(){function n(){}return n.resetCaches=function(){_.resetCache(),ce.resetCache()},oe(n,null,[{key:"now",get:function(){return ai},set:function(t){ai=t}},{key:"defaultZoneName",get:function(){return n.defaultZone.name},set:function(t){t?Br=Fe(t):Br=null}},{key:"defaultZone",get:function(){return Br||Hi.instance}},{key:"defaultLocale",get:function(){return ui},set:function(t){ui=t}},{key:"defaultNumberingSystem",get:function(){return li},set:function(t){li=t}},{key:"defaultOutputCalendar",get:function(){return ci},set:function(t){ci=t}},{key:"throwOnInvalid",get:function(){return di},set:function(t){di=t}}]),n})(),jr={};function zr(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=jr[t];return r||(r=new Intl.DateTimeFormat(n,e),jr[t]=r),r}var qr={};function Ga(n,e){e===void 0&&(e={});var t=JSON.stringify([n,e]),r=qr[t];return r||(r=new Intl.NumberFormat(n,e),qr[t]=r),r}var Zr={};function Va(n,e){e===void 0&&(e={});var t=e,r=t.base,i=ha(t,["base"]),o=JSON.stringify([n,i]),s=Zr[o];return s||(s=new Intl.RelativeTimeFormat(n,e),Zr[o]=s),s}var Me=null;function Ha(){if(Me)return Me;if(de()){var n=new Intl.DateTimeFormat().resolvedOptions().locale;return Me=!n||n==="und"?"en-US":n,Me}else return Me="en-US",Me}function $a(n){var e=n.indexOf("-u-");if(e===-1)return[n];var t,r=n.substring(0,e);try{t=zr(n).resolvedOptions()}catch(a){t=zr(r).resolvedOptions()}var i=t,o=i.numberingSystem,s=i.calendar;return[r,o,s]}function ja(n,e,t){return de()?((t||e)&&(n+="-u",t&&(n+="-ca-"+t),e&&(n+="-nu-"+e)),n):[]}function za(n){for(var e=[],t=1;t<=12;t++){var r=M.utc(2016,t,1);e.push(n(r))}return e}function qa(n){for(var e=[],t=1;t<=7;t++){var r=M.utc(2016,11,13+t);e.push(n(r))}return e}function Qt(n,e,t,r,i){var o=n.listingMode(t);return o==="error"?null:o==="en"?r(e):i(e)}function Za(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 Wa=(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=Ga(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):gn(r,3);return Je(o,this.padTo)}},n})(),Ya=(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=zr(r,l)}}var e=n.prototype;return e.format=function(){if(this.hasIntl)return this.dtf.format(this.dt.toJSDate());var r=Fa(this.opts),i=_.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})(),Ka=(function(){function n(t,r,i){this.opts=Object.assign({style:"long"},i),!r&&xi()&&(this.rtf=Va(t,i))}var e=n.prototype;return e.format=function(r,i){return this.rtf?this.rtf.format(r,i):Ma(i,r,this.opts.numeric,this.opts.style!=="long")},e.formatToParts=function(r,i){return this.rtf?this.rtf.formatToParts(r,i):[]},n})(),_=(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":Ha()),l=i||x.defaultNumberingSystem,u=o||x.defaultOutputCalendar;return new n(c,l,u,a)},n.resetCache=function(){Me=null,jr={},qr={},Zr={}},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=$a(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=ja(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),Qt(this,r,o,_i,function(){var a=i?{month:r,day:"numeric"}:{month:r},c=i?"format":"standalone";return s.monthsCache[c][r]||(s.monthsCache[c][r]=za(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),Qt(this,r,o,Ui,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]=qa(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),Qt(this,void 0,r,function(){return Gi},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),Qt(this,r,i,Vi,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 Wa(this.intl,r.forceSimple||this.fastNumbers,r)},e.dtFormatter=function(r,i){return i===void 0&&(i={}),new Ya(r,this.intl,i)},e.relFormatter=function(r){return r===void 0&&(r={}),new Ka(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=Za(this)),this.fastNumbersCached}}]),n})();function tt(){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 Re(){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 rt(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 $i(){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 ji=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,vn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,zi=RegExp(""+vn.source+ji.source+"?"),wn=RegExp("(?:T"+zi.source+")?"),Ja=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Qa=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Xa=/(\d{4})-?(\d{3})/,eu=$i("weekYear","weekNumber","weekDay"),tu=$i("year","ordinal"),ru=/(\d{4})-(\d\d)-(\d\d)/,qi=RegExp(vn.source+" ?(?:"+ji.source+"|("+Pi.source+"))?"),nu=RegExp("(?: "+qi.source+")?");function Qe(n,e,t){var r=n[e];return A(r)?t:V(r)}function Zi(n,e){var t={year:Qe(n,e),month:Qe(n,e+1,1),day:Qe(n,e+2,1)};return[t,null,e+3]}function Le(n,e){var t={hours:Qe(n,e,0),minutes:Qe(n,e+1,0),seconds:Qe(n,e+2,0),milliseconds:mn(n[e+3])};return[t,null,e+4]}function nt(n,e){var t=!n[e]&&!n[e+1],r=cr(n[e+1],n[e+2]),i=t?null:j.instance(r);return[{},i,e+3]}function Wi(n,e){var t=n[e]?ce.create(n[e]):null;return[{},t,e+1]}var iu=RegExp("^T?"+vn.source+"$"),ou=/^-?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 su(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(mn(l),d)}]}var au={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?Hr(V(e)):V(e),month:Bi.indexOf(t)+1,day:V(r),hour:V(i),minute:V(o)};return s&&(a.second=V(s)),n&&(a.weekday=n.length>3?Ri.indexOf(n)+1:Li.indexOf(n)+1),a}var uu=/^(?:(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 lu(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=au[c]:l?m=0:m=cr(u,d),[f,new j(m)]}function cu(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var du=/^(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$/,fu=/^(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$/,hu=/^(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 fi(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,j.utcInstance]}function pu(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,j.utcInstance]}var mu=tt(Ja,wn),gu=tt(Qa,wn),yu=tt(Xa,wn),vu=tt(zi),wu=Re(Zi,Le,nt),Eu=Re(eu,Le,nt),Tu=Re(tu,Le,nt),Au=Re(Le,nt);function bu(n){return rt(n,[mu,wu],[gu,Eu],[yu,Tu],[vu,Au])}function Cu(n){return rt(cu(n),[uu,lu])}function Du(n){return rt(n,[du,fi],[fu,fi],[hu,pu])}function Su(n){return rt(n,[ou,su])}var Iu=Re(Le);function ku(n){return rt(n,[iu,Iu])}var Ou=tt(ru,nu),xu=tt(qi),Nu=Re(Zi,Le,nt,Wi),Mu=Re(Le,nt,Wi);function Fu(n){return rt(n,[Ou,Nu],[xu,Mu])}var Pu="Invalid Duration",Yi={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}},Bu=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}},Yi),W=146097/400,We=146097/4800,_u=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}},Yi),Ye=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Ru=Ye.slice(0).reverse();function Ne(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 Lu(n){return n<0?Math.floor(n):Math.ceil(n)}function Ki(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?Lu(s):Math.trunc(s);r[i]+=c,e[t]-=c*o}function Uu(n,e){Ru.reduce(function(t,r){return A(e[r])?t:(t&&Ki(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||_.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=r?_u:Bu,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:ar(r,n.normalizeUnit,["locale","numberingSystem","conversionAccuracy","zone"]),loc:_.fromObject(r),conversionAccuracy:r.conversionAccuracy})},n.fromISO=function(r,i){var o=Su(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=ku(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 ya(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 Ii(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):Pu},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+=gn(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=Pe(r),o={},s=Ae(Ye),a;!(a=s()).done;){var c=a.value;(Xe(i.values,c)||Xe(this.values,c))&&(o[c]=i.get(c)+this.get(c))}return Ne(this,{values:o},!0)},e.minus=function(r){if(!this.isValid)return this;var i=Pe(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]=Fi(r(this.values[a],a))}return Ne(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,ar(r,n.normalizeUnit,[]));return Ne(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),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 Uu(this.matrix,r),Ne(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(Ye),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;Be(c[f])&&(m+=c[f]);var v=Math.trunc(m);s[f]=v,a[f]=m-v;for(var w in c)Ye.indexOf(w)>Ye.indexOf(f)&&Ki(this.matrix,c,w,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={},i=0,o=Object.keys(this.values);i<o.length;i++){var s=o[i];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 i(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(!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 Pe(n){if(Be(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 Gu(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 ga(o);return new n({invalid:o})},n.fromDateTimes=function(r,i){var o=xt(r),s=xt(i),a=Gu(o,s);return a==null?new n({start:o,end:s}):a},n.after=function(r,i){var o=Pe(i),s=xt(r);return n.fromDateTimes(s,s.plus(o))},n.before=function(r,i){var o=Pe(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=Pe(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 Fe(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||_.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||_.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||_.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||_.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 _.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 _.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=xi();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 hi(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 Vu(n,e,t){for(var r=[["years",function(v,w){return w.year-v.year}],["quarters",function(v,w){return w.quarter-v.quarter}],["months",function(v,w){return w.month-v.month+(w.year-v.year)*12}],["weeks",function(v,w){var y=hi(v,w);return(y-y%7)/7}],["days",hi]],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 Hu(n,e,t,r){var i=Vu(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 Tn={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"},pi={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]},$u=Tn.hanidec.replace(/[\[|\]]/g,"").split("");function ju(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(Tn.hanidec)!==-1)e+=$u.indexOf(n[t]);else for(var i in pi){var o=pi[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(""+Tn[t||"latn"]+e)}var zu="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(ju(i))}}}var qu="\xA0",Ji="( |"+qu+")",Qi=new RegExp(Ji,"g");function Zu(n){return n.replace(/\./g,"\\.?").replace(Qi,Ji)}function mi(n){return n.replace(/\./g,"").replace(Qi," ").toLowerCase()}function ne(n,e){return n===null?null:{regex:RegExp(n.map(Zu).join("|")),deser:function(r){var i=r[0];return n.findIndex(function(o){return mi(i)===mi(o)})+e}}}function gi(n,e){return{regex:n,deser:function(r){var i=r[1],o=r[2];return cr(i,o)},groups:e}}function yi(n){return{regex:n,deser:function(t){var r=t[0];return r}}}function Wu(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Yu(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(Wu(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,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 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 yi(u);case"a":return ne(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 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 gi(new RegExp("([+-]"+a.source+")(?::("+r.source+"))?"),2);case"ZZZ":return gi(new RegExp("([+-]"+a.source+")("+r.source+")?"),2);case"z":return yi(/[a-z_+-/]{1,256}?/i);default:return m(y)}},v=g(n)||{invalidReason:zu};return v.token=n,v}var Ku={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 Ju(n,e,t){var r=n.type,i=n.value;if(r==="literal")return{literal:!0,val:i};var o=t[r],s=Ku[r];if(typeof s=="object"&&(s=s[o]),s)return{literal:!1,val:s}}function Qu(n){var e=n.map(function(t){return t.regex}).reduce(function(t,r){return t+"("+r.source+")"},"");return["^"+e+"$",n]}function Xu(n,e,t){var r=n.match(e);if(r){var i={},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&&(i[a.token.val[0]]=a.deser(r.slice(o,o+c))),o+=c}return[r,i]}else return[r,{}]}function el(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 j(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=mn(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 _r=null;function tl(){return _r||(_r=M.fromMillis(1555555555555)),_r}function rl(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(tl()),o=i.map(function(s){return Ju(s,e,t)});return o.includes(void 0)?n:o}function nl(n,e){var t;return(t=Array.prototype).concat.apply(t,n.map(function(r){return rl(r,e)}))}function Xi(n,e,t){var r=nl(le.parseFormat(t),n),i=r.map(function(w){return Yu(w,n)}),o=i.find(function(w){return w.invalidReason});if(o)return{input:e,tokens:r,invalidReason:o.invalidReason};var s=Qu(i),a=s[0],c=s[1],l=RegExp(a,"i"),u=Xu(e,l,c),d=u[0],f=u[1],m=f?el(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(n,e,t){var r=Xi(n,e,t),i=r.result,o=r.zone,s=r.invalidReason;return[i,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(n,e){return new ie("unit out of range","you specified "+e+" (of type "+typeof e+") as a "+n+", which is invalid")}function ro(n,e,t){var r=new Date(Date.UTC(n,e-1,t)).getUTCDay();return r===0?7:r}function no(n,e,t){return t+(_t(n)?to:eo)[e-1]}function io(n,e){var t=_t(n)?to:eo,r=t.findIndex(function(o){return o<e}),i=e-t[r];return{month:r+1,day:i}}function Wr(n){var e=n.year,t=n.month,r=n.day,i=no(e,t,r),o=ro(e,t,r),s=Math.floor((i-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(n))}function vi(n){var e=n.weekYear,t=n.weekNumber,r=n.weekday,i=ro(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=io(a,s),l=c.month,u=c.day;return Object.assign({year:a,month:l,day:u},dr(n))}function Rr(n){var e=n.year,t=n.month,r=n.day,i=no(e,t,r);return Object.assign({year:e,ordinal:i},dr(n))}function wi(n){var e=n.year,t=n.ordinal,r=io(e,t),i=r.month,o=r.day;return Object.assign({year:e,month:i,day:o},dr(n))}function ol(n){var e=lr(n.weekYear),t=me(n.weekNumber,1,sr(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 sl(n){var e=lr(n.year),t=me(n.ordinal,1,Ft(n.year));return e?t?!1:K("ordinal",n.ordinal):K("year",n.year)}function oo(n){var e=lr(n.year),t=me(n.month,1,12),r=me(n.day,1,or(n.year,n.month));return e?t?r?!1:K("day",n.day):K("month",n.month):K("year",n.year)}function so(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 Lr="Invalid DateTime",Ei=864e13;function Xt(n){return new ie("unsupported zone",'the zone "'+n.name+'" is not supported')}function Ur(n){return n.weekData===null&&(n.weekData=Wr(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 ao(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 Ti(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 rr(n,e,t){return ao(yn(n),e,t)}function Ai(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,or(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=yn(o),c=ao(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 Ke(n,e,t){return t===void 0&&(t=!0),n.isValid?le.create(_.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function bi(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 w=Ke(n,v);return c&&(w="T"+w),w}var uo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},al={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ul={ordinal:1,hour:0,minute:0,second:0,millisecond:0},lo=["year","month","day","hour","minute","second","millisecond"],ll=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],cl=["year","ordinal","hour","minute","second","millisecond"];function Ci(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 Ii(n);return e}function Di(n,e){for(var t=Ae(lo),r;!(r=t()).done;){var i=r.value;A(n[i])&&(n[i]=uo[i])}var o=oo(n)||so(n);if(o)return M.invalid(o);var s=x.now(),a=e.offset(s),c=rr(n,a,e),l=c[0],u=c[1];return new M({ts:l,zone:e,o:u})}function Si(n,e,t){var r=A(t.round)?!0:t.round,i=function(d,f){d=gn(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:Xt(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=Ti(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||_.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():Di({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:j.utcInstance}):Di({year:r,month:i,day:o,hour:s,minute:a,second:c,millisecond:l},j.utcInstance)},n.fromJSDate=function(r,i){i===void 0&&(i={});var o=wa(r)?r.valueOf():NaN;if(Number.isNaN(o))return n.invalid("invalid input");var s=Fe(i.zone,x.defaultZone);return s.isValid?new n({ts:o,zone:s,loc:_.fromObject(i)}):n.invalid(Xt(s))},n.fromMillis=function(r,i){if(i===void 0&&(i={}),Be(r))return r<-Ei||r>Ei?n.invalid("Timestamp out of range"):new n({ts:r,zone:Fe(i.zone,x.defaultZone),loc:_.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={}),Be(r))return new n({ts:r*1e3,zone:Fe(i.zone,x.defaultZone),loc:_.fromObject(i)});throw new Y("fromSeconds requires a numerical input")},n.fromObject=function(r){var i=Fe(r.zone,x.defaultZone);if(!i.isValid)return n.invalid(Xt(i));var o=x.now(),s=i.offset(o),a=ar(r,Ci,["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=_.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,w,y=Ti(o,s);g?(v=ll,w=al,y=Wr(y)):c?(v=cl,w=ul,y=Rr(y)):(v=lo,w=uo);for(var S=!1,ae=Ae(v),D;!(D=ae()).done;){var L=D.value,Nr=a[L];A(Nr)?S?a[L]=w[L]:a[L]=y[L]:S=!0}var Ys=g?ol(a):c?sl(a):oo(a),Rn=Ys||so(a);if(Rn)return n.invalid(Rn);var Ks=g?vi(a):c?wi(a):a,Ln=rr(Ks,s,i),Js=Ln[0],Qs=Ln[1],Mr=new n({ts:Js,zone:i,o:Qs,loc:m});return a.weekday&&d&&r.weekday!==Mr.weekday?n.invalid("mismatched weekday","you can't specify both a weekday of "+a.weekday+" and a date of "+Mr.toISO()):Mr},n.fromISO=function(r,i){i===void 0&&(i={});var o=bu(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=Cu(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=Du(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=_.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0}),f=il(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=Fu(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 ma(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(j.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=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 n.invalid(Xt(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=ar(r,Ci,[]),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=vi(Object.assign(Wr(this.c),i)):A(i.ordinal)?(d=Object.assign(this.toObject(),i),A(i.day)&&(d.day=Math.min(or(d.year,d.month),d.day))):d=wi(Object.assign(Rr(this.c),i));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 i=Pe(r);return kt(this,Ai(this,i))},e.minus=function(r){if(!this.isValid)return this;var i=Pe(r).negate();return kt(this,Ai(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):Lr},e.toLocaleString=function(r){return r===void 0&&(r=ir),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 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),Ke(this,a)},e.toISOWeekDate=function(){return Ke(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 bi(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 i=r===void 0?{}:r,o=i.includeOffset,s=o===void 0?!0:o,a=i.includeZone,c=a===void 0?!1:a;return bi(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 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=Ea(i).map(H.normalizeUnit),c=r.valueOf()>this.valueOf(),l=c?this:r,u=c?r:this,d=Hu(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),Si(i,this.plus(o),Object.assign(r,{numeric:"always",units:s,unit:a}))},e.toRelativeCalendar=function(r){return r===void 0&&(r={}),this.isValid?Si(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 oi(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 oi(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=_.fromOpts({locale:c,numberingSystem:u,defaultToEN:!0});return Xi(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?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 ir}},{key:"DATE_MED",get:function(){return Yr}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return ki}},{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 en}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return tn}},{key:"TIME_24_SIMPLE",get:function(){return rn}},{key:"TIME_24_WITH_SECONDS",get:function(){return nn}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return on}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return sn}},{key:"DATETIME_SHORT",get:function(){return an}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return un}},{key:"DATETIME_MED",get:function(){return ln}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return cn}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return Oi}},{key:"DATETIME_FULL",get:function(){return dn}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return fn}},{key:"DATETIME_HUGE",get:function(){return hn}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return pn}}]),n})();function xt(n){if(M.isDateTime(n))return n;if(n&&n.valueOf&&Be(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 dl="1.28.1";q.DateTime=M;q.Duration=H;q.FixedOffsetZone=j;q.IANAZone=ce;q.Info=Mt;q.Interval=Pt;q.InvalidZone=$r;q.LocalZone=Hi;q.Settings=x;q.VERSION=dl;q.Zone=et});var xl={};oa(xl,{Account:()=>G,AccountType:()=>F,AccountsDataTableBuilder:()=>lt,Agent:()=>ct,Amount:()=>E,App:()=>we,Backlog:()=>At,Balance:()=>ke,BalanceType:()=>be,BalancesDataTableBuilder:()=>pe,BalancesReport:()=>Et,Billing:()=>pt,Bkper:()=>k,BkperError:()=>ue,Book:()=>X,BooksDataTableBuilder:()=>xr,BotResponse:()=>ft,BotResponseType:()=>st,Collaborator:()=>ze,Collection:()=>Se,Connection:()=>qe,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:()=>it,Query:()=>Tt,Template:()=>Dt,Transaction:()=>$,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 ua=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())})},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 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 ua(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())})},la="https://api.bkper.app";function ca(n){return n.apiBaseUrl?n.apiBaseUrl:la}var te=class extends Ze{constructor(e,t){let r=ca(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 Ee=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Gn(n,e,t){return Ee(this,void 0,void 0,function*(){var r=yield new h(`${n}/accounts`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Vn(n,e,t){return Ee(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 Hn(n,e,t){return Ee(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 $n(n,e,t){return Ee(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 jn(n,e,t){return Ee(this,void 0,void 0,function*(){var r=yield new h(`${n}/accounts/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function zn(n,e,t){return Ee(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 qn(n,e,t){return Ee(this,void 0,void 0,function*(){return(yield new h(`${n}/accounts/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function Zn(n,e){return Ee(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 xe=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 Yn(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Kn(n,e,t){return xe(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 Jn(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function Qn(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups/${e.id}`,t).setMethod("DELETE").fetch();return r.data})}function Xn(n,e){return xe(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 ei(n,e,t){return xe(this,void 0,void 0,function*(){var r=yield new h(`${n}/groups/${encodeURIComponent(e)}`,t).setMethod("GET").fetch();return r.data})}function ti(n,e,t){return xe(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=sa(co(),1);var fl=20,hl=1,Ue=1e6,fo=1e6,pl=-7,ml=21,gl=!1,Rt="[big.js] ",Ge=Rt+"Invalid ",fr=Ge+"decimal places",yl=Ge+"rounding mode",ho=Rt+"Division by zero",C={},fe=void 0,vl=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function po(){function n(e){var t=this;if(!(t instanceof n))return e===fe?po():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(Ge+"value");e=e===0&&1/e<0?"-0":String(e)}wl(t,e)}t.constructor=n}return n.prototype=C,n.DP=fl,n.RM=hl,n.NE=pl,n.PE=ml,n.strict=gl,n.roundDown=0,n.roundHalfUp=1,n.roundHalfEven=2,n.roundUp=3,n}function wl(n,e){var t,r,i;if(!vl.test(e))throw Error(Ge+"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 Ve(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(yl);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 He(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>Ue)throw Error(fr);if(!i[0])throw Error(ho);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),w=v.length,y=n,S=y.c=[],ae=0,D=s+(y.e=e.e-n.e)+1;for(y.s=o,o=D<0?0:D,f.unshift(0);w++<a;)v.push(0);do{for(l=0;l<10;l++){if(a!=(w=v.length))u=a>w?1:-1;else for(d=-1,u=0;++d<a;)if(i[d]!=v[d]){u=i[d]>v[d]?1:-1;break}if(u<0){for(c=w==a?i:f;w;){if(v[--w]<c[w]){for(d=w;d&&!v[--d];)v[d]=9;--v[d],v[w]+=10}v[w]-=c[w]}for(;!v[0];)v.shift()}else break}S[ae++]=u?l:++l,v[0]&&u?v[w]=r[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(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(ho);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<-fo||n>fo)throw Error(Ge+"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>Ue)throw Error(Ge+"precision");return Ve(new this.constructor(this),n,e)};C.round=function(n,e){if(n===fe)n=0;else if(n!==~~n||n<-Ue||n>Ue)throw Error(fr);return Ve(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(+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),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 Ve(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>Ue)throw Error(fr);for(t=Ve(new t.constructor(t),++n,e);t.c.length<n;)t.c.push(0)}return He(t,!0,!!r)};C.toFixed=function(n,e){var t=this,r=t.c[0];if(n!==fe){if(n!==~~n||n<0||n>Ue)throw Error(fr);for(t=Ve(new t.constructor(t),n+t.e+1,e),n=n+t.e+1;t.c.length<n;)t.c.push(0)}return He(t,!1,!!r)};C[Symbol.for("nodejs.util.inspect.custom")]=C.toJSON=C.toString=function(){var n=this,e=n.constructor;return He(n,n.e<=e.NE||n.e>=e.PE,!!n.c[0])};C.toNumber=function(){var n=+He(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>Ue)throw Error(Ge+"precision");for(t=Ve(new r(t),n,e);t.c.length<n;)t.c.push(0)}return He(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 He(n,n.e<=e.NE||n.e>=e.PE,!0)};var El=po(),Lt=El;var E=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 $e;(function(n){n.COMMA="COMMA",n.DOT="DOT"})($e||($e={}));var it;(function(n){n.NONE="NONE",n.VIEWER="VIEWER",n.RECORDER="RECORDER",n.POSTER="POSTER",n.EDITOR="EDITOR",n.OWNER="OWNER"})(it||(it={}));var hr;(function(n){n.PUBLIC="PUBLIC",n.PRIVATE="PRIVATE"})(hr||(hr={}));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 pr;(function(n){n.MONTH="MONTH",n.QUARTER="QUARTER",n.YEAR="YEAR"})(pr||(pr={}));var mr;(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"})(mr||(mr={}));var ge;(function(n){n.TRASHED="TRASHED",n.DRAFT="DRAFT",n.UNCHECKED="UNCHECKED",n.CHECKED="CHECKED"})(ge||(ge={}));var ot;(function(n){n.SIDEBAR="SIDEBAR",n.EXPANDED="EXPANDED",n.NEW_TAB="NEW_TAB"})(ot||(ot={}));var st;(function(n){n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR"})(st||(st={}));var gr;(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_OVERNIGHT="BOOK_OVERNIGHT",n.BOOK_CREATED="BOOK_CREATED",n.BOOK_UPDATED="BOOK_UPDATED",n.BOOK_DELETED="BOOK_DELETED"})(gr||(gr={}));function vr(n,e){return e<=0?"":e===1?n:n+vr(n,e-1)}function go(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 yr=null;function wr(n,e){return n==null&&(n=new E("0")),e?new E(n).round(e):new E(n).round(2)}function ye(n,e,t){if(n==null)return"";if(typeof n=="string"){if(n.trim()=="")return"";n=new E(n)}if(n==null)return"";t==null&&(t=2);var r=n.toFixed(t)+"";return e==$e.DOT?r.replace(/\,/g,"."):r.replace(/\./g,",")}function Er(n,e){if(n!=null){if(!isNaN(+n)&&isFinite(+n))return new E(n);e==$e.DOT?n=n.replace(/\,/g,""):n=n.replace(/\./g,"").replace(/\,/g,".");try{return new E(n)}catch(t){return}}}function yo(n,e){if(!n)return new Date;var t=n/1e4,r=n/100%100,i=n%100,o=bn(t,r,i,e);return o}function bn(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):je(n,t))}function je(n,e){return n==null||Object.prototype.toString.call(n)!=="[object Date]"?"":((!e||e=="")&&(e="UTC"),Gt.DateTime.fromJSDate(n,{zone:e}).toISODate())}function at(n){return+n.replace(/-/g,"")}function Tr(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 Z(n,e){return n==null?new E(0):e!=null&&!e?n.times(-1):n}function Ce(n){for(var e=0,t=0;t<n.length;t++)n[t].length>e&&(e=n[t].length);for(var t=0;t<n.length;t++)for(;n[t].length<e;)n[t].push(null);return n}function ve(n){return 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=Tl(n.trim().toLowerCase()),e&&(n=n.replace(new RegExp(" ","g"),e)),n)}function Tl(n){for(var e=n.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 n=0;n<An.length;n++)for(var e=An[n].letters.split(""),t=0;t<e.length;t++)yr[e[t]]=An[n].base}return yr}var An=[{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 ti(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 Yn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}update(){return $t(this,void 0,void 0,function*(){return this.payload=yield Jn(this.book.getId(),this.payload,this.getConfig()),this.updateGroupCache(),this})}remove(){return $t(this,void 0,void 0,function*(){return this.payload=yield Qn(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(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 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 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 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){let t=e.getId();if(this.payload.groups==null||!t)return!1;for(var r=0;r<this.payload.groups.length;r++)if(this.payload.groups[r].id===t)return!0;return!1}create(){return ut(this,void 0,void 0,function*(){return this.payload=yield Gn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}update(){return ut(this,void 0,void 0,function*(){return this.payload=yield Hn(this.book.getId(),this.payload,this.getConfig()),this.updateAccountCache(),this})}remove(){return ut(this,void 0,void 0,function*(){return this.payload=yield jn(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(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())})},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 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 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 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 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(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 wo(n){return br(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 br(this,void 0,void 0,function*(){return(yield new te(`v5/apps/${n}`,e).setMethod("GET").fetch()).data})}function To(n,e){return br(this,void 0,void 0,function*(){var t=yield new te("v5/apps",e).setMethod("POST").setPayload(n).fetch();return t.data})}function Ao(n,e){return br(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 Co(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 Do(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 So(n,e){return De(this,void 0,void 0,function*(){return(yield new h("",e).setMethod("POST").setPayload(n).fetch()).data})}function Io(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 ko(n,e){return De(this,void 0,void 0,function*(){new h(`${n}/audit`,e).setMethod("PATCH").fetch()})}function Oo(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 xo(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 No(n,e){return De(this,void 0,void 0,function*(){return(yield new h(`${n}`,e).setMethod("DELETE").fetch()).data})}var Cr=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Fo(n,e){return Cr(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 Po(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${n}/queries`,t).setMethod("POST").setPayload(e).fetch()).data})}function Bo(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${n}/queries`,t).setMethod("PUT").setPayload(e).fetch()).data})}function _o(n,e,t){return Cr(this,void 0,void 0,function*(){return(yield new h(`${n}/queries/${e}`,t).setMethod("DELETE").fetch()).data})}var Al=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Lo(n,e,t){return Al(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 Ze(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 Uo(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 Dr(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 Go(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 Vo(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 Ho(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 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())})};function jo(n,e){return Sr(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 Cn(n,e,t){return Sr(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 Sr(this,void 0,void 0,function*(){return(yield new h(`${n}/integrations`,t).setPayload(e).setMethod("PUT").fetch()).data})}function zo(n,e,t){return Sr(this,void 0,void 0,function*(){return(yield new h(`${n}/integrations/${e}`,t).setMethod("DELETE").fetch()).data})}var B=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Zo(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions`,t).setMethod("POST").setPayload(e).fetch();return r.data})}function Wo(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/post/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Yo(n,e,t){return B(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 Ko(n,e,t,r){return B(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 Jo(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/check/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Qo(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e};yield new h(`${n}/transactions/uncheck/batch`,t).setMethod("PATCH").setPayload(r).fetch()})}function Xo(n,e,t,r){return B(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 es(n,e,t){return B(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 ts(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions`,t).setMethod("PUT").setPayload(e).fetch();return r.data})}function rs(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/post`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ns(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/check`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function is(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/uncheck`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function os(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/trash`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function ss(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/restore`,t).setMethod("PATCH").setPayload(e).fetch();return r.data})}function as(n,e,t){return B(this,void 0,void 0,function*(){var r=yield new h(`${n}/transactions/${e}`,t).setMethod("GET").fetch();return r.data})}function us(n,e,t){return B(this,void 0,void 0,function*(){let r={items:e.map(s=>({id:s}))},o=(yield new h(`${n}/transactions/load`,t).setMethod("POST").setPayload(r).fetch()).data;return o!=null&&o.items!=null?o.items:[]})}function ls(n,e,t,r,i){return B(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 cs(n,e,t){return B(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 ds(n,e,t){return B(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 hs(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 ps(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 ms(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 gs(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 ys(n,e){return qt(this,void 0,void 0,function*(){return(yield new h(`${n.getId()}/events/backlog`,e).setMethod("GET").fetch()).data})}var Zt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function ws(n,e,t,r){return Zt(this,void 0,void 0,function*(){let i=new h(`${n}/collaborators/request`,r).setMethod("POST").addParam("permission",e);t&&(i=i.addParam("message",t)),yield i.fetch()})}function Es(n,e,t){return Zt(this,void 0,void 0,function*(){return(yield new h(`${n}/collaborators/request/${encodeURIComponent(e)}`,t).setMethod("GET").fetch()).data})}function Ts(n,e){return Zt(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 Zt(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 As(n,e,t){return Zt(this,void 0,void 0,function*(){return(yield new h(`${n}/collaborators/${e}`,t).setMethod("DELETE").fetch()).data})}var In=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},ze=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 In(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 In(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 In(this,void 0,void 0,function*(){let e=this.getEmail();if(!e)throw new Error("Collaborator email is required");return this.payload=yield As(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 bs(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 Cs(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("POST").setPayload(n).fetch()).data})}function Ds(n,e){return dt(this,void 0,void 0,function*(){return(yield new O("collections",e).setMethod("PUT").setPayload(n).fetch()).data})}function Ss(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 Is(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 ks(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 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())})},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 Is(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 ks(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 Cs(this.payload,this.getConfig()),this})}update(){return Wt(this,void 0,void 0,function*(){return this.payload=yield Ds(this.payload,this.getConfig()),this})}remove(){return Wt(this,void 0,void 0,function*(){return(yield Ss(this.payload,this.getConfig())).map(t=>new X(t,this.config))})}};var xs=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 xs(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})}remove(){return xs(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 ms(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 Ns(n,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("GET").fetch()).data})}function Ms(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 Fs(n,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("POST").fetch()).data})}function Ps(n,e){return ht(this,void 0,void 0,function*(){return(yield new O("user/connections",e).setPayload(n).setMethod("PUT").fetch()).data})}function Bs(n,e){return ht(this,void 0,void 0,function*(){return(yield new O(`user/connections/${n}`,e).setMethod("DELETE").fetch()).data})}function _s(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 Ls=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},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 Ls(this,void 0,void 0,function*(){let e=this.getBookId();return e&&(this.payload=yield zt(e,this.payload,this.getConfig())),this})}remove(){return Ls(this,void 0,void 0,function*(){let e=this.getBookId(),t=this.getId();return e&&t&&(this.payload=yield zo(e,t,this.getConfig())),this})}};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())})},qe=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 _s(e,this.getConfig())).map(i=>new ee(i,this.config)):[]})}create(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Fs(this.payload,this.getConfig()),this})}update(){return Ir(this,void 0,void 0,function*(){return this.payload=yield Ps(this.payload,this.getConfig()),this})}remove(){return Ir(this,void 0,void 0,function*(){let e=this.getId();return e&&(this.payload=yield Bs(e,this.getConfig())),this})}};var Yt=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})};function Us(n){return Yt(this,void 0,void 0,function*(){return(yield new O("user",n).setMethod("GET").fetch()).data})}function Gs(n){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing",n).setMethod("GET").fetch()).data})}function Vs(n){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing/counts",n).setMethod("GET").fetch()).data})}function Hs(n,e){return Yt(this,void 0,void 0,function*(){return(yield new O("user/billing/portal",e).addParam("returnUrl",n).fetch()).data})}function $s(n,e,t,r,i){return Yt(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 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())})},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(){let e=this.payload.totalTransactionsThisMonth;return e!=null?+e:void 0}getTotalTransactionsThisYear(){let e=this.payload.totalTransactionsThisYear;return e!=null?+e:void 0}getTransactionsAverage(){return this.payload.transactionsAverage}getTransactionsCapacity(){return this.payload.transactionsCapacity}getCounts(){return On(this,void 0,void 0,function*(){return yield Vs(this.getConfig())})}getPortalUrl(e){return On(this,void 0,void 0,function*(){let t=yield Hs(e,this.getConfig());return t==null?void 0:t.url})}getCheckoutUrl(e,t,r,i){return On(this,void 0,void 0,function*(){let o=yield $s(e,t,r,i,this.getConfig());return o==null?void 0:o.url})}};var xn=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 xn(this,void 0,void 0,function*(){let e=yield Gs(this.getConfig());return new pt(e,this.config)})}hasUsedConnections(){return this.payload.bankConnections}getConnections(){return xn(this,void 0,void 0,function*(){return(yield Ms(this.getConfig())).map(t=>new qe(t,this.config))})}getConnection(e){return xn(this,void 0,void 0,function*(){let t=yield Ns(e,this.getConfig());return new qe(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(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 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 n=0;n<256;++n)R.push((n+256).toString(16).slice(1));function js(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 Nn,Cl=new Uint8Array(16);function Mn(){if(!Nn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Nn=crypto.getRandomValues.bind(crypto)}return Nn(Cl)}var Dl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Fn={randomUUID:Dl};function Sl(n,e,t){var i,o,s;if(Fn.randomUUID&&!e&&!n)return Fn.randomUUID();n=n||{};let r=(s=(o=n.random)!=null?o:(i=n.rng)==null?void 0:i.call(n))!=null?s:Mn();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 js(r)}var Pn=Sl;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())})},$=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(),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_${Pn()}`),this.pendingFiles.set(e.getId(),e)),this.payload.files.push(e.json()),this}createPendingFiles(){return N(this,void 0,void 0,function*(){if(this.pendingFiles.size===0)return;this.payload.files==null&&(this.payload.files=[]);let e=Array.from(this.pendingFiles.entries()).map(r=>N(this,[r],void 0,function*([i,o]){o.book=this.book,o.setProperty("upload_method","attachment");let s=yield o.create();return{fileId:i,createdFile:s}})),t=yield Promise.all(e);for(let{fileId:r,createdFile:i}of t){let o=this.payload.files.findIndex(s=>s.id===r);o>=0?this.payload.files[o]=i.json():this.payload.files.push(i.json())}this.pendingFiles.clear()})}hasTag(e){for(var t=this.getTags(),r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}getCreditAccount(){return N(this,void 0,void 0,function*(){if(this.payload.creditAccount)return yield this.book.getAccount(this.payload.creditAccount.id)})}getCreditAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getCreditAccount())!=null?(e=yield this.getCreditAccount())===null||e===void 0?void 0:e.getName():""})}setCreditAccount(e){return e==null?(this.payload.creditAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.creditAccount=e.json()):e.id!=null&&(this.payload.creditAccount=e),this)}from(e){return this.setCreditAccount(e)}getDebitAccount(){return N(this,void 0,void 0,function*(){if(this.payload.debitAccount)return yield this.book.getAccount(this.payload.debitAccount.id)})}getDebitAccountName(){return N(this,void 0,void 0,function*(){var e;return(yield this.getDebitAccount())!=null?(e=yield this.getDebitAccount())===null||e===void 0?void 0:e.getName():""})}setDebitAccount(e){return e==null?(this.payload.debitAccount=void 0,this):(e instanceof G?e.getId()!=null&&(this.payload.debitAccount={id:e.getId(),name:e.getName()}):e.id!=null&&(this.payload.debitAccount={id:e.id,name:e.name}),this)}to(e){return this.setDebitAccount(e)}getAmount(){return this.payload.amount!=null&&this.payload.amount.trim()!=""?new E(this.payload.amount):void 0}getAmountFormatted(){let e=this.getAmount();if(e)return this.book.formatValue(e)}setAmount(e){return typeof e=="string"?(e=Er(e,this.book.getDecimalSeparator())+"",this.payload.amount=e.toString(),this):(e=new E(e),e.eq(0)?(this.payload.amount=void 0,this):(this.payload.amount=e.abs().toString(),this))}getCreditAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return this.getAmount()})}getDebitAmount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isDebit(t))return this.getAmount()})}getOtherAccount(e){return N(this,void 0,void 0,function*(){let t=yield this.getAccount_(e);if(yield this.isCredit(t))return yield this.getDebitAccount();if(yield this.isDebit(t))return yield this.getCreditAccount()})}getOtherAccountName(e){return N(this,void 0,void 0,function*(){var t=yield this.getOtherAccount(e);return t!=null?t.getName():""})}isCredit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getCreditAccount())!=null&&e!=null&&((t=yield this.getCreditAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}isDebit(e){return N(this,void 0,void 0,function*(){var t;return(yield this.getDebitAccount())!=null&&e!=null&&((t=yield this.getDebitAccount())===null||t===void 0?void 0:t.getNormalizedName())==e.getNormalizedName()})}getAccount_(e){return N(this,void 0,void 0,function*(){return e==null||e instanceof G?e:yield this.book.getAccount(e)})}getDescription(){return this.payload.description==null?"":this.payload.description}setDescription(e){return this.payload.description=e,this}getDate(){return this.payload.date}setDate(e){if(typeof e=="string")if(e.indexOf("/")>0){let t=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 E(this.payload.creditAccount.balance):void 0}getDaEvolvedBalance_(){return this.payload.debitAccount!=null&&this.payload.debitAccount.balance!=null?new E(this.payload.debitAccount.balance):void 0}getAccountBalance(e){return N(this,void 0,void 0,function*(){var t=this.getCaEvolvedBalance_(),r=!0;if(t==null&&(t=this.getDaEvolvedBalance_(),r=!1),t!=null){if(!e){var i=r?yield this.getCreditAccount():yield this.getDebitAccount();t=Z(t,i==null?void 0:i.isCredit())}return wr(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 ns(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 is(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 Il=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 Il(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 $(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=bn(e,t,r,this.container.getBalancesReport().getBook().getTimeZoneOffset());return i}getFuzzyDate(){return this.payload.fuzzyDate}getCumulativeBalance(){return Z(this.getCumulativeBalanceRaw(),this.container.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit)}getPeriodBalance(){return Z(this.getPeriodBalanceRaw(),this.container.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance)}getPeriodCredit(){return new E(this.payload.periodCredit)}getPeriodDebit(){return new E(this.payload.periodDebit)}};var pe=class{constructor(e,t,r){this.maxDepth=0,this.expandAllAccounts=!1,this.expandAllGroups=!1,this.skipRoot=!1,this.book=e,this.balancesContainers=t,this.periodicity=r,this.balanceType=be.TOTAL,this.shouldFormatDate=!1,this.shouldHideDates=!1,this.shouldHideNames=!1,this.shouldFormatValue=!1,this.shouldTranspose=!1,this.shouldTrial=!1,this.shouldPeriod=!1,this.shouldRaw=!1,this.shouldAddProperties=!1,this.shouldAddHiddenProperties=!1}getBalance(e,t){return this.getRepresentativeBalance(e,t).toNumber()}getRepresentativeBalance(e,t){return e==null?new E(0):t?e.times(-1):e}getBalanceText(e,t){return this.book.formatValue(this.getRepresentativeBalance(e,t))}formatDates(e){return this.shouldFormatDate=e,this}formatValues(e){return this.shouldFormatValue=e,this}expanded(e){return typeof e=="boolean"&&e==!0?(this.maxDepth=1,this.skipRoot=!0):e==-1?this.expandAllGroups=!0:e==-2?this.expandAllAccounts=!0:typeof e=="number"&&e>0&&(this.maxDepth=e),this}type(e){return this.balanceType=e,this}transposed(e){return this.shouldTranspose=e,this}hideDates(e){return this.shouldHideDates=e,this}hideNames(e){return this.shouldHideNames=e,this}properties(e){return this.shouldAddProperties=e,this}hiddenProperties(e){return this.shouldAddHiddenProperties=e,this}trial(e){return this.shouldTrial=e,this}period(e){return this.shouldPeriod=e,this}raw(e){return this.shouldRaw=e,this}build(){return this.balanceType==be.TOTAL?this.buildTotalDataTable_():this.buildTimeDataTable_()}addPropertyKeys(e,t){for(let r of t.getPropertyKeys())!this.shouldAddHiddenProperties&&r.endsWith("_")||e.indexOf(r)<=-1&&e.push(r)}flattenContainers(e,t){for(let r of this.balancesContainers)this.expandAllAccounts?(this.flattenAllAccounts(r,e,t),e.sort(this.sortContainersFunction)):r.isFromGroup()&&this.expandAllGroups?this.flattenAllGroups(r,e,t):this.flattenMaxDepth(r,e,t)}flattenAllAccounts(e,t,r){if(e.isFromGroup())for(let i of e.getBalancesContainers())this.flattenAllAccounts(i,t,r);else t.push(e),this.shouldAddProperties&&this.addPropertyKeys(r,e)}sortContainersFunction(e,t){let r=0;e.isPermanent()&&!t.isPermanent()?r=-1:!e.isPermanent()&&t.isPermanent()&&(r=1),r==0&&(e.getParent()&&!t.getParent()?r=-1:!e.getParent()&&t.getParent()&&(r=1)),r==0&&(r=i(e)-i(t)),r==0&&(r=e.getName().toLowerCase().localeCompare(t.getName().toLowerCase()));function i(o){return o.isPermanent()&&!o.isCredit()?0:o.isPermanent()&&o.isCredit()?1:!o.isPermanent()&&o.isCredit()?2:!o.isPermanent()&&!o.isCredit()?3:4}return r}flattenMaxDepth(e,t,r){let i=e.getDepth();if(i<=this.maxDepth){!this.skipRoot&&!this.shouldTranspose&&(e.payload.name=vr(" ",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=vr(" ",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 E(u),this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber()),g.push(u)}d.push(g)}d.sort(function(D,L){return D[0].getTime()-L[0].getTime()});for(var v=null,w=0;w<d.length;w++){var g=d[w];if(w==0)for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}else for(var y=1;y<g.length;y++){var S=g[y];if(S=="null_amount"&&r)v&&(g[y]=v[y]);else if(S=="null_amount"){var u=new E(0);this.shouldFormatValue?u=ye(u,this.book.getDecimalSeparator(),this.book.getFractionDigits()):u=u.toNumber(),g[y]=u}}v=g,e.push(g)}if(this.shouldFormatDate&&e.length>0)for(var y=1;y<e.length;y++){var g=e[y];g.length>0&&(g[0]=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 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())})},wt=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 zs(this,void 0,void 0,function*(){return null})}getAccount(){return zs(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 E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return Z(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}createDataTable(){return new pe(this.balancesReport.getBook(),[this],this.balancesReport.getPeriodicity())}getBalancesContainers(){return[]}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainer(e){let t=ve(e);if(this.getNormalizedName()==t)return this;throw`${e} does not match ${this.getName()}`}};var qs=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())})},Or=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 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 E(this.payload.cumulativeBalance||0),this.isCredit())}getCumulativeBalanceRaw(){return new E(this.payload.cumulativeBalance||0)}getCumulativeCredit(){return new E(this.payload.cumulativeCredit||0)}getCumulativeDebit(){return new E(this.payload.cumulativeDebit||0)}getCumulativeBalanceText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalance())}getCumulativeBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getCumulativeBalanceRaw())}getCumulativeCreditText(){return this.balancesReport.getBook().formatValue(this.getCumulativeCredit())}getCumulativeDebitText(){return this.balancesReport.getBook().formatValue(this.getCumulativeDebit())}getPeriodBalance(){return Z(new E(this.payload.periodBalance||0),this.isCredit())}getPeriodBalanceRaw(){return new E(this.payload.periodBalance||0)}getPeriodCredit(){return new E(this.payload.periodCredit||0)}getPeriodDebit(){return new E(this.payload.periodDebit||0)}getPeriodBalanceText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalance())}getPeriodBalanceRawText(){return this.balancesReport.getBook().formatValue(this.getPeriodBalanceRaw())}getPeriodCreditText(){return this.balancesReport.getBook().formatValue(this.getPeriodCredit())}getPeriodDebitText(){return this.balancesReport.getBook().formatValue(this.getPeriodDebit())}getBalances(){return this.payload.balances?this.payload.balances.map(e=>new ke(this,e)):new Array}createDataTable(){return new pe(this.balancesReport.getBook(),this.getBalancesContainers(),this.balancesReport.getPeriodicity())}getProperties(){return this.payload.properties!=null?Object.assign({},this.payload.properties):{}}getProperty(...e){for(let t=0;t<e.length;t++){let r=e[t],i=this.payload.properties!=null?this.payload.properties[r]:null;if(i!=null&&i.trim()!="")return i}}getPropertyKeys(){let e=this.getProperties(),t=[];if(e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t=t.sort(),t}getBalancesContainers(){let e=[],t=this.getGroupContainers();t&&t.length>0&&(e=e.concat(t));let r=this.getAccountContainers();return r&&r.length>0&&(e=e.concat(r)),e}getGroupContainers(){let e=this.payload.groupBalances;if(this.groupBalances==null&&e!=null){this.groupBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.groupBalances.push(new n(this,this.balancesReport,r))}}return this.groupBalances||[]}getAccountContainers(){let e=this.payload.accountBalances;if(this.accountBalances==null&&e!=null){this.accountBalances=[];for(let t=0;t<e.length;t++){let r=e[t];this.accountBalances.push(new wt(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 Et=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 wt(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 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 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())})},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 Bn(this,void 0,void 0,function*(){return this.payload=yield Po(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}update(){return Bn(this,void 0,void 0,function*(){return this.payload=yield Bo(this.book.getId(),this.payload,this.getConfig()),this.updateQueryCache(),this})}remove(){return Bn(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 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 _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())})},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 _n(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 _n(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=Z(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 _n(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==it.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 Er(e,this.getDecimalSeparator())}round(e){return wr(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 $(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(i=>r.push(i.json())),r=yield Ko(this.getId(),r,t,this.getConfig()),e=r.map(i=>new $(this,i)),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(i=>r.push(i.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"?{id:e}:e instanceof $?e.json():e;if(r.id==null||r.id.trim()==="")throw new Error("The primary transaction must provide an id for merge.");let i=typeof t=="string"?{id:t}:t instanceof $?t.json():t;if(i.id==null||i.id.trim()==="")throw new Error("The secondary transaction must provide an id for merge.");let o={items:[r,i]},s=yield cs(this.getId(),o,this.getConfig());return new $(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 gs(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 Vn(this.getId(),t,this.getConfig()),i=[];for(let o of r){let s=new G(this,o);i.push(s),this.setAccount(o)}return this.clearCache(),i}return[]})}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 $n(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 zn(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 Kn(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(){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 we(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 Cn(this.getId(),e.json(),this.getConfig()):e=yield Cn(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 qn(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 ei(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 Xn(this.getId(),this.getConfig());return this.allGroupsLoaded=this.mapGroups(r),Array.from(((t=this.idGroupMap)===null||t===void 0?void 0:t.values())||[])})}mapGroups(e){if(!e)return!1;let t=e.map(r=>new Q(this,r));this.idGroupMap=new Map,this.nameGroupMap=new Map;for(let r of t)this.updateGroupCache(r),r.buildGroupTree(this.idGroupMap);for(let r of t)r.buildGroupTree(this.idGroupMap);return!0}getAccounts(){return T(this,void 0,void 0,function*(){var e,t;if(this.idAccountMap&&this.allAccountsLoaded)return Array.from(((e=this.idAccountMap)===null||e===void 0?void 0:e.values())||[]);yield this.getGroups();let r=yield Zn(this.getId(),this.getConfig());return this.allAccountsLoaded=this.mapAccounts(r),Array.from(((t=this.idAccountMap)===null||t===void 0?void 0:t.values())||[])})}mapAccounts(e){if(!e)return!1;let t=e.map(r=>new G(this,r));this.idAccountMap=new Map,this.nameAccountMap=new Map;for(let r of t)this.updateAccountCache(r),this.linkAccountsAndGroups(r);return this.ensureGroupsAccountMapsLoaded(),!0}linkAccountsAndGroups(e){var t;let r=e.json().groups||[];for(let i of r){let o=(t=this.idGroupMap)===null||t===void 0?void 0:t.get(i.id||"");o!=null&&o.addAccount(e)}}ensureGroupsAccountMapsLoaded(){if(this.idGroupMap)for(let e of this.idGroupMap.values())e.accounts==null&&(e.accounts=new Map)}clearCache(){this.clearGroupCache(),this.clearAccountCache()}clearGroupCache(){this.allGroupsLoaded=!1,this.idGroupMap=void 0,this.nameGroupMap=void 0}clearAccountCache(){this.allAccountsLoaded=!1,this.idAccountMap=void 0,this.nameAccountMap=void 0}clearCollaboratorCache(){this.collaborators=void 0}setAccount(e,t){let r=this.payload.accounts||[];t?this.payload.accounts=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.accounts=r.map(o=>o.id===e.id?e:o):this.payload.accounts=[...r,e]}setGroup(e,t){let r=this.payload.groups||[];t?this.payload.groups=r.filter(i=>i.id!==e.id):r.find(o=>o.id===e.id)?this.payload.groups=r.map(o=>o.id===e.id?e:o):this.payload.groups=[...r,e]}listTransactions(e,t,r){return T(this,void 0,void 0,function*(){let i=yield ls(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 Go(this.getId(),e,t,this.getConfig());return new yt(this,r)})}countTransactions(e){return T(this,void 0,void 0,function*(){let t=yield ds(this.getId(),e,this.getConfig());return t.total!=null?+t.total:void 0})}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 hs(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 $(this,t):void 0})}getTransactionsByIds(e){return T(this,void 0,void 0,function*(){if(e==null)throw new Error("Transaction IDs are required.");let t=new Set,r=[];for(let o of e){if(o==null||typeof o!="string"||o.trim()==="")throw new Error("Transaction IDs must be non-blank strings.");let s=o.trim();if(t.has(s))throw new Error(`Duplicate transaction ID: ${s}`);t.add(s),r.push(s)}let i=[];for(let o=0;o<r.length;o+=200){let s=yield us(this.getId(),r.slice(o,o+200),this.getConfig());i.push(...s.map(a=>new $(this,a)))}return i})}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 i=yield xo(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 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 Et(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 ze(this,t)})}getCollaborators(){return T(this,void 0,void 0,function*(){if(!this.collaborators){let e=yield Ts(this.getId(),this.getConfig());this.collaborators=e.map(t=>new ze(this,t))}return this.collaborators})}getBacklog(){return T(this,void 0,void 0,function*(){let e=yield ys(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 kl=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 Zs(n){return kl(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 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())})},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 Oe(this,void 0,void 0,function*(){let i=yield Do(e,t,r,this.config);return new X(i,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 i=r==null?void 0:r.trim();yield ws(e,t,i||void 0,this.config)})}getCollections(){return Oe(this,void 0,void 0,function*(){return(yield bs(this.config)).map(t=>new Se(t,this.config))})}getApps(){return Oe(this,void 0,void 0,function*(){return(yield wo(this.config)).map(t=>new we(t,this.config))})}getApp(e){return Oe(this,void 0,void 0,function*(){let t=yield Eo(e,this.config);return new we(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 Us(this.config);return new Ie(e,this.config)})}};k.globalConfig={};var Ws=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(d){s(d)}}function c(u){try{l(r.throw(u))}catch(d){s(d)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(n,e||[])).next())})},we=class extends P{constructor(e,t){super(e),this.config=t}getConfig(){return this.config||k.globalConfig}setWebhookUrlDev(e){return this.payload.webhookUrlDev=e,this}getId(){return this.payload.id}getName(){return this.payload.name}hasEvents(){return(this.getEvents()||[]).length>0}getEvents(){return this.payload.events}isPublished(){return this.payload.published||!1}isHidden(){return this.payload.hidden||!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 Ws(this,void 0,void 0,function*(){return yield To(this.payload,this.getConfig()),this})}update(){return Ws(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 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 aa(xl);})();
|
|
3
3
|
//# sourceMappingURL=bkper.min.js.map
|