@actual-app/web 23.2.5 → 23.2.9

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.
@@ -0,0 +1,2 @@
1
+ (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{1:function(e,t,n){"use strict";(function(e){n.d(t,"A",function(){return $}),n.d(t,"D",function(){return W}),n.d(t,"c",function(){return G}),n.d(t,"g",function(){return Y}),n.d(t,"r",function(){return K}),n.d(t,"b",function(){return Z}),n.d(t,"i",function(){return Q}),n.d(t,"e",function(){return J}),n.d(t,"d",function(){return X}),n.d(t,"f",function(){return re}),n.d(t,"n",function(){return le}),n.d(t,"o",function(){return ue}),n.d(t,"w",function(){return de}),n.d(t,"x",function(){return pe}),n.d(t,"h",function(){return be}),n.d(t,"s",function(){return Ae}),n.d(t,"a",function(){return Me}),n.d(t,"v",function(){return _e}),n.d(t,"t",function(){return Ye}),n.d(t,"u",function(){return Ze}),n.d(t,"m",function(){return Qe}),n.d(t,"j",function(){return Xe}),n.d(t,"l",function(){return et}),n.d(t,"k",function(){return tt}),n.d(t,"q",function(){return rt});var r=n(0),a=n.n(r),o=n(445),l=n(446),i=n.n(l),c=n(8),s=n(59),u=n(172),d=n(14),f=n(122),p=(n(10),n(114)),m=n(2),y=n(48),g=n(115),h=n(73),b=n(79),O=n(189),w=n(41);n.d(t,"C",function(){return w.a}),n.d(t,"z",function(){return b.a});var v=n(327);n.d(t,"y",function(){return v.a});var E=n(156);n.d(t,"p",function(){return E.a}),n.d(t,"B",function(){return E.b}),n.d(t,"E",function(){return E.c});const j=["children","centered"],S=["style","innerRef"],C=["children"],x=["style","children"],P=["asAnchor","children"],k=["history","staticContext","to","style","activeStyle","match","location"],A=["children","pressed","primary","hover","bare","style","disabled","hoveredStyle","activeStyle","as"],D=["loading","children"],I=["style","inputRef","onEnter","onUpdate","focused"],T=["leftContent","rightContent","inputStyle","style","getStyle"],M=["style","children"],R=["left","right","style","leftStyle","rightStyle","truncate"],B=["style","isLast","children"];function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return L(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function $(e){let t=e.children,n=(e.centered,U(e,j));return a.a.createElement(b.a,Object.assign({numberOfLines:1},n),t)}const W=e=>{const t=Object(r.useRef)(),n=Object(r.useCallback)((...e)=>t.current(...e),[]);return Object(r.useLayoutEffect)(()=>{t.current=e}),n};function G(e){e.style;const t=e.innerRef,n=U(e,S);return a.a.createElement("div",Object.assign({},n,{ref:t,className:`${e.className||""} ${Object(d.css)(e.style)}`}))}var H={marginTop:15,marginLeft:5,marginRight:5,borderRadius:6,backgroundColor:"white",borderColor:m.a.p3,boxShadow:"0 1px 2px #9594A8"},q={borderRadius:6,overflow:"hidden"};const Y=a.a.forwardRef((e,t)=>{let n=e.children,r=U(e,C);return a.a.createElement(w.a,Object.assign({},r,{ref:t,style:[H,r.style]}),a.a.createElement(w.a,{style:q},n))});var V={textDecoration:"none",color:m.c.textColor,backgroundColor:"transparent",border:0,cursor:"pointer",padding:0,font:"inherit",":hover":{textDecoration:"underline"}};function K(e){let t=e.style,n=e.children,r=U(e,x);return a.a.createElement(X,Object.assign({},Object(d.css)(V,m.c.smallText,t),r),n)}function Z({to:e,exact:t,style:n,activeStyle:r,children:o}){let l=Object(c.j)({path:e,exact:!0});return a.a.createElement(s.b,Object.assign({to:e,exact:t},Object(d.css)([m.c.smallText,n,l?r:null])),o)}const Q=a.a.forwardRef((e,t)=>{let n=e.asAnchor,r=e.children,o=U(e,P);function l(e){e.preventDefault(),window.Actual.openURLInBrowser(o.href)}return n?a.a.createElement("a",Object.assign({ref:t},o,{onClick:l}),r):a.a.createElement(X,Object.assign({ref:t,bare:!0},o,{onClick:l}),r)});const J=Object(c.k)(function(e){let t=e.history,n=(e.staticContext,e.to),r=e.style,o=e.activeStyle,l=(e.match,e.location,U(e,k));return a.a.createElement(c.b,{path:n,children:({match:e})=>a.a.createElement(X,Object.assign({style:[r,e?o:null]},l,{onClick:e=>{l.onClick&&l.onClick(e),t.push(n)}}))})}),X=a.a.forwardRef((e,t)=>{let n=e.children,r=e.pressed,o=e.primary,l=e.hover,i=e.bare,c=e.style,s=e.disabled,u=e.hoveredStyle,f=e.activeStyle,p=e.as,y=void 0===p?"button":p,g=U(e,A);u=[i?{backgroundColor:"rgba(100, 100, 100, .15)"}:F({},m.c.shadow),u],f=[i?{backgroundColor:"rgba(100, 100, 100, .25)"}:{transform:"translateY(1px)",boxShadow:!i&&(o?"0 1px 4px 0 rgba(0,0,0,0.3)":"0 1px 4px 0 rgba(0,0,0,0.2)"),transition:"none"},f];let h=y,b=[F({alignItems:"center",justifyContent:"center",flexShrink:0,padding:i?"5px":"5px 10px",margin:0,overflow:"hidden",display:"flex",borderRadius:4,backgroundColor:i?"transparent":o?s?m.a.n7:m.a.p5:"white",border:i?"none":"1px solid "+(o?s?m.a.n7:m.a.p5:m.a.n9),color:o?"white":s?m.a.n6:m.a.n1,transition:"box-shadow .25s"},m.c.smallText),{":hover":!s&&u},{":active":!s&&f},l&&u,r&&f,c];return a.a.createElement(h,Object.assign({ref:t},"string"===typeof y?Object(d.css)(b):{style:b},{disabled:s},g),n)});var ee={position:"relative"},te={position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},ne={width:20,height:20,color:"currentColor"};const re=a.a.forwardRef((e,t)=>{let n=e.loading,r=e.children,o=U(e,D);return a.a.createElement(X,Object.assign({},o,{style:[ee,o.style]}),n&&a.a.createElement(w.a,{style:te},a.a.createElement(y.a,{color:"currentColor",style:ne})),a.a.createElement(w.a,{style:{opacity:n?0:1,flexDirection:"row",alignItems:"center"}},r))}),ae={outline:0,backgroundColor:"white",margin:0,padding:5,borderRadius:4,border:"1px solid #d0d0d0"};var oe={":focus":{border:"1px solid "+m.a.b5,boxShadow:"0 1px 1px "+m.a.b7},"::placeholder":{color:m.a.n7}};function le(e){let t=e.style,n=e.inputRef,l=e.onEnter,i=e.onUpdate,c=e.focused,s=U(e,I),u=Object(r.useRef)();return Object(O.b)(u,c),a.a.createElement("input",Object.assign({ref:n?Object(o.a)([n,u]):u},Object(d.css)(ae,oe,m.c.smallText,t),s,{onKeyDown:e=>{13===e.keyCode&&l&&l(e),s.onKeyDown&&s.onKeyDown(e)},onChange:e=>{i&&i(e.target.value),s.onChange&&s.onChange(e)}}))}var ie={padding:0,flex:1,flexDirection:"row",alignItems:"center"},ce={border:"1px solid "+m.a.b5,boxShadow:"0 1px 1px "+m.a.b7},se={flex:1,"&, &:focus, &:hover":{border:0,backgroundColor:"transparent",boxShadow:"none",color:"inherit"}};function ue(e){let t=e.leftContent,n=e.rightContent,o=e.inputStyle,l=e.style,i=e.getStyle,c=U(e,T),s=_(Object(r.useState)(!1),2),u=s[0],d=s[1];return a.a.createElement(w.a,{style:[ae,ie,u&&ce,l,i&&i(u)]},t,a.a.createElement(le,Object.assign({},c,{style:[o,se],onFocus:e=>{d(!0),c.onFocus&&c.onFocus(e)},onBlur:e=>{d(!1),c.onBlur&&c.onBlur(e)}})),n)}function de({inputRef:e,value:t,onChange:n,placeholder:r,isInModal:o,width:l=350}){return a.a.createElement(le,{inputRef:e,placeholder:r,value:t,onChange:e=>n(e.target.value),style:{width:l,borderColor:o?null:"transparent",backgroundColor:o?null:m.a.n11,":focus":o?null:{backgroundColor:"white","::placeholder":{color:m.a.n8}}}})}m.a.n3,m.a.p6;var fe={backgroundColor:"transparent",height:28,fontSize:14,flex:1,border:"1px solid #d0d0d0",borderRadius:4,color:m.a.n1,":focus":{border:"1px solid "+m.a.b5,boxShadow:"0 1px 1px "+m.a.b7,outline:"none"}};const pe=a.a.forwardRef((e,t)=>{let n=e.style,r=e.children,o=U(e,M);return a.a.createElement("select",Object.assign({ref:t},Object(d.css)(fe,n),o),r)});var me={lineHeight:"1em"},ye={borderWidth:0,padding:5,borderRadius:4},ge={width:7,height:7,paddingTop:3},he={zIndex:1e4,outline:0,borderRadius:4};function be({options:e,value:t,onChange:n,style:r}){return a.a.createElement(u.b,{value:t,onChange:n,style:me},a.a.createElement(u.a,Object.assign({},Object(d.css)([ye,r]),{arrow:a.a.createElement(p.a,{style:ge})})),a.a.createElement(u.e,{style:he},a.a.createElement(u.c,null,e.map(([e,t])=>a.a.createElement(u.d,{key:e,value:e},t)))))}var Oe={fontSize:10,color:m.a.n6};function we({keyName:e}){return a.a.createElement(b.a,{style:Oe},e)}var ve={outline:"none",borderRadius:4,overflow:"hidden"},Ee={margin:"3px 0px"},je={borderTop:"1px solid "+m.a.n10},Se={color:m.a.n6,fontSize:11,lineHeight:"1em",textTransform:"uppercase",margin:"3px 9px"},Ce={color:m.a.n7},xe={backgroundColor:m.a.n10},Pe={lineHeight:0},ke={flex:1};function Ae({header:e,footer:t,items:n,onMenuSelect:o}){let l=Object(r.useRef)(null),i=n.filter(e=>e),c=_(Object(r.useState)(null),2),s=c[0],u=c[1];return Object(r.useEffect)(()=>{l.current.focus();let e=e=>{let t=i.filter(e=>e&&e!==Ae.line&&e.type!==Ae.label),n=t.indexOf(i[s]),r=e=>i.indexOf(t[e]);switch(e.keyCode){case 38:e.preventDefault(),u(null===s?0:r(Math.max(n-1,0)));break;case 40:e.preventDefault(),u(null===s?0:r(Math.min(n+1,t.length-1)));break;case 13:e.preventDefault(),null!==s&&o&&o(i[s].name)}};return l.current.addEventListener("keydown",e),()=>{l.current.removeEventListener("keydown",e)}},[s]),a.a.createElement(w.a,{style:ve,tabIndex:1,innerRef:l},e,i.map((e,t)=>{if(e===Ae.line)return a.a.createElement(w.a,{key:t,style:Ee},a.a.createElement(w.a,{style:je}));if(e.type===Ae.label)return a.a.createElement(b.a,{style:Se},e.name);let n=i[t-1];return a.a.createElement(w.a,{key:e.name,style:[{cursor:"default",padding:"9px 10px",marginTop:0===t||n===Ae.line||n.type===Ae.label?0:-3,flexDirection:"row",alignItems:"center"},e.disabled&&Ce,!e.disabled&&s===t&&xe],onMouseEnter:()=>u(t),onMouseLeave:()=>u(null),onClick:t=>!e.disabled&&o&&o(e.name)},a.a.createElement(b.a,{style:Pe},e.icon&&a.a.createElement(e.icon,{width:e.iconSize||10,height:e.iconSize||10,style:{marginRight:7,width:10}})),a.a.createElement(b.a,null,e.text),a.a.createElement(w.a,{style:ke}),e.key&&a.a.createElement(we,{keyName:e.key}))}),t)}Ae.line=Symbol("menu-line"),Ae.label=Symbol("menu-label");var De={flexDirection:"row",alignItems:"center"},Ie={marginRight:10},Te={flex:1,textAlign:"right"};function Me(e){let t=e.left,n=e.right,r=e.style,o=e.leftStyle,l=e.rightStyle,i=e.truncate,c=void 0===i?"left":i,s=U(e,R);const u={textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"};return a.a.createElement(w.a,Object.assign({style:[De,r]},s),a.a.createElement(G,{style:[Ie,"left"===c&&u,o]},t),a.a.createElement(G,{style:[Te,"right"===c&&u,l]},n))}var Re={marginBottom:15},Be={lineHeight:"1.5em"};function _e(e){let t=e.style,n=e.isLast,r=e.children,o=U(e,B);return a.a.createElement("div",Object.assign({},o,Object(d.css)(!n&&Re,t,Be)),r)}var Le={display:"none"};function ze({style:e,size:t,noAnimation:n,isCurrent:o,stackIndex:l,children:i}){let c=Object(r.useRef)(null),s=Object(r.useRef)(!1),u=Object(r.useRef)(10*Math.random()-5);return Object(r.useLayoutEffect)(()=>{function e(){o?(c.current.style.transform="translateY(0px) scale(1)",c.current.style.pointerEvents="auto"):(c.current.style.transform=`translateY(-40px) scale(.95) rotate(${u.current}deg)`,c.current.style.pointerEvents="none")}null!=c.current&&(s.current?e():n?(c.current.style.opacity=1,c.current.style.transform="translateY(0px) scale(1)",setTimeout(()=>{c.current&&(c.current.style.transition="opacity .1s, transform .1s cubic-bezier(.42, 0, .58, 1)")},0)):(c.current.style.opacity=0,c.current.style.transform="translateY(10px) scale(1)",setTimeout(()=>{c.current&&(s.current=!0,c.current.style.transition="opacity .1s, transform .1s cubic-bezier(.42, 0, .58, 1)",c.current.style.opacity=1,e())},0)))},[n,o,l]),a.a.createElement(w.a,{innerRef:c,style:[e,t&&{width:t.width,height:t.height},n&&!o&&Le]},i)}var Fe={padding:20,position:"relative",flexShrink:0},Ne={color:m.a.n2,flex:1,alignSelf:"center",textAlign:"center",width:"calc(100% - 40px)"},Ue={fontSize:25,fontWeight:700,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},$e={position:"absolute",right:0,top:0,bottom:0,justifyContent:"center",alignItems:"center"},We={flexDirection:"row",marginRight:15},Ge={padding:"10px 10px"},He={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, .6)",alignItems:"center",justifyContent:"center",zIndex:1e3},qe={width:20,height:20};function Ye({title:t,isCurrent:n,isHidden:o,size:l,padding:c=20,showHeader:s=!0,showTitle:u=!0,showClose:d=!0,showOverlay:p=!0,loading:O=!1,noAnimation:v=!1,focusAfterClose:E=!0,stackIndex:j,parent:S,style:C,contentStyle:x,overlayStyle:P,children:k,onClose:A}){return Object(r.useEffect)(()=>{let e=f.a.getScope();return f.a.setScope("modal"),()=>f.a.setScope(e)},[]),a.a.createElement(i.a,{isOpen:!0,onRequestClose:A,shouldCloseOnOverlayClick:!1,shouldFocusAfterRender:!e.IS_DESIGN_MODE,shouldReturnFocusAfterClose:E,appElement:document.querySelector("#root"),parentSelector:S&&(()=>S),style:{content:F({top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",overflow:"visible",border:0,fontSize:14,backgroundColor:"transparent",padding:0,pointerEvents:"auto"},x),overlay:F(F({zIndex:3e3,backgroundColor:p&&0===j?"rgba(0, 0, 0, .1)":"none",pointerEvents:p?"auto":"none"},P),S?{position:"absolute",top:0,left:0,right:0,bottom:0}:{})}},a.a.createElement(ze,{noAnimation:v,isCurrent:n,size:l,style:[{willChange:"opacity, transform",minWidth:"100%",minHeight:0,borderRadius:4,backgroundColor:"white",opacity:o?0:1,[`@media (min-width: ${h.a.breakpoint_narrow})`]:{minWidth:h.a.breakpoint_narrow}},m.c.shadowLarge,C,m.c.lightScrollbar]},s&&a.a.createElement(w.a,{style:Fe},u&&a.a.createElement(w.a,{style:Ne},a.a.createElement(b.a,{style:Ue},t)),a.a.createElement(w.a,{style:$e},a.a.createElement(w.a,{style:We},d&&a.a.createElement(X,{bare:!0,onClick:e=>A(),style:Ge,"aria-label":"Close"},a.a.createElement(g.a,{width:10}))))),a.a.createElement(w.a,{style:{padding:c,paddingTop:0,flex:1}},"function"===typeof k?k():k),O&&a.a.createElement(w.a,{style:He},a.a.createElement(y.a,{style:qe,color:m.a.n1}))))}var Ve={flexDirection:"row",marginTop:30},Ke={flex:1};function Ze({style:e,leftContent:t,focusButton:n=!1,children:o}){let l=Object(r.useRef)(null);return Object(r.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector("button:not([data-hidden])");e&&e.focus()}},[n]),a.a.createElement(w.a,{innerRef:l,style:[Ve,e]},t,a.a.createElement(w.a,{style:Ke}),o)}function Qe({label:e,labelWidth:t,children:n,width:r,style:o}){return a.a.createElement("label",Object(d.css)({display:"flex",flexDirection:"row",alignItems:"center",margin:"7px 0",width:r},o),a.a.createElement("div",{style:{width:t||75,textAlign:"right",paddingRight:10}},e,":"),n)}var Je={color:"red",fontSize:13};function Xe({style:e,children:t}){return a.a.createElement(w.a,{style:[Je,e]},t)}function et({children:t}){let n=Object(r.useRef)(null);return Object(r.useEffect)(()=>{n.current&&!e.IS_DESIGN_MODE&&setTimeout(()=>{n.current&&(n.current.focus(),n.current.setSelectionRange(0,1e4))},0)},[]),"function"===typeof t?t(n):a.a.cloneElement(t,{inputRef:n})}class tt extends a.a.Component{constructor(...e){super(...e),this.state={hovered:!1},this.onMouseEnter=(()=>{this.props.disabled||this.setState({hovered:!0})}),this.onMouseLeave=(()=>{this.props.disabled||this.setState({hovered:!1})})}componentDidUpdate(e){this.props.disabled&&this.state.hovered&&this.setState({hovered:!1})}render(){let e=this.props,t=e.style,n=e.contentStyle,r=e.children,o=e.renderContent;return a.a.createElement(w.a,{style:t},a.a.createElement(w.a,{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,style:n},r),this.state.hovered&&o())}}var nt={color:m.a.n2,textAlign:"right",fontSize:12,marginBottom:2};function rt({title:e,style:t}){return a.a.createElement(b.a,{style:[m.c.text,nt,t]},e)}}).call(this,n(15))},10:function(e,t,n){"use strict";n.d(t,"l",function(){return c}),n.d(t,"g",function(){return s}),n.d(t,"c",function(){return u}),n.d(t,"f",function(){return f}),n.d(t,"i",function(){return p}),n.d(t,"p",function(){return m}),n.d(t,"n",function(){return y}),n.d(t,"o",function(){return h}),n.d(t,"h",function(){return b}),n.d(t,"q",function(){return E}),n.d(t,"k",function(){return j}),n.d(t,"a",function(){return S}),n.d(t,"d",function(){return C}),n.d(t,"e",function(){return x}),n.d(t,"b",function(){return P}),n.d(t,"j",function(){return k}),n.d(t,"m",function(){return A});const r=["id"];function a(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return e[e.length-1]}function s(e,t){const n=e.id?{id:e.id}:{},r=Object.keys(t);let a=!1;for(let o=0;o<r.length;o++){let l=r[o];e[l]!==t[l]&&(n[l]=t[l],a=!0)}return a?n:null}function u(e,t){return t=[...t],e.added&&e.added.forEach(e=>{t.push(e)}),e.updated&&e.updated.forEach(e=>{let n=e.id,o=a(e,r);const i=t.findIndex(e=>e.id===n);t[i]=l(l({},t[i]),o)}),e.deleted&&e.deleted.forEach(e=>{const n=t.findIndex(t=>e.id===t.id);-1!==n&&t.splice(n,1)}),t}function d(e){let t=new Map;for(let n=0;n<e.length;n++){let r=e[n];t.set(r.id,r)}return t}function f(e,t){let n=d(e),r=d(t),a=[],o=[],l=e.filter(e=>!r.has(e.id)).map(e=>({id:e.id}));return t.forEach(e=>{let t=n.get(e.id);if(t){const n=s(t,e);n&&o.push(n)}else a.push(e)}),{added:a,updated:o,deleted:l}}function p(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];t[r.id]=r}return t}function m(e){return e[0].toUpperCase()+e.slice(1)}let y=[{value:"comma-dot",label:"1,000.33"},{value:"dot-comma",label:"1.000,33"},{value:"space-comma",label:"1 000,33"}],g={value:null,formatter:null,regex:null};function h(e){let t,n,r;switch(e){case"space-comma":t="en-ZA",n=/[^-0-9,]/g,r=",";break;case"dot-comma":t="de-DE",n=/[^-0-9,]/g,r=",";break;case"comma-dot":default:t="en-US",n=/[^-0-9.]/g,r="."}g={value:e,separator:r,formatter:new Intl.NumberFormat(t,{minimumFractionDigits:2,maximumFractionDigits:2}),regex:n}}function b(){return g}h("comma-dot");const O=2**51-1,w=-O;function v(e){if(!Number.isInteger(e))throw new Error("safeNumber: number is not an integer: "+JSON.stringify(e));if(e>O||e<w)throw new Error("safeNumber: can't safely perform arithmetic with number: "+e);return e}function E(e){return k(x(e)||0)}function j(e){return g.formatter.format(v(e)/100)}function S(e){return g.formatter.format(e)}function C(e){let t=parseFloat(e.replace(g.regex,"").replace(g.separator,"."));return isNaN(t)?null:t}function x(e){let t=C(e);return t?P(t):null}function P(e){return Math.round(100*e)}function k(e){return parseFloat((v(e)/100).toFixed(2))}function A(e){function t(e){return isNaN(e)?null:e}let n=e.match(/[.,][^.,]*$/);if(!n||0===n.index)return t(parseFloat(e));let r=e.slice(0,n.index),a=e.slice(n.index+1);return t(parseFloat(r.replace(/[^0-9-]/g,"")+"."+a))}},101:function(e,t,n){"use strict";n.d(t,"b",function(){return l}),n.d(t,"d",function(){return i}),n.d(t,"a",function(){return c}),n.d(t,"c",function(){return s});var r=n(3),a=n(11),o=n(62);function l(){return async(e,t)=>{let n=await Object(r.send)("load-prefs"),l=t().prefs.local;return n&&n.id&&!l&&e(Object(o.a)()),e({type:a.a.SET_PREFS,prefs:n,globalPrefs:await Object(r.send)("load-global-prefs")}),n}}function i(e){return async t=>{await Object(r.send)("save-prefs",e),t({type:a.a.MERGE_LOCAL_PREFS,prefs:e})}}function c(){return async(e,t)=>{let n=await Object(r.send)("load-global-prefs");return e({type:a.a.SET_PREFS,prefs:t().prefs.local,globalPrefs:n}),n}}function s(e){return async t=>{await Object(r.send)("save-global-prefs",e),t({type:a.a.MERGE_GLOBAL_PREFS,globalPrefs:e})}}},102:function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"a",function(){return l});var r=n(0),a=n.n(r);const o=e=>t=>{return class extends a.a.Component{componentDidMount(){l(e)}componentDidUpdate(){l(e)}render(){return a.a.createElement(t,this.props)}}};function l(e){[...document.getElementsByTagName("meta")].find(e=>"theme-color"===e.name).setAttribute("content",e)}},11:function(e,t,n){"use strict";t.a={LOAD_TRANSACTIONS:"LOAD_TRANSACTIONS",SET_NEW_TRANSACTIONS:"SET_NEW_TRANSACTIONS",UPDATE_NEW_TRANSACTIONS:"UPDATE_NEW_TRANSACTIONS",SET_LAST_TRANSACTION:"SET_LAST_TRANSACTION",MARK_ACCOUNT_READ:"MARK_ACCOUNT_READ",LOAD_ACCOUNTS:"LOAD_ACCOUNTS",UPDATE_ACCOUNT:"UPDATE_ACCOUNT",LOAD_CATEGORIES:"LOAD_CATEGORIES",ADD_CATEGORY:"ADD_CATEGORY",DELETE_CATEGORY:"DELETE_CATEGORY",LOAD_PAYEES:"LOAD_PAYEES",LOAD_BANKS:"LOAD_BANKS",SET_PROFILE:"SET_PROFILE",SET_PREFS:"SET_PREFS",MERGE_LOCAL_PREFS:"MERGE_LOCAL_PREFS",MERGE_GLOBAL_PREFS:"MERGE_GLOBAL_PREFS",SET_BUDGETS:"SET_BUDGETS",SET_REMOTE_FILES:"SET_REMOTE_FILES",SET_ALL_FILES:"SET_ALL_FILES",SET_AVAILABLE_IMPORTS:"SET_AVAILABLE_IMPORTS",CLOSE_BUDGET:"CLOSE_BUDGET",SET_APP_STATE:"SET_APP_STATE",DEBUG_CELL:"DEBUG_CELL",PUSH_MODAL:"PUSH_MODAL",REPLACE_MODAL:"REPLACE_MODAL",HIDE_MODALS:"HIDE_MODALS",SHOW_MODALS:"SHOW_MODALS",CLOSE_MODAL:"CLOSE_MODAL",POP_MODAL:"POP_MODAL",ADD_NOTIFICATION:"ADD_NOTIFICATION",REMOVE_NOTIFICATION:"REMOVE_NOTIFICATION",GET_USER_DATA:"GET_USER_DATA",SET_LAST_UNDO_STATE:"SET_LAST_UNDO_STATE",SET_LAST_SPLIT_STATE:"SET_LAST_SPLIT_STATE",SET_ACCOUNTS_SYNCING:"SET_ACCOUNTS_SYNCING",ACCOUNT_SYNC_STATUS:"ACCOUNT_SYNC_STATUS",ACCOUNT_SYNC_FAILURES:"ACCOUNT_SYNC_FAILURES",SIGN_OUT:"SIGN_OUT",SET_TUTORIAL_STAGE:"SET_TUTORIAL_STAGE",DEACTIVATE_TUTORIAL:"DEACTIVATE_TUTORIAL"}},113:function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return c}),n.d(t,"c",function(){return s});var r=n(3),a=n(11),o=n(66),l=n(101);function i(){return async e=>{const t=await Object(r.send)("subscribe-get-user");return e({type:a.a.GET_USER_DATA,data:t}),t}}function c(){return async e=>{await e(i()),e(Object(o.i)())}}function s(){return async e=>{await Object(r.send)("subscribe-sign-out"),e(i()),e(Object(l.a)()),e(Object(o.b)()),e({type:a.a.SIGN_OUT})}}},114:function(e,t,n){"use strict";var r=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=(e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 15",style:o({color:"#242134"},e.style)}),r.createElement("path",{fill:"currentColor",d:"M24.483.576c-.309-.327-.674-.49-1.097-.49H1.56C1.137.086.771.25.463.576A1.635 1.635 0 0 0 0 1.737c0 .448.154.834.463 1.161l10.913 11.558c.31.327.675.49 1.097.49.422 0 .788-.163 1.096-.49L24.483 2.898c.308-.327.463-.713.463-1.16 0-.448-.155-.835-.463-1.162Z"})))},115:function(e,t,n){"use strict";var r=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=(e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:o({color:"#242134"},e.style)}),r.createElement("path",{fill:"none",stroke:"currentColor",strokeWidth:4,strokeLinecap:"round",strokeMiterlimit:10,d:"m2 2 20 20M22 2 2 22"})))},117:function(e,t,n){"use strict";var r=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=(e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:o({color:"#242134"},e.style)}),r.createElement("path",{d:"M10 12a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0-6a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0 12a2 2 0 1 1 0-4 2 2 0 0 1 0 4z",fill:"currentColor"})))},118:function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(0),a=n(3);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(){let e=o(Object(r.useState)(""),2),t=e[0],n=e[1];return Object(r.useEffect)(()=>{!async function(){let e=await Object(a.send)("get-server-url")||"";"https://not-configured/"===e&&(e=""),n(e)}()},[]),t}},128:function(e,t,n){"use strict";n.d(t,"b",function(){return c}),n.d(t,"a",function(){return s}),n.d(t,"c",function(){return u});var r=n(11);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i=n(200);function c(e){return{type:r.a.ADD_NOTIFICATION,notification:o(o({},e),{},{id:e.id||i.v4Sync()})}}function s(){return c({type:"error",message:"Something internally went wrong. You may want to restart the app if anything looks wrong. We have been notified of the issue and will try to fix it soon."})}function u(e){return{type:r.a.REMOVE_NOTIFICATION,id:e}}},132:function(e,t,n){"use strict";function r(){return"true"===String(Object({NODE_ENV:"production",PUBLIC_URL:"",REACT_APP_ACTUAL_VERSION:"23.2.9",REACT_APP_BACKEND_WORKER_HASH:"6c5247def36801d673f1",REACT_APP_RELEASE_TYPE:""}).REACT_APP_NETLIFY)}function a(){return!1}n.d(t,"b",function(){return r}),n.d(t,"a",function(){return a})},138:function(e,t,n){"use strict";function r({reason:e,meta:t}){switch(e){case"unauthorized":return"You are not logged in.";case"encrypt-failure":return t.isMissingKey?"Encrypting your file failed because you are missing your encryption key. Create your key in the next step.":"Encrypting the file failed. You have the correct key so this is an internal bug. To fix this, generate a new key in the next step.";case"file-has-reset":return"Something went wrong while resetting your file. Please try again.";case"file-has-new-key":return"Unable to encrypt your data because you are missing the key. Create the latest key in the next step.";case"network":return"Uploading the file failed. Check your network connection.";case"beta-version":return"You cannot perform this action in the beta version (resetting sync, deleting a file, etc).";default:return`An internal error occurred, sorry! Contact help@actualbudget.com for support. (ref: ${e})`}}function a({reason:e,meta:t,fileName:n}){switch(e){case"network":case"download-failure":return"Downloading the file failed. Check your network connection.";case"invalid-zip-file":case"invalid-meta-file":return"Downloaded file is invalid, sorry! Contact help@actualbudget.com for support.";case"decrypt-failure":return"Unable to decrypt file "+(n||"(unknown)")+". To change your key, first download this file with the proper password.";case"out-of-sync-migrations":return"This budget cannot be loaded with this version of the app. Make sure the app is up-to-date.";default:return"Something went wrong trying to download that file, sorry! Contact help@actualbudget.com for support. "+(t&&t.fileId?`(fileId: ${t.fileId})`:"")}}function o(e){return r(e)}function l({reason:e}){switch(e){case"network":return"Unable to connect to the server. We need to access our server to get some information about your keys.";case"old-key-style":return"This file is encrypted with an old unsupported key style. Recreate the key on a device where the file is available, or use an older version of Actual to download it.";case"decrypt-failure":return"Unable to decrypt file with this password. Please try again.";default:return"Something went wrong trying to create a key, sorry! Contact help@actualbudget.com for support."}}n.d(t,"d",function(){return r}),n.d(t,"b",function(){return a}),n.d(t,"a",function(){return o}),n.d(t,"c",function(){return l})},151:function(e,t,n){"use strict";function r(){let e=navigator.userAgent;return/Mobi|android|iphone|kindle|ipad/i.test(e)}n.d(t,"a",function(){return r})},156:function(e,t,n){"use strict";n.d(t,"a",function(){return m}),n.d(t,"c",function(){return y}),n.d(t,"b",function(){return g});var r=n(0),a=n.n(r),o=n(87),l=n.n(o),i=n(14),c=n(2);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const m=a.a.createContext();function y(){let e=f(Object(r.useState)(!1),2),t=e[0],n=e[1];return{getOpenEvents:(e={})=>({onClick:t=>{t.stopPropagation(),e.onClick&&e.onClick(t),n(!0)}}),isOpen:t,close:()=>n(!1)}}class g extends a.a.Component{constructor(e){super(e),this.state={position:null},this.position=e.position||"bottom-right",this.contentRef=a.a.createRef()}setup(){this.layout();let e=e=>{let t=e.target;for(;t&&t!==document.documentElement&&"tooltip"!==t.dataset.testid&&null==t.dataset.reachPopover;)t=t.parentNode;t===document.documentElement&&this.props.onClose&&this.props.onClose()};window.document.addEventListener("mousedown",e,!1),this.contentRef.current.addEventListener("keydown",e=>{27===e.keyCode&&this.props.onClose&&this.props.onClose()},!1),this.cleanup=(()=>{window.document.removeEventListener("mousedown",e)})}componentDidMount(){this.getContainer()?this.setup():this.forceUpdate(()=>{this.getContainer()?this.setup():console.log("Warning: could not mount tooltip, container missing")})}componentDidUpdate(e){(e.targetRect!==this.props.targetRect||e.forceTop!==this.props.forceTop||this.props.forceLayout)&&this.layout()}getContainer(){let e=this.props.ignoreBoundary;return!(void 0!==e&&e)&&this.context?this.context.current:document.body}getBoundsContainer(){let e=this.getContainer();return e.parentNode&&"auto"===e.parentNode.style.overflow?e.parentNode:e}layout(){let e=this.props,t=e.targetRect,n=e.offset,r=void 0===n?0:n,a=this.contentRef.current;if(!a)return;let o=a.getBoundingClientRect(),l=this.target.parentNode,i=t||l.getBoundingClientRect();i={top:i.top,left:i.left,width:i.width,height:i.height};let c=this.getBoundsContainer();if(!c)return;let s=c.getBoundingClientRect();if(i.left-=s.left,i.top-=s.top,this.props.forceTop)i.top=this.props.forceTop;else{let e=o.height+r,t=i.top-e,n=i.top+i.height+e;(-1!==this.position.indexOf("top")&&t<s.top||-1!==this.position.indexOf("bottom")&&n>s.height&&t>0)&&(this.position=this.getOppositePosition(this.position)),i.top+=c.scrollTop}const u=this.getStyleForPosition(this.position,o,i,this.getContainer().getBoundingClientRect(),r);a.style.top=u.top,a.style.bottom=u.bottom,a.style.left=u.left,a.style.right=u.right,a.style.width=u.width}componentWillUnmount(){this.cleanup&&this.cleanup()}getOppositePosition(e){switch(e){case"top":case"top-left":return"bottom";case"top-right":return"bottom-right";case"bottom":case"bottom-left":return"top";case"bottom-right":return"top-right";case"bottom-stretch":return"top-stretch";case"top-stretch":return"bottom-stretch";case"bottom-center":return"top-center";case"top-center":return"bottom-center";case"right":return"right"}}getStyleForPosition(e,t,n,r,a){const o={top:"inherit",bottom:"inherit",left:"inherit",right:"inherit"};if("top"===e||"top-right"===e||"top-left"===e)o.top=n.top-t.height-a+"px",o.left="top-right"===e?n.left+(n.width-t.width)+"px":n.left+"px";else if("bottom"===e||"bottom-right"===e||"bottom-left"===e)o.top=n.top+n.height+a+"px",o.left="bottom-right"===e?n.left+(n.width-t.width)+"px":n.left+"px";else if("bottom-center"===e)o.top=n.top+n.height+a+"px",o.left=n.left-(t.width-n.width)/2+"px";else if("top-center"===e)o.top=n.top-t.height-a+"px",o.left=n.left-(t.width-n.width)/2+"px";else if("left-center"===e)o.top=n.top-(t.height-n.height)/2+"px",o.left=n.left-t.width+"px";else if("top-stretch"===e)o.bottom=r.height-n.top+a+"px",o.left=n.left+"px",o.width=n.width+"px";else if("bottom-stretch"===e)o.top=n.top+n.height+a+"px",o.left=n.left+"px",o.width=n.width+"px";else{if("right"!==e)throw new Error("Invalid position for Tooltip: "+e);o.top=n.top+"px",o.left=n.left+n.width+a+"px"}return o}render(){const e=this.props,t=e.children,n=e.width,r=e.style,o=u(u({position:"absolute",zIndex:3e3,padding:5,width:n},c.c.shadowLarge),{},{borderRadius:4,backgroundColor:"white"});return this.getContainer()?a.a.createElement("div",{ref:e=>this.target=e},l.a.createPortal(a.a.createElement("div",Object.assign({},Object(i.css)(o,r,c.c.darkScrollbar),{ref:this.contentRef,"data-testid":"tooltip",onClick:e=>{e.stopPropagation()}}),t),this.getContainer())):null}}g.contextType=m},158:function(e,t,n){"use strict";n.d(t,"a",function(){return l});var r=n(3),a=n(65),o=n(62);function l(){return(e,t)=>{return!t().prefs.global.seenTutorial&&(Object(r.send)("set-tutorial-seen"),"web"===a.a.env)&&(setTimeout(()=>{e(Object(o.d)("welcome-screen"))},500),!0)}}},189:function(e,t,n){"use strict";n.d(t,"a",function(){return l}),n.d(t,"b",function(){return i});var r=n(0),a=n.n(r);let o=a.a.createContext(null);function l({children:e}){let t=Object(r.useRef)(null),n=Object(r.useMemo)(()=>({keyRef:t,onKeyChange:e=>{t.current=e}}),[t]);return a.a.createElement(o.Provider,{value:n},e)}function i(e,t){let n=Object(r.useContext)(o),a=Object(r.useRef)(null);Object(r.useLayoutEffect)(()=>{let r=a.current,o=e.current;if(o&&t&&(null===r||!1===r)){let e="input,button,div[tabindex]",r=o.matches(e)?o:o.querySelector(e);t&&r&&function(e,t){if(t){let n=function(e){let t=e;for(let n=0;n<10&&t;n++){let e=t.dataset&&t.dataset.focusKey;if(e)return e;t=t.parentNode}return null}(e);e.focus({preventScroll:n&&n===t.keyRef.current}),t.onKeyChange(n)}else e.focus();"INPUT"===e.tagName&&e.setSelectionRange(0,1e4)}(r,n)}a.current=t},[t])}},2:function(e,t,n){"use strict";n.d(t,"a",function(){return o}),n.d(t,"c",function(){return l}),n.d(t,"b",function(){return u});var r=n(65),a=n(73);const o={y1:"#733309",y2:"#87540d",y3:"#B88115",y4:"#D4A31C",y5:"#E6BB20",y6:"#F2D047",y7:"#F5E35D",y8:"#FCF088",y9:"#FFF7C4",y10:"#FFFBEA",y11:"#FFFEFA",r1:"#610316",r2:"#8A041A",r3:"#AB091E",r4:"#CF1124",r5:"#E12D39",r6:"#EF4E4E",r7:"#F86A6A",r8:"#FF9B9B",r9:"#FFBDBD",r10:"#FFE3E3",r11:"#FFF1F1",b1:"#034388",b2:"#0B5FA3",b3:"#1271BF",b4:"#1980D4",b5:"#2B8FED",b6:"#40A5F7",b7:"#66B5FA",b8:"#8BCAFD",b9:"#B3D9FF",b10:"#E3F0FF",b11:"#F5FCFF",n1:"#102A43",n2:"#243B53",n3:"#334E68",n4:"#486581",n5:"#627D98",n6:"#829AB1",n7:"#9FB3C8",n8:"#BCCCDC",n9:"#D9E2EC",n10:"#E8ECF0",n11:"#F7FAFC",g1:"#014D40",g2:"#0C6B58",g3:"#147D64",g4:"#199473",g5:"#27AB83",g6:"#3EBD93",g7:"#65D6AD",g8:"#8EEDC7",g9:"#C6F7E2",g10:"#EFFCF6",g11:"#FAFFFD",p1:"#44056E",p2:"#580A94",p3:"#690CB0",p4:"#7A0ECC",p5:"#8719E0",p6:"#9446ED",p7:"#A368FC",p8:"#B990FF",p9:"#DAC4FF",p10:"#F2EBFE",p11:"#F9F6FE"};o.border=o.n10,o.hover="#fafafa",o.selected=o.b9,o.resolve=((e,t)=>{switch(e){case"border":return o["n"+(8+t)]}throw new Error("Unknown color name: "+e)});const l={veryLargeText:{fontSize:30,fontWeight:600},largeText:{fontSize:20,fontWeight:700,letterSpacing:.5},mediumText:{fontSize:15,fontWeight:500},smallText:{fontSize:13,[`@media (min-width: ${a.a.breakpoint_medium})`]:{}},verySmallText:{fontSize:13},page:{paddingTop:8,minWidth:360,flex:1,[`@media (min-width: ${a.a.breakpoint_medium})`]:{minWidth:500,paddingTop:36}},pageHeader:{fontSize:25,borderBottomWidth:5,borderColor:o.purple2,borderStyle:"solid",display:"inline",flex:0,color:o.grey4,marginTop:40,marginBottom:20,paddingBottom:5},pageContent:{paddingLeft:2,paddingRight:2,[`@media (min-width: ${a.a.breakpoint_medium})`]:{paddingLeft:20,paddingRight:20}},settingsPageContent:{padding:20,[`@media (min-width: ${a.a.breakpoint_medium})`]:{padding:"inherit"}},staticText:{cursor:"default",userSelect:"none"},shadow:{boxShadow:"0 2px 4px 0 rgba(0,0,0,0.1)"},shadowLarge:{boxShadow:"0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)"},tnum:{fontFeatureSettings:'"tnum"'},notFixed:{fontFeatureSettings:""},header:{headerStyle:{backgroundColor:"white",borderBottomWidth:1,borderBottomColor:o.n9,elevation:0},headerTintColor:o.n1,headerTitleStyle:{color:o.n1,fontSize:15,fontWeight:600},headerBackTitle:null},text:{fontSize:16},textColor:o.n1};let i=!1;function c(){l.lightScrollbar=!i&&{"& ::-webkit-scrollbar":{width:11,backgroundColor:"rgba(200, 200, 200, .2)"},"& ::-webkit-scrollbar-thumb":{width:7,borderRadius:30,backgroundClip:"padding-box",border:"2px solid rgba(0, 0, 0, 0)"},"& ::-webkit-scrollbar-thumb:vertical":{backgroundColor:"#d0d0d0"}},l.darkScrollbar=!i&&{"& ::-webkit-scrollbar":{width:7,backgroundColor:"rgba(0, 0, 0, 0)"},"& ::-webkit-scrollbar-thumb:vertical":{backgroundColor:"rgba(200, 200, 200, .5)"}},l.scrollbarWidth=i?0:13}if("web"===r.a.env){function s(){let e=document.createElement("div");e.innerHTML='<div style="width:100px;height:100px;overflow:scroll;position:absolute;top:-9999px;"/>',document.body.appendChild(e);let t=e.childNodes[0];return t.offsetWidth===t.clientWidth}i=s(),c(),window.addEventListener("focus",()=>{i=s(),c()})}const u=()=>i},200:function(e,t,n){const r=n(619);e.exports={v4:function(){return Promise.resolve(r.v4())},v4Sync:function(){return r.v4()}}},204:function(e,t,n){"use strict";n.d(t,"a",function(){return c});var r=n(0),a=n.n(r),o=n(122);let l=a.a.createContext("app");function i({keyName:e,eventType:t="keydown",handler:n}){let a=Object(r.useContext)(l);if("keyup"!==t&&"keydown"!==t)throw new Error("KeyHandler: unknown event type: "+t);return Object(r.useEffect)(()=>{function r(e,r){if(e.preventDefault(),e.type===t&&n)return n(e,r)}return Object(o.a)(e,{scope:a,keyup:!0},r),()=>{o.a.unbind({key:e,scope:a,method:r})}},[e,n,a]),null}function c({eventType:e,keys:t={}}){return Object.keys(t).map(n=>a.a.createElement(i,{key:n,keyName:n,eventType:e,handler:t[n]}))}o.a.filter=(e=>{var t=e.target||e.srcElement,n=t.tagName;return!!(e.metaKey||!t.isContentEditable&&("INPUT"!==n&&"TEXTAREA"!==n&&"SELECT"!==n||t.readOnly))})},205:function(e,t,n){"use strict";var r=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=(e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:o({color:"#242134"},e.style)}),r.createElement("path",{d:"m0 11 2-2 5 5L18 3l2 2L7 18z",fill:"currentColor"})))},206:function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n(0);function a(e){let t=Object(r.useRef)(null);return t.current||(t.current=new ResizeObserver(t=>{e(t[0].contentRect)})),Object(r.useCallback)(e=>{t.current.disconnect(),e&&t.current.observe(e,{box:"border-box"})},[])}},240:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(31),l=n(8),i=n(33),c=n(1),s=n(2),u=n(118);function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var p={color:s.a.n5,fontStyle:"italic"},m={flexDirection:"row",alignItems:"center"},y={padding:0};t.a=Object(o.b)(e=>({userData:e.user.data,files:e.budgets.allFiles,budgetId:e.prefs.local&&e.prefs.local.id}),i)(Object(l.k)(function({files:e,budgetId:t,userData:n,getUserData:o,setAppState:l,signOut:i,pushModal:s,closeBudget:f,style:g,color:h}){let b=d(Object(r.useState)(!0),2),O=b[0],w=b[1],v=d(Object(r.useState)(!1),2),E=v[0],j=v[1];const S=Object(u.a)();return Object(r.useEffect)(()=>{o().then(()=>w(!1))},[]),O?a.a.createElement(c.z,{style:[p,g]},"Loading account..."):n?n.offline?a.a.createElement(c.C,{style:[{color:h},g]},"Offline"):a.a.createElement(c.C,{style:[m,g]},a.a.createElement(c.d,{bare:!0,onClick:async function(){S?j(!0):(await f(),window.__history.push("/config-server"))},style:{color:h}},S?"Server":"No server"),E&&a.a.createElement(c.B,{position:"bottom-right",style:y,onClose:()=>j(!1)},a.a.createElement(c.s,{onMenuSelect:function(e){switch(j(!1),e){case"change-password":!async function(){await f(),window.__history.push("/change-password")}();break;case"sign-out":i()}},items:[{name:"change-password",text:"Change password"},{name:"sign-out",text:"Sign out"}]}))):a.a.createElement(c.C,{style:[{color:h},g]},"Not logged in")}))},242:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(2),l=n(1),i=n(9),c={flex:1,maxHeight:200,overflow:"auto"},s={cursor:"pointer"},u={paddingLeft:20};class d extends a.a.Component{constructor(...e){super(...e),this.state={hoveredBackup:null},this.onHover=(e=>{this.setState({hoveredBackup:e})})}render(){const e=this.props,t=e.backups,n=e.onSelect,r=this.state.hoveredBackup;return a.a.createElement(l.C,{style:c,onMouseLeave:()=>this.onHover(null)},t.map((e,t)=>a.a.createElement(i.h,{key:e.id,collapsed:0!==t,focused:r===e.id,onMouseEnter:()=>this.onHover(e.id),onClick:()=>n(e.id),style:s},a.a.createElement(i.a,{width:"flex",value:e.date?e.date:"Revert to Latest",valueStyle:u}))))}}var f={flex:0},p={marginBottom:30},m={margin:20,marginTop:0,marginBottom:15,lineHeight:1.5},y={marginBottom:10},g={fontWeight:600},h={alignItems:"flex-start"},b={marginBottom:10},O={fontWeight:600},w={color:o.a.n6,marginLeft:20};t.a=function({budgetId:e,backups:t,backupDisabled:n,actions:r,modalProps:o}){const i=t.find(e=>e.isLatest),c=t.filter(e=>!e.isLatest);return a.a.createElement(l.t,Object.assign({title:"Load Backup",padding:0},o,{style:f}),()=>a.a.createElement(l.C,{style:p},a.a.createElement(l.C,{style:m},i?a.a.createElement(l.c,null,a.a.createElement(l.c,{style:y},a.a.createElement(l.z,{style:g},"You are currently working from a backup.")," ","You can load a different backup or revert to the original version below."),a.a.createElement(l.d,{primary:!0,onClick:()=>r.loadBackup(e,i.id)},"Revert to original version")):a.a.createElement(l.C,{style:h},a.a.createElement(l.c,{style:b},"Select a backup to load. After loading a backup, you will have a chance to revert to the current version in this screen."," ",a.a.createElement(l.z,{style:O},"If you use a backup, you will have to setup all your devices to sync from the new budget.")),a.a.createElement(l.d,{primary:!0,disabled:n,onClick:()=>r.makeBackup()},"Backup Now"))),0===c.length?a.a.createElement(l.c,{style:w},"No backups available"):a.a.createElement(d,{backups:c,onSelect:t=>r.loadBackup(e,t)})))}},243:function(e,t,n){"use strict";n.d(t,"a",function(){return j});var r=n(0),a=n.n(r),o=n(14),l=n(3),i=n(138),c=n(1),s=n(2);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f={width:600},p={marginTop:5},m={marginTop:0,"& li":{marginBottom:8}},y={marginTop:5},g={alignItems:"center"},h={fontWeight:600,marginBottom:3},b={color:s.a.r4,textAlign:"center",fontSize:13,marginBottom:3},O={width:300},w={marginTop:5},v={userSelect:"none"},E={marginTop:20};function j({modalProps:e,actions:t,options:n={}}){let s=u(Object(r.useState)(""),2),d=s[0],j=s[1],S=u(Object(r.useState)(!1),2),C=S[0],x=S[1],P=u(Object(r.useState)(""),2),k=P[0],A=P[1],D=u(Object(r.useState)(!1),2),I=D[0],T=D[1],M=n.recreate;return a.a.createElement(c.t,Object.assign({},e,{style:f,title:M?"Generate new key":"Enable encryption",onClose:()=>t.popModal()}),()=>a.a.createElement(a.a.Fragment,null,M?a.a.createElement(a.a.Fragment,null,a.a.createElement(c.v,{style:y},"This will generate a new key for encrypting your data."," ",a.a.createElement("strong",null,"This requires a sync reset")," and all other devices will have to revert to this version of your data. Actual will take you through that process on those devices."," ",a.a.createElement(c.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Getting-Started/sync#end-to-end-encryption"},"Learn more")),a.a.createElement(c.v,null,"Key generation is randomized. The same password will create different keys, so this will change your key regardless of the password being different.")):a.a.createElement(a.a.Fragment,null,a.a.createElement(c.v,{style:p},"To enable end-to-end encryption, you need to create a key. We will generate a key based on a password and use it to encrypt from now on. ",a.a.createElement("strong",null,"This requires a sync reset")," and all other devices will have to revert to this version of your data."," ",a.a.createElement(c.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Getting-Started/sync#end-to-end-encryption"},"Learn more")),a.a.createElement(c.v,null,a.a.createElement("ul",Object(o.css)(m),a.a.createElement("li",null,a.a.createElement("strong",null,"Important:")," if you forget this password"," ",a.a.createElement("em",null,"and")," you don't have any local copies of your data, you will lose access to all your data. The data cannot be decrypted without the password."),a.a.createElement("li",null,"This key only applies to this file. You will need to generate a new key for each file you want to encrypt."),a.a.createElement("li",null,"If you've already downloaded your data on other devices, you will need to reset them. Actual will automatically take you through this process."),a.a.createElement("li",null,"It is recommended for the encryption password to be different than the log-in password in order to better protect your data.")))),a.a.createElement("form",{onSubmit:e=>{e.preventDefault(),async function(){if(""!==d&&!C){x(!0),A(null);let e=await Object(l.send)("key-make",{password:d});if(e.error)return x(null),void A(Object(i.a)(e.error));t.loadGlobalPrefs(),t.loadAllFiles(),t.sync(),x(!1),t.popModal()}}()}},a.a.createElement(c.C,{style:g},a.a.createElement(c.z,{style:h},"Password"),k&&a.a.createElement(c.C,{style:b},k),a.a.createElement(c.l,null,a.a.createElement(c.n,{type:I?"text":"password",style:O,onChange:e=>j(e.target.value)})),a.a.createElement(c.z,{style:w},a.a.createElement("label",{style:v},a.a.createElement("input",{type:"checkbox",onClick:()=>T(!I)})," ","Show password"))),a.a.createElement(c.u,{style:E},a.a.createElement(c.f,{loading:C,primary:!0},"Enable")))))}},244:function(e,t,n){"use strict";n.d(t,"a",function(){return E});var r=n(0),a=n.n(r),o=n(3),l=n(138),i=n(1),c=n(2);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var d={width:600},f={flex:1},p={fontSize:25,fontWeight:700,color:c.a.n2,margin:"20px 0"},m={marginTop:15,flexDirection:"column",alignItems:"center"},y={fontWeight:600,marginBottom:5},g={color:c.a.r4,textAlign:"center",fontSize:13,marginBottom:3},h={width:"50%"},b={marginTop:5},O={userSelect:"none"},w={marginTop:20},v={marginRight:10};function E({modalProps:e,actions:t,options:n={}}){let c=n.hasExistingKey,u=n.cloudFileId,E=n.onSuccess,j=s(Object(r.useState)(""),2),S=j[0],C=j[1],x=s(Object(r.useState)(""),2),P=x[0],k=x[1],A=s(Object(r.useState)(!1),2),D=A[0],I=A[1],T=s(Object(r.useState)(!1),2),M=T[0],R=T[1];async function B(){if(""!==S&&!D){I(!0),k(null);let e=(await Object(o.send)("key-test",{password:S,fileId:u})).error;if(e)return k(Object(l.c)(e)),void I(!1);t.popModal(),E&&E()}}return a.a.createElement(i.t,Object.assign({},e,{showHeader:!1,style:d}),()=>a.a.createElement(i.C,{style:f},a.a.createElement(i.z,{style:p},c?"Unable to decrypt file":"This file is encrypted"),c?a.a.createElement(i.v,null,"This file was encrypted with a different key than you are currently using. This probably means you changed your password. Enter your current password to update your key."," ",a.a.createElement(i.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Getting-Started/sync#end-to-end-encryption"},"Learn more")):a.a.createElement(i.v,null,"We don","'","t have a key that encrypts or decrypts this file. Enter the password for this file to create the key for encryption."," ",a.a.createElement(i.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Getting-Started/sync#end-to-end-encryption"},"Learn more")),a.a.createElement("form",{onSubmit:e=>{e.preventDefault(),B()}},a.a.createElement(i.C,{style:m},a.a.createElement(i.z,{style:y},"Password")," ",P&&a.a.createElement(i.C,{style:g},P),a.a.createElement(i.l,null,a.a.createElement(i.n,{type:M?"text":"password",style:h,onChange:e=>C(e.target.value)})),a.a.createElement(i.z,{style:b},a.a.createElement("label",{style:O},a.a.createElement("input",{type:"checkbox",onClick:()=>R(!M)})," ","Show password"))),a.a.createElement(i.u,{style:w},a.a.createElement(i.d,{style:v,onClick:()=>e.onBack(),type:"button"},"Back"),a.a.createElement(i.f,{loading:D,primary:!0,onClick:B},c?"Update key":"Create key")))))}},245:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(31),l=n(43),i=n(33),c=n(1),s=n(2),u=n(48),d=n(115);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var h={lineHeight:"1.4em"};var b={fontWeight:700,marginBottom:10},O={flexShrink:0,color:"currentColor"},w={width:9,height:9,color:"currentColor"},v={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(250, 250, 250, .75)",alignItems:"center",justifyContent:"center"},E={width:20,height:20,color:"currentColor"};function j({notification:e,onRemove:t}){let n=e.type,o=e.title,l=e.message,i=e.messageActions,f=e.sticky,m=e.internal,g=e.button,j=y(Object(r.useState)(!1),2),S=j[0],C=j[1],x=y(Object(r.useState)(!1),2),P=x[0],k=x[1];Object(r.useEffect)(()=>{"error"===n&&m&&console.error("Internal error:",m),f||setTimeout(t,6500)},[]);let A="message"===n,D="error"===n,I=Object(r.useMemo)(()=>(function(e,t,n,r){return a.a.createElement(c.y,{spacing:2},e.split(/\n\n/).map((e,o)=>{let l=e.split(/(\[[^\]]*\]\([^)]*\))/g);return a.a.createElement(c.z,{key:o,style:h},l.map((e,o)=>{let l=e.match(/\[([^\]]*)\]\(([^)]*)\)/);if(l){let e=y(l,3),i=(e[0],e[1]),s=e[2];if("#"===s[0]){let e=s.slice(1);return a.a.createElement("a",{href:"#",onClick:async a=>{a.preventDefault(),t[e]&&(n(!0),await t[e](),r())}},i)}return a.a.createElement(c.i,{key:o,asAnchor:!0,href:l[2]},l[1])}return a.a.createElement(c.z,{key:o},e)}))}))})(l,i,k,t),[l,i]);return a.a.createElement(c.C,{style:{marginTop:10,color:A?s.a.g3:D?s.a.r3:s.a.y2}},a.a.createElement(c.y,{align:"center",direction:"row",style:p(p({padding:"14px 14px",fontSize:14,backgroundColor:A?s.a.g11:D?s.a.r11:s.a.y10,borderTop:`3px solid ${A?s.a.g5:D?s.a.r5:s.a.y4}`},s.c.shadowLarge),{},{maxWidth:550,"& a":{color:"currentColor"}})},a.a.createElement(c.y,{align:"flex-start"},o&&a.a.createElement(c.C,{style:b},o),a.a.createElement(c.C,null,I),g&&a.a.createElement(c.f,{bare:!0,loading:S,onClick:async()=>{C(!0),await g.action(),t(),C(!1)},style:{backgroundColor:"transparent",border:`1px solid ${A?s.a.g5:D?s.a.r4:s.a.y3}`,color:"currentColor",fontSize:14,flexShrink:0,"&:hover, &:active":{backgroundColor:A?s.a.g9:D?s.a.r10:s.a.y9}}},g.title)),f&&a.a.createElement(c.d,{bare:!0,style:O,onClick:t},a.a.createElement(d.a,{style:w}))),P&&a.a.createElement(c.C,{style:v},a.a.createElement(u.a,{color:"currentColor",style:E})))}var S={position:"absolute",bottom:20,right:13,zIndex:1e4};t.a=Object(o.b)(e=>({notifications:e.notifications.notifications}),e=>Object(l.b)(i,e))(function({notifications:e,removeNotification:t,style:n}){return a.a.createElement(c.C,{style:[S,n]},e.map(e=>a.a.createElement(j,{key:e.id,notification:e,onRemove:()=>{e.onClose&&e.onClose(),t(e.id)}})))})},252:function(e,t,n){"use strict";var r=n(0),a=n(3);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=function(){let e=o(Object(r.useState)(""),2),t=e[0],n=e[1];return Object(r.useEffect)(()=>{(async()=>{const e=await Object(a.send)("get-server-version"),t=e.error,r=e.version;n(t?"":r)})()},[]),t?`v${t}`:"N/A"}},26:function(e,t,n){"use strict";n.d(t,"c",function(){return y}),n.d(t,"d",function(){return b}),n.d(t,"e",function(){return O}),n.d(t,"a",function(){return w}),n.d(t,"b",function(){return v});var r=n(0),a=n.n(r),o=n(31),l=n(3),i=n(90),c=n(75);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t){let n=Math.min(e.start,e.end),r=Math.max(e.start,e.end);for(let a=n;a<=r;a++)t(a)}function y(e,t,n){let a=f(Object(r.useReducer)((e,n)=>{switch(n.type){case"select":{let r=e.selectedRange,a=new Set(e.selectedItems),o=n.id;if(Object(c.a)("shift")&&r){let n,l,i=t.findIndex(e=>e.id===o),c=t.findIndex(e=>e.id===r.start),s=t.findIndex(e=>e.id===r.end);return-1===s?n={start:c,end:i}:s<c?i<=c?(n={start:c,end:i},i>s&&(l={start:i-1,end:s})):n={start:s,end:i}:i>=c?(n={start:c,end:i},i<s&&(l={start:i+1,end:s})):n={start:s,end:i},m(n,e=>a.add(t[e].id)),l&&m(l,e=>a.delete(t[e].id)),u(u({},e),{},{selectedItems:a,selectedRange:{start:t[n.start].id,end:t[n.end].id}})}{let t=null;return a.delete(o)||(a.add(o),t={start:o,end:null}),u(u({},e),{},{selectedItems:a,selectedRange:t})}}case"select-none":return u(u({},e),{},{selectedItems:new Set});case"select-all":return u(u({},e),{},{selectedItems:new Set(n.ids||t.map(e=>e.id)),selectedRange:n.ids&&1===n.ids.length?{start:n.ids[0],end:null}:null});default:throw new Error("Unexpected action: "+n.type)}},null,()=>({selectedItems:new Set(n||[]),selectedRange:n&&1===n.length?{start:n[0],end:null}:null})),2),s=a[0],d=a[1],p=Object(r.useRef)(t);Object(r.useEffect)(()=>{if(s.selectedItems.size>0){let e=new Set(t.map(e=>e.id));if(!(p.current.length===t.length&&p.current.every(t=>e.has(t.id)))){let t=[...s.selectedItems],n=t.filter(t=>e.has(t));t.length!==n.length&&d({type:"select-all",ids:n})}}p.current=t},[t,s.selectedItems]),Object(r.useEffect)(()=>{let t=i.getUndoState("selectedItems");return i.setUndoState("selectedItems",{name:e,items:s.selectedItems}),()=>i.setUndoState("selectedItems",t)},[s.selectedItems]);let y=Object(o.d)(e=>e.app.lastUndoState);return Object(r.useEffect)(()=>{function t({messages:t,undoTag:n}){let r=i.getTaggedState(n),a=new Set(t.filter(e=>"tombstone"===e.column&&1===e.value).map(e=>e.row));r&&r.selectedItems&&r.selectedItems.name===e&&d({type:"select-all",ids:[...r.selectedItems.items].filter(e=>!a.has(e))})}return y&&y.current&&t(y.current),Object(l.listen)("undo-event",t)},[]),{items:s.selectedItems,setItems:s.setSelectedItems,dispatch:d}}let g=a.a.createContext(null),h=a.a.createContext(null);function b(){return Object(r.useContext)(g)}function O(){return Object(r.useContext)(h)}function w({instance:e,fetchAllIds:t,children:n}){let o=Object(r.useRef)(null);Object(r.useEffect)(()=>{o.current=e.items},[e.items]);let l=Object(r.useCallback)(async n=>"select-all"===n.type?o.current&&o.current.size>0?e.dispatch({type:"select-none"}):t?e.dispatch({type:"select-all",ids:await t()}):e.dispatch({type:"select-all"}):e.dispatch(n),[e.dispatch,t]);return a.a.createElement(h.Provider,{value:e.items},a.a.createElement(g.Provider,{value:l},n))}function v({name:e,items:t,initialSelectedIds:n,fetchAllIds:o,registerDispatch:l,children:i}){let c=y(e,t,n);return Object(r.useEffect)(()=>{l&&l(c.dispatch)},[l]),a.a.createElement(w,{instance:c,fetchAllIds:o,children:i})}},3:function(e,t,n){const r=n(618),a=r.captureException,o=r.captureBreadcrumb,l=n(200),i=n(90);let c=new Map,s=new Map,u=[],d=null;class f extends Error{constructor(e,t,n,r,a){super(e),this.name=this.constructor.name,this.message=e,Object.defineProperty(this,"stack",{get:function(){return"extended "+this._stack},set:function(e){this._stack=e}}),this.stack=t,this.url=n,this.line=r,this.column=a}}function p(e,t,n){d=e,e.addEventListener("message",r=>{let l=r.data;"connect"===l.type?(u.length>0&&(u.forEach(t=>e.postMessage(t)),u=[]),t()):"app-init-failure"===l.type?n(l):"capture-exception"===l.type?(a(l.stack?new f(l.message,l.stack,l.url,l.line,l.column):l.exc),l.message&&l.message.includes("indexeddb-quota-error")&&alert("We hit a limit on the local storage available. Edits may not be saved. Please get in touch https://actualbudget.github.io/docs/Contact/ so we can help debug this.")):"capture-breadcrumb"===l.type?o(l.data):function(e){if("error"===e.type){const t=e.id;c.delete(t)}else if("reply"===e.type){const t=e.id,n=e.result,r=e.mutated,a=e.undoTag,o=c.get(t);o&&(c.delete(t),r||i.gc(a),o.resolve(n))}else if("push"===e.type){const t=e.name,n=e.args,r=s.get(t);if(r)for(let e=0;e<r.length&&!0!==r[e](n);e++);}else if(!e.type.startsWith("__"))throw new Error("Unknown message type: "+JSON.stringify(e))}(l)}),e instanceof MessagePort&&e.start()}e.exports.init=async function(e){return new Promise((t,n)=>p(e,t,n))},e.exports.send=function(e,t,{catchErrors:n=!1}={}){return new Promise((r,a)=>{l.v4().then(o=>{c.set(o,{resolve:r,reject:a}),d?d.postMessage({id:o,name:e,args:t,undoTag:i.snapshot(),catchErrors:n}):u.push({id:o,name:e,args:t,undoTag:i.snapshot(),catchErrors:n})})})},e.exports.sendCatch=function(t,n){return e.exports.send(t,n,{catchErrors:!0})},e.exports.listen=function(e,t){return s.get(e)||s.set(e,[]),s.get(e).push(t),()=>{let n=s.get(e);s.set(e,n.filter(e=>e!==t))}},e.exports.unlisten=function(e){s.set(e,[])}},327:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(79),l=n(41);const i=a.a.forwardRef(({direction:e="column",align:t,justify:n,spacing:r=3,children:i,debug:c,style:s},u)=>{const d=e.endsWith("reverse"),f=e.startsWith("row"),p=function e(t,n){return a.a.Children.toArray(n).reduce((n,r)=>r?r.type===a.a.Fragment?n.concat(e(r.key,r.props.children)):(n.push({key:t+r.key,child:r}),n):n,[])}("",i);return a.a.createElement(l.a,{style:[{flexDirection:e,alignItems:t,justifyContent:n},s],innerRef:u},p.map(({key:e,child:t},n)=>{let l,i=p.length===n+1;return l=f?d?"marginLeft":"marginRight":d?"marginTop":"marginBottom",a.a.cloneElement("string"===typeof t?a.a.createElement(o.a,null,t):t,{key:e,style:[c&&{borderWidth:1,borderColor:"red"},i?null:{[l]:5*r},t.props?t.props.style:null]})}))});t.a=i},33:function(e,t,n){"use strict";n.r(t);var r=n(78),a=n(3),o=n(11),l=n(128);function i(e){return{type:o.a.SET_ACCOUNTS_SYNCING,name:e}}function c(e,t,n){return{type:"ACCOUNT_SYNC_STATUS",id:e,failed:!0,errorType:t,errorCode:n}}function s(e){return{type:"ACCOUNT_SYNC_STATUS",id:e,failed:!1}}function u(e){return{type:"ACCOUNT_SYNC_FAILURES",syncErrors:e}}function d(e){return async t=>{await Object(a.send)("account-unlink",{id:e}),t(s(e)),t(Object(r.j)())}}function f(e,t,n,o){return async l=>{await Object(a.send)("accounts-link",{institution:e,publicToken:t,accountId:n,upgradingId:o}),await l(Object(r.l)()),await l(Object(r.j)())}}function p(e,t,n,o){return async l=>{let i=await Object(a.send)("accounts-connect",{institution:e,publicToken:t,accountIds:n,offbudgetIds:o});return await l(Object(r.l)()),await l(Object(r.j)()),i}}function m(e){return async(t,n)=>{if(n().account.accountsSyncing)return!1;if(e){let r=n().queries.accounts.find(t=>t.id===e);t(i(r.name))}else t(i("__all"));const r=await Object(a.send)("accounts-sync",{id:e}),d=r.errors,f=r.newTransactions,p=r.matchedTransactions,m=r.updatedAccounts;if(t(i(null)),e){let n=d.find(t=>t.accountId===e);n?"SyncError"===n.type&&t(c(e,n.category,n.code)):t(s(e))}else t(u(d.filter(e=>"SyncError"===e.type).map(e=>({id:e.accountId,type:e.category,code:e.code}))));return d.forEach(e=>{"SyncError"===e.type?t(Object(l.b)({type:"error",message:e.message})):t(Object(l.b)({type:"error",message:e.message,internal:e.internal}))}),t({type:o.a.SET_NEW_TRANSACTIONS,newTransactions:f,matchedTransactions:p,updatedAccounts:m}),f.length>0||p.length>0}}function y(e){return{type:o.a.SET_LAST_TRANSACTION,transaction:e}}function g(e,t){return async n=>await Object(a.send)("transactions-parse-file",{filepath:e,options:t})}function h(e,t){return async n=>{let r=await Object(a.send)("transactions-import",{accountId:e,transactions:t}),i=r.errors,c=void 0===i?[]:i,s=r.added,u=r.updated;return c.forEach(e=>{n(Object(l.b)({type:"error",message:e.message,internal:e.internal}))}),n({type:o.a.SET_NEW_TRANSACTIONS,newTransactions:s,matchedTransactions:u,updatedAccounts:s.length>0?[e]:[]}),s.length>0||u.length>0}}function b(e){return{type:o.a.UPDATE_NEW_TRANSACTIONS,changedId:e}}function O(e){return{type:o.a.MARK_ACCOUNT_READ,accountId:e}}function w(){return async e=>{e({type:o.a.LOAD_BANKS,banks:await Object(a.send)("banks")})}}function v(e,t){return{type:o.a.DEBUG_CELL,sheet:e,name:t}}var E=n(62),j=n(101),S=n(66),C=n(74),x=n(158);function P(e,t){return async(n,r)=>{const o=r().prefs.local;o&&o.id&&await n(Object(S.b)()),await Object(a.send)("backup-load",{id:e,backupId:t}),n(Object(S.j)(e))}}function k(){return async(e,t)=>{const n=t().prefs.local;n&&n.id&&await Object(a.send)("backup-make",{id:n.id})}}var A=n(138);function D(){return async e=>{const t=await Object(a.send)("unregister");e({type:o.a.SET_PROFILE,profile:t})}}function I(){return async(e,t)=>{let n=(await Object(a.send)("sync-reset")).error;n?(alert(Object(A.d)(n)),"encrypt-failure"===n.reason&&n.meta.isMissingKey||"file-has-new-key"===n.reason?e(Object(E.d)("fix-encryption-key",{onSuccess:()=>{e(I())}})):"encrypt-failure"===n.reason&&e(Object(E.d)("create-encryption-key",{recreate:!0}))):(await e(T()),await e(Object(j.b)()))}}function T(){return async(e,t)=>{const n=t().prefs.local;if(n&&n.id){return{error:(await Object(a.send)("sync")).error}}}}function M(e){return async(t,n)=>{let r=await t(T());if(r.error)return{error:r.error};let a=await t(m(e));if(a){let e=await t(T());return!e.error||{error:e.error}}return{hasUpdated:a||r.updated}}}var R=n(113);n.d(t,"applyBudgetAction",function(){return r.a}),n.d(t,"getCategories",function(){return r.k}),n.d(t,"createCategory",function(){return r.d}),n.d(t,"deleteCategory",function(){return r.g}),n.d(t,"updateCategory",function(){return r.v}),n.d(t,"moveCategory",function(){return r.n}),n.d(t,"moveCategoryGroup",function(){return r.o}),n.d(t,"createGroup",function(){return r.e}),n.d(t,"updateGroup",function(){return r.w}),n.d(t,"deleteGroup",function(){return r.h}),n.d(t,"getPayees",function(){return r.l}),n.d(t,"initiallyLoadPayees",function(){return r.m}),n.d(t,"createPayee",function(){return r.f}),n.d(t,"getAccounts",function(){return r.j}),n.d(t,"updateAccount",function(){return r.u}),n.d(t,"createAccount",function(){return r.c}),n.d(t,"openAccountCloseModal",function(){return r.p}),n.d(t,"closeAccount",function(){return r.b}),n.d(t,"reopenAccount",function(){return r.r}),n.d(t,"forceCloseAccount",function(){return r.i}),n.d(t,"setUndoEnabled",function(){return r.s}),n.d(t,"undo",function(){return r.t}),n.d(t,"redo",function(){return r.q}),n.d(t,"setAccountsSyncing",function(){return i}),n.d(t,"markAccountFailed",function(){return c}),n.d(t,"markAccountSuccess",function(){return s}),n.d(t,"setFailedAccounts",function(){return u}),n.d(t,"unlinkAccount",function(){return d}),n.d(t,"linkAccount",function(){return f}),n.d(t,"connectAccounts",function(){return p}),n.d(t,"syncAccounts",function(){return m}),n.d(t,"setLastTransaction",function(){return y}),n.d(t,"parseTransactions",function(){return g}),n.d(t,"importTransactions",function(){return h}),n.d(t,"updateNewTransactions",function(){return b}),n.d(t,"markAccountRead",function(){return O}),n.d(t,"getBanks",function(){return w}),n.d(t,"debugCell",function(){return v}),n.d(t,"pushModal",function(){return E.d}),n.d(t,"replaceModal",function(){return E.e}),n.d(t,"hideModals",function(){return E.b}),n.d(t,"showModals",function(){return E.f}),n.d(t,"popModal",function(){return E.c}),n.d(t,"closeModal",function(){return E.a}),n.d(t,"addNotification",function(){return l.b}),n.d(t,"addGenericErrorNotification",function(){return l.a}),n.d(t,"removeNotification",function(){return l.c}),n.d(t,"loadPrefs",function(){return j.b}),n.d(t,"savePrefs",function(){return j.d}),n.d(t,"loadGlobalPrefs",function(){return j.a}),n.d(t,"saveGlobalPrefs",function(){return j.c}),n.d(t,"updateStatusText",function(){return S.m}),n.d(t,"loadBudgets",function(){return S.k}),n.d(t,"loadRemoteFiles",function(){return S.l}),n.d(t,"loadAllFiles",function(){return S.i}),n.d(t,"loadBudget",function(){return S.j}),n.d(t,"closeBudget",function(){return S.b}),n.d(t,"closeBudgetUI",function(){return S.c}),n.d(t,"deleteBudget",function(){return S.e}),n.d(t,"createBudget",function(){return S.d}),n.d(t,"importBudget",function(){return S.h}),n.d(t,"uploadBudget",function(){return S.n}),n.d(t,"closeAndDownloadBudget",function(){return S.a}),n.d(t,"downloadBudget",function(){return S.f}),n.d(t,"getYNAB4Imports",function(){return S.g}),n.d(t,"setAppState",function(){return C.b}),n.d(t,"updateApp",function(){return C.d}),n.d(t,"setLastUndoState",function(){return C.c}),n.d(t,"uploadFile",function(){return C.e}),n.d(t,"focused",function(){return C.a}),n.d(t,"startTutorialFirstTime",function(){return x.a}),n.d(t,"loadBackup",function(){return P}),n.d(t,"makeBackup",function(){return k}),n.d(t,"unregister",function(){return D}),n.d(t,"resetSync",function(){return I}),n.d(t,"sync",function(){return T}),n.d(t,"syncAndDownload",function(){return M}),n.d(t,"getUserData",function(){return R.a}),n.d(t,"loggedIn",function(){return R.b}),n.d(t,"signOut",function(){return R.c})},34:function(e,t,n){"use strict";var r=n(3);var a=n(99);n.d(t,"f",function(){return o}),n.d(t,"d",function(){return l}),n.d(t,"e",function(){return i}),n.d(t,"a",function(){return c}),n.d(t,"b",function(){return s});t.c=a.a;async function o(e){return Object(r.send)("query",e.serialize())}function l(e,t,n){let r=new c(e,t,n);return r.run(),r}function i(e,t,n){let r=new s(e,t,n);return r.run(),r}class c{constructor(e,t,n={}){this.onData=((e,t)=>{for(let n=0;n<this.listeners.length;n++)this.listeners[n](e,t)}),this.onUpdate=(e=>{(null==this.dependencies||e.find(e=>this.dependencies.has(e)))&&this.run()}),this.run=(()=>(this.subscribe(),this._fetchData(()=>o(this.query)))),this._fetchData=(async e=>{let t=Math.random();this.inflightRequestId=t;let n=await e(),r=n.data,a=n.dependencies;if(null==this.dependencies&&(this.dependencies=new Set(a)),this.inflightRequestId===t&&this._unsubscribe){let e=this.mappedData;this.data=r,this.mappedData=this.mapData(r),this.onData(this.mappedData,e),this.inflightRequestId=null}}),this.subscribe=(()=>{null==this._unsubscribe&&(this._unsubscribe=Object(r.listen)("sync-event",({type:e,tables:t})=>{-1!==(this.onlySync?["success"]:["applied","success"]).indexOf(e)&&this.onUpdate(t)}))}),this.unsubscribe=(()=>{this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null)}),this.mapData=(e=>this.mapper?this.mapper(e):e),this.getQuery=(()=>this.query),this.getData=(()=>this.mappedData),this.getNumListeners=(()=>this.listeners.length),this.isRunning=(()=>null!=this._unsubscribe),this._optimisticUpdate=((e,t)=>{this.data=e(this.data),this.mappedData=t(this.mappedData)}),this.optimisticUpdate=((e,t)=>{let n=this.mappedData;this._optimisticUpdate(e,t),this.onData(this.mappedData,n)}),this.error=new Error,this.query=e,this.data=null,this.mappedData=null,this.dependencies=null,this.mapper=n.mapper,this.onlySync=n.onlySync,this.listeners=[],this.inflight=!1,this.restart=!1,t&&this.addListener(t)}addListener(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}}class s extends c{constructor(e,t,n={}){super(e,t,n),this._fetchCount=(()=>o(this.query.calculate({$count:"*"})).then(({data:e})=>{this.totalCount=e})),this.run=(()=>(this.subscribe(),this.runPromise=this._fetchData(async()=>(this.done=!1,this._fetchCount(),o(this.query.limit(null==this.data?this.pageCount:Math.max(this.data.length,this.pageCount))))),this.runPromise)),this.refetchUpToRow=(async(e,t)=>(this.runPromise=this._fetchData(async()=>{this.done=!1,this._fetchCount();let n=Object(a.b)(this.query,t);if(null==n)throw new Error("refetchUpToRow requires a query with orderBy");let r=n.field,l=n.order,i=await o(this.query.filter({id:e}).select(r));if(0===i.data.length)return;let c=i.data[0],s=(i=await o(this.query.filter({[r]:{["asc"===l?"$lte":"$gte"]:c[r]}}))).data;return i=await o(this.query.filter({[r]:{["asc"===l?"$gt":"$lt"]:c[r]}}).limit(this.pageCount)),{data:s.concat(i.data),dependencies:i.dependencies}}),this.runPromise)),this._fetchNext=(async()=>{for(;this.inflightRequestId;)await this.runPromise;let e=this.data;if(!this.done){let t=(await o(this.query.limit(this.pageCount).offset(e.length))).data;if(this.inflightRequestId||e!==this.data)return this._fetchNext();if(0===t.length)this.done=!0;else{this.done=t.length<this.pageCount,this.data=this.data.concat(t);let e=this.mappedData,n=this.mapData(t);this.mappedData=this.mappedData.concat(n),this.onPageData(n),this.onData(this.mappedData,e)}}}),this.fetchNext=function(e){let t=null;return(...n)=>t||(t=e(...n).finally(()=>{t=null}))}(this._fetchNext),this.isFinished=(()=>this.done),this.getTotalCount=(()=>this.totalCount),this.optimisticUpdate=((e,t)=>{let n=this.data,r=this.mappedData;this._optimisticUpdate(e,t),this.totalCount+=this.data.length-n.length,this.onData(this.mappedData,r)}),this.totalCount=null,this.pageCount=n.pageCount||500,this.runPromise=null,this.done=!1,this.onPageData=n.onPageData||(()=>{})}}},40:function(e,t,n){"use strict";n.d(t,"d",function(){return s}),n.d(t,"c",function(){return d}),n.d(t,"b",function(){return f}),n.d(t,"a",function(){return m});var r=n(0),a=n.n(r),o=n(14),l=n(2),i=n(1),c={fontWeight:500,textTransform:"uppercase",color:l.a.b3,marginBottom:5,lineHeight:"1em"};function s({title:e,style:t}){return a.a.createElement(i.C,{style:[c,t]},e)}var u={fontSize:13,marginBottom:3,color:l.a.n3};function d({style:e,title:t}){return a.a.createElement(i.z,{style:[u,e]},t)}function f({style:e,children:t}){return a.a.createElement(i.C,{style:e},t)}var p={position:"relative",margin:0,marginRight:6,width:15,height:15,appearance:"none",outline:0,border:"1px solid #d0d0d0",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",color:"white",backgroundColor:"white",":checked":{border:"1px solid "+l.a.b6,backgroundColor:l.a.b6,"::after":{display:"block",background:l.a.b6+' url(\'data:image/svg+xml; utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="white" d="M0 11l2-2 5 5L18 3l2 2L7 18z"/></svg>\') 9px 9px',width:9,height:9,content:" "}},"&.focus-visible:focus":{"::before":{position:"absolute",top:-5,bottom:-5,left:-5,right:-5,border:"2px solid "+l.a.b5,borderRadius:6,content:" "}}};function m(e){return a.a.createElement("input",Object.assign({type:"checkbox"},e,Object(o.css)([p],e.style)))}},41:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(14);const l=["style","nativeStyle","innerRef"];function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}t.a=function(e){e.style;const t=e.nativeStyle,n=e.innerRef,r=i(e,l);return a.a.createElement("div",Object.assign({},r,{ref:n,style:t,className:`view ${e.className||""} ${Object(o.css)(e.style)}`}))}},42:function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n(10);function a(e,t="string"){switch(t){case"string":const n=JSON.stringify(e);return'"'===n.charAt(0)&&'"'===n.charAt(n.length-1)?n.slice(1,-1):n;case"number":return""+e;case"financial-with-sign":let o=a(e,"financial");return e>=0?"+"+o:o;case"financial":if(null==e||""===e)return Object(r.k)(0);if("string"===typeof e){const t=parseFloat(e);e=isNaN(t)?0:t}if("number"!==typeof e)throw new Error("Value is not a number ("+typeof e+"): "+e);return Object(r.k)(e);default:throw new Error("Unknown format type: "+t)}}},442:function(e,t,n){"use strict";function r(){return new Worker(n.p+"static/js/browser-server.4f270a84.worker.js")}n.d(t,"a",function(){return r})},443:function(e,t,n){"use strict";(function(e){var r=n(0),a=n.n(r),o=n(31),l=n(14),i=n(33),c=n(3),s=n(2),u=n(444),d=n(600),f=n(448),p=n(609),m=n(610),y=n(605),g=n(612),h={height:"100%",backgroundColor:"#E8ECF0",overflow:"hidden"};t.a=Object(o.b)(e=>({budgetId:e.prefs.local&&e.prefs.local.id,cloudFileId:e.prefs.local&&e.prefs.local.cloudFileId,loadingText:e.app.loadingText}),i)(class extends a.a.Component{constructor(...e){super(...e),this.state={fatalError:null,initializing:!0,hiddenScrollbars:Object(s.b)()}}async init(){const t=await e.Actual.getServerSocket();try{await Object(c.init)(t)}catch(r){if("app-init-failure"===r.type)return void this.setState({initializing:!1,fatalError:r});throw r}await this.props.loadGlobalPrefs();const n=await Object(c.send)("get-last-opened-backup");n&&(await this.props.loadBudget(n),Object(c.send)("get-remote-files").then(e=>{if(e){let t=e.find(e=>e.fileId===this.props.cloudFileId);t&&t.deleted&&this.props.closeBudget()}}))}async componentDidMount(){await Promise.all([Object(u.a)(),this.init()]),this.setState({initializing:!1});let e=()=>{this.state.hiddenScrollbars!==Object(s.b)()&&this.setState({hiddenScrollbars:Object(s.b)()})};window.addEventListener("focus",e),this.cleanup=(()=>window.removeEventListener("focus",e))}componentDidCatch(e){this.setState({fatalError:e})}componentDidUpdate(t){this.props.budgetId!==t.budgetId&&e.Actual.updateAppMenu(!!this.props.budgetId)}render(){const e=this.props,t=e.budgetId,n=e.loadingText,r=this.state,o=r.fatalError,i=r.initializing,c=r.hiddenScrollbars;return a.a.createElement("div",Object.assign({key:c?"hidden-scrollbars":"scrollbars"},Object(l.css)([h,s.c.lightScrollbar])),o?a.a.createElement(a.a.Fragment,null,a.a.createElement(d.a,null),a.a.createElement(f.a,{error:o,buttonText:"Restart app"})):i?a.a.createElement(d.a,{initializing:i,loadingText:n}):t?a.a.createElement(p.a,null):a.a.createElement(a.a.Fragment,null,a.a.createElement(d.a,{initializing:i,loadingText:n}),a.a.createElement(m.a,null)),a.a.createElement(g.a,null),a.a.createElement(y.a,null))}})}).call(this,n(15))},444:function(e,t,n){"use strict";async function r(){if("ResizeObserver"in window===!1){const e=await n.e(2).then(n.bind(null,819));window.ResizeObserver=e.ResizeObserver}}n.d(t,"a",function(){return r})},447:function(e,t,n){e.exports=n.p+"static/media/bg.ad9dce3b.svg"},448:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(1),l=n(40),i=n(2);function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u={alignItems:"center",justifyContent:"center",height:"100%"},d={paddingBottom:100,maxWidth:500,color:i.a.r4,lineHeight:"1.5em",fontSize:15,"& a":{color:i.a.r4}},f={maxWidth:500},p={color:i.a.p4},m={fontSize:11},y={color:i.a.p4},g={marginTop:5,height:100,overflow:"auto"};t.a=class extends a.a.Component{constructor(...e){super(...e),this.state={showError:!1}}renderSimple(e){let t;return t=e.IDBFailure?a.a.createElement(o.z,null,"Your browser doesn","'","t support IndexedDB in this environment, a feature that Actual requires to run. This might happen if you are in private browsing mode. Please try a different browser or turn off private browsing."):e.SharedArrayBufferMissing?a.a.createElement(o.z,null,"Actual requires access to ",a.a.createElement("code",null,"SharedArrayBuffer")," in order to function properly. If you\u2019re seeing this error, either your browser does not support ",a.a.createElement("code",null,"SharedArrayBuffer"),", or your server is not sending the appropriate headers, or you are not using HTTPS. See"," ",a.a.createElement("a",{href:"https://actualbudget.github.io/docs/Troubleshooting/SharedArrayBuffer"},"our troubleshooting documentation")," ","to learn more. ",a.a.createElement(w,null)):a.a.createElement(o.z,null,"There was a problem loading the app in this browser version. If this continues to be a problem, you can"," ",a.a.createElement("a",{href:"https://github.com/actualbudget/releases"},"download the desktop app"),"."),a.a.createElement(o.C,{style:u},a.a.createElement(o.y,{style:d},a.a.createElement(o.z,null,t),a.a.createElement(o.z,null,"Please get"," ",a.a.createElement("a",{href:"https://actualbudget.github.io/docs/Contact"},"in touch")," ","for support")))}render(){const e=this.props,t=e.buttonText,n=e.error,r=this.state.showError;return"app-init-failure"===n.type?this.renderSimple(n):a.a.createElement(o.t,{isCurrent:!0,showClose:!1,title:"Fatal Error"},()=>a.a.createElement(o.C,{style:f},a.a.createElement(o.v,null,"There was an unrecoverable error in the UI. Sorry!"),a.a.createElement(o.v,null,"If this error persists, please get"," ",a.a.createElement("a",{href:"https://actualbudget.github.io/docs/Contact",style:p},"in touch"),"so it can be investigated."),a.a.createElement(o.v,null,a.a.createElement(o.d,{onClick:()=>window.Actual.relaunch()},t)),a.a.createElement(o.v,{isLast:!0,style:m},a.a.createElement(o.r,{onClick:()=>this.setState({showError:!0}),style:y},"Show Error"),r&&a.a.createElement(o.c,{style:g},n.stack))))}};var h={marginTop:10},b={display:"flex",alignItems:"center",marginBottom:10},O={color:"inherit !important",marginLeft:5,border:"none !important",background:"none !important",padding:"0 !important",textDecoration:"underline !important",boxShadow:"none !important",display:"inline !important",font:"inherit !important"};function w(){let e=c(Object(r.useState)(!1),2),t=e[0],n=e[1],i=c(Object(r.useState)(!1),2),s=i[0],u=i[1];return t?a.a.createElement(a.a.Fragment,null,a.a.createElement(o.v,{style:h},"Actual uses ",a.a.createElement("code",null,"SharedArrayBuffer")," to allow usage from multiple tabs at once and to ensure correct behavior when switching files. While it can run without access to ",a.a.createElement("code",null,"SharedArrayBuffer"),", you may encounter data loss or notice multiple budget files being merged with each other."),a.a.createElement("label",{style:b},a.a.createElement(l.a,{checked:s,onChange:u})," I understand the risks, run Actual in the unsupported fallback mode"),a.a.createElement(o.d,{disabled:!s,onClick:()=>{window.localStorage.setItem("SharedArrayBufferOverride","true"),window.location.reload()}},"Open Actual")):a.a.createElement(o.r,{onClick:()=>n(!0),style:O},"Advanced options")}},450:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return o});var r=n(3),a=n(65);function o(t,n,o){Object(r.send)("get-upgrade-notifications").then(n=>{n.forEach(n=>{switch(n){case"schedules":{let n="Track bills and subscriptions and much more with scheduled transactions. We can search all your existing transactions and try to find existing schedules.\n\n"+(e.IS_BETA?"NOTE: You are using the beta version, and this will not reset your sync data. This is safe to do.":"");"mobile"===a.a.env&&(n="Track bills and subscriptions and much more with scheduled transactions. Upcoming transactions will be shown in the accounts screen. Use the desktop app to create schedules."),t({type:"message",title:"Scheduled transactions are now available!",message:n,sticky:!0,id:"find-schedules",button:"mobile"!==a.a.env&&{title:"Find schedules",action:async()=>{__history&&__history.push("/schedule/discover",{locationPtr:__history.location})}},onClose:()=>{Object(r.send)("seen-upgrade-notification",{type:"schedules"})}});break}case"repair-splits":o&&t({type:"message",title:"Split transactions now support transfers & payees",message:"The payee field is now available on split transactions, allowing you to perform transfers on individual split transactions.\n\nAll existing split transactions have a blank payee and we recommend using the tool below to set the payee from the parent. [View a video walkthrough](https://www.youtube.com/watch?v=5kTtAsB0Oqk)",sticky:!0,id:"repair-splits",button:{title:"Repair splits...",action:()=>o.push("/tools/fix-splits",{locationPtr:o.location})},onClose:()=>{Object(r.send)("seen-upgrade-notification",{type:"repair-splits"})}})}})})}}).call(this,n(15))},457:function(e,t,n){"use strict";(function(e){var t=n(441),r=n(442);let a,o=!1,l=null!=Object({NODE_ENV:"production",PUBLIC_URL:"",REACT_APP_ACTUAL_VERSION:"23.2.9",REACT_APP_BACKEND_WORKER_HASH:"6c5247def36801d673f1",REACT_APP_RELEASE_TYPE:""}).PERF_BUILD,i="23.2.9";function c(){a=new r.a,Object(t.a)(a),window.SharedArrayBuffer&&localStorage.removeItem("SharedArrayBufferOverride"),a.postMessage({type:"init",version:i,isDev:o,hash:"6c5247def36801d673f1",isSharedArrayBufferOverrideEnabled:localStorage.getItem("SharedArrayBufferOverride")}),(o||l)&&(a.addEventListener("message",e=>{if("__actual:backend-running"===e.data.type){let e=document.querySelector(".debugger .activity");if(e){let t=window.getComputedStyle(e)["background-color"];e.style.transition="none",e.style.backgroundColor="#3EBD93",setTimeout(()=>{e.style.transition="background-color 1s",e.style.backgroundColor=t},100)}}}),Promise.resolve().then(function(){var e=new Error("Cannot find module 'perf-deets/frontend'");throw e.code="MODULE_NOT_FOUND",e}).then(({listenForPerfData:e})=>{e(a)}))}c(),(o||l)&&Promise.resolve().then(function(){var e=new Error("Cannot find module 'perf-deets/frontend'");throw e.code="MODULE_NOT_FOUND",e}).then(({listenForPerfData:t})=>{t(window),e.__startProfile=(()=>{window.postMessage({type:"__perf-deets:start-profile"}),a.postMessage({type:"__perf-deets:start-profile"})}),e.__stopProfile=(()=>{window.postMessage({type:"__perf-deets:stop-profile"}),a.postMessage({type:"__perf-deets:stop-profile"})})}),e.Actual={IS_DEV:o,ACTUAL_VERSION:i,IS_FAKE_WEB:!0,IS_BETA:!1,logToTerminal:(...e)=>{console.log(...e)},relaunch:()=>{window.location.reload()},openFileDialog:async({filters:e=[],properties:t})=>new Promise(t=>{let n=document.createElement("input");n.type="file";let r=e.find(e=>e.extensions);r&&(n.accept=r.extensions.map(e=>"."+e).join(",")),n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0})),n.addEventListener("change",e=>{let n=e.target.files[0],r=n.name.replace(/.*(\.[^.]*)/,"file$1");if(n){var a=new FileReader;a.readAsArrayBuffer(n),a.onload=async function(e){let n=`/uploads/${r}`;window.__actionsForMenu.uploadFile(r,e.target.result).then(()=>t([n]))},a.onerror=function(e){alert("Error reading file")}}})}),saveFile:(e,t,n)=>{const r=document.createElement("a");r.style="display: none",r.download=t,r.rel="noopener";const a=new Blob([e]);r.href=URL.createObjectURL(a),r.dispatchEvent(new MouseEvent("click"))},openURLInBrowser:e=>{window.open(e,"_blank")},onEventFromMain:(e,t)=>{},applyAppUpdate:()=>{},updateAppMenu:e=>{},ipcConnect:()=>{},getServerSocket:async()=>a},o&&(e.Actual.reloadBackend=(()=>{a.postMessage({type:"__actual:shutdown"}),c()})),document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(79===e.keyCode?(e.preventDefault(),window.__actionsForMenu.closeBudget()):90===e.keyCode&&(e.shiftKey?window.__actionsForMenu.redo():window.__actionsForMenu.undo()))})}).call(this,n(15))},468:function(e,t,n){e.exports=n.p+"static/media/DateSelect.left.1ae92674.png"},469:function(e,t,n){e.exports=n.p+"static/media/DateSelect.right.2a470dc0.png"},470:function(e,t,n){"use strict";n.d(t,"a",function(){return g});var r=n(0),a=n.n(r),o=n(58),l=n(1),i=n(206);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const p=150,m=(e,t)=>e;function y({onResize:e,children:t}){return t(Object(i.a)(e))}class g extends a.a.PureComponent{constructor(e){super(e),this._outerRef=void 0,this._resetIsScrollingTimeoutId=null,this.setRowAnimation=(e=>{this.animationEnabled=e;let t=this._outerRef;t&&(this.animationEnabled?t.classList.add("animated"):t.classList.remove("animated"))}),this.onHeaderResize=(e=>{}),this.getItemOffset=(e=>e*this.props.itemSize),this.getItemSize=(e=>this.props.itemSize),this.getEstimatedTotalSize=(()=>this.props.itemSize*this.props.itemCount),this.getOffsetForIndexAndAlignment=((e,t,n)=>{const r=this.props.height,a=Math.max(0,this.props.itemCount*this.props.itemSize-r),o=Math.min(a,e*this.props.itemSize),l=Math.max(0,e*this.props.itemSize-r+this.props.itemSize);switch("smart"===t&&(t=n>=l-r&&n<=o+r?"auto":"center"),t){case"start":return o;case"end":return l;case"center":{const e=Math.round(l+(o-l)/2);return e<Math.ceil(r/2)?0:e>a+Math.floor(r/2)?a:e}case"auto":default:return n>=l&&n<=o?n:n<l?l:o}}),this.getStartIndexForOffset=(e=>Math.max(0,Math.min(this.props.itemCount-1,Math.floor(e/this.props.itemSize)))),this.getStopIndexForStartIndex=((e,t)=>{const n=e*this.props.itemSize,r=this.props.width,a=Math.ceil((r+t-n)/this.props.itemSize);return Math.max(0,Math.min(this.props.itemCount-1,e+a-1))}),this._callOnItemsRendered=Object(o.a)((e,t,n,r)=>this.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:r})),this._callOnScroll=Object(o.a)((e,t,n)=>this.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})),this._getItemStyle=(e=>{const t=this.props,n=t.direction,r=t.itemSize,a=t.layout,o=this._getItemStyleCache(r,a,n);let l;if(o.hasOwnProperty(e))l=o[e];else{const t=this.getItemOffset(e),n=this.getItemSize(e);o[e]=l={position:"absolute",left:0,top:t,height:n,width:"100%"}}return l}),this._getItemStyleCache=Object(o.a)((e,t,n)=>({})),this._onScrollVertical=(e=>{let t=e.currentTarget.scrollTop;this.setState(e=>{if(e.scrollOffset===t)return null;let n=t;return{isScrolling:!0,scrollDirection:e.scrollOffset<n?"forward":"backward",scrollOffset:n,scrollUpdateWasRequested:!1}},this._resetIsScrollingDebounced)}),this._outerRefSetter=(e=>{const t=this.props.outerRef;this._outerRef=e,"function"===typeof t?t(e):null!=t&&"object"===typeof t&&t.hasOwnProperty("current")&&(t.current=e)}),this._resetIsScrollingDebounced=(()=>{null!==this._resetIsScrollingTimeoutId&&clearTimeout(this._resetIsScrollingTimeoutId),this._resetIsScrollingTimeoutId=setTimeout(this._resetIsScrolling,p)}),this._resetIsScrolling=(()=>{this._resetIsScrollingTimeoutId=null,this.setState({isScrolling:!1},()=>{this._getItemStyleCache(-1,null)})}),this.lastPositions=a.a.createRef(),this.lastPositions.current=new Map,this.needsAnimationRerender=a.a.createRef(),this.needsAnimationRerender.current=!1,this.animationEnabled=!1,this.state={instance:this,isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"===typeof this.props.initialScrollOffset?this.props.initialScrollOffset:0,scrollUpdateWasRequested:!1}}scrollTo(e){e=Math.max(0,e),this.setState(t=>t.scrollOffset===e?null:(this.requestScrollUpdateHandled=!1,{scrollDirection:t.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!0}),this._resetIsScrollingDebounced)}scrollToItem(e,t="auto"){const n=this.props.itemCount,r=this.state.scrollOffset;e=Math.max(0,Math.min(e,n-1)),this.scrollTo(this.getOffsetForIndexAndAlignment(e,t,r))}componentDidMount(){const e=this.props.initialScrollOffset;if("number"===typeof e&&null!=this._outerRef){let t=this._outerRef;(t=this._outerRef).scrollTop=e}this._callPropsCallbacks()}getAnchoredScrollPos(){if(this.anchored&&this.props.indexForKey&&null!=this._outerRef){let e=this.props.indexForKey(this.anchored.key);return this.getOffsetForIndexAndAlignment(e,"start")+this.anchored.offset}return null}componentDidUpdate(){const e=this.state,t=e.scrollOffset,n=e.scrollUpdateWasRequested;let r=this.getAnchoredScrollPos();if(null!=r){this._outerRef.scrollTop=r}else if(n&&!this.requestScrollUpdateHandled&&null!=this._outerRef){this.requestScrollUpdateHandled=!0,this._outerRef.scrollTop=t}this.needsAnimationRerender.current&&(this.needsAnimationRerender.current=!1,this.rerenderTimeout=setTimeout(()=>{this.forceUpdate()},10)),this._callPropsCallbacks()}componentWillUnmount(){null!==this._resetIsScrollingTimeoutId&&clearTimeout(this._resetIsScrollingTimeoutId)}render(){const e=this.props,t=e.className,n=e.height,r=e.header,o=e.innerRef,i=e.innerElementType,c=e.innerTagName,u=e.itemCount,f=e.renderRow,p=e.itemKey,g=void 0===p?m:p,h=e.outerElementType,b=e.outerTagName,O=e.style,w=e.useIsScrolling,v=e.width,E=this.state.isScrolling,j=d(this._getRangeToRender(),2),S=j[0],C=j[1],x=new Map,P=[];if(u>0)for(let a=S;a<=C;a++){let e=g(a),t=this._getItemStyle(a),n=this.lastPositions.current.get(e),r=!1;x.set(e,t.top),this.animationEnabled&&null!=n&&n!==t.top&&(t=s(s({},t),{},{top:n}),this.needsAnimationRerender.current=!0,r=!0),P.push(f({index:a,key:e,style:t,isScrolling:w?E:void 0,isAnimating:r}))}this.lastPositions.current=x;let k=this.getEstimatedTotalSize(),A=h||b||"div",D=i||c||"div";var I=s({height:n,width:v,overflow:"auto"},O),T={position:"relative",height:k,width:"100%",pointerEvents:E?"none":void 0};return a.a.createElement(y,{onResize:this.onHeaderResize},e=>a.a.createElement(A,{className:t,onScroll:this._onScrollVertical,ref:this._outerRefSetter,style:I},a.a.createElement(l.C,{innerRef:e},r),a.a.createElement(D,{ref:o,style:T},P)))}anchor(){let e=this.props.itemKey||m,t=this._outerRef,n=t?t.scrollTop:0,r=this.getStartIndexForOffset(n),a=e(r);this.anchored={key:a,offset:n-this.getItemOffset(r)}}unanchor(){this.anchored=null}isAnchored(){return null!=this.anchored}_callPropsCallbacks(){if("function"===typeof this.props.onItemsRendered){if(this.props.itemCount>0){const e=d(this._getRangeToRender(),4),t=e[0],n=e[1],r=e[2],a=e[3];this._callOnItemsRendered(t,n,r,a)}}if("function"===typeof this.props.onScroll){const e=this.state,t=e.scrollDirection,n=e.scrollOffset,r=e.scrollUpdateWasRequested;this._callOnScroll(t,n,r)}}_getRangeToRender(){let e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,a=r.isScrolling,o=r.scrollDirection,l=r.scrollOffset,i=this.getAnchoredScrollPos();if(null!=i&&(l=i),0===t)return[0,0,0,0];const c=this.getStartIndexForOffset(l),s=this.getStopIndexForStartIndex(c,l),u=a&&"backward"!==o?1:Math.max(1,n),d=a&&"forward"!==o?1:Math.max(1,n);return[Math.max(0,c-u),Math.max(0,Math.min(t-1,s+d)),c,s]}}g.defaultProps={direction:"ltr",renderRow:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1,headerHeight:0}},48:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(14);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var d=e=>{let t=e.color,n=void 0===t?"#fff":t,o=s(Object(r.useState)("gradient-"+Math.random()),1)[0];return a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 38 38",style:i({},e.style)}),a.a.createElement("defs",null,a.a.createElement("linearGradient",{x1:"8.042%",y1:"0%",x2:"65.682%",y2:"23.865%",id:o},a.a.createElement("stop",{stopColor:n,stopOpacity:0,offset:"0%"}),a.a.createElement("stop",{stopColor:n,stopOpacity:.631,offset:"63.146%"}),a.a.createElement("stop",{stopColor:n,offset:"100%"}))),a.a.createElement("g",{transform:"translate(1 2)",fill:"none",fillRule:"evenodd"},a.a.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18",stroke:"url(#"+o+")",strokeWidth:2,fill:"none"}),a.a.createElement("circle",{fill:n,cx:36,cy:18,r:1})))};var f={animationName:o.css.keyframes({"0%":{transform:"rotate(-90deg)"},"100%":{transform:"rotate(666deg)"}}),animationDuration:"1.6s",animationTimingFunction:"cubic-bezier(0.17, 0.67, 0.83, 0.67)",animationIterationCount:"infinite",lineHeight:0};t.a=function(e){return a.a.createElement("span",Object(o.css)(f),a.a.createElement(d,e))}},5:function(e,t,n){"use strict";(function(e){n.d(t,"t",function(){return m}),n.d(t,"s",function(){return y}),n.d(t,"e",function(){return g}),n.d(t,"d",function(){return h}),n.d(t,"c",function(){return b}),n.d(t,"u",function(){return O}),n.d(t,"b",function(){return w}),n.d(t,"y",function(){return v}),n.d(t,"a",function(){return E}),n.d(t,"x",function(){return j}),n.d(t,"r",function(){return S}),n.d(t,"v",function(){return x}),n.d(t,"f",function(){return k}),n.d(t,"k",function(){return A}),n.d(t,"o",function(){return D}),n.d(t,"j",function(){return I}),n.d(t,"q",function(){return T}),n.d(t,"p",function(){return M}),n.d(t,"w",function(){return R}),n.d(t,"g",function(){return B}),n.d(t,"h",function(){return _}),n.d(t,"i",function(){return L}),n.d(t,"l",function(){return z}),n.d(t,"m",function(){return F}),n.d(t,"n",function(){return N});var r=n(839),a=n(263),o=n(613),l=n(464),i=n(465),c=n(466),s=n(815),u=(n(816),n(817),n(58));function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e){if("string"===typeof e){let t=d(e.split("-"),3),n=t[0],r=t[1],a=t[2];return null!=a?new Date(parseInt(n),parseInt(r)-1,parseInt(a),12):null!=r?new Date(parseInt(n),parseInt(r)-1,1,12):new Date(parseInt(n),0,1,12)}return e}const m=p;function y(e){return r.a(p(e),"yyyy-MM")}function g(e){return r.a(p(e),"yyyy-MM-dd")}function h(){return e.IS_TESTING?"2017-01":r.a(new Date,"yyyy-MM")}function b(){return e.IS_TESTING?"2017-01-01":r.a(new Date,"yyyy-MM-dd")}function O(e){return r.a(o.a(p(e),1),"yyyy-MM")}function w(e,t){return r.a(a.a(p(e),t),"yyyy-MM")}function v(e,t){return r.a(o.a(p(e),t),"yyyy-MM")}function E(e,t){return r.a(l.a(p(e),t),"yyyy-MM-dd")}function j(e,t){return r.a(i.a(p(e),t),"yyyy-MM-dd")}function S(e,t){return s.a(p(e),p(t))}function C(e,t,n){const r=[];let a=y(e);for(;c.a(p(a),p(t));)r.push(a),a=w(a,1);return n&&r.push(a),r}function x(e,t){return C(e,t,!0)}function P(e,t,n){const r=[];let a=e;for(;c.a(p(a),p(t));)r.push(a),a=E(a,1);return n&&r.push(a),r}function k(e,t){return P(e,t,!0)}function A(e){return parseInt(e.slice(5,7))-1}function D(e){return e.slice(0,4)}function I(e){return e.slice(0,7)}function T(e){return D(e)+"-01"}function M(e){return D(e)+"-12"}function R(e){return"budget"+e.replace("-","")}function B(e,t){return r.a(p(e),t)}Object(u.a)(e=>new RegExp(e.replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{4}")));const _=Object(u.a)(e=>e.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"")),L=Object(u.a)(e=>{let t=e.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}");return new RegExp("^"+t+"$")}),z=Object(u.a)(e=>e.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/\.\./,".").replace(/--/,"-")),F=(Object(u.a)(e=>{let t=e.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2,4}");return new RegExp("^"+t+"$")}),Object(u.a)(e=>e.replace(/y+/g,"yy"))),N=Object(u.a)(e=>{let t=e.replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2}");return new RegExp("^"+t+"$")})}).call(this,n(15))},600:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(14),l=n(1),i=n(2),c=n(48),s=n(447),u={position:"absolute",top:0,bottom:0,left:0,right:0,background:`url(${n.n(s).a}) no-repeat center center fixed`,backgroundSize:"100% 100%"};var d=function({selected:e}){return a.a.createElement("div",Object(o.css)(u))},f={position:"absolute",top:0,left:0,right:0,padding:50,paddingTop:200,color:i.a.n1,alignItems:"center"},p={marginBottom:20,fontSize:18};t.a=function({initializing:e,loadingText:t}){return a.a.createElement(a.a.Fragment,null,a.a.createElement(d,null),(null!=t||e)&&a.a.createElement(l.C,Object(o.css)(f),a.a.createElement(l.c,{style:p},t),a.a.createElement(c.a,{width:25,color:i.a.n1})))}},605:function(e,t,n){"use strict";n.d(t,"a",function(){return v});var r=n(0),a=n.n(r),o=n(31),l=n(33),i=n(1),c=n(40),s=n(2),u=n(151);function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let y={border:0,fontSize:15,padding:"10px 13px"};var g=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"absolute",bottom:0,left:0,right:0,backgroundColor:s.a.n1,color:"white",padding:10,margin:10,borderRadius:6,zIndex:1e4,fontSize:15},s.c.shadowLarge),h={lineHeight:"1.5em"},b={gap:16,marginTop:20,justifyContent:"center"},O={alignItems:"center",flexDirection:"row",justifyContent:"flex-end"},w={userSelect:"none"};function v(){const e=Object(o.d)(e=>e.prefs.local&&e.prefs.local.hideMobileMessage||!0);let t=d(Object(r.useState)(Object(u.a)()&&!e&&!document.cookie.match(/hideMobileMessage=true/)),2),n=t[0],s=t[1],f=d(Object(r.useState)(!1),2),p=f[0],m=f[1],v=Object(o.c)();return n?a.a.createElement(i.C,{style:g},a.a.createElement(i.z,{style:h},a.a.createElement("strong",null,"Actual features are limited on small screens."),a.a.createElement("br",null),a.a.createElement("span",null,"While we work to improve this experience, you may find the full Actual feature set on devices with larger screens.")),a.a.createElement(i.C,{style:b},a.a.createElement(i.d,{style:y,onClick:function(){if(s(!1),p)v(Object(l.savePrefs)({hideMobileMessage:!0}));else{let e=new Date;e.setTime(e.getTime()+3e5),document.cookie="hideMobileMessage=true;path=/;expires="+e.toGMTString()}}},"Try it anyway"),a.a.createElement(i.C,{style:O},a.a.createElement(c.a,{id:"dont_remind_me",checked:p,onChange:()=>{m(!p)}}),a.a.createElement("label",{htmlFor:"dont_remind_me",style:w},"Don't remind me again")))):null}},606:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return l});var r=n(607),a=n(3),o=n(90);function l(t,n){e.Actual.onEventFromMain("update-downloaded",(e,n)=>{t.setAppState({updateInfo:n})}),e.Actual.onEventFromMain("update-error",e=>{}),Object(a.listen)("server-error",e=>{t.addGenericErrorNotification()}),Object(a.listen)("update-loading-status",e=>{switch(e){case"updating":t.updateStatusText("Updating...")}}),Object(a.listen)("orphaned-payees",({orphanedIds:e,updatedPayeeIds:n})=>{t.pushModal("merge-unused-payees",{payeeIds:e,targetPayeeId:n[0]})}),Object(a.listen)("schedules-offline",({payees:e})=>{let t=window.__history;t&&t.push("/schedule/posts-offline-notification",{locationPtr:t.location,payees:e})}),Object(a.listen)("sync-event",async({type:e,tables:r})=>{let a=n.getState().prefs.local;a&&a.id&&"applied"===e&&(r.includes("payees")||r.includes("payee_mapping"))&&t.getPayees()}),Object(a.listen)("sync-event",async({type:e})=>{"unauthorized"===e&&t.addNotification({type:"warning",message:"Unable to authenticate with server",sticky:!0,id:"auth-issue"})}),r.a(t,n),Object(a.listen)("undo-event",e=>{let r=e.tables,a=e.undoTag,l=[];(r.includes("categories")||r.includes("category_groups")||r.includes("category_mapping"))&&l.push(t.getCategories()),r.includes("accounts")&&l.push(t.getAccounts());let i=o.getTaggedState(a);i&&Promise.all(l).then(()=>{if(t.setLastUndoState(e),i.openModal){let e=n.getState().modals.modalStack;0!==e.length&&e[e.length-1].name===i.openModal||t.replaceModal(i.openModal)}else if(t.closeModal(),window.location.href!==i.url)return window.location.href=i.url,!0})}),Object(a.listen)("fallback-write-error",()=>{t.addNotification({type:"error",title:"Unable to save changes",sticky:!0,message:"This browser only supports using the app in one tab at a time, and another tab has opened the app. No changes will be saved from this tab; please close it and continue working in the other one."})}),Object(a.listen)("start-load",()=>{t.closeBudgetUI(),t.setAppState({loadingText:""})}),Object(a.listen)("finish-load",()=>{t.closeModal(),t.setAppState({loadingText:null}),t.loadPrefs()}),Object(a.listen)("start-import",()=>{t.closeBudgetUI(),t.setAppState({loadingText:"Importing..."})}),Object(a.listen)("finish-import",()=>{t.closeModal(),t.setAppState({loadingText:null}),t.loadPrefs()}),Object(a.listen)("show-budgets",()=>{t.closeBudgetUI(),t.setAppState({loadingText:null})})}}).call(this,n(15))},607:function(e,t,n){"use strict";n.d(t,"a",function(){return l});var r=n(3);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){let n=!1;Object(r.listen)("sync-event",l=>{let i=l.type,c=l.subtype,s=l.meta,u=l.tables,d=t.getState().prefs.local;if(d&&d.id)if("success"===i)n&&(n=!1,e.addNotification({title:"Syncing has been fixed!",message:"Happy budgeting!",type:"message"})),u.includes("prefs")&&e.loadPrefs(),(u.includes("categories")||u.includes("category_groups")||u.includes("category_mapping"))&&e.getCategories(),(u.includes("payees")||u.includes("payee_mapping"))&&e.getPayees(),u.includes("accounts")&&e.getAccounts();else if("error"===i){let l=null,i="[Learn more](https://actualbudget.github.io/docs/Getting-Started/sync#debugging-sync-issues)";const u="https://github.com/actualbudget/actual/issues/new?assignees=&labels=bug%2Cneeds+triage&template=bug-report.yml&title=%5BBug%5D%3A+";switch(c){case"out-of-sync":l=n?{title:"Your data is still out of sync",message:"We were unable to repair your sync state, sorry! You need to reset your sync state. "+i,sticky:!0,id:"reset-sync",button:{title:"Reset sync",action:e.resetSync}}:{title:"Your data is out of sync",message:"There was a problem syncing your data. We can try to repair your sync state to fix it. "+i,type:"warning",sticky:!0,id:"repair-sync",button:{title:"Repair",action:async()=>{n=!0,await Object(r.send)("sync-repair"),e.sync()}}};break;case"file-old-version":l={title:"Actual has updated the syncing format",message:"This happens rarely (if ever again). The internal syncing format has changed and you need to reset sync. This will upload data from this device and revert all other devices. [Learn more about what this means](https://actualbudget.github.io/docs/Getting-Started/sync#what-does-resetting-sync-mean).\n\nOld encryption keys are not migrated. If using encryption, [reset encryption here](#makeKey).",messageActions:{makeKey:()=>e.pushModal("create-encryption-key")},sticky:!0,id:"old-file",button:{title:"Reset sync",action:e.resetSync}};break;case"file-key-mismatch":l={title:"Your encryption key need to be reset",message:"Something went wrong when registering your encryption key id. You need to recreate your key. "+i,sticky:!0,id:"invalid-key-state",button:{title:"Reset key",action:()=>e.pushModal("create-encryption-key")}};break;case"file-not-found":l={title:"This file is not a cloud file",message:"You need to register it to take advantage of syncing which allows you to use it across devices and never worry about losing your data. "+i,type:"warning",sticky:!0,id:"register-file",button:{title:"Register",action:async()=>{await e.uploadBudget(),e.sync(),e.loadPrefs()}}};break;case"file-needs-upload":l={title:"File needs upload",message:"Something went wrong when creating this cloud file. You need to upload this file to fix it. "+i,sticky:!0,id:"upload-file",button:{title:"Upload",action:e.resetSync}};break;case"file-has-reset":case"file-has-new-key":let a=t.getState().prefs.local.cloudFileId;l={title:"Syncing has been reset on this cloud file",message:"You need to revert it to continue syncing. Any unsynced data will be lost. If you like, you can instead [upload this file](#upload) to be the latest version. "+i,messageActions:{upload:e.resetSync},sticky:!0,id:"needs-revert",button:{title:"Revert",action:()=>e.closeAndDownloadBudget(a)}};break;case"encrypt-failure":case"decrypt-failure":l=s.isMissingKey?{title:"Missing encryption key",message:"Unable to encrypt your data because you are missing the key. Create your key to sync your data.",sticky:!0,id:"encrypt-failure-missing",button:{title:"Create key",action:()=>e.pushModal("fix-encryption-key",{onSuccess:()=>e.sync()})}}:{message:"Unable to encrypt your data. You have the correct key so this is likely an internal failure. To fix this, reset your sync data with a new key.",sticky:!0,id:"encrypt-failure",button:{title:"Reset key",action:()=>e.pushModal("create-encryption-key",{onSuccess:()=>e.sync()})}};break;case"invalid-schema":l={title:"Update required",message:"We couldn't apply changes from the server. This probably means you need to update the app to support the latest database.",type:"warning"};break;case"apply-failure":l={message:`We couldn't apply that change to the database. Please report this as a bug by [opening a Github issue](${u}).`};break;case"beta-version":case"network":break;default:l={message:`We had problems syncing your changes. Please report this as a bug by [opening a Github issue](${u}).`}}l&&e.addNotification(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({type:"error"},l))}})}},609:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"BudgetSummary",function(){return bg}),n.d(r,"BudgetTotalsMonth",function(){return Pg}),n.d(r,"IncomeHeaderMonth",function(){return Ig}),n.d(r,"GroupMonth",function(){return _g}),n.d(r,"CategoryMonth",function(){return qg}),n.d(r,"ExpenseGroupMonth",function(){return Yg}),n.d(r,"ExpenseCategoryMonth",function(){return Vg}),n.d(r,"IncomeGroupMonth",function(){return Kg}),n.d(r,"IncomeCategoryMonth",function(){return Zg});var a={};n.r(a),n.d(a,"BudgetSummary",function(){return Hh}),n.d(a,"BudgetTotalsMonth",function(){return sb}),n.d(a,"IncomeHeaderMonth",function(){return fb}),n.d(a,"ExpenseGroupMonth",function(){return hb}),n.d(a,"ExpenseCategoryMonth",function(){return Cb}),n.d(a,"IncomeGroupMonth",function(){return kb}),n.d(a,"IncomeCategoryMonth",function(){return Mb});var o=n(0),l=n.n(o),i=n(836),c=n(611),s=n(31),u=n(8),d=n(59),f=n(234),p=n(47),m=n(122),y=n(33),g=n(34),h=n(69);function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let w=l.a.createContext(null);function v({children:e}){let t=function(){let e=b(Object(o.useState)(null),2),t=e[0],n=e[1];return Object(o.useEffect)(()=>{let e=Object(g.d)(Object(g.c)("accounts").select("*"),async t=>{e&&n(t)});return()=>{e.unsubscribe(),e=null}},[]),t}();return l.a.createElement(w.Provider,{value:t,children:e})}function E({children:e,idKey:t}){return e(j({idKey:t}))}function j({idKey:e}={}){let t=Object(o.useContext)(w);return e&&t?Object(h.b)(t):t}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let x=l.a.createContext(null);function P({children:e}){let t=function(){let e=S(Object(o.useState)([]),2),t=e[0],n=e[1];return Object(o.useEffect)(()=>{let e=Object(g.d)(Object(g.c)("payees").select("*"),async t=>{e&&n(t)});return()=>{e.unsubscribe(),e=null}},[]),t}();return l.a.createElement(x.Provider,{value:t,children:e})}function k({children:e,idKey:t}){return e(A({idKey:t}))}function A({idKey:e}={}){let t=Object(o.useContext)(x);return e&&t?Object(h.e)(t):t}var D=n(449),I=n.n(D),T=n(77),M=n(3);function R({children:e}){let t=Object(o.useMemo)(()=>(function(){const e={},t=new I.a({max:1200}),n={};let r=!1;return new class{observeCell(t,r){return e[t]||(e[t]=[]),e[t].push(r),()=>{e[t]=e[t].filter(e=>e!==r),0===e[t].length&&(n[t]=null)}}disableObservers(){r=!0}enableObservers(){r=!1}prewarmCache(e,n){t.set(e,n)}listen(){return Object(M.listen)("cells-changed",function(a){r||a.forEach(r=>{const a=e[r.name];a&&(a.forEach(e=>e(r)),n[r.name]=Promise.resolve(r),t.set(r.name,r))})})}bind(e="__global",r,a,o){let l=`${e}!${(r="string"===typeof r?{name:r,value:null}:r).name}`,i=this.observeCell(l,o);if(t.has(l)&&o(t.get(l)),null!=n[l])n[l].then(o);else{const i=this.get(e,r.name,a);n[l]=i,i.then(e=>{n[l]===i&&(t.set(l,e),o(e))})}return i}get(e,t){return Object(M.send)("getCell",{sheetName:e,name:t})}getCellNames(e){return Object(M.send)("getCellNamesInSheet",{sheetName:e})}createQuery(e,t,n){return Object(M.send)("create-query",{sheetName:e,name:t,query:n.serialize()})}}})(),[]);return Object(o.useEffect)(()=>t.listen(),[t]),l.a.createElement(T.a.Provider,{value:t},e)}var B=n(450),_=n(90);function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return z(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let F=l.a.createContext();function N({children:e}){let t=L(Object(o.useState)(1),2),n=t[0],r=t[1];return l.a.createElement(F.Provider,{value:{displayMax:n,setDisplayMax:r}},e)}function U(){return Object(o.useContext)(F)}var $=n(1),W=n(2);function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach(function(t){q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Y=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:H({color:"#242134"},e.style)}),o.createElement("path",{d:"M3.94 6.5 2.22 3.64l1.42-1.42L6.5 3.94c.52-.3 1.1-.54 1.7-.7L9 0h2l.8 3.24c.6.16 1.18.4 1.7.7l2.86-1.72 1.42 1.42-1.72 2.86c.3.52.54 1.1.7 1.7L20 9v2l-3.24.8c-.16.6-.4 1.18-.7 1.7l1.72 2.86-1.42 1.42-2.86-1.72c-.52.3-1.1.54-1.7.7L11 20H9l-.8-3.24c-.6-.16-1.18-.4-1.7-.7l-2.86 1.72-1.42-1.42 1.72-2.86c-.3-.52-.54-1.1-.7-1.7L0 11V9l3.24-.8c.16-.6.4-1.18.7-1.7zM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",fill:"currentColor"}));function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Q=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",style:K({color:"#242134"},e.style)}),o.createElement("g",{clipPath:"url(#a)"},o.createElement("path",{d:"M1.857 7.612H.98a.98.98 0 0 0-.98.98v2.224c0 .449.184.857.51 1.163.612.551 1.816 1.49 3.735 2.368a.571.571 0 0 1 .306.346l.939 3.286a.484.484 0 0 0 .469.347h1.47a.479.479 0 0 0 .469-.367l.47-1.817a.262.262 0 0 1 .326-.183c.571.122 1.183.163 1.795.163.613 0 1.225-.061 1.796-.163.143-.02.286.06.327.183l.47 1.817a.502.502 0 0 0 .468.367h1.47a.484.484 0 0 0 .47-.347l1.224-4.245a.487.487 0 0 1 .122-.224c.919-.98 1.53-2.163 1.735-3.47h.49c.53 0 .959-.448.938-.979-.02-.51-.47-.918-.98-.918h-.448C18.06 4.673 14.632 2 10.489 2c-1.775 0-3.428.49-4.755 1.326-.591-.408-1.469-.734-2.693-.632-.49.04-.715.612-.388.959.408.429.796 1 .877 1.735L1.857 7.612Zm3.122.98a.862.862 0 0 1-.857-.858c0-.469.388-.857.857-.857.47 0 .858.388.858.857 0 .47-.388.858-.858.858Z",fill:"currentColor"})),o.createElement("defs",null,o.createElement("clipPath",{id:"a"},o.createElement("path",{fill:"currentColor",d:"M0 0h20v20H0z"}))));function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach(function(t){ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var te=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:X({color:"#242134"},e.style)}),o.createElement("path",{d:"M0 4c0-1.1.9-2 2-2h15a1 1 0 0 1 1 1v1H2v1h17a1 1 0 0 1 1 1v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm16.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",fill:"currentColor"})),ne=n(151);function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach(function(t){oe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let le=Date.now();function ie(e,t){return e.state&&e.state._version===le?t?e.state[t]:e.state:null}var ce=n(116),se=n.n(ce),ue=n(43),de=n(5),fe=n(99);function pe(e,t,n){let r=de.c();return t?"completed":n?"paid":e===r?"due":e>r&&e<=de.a(r,7)?"upcoming":e<r?"missed":"scheduled"}function me(e){return de.g(new Date(2020,0,e,12),"do")}function ye(e){return{SU:"Sunday",MO:"Monday",TU:"Tuesday",WE:"Wednesday",TH:"Thursday",FR:"Friday",SA:"Saturday"}[e]}function ge(e){let t=e.interval||1;switch(e.frequency){case"weekly":{let n="Every ";return n+=1!==t?`${t} weeks`:"week",n+=" on "+de.g(e.start,"EEEE")}case"monthly":{let n="Every ";if(n+=1!==t?`${t} months`:"month",e.patterns&&e.patterns.length>0){let t=[...e.patterns].sort((e,t)=>{let n=("day"===e.type?1:0)-("day"===t.type?1:0),r=e.value-t.value;return 0===n?r:n}).filter(e=>-1!==e.value);t=t.concat(e.patterns.filter(e=>-1===e.value)),n+=" on the ";let r=[],a=new Set(t.map(e=>e.type)),o=1===a.length&&!a.has("day");for(let e of t)if("day"===e.type)-1===e.value?r.push("last day"):r.push(me(e.value));else{let t=o?"":" "+ye(e.type);-1===e.value?r.push("last"+t):r.push(me(e.value)+t)}r.length>2?(n+=r.slice(0,r.length-1).join(", "),n+=", and ",n+=r[r.length-1]):n+=r.join(" and "),o&&(n+=" "+ye(t[0].type))}else n+=" on the "+de.g(e.start,"do");return n}case"yearly":{let n="Every ";return n+=1!==t?`${t} years`:"year",n+=" on "+de.g(e.start,"LLL do")}default:return"Recurring error"}}function he(e){return{payee:e.find(e=>"is"===e.op&&"payee"===e.field)||e.find(e=>"is"===e.op&&"description"===e.field)||null,account:e.find(e=>"is"===e.op&&"account"===e.field)||e.find(e=>"is"===e.op&&"acct"===e.field)||null,amount:e.find(e=>("is"===e.op||"isapprox"===e.op||"isbetween"===e.op)&&"amount"===e.field)||null,date:e.find(e=>("is"===e.op||"isapprox"===e.op)&&"date"===e.field)||null}}function be(e){return e&&"number"!==typeof e?Math.round((e.num1+e.num2)/2):e}function Oe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return we(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return we(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ve(e,t){return Object(g.d)(function(e){let t=e.map(e=>{let t=e._conditions.find(e=>"date"===e.field);return{$and:{schedule:e.id,date:{$gte:t&&"is"===t.op?e.next_date:de.x(e.next_date,2)}}}});return Object(fe.a)("transactions").filter({$or:t}).orderBy({date:"desc"}).groupBy("schedule").select(["schedule","date"])}(e),t,{mapper:t=>{let n=new Set(t.filter(Boolean).map(e=>e.schedule));return new Map(e.map(e=>[e.id,pe(e.next_date,e.completed,n.has(e.id))]))}})}function Ee({transform:e}={}){let t=Oe(Object(o.useState)(null),2),n=t[0],r=t[1];return Object(o.useEffect)(()=>{let t,n,a=Object(g.c)("schedules").select("*");return t=Object(g.d)(e?e(a):a,async e=>{t&&(n&&n.unsubscribe(),n=ve(e,t=>r({schedules:e,statuses:t})))}),()=>{t&&t.unsubscribe(),n&&n.unsubscribe()}},[e]),n}let je=l.a.createContext(null);function Se({transform:e,children:t}){let n=Ee({transform:e});return l.a.createElement(je.Provider,{value:n,children:t})}function Ce(){return Object(o.useContext)(je)}var xe=n(838),Pe=n(463),ke=n(10);function Ae(e,t="account"){return e?"budgeted"===e?{[`${t}.offbudget`]:!1,[`${t}.closed`]:!1}:"offbudget"===e?{[`${t}.offbudget`]:!0,[`${t}.closed`]:!1}:"uncategorized"===e?{[`${t}.offbudget`]:!1,category:null,is_parent:!1,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]}:{[t]:e}:null}function De(e){let t=Object(fe.a)("transactions").options({splits:"grouped"}),n=Ae(e);return n&&(t=t.filter(n)),t}function Ie(e,t,n){let r,a=Object(ke.d)(t);return r=Object(de.i)(n).test(t)?Object(xe.a)(t,Object(de.h)(n),new Date):Object(de.n)(n).test(t)?Object(xe.a)(t,Object(de.m)(n),new Date):Object(xe.a)(t,n,new Date),e.filter({$or:{"payee.name":{$like:`%${t}%`},notes:{$like:`%${t}%`},"category.name":{$like:`%${t}%`},"account.name":{$like:`%${t}%`},$or:[Object(Pe.a)(r)&&{date:Object(de.e)(r)},null!=a&&{amount:{$transform:"$abs",$eq:Object(ke.b)(a)}},null!=a&&Number.isInteger(a)&&{amount:{$transform:{$abs:{$idiv:["$",100]}},$eq:a}}].filter(Boolean)}})}function Te(e){return{name:`balance-${e.id}`,query:Object(fe.a)("transactions").filter({account:e.id}).options({splits:"none"}).calculate({$sum:"$amount"})}}function Me(){return{query:Object(fe.a)("transactions").filter({"account.closed":!1}).calculate({$sum:"$amount"}),name:"accounts-balance"}}function Re(){return{name:"budgeted-accounts-balance",query:Object(fe.a)("transactions").filter({"account.offbudget":!1,"account.closed":!1}).calculate({$sum:"$amount"})}}function Be(){return{name:"offbudget-accounts-balance",query:Object(fe.a)("transactions").filter({"account.offbudget":!0,"account.closed":!1}).calculate({$sum:"$amount"})}}let _e=Object(fe.a)("transactions").filter({"account.offbudget":!1,category:null,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]});const Le={incomeAvailable:"available-funds",lastMonthOverspent:"last-month-overspent",forNextMonth:"buffered",totalBudgeted:"total-budgeted",toBudget:"to-budget",fromLastMonth:"from-last-month",totalIncome:"total-income",totalSpent:"total-spent",totalBalance:"total-leftover",groupSumAmount:e=>`group-sum-amount-${e}`,groupIncomeReceived:"total-income",groupBudgeted:e=>`group-budget-${e}`,groupBalance:e=>`group-leftover-${e}`,catBudgeted:e=>`budget-${e}`,catSumAmount:e=>`sum-amount-${e}`,catBalance:e=>`leftover-${e}`,catCarryover:e=>`carryover-${e}`},ze={totalBudgetedExpense:"total-budgeted",totalBudgetedIncome:"total-budget-income",totalBudgetedSaved:"total-saved",totalIncome:"total-income",totalSpent:"total-spent",totalSaved:"real-saved",totalLeftover:"total-leftover",groupSumAmount:e=>`group-sum-amount-${e}`,groupIncomeReceived:"total-income",groupBudgeted:e=>`group-budget-${e}`,groupBalance:e=>`group-leftover-${e}`,catBudgeted:e=>`budget-${e}`,catSumAmount:e=>`sum-amount-${e}`,catBalance:e=>`leftover-${e}`,catCarryover:e=>`carryover-${e}`},Fe=["subtransactions"];function Ne(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach(function(t){We(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function We(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ge=n(200);function He(e){return"number"===typeof e?e:0}function qe(e,t){return{type:"SplitTransactionError",version:1,difference:He(t.amount)-e}}function Ye(e,t){let n="temp"===e.id?"temp":"";return $e($e({amount:0},t),{},{payee:t.payee||e.payee,id:t.id?t.id:n+Ge.v4Sync(),account:e.account,date:e.date,cleared:null!=e.cleared?e.cleared:null,starting_balance_flag:null!=e.starting_balance_flag?e.starting_balance_flag:null,is_child:!0,parent_id:e.id,error:null})}function Ve(e){const t=e.subtransactions.reduce((e,t)=>e+He(t.amount),0);return $e($e({},e),{},{error:t===He(e.amount)?null:qe(t,e)})}function Ke(e,t){let n=[e[t]],r=t+1;for(;r<e.length&&e[r].is_child;)n.push(e[r]),r++;return n}function Ze(e){return e.reduce((e,t)=>{let n=t.subtransactions,r=Ne(t,Fe);n=n||[],e.push(r);for(let a=0;a<n.length;a++)e.push(n[a]);return e},[])}function Qe(e){return $e($e({},e[0]),{},{subtransactions:e.slice(1)})}function Je(e){return null==e?null:Ze([e])}function Xe(e,t,n){let r=e.findIndex(e=>e.id===t),a=e[r],o=[...e];if(-1===r)throw new Error("Tried to edit unknown transaction id: "+t);if(a.is_parent||a.is_child){let t=function(e,t){for(;t>=0;){if(e[t].is_parent)return t;t--}return null}(e,r);if(null==t)return console.log("Cannot find parent index"),{diff:{deleted:[],updated:[]}};let a,l=Ke(e,t),i=n(Qe(l)),c=Je(i);return null==c?(a={deleted:[{id:l[0].id}],updated:[]},i={id:l[0].id,_deleted:!0},o.splice(t,l.length)):(a=Object(ke.f)(l,c),o.splice(t,l.length,...c)),{data:o,newTransaction:i,diff:a}}{let e=n(a),t=Je(e)||[];return e&&(e.subtransactions=e.subtransactions||[]),o.splice(r,1,...t),{data:o,newTransaction:e||{id:a.id,_deleted:!0},diff:Object(ke.f)([a],t)}}}function et(e,t){return Xe(e,t,e=>{if(!e.is_parent)return e;let t=Object(ke.l)(e.subtransactions);return e.subtransactions.push(Ye(e,{amount:0,sort_order:He(t&&t.sort_order)-1})),e})}function tt(e,t){return Xe(e,t.id,e=>{if(e.is_parent){let n=e.id===t.id?t:e,r=e.subtransactions.map(r=>{let a=r;return e.id===t.id?a=$e($e({},r),{},{payee:r.payee===e.payee?t.payee:r.payee}):r.id===t.id&&(a=t),Ye(n,a)});return Ve($e($e({},n),{},{subtransactions:r}))}return t})}function nt(e,t){return Xe(e,t,e=>{if(e.is_parent){if(e.id===t)return null;if(1===e.subtransactions.length)return $e($e({},e),{},{subtransactions:null,is_parent:!1,error:null});{let n=e.subtransactions.filter(e=>e.id!==t);return Ve($e($e({},e),{},{subtransactions:n}))}}return null})}function rt(e,t){return Xe(e,t,e=>e.is_parent||e.is_child?e:$e($e({},e),{},{is_parent:!0,error:0===He(e.amount)?null:qe(0,e),subtransactions:[Ye(e,{amount:0,sort_order:-1})]}))}function at(e){let t=e.find(e=>!e.is_child);t=$e($e({},t),{},{id:Ge.v4Sync()});let n=e.filter(e=>e.is_child);return[t,...n.map(e=>$e($e({},e),{},{id:Ge.v4Sync(),parent_id:t.id}))]}var ot=n(204),lt=n(14);function it(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ct(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function st(e,t,n){let r=new n(e,null,t),a=l.a.createContext(null);return{Provider:function({children:e}){let t=it(Object(o.useState)(r.getData()),2),n=t[0],i=t[1],c=Object(o.useMemo)(()=>({data:n,query:r}),[n,r]);return Object(o.useEffect)(()=>{if(0!==r.getNumListeners())throw new Error("Query already has listeners. You cannot use the same query context `Provider` twice");let e=r.addListener(e=>i(e));return r.isRunning()||r.run(),i(r.getData()),()=>{e(),r.unsubscribe()}},[]),l.a.createElement(a.Provider,{value:c,children:e})},useQuery:function(){let e=Object(o.useContext)(a);if(null==e)throw new Error("`useQuery` tried to access a query that hasn't been run. You need to put its `Provider` in a parent component");return e}}}function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach(function(t){ft(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ft(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pt=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 19 24",xmlns:"http://www.w3.org/2000/svg",style:dt({color:"#242134"},e.style)}),o.createElement("path",{d:"M17 24H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h9a1 1 0 0 1 .707.293l7 7A1 1 0 0 1 19 8v14a2 2 0 0 1-2 2ZM2 21.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5V9a.5.5 0 0 0-.5-.5h-4a2 2 0 0 1-2-2v-4A.5.5 0 0 0 10 2H2.5a.5.5 0 0 0-.5.5v19Z",fill:"currentColor"}));function mt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var gt={border:"1px solid "+W.a.border,padding:7,minWidth:300,minHeight:120,outline:"none"},ht={display:"block",maxWidth:225,padding:8,whiteSpace:"pre-wrap",overflowWrap:"break-word"};function bt({editable:e,defaultNotes:t,position:n="bottom-left",onClose:r}){let a=mt(Object(o.useState)(t),2),i=a[0],c=a[1],s=l.a.createRef();return Object(o.useEffect)(()=>{e&&s.current.focus()},[s,e]),l.a.createElement($.B,{position:n,onClose:()=>r(i)},e?l.a.createElement("textarea",Object.assign({ref:s},Object(lt.css)(gt),{value:i||"",onChange:e=>c(e.target.value)})):l.a.createElement($.z,Object(lt.css)(ht),i))}var Ot={flexShrink:0},wt={"& button, & .hover-visible":{display:"flex",opacity:1,color:W.a.n1}},vt={"& button, & .hover-visible":{display:"flex",opacity:1}};function Et({id:e,width:t=12,height:n=12,defaultColor:r=W.a.n8,tooltipPosition:a,style:i}){let c=mt(Object(o.useState)(!1),2),s=c[0],u=c[1],d=Object($.E)(),f=function(e,t){let n=it(Object(o.useState)(null),2),r=n[0],a=n[1];return Object(o.useEffect)(()=>{let n=Object(g.d)(e,async e=>{n&&a(e)},t);return()=>{n.unsubscribe(),n=null}},[e]),{data:r}}(Object(o.useMemo)(()=>Object(g.c)("notes").filter({id:e}).select("*"),[e])).data,p=f&&f.length>0?f[0].note:null,m=p&&""!==p;const y=d.isOpen||m&&s;return l.a.createElement($.C,{style:[Ot,y&&wt,m&&vt],onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1)},l.a.createElement($.d,Object.assign({bare:!0,className:"hover-visible",style:[{color:r},i]},d.getOpenEvents()),l.a.createElement(pt,{style:{width:t,height:n,color:"currentColor"}})),y&&l.a.createElement(bt,{editable:d.isOpen,defaultNotes:p,position:a,onClose:function(t){Object(M.send)("notes-save",{id:e,note:t}),d.close()}}))}var jt=n(79),St=n(42),Ct=n(93);var xt=function({binding:e,type:t,formatter:n,style:r,getStyle:a,debug:o}){return l.a.createElement(Ct.a,{binding:e,debug:o},({name:e,value:o})=>l.a.createElement(jt.a,{style:["financial"===t&&W.c.tnum,r,a&&a(o)],numberOfLines:1,"data-testid":e,"data-cellname":e},n?n(o):Object(St.a)(o,t)))},Pt=n(61),kt=n(9),At=n(26),Dt=n(48);function It(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?It(Object(n),!0).forEach(function(t){Mt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):It(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Rt=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",style:Tt({color:"#242134"},e.style)}),o.createElement("path",{fill:"currentColor",className:"path",d:"M23 11.5a1.5 1.5 0 0 1-1.5 1.5h-20a1.5 1.5 0 0 1 0-3h20a1.5 1.5 0 0 1 1.5 1.5Z"}),o.createElement("path",{fill:"currentColor",className:"path",d:"M11.5 23a1.5 1.5 0 0 1-1.5-1.5v-20a1.5 1.5 0 0 1 3 0v20a1.5 1.5 0 0 1-1.5 1.5Z"})),Bt=n(117);function _t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_t(Object(n),!0).forEach(function(t){zt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ft=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Lt({color:"#242134"},e.style)}),o.createElement("path",{d:"M13.584 12a2.643 2.643 0 0 1-.775 1.875l-9.541 9.541a1.768 1.768 0 0 1-2.5-2.5l8.739-8.739a.25.25 0 0 0 0-.354L.768 3.084a1.768 1.768 0 0 1 2.5-2.5l9.541 9.541A2.643 2.643 0 0 1 13.584 12Z",fill:"currentColor"}),o.createElement("path",{d:"M23.75 12a2.643 2.643 0 0 1-.775 1.875l-9.541 9.541a1.768 1.768 0 0 1-2.5-2.5l8.739-8.739a.25.25 0 0 0 0-.354l-8.739-8.739a1.768 1.768 0 0 1 2.5-2.5l9.541 9.541A2.643 2.643 0 0 1 23.75 12Z",fill:"currentColor"}));function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nt(Object(n),!0).forEach(function(t){$t(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wt=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Ut({color:"#242134"},e.style)}),o.createElement("path",{d:"M19.611 2.571h-3.754a1.286 1.286 0 1 1 0-2.571h6.857A1.286 1.286 0 0 1 24 1.286v6.857a1.286 1.286 0 0 1-2.571 0V4.39L15.48 10.34a1.286 1.286 0 0 1-1.817-1.817l5.948-5.95ZM1.286 14.571a1.286 1.286 0 0 1 1.285 1.286v3.754l5.949-5.946a1.286 1.286 0 0 1 1.817 1.817L4.39 21.429h3.753a1.285 1.285 0 1 1 0 2.571H1.286A1.286 1.286 0 0 1 0 22.714v-6.857a1.286 1.286 0 0 1 1.286-1.286Z",fill:"currentColor"}));function Gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ht(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gt(Object(n),!0).forEach(function(t){qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yt=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Ht({color:"#242134"},e.style)}),o.createElement("path",{d:"M14.143 1.714A1.286 1.286 0 0 1 15.429 3v3.753L21.806.377a1.286 1.286 0 0 1 1.817 1.817l-6.376 6.377H21a1.286 1.286 0 1 1 0 2.572h-6.857a1.286 1.286 0 0 1-1.286-1.286V3a1.286 1.286 0 0 1 1.286-1.286ZM9.857 22.286A1.285 1.285 0 0 1 8.571 21v-3.753l-6.377 6.376a1.286 1.286 0 0 1-1.817-1.817l6.376-6.377H3a1.286 1.286 0 0 1 0-2.572h6.857a1.286 1.286 0 0 1 1.286 1.286V21a1.286 1.286 0 0 1-1.286 1.286Z",fill:"currentColor"}));function Vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach(function(t){Zt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qt=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Kt({color:"#242134"},e.style)}),o.createElement("path",{d:"M12 0a12 12 0 1 0 12 12A12.014 12.014 0 0 0 12 0Zm6.927 8.2-6.845 9.289a1.011 1.011 0 0 1-1.43.188l-4.888-3.908a1 1 0 1 1 1.25-1.562l4.076 3.261 6.227-8.451a1 1 0 1 1 1.61 1.183Z",fill:"currentColor"}));function Jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(n),!0).forEach(function(t){en(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function en(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var tn=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Xt({color:"#242134"},e.style)}),o.createElement("path",{d:"M8.616 1.741A1.455 1.455 0 0 1 10.07.287h3.392a1.455 1.455 0 0 1 1.453 1.454v8.228a.25.25 0 0 0 .25.25h2.9a1.138 1.138 0 0 1 .827 2l-6.1 6.1a1.489 1.489 0 0 1-2.056 0l-6.1-6.1a1.137 1.137 0 0 1 .827-2h2.9a.249.249 0 0 0 .25-.25Z",fill:"currentColor"}),o.createElement("path",{d:"M0 19.677a4.039 4.039 0 0 0 4.035 4.035h15.93A4.039 4.039 0 0 0 24 19.677V17.8a1.225 1.225 0 0 0-2.449 0v1.874a1.588 1.588 0 0 1-1.586 1.586H4.035a1.588 1.588 0 0 1-1.586-1.586V17.8A1.225 1.225 0 0 0 0 17.8Z",fill:"currentColor"}));function nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nn(Object(n),!0).forEach(function(t){an(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function an(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var on=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:rn({color:"#242134"},e.style)}),o.createElement("path",{d:"M15.067 3.986a.5.5 0 0 0-.354-.148.5.5 0 0 0-.354.147L3.437 14.91a.5.5 0 0 0 0 .707l4.948 4.948a.5.5 0 0 0 .707 0L20.009 9.648a.5.5 0 0 0 0-.706ZM2.43 16.8a.5.5 0 0 0-.489-.127.5.5 0 0 0-.351.364L.084 23.314a.5.5 0 0 0 .133.47.507.507 0 0 0 .47.132l6.272-1.5a.5.5 0 0 0 .237-.84ZM23.2 2.924 21.077.8a2.5 2.5 0 0 0-3.532 0l-1.418 1.417a.5.5 0 0 0 0 .707l4.95 4.949a.5.5 0 0 0 .707 0L23.2 6.454a2.5 2.5 0 0 0 0-3.53Z",fill:"currentColor"}));function ln(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function cn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ln(Object(n),!0).forEach(function(t){sn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ln(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var un=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:cn({color:"#242134"},e.style)}),o.createElement("path",{d:"m23.384 21.619-6.529-6.529a9.284 9.284 0 1 0-1.768 1.768l6.529 6.529a1.266 1.266 0 0 0 1.768 0 1.251 1.251 0 0 0 0-1.768ZM2.75 9.5a6.75 6.75 0 1 1 6.75 6.75A6.758 6.758 0 0 1 2.75 9.5Z",fill:"currentColor"}));function dn(e,t,{onSuccess:n,onClose:r}){e("plaid-external-msg",{onMoveExternal:async()=>{let e=await Object(M.send)("create-web-token"),n="http://link.actualbudget.com/?token="+e;t&&(n=n+"&plaidToken="+t),window.Actual.openURLInBrowser(n);let r=await Object(M.send)("poll-web-token",{token:e});return{error:r.error,data:r.data}},onClose:r,onSuccess:n})}async function fn(e,{upgradingId:t}={}){dn(e,null,{onSuccess:async n=>{e("select-linked-accounts",{institution:n.metadata.institution,publicToken:n.publicToken,accounts:n.metadata.accounts,upgradingId:t})}})}let pn=l.a.createContext(null);function mn({location:e,children:t}){return l.a.createElement(pn.Provider,{value:e,children:t})}function yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yn(Object(n),!0).forEach(function(t){hn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var bn=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:gn({color:"#242134"},e.style)}),o.createElement("path",{d:"M10 3v2a5 5 0 0 0-3.54 8.54l-1.41 1.41A7 7 0 0 1 10 3zm4.95 2.05A7 7 0 0 1 10 17v-2a5 5 0 0 0 3.54-8.54l1.41-1.41zM10 20l-4-4 4-4v8zm0-12V0l4 4-4 4z",fill:"currentColor"}));function On(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?On(Object(n),!0).forEach(function(t){vn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):On(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let En=lt.css.keyframes({"0%":{transform:"rotateZ(0deg)"},"100%":{transform:"rotateZ(360deg)"}});function jn({animating:e,iconStyle:t}){return l.a.createElement($.C,{style:[{animation:e?`${En} 1s infinite linear`:null}]},l.a.createElement(bn,{width:14,height:14,style:wn({color:"currentColor"},t)}))}var Sn=n(839),Cn=n(207),xn=n.n(Cn);const Pn=["error","inputKey"];function kn(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach(function(t){In(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function In(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tn={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:!1},id:{ops:["is","contains","oneOf"],nullable:!0},string:{ops:["is","contains","oneOf"],nullable:!1},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:!1},boolean:{ops:["is"],nullable:!1}},Mn=new Map(Object.entries({imported_payee:"string",payee:"id",date:"date",notes:"string",amount:"number",amountInflow:"number",amountOutfow:"number",category:"id",account:"id",cleared:"boolean"}));function Rn(e,t){switch(t=t||{},e){case"imported_payee":return"imported payee";case"amount":return t.inflow?"amount (inflow)":t.outflow?"amount (outflow)":"amount";case"amount-inflow":return"amount (inflow)";case"amount-outflow":return"amount (outflow)";case"cleared":return"cleared";default:return e}}function Bn(e,t){switch(e){case"oneOf":return"one of";case"is":return"is";case"isapprox":return"is approx";case"isbetween":return"is between";case"contains":return"contains";case"gt":return"date"===t?"is after":"is greater than";case"gte":return"date"===t?"is after or equals":"is greater than or equals";case"lt":return"date"===t?"is before":"is less than";case"lte":return"date"===t?"is before or equals":"is less than or equals";case"true":return"is true";case"false":return"is false";case"set":return"set";case"link-schedule":return"link schedule";default:return""}}function _n(e){switch(e){case"date-format":return"Invalid date format";case"no-null":case"no-empty-array":case"no-empty-string":return"Value cannot be empty";case"not-number":return"Value must be a number";case"invalid-field":return"Please choose a valid field for this type of rule";default:return"Internal error, sorry! Please get in touch https://actualbudget.github.io/docs/Contact/ for support"}}function Ln(e){switch(e.type){case"number":{let t=e.value;return"amount"===e.field&&"isbetween"!==e.op&&(t=Object(ke.j)(t)),Dn(Dn({},e),{},{value:t})}case"string":{let t=null==e.value?"":e.value;return Dn(Dn({},e),{},{value:t})}case"boolean":{let t=e.value;return Dn(Dn({},e),{},{value:t})}}return Dn(Dn({},e),{},{error:null})}function zn(e){e.error,e.inputKey;let t=kn(e,Pn);switch(t.type){case"number":{let e=t.value;return"amount"===t.field&&"isbetween"!==t.op&&(e=Object(ke.b)(e)),Dn(Dn({},t),{},{value:e})}case"string":{let e=null==t.value?"":t.value;return Dn(Dn({},t),{},{value:e})}case"boolean":{let e=null!=t.value&&t.value;return Dn(Dn({},t),{},{value:e})}}return t}function Fn(e,t){switch(t.type){case"number":if("isbetween"!==t.op)return Dn(Dn({},t),{},{error:null,value:e&&Object(ke.d)(e)||0})}return Dn(Dn({},t),{},{error:null,value:e})}var Nn=n(115);function Un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Un(Object(n),!0).forEach(function(t){Wn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Un(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Gn=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",style:$n({color:"#242134"},e.style)}),o.createElement("path",{d:"M4.5 17.5h6.646a3.5 3.5 0 0 0 6.708 0H19.5a1 1 0 0 0 0-2h-1.646a3.5 3.5 0 0 0-6.708 0H4.5a1 1 0 0 0 0 2Zm10-2.5a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM19.5 6.5h-6.646a3.5 3.5 0 0 0-6.708 0H4.5a1 1 0 0 0 0 2h1.646a3.5 3.5 0 0 0 6.708 0H19.5a1 1 0 1 0 0-2ZM9.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Z",fill:"currentColor"})),Hn=n(834),qn=n(62),Yn=n(78);function Vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vn(Object(n),!0).forEach(function(t){Zn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qn=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 91 51",style:Kn({color:"#242134"},e.style)}),o.createElement("path",{fill:"currentColor",d:"M63.004.003a3 3 0 0 0-1.875 5.219L79.44 22.034H3.16a3.257 3.257 0 0 0-.313 0c-1.57.082-2.925 1.585-2.843 3.156.081 1.571 1.585 2.926 3.156 2.844H79.44L61.129 44.815a3 3 0 1 0 4.062 4.407l24-22a3 3 0 0 0 0-4.407l-24-22a3 3 0 0 0-2.187-.812Z"}));const Jn=["data","navigator","loadMore","style","onHoverLeave","children"];function Xn(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function er(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return tr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tr(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let nr=st(Object(g.c)("schedules").select("*"),rr,g.a);var rr,ar={color:W.a.p4},or={color:W.a.p4},lr={color:W.a.n3},ir={color:W.a.p4},cr={color:W.a.p4},sr={color:W.a.p4,textDecoration:"none",":hover":{textDecoration:"underline"}},ur={color:W.a.p4},dr={color:W.a.p4},fr={color:W.a.p4};function pr({value:e,field:t,inline:n=!1,data:r,describe:a=(e=>e.name)}){let i=Object(s.d)(e=>{let n;if(r)n=r;else switch(t){case"payee":n=e.queries.payees;break;case"category":n=e.queries.categories.list;break;case"account":n=e.queries.accounts;break;default:n=[]}return{data:n,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"}}),c=i.data,u=i.dateFormat,d=er(Object(o.useState)(!1),2),f=d[0],p=d[1];function m(e){if(null==e||""===e)return"(nothing)";if("boolean"===typeof e)return e?"true":"false";if("amount"===t)return Object(ke.k)(e);if("date"===t)return e?e.frequency?ge(e):Object(Sn.a)(Object(Hn.a)(e),u):null;if("month"===t)return e?Object(Sn.a)(Object(Hn.a)(e),Object(de.l)(u)):null;if("year"===t)return e?Object(Sn.a)(Object(Hn.a)(e),"yyyy"):null;if(c&&c.length){let t=c.find(t=>t.id===e);return t?a(t):"(deleted)"}return"\u2026"}if(Array.isArray(e)){if(0===e.length)return l.a.createElement($.z,{style:ar},"(empty)");if(1===e.length)return l.a.createElement($.z,null,"[",l.a.createElement($.z,{style:or},m(e[0])),"]");let t=e;!f&&e.length>4&&(t=e.slice(0,3));let r=e.length-t.length;return l.a.createElement($.z,{style:lr},"[",t.map((t,r)=>{let a,o=l.a.createElement($.z,{style:ir},m(t));return a=n?0!==r?" ":"":l.a.createElement(l.a.Fragment,null,0===r&&l.a.createElement("br",null),"\xa0\xa0"),l.a.createElement($.z,{key:r},a,o,r===e.length-1?"":",",!n&&l.a.createElement("br",null))}),r>0&&l.a.createElement($.z,{style:cr},"\xa0\xa0",l.a.createElement("a",Object.assign({href:"#",onClick:function(e){e.preventDefault(),p(!0)}},Object(lt.css)(sr)),r," more items..."),!n&&l.a.createElement("br",null)),"]")}return e&&null!=e.num1&&null!=e.num2?l.a.createElement($.z,null,l.a.createElement($.z,{style:ur},m(e.num1))," and"," ",l.a.createElement($.z,{style:dr},m(e.num2))):l.a.createElement($.z,{style:fr},m(e))}var mr={display:"block",maxWidth:"100%",backgroundColor:W.a.n10,borderRadius:4,padding:"3px 5px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},yr={color:W.a.p4},gr={color:W.a.n3};function hr({field:e,op:t,value:n,options:r,stage:a,style:o}){return l.a.createElement($.C,{style:[mr,o]},l.a.createElement($.z,{style:yr},Rn(e,r))," ",l.a.createElement($.z,{style:gr},Bn(t))," ",l.a.createElement(pr,{value:n,field:e}))}function br(e,t){return t?`${t.name} (${e.next_date})`:`Next: ${e.next_date}`}function Or({value:e}){let t=Object(s.d)(e=>e.queries.payees),n=Object(h.e)(t),r=nr.useQuery().data;return l.a.createElement(pr,{value:e,field:"rule",data:r,describe:e=>br(e,n[e._payee])})}var wr={display:"block",maxWidth:"100%",backgroundColor:W.a.n10,borderRadius:4,padding:"3px 5px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},vr={color:W.a.n3},Er={color:W.a.p4},jr={color:W.a.n3},Sr={color:W.a.n3};function Cr({field:e,op:t,value:n,options:r,style:a}){return l.a.createElement($.C,{style:[wr,a]},"set"===t?l.a.createElement(l.a.Fragment,null,l.a.createElement($.z,{style:vr},Bn(t))," ",l.a.createElement($.z,{style:Er},Rn(e,r))," ",l.a.createElement($.z,{style:jr},"to "),l.a.createElement(pr,{value:n,field:e})):"link-schedule"===t?l.a.createElement(l.a.Fragment,null,l.a.createElement($.z,{style:Sr},Bn(t))," ",l.a.createElement(Or,{value:n})):null)}var xr={color:W.a.n5},Pr={alignSelf:"flex-start",margin:5,backgroundColor:W.a.b10,color:W.a.b1,borderRadius:4,padding:"3px 5px"},kr={padding:"15px 0"},Ar={flex:1,alignItems:"flex-start"},Dr={marginTop:3},Ir={width:12,height:12},Tr={flex:1,alignItems:"flex-start"},Mr={marginTop:3},Rr={padding:"0 15px",paddingLeft:5};let Br=l.a.memo(({rule:e,hovered:t,selected:n,editing:r,focusedField:a,onHover:o,onEdit:i,onEditRule:c})=>{let s=Object(At.d)(),u=n?W.a.b8:W.a.border,d=t||"select"===a;return l.a.createElement(kt.h,{height:"auto",borderColor:u,backgroundColor:n?W.a.selected:d?W.a.hover:"white",style:{fontSize:13,zIndex:r||n?101:"auto"},collapsed:"true",onMouseEnter:()=>o&&o(e.id),onMouseLeave:()=>o&&o(null)},l.a.createElement(kt.i,{exposed:t||n||r,focused:"select"===a,onSelect:()=>{s({type:"select",id:e.id})},onEdit:()=>i(e.id,"select"),selected:n}),l.a.createElement(kt.a,{name:"stage",width:50,plain:!0,style:xr},e.stage&&l.a.createElement($.C,{style:Pr},e.stage)),l.a.createElement(kt.e,{width:"flex",style:kr,truncate:!1},l.a.createElement($.y,{direction:"row",align:"center"},l.a.createElement($.C,{style:Ar},e.conditions.map((t,n)=>l.a.createElement(hr,{key:n,field:t.field,op:t.op,value:t.value,options:t.options,stage:e.stage,style:0!==n&&Dr}))),l.a.createElement($.z,null,l.a.createElement(Qn,{color:W.a.n4,style:Ir})),l.a.createElement($.C,{style:Tr},e.actions.map((e,t)=>l.a.createElement(Cr,{key:t,field:e.field,op:e.op,value:e.value,options:e.options,style:0!==t&&Mr}))))),l.a.createElement(kt.a,{name:"edit",focused:"edit"===a,plain:!0,style:Rr},l.a.createElement($.d,{as:kt.b,onSelect:()=>c(e),onEdit:()=>i(e.id,"edit")},"Edit")))});var _r={flex:1,outline:"none","& .animated .animated-row":{transition:".25s transform"}},Lr={maxWidth:"100%",overflow:"auto"};let zr=l.a.forwardRef((e,t)=>{let n=e.data,r=e.navigator,a=e.loadMore,i=e.style,c=e.onHoverLeave,s=e.children,u=Xn(e,Jn),d=Object(o.useRef)(),f=Object(o.useRef)(),p=Object(o.useRef)(),m=r.getNavigatorProps;return Object(o.useEffect)(()=>{d.current?f.current=d.current.getBoundingClientRect().height:f.current=null},[d.current,n]),l.a.createElement($.C,Object.assign({style:[_r,i],tabIndex:"1"},m(u)),l.a.createElement($.C,{innerRef:p,style:Lr,onScroll:function(e){null!=f.current&&a&&e.target.scrollTop>f.current-750&&a()}},l.a.createElement("div",{ref:d,onMouseLeave:c},s)))});var Fr={};function Nr(){let e=Object(At.e)(),t=Object(At.d)();return l.a.createElement(kt.m,{version:"v2",style:Fr},l.a.createElement(kt.i,{exposed:!0,focused:!1,selected:e.size>0,onSelect:()=>t({type:"select-all"})}),l.a.createElement(kt.a,{value:"Stage",width:50}),l.a.createElement(kt.a,{value:"Rule",width:"flex"}))}function Ur({rules:e,selectedItems:t,navigator:n,hoveredRule:r,collapsed:a,onHover:o,onCollapse:i,onEditRule:c}){return 0===e.length?null:l.a.createElement($.C,null,e.map(e=>{let a=r===e.id,i=t.has(e.id),s=n.editingId===e.id;return l.a.createElement(Br,{key:e.id,rule:e,hovered:a,selected:i,editing:s,focusedField:s&&n.focusedField,onHover:o,onEdit:n.onEdit,onEditRule:c})}))}function $r(e,t,{payees:n,categories:r,accounts:a}){if(!t)return"";let o=null;if("payee"===e)o=n.find(e=>e.id===t);else if("category"===e)o=r.find(e=>e.id===t);else{if("account"!==e)return t;o=a.find(e=>e.id===t)}return o?o.name:"(deleted)"}var Wr={overflow:"hidden"},Gr={color:W.a.n4,flexDirection:"row",alignItems:"center",width:"50%"},Hr={color:W.a.n4},qr={flex:1},Yr={flex:1},Vr={marginBottom:-1};function Kr({isModal:e,payeeId:t,setLoading:n}){let r=er(Object(o.useState)(null),2),a=r[0],i=r[1],c=er(Object(o.useState)(null),2),u=c[0],d=c[1],f=er(Object(o.useState)(""),2),p=f[0],m=f[1],y=Object(s.c)(),g=Object(kt.o)(u,["select","edit"]),h=nr.useQuery().data,b=Object(s.d)(e=>({payees:e.queries.payees,categories:e.queries.categories.list,accounts:e.queries.accounts,schedules:h})),O=Object(o.useMemo)(()=>""!==p&&u?u.filter(e=>(function(e,t){let n=e.conditions.flatMap(e=>[Rn(e.field),Bn(e.op),"oneOf"===e.op?e.value.map(n=>$r(e.field,n,t)).join(", "):$r(e.field,e.value,t)]),r=e.actions.flatMap(e=>{if("set"===e.op)return[Bn(e.op),Rn(e.field),"to",$r(e.field,e.value,t)];if("link-schedule"===e.op){let n=t.schedules.find(t=>t.id===e.value);return[Bn(e.op),br(n,t.payees.find(e=>e.id===n._payee))]}return[]});return(e.stage||"")+" "+n.join(" ")+" "+r.join(" ")})(e,b).toLowerCase().includes(p.toLowerCase())):u,[u,p,b]),w=Object(At.c)("manage-rules",a,[]),v=er(Object(o.useState)(null),2),E=v[0],j=v[1],S=Object(o.useRef)(null);async function C(){n(!0);let e=null;return e=t?await Object(M.send)("payees-get-rules",{id:t}):await Object(M.send)("rules-get"),i(e),e}Object(o.useEffect)(()=>{return _.setUndoState("openModal","manage-rules"),async function(){let e=await C();d(e.slice(0,100)),n(!1),await y(Object(Yn.m)())}(),()=>{_.setUndoState("openModal",null)}},[]);let x=Object(o.useCallback)(e=>{y(Object(qn.d)("edit-rule",{rule:e,onSave:async e=>{let t=await C();d(n=>{let r=t.findIndex(t=>t.id===e.id);return r>n.length?t.slice(0,r+75):t.slice(0,n.length)}),n(!1)}}))},[]);let P=Object(o.useCallback)(e=>{j(e)},[]);return null===u?null:l.a.createElement(At.a,{instance:w},l.a.createElement($.C,{style:Wr},l.a.createElement($.C,{style:{flexDirection:"row",alignItems:"center",padding:e?"0 13px 15px":"0 0 15px",flexShrink:0}},l.a.createElement($.C,{style:Gr},l.a.createElement($.z,null,"Rules are always run in the order that you see them."," ",l.a.createElement($.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Budgeting/rules/",style:Hr},"Learn more"))),l.a.createElement($.C,{style:qr}),l.a.createElement($.n,{placeholder:"Filter rules...",value:p,onChange:e=>{m(e.target.value),g.onEdit(null)},style:{width:350,borderColor:e?null:"transparent",backgroundColor:e?null:W.a.n11,":focus":e?null:{backgroundColor:"white","::placeholder":{color:W.a.n8}}}})),l.a.createElement($.C,{style:Yr},l.a.createElement(Nr,null),l.a.createElement(zr,{ref:S,data:O,navigator:g,loadMore:function(){d(u.concat(a.slice(u.length,u.length+50)))},style:Vr},l.a.createElement(Ur,{rules:O,selectedItems:w.items,navigator:g,hoveredRule:E,onHover:P,onEditRule:x}))),l.a.createElement($.C,{style:{paddingBlock:15,paddingInline:e?13:0,borderTop:e&&"1px solid "+W.a.border,flexShrink:0}},l.a.createElement($.y,{direction:"row",align:"center",justify:"flex-end",spacing:2},w.items.size>0&&l.a.createElement($.d,{onClick:async function(){n(!0),(await Object(M.send)("rule-delete-all",[...w.items])).someDeletionsFailed&&alert("Some rules were not deleted because they are linked to schedules");let e=await C();d(t=>e.slice(0,t.length)),w.dispatch({type:"select-none"}),n(!1)}},"Delete ",w.items.size," rules"),l.a.createElement($.d,{primary:!0,onClick:function(){let e={stage:null,conditions:[{field:"payee",op:"is",value:t||null,type:"id"}],actions:[{op:"set",field:"category",value:null,type:"id"}]};y(Object(qn.d)("edit-rule",{rule:e,onSave:async e=>{let t=await C();g.onEdit(e.id,"edit"),d(n=>{let r=t.findIndex(t=>t.id===e.id);return t.slice(0,r+75)}),n(!1)}}))}},"Create new rule")))))}function Zr({isModal:e,payeeId:t,setLoading:n=(()=>{})}){return l.a.createElement(nr.Provider,null,l.a.createElement(Kr,{isModal:e,payeeId:t,setLoading:n}))}var Qr=n(129),Jr=n.n(Qr),Xr=n(133);function ea(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ta(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ea(Object(n),!0).forEach(function(t){na(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ea(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ra=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:ta({color:"#242134"},e.style)}),o.createElement("path",{d:"M.439 21.44a1.5 1.5 0 0 0 2.122 2.121l9.262-9.261a.25.25 0 0 1 .354 0l9.262 9.263a1.5 1.5 0 1 0 2.122-2.121L14.3 12.177a.25.25 0 0 1 0-.354l9.263-9.262A1.5 1.5 0 0 0 21.439.44L12.177 9.7a.25.25 0 0 1-.354 0L2.561.44A1.5 1.5 0 0 0 .439 2.561L9.7 11.823a.25.25 0 0 1 0 .354Z",fill:"currentColor"}));const aa=["value","onSelect","suggestions","strict"],oa=["multi"];function la(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ia(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ia(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ia(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ca(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ua(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sa(Object(n),!0).forEach(function(t){da(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fa(e,t,n){if(e){let e=t.findIndex(e=>e.id===n);return-1===e?null:t[e]}return n}function pa(e){return null==e?"":"string"===typeof e?e:e.name||""}function ma(e){return"string"===typeof e?e:e?e.id:null}function ya({props:{value:e,suggestions:t,embedded:n,isOpen:r=!1,strict:a,initialFilterSuggestions:o}}){let l=fa(a,t,e),i=o?o(t,e):null;return{selectedItem:l,value:l?pa(l):"",originalItem:l,filteredSuggestions:i,highlightedIndex:null,isOpen:n||r}}function ga(e,t){return pa(e).toLowerCase().includes(t.toLowerCase())}function ha(e,t){return e.filter(e=>ga(e,t))}function ba(e,t,n,r,a){let o=null;if(t)if(null==r){let e=n.find(e=>e.id===a);e&&(o=e.id)}else r<n.length&&(o=n[r].id);else o=a;e&&e(o)}function Oa({props:{suggestions:e,onUpdate:t,multi:n,highlightFirst:r,strict:a,filterSuggestions:o=ha,getHighlightedIndex:l},state:{isOpen:i}},c,s){if(!document.hasFocus())return;if(s.type===Xr.a.stateChangeTypes.controlledPropUpdatedSelectedItem)return;const u=o(e,c);if(""===c)return s.type!==Xr.a.stateChangeTypes.clickItem&&ba(t,a,u,null,null),{value:c,filteredSuggestions:u,highlightedIndex:null};{let e=e=>r&&e.length?0:null,n=(l||e)(u);return s.type!==Xr.a.stateChangeTypes.clickItem&&ba(t,a,u,n,c),{value:c,filteredSuggestions:u,highlightedIndex:n}}}function wa({props:e,state:t,inst:n},r,a){if(e.tableBehavior&&r.type===Xr.a.stateChangeTypes.mouseUp)return;const o={};return"highlightedIndex"in r&&(o.highlightedIndex=r.highlightedIndex),"isOpen"in r&&(o.isOpen=!!e.embedded||r.isOpen),"selectedItem"in r&&(o.selectedItem=r.selectedItem),!t.isOpen||r.type!==Xr.a.stateChangeTypes.keyDownArrowUp&&r.type!==Xr.a.stateChangeTypes.keyDownArrowDown||ba(e.onUpdate,e.strict,t.filteredSuggestions||e.suggestions,null!=o.highlightedIndex?o.highlightedIndex:t.highlightedIndex,t.value),n.lastChangeType=r.type,o}function va({props:{onSelect:e,clearAfterSelect:t,suggestions:n},inst:r},a){return e&&setTimeout(()=>{e(ma(a))},0),Ea(n,t,r)}function Ea(e,t,n){if(t)return{value:"",selectedItem:null,highlightedIndex:null,filteredSuggestions:e};n.input&&n.input.setSelectionRange(0,1e4)}function ja({props:{inputProps:e}},t){const n=(e||{}).onChange;n&&n(t.target.value)}function Sa({props:{suggestions:e,clearAfterSelect:t,initialFilterSuggestions:n,embedded:r,onUpdate:a,onSelect:o,inputProps:l,shouldSaveFromKey:i=Pa,strict:c},state:{selectedItem:s,filteredSuggestions:u,highlightedIndex:d,originalItem:f,isNulled:p,isOpen:m,value:y},inst:g},h){let b=(l||{}).onKeyDown;if(m)if(13===h.keyCode)if(null!=d)g.lastChangeType===Xr.a.stateChangeTypes.itemMouseEnter?h.preventDefault():h.stopPropagation();else{if(!c)return h.stopPropagation(),o(y),Ea(e,t,g);h.preventDefault(),b&&b(h)}else i(h)&&(h.preventDefault(),b&&b(h));if(27===h.keyCode){h.preventDefault(),r||h.stopPropagation();let t=n?n(e,pa(f)):null;return ba(a,c,e,null,ma(f)),{value:pa(f),selectedItem:fa(c,e,f),filteredSuggestions:t,highlightedIndex:null,isOpen:!!r}}}function Ca(e){return l.a.createElement($.n,e)}function xa(e,t,n){return l.a.createElement("div",null,e.map((e,r)=>{let a=pa(e);return l.a.createElement("div",Object.assign({},t({item:e}),{key:a},Object(lt.css)({padding:5,cursor:"default",backgroundColor:n===r?W.a.n4:null})),a)}))}function Pa(e){return 13===e.keyCode}function ka({inst:e,props:{inputProps:t={},openOnFocus:n=!0}},r){if(t.onFocus&&t.onFocus(r),n)return{isOpen:!0}}function Aa({inst:e,props:t,state:{selectedItem:n}},r){let a=t.inputProps,o=void 0===a?{}:a,l=t.onSelect;if(r.preventDownshiftDefault=!0,o.onBlur&&o.onBlur(r),t.tableBehavior)return{isOpen:!1};{if(""===r.target.value)return l&&l(null),{selectedItem:null,originalValue:null,isOpen:!1};let e=n?ma(n):null;return ya({props:ua(ua({},t),{},{value:e,originalValue:e})})}}function Da(e){return e?pa(e):""}var Ia={display:"flex"},Ta={marginTop:5};const Ma=Jr()(function({props:{focused:e,embedded:t,containerProps:n,inputProps:r,children:a,suggestions:o,tooltipStyle:i,onItemClick:c,strict:s,tooltipProps:u,renderInput:d=Ca,renderItems:f=xa,itemToString:p=Da},state:{value:m,selectedItem:y,filteredSuggestions:g,highlightedIndex:h,isOpen:b},updater:O,inst:w}){var v=ua({padding:0,backgroundColor:W.a.n1,color:"white"},i);const E=g||o;return l.a.createElement(Xr.a,{onSelect:O(va),highlightedIndex:h,selectedItem:y||null,itemToString:p,inputValue:m,isOpen:b,onInputValueChange:O(Oa),onStateChange:O(wa)},({getInputProps:a,getItemProps:o,getRootProps:i,isOpen:c,inputValue:s,selectedItem:p,highlightedIndex:m})=>l.a.createElement("div",Object.assign({className:"view "+Object(lt.css)(Ia).toString()},n),d(a(ua(ua({focused:e},r),{},{onFocus:O(ka),onBlur:O(Aa),onKeyDown:O(Sa),onChange:O(ja)}))),c&&E.length>0&&(t?l.a.createElement($.C,{style:Ta,"data-testid":"autocomplete"},f(E,o,m,s)):l.a.createElement($.B,Object.assign({position:"bottom-stretch",offset:2,style:v},u,{"data-testid":"autocomplete"}),f(E,o,m,s)))))},{getInitialState:ya,componentWillReceiveProps:function(e,t){let n=t.strict,r=t.suggestions,a=t.filterSuggestions,o=void 0===a?ha:a,l=t.initialFilterSuggestions,i=t.value,c=t.itemToString,s=void 0===c?Da:c,u=e.state.value,d=null;function f(){let e=fa(n,r,i);e&&((d=d||{}).value=s(e),d.selectedItem=e)}if(e.props.value!==i&&f(),e.props.suggestions!==r){let t=null;t=null!=e.state.highlightedIndex?o(r,u):l?l(r,u):null,d=d||{},f(),d.filteredSuggestions=t}return d}});var Ra={alignItems:"center",flexDirection:"row",backgroundColor:W.a.b9,padding:"2px 4px",margin:"2px",borderRadius:4},Ba={marginLeft:1},_a={width:8,height:8};function La({name:e,onRemove:t}){return l.a.createElement($.C,{style:Ra},e,l.a.createElement($.d,{type:"button",bare:!0,style:Ba,onClick:t},l.a.createElement(ra,{style:_a})))}var za={display:"flex",flexWrap:"wrap",flexDirection:"row",alignItems:"center",backgroundColor:"white",borderRadius:4,border:"1px solid #d0d0d0"},Fa={border:"1px solid "+W.a.b5,boxShadow:"0 1px 1px "+W.a.b7},Na={flex:1,minWidth:30,border:0,":focus":{border:0,boxShadow:"none"}};function Ua(e){let t=e.value,n=e.onSelect,r=e.suggestions,a=e.strict,i=ca(e,aa),c=la(Object(o.useState)(!1),2),s=c[0],u=c[1],d=Object(o.useRef)();function f(e){let r=t.filter(t=>t!==e);n(r)}return Object(o.useEffect)(()=>{d.current=t}),l.a.createElement(Ka,Object.assign({},i,{value:null,suggestions:r.filter(e=>!t.includes(ma(e))),onSelect:function(e){e&&(e=e.trim(),n([...t,e],e))},clearAfterSelect:!0,highlightFirst:!0,strict:a,tooltipProps:{forceLayout:d.current!==t},renderInput:e=>l.a.createElement($.C,{style:[za,s&&Fa]},t.map((e,t)=>(e=fa(a,r,e))&&l.a.createElement(La,{key:ma(e)||t,name:pa(e),onRemove:()=>f(ma(e))})),l.a.createElement($.n,Object.assign({},e,{onKeyDown:n=>(function(e,n){"Backspace"===e.key&&""===e.target.value&&f(t[t.length-1]),n&&n(e)})(n,e.onKeyDown),onFocus:t=>{u(!0),e.onFocus(t)},onBlur:t=>{u(!1),e.onBlur(t)},style:[Na,e.style]})))}))}var $a={fontSize:12,color:W.a.n10,backgroundColor:"transparent",borderColor:W.a.n5},Wa={backgroundColor:"rgba(200, 200, 200, .25)"};function Ga({title:e,style:t,hoveredStyle:n,onClick:r}){return l.a.createElement($.d,{style:[$a,t],hoveredStyle:[Wa,n],onClick:r},e)}var Ha={flexShrink:0},qa={paddingTop:5},Ya={padding:5};function Va({show:e=!0,embedded:t,children:n}){return e&&l.a.createElement($.C,{style:[Ha,t?qa:Ya],onMouseDown:e=>e.preventDefault()},n)}function Ka(e){let t=e.multi,n=ca(e,oa);return t?l.a.createElement(Ua,n):l.a.createElement(Ma,n)}const Za=["embedded","includeClosedAccounts"];function Qa(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Ja={overflow:"auto",padding:"5px 0"},Xa={maxHeight:175},eo={color:W.a.y9,padding:"4px 9px"};function to({items:e,getItemProps:t,highlightedIndex:n,embedded:r}){let a=null;return l.a.createElement($.C,null,l.a.createElement($.C,{style:[Ja,!r&&Xa]},e.map((e,o)=>{const i=!a||e.offbudget!==a.offbudget,c=e.offbudget?"Off Budget":"For Budget";return a=e,[i?l.a.createElement("div",{key:c,style:eo,"data-testid":"account-item-group"},c):null,l.a.createElement("div",Object.assign({},t?t({item:e}):null,{key:e.id,style:{backgroundColor:n===o?W.a.n4:"transparent",padding:4,paddingLeft:20,borderRadius:r?4:0},"data-testid":"account-item"+(n===o?"-highlighted":"")}),e.name)]})))}function no(e){let t=e.embedded,n=e.includeClosedAccounts,r=void 0===n||n,a=Qa(e,Za),o=j()||[];return l.a.createElement(Ka,Object.assign({strict:!0,highlightFirst:!0,embedded:t,suggestions:r?o:o.filter(e=>!1===e.closed),renderItems:(e,n,r)=>l.a.createElement(to,{items:e,getItemProps:n,highlightedIndex:r,embedded:t})},a))}function ro(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ao(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ro(Object(n),!0).forEach(function(t){oo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ro(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lo=e=>o.createElement("svg",Object.assign({},e,{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",style:ao({color:"#242134"},e.style)}),o.createElement("path",{d:"m30 9-4-4M30 9l-4 4M6 5 2 9M2 9l4 4M10 9H3M22 9h7M16 15l6-6M16 15l-6-6M16 28V15",fill:"none",stroke:"currentColor",strokeWidth:3.5,strokeMiterlimit:10,strokeLinecap:"round"}));const io=["categoryGroups","emptyLabel"],co=["categoryGroups","showSplitOption","embedded","onSplit"];function so(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function uo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?so(Object(n),!0).forEach(function(t){fo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):so(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function po(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const mo=l.a.forwardRef((e,t)=>{let n=e.categoryGroups,r=e.emptyLabel,a=po(e,io);return l.a.createElement($.x,Object.assign({},a,{ref:t}),l.a.createElement("option",{value:""},r||"Select category..."),n.map(e=>l.a.createElement("optgroup",{key:e.id,label:e.name},e.categories.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name)))))});var yo={overflow:"auto",padding:"5px 0"},go={maxHeight:175},ho={lineHeight:0},bo={marginRight:5,color:"inherit"},Oo={color:W.a.y9,padding:"4px 9px"};function wo({items:e,getItemProps:t,highlightedIndex:n,embedded:r,footer:a}){let o=null;return l.a.createElement($.C,null,l.a.createElement($.C,{style:[yo,!r&&go]},e.map((e,a)=>{if("split"===e.id)return l.a.createElement($.C,Object.assign({key:"split"},t?t({item:e}):null,{style:{backgroundColor:n===a?W.a.n4:"transparent",borderRadius:r?4:0,flexShrink:0,flexDirection:"row",alignItems:"center",fontSize:11,fontWeight:500,color:W.a.g8,padding:"6px 8px"},"data-testid":"split-transaction-button"}),l.a.createElement($.z,{style:ho},l.a.createElement(lo,{width:10,height:10,style:bo})),"Split Transaction");const i=e.cat_group!==o;return o=e.cat_group,l.a.createElement(l.a.Fragment,{key:e.id},i&&l.a.createElement("div",{style:Oo,"data-testid":"category-item-group"},e.groupName),l.a.createElement("div",Object.assign({},t?t({item:e}):null,{style:{backgroundColor:n===a?W.a.n4:"transparent",padding:4,paddingLeft:20,borderRadius:r?4:0},"data-testid":"category-item"+(n===a?"-highlighted":"")}),e.name))})),a)}function vo(e){let t=e.categoryGroups,n=e.showSplitOption,r=e.embedded,a=(e.onSplit,po(e,co)),i=Object(o.useMemo)(()=>t.reduce((e,t)=>e.concat(t.categories.map(e=>uo(uo({},e),{},{groupName:t.name}))),n?[{id:"split",name:""}]:[]),[t]);return l.a.createElement(Ka,Object.assign({strict:!0,highlightFirst:!0,embedded:r,getHighlightedIndex:e=>0===e.length?null:"split"===e[0].id?e.length>1?1:null:0,filterSuggestions:(e,t)=>e.filter(e=>"split"===e.id||ga(e,t)||e.groupName.toLowerCase().includes(t.toLowerCase())),suggestions:i,renderItems:(e,t,n)=>l.a.createElement(wo,{items:e,embedded:r,getItemProps:t,highlightedIndex:n})},a))}var Eo=n(97),jo=n(40);const So=["value","inputProps","showMakeTransfer","showManagePayees","defaultFocusTransferPayees","tableBehavior","embedded","onUpdate","onSelect","onManagePayees"];function Co(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Co(Object(n),!0).forEach(function(t){Po(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Co(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ko(e,t){return Ro(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||To(e,t)||Io()}function Ao(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Do(e){return Ro(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||To(e)||Io()}function Io(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function To(e,t){if(e){if("string"===typeof e)return Mo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mo(e,t):void 0}}function Mo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ro(e){if(Array.isArray(e))return e}function Bo(e,t,n){let r=n?Object(h.c)(e,n):e;return t&&r&&(r=r.filter(e=>!!e.transfer_acct)),r||[]}function _o(e,t){return"new"!==e||t.current.startsWith("new:")?e:"new:"+t.current}function Lo(e){return"string"===typeof e&&e.startsWith("new:")?"new":e}var zo={overflow:"auto",padding:"5px 0"},Fo={maxHeight:175},No={display:"block",color:W.a.g8,borderRadius:4,fontSize:11,fontWeight:500},Uo={color:W.a.g8,marginRight:5,display:"inline-block"},$o={color:W.a.y9,padding:"4px 9px"},Wo={fontSize:11,padding:5,color:W.a.n5,textAlign:"center"};function Go({items:e,getItemProps:t,highlightedIndex:n,embedded:r,inputValue:a,footer:o}){let i=e.filtered,c=null;if("new"===(e=[...e])[0].id){let t=Do(e),n=t[0],r=t.slice(1);c=n,e=r}let s=c?1:0,u=null;return l.a.createElement($.C,null,l.a.createElement($.C,{style:[zo,!r&&Fo]},c&&l.a.createElement($.C,Object.assign({},t?t({item:c}):null,{style:{flexShrink:0,padding:"6px 9px",backgroundColor:0===n?W.a.n4:"transparent",borderRadius:r?4:0}}),l.a.createElement($.C,{style:No},l.a.createElement(Rt,{width:8,height:8,style:Uo}),'Create Payee "',a,'"')),e.map((a,o)=>{let c,d=a.transfer_acct?"account":"payee";"payee"===d&&u!==d?c="Payees":"account"===d&&u!==d&&(c="Transfer To/From");let f=o===e.length-1&&i;return u=d,l.a.createElement(l.a.Fragment,{key:a.id},c&&l.a.createElement("div",{key:"title-"+o,style:$o},c),l.a.createElement("div",Object.assign({},t?t({item:a}):null,{key:a.id,style:{backgroundColor:n===o+s?W.a.n4:"transparent",borderRadius:r?4:0,padding:4,paddingLeft:20}}),a.name),f&&l.a.createElement("div",{style:Wo},"More payees are available, search to find them"))})),o)}var Ho={marginBottom:5},qo={backgroundColor:W.a.y8,color:W.a.g2,borderColor:W.a.y8},Yo={backgroundColor:W.a.y8,colors:W.a.y2};function Vo(e){let t=e.value,n=e.inputProps,r=e.showMakeTransfer,a=void 0===r||r,i=e.showManagePayees,c=void 0!==i&&i,u=e.defaultFocusTransferPayees,d=void 0!==u&&u,f=e.tableBehavior,p=e.embedded,m=e.onUpdate,y=e.onSelect,g=e.onManagePayees,h=Ao(e,So),b=A(),O=j(),w=ko(Object(o.useState)(d),2),v=w[0],E=w[1],S=Object(o.useMemo)(()=>[{id:"new",name:""},...Bo(b,v,O)],[b,v,O]),C=Object(o.useRef)(""),x=Object(s.c)();const P=ko(Object(o.useState)(!1),2),k=P[0],D=P[1];return l.a.createElement(Ka,Object.assign({key:v?"transfers":"all",strict:!0,embedded:p,value:Lo(t),suggestions:S,tableBehavior:f,itemToString:e=>e?"new"===e.id?C.current:e.name:"",focused:k,inputProps:xo(xo({},n),{},{onBlur:()=>D(!1),onFocus:()=>D(!0),onChange:e=>C.current=e}),onUpdate:e=>m&&m(_o(e,C)),onSelect:async function(e){if(f)y&&y(_o(e,C));else{let t=()=>x(Object(Yn.f)(C.current));Array.isArray(e)?e=await Promise.all(e.map(e=>"new"===e?t():e)):"new"===e&&(e=await t()),y&&y(e)}},getHighlightedIndex:e=>e.length>1&&"new"===e[0].id?1:0,filterSuggestions:(e,t)=>{let n=e.filter((e,n)=>"new"===e.id?!(!t||""===t||v):ga(e,t));n.sort((e,n)=>{let r=e.name.toLowerCase().startsWith(t.toLowerCase()),a=n.name.toLowerCase().startsWith(t.toLowerCase()),o=e.name.toLowerCase()===t.toLowerCase(),l=n.name.toLowerCase()===t.toLowerCase();return"new"===e.id?-1:"new"===n.id?1:o&&!l?-1:!o&&l?1:r===a?0:r&&!a?-1:1});let r=n.length>100;return(n=n.slice(0,100)).filtered=r,n.length>=2&&"new"===n[0].id&&n[1].name.toLowerCase()===t.toLowerCase()&&!n[1].transfer_acct?n.slice(1):n},initialFilterSuggestions:e=>{let t=!1,n=e.filter((e,n)=>"new"!==e.id&&(!(n>=100&&!e.transfer_acct)||(t=!0,!1)));return t&&(n.filtered=!0),n},renderItems:(e,t,n,r)=>l.a.createElement(Go,{items:e,getItemProps:t,highlightedIndex:n,inputValue:r,embedded:p,footer:l.a.createElement(Va,{embedded:p},a&&l.a.createElement(Ga,{title:"Make Transfer",style:[c&&Ho,v&&qo],hoveredStyle:v&&Yo,onClick:()=>{m&&m(null),E(!v)}}),c&&l.a.createElement(Ga,{title:"Manage Payees",onClick:()=>g()}))})},h))}var Ko=n(156);function Zo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zo(Object(n),!0).forEach(function(t){Jo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xo=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Qo({color:"#242134"},e.style)}),o.createElement("path",{d:"M23 11.5a1.5 1.5 0 0 1-1.5 1.5h-20a1.5 1.5 0 0 1 0-3h20a1.5 1.5 0 0 1 1.5 1.5Z",fill:"currentColor"}),o.createElement("path",{d:"M11.5 23a1.5 1.5 0 0 1-1.5-1.5v-20a1.5 1.5 0 0 1 3 0v20a1.5 1.5 0 0 1-1.5 1.5Z",fill:"currentColor"}));function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(t){nl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rl=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:tl({color:"#242134"},e.style)}),o.createElement("path",{d:"M23 11.5a1.5 1.5 0 0 1-1.5 1.5h-20a1.5 1.5 0 0 1 0-3h20a1.5 1.5 0 0 1 1.5 1.5Z",fill:"currentColor"}));function al(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ol(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ol(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ol(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function il(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ll(Object(n),!0).forEach(function(t){cl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ll(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sl=5,ul=[{id:"weekly",name:"Weeks"},{id:"monthly",name:"Months"},{id:"yearly",name:"Years"}],dl=[...Array(31).keys()].map(e=>e+1),fl=[{id:"SU",name:"Sunday"},{id:"MO",name:"Monday"},{id:"TU",name:"Tuesday"},{id:"WE",name:"Wednesday"},{id:"TH",name:"Thursday"},{id:"FR",name:"Friday"},{id:"SA",name:"Saturday"}];function pl(e){return e||{start:de.c(),interval:1,frequency:"monthly",patterns:[yl(de.c())]}}function ml(e){return il(il({},e),{},{interval:vl(e.interval)})}function yl(e){return{value:parseInt(de.g(e,"d")),type:"day"}}function gl(e,t){switch(t.type){case"replace-config":return il(il({},e),{},{config:t.config});case"change-field":return il(il({},e),{},{config:il(il({},e.config),{},{[t.field]:t.value,patterns:"monthly"!==e.config.frequency?[]:e.config.patterns})});case"update-recurrence":return il(il({},e),{},{config:il(il({},e.config),{},{patterns:e.config.patterns.map(e=>e===t.recurrence?il(il({},t.recurrence),function({field:e,value:t,recurrence:n}){return"value"===e&&"day"!==n.type&&t>sl||"type"===e&&"day"!==t&&n.value>sl?{[e]:t,value:sl}:{[e]:t}}(t)):e)})});case"add-recurrence":return il(il({},e),{},{config:il(il({},e.config),{},{patterns:[...e.config.patterns||[],yl(e.config.start)]})});case"remove-recurrence":return il(il({},e),{},{config:il(il({},e.config),{},{patterns:e.config.patterns.filter(e=>e!==t.recurrence)})});default:return e}}var hl={fontWeight:600},bl={marginTop:10},Ol={marginTop:15,color:W.a.n4};function wl({previewDates:e}){if(!e)return null;let t=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy");t=t.replace("MM","M").replace("dd","d");let n=null;return n="string"===typeof e?l.a.createElement($.z,null,e):l.a.createElement($.C,null,l.a.createElement($.z,{style:hl},"Upcoming dates"),l.a.createElement($.y,{direction:"row",spacing:4,style:bl},e.map(e=>l.a.createElement($.C,null,l.a.createElement($.z,null,de.g(e,t)),l.a.createElement($.z,null,de.g(e,"EEEE")))))),l.a.createElement(l.a.Fragment,null,l.a.createElement($.y,{direction:"column",spacing:1,style:Ol},n))}function vl(e){const t=parseInt(e);return Number.isInteger(t)&&t>0?t:1}var El={marginTop:10},jl={display:"flex",flexDirection:"row"},Sl={marginRight:10},Cl={marginRight:10},xl={padding:7},Pl={width:8,height:8},kl={padding:7,marginLeft:5},Al={width:10,height:10};function Dl({config:e,dispatch:t}){let n=(e,n,r)=>t({type:"update-recurrence",recurrence:e,field:n,value:r});return l.a.createElement($.y,{spacing:2,style:El},e.patterns.map((e,r)=>l.a.createElement($.C,{key:r,style:jl},l.a.createElement($.x,{style:Sl,value:e.value,onChange:t=>n(e,"value",function(e){return"last"===e?-1:Number(e)}(t.target.value))},l.a.createElement("option",{value:-1},"Last"),l.a.createElement("option",{disabled:!0},"---"),dl.map(e=>l.a.createElement("option",{key:e,value:e},e))),l.a.createElement($.x,{style:Cl,value:e.type,onChange:t=>n(e,"type",t.target.value)},l.a.createElement("option",{value:"day"},"Day"),l.a.createElement("option",{disabled:!0},"---"),fl.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name))),l.a.createElement($.d,{bare:!0,style:xl,onClick:()=>t({type:"remove-recurrence",recurrence:e})},l.a.createElement(rl,{style:Pl})),l.a.createElement($.d,{bare:!0,style:kl,onClick:()=>t({type:"add-recurrence"})},l.a.createElement(Xo,{style:Al})))))}var Il={padding:10,width:380},Tl={display:"flex",alignItems:"center"},Ml={marginRight:5},Rl={marginTop:10},Bl={whiteSpace:"nowrap"},_l={width:40},Ll={flex:0},zl={display:"flex",marginTop:15,justifyContent:"flex-end"},Fl={marginLeft:10};function Nl({config:e,onClose:t,onSave:n}){let r=al(Object(o.useState)(null),2),a=r[0],i=r[1],c=al(Object(o.useReducer)(gl,{config:pl(e)}),2),u=c[0],d=c[1],f=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy");Object(o.useEffect)(()=>{d({type:"replace-config",config:pl(e)})},[e]);let p=u.config,m=(e,t)=>d({type:"change-field",field:e,value:t});return Object(o.useEffect)(()=>{!async function(){let e=await Object(M.sendCatch)("schedule/get-upcoming-dates",{config:ml(p),count:4}),t=e.data,n=e.error;i(n?"Invalid rule":t)}()},[p]),null==a?null:l.a.createElement($.B,{style:Il,offset:1,position:"bottom-left",onClose:t},l.a.createElement("div",{style:Tl},l.a.createElement("label",{htmlFor:"start",style:Ml},"Starts:"),l.a.createElement(Eo.a,{id:"start",inputProps:{placeholder:"Start Date"},value:p.start,onSelect:e=>m("start",e),containerProps:{style:{width:100}},dateFormat:f})),l.a.createElement($.y,{direction:"row",align:"center",justify:"flex-start",style:Rl,spacing:2},l.a.createElement($.z,{style:Bl},"Repeat every"),l.a.createElement($.n,{id:"interval",style:_l,type:"text",onBlur:e=>m("interval",e.target.value),onEnter:e=>m("interval",e.target.value),defaultValue:p.interval||1}),l.a.createElement($.x,{onChange:e=>m("frequency",e.target.value),value:p.frequency,style:Ll},ul.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name))),"monthly"!==p.frequency||null!=p.patterns&&0!==p.patterns.length?null:l.a.createElement($.d,{onClick:()=>d({type:"add-recurrence"})},"Add specific days")),"monthly"===p.frequency&&p.patterns&&p.patterns.length>0&&l.a.createElement(Dl,{config:p,dispatch:d}),l.a.createElement(wl,{previewDates:a}),l.a.createElement("div",{style:zl},l.a.createElement($.d,{onClick:t},"Cancel"),l.a.createElement($.d,{onClick:()=>n(ml(p)),primary:!0,style:Fl},"Apply")))}var Ul={textAlign:"left"};function $l({value:e,buttonStyle:t,onChange:n}){let r=Object(Ko.c)(),a=r.isOpen,o=r.close,i=r.getOpenEvents;return l.a.createElement($.C,null,l.a.createElement($.d,Object.assign({},i(),{style:[Ul,t]}),e?ge(e):"No recurring date"),a&&l.a.createElement(Nl,{config:e,onClose:o,onSave:function(e){n(e),o()}}))}function Wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wl(Object(n),!0).forEach(function(t){Hl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ql={justifyContent:"flex-start"},Yl={flex:1};function Vl({field:e,subfield:t,type:n,multi:r,value:a,inputRef:o,style:i,onChange:c}){let u=Object(s.d)(e=>({payees:e.queries.payees,accounts:e.queries.accounts,categoryGroups:e.queries.categories.grouped,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"})),d=u.payees,f=u.accounts,p=u.categoryGroups,m=u.dateFormat;if(r&&!Array.isArray(a))a=[];else if(!r&&Array.isArray(a))return null;let y,g=!r||0===a.length;switch(n){case"id":switch(e){case"payee":d.length>0&&(y=l.a.createElement(Vo,{payees:d,accounts:f,multi:r,showMakeTransfer:!1,openOnFocus:!0,value:a,onSelect:c,inputProps:Gl({inputRef:o},g?{placeholder:"nothing"}:null)}));break;case"account":y=l.a.createElement(no,{accounts:f,value:a,multi:r,openOnFocus:!0,onSelect:c,inputProps:Gl({inputRef:o},g?{placeholder:"nothing"}:null)});break;case"category":y=l.a.createElement(vo,{categoryGroups:p,value:a,multi:r,openOnFocus:!0,onSelect:c,inputProps:Gl({inputRef:o},g?{placeholder:"nothing"}:null)})}break;case"date":switch(t){case"month":y=l.a.createElement($.n,{inputRef:o,defaultValue:a||"",placeholder:Object(de.l)(m).toLowerCase(),onEnter:e=>c(e.target.value),onBlur:e=>c(e.target.value)});break;case"year":y=l.a.createElement($.n,{inputRef:o,defaultValue:a||"",placeholder:"yyyy",onEnter:e=>c(e.target.value),onBlur:e=>c(e.target.value)});break;default:y=a&&a.frequency?l.a.createElement($l,{value:a,buttonStyle:ql,onChange:c}):l.a.createElement(Eo.a,{value:a,dateFormat:m,openOnFocus:!1,inputRef:o,inputProps:{placeholder:m.toLowerCase()},onSelect:c})}break;case"boolean":y=l.a.createElement(jo.a,{checked:a,value:a,onChange:e=>c(!a)});break;default:y=r?l.a.createElement(Ka,{multi:!0,suggestions:[],value:a,inputProps:{inputRef:o},onSelect:c}):l.a.createElement($.n,{inputRef:o,defaultValue:a||"",placeholder:"nothing",onEnter:e=>c(e.target.value),onBlur:e=>c(e.target.value)})}return l.a.createElement($.C,{style:[Yl,i]},y)}function Kl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Zl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kl(Object(n),!0).forEach(function(t){Ql(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ql(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Xl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xl(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let ei=["date","account","payee","notes","category","amount","cleared"].map(e=>[e,Rn(e)]);function ti(e,t){switch(e){case"amount":switch(t){case"amount-inflow":return{inflow:!0};case"amount-outflow":return{outflow:!0};default:return null}case"date":switch(t){case"month":return{month:!0};case"year":return{year:!0};default:return null}default:return null}}function ni({children:e}){let t=Object(o.useRef)();return Object(o.useEffect)(()=>{t.current.focus()},[]),l.a.createElement("div",{ref:t,tabIndex:-1,onKeyDown:function(e){9===e.keyCode&&xn()(t.current,e)}},e)}var ri={backgroundColor:W.a.n10,marginBottom:5},ai={color:"white","&,:hover,:active":{backgroundColor:W.a.b4}};function oi({op:e,selected:t,style:n,onClick:r}){return l.a.createElement($.d,{bare:!0,style:[ri,n,t&&ai],onClick:r},Bn(e))}var li={padding:15},ii={marginBottom:10},ci={borderWidth:1},si={flexWrap:"wrap"},ui={marginTop:10},di={marginTop:15};function fi({field:e,op:t,value:n,dispatch:r,onApply:a}){let i=Jl(Object(o.useState)(e),2),c=i[0],s=i[1],u=Object(o.useRef)(),d=Object(o.useRef)(null);Object(o.useEffect)(()=>{d.current!==t&&u.current&&u.current.focus(),d.current=t},[t]);let f=Mn.get(e),p=Tn[f].ops;return"month"!==c&&"year"!==c||(p=["is"]),l.a.createElement($.B,{position:"bottom-left",style:li,width:300,onClose:()=>r({type:"close"})},l.a.createElement(ni,null,l.a.createElement($.C,{style:ii},"amount"===e||"date"===e?l.a.createElement($.h,{options:"amount"===e?[["amount","Amount"],["amount-inflow","Amount (inflow)"],["amount-outflow","Amount (outflow)"]]:"date"===e?[["date","Date"],["month","Month"],["year","Year"]]:null,value:c,onChange:e=>{s(e),"month"!==e&&"year"!==e||r({type:"set-op",op:"is"})},style:ci}):Object(ke.p)(Rn(e))),l.a.createElement($.y,{direction:"row",align:"flex-start",spacing:1,style:si},"boolean"===f?[l.a.createElement(oi,{key:"true",op:"true",selected:!0===n,onClick:()=>{r({type:"set-op",op:"is"}),r({type:"set-value",value:!0})}}),l.a.createElement(oi,{key:"false",op:"false",selected:!1===n,onClick:()=>{r({type:"set-op",op:"is"}),r({type:"set-value",value:!1})}})]:p.map(e=>l.a.createElement(oi,{key:e,op:e,selected:e===t,onClick:()=>r({type:"set-op",op:e})}))),l.a.createElement("form",{action:"#"},"boolean"!==f&&l.a.createElement(Vl,{inputRef:u,field:e,subfield:c,type:"id"===f&&"contains"===t?"string":f,value:n,multi:"oneOf"===t,style:ui,onChange:e=>r({type:"set-value",value:e})}),l.a.createElement($.C,null,l.a.createElement($.d,{primary:!0,style:di,onClick:r=>{r.preventDefault(),a({field:e,op:t,value:n,options:ti(e,c)})}},"Apply")))))}var pi={width:16,height:16,color:"inherit",marginRight:5},mi={padding:0};function yi({onApply:e}){let t=Object(s.d)(e=>({dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"})).dateFormat,n=Jl(Object(o.useReducer)((e,t)=>{switch(t.type){case"select-field":return Zl(Zl({},e),{},{fieldsOpen:!0,condOpen:!1});case"configure":{let n=function(e){return"amount-inflow"===e?{field:"amount",options:{inflow:!0}}:"amount-outflow"===e?{field:"amount",options:{outflow:!0}}:{field:e}}(t.field).field,r=Mn.get(n),a=Tn[r].ops;return Zl(Zl({},e),{},{fieldsOpen:!1,condOpen:!0,field:t.field,op:a[0],value:"boolean"===r||null})}case"set-op":{let n=Mn.get(e.field),r=e.value;return"id"===n&&"contains"===t.op&&(r=null),Zl(Zl({},e),{},{op:t.op,value:r})}case"set-value":let n=Fn(t.value,{type:Mn.get(e.field)}).value;return Zl(Zl({},e),{},{value:n});case"close":return{fieldsOpen:!1,condOpen:!1,value:null};default:throw new Error("Unknown action: "+t.type)}},{fieldsOpen:!1,condOpen:!1,field:null,value:null}),2),r=n[0],a=n[1];return l.a.createElement($.C,null,l.a.createElement($.d,{bare:!0,onClick:()=>a({type:"select-field"})},l.a.createElement(Gn,{style:pi})," ","Filter"),r.fieldsOpen&&l.a.createElement($.B,{position:"bottom-left",style:mi,onClose:()=>a({type:"close"})},l.a.createElement($.s,{onMenuSelect:e=>{a({type:"configure",field:e})},items:ei.map(([e,t])=>({name:e,text:Object(ke.p)(t)}))})),r.condOpen&&l.a.createElement(fi,{field:r.field,op:r.op,value:r.value,dispatch:a,onApply:async function(n){if("date"===(n=zn(Zl(Zl({},n),{},{type:Mn.get(n.field)}))).type&&n.options)if(n.options.month){let e=Object(xe.a)(n.value,Object(de.l)(t),new Date);if(!Object(Pe.a)(e))return void alert("Invalid date format");n.value=Object(Sn.a)(e,"yyyy-MM")}else if(n.options.year){let e=Object(xe.a)(n.value,"yyyy",new Date);if(!Object(Pe.a)(e))return void alert("Invalid date format");n.value=Object(Sn.a)(e,"yyyy")}let r=(await Object(M.send)("rule-validate",{conditions:[n],actions:[]})).error;if(r&&r.conditionErrors.length>0){let e=Object(ke.p)(Rn(n.field));alert(e+": "+_n(r.conditionErrors[0]))}else e(n),a({type:"close"})}}))}var gi={backgroundColor:W.a.n10,borderRadius:4,flexDirection:"row",alignItems:"center",padding:5,paddingLeft:10,marginBottom:10,marginRight:10},hi={color:W.a.p4},bi={color:W.a.p4},Oi={color:W.a.n3},wi={marginLeft:3},vi={width:8,height:8,color:W.a.n4};function Ei({field:e,customName:t,op:n,value:r,options:a,stage:o,style:i,onDelete:c}){let s=e;return"date"===Mn.get(e)&&(7===r.length?s="month":4===r.length&&(s="year")),l.a.createElement($.C,{style:[gi,i]},l.a.createElement("div",null,t?l.a.createElement($.z,{style:hi},t):l.a.createElement(l.a.Fragment,null,l.a.createElement($.z,{style:bi},Rn(s,a))," ",l.a.createElement($.z,{style:Oi},Bn(n))," ",l.a.createElement(pr,{value:r,field:s,inline:!0}))),l.a.createElement($.d,{bare:!0,style:wi,onClick:c},l.a.createElement(Nn.a,{style:vi})))}var ji={flexDirection:"row",alignItems:"center",flexWrap:"wrap",marginTop:10,marginBottom:-5};function Si({filters:e,editingFilter:t,onDelete:n}){return l.a.createElement($.C,{style:ji},e.map((e,r)=>l.a.createElement(Ei,{key:r,customName:e.customName,field:e.field,op:e.op,value:e.value,options:e.options,editing:t===e,onDelete:()=>n(e)})))}function Ci(e,t){throw new Error(t+": "+JSON.stringify(e.str.slice(e.index,10)))}function xi(e){return e.str[e.index]}function Pi(e){if(e.index>=e.str.length)return null;let t=xi(e);return e.index++,t}function ki(e,t){return xi(e)===t&&(Pi(e),!0)}function Ai(e){if("("===xi(e)){Pi(e);let t=Di(e);return")"!==xi(e)&&Ci(e,"Unbalanced parentheses"),Pi(e),t}return function(e){let t="-"===xi(e);t&&Pi(e),/\p{Sc}/u.test(xi(e))&&Pi(e);let n="";for(;xi(e)&&xi(e).match(/[0-9,.]/);){let t=","===Object(ke.h)().separator?".":",";xi(e)===t?Pi(e):n+=Pi(e)}""===n&&Ci(e,"Unexpected character");let r=parseFloat(n.replace(Object(ke.h)().separator,"."));return t?-r:r}(e)}let Di=function(...e){return e.reduce((e,t)=>n=>{let r=e(n);for(;ki(n,t);)r={op:t,left:r,right:e(n)};return r},Ai)}("^","/","*","-","+");function Ii(e,t=null){if(""===e)return t;let n;try{n=function e(t){if("number"===typeof t)return t;let n=t.left,r=t.right,a=t.op;switch(a){case"+":return e(n)+e(r);case"-":return e(n)-e(r);case"*":return e(n)*e(r);case"/":return e(n)/e(r);case"^":return Math.pow(e(n),e(r));default:throw new Error("Unknown operator: "+a)}}(function(e){let t={str:e.replace(/\s/g,""),index:0};return Di(t)}(e))}catch(r){return t}return isNaN(n)?t:n}function Ti(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ti(Object(n),!0).forEach(function(t){Ri(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ti(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ri(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bi=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 91 51",style:Mi({color:"#242134"},e.style)}),o.createElement("path",{fill:"currentColor",d:"M30.256 48.614a3.14 3.14 0 0 0-.989-2.153L10.803 29.063h76.915a3.2 3.2 0 0 0 .315 0c1.584-.084 2.95-1.64 2.867-3.266-.082-1.625-1.598-3.028-3.182-2.943H10.803L29.267 5.49c1.284-1.099 1.456-3.057.385-4.373a2.972 2.972 0 0 0-4.48-.187L.971 23.695a3.163 3.163 0 0 0 0 4.56l24.2 22.766a2.98 2.98 0 0 0 2.205.84c1.669-.08 2.958-1.534 2.88-3.247Z"}));function _i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Li(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_i(Object(n),!0).forEach(function(t){zi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fi=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:Li({color:"#242134"},e.style)}),o.createElement("path",{d:"m9.293 12.95.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z",fill:"currentColor"}));function Ni(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ui(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ni(Object(n),!0).forEach(function(t){$i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ni(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wi=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",style:Ui({color:"#242134"},e.style)}),o.createElement("g",{fill:"#000"},o.createElement("path",{d:"m23.962 17.457-.82-3.297a1.287 1.287 0 0 0-1.56-.934l-3.294.823a1.286 1.286 0 0 0-.343 2.35L19 17.03A9.538 9.538 0 0 1 12 20.604a8.652 8.652 0 0 1-8.085-5.667 1.286 1.286 0 0 0-2.415.884A11.232 11.232 0 0 0 12 23.175a12.108 12.108 0 0 0 9.214-4.8l.839.503a1.286 1.286 0 0 0 1.91-1.415ZM2.422 10.774l3.295-.823a1.286 1.286 0 0 0 .352-2.35l-.972-.583A9.588 9.588 0 0 1 12 3.396a8.652 8.652 0 0 1 8.085 5.667A1.286 1.286 0 0 0 22.5 8.18 11.232 11.232 0 0 0 12 .825 12.242 12.242 0 0 0 2.866 5.68l-.919-.552a1.286 1.286 0 0 0-1.91 1.414l.82 3.297a1.287 1.287 0 0 0 1.246.974 1.311 1.311 0 0 0 .32-.04Z",fill:"currentColor"})));function Gi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gi(Object(n),!0).forEach(function(t){qi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yi=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Hi({color:"#242134"},e.style)}),o.createElement("path",{d:"M21.5 3h-2.75a.25.25 0 0 1-.25-.25V1a1 1 0 0 0-2 0v4.75a.75.75 0 0 1-.75.75.75.75 0 0 1-.75-.75V3.5a.5.5 0 0 0-.5-.5H8.25A.25.25 0 0 1 8 2.751V1a1 1 0 1 0-2 0v4.75a.75.75 0 0 1-.75.75.75.75 0 0 1-.75-.75V3.5A.5.5 0 0 0 4 3H2.5a2 2 0 0 0-2 2v17a2 2 0 0 0 2 2h19a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2ZM21 22H3a.5.5 0 0 1-.5-.5v-12A.5.5 0 0 1 3 9h18a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5Z",fill:"currentColor"}));function Vi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ki(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vi(Object(n),!0).forEach(function(t){Zi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qi=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Ki({color:"#242134"},e.style)}),o.createElement("path",{d:"M12.406 14.905a1 1 0 0 0-.543 1.307 1 1 0 0 1-.217 1.09l-2.828 2.829a2 2 0 0 1-2.828 0L3.868 18.01a2 2 0 0 1 0-2.829L6.7 12.353a1.013 1.013 0 0 1 1.091-.217 1 1 0 0 0 .763-1.849 3.034 3.034 0 0 0-3.268.652l-2.832 2.828a4.006 4.006 0 0 0 0 5.657l2.122 2.121a4 4 0 0 0 5.656 0l2.829-2.828a3.008 3.008 0 0 0 .651-3.27 1 1 0 0 0-1.306-.542Z",fill:"currentColor"}),o.createElement("path",{d:"M7.757 16.241a1.011 1.011 0 0 0 1.414 0l7.779-7.778a1 1 0 0 0-1.414-1.414l-7.779 7.778a1 1 0 0 0 0 1.414Z",fill:"currentColor"}),o.createElement("path",{d:"m21.546 4.574-2.121-2.121a4.006 4.006 0 0 0-5.657 0l-2.829 2.828a3.006 3.006 0 0 0-.651 3.269 1 1 0 1 0 1.849-.764 1 1 0 0 1 .217-1.086l2.828-2.828a2 2 0 0 1 2.829 0l2.121 2.121a2 2 0 0 1 0 2.829L17.3 11.645a1.015 1.015 0 0 1-1.091.217 1 1 0 0 0-.765 1.849 3.026 3.026 0 0 0 3.27-.651l2.828-2.828a4.007 4.007 0 0 0 .004-5.658Z",fill:"currentColor"}));function Ji(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ji(Object(n),!0).forEach(function(t){ec(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ji(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var tc=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Xi({color:"#242134"},e.style)}),o.createElement("path",{d:"M23.119 20 13.772 2.15a2 2 0 0 0-3.543 0L.881 20a2 2 0 0 0 1.772 2.928h18.694A2 2 0 0 0 23.119 20ZM11 8.423a1 1 0 0 1 2 0v6a1 1 0 1 1-2 0Zm1.05 11.51h-.028a1.528 1.528 0 0 1-1.522-1.47 1.476 1.476 0 0 1 1.448-1.53h.028A1.527 1.527 0 0 1 13.5 18.4a1.475 1.475 0 0 1-1.45 1.533Z",fill:"currentColor"}));function nc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nc(Object(n),!0).forEach(function(t){ac(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ac(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oc=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:rc({color:"#242134"},e.style)}),o.createElement("path",{d:"M12 0C1.308 0-4.044 12.925 3.516 20.484 11.075 28.044 24 22.692 24 12 23.992 5.376 18.624.008 12 0zm.01 1.988c5.521.007 9.995 4.48 10.002 10.002 0 8.912-10.774 13.373-17.075 7.072-6.3-6.3-1.839-17.074 7.073-17.074zm6.234 4.588a1 1 0 0 0-.928.442l-6.226 8.45-4.076-3.261a1 1 0 1 0-1.25 1.563l4.888 3.908a1.011 1.011 0 0 0 1.43-.19L18.928 8.2a1 1 0 0 0-.684-1.623z",fill:"currentColor"}));function lc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ic(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lc(Object(n),!0).forEach(function(t){cc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sc=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:ic({color:"#242134"},e.style)}),o.createElement("path",{d:"M12 0a10.286 10.286 0 0 0-6.243 18.45 1.714 1.714 0 0 1 .672 1.36v1.619A2.571 2.571 0 0 0 9 24a1.714 1.714 0 0 0 1.714-1.714V21a1.286 1.286 0 0 1 2.572 0v1.286A1.714 1.714 0 0 0 15 24a2.571 2.571 0 0 0 2.571-2.571V19.81a1.714 1.714 0 0 1 .672-1.36A10.286 10.286 0 0 0 12 0ZM7.714 12.429a2.143 2.143 0 1 1 2.143-2.143 2.143 2.143 0 0 1-2.143 2.143Zm8.572 0a2.143 2.143 0 1 1 2.143-2.143 2.143 2.143 0 0 1-2.143 2.143Z",fill:"currentColor"}));function uc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uc(Object(n),!0).forEach(function(t){fc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pc=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:dc({color:"#242134"},e.style)}),o.createElement("path",{d:"M23.91 9.113a1.785 1.785 0 0 0-1.453-1.227l-6.132-.926-2.714-5.506a1.863 1.863 0 0 0-3.222 0l-2.78 5.552-6.066.88a1.798 1.798 0 0 0-1 3.068l4.428 4.361-1.028 6.055a1.797 1.797 0 0 0 2.607 1.895l5.488-2.865 5.429 2.858a1.797 1.797 0 0 0 2.607-1.895l-1.011-6.128 4.394-4.286a1.786 1.786 0 0 0 .454-1.836Z",fill:"currentColor"}));function mc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mc(Object(n),!0).forEach(function(t){gc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hc=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:yc({color:"#242134"},e.style)}),o.createElement("path",{d:"M7.176 22.5a4.111 4.111 0 0 1-3.17-1.486l-3.62-4.6a1.8 1.8 0 1 1 2.828-2.228l3.6 4.56a.384.384 0 0 0 .379.152.52.52 0 0 0 .408-.197L20.794 2.177a1.8 1.8 0 1 1 2.812 2.246L10.39 20.964A4.12 4.12 0 0 1 7.2 22.5Z",fill:"currentColor"}));function bc(e){let t,n,r;switch(e){case"missed":t=W.a.r1,n=W.a.r10,r=sc;break;case"due":t=W.a.y1,n=W.a.y9,r=tc;break;case"upcoming":t=W.a.p1,n=W.a.p10,r=Yi;break;case"paid":t=W.a.g2,n=W.a.g10,r=hc;break;case"completed":t=W.a.n4,n=W.a.n11,r=pc;break;case"pending":t=W.a.g4,n=W.a.g11,r=Yi;break;case"scheduled":t=W.a.n1,n=W.a.n11,r=Yi;break;case"cleared":t=W.a.g5,n=W.a.n11,r=Qt;break;default:t=W.a.n1,n=W.a.n11,r=oc}return{color:t,backgroundColor:n,Icon:r}}var Oc={width:13,height:13,color:"inherit",marginRight:7},wc={lineHeight:"1em"};function vc({status:e,style:t}){let n=bc(e),r=n.color,a=n.backgroundColor,o=n.Icon;return l.a.createElement($.C,{style:[{color:r,backgroundColor:a,padding:"6px 8px",borderRadius:4,flexDirection:"row",alignItems:"center",flexShrink:0},t]},l.a.createElement(o,{style:Oc}),l.a.createElement($.z,{style:wc},Object(ke.p)(e)))}const Ec=["debit","credit","date"];function jc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Sc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sc(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Cc(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function xc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xc(Object(n),!0).forEach(function(t){kc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ac(e,t,n){let r=e.amount,a=e.date;bs(e.id)&&(r=be(r));let o=r<0?-r:null,l=r>0?r:null;return 0===r&&(t?l=0:o=0),Object(Pe.a)(Object(Hn.a)(a))||(a=null),Pc(Pc({},e),{},{date:a,debit:null!=o?Object(ke.k)(o):"",credit:null!=l?Object(ke.k)(l):""})}function Dc(e,t){let n=e[t],r=t;for(;r>=0;){if(e[r].id===n.parent_id)return e[r];r--}return null}function Ic(e,t){let n=e[t];return n&&n.is_child&&(null==e[t+1]||e[t+1].parent_id!==n.parent_id)}let Tc=l.a.createContext(null);function Mc(){let e=Object(o.useContext)(Tc);return Object(o.useMemo)(()=>Pc(Pc({},e),{},{expanded:t=>"collapse"===e.state.mode?!e.state.ids.has(t):e.state.ids.has(t)}),[e])}function Rc({children:e,initialMode:t="expand"}){let n=Object(s.d)(e=>e.app.lastSplitState),r=Object(s.c)(),a=jc(Object(o.useReducer)((e,t)=>{switch(t.type){case"toggle-split":{let n=new Set([...e.ids]),r=t.id;return n.has(r)?n.delete(r):n.add(r),Pc(Pc({},e),{},{ids:n})}case"open-split":{let n=new Set([...e.ids]),r=t.id;return"collapse"===e.mode?n.delete(r):n.add(r),Pc(Pc({},e),{},{ids:n})}case"set-mode":return Pc(Pc({},e),{},{mode:t.mode,ids:new Set,transitionId:null});case"switch-mode":return null!=e.transitionId?e:Pc(Pc({},e),{},{mode:"expand"===e.mode?"collapse":"expand",transitionId:t.id,ids:new Set});case"finish-switch-mode":return Pc(Pc({},e),{},{transitionId:null});default:throw new Error("Unknown action type: "+t.type)}},n.current||{ids:new Set,mode:t}),2),i=a[0],c=a[1];Object(o.useEffect)(()=>{null!=i.transitionId&&setTimeout(()=>{c({type:"finish-switch-mode"})},250)},[i.transitionId]),Object(o.useEffect)(()=>{null==i.transitionId&&r({type:"SET_LAST_SPLIT_STATE",splitState:i})},[i]);let u=Object(o.useMemo)(()=>({state:i,dispatch:c}),[i,c]);return l.a.createElement(Tc.Provider,{value:u},e)}var Bc={color:W.a.n4,fontWeight:300,zIndex:200};const _c=l.a.memo(({hasSelected:e,showAccount:t,showCategory:n,showBalance:r})=>{let a=Object(At.d)();return l.a.createElement(kt.h,{borderColor:W.a.n9,backgroundColor:"white",style:Bc},l.a.createElement(kt.i,{exposed:!0,focused:!1,selected:e,width:20,onSelect:()=>a({type:"select-all"})}),l.a.createElement(kt.a,{value:"Date",width:110}),t&&l.a.createElement(kt.a,{value:"Account",width:"flex"}),l.a.createElement(kt.a,{value:"Payee",width:"flex"}),l.a.createElement(kt.a,{value:"Notes",width:"flex"}),n&&l.a.createElement(kt.a,{value:"Category",width:"flex"}),l.a.createElement(kt.a,{value:"Payment",width:80,textAlign:"right"}),l.a.createElement(kt.a,{value:"Deposit",width:80,textAlign:"right"}),r&&l.a.createElement(kt.a,{value:"Balance",width:85,textAlign:"right"}),l.a.createElement(kt.e,{width:21,truncate:!1}),l.a.createElement(kt.a,{value:"",width:15+W.c.scrollbarWidth}))});var Lc={flexDirection:"row",alignItems:"center"},zc={marginRight:5,flexShrink:0},Fc={overflow:"hidden",textOverflow:"ellipsis"};var Nc={padding:1},Uc={visibility:"hidden"};function $c({id:e,focused:t,selected:n,status:r,isChild:a,onEdit:o,onUpdate:i}){let c="cleared"===r||null==r,s=bc(r),u={color:"cleared"===r?W.a.g5:"missed"===r?W.a.r6:"due"===r?W.a.y5:n?W.a.b7:W.a.n7};return l.a.createElement(kt.a,{name:"cleared",width:"auto",focused:t,style:Nc,plain:!0},l.a.createElement(kt.b,{style:[{padding:3,border:"1px solid transparent",borderRadius:50,":focus":{border:"1px solid "+u.color,boxShadow:`0 1px 2px ${u.color}`},cursor:c?"pointer":"default"},a&&Uc],onEdit:()=>o(e,"cleared"),onSelect:function(){c&&i("cleared",!("cleared"===r))}},l.a.createElement(s.Icon,{style:{width:13,height:13,color:u.color,marginTop:"due"===r?-1:0}})))}var Wc={color:W.a.n8};function Gc({id:e,payeeId:t,focused:n,inherited:r,payees:a,accounts:i,valueStyle:c,transaction:s,payee:u,transferAcct:d,importedPayee:f,isPreview:p,onEdit:m,onUpdate:y,onCreatePayee:g,onManagePayees:h}){let b=Object(o.useRef)(!1);return l.a.createElement(kt.c,{width:"flex",name:"payee",value:t,valueStyle:[c,r&&Wc],formatter:e=>(function(e,t,n){let r=e.payee;if(n){const t=e.amount>0?Bi:Qn;return l.a.createElement($.C,{style:Lc},l.a.createElement(t,{width:10,height:8,style:zc}),l.a.createElement("div",{style:Fc},n.name))}return t&&!t.transfer_acct?t.name:r&&r.startsWith("new:")?r.slice("new:".length):""})(s,u,d),exposed:n,onExpose:!p&&(t=>m(e,t)),onUpdate:async e=>{if(y("payee",e),e&&e.startsWith("new:")&&!b.current){b.current=!0;let t=await g(e.slice("new:".length));y("payee",t),b.current=!1}}},({onBlur:e,onKeyDown:n,onUpdate:r,onSave:o,shouldSaveFromKey:c,inputStyle:u})=>l.a.createElement(l.a.Fragment,null,l.a.createElement(Vo,{payees:a,accounts:i,value:t,shouldSaveFromKey:c,inputProps:{onBlur:e,onKeyDown:n,style:u},showManagePayees:!0,tableBehavior:!0,defaultFocusTransferPayees:s.is_child,focused:!0,onUpdate:r,onSelect:o,onManagePayees:()=>h(t)})))}var Hc={flex:1,flexDirection:"row",alignItems:"stretch"};function qc({scheduleId:e,children:t}){let n=Ce().schedules.find(t=>t.id===e);if(null==n)return t;let r=n._date&&!!n._date.frequency,a={width:13,height:13,marginLeft:5,marginRight:3,color:"inherit"};var o=Pc(Pc({},a),{},{transform:"translateY(-1px)"});return l.a.createElement($.C,{style:Hc},l.a.createElement(kt.a,{exposed:!0},()=>r?l.a.createElement(Wi,{style:a}):l.a.createElement(Yi,{style:o})),t)}var Yc={color:W.a.n5,fontStyle:"italic"},Vc={opacity:.5},Kc={width:110,backgroundColor:W.a.n11,borderBottomWidth:0},Zc={flex:1,backgroundColor:W.a.n11,opacity:0},Qc={borderLeftWidth:1},Jc={lineHeight:0},Xc={borderLeftWidth:1},es={width:13,height:13,color:W.a.n7},ts={alignItems:"flex-start"},ns={padding:0},rs={alignSelf:"flex-start",color:W.a.n6,borderRadius:4,transition:"none","&:hover":{backgroundColor:"rgba(100, 100, 100, .15)",color:W.a.n5}},as={flexDirection:"row",alignItems:"center",alignSelf:"stretch",borderRadius:4,flex:1,padding:4},os={fontStyle:"italic",userSelect:"none"},ls={fontStyle:"italic",color:"#c0c0c0",fontWeight:300},is={fontStyle:"italic",fontWeight:300,color:W.a.p8},cs={fontStyle:"italic"},ss={fontStyle:"italic"};const us=l.a.memo(function(e){let t=e.transaction,n=e.editing,r=e.backgroundColor,a=void 0===r?"white":r,i=e.showAccount,c=e.showBalance,s=e.showZeroInDeposit,u=e.style,d=e.hovered,f=e.selected,p=e.highlighted,m=e.added,y=e.matched,g=e.expanded,b=e.inheritedFields,O=e.focusedField,w=e.categoryGroups,v=e.payees,E=e.accounts,j=e.balance,S=e.dateFormat,C=void 0===S?"MM/dd/yyyy":S,x=e.onSave,P=e.onEdit,k=e.onHover,A=e.onDelete,D=e.onSplit,I=e.onManagePayees,T=e.onCreatePayee,M=e.onToggleSplit,R=Object(At.d)(),B=jc(Object(o.useState)(s),2),_=B[0],L=B[1],z=jc(Object(o.useState)(t),2),F=z[0],N=z[1],U=jc(Object(o.useState)(Ac(t,s)),2),G=U[0],H=U[1],q=bs(G.id);function Y(e,n){if(G[e]!==n){let r=Pc(Pc({},G),{},{[e]:n});if("account"===e&&n&&Object(h.b)(E)[n].offbudget&&(r.category=null),"credit"===e?r.debit="":"debit"===e&&(r.credit=""),"payee"===e&&n&&n.startsWith("new:"))H(r);else{let e=function(e,t,n){let r,a=e.debit,o=e.credit,l=e.date,i=Cc(e,Ec);if(""!==a){let e=Ii(a,null);r=null!=e?-e:null}else r=Ii(o,null);return r=null!=r?Object(ke.b)(r):t.amount,null==l&&(l=t.date||Object(de.c)()),Pc(Pc({},i),{},{date:l,amount:r})}(r,t);H(Ac(e,s)),x(e)}}}t===F&&s===_||(H(Ac(t,s)),N(t),L(s));let V=G.id,K=G.debit,Z=G.credit,Q=G.payee,J=G.imported_payee,X=G.notes,ee=G.date,te=G.account,ne=G.category,re=G.cleared,ae=G.is_parent,oe=G._unmatched,le=void 0!==oe&&oe,ie=v&&Q&&Object(h.e)(v)[Q],ce=E&&te&&Object(h.b)(E)[te],se=ie&&ie.transfer_acct&&Object(h.b)(E)[ie.transfer_acct],ue=G.is_child,fe=f?W.a.b8:W.a.border,pe=se&&0===se.offbudget,me=ce&&1===ce.offbudget,ye=m?{fontWeight:600}:null,ge=d||"select"===O;var he={color:"missed"===X?W.a.r6:"due"===X?W.a.y4:f?W.a.b5:W.a.n6,backgroundColor:"missed"===X?W.a.r10:"due"===X?W.a.y9:f?W.a.b8:W.a.n10,margin:"0 5px",padding:"3px 7px",borderRadius:4};return l.a.createElement(kt.h,{borderColor:fe,backgroundColor:f?W.a.selected:ge?W.a.hover:q?"#fcfcfc":a,highlighted:p,style:[u,q&&Yc,le&&Vc],onMouseEnter:()=>k&&k(G.id)},ue&&l.a.createElement(kt.e,{borderColor:"transparent",width:110,style:Kc}),ue&&i&&l.a.createElement(kt.e,{borderColor:"transparent",style:Zc}),hs(G.id)?ue?l.a.createElement(kt.d,{onDelete:()=>A&&A(G.id),exposed:d||n,style:[ue&&Qc,Jc]}):l.a.createElement(kt.a,{width:20}):l.a.createElement(kt.i,{exposed:d||f||n,focused:"select"===O,onSelect:()=>{R({type:"select",id:G.id})},onEdit:()=>P(V,"select"),selected:f,style:[ue&&Xc],value:y&&l.a.createElement(Qi,{style:es})}),!ue&&l.a.createElement(kt.c,{name:"date",width:110,exposed:"date"===O,value:ee,valueStyle:ye,formatter:e=>e?Object(Sn.a)(Object(Hn.a)(e),C):"",onExpose:!q&&(e=>P(V,e)),onUpdate:e=>{Y("date",e)}},({onBlur:e,onKeyDown:t,onUpdate:n,onSave:r,shouldSaveFromKey:a,inputStyle:o})=>l.a.createElement(Eo.a,{value:ee||"",dateFormat:C,inputProps:{onBlur:e,onKeyDown:t,style:o},shouldSaveFromKey:a,tableBehavior:!0,onUpdate:n,onSelect:r})),!ue&&i&&l.a.createElement(kt.c,{name:"account",width:"flex",value:te,formatter:e=>{let t=e&&Object(h.b)(E)[e];return t?t.name:""},valueStyle:ye,exposed:"account"===O,onExpose:!q&&(e=>P(V,e)),onUpdate:async e=>{e&&Y("account",e)}},({onBlur:e,onKeyDown:t,onUpdate:n,onSave:r,shouldSaveFromKey:a,inputStyle:o})=>l.a.createElement(no,{value:te,accounts:E,shouldSaveFromKey:a,tableBehavior:!0,focused:!0,inputProps:{onBlur:e,onKeyDown:t,style:o},onUpdate:n,onSelect:r})),(()=>{let e=l.a.createElement(Gc,{id:V,payeeId:Q,focused:"payee"===O,inherited:b&&b.has("payee"),payees:v,accounts:E,valueStyle:ye,transaction:G,payee:ie,transferAcct:se,importedPayee:J,isPreview:q,onEdit:P,onUpdate:Y,onCreatePayee:T,onManagePayees:I});return G.schedule?l.a.createElement(qc,{scheduleId:G.schedule},e):e})(),q?l.a.createElement(kt.a,{name:"notes",width:"flex"}):l.a.createElement(kt.f,{width:"flex",name:"notes",exposed:"notes"===O,focused:"notes"===O,value:X||"",valueStyle:ye,onExpose:!q&&(e=>P(V,e)),inputProps:{value:X||"",onUpdate:Y.bind(null,"notes")}}),q?l.a.createElement(kt.a,{width:"flex",style:ts,exposed:!0},()=>l.a.createElement($.C,{style:he},Object(ke.p)(X))):ae?l.a.createElement(kt.a,{name:"category",width:"flex",focused:"category"===O,style:ns,plain:!0},l.a.createElement(kt.b,{style:rs,disabled:hs(G.id),onEdit:()=>P(V,"category"),onSelect:()=>M(V)},l.a.createElement($.C,{style:as},ae&&l.a.createElement(Fi,{style:{width:14,height:14,color:"currentColor",transition:"transform .08s",transform:g?"rotateZ(0)":"rotateZ(-90deg)"}}),l.a.createElement($.z,{style:os},"Split")))):pe||me||q?l.a.createElement(kt.f,{name:"category",width:"flex",exposed:"category"===O,focused:"category"===O,onExpose:!q&&(e=>P(V,e)),value:ae?"Split":me?"Off Budget":pe?"Transfer":"",valueStyle:ye,style:ls,inputProps:{readOnly:!0,style:{fontStyle:"italic"}}}):l.a.createElement(kt.c,{name:"category",width:"flex",value:ne,formatter:e=>e?function(e,t){return e?e[t]:""}(Object(h.d)(w)[e],"name"):G.id?"Categorize":"",exposed:"category"===O,onExpose:e=>P(V,e),valueStyle:ne?ye:is,onUpdate:async e=>{"split"===e?D(G.id):Y("category",e)}},({onBlur:e,onKeyDown:t,onUpdate:n,onSave:r,shouldSaveFromKey:a,inputStyle:o})=>l.a.createElement(vo,{categoryGroups:w,value:ne,focused:!0,tableBehavior:!0,showSplitOption:!ue&&!ae,shouldSaveFromKey:a,inputProps:{onBlur:e,onKeyDown:t,style:o},onUpdate:n,onSelect:r})),l.a.createElement(kt.f,{type:"input",width:80,name:"debit",exposed:"debit"===O,focused:"debit"===O,value:null==K?"":K,valueStyle:ye,textAlign:"right",title:K,onExpose:!q&&(e=>P(V,e)),style:[ae&&cs,W.c.tnum],inputProps:{value:K,onUpdate:Y.bind(null,"debit")}}),l.a.createElement(kt.f,{type:"input",width:80,name:"credit",exposed:"credit"===O,focused:"credit"===O,value:null==Z?"":Z,valueStyle:ye,textAlign:"right",title:Z,onExpose:!q&&(e=>P(V,e)),style:[ae&&ss,W.c.tnum],inputProps:{value:Z,onUpdate:Y.bind(null,"credit")}}),c&&l.a.createElement(kt.a,{name:"balance",value:null==j||ue||q?"":Object(ke.k)(j),valueStyle:{color:j<0?W.a.r4:W.a.g4},style:W.c.tnum,width:85,textAlign:"right"}),l.a.createElement($c,{id:V,focused:"cleared"===O,selected:f,isPreview:q,status:q?X:re?"cleared":null,isChild:ue,onEdit:P,onUpdate:Y}),l.a.createElement(kt.a,{width:15}))});var ds={flexDirection:"row",alignItems:"center",padding:"0 5px"},fs={fontWeight:500},ps={flex:1},ms={marginLeft:15,padding:"4px 10px"};function ys({error:e,isDeposit:t,onAddSplit:n,style:r}){switch(e.type){case"SplitTransactionError":if(1===e.version)return l.a.createElement($.C,{style:[ds,r],"data-testid":"transaction-error"},l.a.createElement($.z,null,"Amount left:"," ",l.a.createElement($.z,{style:fs},Object(ke.k)(t?e.difference:-e.difference))),l.a.createElement($.C,{style:ps}),l.a.createElement($.d,{style:ms,primary:!0,onClick:n},"Add Split"));break;default:return null}}function gs(e,t){return[{id:"temp",date:t||Object(de.c)(),account:e||null,cleared:!1,amount:0}]}function hs(e){return-1!==e.indexOf("temp")}function bs(e){return-1!==e.indexOf("preview/")}var Os={borderBottom:"1px solid #ebebeb",paddingBottom:6,backgroundColor:"white"},ws={marginTop:-1},vs={flexDirection:"row",alignItems:"center",justifyContent:"flex-end",marginTop:6,marginRight:20},Es={marginRight:10,padding:"4px 10px"},js={padding:"4px 10px"};function Ss({transactions:e,accounts:t,currentAccountId:n,categoryGroups:r,payees:a,editingTransaction:o,hoveredTransaction:i,focusedField:c,showAccount:s,showCategory:u,showBalance:d,dateFormat:f,onHover:p,onClose:m,onSplit:y,onEdit:g,onDelete:h,onSave:b,onAdd:O,onAddSplit:w,onManagePayees:v,onCreatePayee:E}){const j=e[0].error,S=e[0].amount>0;return l.a.createElement($.C,{style:Os,"data-testid":"new-transaction",onKeyDown:e=>{27===e.keyCode&&m()},onMouseLeave:()=>p(null)},e.map((e,n)=>l.a.createElement(us,{key:e.id,editing:o===e.id,hovered:i===e.id,transaction:e,showAccount:s,showCategory:u,showBalance:d,focusedField:o===e.id&&c,showZeroInDeposit:S,accounts:t,categoryGroups:r,payees:a,dateFormat:f,expanded:!0,onHover:p,onEdit:g,onSave:b,onSplit:y,onDelete:h,onAdd:O,onManagePayees:v,onCreatePayee:E,style:ws})),l.a.createElement($.C,{style:vs},l.a.createElement($.d,{style:Es,onClick:()=>m(),"data-testid":"cancel-button"},"Cancel"),j?l.a.createElement(ys,{error:j,isDeposit:S,onAddSplit:()=>w(e[0].id)}):l.a.createElement($.d,{style:js,primary:!0,onClick:O,"data-testid":"add-button"},"Add")))}var Cs={transform:"translate(-5px, 2px)"},xs={flex:1,cursor:"default"},Ps={flex:1,overflow:"hidden"},ks={position:"absolute",top:-20,left:0,right:0,height:20,backgroundColor:"red",boxShadow:"0 0 6px rgba(0, 0, 0, .20)"};class As extends l.a.Component{constructor(...e){super(...e),this.container=l.a.createRef(),this.state={highlightedRows:null},this.renderRow=(({item:e,index:t,position:n,editing:r,focusedFied:a,onEdit:o})=>{const i=this.state.highlightedRows,c=this.props,s=c.transactions,u=c.selectedItems,d=c.hoveredTransaction,f=c.accounts,p=c.categoryGroups,m=c.payees,y=c.showAccount,g=c.showCategory,h=c.balances,b=c.dateFormat,O=void 0===b?"MM/dd/yyyy":b,w=c.tableNavigator,v=c.isNew,E=c.isMatched,j=c.isExpanded;let S=e,C=d===S.id,x=u.has(S.id),P=!x&&!!i&&i.has(S.id),k=this.getParent(S,t),A=k&&k.amount>0,D=j&&j((k||S).id),I=D&&k&&k.error||S.error;return l.a.createElement(l.a.Fragment,null,(!D||Ic(s,t))&&I&&"SplitTransactionError"===I.type&&l.a.createElement($.B,{position:"bottom-right",width:250,forceTop:n,forceLayout:!0,style:Cs},l.a.createElement(ys,{error:I,isDeposit:A,onAddSplit:()=>this.props.onAddSplit(S.id)})),l.a.createElement(us,{editing:r,transaction:S,showAccount:y,showCategory:g,showBalance:!!h,hovered:C,selected:x,highlighted:P,added:v&&v(S.id),expanded:j&&j(S.id),matched:E&&E(S.id),showZeroInDeposit:A,balance:h&&h[S.id]&&h[S.id].balance,focusedField:r&&w.focusedField,accounts:f,categoryGroups:p,payees:m,inheritedFields:k&&k.payee===S.payee?new Set(["payee"]):new Set,dateFormat:O,onHover:this.props.onHover,onEdit:w.onEdit,onSave:this.props.onSave,onDelete:this.props.onDelete,onSplit:this.props.onSplit,onManagePayees:this.props.onManagePayees,onCreatePayee:this.props.onCreatePayee,onToggleSplit:this.props.onToggleSplit}))})}componentDidMount(){this.highlight=(e=>{this.setState({highlightedRows:new Set(e)},()=>{this.setState({highlightedRows:null})})})}componentWillReceiveProps(e){!this.props.isAdding&&e.isAdding&&this.props.newNavigator.onEdit("temp","date")}componentDidUpdate(){this._cachedParent=null}getParent(e,t){let n=this.props.transactions;return this._cachedParent&&this._cachedParent.id===e.parent_id?this._cachedParent:e.parent_id?(this._cachedParent=Dc(n,t),this._cachedParent):null}render(){let e=this.props,t=e.tableNavigator,n=e.tableRef,r=e.dateFormat,a=void 0===r?"MM/dd/yyyy":r,o=e.newNavigator,i=e.renderEmpty,c=e.onHover,s=e.onScroll;return l.a.createElement($.C,{innerRef:this.container,style:[xs,e.style]},l.a.createElement($.C,null,l.a.createElement(_c,{hasSelected:e.selectedItems.size>0,showAccount:e.showAccount,showCategory:e.showCategory,showBalance:!!e.balances}),e.isAdding&&l.a.createElement($.C,o.getNavigatorProps({onKeyDown:t=>e.onCheckNewEnter(t)}),l.a.createElement(Ss,{transactions:e.newTransactions,editingTransaction:o.editingId,hoveredTransaction:e.hoveredTransaction,focusedField:o.focusedField,accounts:e.accounts,currentAccountId:e.currentAccountId,categoryGroups:e.categoryGroups,payees:this.props.payees||[],showAccount:e.showAccount,showCategory:e.showCategory,showBalance:!!e.balances,dateFormat:a,onClose:e.onCloseAddTransaction,onAdd:this.props.onAddTemporary,onAddSplit:this.props.onAddSplit,onSplit:this.props.onSplit,onEdit:o.onEdit,onSave:this.props.onSave,onDelete:this.props.onDelete,onHover:this.props.onHover,onManagePayees:this.props.onManagePayees,onCreatePayee:this.props.onCreatePayee}))),l.a.createElement($.C,{style:[Ps],"data-testid":"transaction-table",onMouseLeave:()=>c(null)},l.a.createElement(kt.l,{navigator:t,ref:n,items:e.transactions,renderItem:this.renderRow,renderEmpty:i,loadMore:e.loadMoreTransactions,isSelected:t=>e.selectedItems.has(t),onKeyDown:t=>e.onCheckEnter(t),onScroll:s}),e.isAdding&&l.a.createElement("div",{key:"shadow",style:ks})))}}let Ds=l.a.forwardRef((e,t)=>{let n=jc(Object(o.useState)(null),2),r=n[0],a=n[1],i=jc(Object(o.useState)(e.hoveredTransaction),2),c=i[0],s=i[1],u=jc(Object(o.useState)(!1),2),d=u[0],f=u[1],p=Mc(),m=Object(o.useRef)(null),y=Object(o.useRef)(null),g=function(e,t){return Object(o.useMemo)(()=>(function(n){[e,t].forEach(e=>{"function"===typeof e?e(n):null!=e&&(e.current=n)})}),[e,t])}(y,t),h=Object(o.useMemo)(()=>{let t;if(null!=p.state.transitionId){let n=e.transactions.findIndex(e=>e.id===p.state.transitionId);t=e.transactions.filter((e,t)=>{if(e.parent_id){if(t>=n)return p.expanded(e.parent_id);if(m.current)return m.current.expanded(e.parent_id)}return!0})}else m.current&&null!=m.current.state.transitionId&&(y.current.anchor(),y.current.setRowAnimation(!1)),m.current=p,t=e.transactions.filter(e=>!e.parent_id||p.expanded(e.parent_id));return m.current=p,t},[e.transactions,p]);Object(o.useEffect)(()=>{y.current.isAnchored()&&(y.current.unanchor(),y.current.setRowAnimation(!0))},[m.current]);let b=Object(kt.o)(r,P),O=Object(kt.o)(h,P),w=Object(o.useRef)(!1),v=Object(o.useRef)({newTransactions:r,newNavigator:b,tableNavigator:O}),E=Object(o.useRef)(!1),j=Object(o.useRef)(!1),S=jc(Object(o.useState)({}),2),C=(S[0],S[1]),x=Object(At.e)();function P(t){let n=["select","date","account","payee","notes","category","debit","credit","cleared"];return n=t.is_child?["select","payee","notes","category","debit","credit"]:n.filter(t=>(e.showAccount||"account"!==t)&&(e.showCategory||"category"!==t)),bs(t.id)&&(n=["select","cleared"]),hs(t.id)&&(n=n.slice(1)),n}function k(t){E.current?j.current=t:t(e)}Object(o.useLayoutEffect)(()=>{v.current={newTransactions:r,newNavigator:b,tableNavigator:O,transactions:e.transactions}}),d!==e.isAdding&&(!d&&e.isAdding&&a(gs(e.currentAccountId)),f(e.isAdding)),Object(o.useEffect)(()=>{if(w.current){if(null==r[0].account)e.addNotification({type:"error",message:"Account is a required field"}),b.onEdit("temp","account");else{let t=v.current.newTransactions,n=t.length>0?t[0].date:null;a(gs(e.currentAccountId,n)),b.onEdit("temp","date"),e.onAdd(t)}w.current=!1}}),Object(o.useEffect)(()=>{E.current&&j.current&&(j.current(e),j.current=null),E.current=!1},[r,e.transactions]);let A=Object(o.useCallback)(()=>{w.current=!0,C({})},[e.onAdd,b.onEdit]),D=Object(o.useCallback)(async t=>{if(E.current=!0,hs(t.id)){e.onApplyRules&&(t=await e.onApplyRules(t));let n=v.current.newTransactions;a(tt(n,t).data)}else e.onSave(t)},[e.onSave]),I=Object(o.useCallback)(e=>{s(e)},[]),T=Object(o.useCallback)(e=>{if(hs(e)){let t=v.current.newTransactions;if(e===t[0].id)return;a(nt(t,e).data)}},[]),M=Object(o.useMemo)(()=>t=>{if(hs(t)){let e=v.current.newNavigator,n=rt(v.current.newTransactions,t),r=n.data,o=n.diff;a(r),e.onEdit(o.added[0].id,v.current.newNavigator.focusedField)}else{let n=v.current.transactions.find(e=>e.id===t),r=e.onSplit(t);p.dispatch({type:"open-split",id:n.id});let a=v.current.tableNavigator;null==n.amount?a.onEdit(n.id,"debit"):a.onEdit(r,a.focusedField)}},[e.onSplit,p.dispatch]),R=Object(o.useCallback)(t=>{if(hs(t)){let e=et(v.current.newTransactions,t),n=e.data,r=e.diff;a(n),b.onEdit(r.added[0].id,v.current.newNavigator.focusedField)}else{let n=e.onAddSplit(t);O.onEdit(n,v.current.tableNavigator.focusedField)}},[e.onAddSplit]);let B=Object(o.useCallback)(e=>p.dispatch({type:"toggle-split",id:e}),[p.dispatch]);return l.a.createElement(As,Object.assign({tableRef:g},e,{transactions:h,selectedItems:x,hoveredTransaction:c,isExpanded:p.expanded,onHover:I,onSave:D,onDelete:T,onSplit:M,onCheckNewEnter:function(e){if(13===e.keyCode)if(e.metaKey)e.stopPropagation(),A();else if(!e.shiftKey){function t(e){let t=e.current.newTransactions;return t[t.length-1]}b.editingId===t(v).id&&e.stopPropagation(),k(()=>{let e=t(v),n=e.parent_id||e.is_parent;v.current.newTransactions[0].error&&b.editingId===e.id?R(e.id):"debit"!==b.focusedField&&"credit"!==b.focusedField&&"cleared"!==b.focusedField||b.editingId!==e.id||n&&e.error||A()})}},onCheckEnter:function(e){if(13===e.keyCode&&!e.shiftKey){let t=O.editingId,n=O.focusedField;k(r=>{let a=v.current.transactions,o=a.findIndex(e=>e.id===t),l=Dc(a,o);Ic(a,o)&&l&&l.error&&"select"!==n&&(e.stopPropagation(),R(t))})}},onAddTemporary:A,onAddSplit:R,onCloseAddTransaction:function(){a(gs(e.currentAccountId)),e.onCloseAddTransaction()},onToggleSplit:B,newTransactions:r,tableNavigator:O,newNavigator:b}))});function Is(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ts(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Is(Object(n),!0).forEach(function(t){Ms(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Is(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ms(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}async function Rs(e){let t=await Object(M.send)("transactions-batch-update",Ts(Ts({},e),{},{learnCategories:!0}));return t.length>0?{updates:t}:{}}async function Bs(e,t,n){let r=await Rs(e);n(function(e,t){return Qe(Object(ke.c)(t,Je(e)))}(t.newTransaction,r),Object(ke.c)(r,t.data))}var _s={backgroundColor:"white"};function Ls({tableRef:e,transactions:t,allTransactions:n,loadMoreTransactions:r,account:a,accounts:i,categoryGroups:c,payees:s,balances:d,showAccount:f,headerContent:p,animated:m,isAdding:y,isNew:g,isMatched:h,isFiltered:b,dateFormat:O,addNotification:w,renderEmpty:v,onChange:E,onRefetch:j,onCloseAddTransaction:S,onCreatePayee:C}){let x=Object(o.useRef)(),P=Object(u.g)();Object(o.useLayoutEffect)(()=>{x.current=t},[t]);let k=Object(o.useCallback)(async e=>{e=at(e),await Rs({added:e}),j()},[]),A=Object(o.useCallback)(async e=>{let t=tt(x.current,e);if(t.diff.updated.length>0){!!t.diff.updated[0].date?(t.diff.updated[0].sort_order=Date.now(),await Rs(t.diff),j()):(E(t.newTransaction,t.data),Bs(t.diff,t,E))}},[]),D=Object(o.useCallback)(e=>{const t=et(x.current,e);return E(t.newTransaction,t.data),Bs(t.diff,t,E),t.diff.added[0].id},[]),I=Object(o.useCallback)(e=>{const t=rt(x.current,e);return E(t.newTransaction,t.data),Bs(t.diff,t,E),t.diff.added[0].id},[]),T=Object(o.useCallback)(async e=>{let t=await Object(M.send)("rules-run",{transaction:e}),n=Object(ke.g)(e,t),r=Ts({},e);return n&&Object.keys(n).forEach(e=>{null!=r[e]&&""!==r[e]&&0!==r[e]&&!1!==r[e]||(r[e]=n[e])}),r},[]),R=Object(o.useCallback)(e=>{P.push("/payees",{selectedPayee:e})},[P]);return l.a.createElement(Ds,{ref:e,transactions:n,loadMoreTransactions:r,accounts:i,categoryGroups:c,payees:s,balances:d,showAccount:f,showCategory:!0,animated:m,currentAccountId:a&&a.id,isAdding:y,isNew:g,isMatched:h,isFiltered:b,dateFormat:O,addNotification:w,headerContent:p,renderEmpty:v,onSave:A,onApplyRules:T,onSplit:I,onCloseAddTransaction:S,onAdd:k,onAddSplit:D,onManagePayees:R,onCreatePayee:C,style:_s})}const zs=["sort_order"];function Fs(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ns(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Us(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Us(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Us(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ws(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$s(Object(n),!0).forEach(function(t){Gs(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Gs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Hs={backgroundColor:"white",flex:1,alignItems:"center",borderTopWidth:1,borderColor:W.a.n9},qs={width:550,marginTop:75,fontSize:15,alignItems:"center"},Ys={textAlign:"center",lineHeight:"1.4em"},Vs={marginTop:20},Ks={marginTop:20,fontSize:13,color:W.a.n5};function Zs({onAdd:e}){return l.a.createElement($.C,{style:Hs},l.a.createElement($.C,{style:qs},l.a.createElement($.z,{style:Ys},"For Actual to be useful, you need to ",l.a.createElement("strong",null,"add an account"),". You can link an account to automatically download transactions, or manage it locally yourself."),l.a.createElement($.d,{primary:!0,style:Vs,onClick:e},"Add account"),l.a.createElement($.C,{style:Ks},"In the future, you can add accounts from the sidebar.")))}var Qs=Ws(Ws({flexDirection:"row",alignSelf:"center",backgroundColor:"white"},W.c.shadow),{},{borderRadius:4,marginTop:5,marginBottom:15,padding:10}),Js={flexDirection:"row",alignItems:"center"},Xs={color:W.a.g4,flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},eu={width:13,height:13,color:W.a.g5,marginRight:3},tu={color:W.a.n3},nu={fontStyle:"italic",textAlign:"center"},ru={fontWeight:700},au={marginLeft:15},ou={marginLeft:15};function lu({balanceQuery:e,targetBalance:t,onDone:n,onCreateTransaction:r}){let a=Object(Pt.a)({name:e.name+"-cleared",value:0,query:e.query.filter({cleared:!0})}),o=t-a;return l.a.createElement($.C,{style:Qs},l.a.createElement($.C,{style:Js},0===o?l.a.createElement($.C,{style:Xs},l.a.createElement(Qt,{style:eu}),"All reconciled!"):l.a.createElement($.C,{style:tu},l.a.createElement($.z,{style:nu},"Your cleared balance"," ",l.a.createElement("strong",null,Object(St.a)(a,"financial"))," needs"," ",l.a.createElement("strong",null,(o>0?"+":"")+Object(St.a)(o,"financial"))," ","to match",l.a.createElement("br",null)," your bank","'","s balance of"," ",l.a.createElement($.z,{style:ru},Object(St.a)(t,"financial")))),l.a.createElement($.C,{style:au},l.a.createElement($.d,{primary:!0,onClick:n},"Done Reconciling")),0!==o&&l.a.createElement($.C,{style:ou},l.a.createElement($.d,{onClick:()=>r(o)},"Create Reconciliation Transaction"))))}var iu={padding:"5px 8px"},cu={margin:"7px 0"};function su({account:e,onReconcile:t,onClose:n}){let r=Object(Pt.a)(Te(e));return l.a.createElement($.B,{position:"bottom-right",width:275,onClose:n},l.a.createElement($.C,{style:iu},l.a.createElement($.z,null,"Enter the current balance of your bank account that you want to reconcile with:"),l.a.createElement("form",{onSubmit:function(e){let a=e.target.elements[0],o=Object(ke.e)(a.value);t(null==o?r:o),n()}},null!=r&&l.a.createElement($.l,null,l.a.createElement($.n,{defaultValue:Object(St.a)(r,"financial"),style:cu})),l.a.createElement($.d,{primary:!0},"Reconcile"))))}var uu={color:"inherit",transform:"rotateZ(90deg)"};function du({onClick:e}){return l.a.createElement($.d,{bare:!0,onClick:e},l.a.createElement(Bt.a,{width:15,height:15,style:uu}))}var fu={padding:0};function pu({onClose:e,children:t}){return l.a.createElement($.B,{position:"bottom-right",width:200,style:fu,onClose:e},t)}function mu({account:e,canSync:t,syncEnabled:n,showBalances:r,canShowBalances:a,onClose:i,onReconcile:c,onMenuSelect:s}){let u=Ns(Object(o.useState)("default"),2),d=u[0],f=u[1];return"reconcile"===d?l.a.createElement(su,{account:e,onClose:i,onReconcile:c}):l.a.createElement(pu,{onClose:i},l.a.createElement($.s,{onMenuSelect:e=>{"reconcile"===e?f("reconcile"):s(e)},items:[a&&{name:"toggle-balance",text:(r?"Hide":"Show")+" Running Balance"},{name:"export",text:"Export"},{name:"reconcile",text:"Reconcile"},n&&e&&!e.closed&&(t?{name:"unlink",text:"Unlink Account"}:{name:"link",text:"Link Account"}),e.closed?{name:"reopen",text:"Reopen Account"}:{name:"close",text:"Close Account"}].filter(e=>e)}))}function yu({onClose:e,onMenuSelect:t}){return l.a.createElement(pu,{onClose:e},l.a.createElement($.s,{onMenuSelect:e=>{t(e)},items:[{name:"export",text:"Export"}]}))}var gu={marginLeft:15,backgroundColor:W.a.n10,borderRadius:4,padding:"4px 6px",color:W.a.n5},hu={fontWeight:600};function bu({name:e,balance:t}){return l.a.createElement($.z,{style:gu},e," ",l.a.createElement($.z,{style:hu},Object(St.a)(t,"financial")))}function Ou({selectedItems:e}){let t=`selected-balance-${[...e].join("-")}`,n=Object(Pt.a)({name:t,query:Object(g.c)("transactions").filter({id:{$oneof:[...e]},parent_id:{$oneof:[...e]}}).select("id")}),r=new Set((n||[]).map(e=>e.id)),a=[...e].filter(e=>!r.has(e)),o=Object(Pt.a)({name:t+"-sum",query:Object(g.c)("transactions").filter({id:{$oneof:a}}).options({splits:"all"}).calculate({$sum:"$amount"})});return null==o?null:l.a.createElement(bu,{name:"Selected balance:",balance:o})}var wu={flexDirection:"row"};function vu({balanceQuery:e}){let t=Object(Pt.a)({name:e.name+"-cleared",query:e.query.filter({cleared:!0})}),n=Object(Pt.a)({name:e.name+"-uncleared",query:e.query.filter({cleared:!1})});return l.a.createElement($.C,{style:wu},l.a.createElement(bu,{name:"Cleared total:",balance:t}),l.a.createElement(bu,{name:"Uncleared total:",balance:n}))}var Eu={flexDirection:"row",alignItems:"center",marginTop:-5,marginLeft:-5},ju={fontSize:22,fontWeight:400};function Su({balanceQuery:e,showExtraBalances:t,onToggleExtraBalances:n}){let r=Object(At.e)();return l.a.createElement($.C,{style:Eu},l.a.createElement($.d,{bare:!0,onClick:n,style:{"& svg":{opacity:r.size>0||t?1:0},"&:hover svg":{opacity:1}}},l.a.createElement(xt,{binding:Ws(Ws({},e),{},{value:0}),type:"financial",style:ju,getStyle:e=>({color:e<0?W.a.r5:e>0?W.a.g5:W.a.n8})}),l.a.createElement(Ft,{style:{width:10,height:10,marginLeft:10,color:W.a.n5,transform:t?"rotateZ(180deg)":"rotateZ(0)"}})),t&&l.a.createElement(vu,{balanceQuery:e}),r.size>0&&l.a.createElement(Ou,{selectedItems:r}))}function Cu({style:e,getTransaction:t,onShow:n,onDuplicate:r,onDelete:a,onEdit:i,onUnlink:c,onScheduleAction:s}){let d=Object(At.e)(),f=Object(u.g)(),p=Object(o.useMemo)(()=>{let e=[...d];return{preview:!!e.find(e=>bs(e)),trans:!!e.find(e=>!bs(e))}},[d]),m=Object(o.useMemo)(()=>{return[...d].map(e=>t(e)).some(e=>e&&e.is_child)},[d]),y=Object(o.useMemo)(()=>!p.preview&&[...d].every(e=>{let n=t(e);return n&&n.schedule}),[p.preview,d,t]);return l.a.createElement(kt.j,{name:"transactions",keyHandlers:p.trans&&{f:()=>n([...d]),d:()=>a([...d]),a:()=>i("account",[...d]),p:()=>i("payee",[...d]),n:()=>i("notes",[...d]),c:()=>i("category",[...d]),l:()=>i("cleared",[...d])},items:[...p.trans?[{name:"show",text:"Show",key:"F"},{name:"duplicate",text:"Duplicate",disabled:m},{name:"delete",text:"Delete",key:"D"},...y?[{name:"view-schedule",text:"View schedule",disabled:d.size>1},{name:"unlink-schedule",text:"Unlink schedule"}]:[{name:"link-schedule",text:"Link schedule"}],$.s.line,{type:$.s.label,name:"Edit field"},{name:"date",text:"Date"},{name:"account",text:"Account",key:"A"},{name:"payee",text:"Payee",key:"P"},{name:"notes",text:"Notes",key:"N"},{name:"category",text:"Category",key:"C"},{name:"amount",text:"Amount"},{name:"cleared",text:"Cleared",key:"L"}]:[{name:"view-schedule",text:"View schedule"},{name:"post-transaction",text:"Post transaction"},{name:"skip",text:"Skip scheduled date"}]],onSelect:e=>{switch(e){case"show":n([...d]);break;case"duplicate":r([...d]);break;case"delete":a([...d]);break;case"post-transaction":case"skip":s(e,d);break;case"view-schedule":let o,l=[...d][0];if(bs(l)){o=l.split("/")[1]}else{let e=t(l);o=e&&e.schedule}o&&f.push(`/schedule/edit/${o}`,{locationPtr:f.location});break;case"link-schedule":f.push("/schedule/link",{locationPtr:f.location,transactionIds:[...d]});break;case"unlink-schedule":c([...d]);break;default:i(e,[...d])}}})}var xu={paddingBottom:10,flexShrink:0},Pu={marginTop:2,alignItems:"flex-start"},ku={fontSize:25,fontWeight:500,marginTop:-5,marginBottom:-2,marginLeft:-5},Au={flexDirection:"row",alignItems:"center",gap:3,"& .hover-visible":{opacity:0,transition:"opacity .25s"},"&:hover .hover-visible":{opacity:1}},Du={fontSize:25,fontWeight:500,marginRight:5,marginBottom:5},Iu={width:11,height:11,color:W.a.n8},Tu={fontSize:25,fontWeight:500,marginBottom:5},Mu={marginTop:12},Ru={color:"currentColor",marginRight:4},Bu={color:"currentColor",marginRight:4},_u={color:"inherit",marginRight:3},Lu={backgroundColor:"transparent",borderWidth:0,boxShadow:"none",transition:"color .15s","& input::placeholder":{color:W.a.n1,transition:"color .25s"}},zu={boxShadow:"0 0 0 2px "+W.a.b5},Fu={color:W.a.p4},Nu={width:16,height:16},Uu={padding:6},$u={width:14,height:14,color:"inherit"},Wu={width:14,height:14,color:"inherit"};const Gu=l.a.memo(({tableRef:e,editingName:t,isNameEditable:n,workingHard:r,accountName:a,account:i,accountsSyncing:c,accounts:s,transactions:u,syncEnabled:d,showBalances:f,showExtraBalances:p,showEmptyMessage:m,balanceQuery:y,reconcileAmount:g,canCalculateBalance:h,search:b,filters:O,savePrefs:w,onSearch:v,onAddTransaction:E,onShowTransactions:j,onDoneReconciling:S,onCreateReconciliationTransaction:C,onToggleExtraBalances:x,onSaveName:P,onExposeName:k,onSync:A,onImport:D,onMenuSelect:I,onReconcile:T,onBatchDelete:M,onBatchDuplicate:R,onBatchEdit:B,onBatchUnlink:_,onApplyFilter:L,onDeleteFilter:z,onScheduleAction:F})=>{let N=Ns(Object(o.useState)(!1),2),U=N[0],G=N[1],H=Object(o.useRef)(null),q=Mc(),Y=d&&i&&i.account_id;return i||(Y=!!s.find(e=>!!e.account_id)),l.a.createElement(l.a.Fragment,null,l.a.createElement(ot.a,{keys:{"mod+f":()=>{H.current&&H.current.focus()}}}),l.a.createElement($.C,{style:[W.c.pageContent,xu]},l.a.createElement($.C,{style:Pu},l.a.createElement($.C,null,t?l.a.createElement($.l,null,l.a.createElement($.n,{defaultValue:a,onEnter:e=>P(e.target.value),onBlur:()=>k(!1),style:ku})):n?l.a.createElement($.C,{style:Au},l.a.createElement($.C,{style:Du},i&&i.closed?"Closed: "+a:a),i&&l.a.createElement(Et,{id:`account-${i.id}`}),l.a.createElement($.d,{bare:!0,className:"hover-visible",onClick:()=>k(!0)},l.a.createElement(on,{style:Iu}))):l.a.createElement($.C,{style:Tu},i&&i.closed?"Closed: "+a:a))),l.a.createElement(Su,{balanceQuery:y,showExtraBalances:p,onToggleExtraBalances:x}),l.a.createElement($.y,{spacing:2,direction:"row",align:"center",style:Mu},(i&&!i.closed||Y)&&l.a.createElement($.d,{bare:!0,onClick:Y?A:D},Y?l.a.createElement(l.a.Fragment,null,l.a.createElement(jn,{width:13,height:13,animating:i&&c===i.name||"__all"===c,style:Ru})," ","Sync"):l.a.createElement(l.a.Fragment,null,l.a.createElement(tn,{width:13,height:13,style:Bu})," ","Import")),!m&&l.a.createElement($.d,{bare:!0,onClick:E},l.a.createElement(Rt,{width:10,height:10,style:_u})," ","Add New"),l.a.createElement($.C,null,l.a.createElement(yi,{onApply:L})),l.a.createElement($.o,{leftContent:l.a.createElement(un,{style:{width:13,height:13,flexShrink:0,color:b?W.a.p7:"inherit",margin:5,marginRight:0}}),inputRef:H,value:b,placeholder:"Search",getStyle:e=>[Lu,e&&zu,!e&&""!==b&&Fu],onChange:e=>v(e.target.value)}),r?l.a.createElement($.C,null,l.a.createElement(Dt.a,{color:W.a.n1,style:Nu})):l.a.createElement(Cu,{getTransaction:e=>u.find(t=>t.id===e),onShow:j,onDuplicate:R,onDelete:M,onEdit:B,onUnlink:_,onScheduleAction:F}),l.a.createElement($.d,{bare:!0,disabled:""!==b||O.length>0,style:Uu,onClick:function(){e.current&&(q.dispatch({type:"switch-mode",id:e.current.getScrolledItem()}),w({"expand-splits":!("expand"===q.state.mode)}))},title:"collapse"===q.state.mode?"Collapse split transactions":"Expand split transactions"},"collapse"===q.state.mode?l.a.createElement(Yt,{style:$u}):l.a.createElement(Wt,{style:Wu})),i?l.a.createElement($.C,null,l.a.createElement(du,{onClick:()=>G(!0)}),U&&l.a.createElement(mu,{account:i,canSync:Y,syncEnabled:d,canShowBalances:h(),showBalances:f,onMenuSelect:e=>{G(!1),I(e)},onReconcile:T,onClose:()=>G(!1)})):l.a.createElement($.C,null,l.a.createElement(du,{onClick:()=>G(!0)}),U&&l.a.createElement(yu,{onMenuSelect:e=>{G(!1),I(e)},onClose:()=>G(!1)}))),O&&O.length>0&&l.a.createElement(Si,{filters:O,onDelete:z})),null!=g&&l.a.createElement(lu,{targetBalance:g,balanceQuery:y,onDone:S,onCreateTransaction:C}))});function Hu({transactions:e,filtered:t,children:n}){let r=Ce(),a=Object(o.useMemo)(()=>r?r.schedules.filter(e=>!e.completed&&["due","upcoming","missed"].includes(r.statuses.get(e.id))):[],[r]),l=Object(o.useMemo)(()=>a.map(e=>({id:"preview/"+e.id,payee:e._payee,account:e._account,amount:e._amount,date:e.next_date,notes:r.statuses.get(e.id),schedule:e.id})),[a]),i=Object(o.useMemo)(()=>!t&&l.length>0?l.concat(e):e,[t,l,e]);return n(null==r?null:i)}var qu={backgroundColor:W.a.n11},Yu={flex:1},Vu={marginTop:20,textAlign:"center",fontStyle:"italic"};class Ku extends l.a.PureComponent{constructor(e){super(e),this.fetchAllIds=(async()=>{return(await Object(g.f)(this.paged.getQuery().select("id"))).data.reduce((e,t)=>(e.push(t.id),t.subtransactions.forEach(t=>e.push(t.id)),e),[])}),this.refetchTransactions=(async()=>{this.paged&&this.paged.run()}),this.fetchTransactions=(()=>{let e=this.makeRootQuery();this.rootQuery=this.currentQuery=e,this.updateQuery(e),this.props.accountId&&this.props.markAccountRead(this.props.accountId)}),this.makeRootQuery=(()=>{let e=this.props.location.state,t=this.props.accountId;return e&&e.filter?Object(g.c)("transactions").options({splits:"grouped"}).filter(Ws({"account.offbudget":!1},e.filter)):De(t)}),this.onSearch=(e=>{this.paged.unsubscribe(),this.setState({search:e},this.onSearchDone)}),this.onSearchDone=Object(ce.debounce)(()=>{""===this.state.search?this.updateQuery(this.currentQuery,this.state.filters.length>0):this.updateQuery(Ie(this.currentQuery,this.state.search,this.props.dateFormat),!0)},150),this.onSync=(async()=>{const e=this.props.accountId,t=this.props.accounts.find(t=>t.id===e);await this.props.syncAndDownload(t?t.id:null)}),this.onImport=(async()=>{const e=this.props.accountId;if(this.props.accounts.find(t=>t.id===e)){const t=await window.Actual.openFileDialog({filters:[{name:"Financial Files",extensions:["qif","ofx","qfx","csv"]}]});t&&this.props.pushModal("import-transactions",{accountId:e,filename:t[0],onImported:e=>{e&&this.fetchTransactions()}})}}),this.onExport=(async e=>{let t=await Object(M.send)("transactions-export-query",{query:this.currentQuery.serialize()}),n=`${e&&e.replace(/[()]/g,"").replace(/\s+/g,"-")||"transactions"}.csv`;window.Actual.saveFile(t,n,"Export Transactions")}),this.onTransactionsChange=((e,t)=>{this.paged.optimisticUpdate(t=>e._deleted?t.filter(t=>t.id!==e.id):t.map(t=>t.id===e.id?e:t),e=>t),this.props.updateNewTransactions(e.id)}),this.canCalculateBalance=(()=>{let e=this.props.accountId;return this.props.accounts.find(t=>t.id===e)&&""===this.state.search&&0===this.state.filters.length}),this.onAddTransaction=(()=>{this.setState({isAdding:!0})}),this.onExposeName=(e=>{this.setState({editingName:e})}),this.onSaveName=(e=>{if(e.trim().length){const t=this.props.accountId,n=this.props.accounts.find(e=>e.id===t);this.props.updateAccount(Ws(Ws({},n),{},{name:e})),this.setState({editingName:!1})}}),this.onToggleExtraBalances=(()=>{let e=this.props,t=e.accountId,n=e.showExtraBalances,r="show-extra-balances-"+t;this.props.savePrefs({[r]:!n})}),this.onMenuSelect=(async e=>{const t=this.props.accountId,n=this.props.accounts.find(e=>e.id===t);switch(e){case"link":fn(this.props.pushModal,{upgradingId:t});break;case"unlink":this.props.unlinkAccount(t);break;case"close":this.props.openAccountCloseModal(t);break;case"reopen":this.props.reopenAccount(t);break;case"export":const r=this.getAccountTitle(n,t);this.onExport(r);break;case"toggle-balance":this.state.showBalances?(this.props.savePrefs({["show-balances-"+t]:!1}),this.setState({showBalances:!1,balances:[]})):(this.props.savePrefs({["show-balances-"+t]:!0}),this.setState({showBalances:!0}),this.calculateBalances())}}),this.isNew=(e=>this.props.newTransactions.includes(e)),this.isMatched=(e=>this.props.matchedTransactions.includes(e)),this.onCreatePayee=(e=>{return""!==e.trim()?this.props.createPayee(e):null}),this.onReconcile=(e=>{this.setState({reconcileAmount:e})}),this.onDoneReconciling=(()=>{this.setState({reconcileAmount:null})}),this.onCreateReconciliationTransaction=(async e=>{const t=at([{id:"temp",account:this.props.accountId,cleared:!0,amount:e,date:Object(de.c)(),notes:"Reconciliation balance adjustment"}]);this.setState({transactions:[...this.state.transactions,...t]}),await Object(M.send)("transactions-batch-update",{added:t}),await this.refetchTransactions()}),this.onShowTransactions=(async e=>{this.onApplyFilter({customName:"Selected transactions",filter:{id:{$oneof:e}}})}),this.onBatchEdit=(async(e,t)=>{let n=async(e,n)=>{this.setState({workingHard:!0});let r=Ze((await Object(g.f)(Object(g.c)("transactions").filter({id:{$oneof:t}}).select("*").options({splits:"grouped"}))).data),a={deleted:[],updated:[]};"cleared"===e&&(n=!!r.find(e=>!e.cleared));const o=new Set(t);r.forEach(t=>{if(!o.has(t.id))return;let l=tt(r,Ws(Ws({},t),{},{[e]:n})).diff;r=Object(ke.c)(l,r),a.deleted=a.deleted?a.deleted.concat(l.deleted):l.deleted,a.updated=a.updated?a.updated.concat(l.updated):l.updated,a.added=a.added?a.added.concat(l.added):l.added}),await Object(M.send)("transactions-batch-update",a),await this.refetchTransactions(),this.table.current&&this.table.current.edit(r[0].id,"select",!1)};"cleared"===e?n("cleared",null):this.props.pushModal("edit-field",{name:e,onSubmit:n})}),this.onBatchDuplicate=(async e=>{this.setState({workingHard:!0});let t={added:(await Object(g.f)(Object(g.c)("transactions").filter({id:{$oneof:e}}).select("*").options({splits:"grouped"}))).data.reduce((e,t)=>e.concat(at(Je(t))),[]).map(e=>{e.sort_order;return Ws({},Fs(e,zs))})};await Object(M.send)("transactions-batch-update",t),await this.refetchTransactions()}),this.onBatchDelete=(async e=>{this.setState({workingHard:!0});let t=Ze((await Object(g.f)(Object(g.c)("transactions").filter({id:{$oneof:e}}).select("*").options({splits:"grouped"}))).data),n=new Set(e),r={deleted:[],updated:[]};t.forEach(e=>{let a=e.parent_id;if(!n.has(e.id)||a&&n.has(a))return;let o=nt(t,e.id).diff;t=Object(ke.c)(o,t),r.deleted=o.deleted?r.deleted.concat(o.deleted):o.deleted,r.updated=o.updated?r.updated.concat(o.updated):o.updated}),await Object(M.send)("transactions-batch-update",r),await this.refetchTransactions()}),this.onBatchUnlink=(async e=>{await Object(M.send)("transactions-batch-update",{updated:e.map(e=>({id:e,schedule:null}))}),await this.refetchTransactions()}),this.onDeleteFilter=(e=>{this.applyFilters(this.state.filters.filter(t=>t!==e))}),this.onApplyFilter=(async e=>{let t=this.state.filters;e.customName&&(t=t.filter(t=>t.customName!==e.customName)),this.applyFilters([...t,e])}),this.onScheduleAction=(async(e,t)=>{switch(e){case"post-transaction":for(let e of t){let t=e.split("/");await Object(M.send)("schedule/post-transaction",{id:t[1]})}this.refetchTransactions();break;case"skip":for(let e of t){let t=e.split("/");await Object(M.send)("schedule/skip-next-date",{id:t[1]})}}}),this.applyFilters=(async e=>{if(e.length>0){let t=e.filter(e=>!!e.customName).map(e=>e.filter),n=(await Object(M.send)("make-filters-from-conditions",{conditions:e.filter(e=>!e.customName)})).filters;this.currentQuery=this.rootQuery.filter({$and:[...n,...t]}),this.updateQuery(this.currentQuery,!0),this.setState({filters:e,search:""})}else this.setState({transactions:[],transactionCount:0}),this.fetchTransactions(),this.setState({filters:e,search:""})}),this.paged=null,this.table=l.a.createRef(),this.animated=!0,this.state={search:"",filters:[],loading:!0,workingHard:!1,reconcileAmount:null,transactions:[],transactionsCount:0,showBalances:e.showBalances,balances:[],editingName:!1,isAdding:!1,latestDate:null}}async componentDidMount(){let e=e=>{if(e.includes("transactions")||e.includes("category_mapping")||e.includes("payee_mapping"))return this.refetchTransactions()},t=async({tables:t,messages:n,undoTag:r})=>{let a;if(await e(t),n.every(e=>"transactions"===e.dataset)&&!n.find(e=>"tombstone"===e.column)){let e=n.filter(e=>"transactions"===e.dataset&&!("tombstone"===e.column));a=1===e.length?e[0].row:null}this.table.current&&(this.table.current.edit(null),a&&this.table.current.scrollTo(a)),this.props.setLastUndoState(null)},n=[Object(M.listen)("undo-event",t)];this.unlisten=(()=>{n.forEach(e=>e())}),0===this.props.categoryGroups.length&&await this.props.getCategories(),await this.props.initiallyLoadPayees(),await this.fetchTransactions(),this.props.lastUndoState&&this.props.lastUndoState.current&&t(this.props.lastUndoState.current)}componentDidUpdate(e){e.modalShowing&&!this.props.modalShowing&&setTimeout(()=>{this.refetchTransactions()},100)}componentWillUnmount(){this.unlisten&&this.unlisten(),this.paged&&this.paged.unsubscribe()}updateQuery(e,t){this.paged&&this.paged.unsubscribe(),this.paged=Object(g.e)(e.select("*"),async(e,n)=>{const r=null==n;r&&(this.table.current&&this.table.current.setRowAnimation(!1),t?this.props.splitsExpandedDispatch({type:"set-mode",mode:"collapse"}):this.props.splitsExpandedDispatch({type:"set-mode",mode:this.props.expandSplits?"expand":"collapse"})),this.setState({transactions:e,transactionCount:this.paged.getTotalCount(),transactionsFiltered:t,loading:!1,workingHard:!1},()=>{this.state.showBalances&&this.calculateBalances(),r&&this.table.current&&this.table.current.scrollToTop(),setTimeout(()=>{this.table.current&&this.table.current.setRowAnimation(!0)},0)})},{pageCount:150,onlySync:!0,mapper:Ze})}componentWillReceiveProps(e){this.props.match!==e.match&&this.setState({editingName:!1,loading:!0,search:"",showBalances:e.showBalances,balances:[]},()=>{this.fetchTransactions()})}async calculateBalances(){if(!this.canCalculateBalance())return;let e=(await Object(g.f)(this.paged.getQuery().options({splits:"none"}).select([{balance:{$sumOver:"$amount"}}]))).data;this.setState({balances:Object(ke.i)(e)})}getAccountTitle(e,t){let n=(this.props.location.state||{}).filterName;return n||(e?e.name:"budgeted"===t?"Budgeted Accounts":"offbudget"===t?"Off Budget Accounts":"uncategorized"===t?"Uncategorized":t?null:"All Accounts")}getBalanceQuery(e,t){return{name:`balance-query-${t}`,query:this.makeRootQuery().calculate({$sum:"$amount"})}}render(){let e=this.props,t=e.accounts,n=e.categoryGroups,r=e.payees,a=e.syncEnabled,o=e.dateFormat,i=e.addNotification,c=e.accountsSyncing,s=e.replaceModal,d=e.showExtraBalances,f=e.accountId,p=this.state,m=p.transactions,y=p.loading,g=p.workingHard,h=p.reconcileAmount,b=p.transactionsFiltered,O=p.editingName,w=p.showBalances,v=p.balances,E=t.find(e=>e.id===f);const j=this.getAccountTitle(E,f);if(!j&&!y)return l.a.createElement(u.a,{to:"/accounts"});let S=!y&&!f&&0===t.length,C=f&&"budgeted"!==f&&"offbudget"!==f&&"uncategorized"!==f,x=this.getBalanceQuery(E,f);return l.a.createElement(Hu,{transactions:m,filtered:b},e=>null==e?null:l.a.createElement(At.b,{name:"transactions",items:e,fetchAllIds:this.fetchAllIds,registerDispatch:e=>this.dispatchSelected=e},l.a.createElement($.C,{style:[W.c.page,qu]},l.a.createElement(Gu,{tableRef:this.table,editingName:O,isNameEditable:C,workingHard:g,account:E,accountName:j,accountsSyncing:c,accounts:t,transactions:m,showBalances:w,showExtraBalances:d,showEmptyMessage:S,balanceQuery:x,syncEnabled:a,canCalculateBalance:this.canCalculateBalance,reconcileAmount:h,search:this.state.search,filters:this.state.filters,savePrefs:this.props.savePrefs,onSearch:this.onSearch,onShowTransactions:this.onShowTransactions,onMenuSelect:this.onMenuSelect,onAddTransaction:this.onAddTransaction,onToggleExtraBalances:this.onToggleExtraBalances,onSaveName:this.onSaveName,onExposeName:this.onExposeName,onReconcile:this.onReconcile,onDoneReconciling:this.onDoneReconciling,onCreateReconciliationTransaction:this.onCreateReconciliationTransaction,onSync:this.onSync,onImport:this.onImport,onBatchDelete:this.onBatchDelete,onBatchDuplicate:this.onBatchDuplicate,onBatchEdit:this.onBatchEdit,onBatchUnlink:this.onBatchUnlink,onDeleteFilter:this.onDeleteFilter,onApplyFilter:this.onApplyFilter,onScheduleAction:this.onScheduleAction}),l.a.createElement($.C,{style:Yu},l.a.createElement(Ls,{tableRef:this.table,account:E,transactions:m,allTransactions:e,animated:this.animated,loadMoreTransactions:()=>this.paged&&this.paged.fetchNext(),accounts:t,categoryGroups:n,payees:r,balances:w&&this.canCalculateBalance()?v:null,showAccount:!f||"offbudget"===f||"budgeted"===f||"uncategorized"===f,isAdding:this.state.isAdding,isNew:this.isNew,isMatched:this.isMatched,isFiltered:""!==this.state.search||this.state.filters.length>0,dateFormat:o,addNotification:i,renderEmpty:()=>S?l.a.createElement(Zs,{onAdd:()=>s(a?"add-account":"add-local-account")}):y?null:l.a.createElement($.C,{style:Vu},"No transactions"),onChange:this.onTransactionsChange,onRefetch:this.refetchTransactions,onRefetchUpToRow:e=>this.paged.refetchUpToRow(e,{field:"date",order:"desc"}),onCloseAddTransaction:()=>this.setState({isAdding:!1}),onCreatePayee:this.onCreatePayee})))))}}function Zu(e){let t=Mc().dispatch;return l.a.createElement(Ku,Object.assign({},e,{splitsExpandedDispatch:t}))}function Qu(e){let t=Object(s.d)(t=>({newTransactions:t.queries.newTransactions,matchedTransactions:t.queries.matchedTransactions,accounts:t.queries.accounts,failedAccounts:t.account.failedAccounts,categoryGroups:t.queries.categories.grouped,syncEnabled:t.prefs.local["flags.syncAccount"],dateFormat:t.prefs.local.dateFormat||"MM/dd/yyyy",expandSplits:e.match&&t.prefs.local["expand-splits"],showBalances:e.match&&t.prefs.local["show-balances-"+e.match.params.id],showExtraBalances:e.match&&t.prefs.local["show-extra-balances-"+e.match.params.id],payees:t.queries.payees,modalShowing:t.modals.modalStack.length>0,accountsSyncing:t.account.accountsSyncing,lastUndoState:t.app.lastUndoState,tutorialStage:t.tutorial.stage})),n=Object(s.c)(),r=Object(o.useMemo)(()=>Object(ue.b)(y,n),[n]),a=Object(u.i)(),i=Object(u.h)(),c=Object(o.useContext)(pn),d=Object(o.useMemo)(()=>{let e=Ae(a.id,"_account");return(i.state&&i.state.filter||"uncategorized"===a.id)&&(e={id:null}),t=>(t=t.filter({$and:[e,{"_account.closed":!1}]})).orderBy({next_date:"desc"})},[a.id]);return l.a.createElement(Se,{transform:d},l.a.createElement(Rc,{initialMode:t.expandSplits?"collapse":"expand"},l.a.createElement(Zu,Object.assign({},t,r,{modalShowing:t.modalShowing||!(!c.state||!c.state.locationPtr),accountId:a.id,location:e.location}))))}var Ju=n(6),Xu=n(58),ed=n(102);function td(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return nd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nd(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function rd({onSync:e,children:t}){let n=td(Object(o.useState)(!1),2),r=n[0],a=n[1];return t({refreshing:r,onRefresh:async function(){a(!0),await e(),a(!1)}})}function ad(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function od(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ad(Object(n),!0).forEach(function(t){ld(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ad(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ld(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var id=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:od({color:"#242134"},e.style)}),o.createElement("path",{d:"M7.05 9.293 6.343 10 12 15.657l1.414-1.414L9.172 10l4.242-4.243L12 4.343z",fill:"currentColor"})),cd=n(167),sd=n(599),ud=n(19),dd=n(131),fd=n(495);const pd=["children","style"];function md(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function yd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yd(Object(n),!0).forEach(function(t){hd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let bd=Object(Xu.a)(e=>Object(ke.i)(e)),Od=Object(Xu.a)(e=>Object(ke.i)(e));function wd(e){return-1!==e.indexOf("preview/")}W.a.n10,W.a.n9,W.a.n4;function vd({status:e}){let t;switch(e){case"missed":t=W.a.r3;break;case"due":t=W.a.y3;break;case"upcoming":t=W.a.n4}return l.a.createElement($.z,{style:{fontSize:11,color:t,fontStyle:"italic"}},Object(ke.p)(e))}var Ed={flex:1,height:60,padding:"5px 10px"},jd={backgroundColor:W.a.n11},Sd={flex:1},Cd={flexDirection:"row",alignItems:"center"},xd={color:W.a.n6,fontStyle:"italic"},Pd={flexDirection:"row",alignItems:"center",marginTop:3},kd={marginLeft:25,marginRight:5,fontSize:14};class Ad extends l.a.PureComponent{render(){const e=this.props,t=e.transaction,n=e.accounts,r=e.categories,a=e.payees,o=e.showCategory,i=e.added,c=e.style;let s=t.id,u=t.payee,d=t.amount,f=t.category,p=t.cleared,m=t.is_parent,y=t.notes,g=t.schedule;wd(s)&&(d=be(d));let h=f?function(e,t){return e.find(e=>e.id===t).name}(r,f):null,b=a&&u&&bd(a)[u],O=b&&b.transfer_acct&&Od(n)[b.transfer_acct],w=function(e,t,n){let r=e.amount;return n?`Transfer ${r>0?"from":"to"} ${n.name}`:t?t.name:""}(t,b,O),v=O?"Transfer":m?"Split":h,E=wd(s),j=E&&{fontStyle:"italic",color:W.a.n5};return l.a.createElement($d,{style:[Ed,E&&jd,c]},l.a.createElement($.C,{style:[Sd]},l.a.createElement($.C,{style:Cd},g&&l.a.createElement(Wi,{style:{width:12,height:12,marginRight:5,color:j.color||W.a.n1}}),l.a.createElement($.A,{style:[W.c.text,j,{fontSize:14,fontWeight:i?"600":"400"},""===w&&xd]},w||"Empty")),E?l.a.createElement(vd,{status:y}):l.a.createElement($.C,{style:Pd},l.a.createElement(Qt,{style:{width:11,height:11,color:p?W.a.g6:W.a.n8,marginRight:5}}),o&&l.a.createElement($.A,{style:{fontSize:11,marginTop:1,fontWeight:"400",color:v?W.a.n3:W.a.p7,fontStyle:v?null:"italic",textAlign:"left"}},v||"Uncategorized"))),l.a.createElement($.z,{style:[W.c.text,j,kd]},Object(ke.k)(d)))}}var Dd={flex:"1 auto",height:"100%",overflowY:"auto"},Id={display:"flex",justifyContent:"center",width:"100%"},Td={fontSize:15};class Md extends l.a.Component{constructor(...e){super(...e),this.makeData=Object(Xu.a)(e=>{const t=[];return e.forEach(e=>{if(0===t.length||e.date!==t[t.length-1].date){let n=t[t.length-1];if(n&&n.data.length>0){let e=n.data;e[e.length-1].isLast=!0}t.push({id:e.date,date:e.date,data:[]})}e.is_child||t[t.length-1].data.push(e)}),t})}render(){const e=this.props,t=e.transactions,n=e.scrollProps,r=void 0===n?{}:n,a=e.onLoadMore,o=this.makeData(t);return l.a.createElement(l.a.Fragment,null,r.ListHeaderComponent,l.a.createElement(Bd,Object.assign({},r,{"aria-label":"transaction list",label:"",loadMore:a,selectionMode:"none",style:Dd}),0===o.length?l.a.createElement(dd.b,null,l.a.createElement(dd.a,null,l.a.createElement("div",{style:Id},l.a.createElement($.z,{style:Td},"No transactions")))):null,o.map(e=>l.a.createElement(dd.b,{title:de.g(e.date,"MMMM dd, yyyy"),key:e.id},e.data.map((e,t,n)=>l.a.createElement(dd.a,{key:e.id,style:{fontSize:t===n.length-1?98:"inherit"},textValue:e.id},l.a.createElement(Ad,{transaction:e,categories:this.props.categories,accounts:this.props.accounts,payees:this.props.payees,showCategory:this.props.showCategory,added:this.props.isNew(e.id),onSelect:()=>{}})))))))}}var Rd={padding:0,listStyle:"none",margin:0,overflowY:"auto",width:"100%"};function Bd(e){let t=Object(fd.a)(e),n=l.a.useRef(),r=Object(sd.a)(e,t,n),a=r.listBoxProps,i=r.labelProps;return Object(o.useEffect)(()=>{function t(){Math.abs(n.current.scrollHeight-n.current.clientHeight-n.current.scrollTop)<n.current.clientHeight&&e.loadMore()}return n.current.addEventListener("scroll",t),()=>{n.current&&n.current.removeEventListener("scroll",t)}},[t.collection]),l.a.createElement(l.a.Fragment,null,l.a.createElement("div",i,e.label),l.a.createElement("ul",Object.assign({},a,{ref:n,style:Rd}),[...t.collection].map(e=>l.a.createElement(Fd,{key:e.key,section:e,state:t}))))}var _d={width:"100%"},Ld=gd(gd({},W.c.smallText),{},{backgroundColor:W.a.n10,borderBottom:`1px solid ${W.a.n9}`,borderTop:`1px solid ${W.a.n9}`,color:W.a.n4,display:"flex",justifyContent:"center",paddingBottom:4,paddingTop:4,position:"sticky",top:"0",width:"100%",zIndex:10}),zd={padding:0,listStyle:"none"};function Fd({section:e,state:t}){let n=Object(sd.b)({heading:e.rendered,"aria-label":e["aria-label"]}),r=n.itemProps,a=n.headingProps,o=n.groupProps;return l.a.createElement(l.a.Fragment,null,l.a.createElement("li",Object.assign({},r,{style:_d}),e.rendered&&l.a.createElement("div",Object.assign({},a,{style:Ld}),e.rendered),l.a.createElement("ul",Object.assign({},o,{style:zd}),[...e.childNodes].map((e,n,r)=>l.a.createElement(Nd,{key:e.key,item:e,state:t,isLast:n===r.length-1})))))}function Nd({isLast:e,item:t,state:n}){let r=l.a.useRef(),a=Object(sd.c)({key:t.key},n,r),o=a.optionProps,i=a.isSelected,c=Object(cd.c)(),s=c.isFocusVisible,u=c.focusProps;return l.a.createElement("li",Object.assign({},Object(ud.g)(o,u),{ref:r,style:gd({background:i?"blueviolet":"transparent",color:i?"white":null,outline:s?"2px solid orange":"none"},!e&&{borderBottom:`1px solid ${W.a.border}`})}),t.rendered)}var Ud={height:50,flexDirection:"row",alignItems:"center",paddingLeft:10,paddingRight:10};const $d=l.a.forwardRef((e,t)=>{let n=e.children,r=e.style,a=md(e,pd);return l.a.createElement($.C,Object.assign({style:[Ud,r],ref:t},a),n)});function Wd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wd(Object(n),!0).forEach(function(t){Hd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qd={flexDirection:"row",alignItems:"center",backgroundColor:W.a.n11,margin:"11px auto 4px",borderRadius:4,padding:10,width:"100%"},Yd={backgroundColor:W.a.n11,border:`1px solid ${W.a.n9}`,fontSize:15,flex:1,height:32,marginLeft:4,padding:8};class Vd extends l.a.Component{constructor(...e){super(...e),this.state={text:""},this.performSearch=(()=>{this.props.onSearch(this.state.text)}),this.onChange=(e=>{this.setState({text:e},this.performSearch)})}render(){const e=this.props.accountName,t=this.state.text;return l.a.createElement($.C,{style:qd},l.a.createElement($.o,{leftContent:l.a.createElement(un,{style:{width:13,height:13,flexShrink:0,color:t?W.a.p7:"inherit",margin:5,marginRight:0}}),value:t,onUpdate:this.onChange,placeholder:`Search ${e}`,style:Yd}))}}var Kd={flex:1,backgroundColor:W.a.n11,overflowY:"hidden",width:"100%"},Zd={alignItems:"center",backgroundColor:W.a.n11,flexShrink:0,overflowY:"hidden",paddingTop:20,top:0,width:"100%"},Qd={alignItems:"center",flexDirection:"row",justifyContent:"space-between",width:"100%"},Jd={alignItems:"center",display:"flex",textDecoration:"none",width:70},Xd={color:W.a.b5,width:32,height:32},ef=Gd(Gd({},W.c.text),{},{color:W.a.b5,fontWeight:500}),tf={fontSize:16,fontWeight:500},nf={visibility:"hidden"},rf={justifyContent:"center",width:70},af={marginTop:10},of={fontSize:18,fontWeight:"500"};function lf({account:e,prependTransactions:t,transactions:n,accounts:r,categories:a,payees:i,balance:c,isNewTransaction:s,onLoadMore:u,onSearch:f,onSelectTransaction:p}){let m=Object(o.useMemo)(()=>t.concat(n),[t,n]);return l.a.createElement($.C,{style:Kd},l.a.createElement($.C,{style:Zd},l.a.createElement($.C,{style:Qd},l.a.createElement(d.a,{to:"/accounts",style:Jd},l.a.createElement(id,{style:Xd}),l.a.createElement(jt.a,{style:ef},"Back")),l.a.createElement($.C,{style:tf},e.name),l.a.createElement(d.a,{to:"transaction/new",style:nf},l.a.createElement($.d,{bare:!0,style:rf},l.a.createElement(Rt,{width:20,height:20})))),l.a.createElement($.q,{title:"BALANCE",style:af}),l.a.createElement(xt,{binding:c,type:"financial",debug:!0,style:of,getStyle:e=>({color:e<0?W.a.r4:W.a.p5})}),l.a.createElement(Vd,{accountName:e.name,onSearch:f})),l.a.createElement(Md,{transactions:m,categories:a,accounts:r,payees:i,showCategory:!e.offbudget,isNew:s,onLoadMore:u,onSelect:p}))}function cf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return sf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sf(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const uf=Object(Xu.a)((e,t)=>{let n=Ae(e,"_account");return t&&(n={id:null}),e=>(e=e.filter({$and:[n,{"_account.closed":!1}]})).orderBy({next_date:"desc"})});function df({accountId:e,children:t}){let n=Ce();return t(null==n?null:n.schedules.filter(e=>!e.completed&&["due","upcoming","missed"].includes(n.statuses.get(e.id))).map(e=>({id:"preview/"+e.id,payee:e._payee,account:e._account,amount:e._amount,date:e.next_date,notes:n.statuses.get(e.id),schedule:e.id})))}let ff;var pf=Object(s.b)(e=>({accounts:e.queries.accounts,newTransactions:e.queries.newTransactions,updatedAccounts:e.queries.updatedAccounts,categories:e.queries.categories.list,prefs:e.prefs.local}),y)(Object(ed.b)(W.a.n11)(function(e){Object(Ju.j)();const t=cf(Object(o.useState)([]),2),n=t[0],r=t[1],a=cf(Object(o.useState)(""),2),i=a[0],c=a[1],u=cf(Object(o.useState)(),2),d=u[0],f=u[1];let p=Object(s.d)(e=>({payees:e.queries.payees,newTransactions:e.queries.newTransactions,categories:e.queries.categories.list,prefs:e.prefs.local,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"})),m=Object(s.c)(),h=Object(o.useMemo)(()=>Object(ue.b)(y,m),[m]);const b=e.match.params.id,O=e=>{ff&&ff.unsubscribe(),ff=Object(g.e)(e.options({splits:"grouped"}).select("*"),e=>r(e),{pageCount:150,mapper:Ze})},w=async()=>{let t=De((e.match.params||{}).id);f(t),O(t)};Object(o.useEffect)(()=>{let t;return async function(){t=Object(M.listen)("sync-event",({type:e,tables:t})=>{"applied"===e&&((t.includes("transactions")||t.includes("category_mapping")||t.includes("payee_mapping"))&&ff&&ff.run(),(t.includes("payees")||t.includes("payee_mapping"))&&h.getPayees())}),0===p.categories.length&&await h.getCategories(),0===e.accounts.length&&await h.getAccounts(),await h.initiallyLoadPayees(),await w(),h.markAccountRead(b)}(),()=>t()},[]);const v=se()(()=>{""===i&&d?O(d):i&&d&&O(Ie(d,i,p.dateFormat))},150);if(Object(o.useEffect)(v,[i,d,p.dateFormat]),!e.accounts||!e.accounts.length||!e.match)return null;const E=e.accounts.find(e=>e.id===b),j=e=>p.newTransactions.includes(e),S=async e=>{ff.unsubscribe(),c(e)};let C=Te(E),x=p.prefs.numberFormat||"comma-dot";return l.a.createElement(rd,{onSync:async()=>{await e.syncAndDownload()}},({refreshing:t,onRefresh:r})=>l.a.createElement(Se,{transform:uf(b,""!==i)},l.a.createElement(df,{accountId:e.accountId},t=>null==t?null:l.a.createElement(lf,Object.assign({},p,h,{key:x,account:E,accounts:e.accounts,categories:p.categories,payees:p.payees,transactions:n,prependTransactions:t||[],balance:C,isNewTransaction:j,onLoadMore:()=>{ff&&ff.fetchNext()},onSearch:S,onSelectTransaction:()=>{}})))))}));function mf(e,t){switch(e){case"brokerage":case"investment":return"investment";case"credit":return"credit";case"loan":return"debt";case"other":return"other";case"depository":default:switch(t){case"money market":case"savings":return"savings";case"cd":return"cd";default:return"checking"}}}function yf(e){switch(e){case"checking":return"Checking";case"savings":return"Savings";case"cd":return"CD";case"investment":return"Investment";case"credit":return"Credit Card";case"mortgage":return"Mortgage";case"debt":return"Debt";case"other":default:return"Other"}}function gf(e){switch(e){case"investment":case"mortgage":case"debt":case"other":return!0}return!1}var hf={flexDirection:"row",marginTop:28,marginBottom:10},bf={flex:1},Of={textTransform:"uppercase",color:W.a.n5,fontSize:13},wf={color:W.a.n5,fontSize:13};function vf({name:e,amount:t}){return l.a.createElement($.C,{style:hf},l.a.createElement($.C,{style:bf},l.a.createElement($.z,{style:[W.c.text,Of],"data-testid":"name"},e)),l.a.createElement(xt,{binding:t,style:[W.c.text,wf],type:"financial"}))}var Ef={flex:"1 0 auto",flexDirection:"row",backgroundColor:"white",boxShadow:`0 1px 1px ${W.a.n7}`,borderRadius:6,marginTop:10},jf={flexDirection:"row",flex:1,alignItems:"center",borderRadius:6,"&:active":{opacity:.1}},Sf={flex:"1 auto",height:52,marginTop:10},Cf={flexDirection:"row",alignItems:"center"},xf={backgroundColor:W.a.g5,marginLeft:"-23px",width:8,height:8,borderRadius:8},Pf={flexDirection:"row",alignItems:"center",marginTop:"4px"},kf={color:W.a.n5},Af={width:15,height:15,color:W.a.n9,marginLeft:8,marginBottom:2},Df={fontSize:16,color:W.a.n3},If={color:W.a.r4};function Tf({account:e,updated:t,getBalanceQuery:n,onSelect:r}){return l.a.createElement($.C,{style:Ef},l.a.createElement($.d,{onMouseDown:()=>r(e.id),style:jf},l.a.createElement($.C,{style:Sf},l.a.createElement($.C,{style:Cf},l.a.createElement($.A,{style:[W.c.text,{fontSize:17,fontWeight:600,color:t?W.a.b2:W.a.n2,paddingRight:30}]},e.name),e.bankId&&l.a.createElement($.C,{style:xf})),l.a.createElement($.C,{style:Pf},l.a.createElement($.z,{style:[W.c.smallText,kf]},yf(e.type)),l.a.createElement(te,{style:Af}))),l.a.createElement(xt,{binding:n(e),type:"financial",style:Df,getStyle:e=>e<0&&If})))}var Mf={flex:1,padding:30},Rf={marginTop:20,alignSelf:"center"},Bf={marginTop:20,color:W.a.n5};function _f({onAdd:e}){return l.a.createElement($.C,{style:Mf},l.a.createElement($.z,{style:W.c.text},"For Actual to be useful, you need to add an account. You can link an account to automatically download transactions, or manage it locally yourself."),l.a.createElement($.d,{primary:!0,style:Rf,onClick:()=>alert("Account creation is not supported on mobile on the self-hosted service yet")},"Add Account"),l.a.createElement($.z,{style:Bf},"In the future, you can add accounts using the add button in the header."))}var Lf={overflowY:"auto"},zf={alignItems:"center",backgroundColor:W.a.b2,color:"white",flexDirection:"row",flex:"1 0 auto",fontSize:18,fontWeight:500,height:50,justifyContent:"center",overflowY:"auto"},Ff={backgroundColor:W.a.n10,overflowY:"auto",padding:10},Nf={flex:1};class Uf extends l.a.Component{constructor(...e){super(...e),this.isNewTransaction=(e=>this.props.newTransactions.includes(e))}render(){const e=this.props,t=e.accounts,n=e.updatedAccounts,r=e.getBalanceQuery,a=e.getOnBudgetBalance,o=e.getOffBudgetBalance,i=e.onAddAccount,c=e.onSelectAccount,s=t.filter(e=>0===e.offbudget),u=t.filter(e=>1===e.offbudget);if(0===t.length)return l.a.createElement(_f,{onAdd:i});const d=l.a.createElement($.C,{style:Lf},l.a.createElement($.C,{style:zf},"Accounts"),l.a.createElement($.C,{style:Ff},l.a.createElement(vf,{name:"Budgeted",amount:a()}),s.map((e,t)=>l.a.createElement(Tf,{account:e,key:e.id,updated:n.includes(e.id),getBalanceQuery:r,onSelect:c})),l.a.createElement(vf,{name:"Off budget",amount:o()}),u.map((e,t)=>l.a.createElement(Tf,{account:e,key:e.id,updated:n.includes(e.id),getBalanceQuery:r,onSelect:c}))));return l.a.createElement($.C,{style:Nf},d)}}var $f={flex:1};var Wf=Object(s.b)(e=>({accounts:e.queries.accounts,newTransactions:e.queries.newTransactions,updatedAccounts:e.queries.updatedAccounts,categories:e.queries.categories.list,prefs:e.prefs.local}),y)(Object(ed.b)(W.a.b2)(function(e){const t=Object(o.useState)({}),n=Object(Ju.j)();Object(o.useEffect)(()=>{(async()=>{0===e.categories.length&&await e.getCategories(),e.getAccounts()})()},[]);let r=e.accounts,a=e.categories,i=e.newTransactions,c=e.updatedAccounts,s=e.prefs.numberFormat||"comma-dot";return l.a.createElement($.C,{style:$f},l.a.createElement(Uf,{key:s,accounts:r.filter(e=>!e.closed),categories:a,transactions:t||[],updatedAccounts:c,newTransactions:i,getBalanceQuery:Te,getOnBudgetBalance:Re,getOffBudgetBalance:Be,onAddAccount:()=>{},onSelectAccount:e=>{n(`/accounts/${e}`)},onSelectTransaction:e=>{n(`/transaction/${e}`)}}))})),Gf=n(304);function Hf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yf={position:"absolute",top:0,left:0,right:0,marginTop:5,alignItems:"center",zIndex:501},Vf=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hf(Object(n),!0).forEach(function(t){qf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({borderRadius:4,backgroundColor:W.a.b9,color:W.a.b1,padding:"5px 13px",flexDirection:"row",alignItems:"center"},W.c.shadow),Kf={color:W.a.b1};var Zf=Object(s.b)(e=>({accountsSyncing:e.account.accountsSyncing}),y)(function({accountsSyncing:e}){let t=e?"__all"===e?"accounts":e:null;const n=Object(Gf.b)(t,null,{from:{opacity:0,transform:"translateY(-100px)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(-100px)"},unique:!0});return l.a.createElement($.C,{style:Yf},n.map(({item:e,key:t,props:n})=>e&&l.a.createElement(Gf.a.div,{key:t,style:n},l.a.createElement($.C,{style:Vf},l.a.createElement(jn,{animating:!0,iconStyle:Kf}),l.a.createElement($.z,null,"Syncing ",e)))))});function Qf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qf(Object(n),!0).forEach(function(t){Xf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ep(e,t){return e.map(e=>(e.id===t.cat_group&&(e.categories=[t,...e.categories]),Jf({},e)))}function tp(e,t){return e.map(e=>(e.id===t.cat_group&&(e.categories=e.categories.map(e=>e.id===t.id?Jf(Jf({},e),t):e)),e))}function np(e,t,n,r){if(t===r)return e;let a=e.reduce((e,n)=>e||n.categories.find(e=>e.id===t),null);return a=Jf(Jf({},a),{},{cat_group:n}),e.map(e=>(e.id===n?(e.categories=e.categories.reduce((e,n)=>(n.id===r?(e.push(a),e.push(n)):n.id!==t&&e.push(n),e),[]),r||e.categories.push(a)):e.categories=e.categories.filter(e=>e.id!==t),Jf({},e)))}function rp(e,t,n){if(t===n)return e;let r=e.find(e=>e.id===t);return e=e.reduce((e,a)=>(a.id===n?(e.push(r),e.push(a)):a.id!==t&&e.push(a),e),[]),n||e.push(r),e}function ap(e,t){return e.map(e=>(e.categories=e.categories.filter(e=>e.id!==t),e))}function op(e,t){return[...e,t]}function lp(e,t){return e.map(e=>e.id===t.id?Jf(Jf({},e),t):e)}function ip(e,t){return e.filter(e=>e.id!==t)}var cp=n(160);let sp=l.a.createContext([]);function up(e){return[{id:"to-be-budgeted",name:"To Be Budgeted",categories:[{id:"to-be-budgeted",name:"To Be Budgeted"}]},...e]}function dp(e){return 0===e||"0"===e||""===e?{color:W.a.n10}:null}function fp(e){const t=dp(e);return t||(e<0?{color:W.a.r4}:void 0)}function pp(e){return{color:e<0?W.a.r4:0===e?W.a.n10:W.a.g4}}function mp(e,t,n){if("top"===t)return{targetId:n};{let t=e.findIndex(e=>e.id===n);if(-1===t)throw new Error("findSort: item not found: "+n);let r=t+1;return r<e.length-1?{targetId:e[r].id}:{targetId:null}}}var yp=n(114);function gp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gp(Object(n),!0).forEach(function(t){bp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Op=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:hp({color:"#242134"},e.style)}),o.createElement("path",{d:"m3.828 9 6.071-6.071-1.414-1.414L0 10l.707.707 7.778 7.778 1.414-1.414L3.828 11H20V9H3.828z",fill:"currentColor"}));function wp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wp(Object(n),!0).forEach(function(t){Ep(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ep(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var jp=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:vp({color:"#242134"},e.style)}),o.createElement("path",{d:"m16.172 9-6.071-6.071 1.414-1.414L20 10l-.707.707-7.778 7.778-1.414-1.414L16.172 11H0V9z",fill:"currentColor"}));function Sp(e,t){const n=e.getBoundingClientRect();return t.find(e=>null!=e.width&&n.width<e.width||null!=e.height&&n.height<e.height)||t[t.length-1]}var Cp=Jr()(function({props:{children:e},state:{matched:t},inst:n}){return e(t,e=>n.element=e)},{getInitialState:()=>({matched:null}),componentDidMount({inst:e,props:t,setState:n}){e.observer=new ResizeObserver(r=>{r.forEach(r=>{n({matched:Sp(e.element,t.sizes)})})}),e.observer.observe(e.element)},componentWillUnmount({inst:e}){e.observer.disconnect()}}),xp=n(842),Pp=n(843);function kp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ap(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ap(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ap(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Dp({item:e,type:t,makePreview:n,children:r,canDrag:a,onDragChange:l}){let i=Object(o.useRef)(l);const c=kp(Object(xp.a)({item:{type:t,item:e},collect:e=>({isDragging:e.isDragging()}),begin(n){i.current({state:"start-preview",type:t,item:e}),setTimeout(()=>{i.current({state:"start"})},0)},end(e,n){i.current({state:"end",type:t,item:e})},canDrag:()=>a}),2),s=(c[0].isDragging,c[1]);return Object(o.useLayoutEffect)(()=>{i.current=l}),{dragRef:s}}function Ip({types:e,id:t,onDrop:n,onLongHover:r}){let a=Object(o.useRef)(null),l=kp(Object(o.useState)(null),2),i=l[0],c=l[1],s=kp(Object(Pp.a)({accept:e,drop({item:e},r){n(e.id,i,t)},hover({item:e,type:t},n){let r=a.current.getBoundingClientRect(),o=(r.bottom-r.top)/2,l=n.getClientOffset().y-r.top;c(l<o?"top":"bottom")},collect:e=>({isOver:e.isOver()})}),2),u=s[0].isOver,d=s[1];return Object(o.useEffect)(()=>{let e;return r&&u&&(e=setTimeout(r,700)),()=>e&&clearTimeout(e)},[u]),{dropRef:(f=d,p=a,Object(o.useMemo)(()=>(function(e){[f,p].forEach(t=>{"function"===typeof t?t(e):null!=t&&(t.current=e)})}),[f,p])),dropPos:u?i:null};var f,p}const Tp=l.a.createContext(null);var Mp={position:"absolute",left:2,right:2,borderRadius:3,height:3,background:`linear-gradient(90deg, ${W.a.b4} 0%, ${W.a.b5} 100%)`,zIndex:1e4,pointerEvents:"none"};function Rp({pos:e,offset:t={}}){if(null==e)return null;let n=Object(o.useContext)(Tp),r=("first"===n?2:0)+(t.top||0),a=("last"===n?2:0)+(t.bottom||0),i="top"===e?{top:-2+r}:{bottom:-1+a};return l.a.createElement($.C,{style:[Mp,i]})}var Bp=n(71),_p=n(471),Lp=n(206);function zp(e,t,n){return{start:t<e.start?e.start:t,end:n>e.end?e.end:n}}let Fp=l.a.createContext();function Np({startMonth:e,numMonths:t,monthBounds:n,type:r,children:a}){let o=zp(n,e,de.b(e,t-1)),i=de.v(o.start,o.end);return l.a.createElement(Fp.Provider,{value:{months:i,type:r}},a)}function Up(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return $p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Wp={flex:1,overflow:"hidden"},Gp={marginLeft:-4,marginRight:-4},Hp={paddingLeft:4,paddingRight:4};function qp({SummaryComponent:e}){let t=Object(o.useContext)(Fp).months,n=Up(Object(o.useState)(0),2),r=n[0],a=n[1],i=Object(o.useRef)(null),c=Object(Lp.a)(Object(o.useCallback)(e=>{a(e.width)},[])),s=Object(o.useRef)(),u=Object(o.useRef)(t[0]),d=[...t];d.unshift(de.y(t[0],1)),d.push(de.b(t[t.length-1],1));let f=r/t.length;Object(o.useLayoutEffect)(()=>{if(!s.current)return;i.current||(i.current=new _p.a({stiffness:600,damping:80,mass:3,fromValue:-f}),i.current.onUpdate(e=>{s.current&&(s.current.style.transform="translateX("+e.currentValue+"px)")}));let e=u.current,n=e>t[0],r=f,a=n?2*-r:0;e!==d[0]&&e!==d[2]&&(a=-r);let o=-r;i.current.updateConfig({fromValue:a,toValue:o}).start()},[t[0]]),Object(o.useLayoutEffect)(()=>{u.current=t[0]},[t[0]]),Object(o.useLayoutEffect)(()=>{s.current.style.transform=`translateX(${-f}px)`},[f]);var p={flex:`0 0 ${f}px`};return l.a.createElement("div",Object.assign({},Object(lt.css)([Wp,1===t.length&&Gp]),{ref:c}),l.a.createElement($.C,{style:{flexDirection:"row",width:r,willChange:"transform"},innerRef:s},d.map((t,n)=>l.a.createElement($.C,{key:t,style:[p,Hp]},l.a.createElement(e,{month:t})))))}const Yp="0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)";function Vp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Kp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kp(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Zp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zp(Object(n),!0).forEach(function(t){Jp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xp(){return Math.max(W.c.scrollbarWidth-2,0)}var em={flex:1},tm={"& ::-webkit-scrollbar":{backgroundColor:"transparent"},"& ::-webkit-scrollbar-thumb:vertical":{backgroundColor:"white"}},nm={flexDirection:"row",overflow:"hidden",flexShrink:0,paddingLeft:5,paddingRight:5+Xp()},rm={width:200},am={overflowY:"scroll",overflowAnchor:"none",flex:1,paddingLeft:5,paddingRight:5};class om extends l.a.Component{constructor(e){super(e),this.onEditMonth=((e,t)=>{this.setState({editing:e?{id:e,cell:t}:null})}),this.onEditName=(e=>{this.setState({editing:e?{id:e,cell:"name"}:null})}),this.onReorderCategory=((e,t,n)=>{let r=this.props.categoryGroups;if(!!r.find(e=>e.id===n)){let a=function(e,t,n){if("bottom"===t)return{targetId:n};{let t=e.findIndex(e=>e.id===n);if(-1===t)throw new Error("findSort: item not found: "+n);let r=t-1;return r>=0?{targetId:e[r].id}:{targetId:null}}}(r,t,n).targetId,o=r.find(e=>e.id===a);if(o){let n=o.categories;this.props.onReorderCategory({id:e,groupId:o.id,targetId:0===n.length||"top"===t?null:n[0].id})}}else{let a;for(let e of r)if(e.categories.find(e=>e.id===n)){a=e;break}this.props.onReorderCategory(Qp({id:e,groupId:a.id},mp(a.categories,t,n)))}}),this.onReorderGroup=((e,t,n)=>{let r=this.props.categoryGroups;this.props.onReorderGroup(Qp({id:e},mp(r,t,n)))}),this.moveVertically=(e=>{let t=this.state.editing,n=this.props,r=n.type,a=n.categoryGroups,o=n.collapsed;const l=a.reduce((e,t)=>o.includes(t.id)?e.concat({id:t.id,isGroup:!0}):e.concat([{id:t.id,isGroup:!0},...t.categories]),[]);if(t){let n=l.findIndex(e=>e.id===t.id)+e;for(;n>=0&&n<l.length;){const a=l[n];if(!a.isGroup){if("report"!==r&&a.is_income)break;return void this.onEditMonth(a.id,t.cell)}n+=e}}}),this.onKeyDown=(e=>{if(!this.state.editing)return null;13!==e.keyCode&&9!==e.keyCode||(e.preventDefault(),this.moveVertically(e.shiftKey?-1:1))}),this.onShowActivity=((e,t,n)=>{this.props.onShowActivity(e,t,this.resolveMonth(n))}),this.onBudgetAction=((e,t,n)=>{this.props.onBudgetAction(this.resolveMonth(e),t,n)}),this.resolveMonth=(e=>de.b(this.props.startMonth,e)),this.budgetCategoriesRef=l.a.createRef(),this.state={editing:null,draggingState:null}}clearEditing(){this.setState({editing:null})}render(){let e=this.props,t=e.type,n=e.categoryGroups,r=e.prewarmStartMonth,a=e.startMonth,o=e.numMonths,i=e.monthBounds,c=e.collapsed,s=e.setCollapsed,u=e.newCategoryForGroup,d=e.dataComponents,f=e.isAddingGroup,p=e.onSaveCategory,m=e.onSaveGroup,y=e.onDeleteCategory,g=e.onDeleteGroup,h=e.onShowNewCategory,b=e.onHideNewCategory,O=e.onShowNewGroup,w=e.onHideNewGroup,v=this.state,E=v.editing,j=v.draggingState;return l.a.createElement($.C,{style:[em,W.c.lightScrollbar&&tm]},l.a.createElement($.C,{style:nm},l.a.createElement($.C,{style:rm}),l.a.createElement(Np,{startMonth:r,numMonths:o,monthBounds:i,type:t},l.a.createElement(qp,{SummaryComponent:d.SummaryComponent}))),l.a.createElement(Np,{startMonth:a,numMonths:o,monthBounds:i,type:t},l.a.createElement(Lm,{MonthComponent:d.BudgetTotalsComponent}),l.a.createElement($.p.Provider,{value:this.budgetCategoriesRef},l.a.createElement($.C,{style:am,innerRef:this.budgetCategoriesRef},l.a.createElement($.C,{style:{opacity:j?.5:1,flexShrink:0},onKeyDown:this.onKeyDown,innerRef:e=>this.budgetDataNode=e},l.a.createElement(Km,{categoryGroups:n,newCategoryForGroup:u,isAddingGroup:f,editingCell:E,collapsed:c,setCollapsed:s,dataComponents:d,onEditMonth:this.onEditMonth,onEditName:this.onEditName,onSaveCategory:p,onSaveGroup:m,onDeleteCategory:y,onDeleteGroup:g,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup,onShowNewCategory:h,onHideNewCategory:b,onShowNewGroup:O,onHideNewGroup:w,onBudgetAction:this.onBudgetAction,onShowActivity:this.onShowActivity}))))))}}var lm={flexDirection:"row",alignItems:"center",userSelect:"none",WebkitUserSelect:"none"},im={textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},cm={flexShrink:0,marginLeft:5},sm={color:"currentColor",padding:3},um={color:"currentColor"},dm={padding:0},fm={flex:1},pm={color:"currentColor"},mm={width:200,"& button":{display:"none"}},ym={"&:hover button":{display:"flex",color:W.a.n1}},gm={color:W.a.n8},hm={backgroundColor:"white",zIndex:1e4,borderRadius:6,overflow:"hidden"},bm={paddingLeft:13},Om={borderBottomWidth:0};function wm({innerRef:e,category:t,dragPreview:n,dragging:r,editing:a,style:i,borderColor:c=W.a.border,isLast:s,onDragChange:u,onEditMonth:d,onEditName:f,onSave:p,onDelete:m,onHideNewCategory:y}){const g="new"===t.id,h=Vp(Object(o.useState)(!1),2),b=h[0],O=h[1],w=l.a.createElement($.C,{style:lm},l.a.createElement("div",{style:im},t.name),l.a.createElement($.C,{style:cm},l.a.createElement($.d,{bare:!0,onClick:e=>{e.stopPropagation(),O(!0)},style:sm},l.a.createElement(Fi,{width:14,height:14,style:um})),b&&l.a.createElement($.B,{position:"bottom-left",width:200,style:dm,onClose:()=>O(!1)},l.a.createElement($.s,{onMenuSelect:e=>{"rename"===e?f(t.id):m(t.id),O(!1)},items:[{name:"rename",text:"Rename"},{name:"delete",text:"Delete"}]}))),l.a.createElement($.C,{style:fm}),l.a.createElement(Et,{id:t.id,style:r&&pm}));return l.a.createElement($.C,{innerRef:e,style:[mm,!r&&!n&&ym,r&&gm,n&&hm,i],onKeyDown:e=>{13===e.keyCode&&(f(null),e.stopPropagation())}},l.a.createElement(kt.f,{value:t.name,formatter:e=>w,width:"flex",exposed:a||g,borderColor:n?"transparent":c,onUpdate:e=>{g?""===e?y():""!==e&&p(Qp(Qp({},t),{},{name:e})):e!==t.name&&p(Qp(Qp({},t),{},{name:e}))},onBlur:()=>f(null),style:[bm,s&&Om],inputProps:{placeholder:g?"New Category Name":""}}))}var vm={flexDirection:"row",alignItems:"center",userSelect:"none",WebkitUserSelect:"none"},Em={textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},jm={fontWeight:500},Sm={marginLeft:5,flexShrink:0},Cm={padding:3},xm={padding:0},Pm={flex:1},km={width:200,backgroundColor:W.a.n11,"& button":{display:"none"},"&:hover button":{display:"flex",color:W.a.n1}},Am={paddingLeft:10,zIndex:1e4,borderRadius:6,overflow:"hidden"},Dm={fontWeight:600};function Im({group:e,editing:t,collapsed:n,dragPreview:r,innerRef:a,style:i,borderColor:c=W.a.border,onEdit:s,onSave:u,onDelete:d,onShowNewCategory:f,onHideNewGroup:p,onToggleCollapse:m}){const y="new"===e.id,g=Vp(Object(o.useState)(!1),2),h=g[0],b=g[1],O=l.a.createElement($.C,{style:vm,onClick:t=>{m(e.id)}},!r&&l.a.createElement(yp.a,{width:8,height:8,style:{marginRight:5,marginLeft:5,flexShrink:0,transition:"transform .1s",transform:n?"rotate(-90deg)":""}}),l.a.createElement("div",{style:Em},r&&l.a.createElement($.z,{style:jm},"Group: "),e.name),!r&&l.a.createElement(l.a.Fragment,null,l.a.createElement($.C,{style:Sm},l.a.createElement($.d,{bare:!0,onClick:e=>{e.stopPropagation(),b(!0)},style:Cm},l.a.createElement(Fi,{width:14,height:14})),h&&l.a.createElement($.B,{position:"bottom-left",width:200,style:xm,onClose:()=>b(!1)},l.a.createElement($.s,{onMenuSelect:t=>{"rename"===t?s(e.id):"add-category"===t?f(e.id):d(e.id),b(!1)},items:[{name:"add-category",text:"Add category"},{name:"rename",text:"Rename"},d&&{name:"delete",text:"Delete"}]}))),l.a.createElement($.C,{style:Pm}),l.a.createElement(Et,{id:e.id})));return l.a.createElement($.C,{innerRef:a,style:[i,km,r&&Am],onKeyDown:e=>{13===e.keyCode&&(s(null),e.stopPropagation())}},l.a.createElement(kt.f,{value:e.name,formatter:e=>O,width:"flex",exposed:t,borderColor:W.a.border,onUpdate:t=>{y?""===t?p():""!==t&&u({id:e.id,name:t}):u({id:e.id,name:t})},onBlur:()=>s(null),style:Dm,inputProps:{style:{marginLeft:20},placeholder:y?"New Group Name":""}}))}var Tm={flex:1},Mm={borderLeft:"1px solid "+W.a.border};function Rm({component:e,editingIndex:t,args:n,style:r}){let a=Object(o.useContext)(Fp),i=a.months,c=a.type;return i.map((a,o)=>{let i=t===o;return l.a.createElement(Bp.a.Provider,{key:o,value:de.w(a,c)},l.a.createElement($.C,{style:[Tm,Mm,r]},l.a.createElement(e,Object.assign({monthIndex:o,editing:i},n))))})}var Bm={backgroundColor:"white",flexDirection:"row",flexShrink:0,boxShadow:Yp,marginLeft:5,marginRight:5+Xp(),borderRadius:"4px 4px 0 0",borderBottom:"1px solid "+W.a.border},_m={width:200,color:W.a.n4,justifyContent:"center",paddingLeft:18};const Lm=l.a.memo(function({MonthComponent:e}){return l.a.createElement($.C,{style:Bm},l.a.createElement($.C,{style:_m},"Category"),l.a.createElement(Rm,{component:e}))});var zm={fontWeight:600};function Fm({group:e,collapsed:t,editingCell:n,dragState:r,itemPos:a,MonthComponent:o,onEditName:i,onSave:c,onDelete:s,onDragChange:u,onReorderGroup:d,onReorderCategory:f,onToggleCollapse:p,onShowNewCategory:m}){let y=r&&r.item===e,g=Dp({type:"group",onDragChange:u,item:e,canDrag:null===n}).dragRef,h=Ip({types:"group",id:e.id,onDrop:d}),b=h.dropRef,O=h.dropPos,w=Ip({types:"category",id:e.id,onDrop:f,onLongHover:()=>{t&&p(e.id)}}),v=w.dropRef,E=w.dropPos;return l.a.createElement(kt.h,{collapsed:!0,backgroundColor:W.a.n11,style:zm},r&&!r.preview&&"group"===r.type&&l.a.createElement($.C,{innerRef:b,style:{position:"absolute",left:0,right:0,height:t?kt.g-1:(1+e.categories.length)*(kt.g-1)+1,zIndex:1e4}},l.a.createElement(Rp,{pos:O,offset:{top:1}})),l.a.createElement(Rp,{pos:E,offset:{top:1}}),l.a.createElement($.C,{innerRef:v,style:{flex:1,flexDirection:"row",opacity:y&&!r.preview?.3:1}},l.a.createElement(Im,{innerRef:g,group:e,editing:n&&"name"===n.cell&&n.id===e.id,dragPreview:y&&r.preview,collapsed:t,onToggleCollapse:p,onEdit:i,onSave:c,onDelete:s,onShowNewCategory:m}),l.a.createElement(Rm,{component:o,args:{group:e}})))}var Nm={flex:1,flexDirection:"row"};function Um({cat:e,budgetArray:t,editingCell:n,dragState:r,MonthComponent:a,onEditName:o,onEditMonth:i,onSave:c,onDelete:s,onBudgetAction:u,onShowActivity:d,onDragChange:f,onReorder:p}){let m=r&&r.item===e;r&&r.item.id===e.cat_group&&(m=!0);let y=Dp({type:"category",onDragChange:f,item:e,canDrag:null===n}).dragRef,g=Ip({types:"category",id:e.id,onDrop:p}),h=g.dropRef,b=g.dropPos;return l.a.createElement(kt.h,{innerRef:h,collapsed:!0,backgroundColor:"transparent"},l.a.createElement(Rp,{pos:b,offset:{top:1}}),l.a.createElement($.C,{style:[Nm]},l.a.createElement(wm,{innerRef:y,category:e,dragPreview:m&&r.preview,dragging:m&&!r.preview,editing:n&&"name"===n.cell&&n.id===e.id,onEditName:o,onSave:c,onDelete:s,onDragChange:f}),l.a.createElement(Rm,{component:a,editingIndex:n&&n.id===e.id&&n.cell,args:{category:e,onEdit:i,onBudgetAction:u,onShowActivity:d}})))}var $m={fontWeight:600};function Wm({group:e,editingCell:t,collapsed:n,MonthComponent:r,onEditName:a,onSave:o,onToggleCollapse:i,onShowNewCategory:c}){return l.a.createElement(kt.h,{collapsed:!0,backgroundColor:W.a.n11,style:$m},l.a.createElement(Im,{group:e,collapsed:n,editing:t&&"name"===t.cell&&t.id===e.id,onEdit:a,onSave:o,onToggleCollapse:i,onShowNewCategory:c}),l.a.createElement(Rm,{component:r,args:{group:e}}))}function Gm({cat:e,isLast:t,editingCell:n,MonthComponent:r,onEditName:a,onEditMonth:o,onSave:i,onDelete:c,onDragChange:s,onBudgetAction:u,onReorder:d,onShowActivity:f}){let p=Dp({type:"income-category",onDragChange:s,item:e,canDrag:null===n}).dragRef,m=Ip({types:"income-category",id:e.id,onDrop:d}),y=m.dropRef,g=m.dropPos;return l.a.createElement(kt.h,{innerRef:y,collapsed:!0,backgroundColor:"transparent"},l.a.createElement(Rp,{pos:g,offset:{top:1}}),l.a.createElement(wm,{innerRef:p,category:e,isLast:t,editing:n&&"name"===n.cell&&n.id===e.id,onEditName:a,onSave:i,onDelete:c}),l.a.createElement(Rm,{component:r,editingIndex:n&&n.id===e.id&&n.cell,args:{category:e,onEdit:o,isLast:t,onShowActivity:f,onBudgetAction:u}}))}var Hm={marginBottom:10,backgroundColor:"white",overflow:"hidden",boxShadow:Yp,borderRadius:"0 0 4px 4px",flex:1},qm={backgroundColor:W.a.n11},Ym={height:70,backgroundColor:"white"},Vm={":hover":{backgroundColor:"#fcfcfc"}};const Km=l.a.memo(({categoryGroups:e,newCategoryForGroup:t,isAddingGroup:n,editingCell:r,collapsed:a,setCollapsed:i,dataComponents:c,onBudgetAction:s,onShowActivity:u,onEditName:d,onEditMonth:f,onSaveCategory:p,onSaveGroup:m,onDeleteCategory:y,onDeleteGroup:g,onReorderCategory:h,onReorderGroup:b,onShowNewCategory:O,onHideNewCategory:w,onShowNewGroup:v,onHideNewGroup:E})=>{let j=Object(o.useMemo)(()=>{let r=Vp(function(e){return[e.filter(e=>!e.is_income),e.find(e=>e.is_income)]}(e),2),o=r[0],l=r[1],i=Array.prototype.concat.apply([],o.map(e=>{let n=[{type:"expense-group",value:e}];return t===e.id&&n.push({type:"new-category"}),[...n,...(a.includes(e.id)?[]:e.categories).map(e=>({type:"expense-category",value:e}))]}));return n&&i.push({type:"new-group"}),l&&(i=i.concat([{type:"income-separator"},{type:"income-group",value:l},t===l.id&&{type:"new-category"},...(a.includes(l.id)?[]:l.categories).map(e=>({type:"income-category",value:e}))].filter(e=>e))),i},[e,a,t,n]),S=Vp(Object(o.useState)(null),2),C=S[0],x=S[1],P=Vp(Object(o.useState)(null),2),k=P[0],A=P[1];function D(e){let t=e.state;"start-preview"===t?x({type:e.type,item:e.item,preview:!0}):"start"===t?C&&(x(Qp(Qp({},C),{},{preview:!1})),A(a)):"hover"===t?x(Qp(Qp({},C),{},{hoveredId:e.id,hoveredPos:e.pos})):"end"===t&&(x(null),i(k))}function I(e){a.includes(e)?i(a.filter(t=>t!==e)):i([...a,e])}return l.a.createElement($.C,{style:Hm},j.map((n,o)=>{let i;switch(n.type){case"new-group":i=l.a.createElement(kt.h,{style:qm},l.a.createElement(Im,{group:{id:"new",name:""},editing:!0,onSave:m,onHideNewGroup:E,onEdit:d}));break;case"new-category":i=l.a.createElement(kt.h,null,l.a.createElement(wm,{category:{name:"",cat_group:t,is_income:t===e.find(e=>e.is_income).id,id:"new"},editing:!0,onSave:p,onHideNewCategory:w,onEditName:d}));break;case"expense-group":i=l.a.createElement(Fm,{group:n.value,editingCell:r,collapsed:a.includes(n.value.id),MonthComponent:c.ExpenseGroupComponent,dragState:C,onEditName:d,onSave:m,onDelete:g,onDragChange:D,onReorderGroup:b,onReorderCategory:h,onToggleCollapse:I,onShowNewCategory:O});break;case"expense-category":i=l.a.createElement(Um,{cat:n.value,editingCell:r,MonthComponent:c.ExpenseCategoryComponent,dragState:C,onEditName:d,onEditMonth:f,onSave:p,onDelete:y,onDragChange:D,onReorder:h,onBudgetAction:s,onShowActivity:u});break;case"income-separator":i=l.a.createElement($.C,{style:Ym},l.a.createElement(ey,{MonthComponent:c.IncomeHeaderComponent,onShowNewGroup:v}));break;case"income-group":i=l.a.createElement(Wm,{group:n.value,editingCell:r,MonthComponent:c.IncomeGroupComponent,collapsed:a.includes(n.value.id),onEditName:d,onSave:m,onToggleCollapse:I,onShowNewCategory:O});break;case"income-category":i=l.a.createElement(Gm,{cat:n.value,editingCell:r,isLast:o===j.length-1,MonthComponent:c.IncomeCategoryComponent,onEditName:d,onEditMonth:f,onSave:p,onDelete:y,onDragChange:D,onReorder:h,onBudgetAction:s,onShowActivity:u});break;default:throw new Error("Unknown item type: "+n.type)}let S=0===o?"first":o===j.length-1?"last":null;return l.a.createElement(Tp.Provider,{key:n.value?n.value.id:"income-separator"===n.type?"separator":o,value:S},l.a.createElement($.C,{style:!C&&Vm},i))}))});var Zm={flexDirection:"row",flex:1},Qm={width:200,alignItems:"flex-start",justifyContent:"flex-start"},Jm={fontSize:12,margin:10},Xm={border:0,justifyContent:"flex-end"};function ey({MonthComponent:e,onShowNewGroup:t}){return l.a.createElement($.C,{style:Zm},l.a.createElement($.C,{style:Qm},l.a.createElement($.d,{onClick:t,style:Jm},"Add Group")),l.a.createElement(Rm,{component:e,style:Xm}))}var ty={marginLeft:205,flexShrink:0},ny={marginRight:5+Xp()},ry={paddingTop:5};const ay=l.a.memo(({startMonth:e,onMonthSelect:t,numMonths:n,monthBounds:r,style:a})=>{return l.a.createElement($.C,{style:ty},l.a.createElement($.C,{style:ny},l.a.createElement(yy,{startMonth:e,numDisplayed:n,monthBounds:r,style:ry,onSelect:e=>t(function(e){let t=r.start,a=de.y(r.end,n-1);return e<t?t:e>a?a:e}(e))})))});var oy={flexDirection:"row",alignItems:"center",justifyContent:"space-between"},ly={padding:"3px 0px",margin:"3px 0",fontWeight:"bold",fontSize:14,flex:"0 0 40px"},iy={flexDirection:"row",flex:1,alignItems:"center",justifyContent:"center"},cy={color:W.a.n7},sy={backgroundColor:W.a.p6,color:"white",borderRadius:0},uy={borderTopLeftRadius:2,borderBottomLeftRadius:2},dy={borderTopRightRadius:2,borderBottomRightRadius:2},fy={marginRight:0,borderRight:"solid 1px",borderColor:W.a.p6},py={textDecoration:"underline"},my={flexDirection:"row",alignItems:"center",flex:"0 0 50px",justifyContent:"flex-end"};const yy=Object(Qr.scope)(e=>{function t(e,t){return de.o(e)===de.o(t)?de.g(t,"MMM"):null}return e(function({state:{monthNames:e,currentMonthName:t},props:{startMonth:n,numDisplayed:r,monthBounds:a,style:o,onSelect:i}}){const c=de.o(n),s=de.k(n);return l.a.createElement($.C,{style:[oy,o]},l.a.createElement($.C,{style:ly},de.g(c,"yyyy")),l.a.createElement(Cp,{sizes:[{width:320,size:"small"},{width:400,size:"medium"},{size:"big"}]},(n,o)=>l.a.createElement($.C,{innerRef:o,style:iy},e.map((e,o)=>{const u=s+r,d=o>=s&&o<u,f=e===t,p=function(e,t){return de.b(e,t)}(c,o),m=p>=a.start&&p<=a.end;return l.a.createElement($.C,{key:e,style:[{marginRight:1,padding:n&&"big"===n.size?"3px 5px":"3px 3px",textAlign:"center",cursor:"default",borderRadius:2,":hover":m&&{backgroundColor:W.a.p6,color:"white"}},!m&&cy,W.c.smallText,d&&sy,o===s&&uy,o===u-1&&dy,o>=s&&o<u-1&&fy,f&&py],onClick:()=>i(p)},n&&"small"===n.size?e[0]:e)}))),l.a.createElement($.C,{style:my},l.a.createElement($.d,{onClick:()=>i(de.y(n,1)),bare:!0},l.a.createElement(Op,{width:12,height:12})),l.a.createElement($.d,{onClick:()=>i(de.b(n,1)),bare:!0},l.a.createElement(jp,{width:12,height:12}))))},{getInitialState:function({props:{startMonth:e,monthBounds:n}}){const r=de.d();var a;return{monthNames:(a=r,de.v(de.q(a),de.p(a))).map(e=>de.g(e,"MMM")),currentMonthName:t(e,r)}},componentWillReceiveProps:function({props:e},n){if(de.o(e.startMonth)!==de.o(n.startMonth))return{currentMonthName:t(n.startMonth,de.d())}}})}),gy=["width","height","categoryGroups","prewarmStartMonth","startMonth","maxMonths","monthBounds","onMonthSelect","onPreload"];function hy(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const by=l.a.forwardRef((e,t)=>{let n=e.width,r=e.height,a=e.categoryGroups,i=e.prewarmStartMonth,c=e.startMonth,s=e.maxMonths,u=void 0===s?3:s,d=e.monthBounds,f=e.onMonthSelect,p=(e.onPreload,hy(e,gy)),m=U().setDisplayMax,y=function(e){let t=e-200;return t<500?1:t<750?2:t<1e3?3:t<1250?4:t<1500?5:6}(n),g=Math.min(y,u),h=200+500*g;return Object(o.useEffect)(()=>{m(y)},[y]),l.a.createElement(sp.Provider,{value:a},l.a.createElement($.C,{style:{width:n,height:r,alignItems:"center",opacity:n<=0||r<=0?0:1}},l.a.createElement($.C,{style:{width:"100%",maxWidth:h}},l.a.createElement(ay,{startMonth:i,numMonths:g,monthBounds:d,onMonthSelect:function(e){f(e,g)}}),l.a.createElement(om,Object.assign({ref:t,categoryGroups:a,prewarmStartMonth:i,startMonth:c,numMonths:g,monthBounds:d},p)))))});var Oy=l.a.forwardRef((e,t)=>l.a.createElement(cp.a,null,({width:n,height:r})=>l.a.createElement(by,Object.assign({ref:t,width:n,height:r},e))));function wy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vy(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wy(Object(n),!0).forEach(function(t){Ey(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ey(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var jy={textAlign:"right"},Sy={cursor:"pointer",":hover":{textDecoration:"underline"}},Cy={alignSelf:"center",marginLeft:2,position:"absolute",right:-4,top:0,bottom:0,justifyContent:"center"};function xy({carryover:e,balance:t,category:n,disabled:r}){let a=Object(Pt.a)(e),o=Object(Pt.a)(t);return l.a.createElement(l.a.Fragment,null,l.a.createElement(xt,{binding:t,type:"financial",getStyle:fp,style:[jy,!r&&Sy]}),!0===a&&l.a.createElement($.C,{style:Cy},l.a.createElement(jp,{width:7,height:7,style:vy({},fp(o))})))}function Py(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ky(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Py(Object(n),!0).forEach(function(t){Ay(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Py(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ay(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dy=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:ky({color:"#242134"},e.style)}),o.createElement("path",{d:"M12 13.584a2.643 2.643 0 0 1-1.875-.775L.584 3.268a1.768 1.768 0 0 1 2.5-2.5l8.739 8.739a.25.25 0 0 0 .354 0L20.916.768a1.768 1.768 0 0 1 2.5 2.5l-9.541 9.541a2.643 2.643 0 0 1-1.875.775Z",fill:"currentColor"}),o.createElement("path",{d:"M12 23.75a2.643 2.643 0 0 1-1.875-.775L.584 13.434a1.768 1.768 0 0 1 2.5-2.5l8.739 8.739a.25.25 0 0 0 .354 0l8.739-8.739a1.768 1.768 0 0 1 2.5 2.5l-9.541 9.541A2.643 2.643 0 0 1 12 23.75Z",fill:"currentColor"}));function Iy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ty(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Iy(Object(n),!0).forEach(function(t){My(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function My(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ry=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Ty({color:"#242134"},e.style)}),o.createElement("path",{d:"M12 10.416a2.643 2.643 0 0 1 1.875.775l9.541 9.541a1.768 1.768 0 0 1-2.5 2.5l-8.739-8.739a.25.25 0 0 0-.354 0l-8.739 8.739a1.768 1.768 0 0 1-2.5-2.5l9.541-9.541A2.643 2.643 0 0 1 12 10.416Z",fill:"currentColor"}),o.createElement("path",{d:"M12 .25a2.643 2.643 0 0 1 1.875.775l9.541 9.541a1.768 1.768 0 0 1-2.5 2.5l-8.739-8.739a.25.25 0 0 0-.354 0l-8.739 8.739a1.768 1.768 0 0 1-2.5-2.5l9.541-9.541A2.643 2.643 0 0 1 12 .25Z",fill:"currentColor"}));let By=l.a.createContext(null);function _y({summaryCollapsed:e,onBudgetAction:t,onToggleSummaryCollapse:n,children:r}){let a=de.d();return l.a.createElement(By.Provider,{value:{currentMonth:a,summaryCollapsed:e,onBudgetAction:t,onToggleSummaryCollapse:n},children:r})}function Ly(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return zy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fy({style:e,progress:t,color:n,backgroundColor:r}){let a=2*Math.PI*4,o=t*a,i=a;return l.a.createElement("svg",{viewBox:"0 0 20 20",style:e},l.a.createElement("circle",{r:"10",cx:"10",cy:"10",fill:r}),l.a.createElement("circle",{r:4,cx:"10",cy:"10",fill:"none",stroke:n,strokeWidth:8,strokeDasharray:`${o} ${i}`,transform:"rotate(-90) translate(-20)"})," ")}function Ny(e,t){return 0===t?e>0?1:0:e/t}var Uy={width:20,height:20};function $y({current:e,target:t}){let n=Object(Pt.a)(e)||0,r=!1;n<0&&(r=!0,n=-n);let a=Ny(n,Object(Pt.a)(t)||0);return l.a.createElement(Fy,{progress:a,color:r?W.a.r7:W.a.g5,backgroundColor:r?W.a.r10:W.a.n10,style:Uy})}var Wy={width:20,height:20};function Gy({current:e,target:t}){let n,r=Object(Pt.a)(e)||0,a=Object(Pt.a)(t)||0,o=!1;return(r=Math.max(-r,0))>a?(n=(r-a)/a,o=!0):n=Ny(r,a),l.a.createElement(Fy,{progress:n,color:o?W.a.r7:W.a.g5,backgroundColor:o?W.a.r10:W.a.n10,style:Wy})}var Hy={lineHeight:1.5,flexDirection:"row",alignItems:"center",fontSize:14},qy={marginLeft:10},Yy={color:W.a.n4},Vy={color:W.a.n6,fontStyle:"italic"};function Ky({title:e,current:t,target:n,ProgressComponent:r,style:a}){return l.a.createElement($.C,{style:[Hy,a]},l.a.createElement(r,{current:t,target:n}),l.a.createElement($.C,{style:qy},l.a.createElement($.C,null,l.a.createElement($.z,{style:Yy},e)),l.a.createElement($.z,null,l.a.createElement(xt,{binding:t,type:"financial"}),l.a.createElement($.z,{style:Vy}," of ",l.a.createElement(xt,{binding:n,type:"financial",style:W.c.notFixed})))))}function Zy({projected:e,style:t}){return l.a.createElement(Ky,{title:"Income",current:ze.totalIncome,target:ze.totalBudgetedIncome,ProgressComponent:$y,style:t})}function Qy({style:e}){return l.a.createElement(Ky,{title:"Expenses",current:ze.totalSpent,target:ze.totalBudgetedExpense,ProgressComponent:Gy,style:e})}var Jy={alignItems:"center",fontSize:14},Xy={color:W.a.n4},eg={color:W.a.n4},tg={padding:10,fontSize:14};function ng({projected:e,style:t}){let n=Object(Pt.a)(ze.totalBudgetedSaved)||0,r=Object(Pt.a)(ze.totalSaved)||0,a=e?n:r,o=a<0;return l.a.createElement($.C,{style:[Jy,t]},e?l.a.createElement($.z,{style:Xy},"Projected Savings:"):l.a.createElement($.C,{style:eg},o?"Overspent:":"Saved:"),l.a.createElement($.k,{renderContent:()=>{if(!e){let e=r-n;return l.a.createElement($.B,{position:"bottom-center",style:tg},l.a.createElement($.a,{left:"Projected Savings:",right:l.a.createElement($.z,{style:[pp(n),W.c.tnum]},Object(St.a)(n,"financial-with-sign"))}),l.a.createElement($.a,{left:"Difference:",right:l.a.createElement($.z,{style:[pp(e),W.c.tnum]},Object(St.a)(e,"financial-with-sign"))}))}return null}},l.a.createElement($.C,Object(lt.css)([{fontSize:25,color:e?W.a.y3:o?W.a.r4:W.a.p5}]),Object(St.a)(a,"financial"))))}var rg={backgroundColor:"white",boxShadow:Yp,borderRadius:6,marginLeft:0,marginRight:0,marginTop:5,flex:1,cursor:"default",marginBottom:5,overflow:"hidden","& .hover-visible":{opacity:0,transition:"opacity .25s"},"&:hover .hover-visible":{opacity:1}},ag={padding:"0 13px"},og={margin:"10px 0"},lg={marginTop:16},ig={position:"absolute",left:10,top:0},cg={color:W.a.n6,margin:1},sg={textAlign:"center",marginTop:3,fontSize:18,fontWeight:500,textDecorationSkip:"ink"},ug={textDecoration:"underline"},dg={position:"absolute",right:10,top:0,flexDirection:"row",alignItems:"center"},fg={userSelect:"none"},pg={color:W.a.n5},mg={padding:0},yg={alignSelf:"center",backgroundColor:W.a.n11,borderRadius:4,padding:"10px 15px",marginTop:13},gg={alignItems:"center",padding:"10px 20px",justifyContent:"space-between",backgroundColor:W.a.n11,borderTop:"1px solid "+W.a.n10},hg={marginTop:13,marginBottom:20},bg=l.a.memo(function({month:e}){let t=Object(o.useContext)(By),n=t.currentMonth,r=t.summaryCollapsed,a=t.onBudgetAction,i=t.onToggleSummaryCollapse,c=Ly(Object(o.useState)(!1),2),s=c[0],u=c[1];function d(e){u(!1)}let f=r?Dy:Ry;return l.a.createElement($.C,{style:rg},l.a.createElement(Bp.a.Provider,{value:de.w(e,"report")},l.a.createElement($.C,{style:[ag,r?og:lg]},l.a.createElement($.C,{style:ig},l.a.createElement($.d,{className:"hover-visible",bare:!0,onClick:i},l.a.createElement(f,{width:13,height:13,style:cg}))),l.a.createElement("div",Object(lt.css)([sg,n===e&&ug]),de.g(e,"MMMM")),l.a.createElement($.C,{style:dg},l.a.createElement($.C,null,l.a.createElement(Et,{id:`budget-${e}`,width:15,height:15,tooltipPosition:"bottom-right",defaultColor:W.a.n6})),l.a.createElement($.C,{style:fg},l.a.createElement($.d,{bare:!0,onClick:function(e){u(!0)}},l.a.createElement(Bt.a,{width:15,height:15,style:pg})),s&&l.a.createElement($.B,{position:"bottom-right",width:200,style:mg,onClose:d},l.a.createElement($.s,{onMenuSelect:t=>{d(),a(e,t)},items:[{name:"copy-last",text:"Copy last month's budget"},{name:"set-zero",text:"Set budgets to zero"},{name:"set-3-avg",text:"Set budgets to 3 month avg"}]}))))),!r&&l.a.createElement($.y,{spacing:2,style:yg},l.a.createElement(Zy,null),l.a.createElement(Qy,null)),r?l.a.createElement($.C,{style:gg},l.a.createElement(ng,{projected:e>=n})):l.a.createElement(ng,{projected:e>=n,style:hg})))});let Og={flex:1,padding:"0 5px",textAlign:"right"};var wg={flex:1,flexDirection:"row",marginRight:5,paddingTop:10,paddingBottom:10},vg={color:W.a.n4},Eg={color:W.a.n4,fontWeight:600},jg={color:W.a.n4},Sg={color:W.a.n4,fontWeight:600},Cg={color:W.a.n4},xg={color:W.a.n4,fontWeight:600};const Pg=l.a.memo(function(){return l.a.createElement($.C,{style:wg},l.a.createElement($.C,{style:Og},l.a.createElement($.z,{style:vg},"Budgeted"),l.a.createElement(xt,{binding:ze.totalBudgetedExpense,type:"financial",style:Eg,formatter:e=>Object(St.a)(parseFloat(e||"0"),"financial")})),l.a.createElement($.C,{style:Og},l.a.createElement($.z,{style:jg},"Spent"),l.a.createElement(xt,{binding:ze.totalSpent,type:"financial",style:Sg})),l.a.createElement($.C,{style:Og},l.a.createElement($.z,{style:Cg},"Balance"),l.a.createElement(xt,{binding:ze.totalLeftover,type:"financial",style:xg})))});var kg={flexDirection:"row",marginRight:5,paddingBottom:5},Ag={color:W.a.n4},Dg={color:W.a.n4};function Ig(){return l.a.createElement($.C,{style:kg},l.a.createElement($.C,{style:Og},l.a.createElement($.z,{style:Ag},"Budgeted")),l.a.createElement($.C,{style:Og},l.a.createElement($.z,{style:Dg},"Received")))}var Tg={flex:1,flexDirection:"row"},Mg={fontWeight:600},Rg={fontWeight:600},Bg={fontWeight:600,paddingRight:5};const _g=l.a.memo(function({group:e}){let t=W.a.border,n=e.id;return l.a.createElement($.C,{style:Tg},l.a.createElement(kt.k,{name:"budgeted",width:"flex",borderColor:t,textAlign:"right",style:[Mg,W.c.tnum],valueProps:{binding:ze.groupBudgeted(n),type:"financial"}}),l.a.createElement(kt.k,{name:"spent",width:"flex",textAlign:"right",borderColor:t,style:[Rg,W.c.tnum],valueProps:{binding:ze.groupSumAmount(n),type:"financial"}}),!e.is_income&&l.a.createElement(kt.k,{name:"balance",width:"flex",borderColor:t,textAlign:"right",style:[Bg,W.c.tnum],valueProps:{binding:ze.groupBalance(n),type:"financial"}}))});var Lg={padding:0};function zg({categoryId:e,tooltip:t,monthIndex:n,onBudgetAction:r}){let a=Object(Pt.a)(ze.catCarryover(e));return l.a.createElement($.B,{position:"bottom-right",width:200,style:Lg,onClose:t.close},l.a.createElement($.s,{onMenuSelect:o=>{r(n,"carryover",{category:e,flag:!a}),t.close()},items:[{name:"carryover",text:a?"Remove overspending rollover":"Rollover overspending"}]}))}var Fg={flex:1,flexDirection:"row"},Ng={zIndex:100},Ug={cursor:"default",margin:1,padding:"0 4px",borderRadius:4},$g={":hover":{boxShadow:"inset 0 0 0 1px "+W.a.n7,backgroundColor:"white"}},Wg={textAlign:"right"},Gg={cursor:"pointer",":hover":{textDecoration:"underline"}},Hg={paddingRight:5,textAlign:"right"};const qg=l.a.memo(function({monthIndex:e,category:t,budgeted:n,currentSum:r,balance:a,editing:o,onEdit:i,onBudgetAction:c,onShowActivity:s}){let u=W.a.border,d=Object($.E)();return l.a.createElement($.C,{style:Fg},l.a.createElement(kt.k,{name:"budget",sync:!0,exposed:o,width:"flex",borderColor:u,onExpose:()=>i(t.id,e),style:[o&&Ng,W.c.tnum],textAlign:"right",valueStyle:[Ug,$g],valueProps:{binding:ze.catBudgeted(t.id),type:"financial",getValueStyle:dp,formatExpr:e=>Object(ke.k)(e),unformatExpr:e=>Object(ke.b)(Ii(e,0))},inputProps:{onBlur:()=>{i(null)}},onSave:n=>{c(e,"budget-amount",{category:t.id,amount:n})}}),l.a.createElement(kt.e,{name:"spent",width:"flex",borderColor:u,style:Wg},l.a.createElement("span",{onClick:()=>s(t.name,t.id,e)},l.a.createElement(xt,{binding:ze.catSumAmount(t.id),type:"financial",getStyle:dp,style:Gg}))),!t.is_income&&l.a.createElement(kt.e,{name:"balance",width:"flex",borderColor:u,style:Hg},l.a.createElement("span",t.is_income?{}:d.getOpenEvents(),l.a.createElement(xy,{category:t,disabled:t.is_income,carryover:ze.catCarryover(t.id),balance:ze.catBalance(t.id)})),d.isOpen&&l.a.createElement(zg,{categoryId:t.id,tooltip:d,monthIndex:e,onBudgetAction:c})))}),Yg=_g,Vg=qg,Kg=_g,Zg=qg;function Qg(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Jg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jg(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Xg={padding:10},eh={marginBottom:5},th={margin:"10px 0 5px 0"},nh={alignItems:"flex-end",marginTop:10},rh={fontSize:12,paddingTop:3,paddingBottom:3};function ah({initialAmount:e,initialAmountName:t,showToBeBudgeted:n,tooltipProps:r,onSubmit:a,onClose:i}){let c=Object(o.useContext)(T.a),s=Object(o.useContext)(Bp.a),u=Object(o.useContext)(sp);u=u.filter(e=>!e.is_income),n&&(u=up(u));let d=Qg(Object(o.useState)(null),2),f=d[0],p=d[1],m=Qg(Object(o.useState)(null),2),y=m[0],g=m[1];function h(){let e=Ii(f,null);e&&y&&(a(Object(ke.b)(e),y),i())}return Object(o.useEffect)(()=>{(async()=>{if(t){const e=await c.get(s,t);p(Object(ke.k)(Math.max(e.value,0)))}else p(Object(ke.k)(Math.max(e,0)))})()},[]),null===f?null:l.a.createElement($.B,Object.assign({position:"bottom-right",width:200,style:Xg},r,{onClose:i}),l.a.createElement($.C,{style:eh},"Transfer this amount:"),l.a.createElement($.C,null,l.a.createElement($.l,null,l.a.createElement($.n,{value:f,onChange:e=>p(e.target.value),onEnter:h}))),l.a.createElement($.C,{style:th},"To:"),l.a.createElement(vo,{categoryGroups:u,value:null,openOnFocus:!0,onUpdate:e=>{},onSelect:e=>g(e),inputProps:{onEnter:h}}),l.a.createElement($.C,{style:nh},l.a.createElement($.d,{primary:!0,style:rh,onClick:h},"Transfer")))}var oh=n(139);function lh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ih(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ih(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ih(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ch={padding:10},sh={marginBottom:5},uh={alignItems:"flex-end",marginTop:10},dh={fontSize:12,paddingTop:3,paddingBottom:3};function fh({onSubmit:e,onClose:t}){const n=Object(o.useContext)(T.a),r=Object(o.useContext)(Bp.a),a=lh(Object(o.useState)(null),2),i=a[0],c=a[1];function s(){const n=Ii(i,null);n&&e(Object(ke.b)(n)),t()}return Object(o.useEffect)(()=>{(async()=>{const e=await n.get(r,"to-budget");c(Object(ke.k)(Math.max(e.value,0)))})()},[]),null===i?null:l.a.createElement($.B,{position:"bottom-right",width:200,style:ch,onClose:t},l.a.createElement($.C,{style:sh},"Hold this amount:"),l.a.createElement($.C,null,l.a.createElement($.l,null,l.a.createElement($.n,{value:i,onChange:e=>c(e.target.value),onEnter:s}))),l.a.createElement($.C,{style:uh},l.a.createElement($.d,{primary:!0,style:dh,onClick:s},"Hold")))}let ph=l.a.createContext(null);function mh({categoryGroups:e,summaryCollapsed:t,onBudgetAction:n,onToggleSummaryCollapse:r,children:a}){let o=de.d();return l.a.createElement(ph.Provider,{value:{currentMonth:o,categoryGroups:e,summaryCollapsed:t,onBudgetAction:n,onToggleSummaryCollapse:r},children:a})}function yh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return gh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var hh={flexDirection:"row",lineHeight:1.5,justifyContent:"center"},bh={padding:"5px 0",marginTop:17,backgroundColor:W.a.n11,borderTopWidth:1,borderBottomWidth:1,borderColor:W.a.n9},Oh={padding:7},wh={textAlign:"right",marginRight:10,minWidth:50},vh={flexShrink:0},Eh={lineHeight:1.5,padding:"6px 10px"},jh={fontWeight:600},Sh={fontWeight:600},Ch={fontWeight:600},xh={fontWeight:600};function Ph({prevMonthName:e,collapsed:t}){return l.a.createElement($.C,{style:[hh,!t&&bh,t&&Oh,W.c.smallText]},l.a.createElement($.C,{style:wh},l.a.createElement($.k,{style:vh,renderContent:()=>l.a.createElement($.B,{width:200,style:Eh},l.a.createElement($.a,{left:"Income:",right:l.a.createElement(xt,{binding:Le.totalIncome,type:"financial"})}),l.a.createElement($.a,{left:"From Last Month:",right:l.a.createElement(xt,{binding:Le.fromLastMonth,type:"financial"})}))},l.a.createElement(xt,{binding:Le.incomeAvailable,type:"financial",style:jh})),l.a.createElement(xt,{binding:Le.lastMonthOverspent,formatter:e=>{let t=Object(St.a)(e,"financial");return e>0?"+"+t:0===e?"-"+t:t},style:[Sh,W.c.tnum]}),l.a.createElement(xt,{binding:Le.totalBudgeted,formatter:e=>{let t=Object(St.a)(e,"financial");return e>0?"+"+t:0===e?"-"+t:t},style:[Ch,W.c.tnum]}),l.a.createElement(xt,{binding:Le.forNextMonth,formatter:e=>{let t=parseInt(e)||0,n=Object(St.a)(Math.abs(t),"financial");return t>=0?"-"+n:"+"+n},style:[xh,W.c.tnum]})),l.a.createElement($.C,null,l.a.createElement($.c,null,"Available Funds"),l.a.createElement($.c,null,"Overspent in ",e),l.a.createElement($.c,null,"Budgeted"),l.a.createElement($.c,null,"For Next Month")))}var kh={alignItems:"center"},Ah={padding:0};function Dh({month:e,prevMonthName:t,collapsed:n,onBudgetAction:r}){return l.a.createElement(Ct.a,{binding:Le.toBudget,initialValue:0},a=>{const o=parseInt(a.value),i=isNaN(o)?0:o,c=i<0;var s={fontWeight:400,userSelect:"none",cursor:"pointer",color:c?W.a.r4:W.a.p5,marginBottom:-1,borderBottom:"1px solid transparent",":hover":{borderColor:c?W.a.r4:W.a.p5}};return l.a.createElement($.C,{style:kh},l.a.createElement($.c,null,c?"Overbudgeted:":"To Budget:"),l.a.createElement(oh.a,{initialState:{menuOpen:null}},({state:c,setState:u})=>l.a.createElement($.C,null,l.a.createElement($.k,{disabled:!n||c.menuOpen,renderContent:()=>l.a.createElement($.B,{position:"bottom-center"},l.a.createElement(Ph,{collapsed:!0,prevMonthName:t}))},l.a.createElement($.c,Object.assign({onClick:()=>u({menuOpen:"actions"}),"data-cellname":a.name},Object(lt.css)([W.c.veryLargeText,s])),Object(St.a)(i,"financial"))),"actions"===c.menuOpen&&l.a.createElement($.B,{position:"bottom-center",width:200,style:Ah,onClose:()=>u({menuOpen:null})},l.a.createElement($.s,{onMenuSelect:t=>{"reset-buffer"===t?(r(e,"reset-hold"),u({menuOpen:null})):u({menuOpen:t})},items:[{name:"transfer",text:"Move to a category"},{name:"buffer",text:"Hold for next month"},{name:"reset-buffer",text:"Reset next month's buffer"}]})),"buffer"===c.menuOpen&&l.a.createElement(fh,{onClose:()=>u({menuOpen:null}),onSubmit:t=>{r(e,"hold",{amount:t})}}),"transfer"===c.menuOpen&&l.a.createElement(ah,{initialAmount:o,onClose:()=>u({menuOpen:null}),onSubmit:(t,n)=>{r(e,"transfer-available",{amount:t,category:n})}}))))})}var Ih={backgroundColor:"white",boxShadow:Yp,borderRadius:6,marginLeft:0,marginRight:0,marginTop:5,flex:1,cursor:"default",marginBottom:5,overflow:"hidden","& .hover-visible":{opacity:0,transition:"opacity .25s"},"&:hover .hover-visible":{opacity:1}},Th={padding:"0 13px"},Mh={margin:"10px 0"},Rh={marginTop:16},Bh={position:"absolute",left:10,top:0},_h={color:W.a.n6,margin:1},Lh={textAlign:"center",marginTop:3,fontSize:18,fontWeight:500,textDecorationSkip:"ink"},zh={textDecoration:"underline"},Fh={position:"absolute",right:10,top:0,flexDirection:"row",alignItems:"center"},Nh={userSelect:"none",marginLeft:2},Uh={color:W.a.n5},$h={padding:0},Wh={alignItems:"center",padding:"10px 20px",justifyContent:"space-between",backgroundColor:W.a.n11,borderTop:"1px solid "+W.a.n10},Gh={margin:"23px 0"};var Hh=Object(s.b)(e=>({localPrefs:e.prefs.local}),y)(function({month:e,localPrefs:t}){let n=Object(o.useContext)(ph),r=n.currentMonth,a=n.summaryCollapsed,i=n.onBudgetAction,c=n.onToggleSummaryCollapse,s=yh(Object(o.useState)(!1),2),u=s[0],d=s[1];function f(e){d(!1)}let p=de.g(de.u(e),"MMM"),m=a?Dy:Ry,y=t["flags.goalTemplatesEnabled"];return l.a.createElement($.C,{style:Ih},l.a.createElement(Bp.a.Provider,{value:de.w(e)},l.a.createElement($.C,{style:[Th,a?Mh:Rh]},l.a.createElement($.C,{style:Bh},l.a.createElement($.d,{className:"hover-visible",bare:!0,onClick:c},l.a.createElement(m,{width:13,height:13,style:_h}))),l.a.createElement("div",Object(lt.css)([Lh,r===e&&zh]),de.g(e,"MMMM")),l.a.createElement($.C,{style:Fh},l.a.createElement($.C,null,l.a.createElement(Et,{id:`budget-${e}`,width:15,height:15,tooltipPosition:"bottom-right",defaultColor:W.a.n6})),l.a.createElement($.C,{style:Nh},l.a.createElement($.d,{bare:!0,onClick:function(e){d(!0)}},l.a.createElement(Bt.a,{width:15,height:15,style:Uh})),u&&l.a.createElement($.B,{position:"bottom-right",width:200,style:$h,onClose:f},l.a.createElement($.s,{onMenuSelect:t=>{f(),i(e,t)},items:[{name:"copy-last",text:"Copy last month's budget"},{name:"set-zero",text:"Set budgets to zero"},{name:"set-3-avg",text:"Set budgets to 3 month avg"},y&&{name:"apply-goal-template",text:"Apply budget template"},y&&{name:"overwrite-goal-template",text:"Overwrite with budget template"}]}))))),a?l.a.createElement($.C,{style:Wh},l.a.createElement(Dh,{collapsed:a,prevMonthName:p,month:e,onBudgetAction:i})):l.a.createElement(l.a.Fragment,null,l.a.createElement(Ph,{prevMonthName:p}),l.a.createElement($.C,{style:Gh},l.a.createElement(Dh,{month:e,onBudgetAction:i})))))});function qh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Yh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Vh={padding:10},Kh={marginBottom:5},Zh={alignItems:"flex-end",marginTop:10},Qh={fontSize:12,paddingTop:3};function Jh({showToBeBudgeted:e,inline:t,tooltipProps:n,onSubmit:r,onClose:a}){let i=Object(o.useContext)(sp);i=up(i.filter(e=>!e.is_income));let c=qh(Object(o.useState)(null),2),s=c[0],u=c[1];function d(){s&&(r(s),a())}return l.a.createElement($.B,Object.assign({position:"bottom-right",width:200,style:Vh},n,{onClose:a}),l.a.createElement($.C,{style:Kh},"Cover from category:"),l.a.createElement($.l,null,e=>l.a.createElement(vo,{categoryGroups:i,value:null,openOnFocus:!0,onUpdate:e=>{},onSelect:e=>u(e),inputProps:{inputRef:e,onKeyDown:e=>{13===e.keyCode&&d()}}})),l.a.createElement($.C,{style:Zh},l.a.createElement($.d,{primary:!0,style:Qh,onClick:d},"Transfer")))}var Xh={padding:0};function eb({categoryId:e,tooltip:t,monthIndex:n,onBudgetAction:r}){let a=Object(Pt.a)(Le.catCarryover(e)),i=Object(Pt.a)(Le.catBalance(e)),c=qh(Object(o.useState)("menu"),2),s=c[0],u=c[1];return l.a.createElement(l.a.Fragment,null,"menu"===s&&l.a.createElement($.B,{position:"bottom-right",width:200,style:Xh,onClose:t.close},l.a.createElement($.s,{onMenuSelect:o=>{"carryover"===o?(r(n,"carryover",{category:e,flag:!a}),t.close()):u(o)},items:[{name:"transfer",text:"Transfer to another category"},{name:"carryover",text:a?"Remove overspending rollover":"Rollover overspending"},i<0&&{name:"cover",text:"Cover overspending"}].filter(e=>e)})),"transfer"===s&&l.a.createElement(ah,{initialAmountName:Le.catBalance(e),showToBeBudgeted:!0,onClose:t.close,onSubmit:(t,a)=>{r(n,"transfer-category",{amount:t,from:e,to:a})}}),"cover"===s&&l.a.createElement(Jh,{showToBeBudgeted:!0,onClose:t.close,onSubmit:t=>{r(n,"cover",{to:e,from:t})}}))}let tb={flex:1,padding:"0 5px",textAlign:"right"};var nb={flex:1,flexDirection:"row",marginRight:5,paddingTop:10,paddingBottom:10},rb={color:W.a.n4},ab={color:W.a.n4,fontWeight:600},ob={color:W.a.n4},lb={color:W.a.n4,fontWeight:600},ib={color:W.a.n4},cb={color:W.a.n4,fontWeight:600};const sb=l.a.memo(function(){return l.a.createElement($.C,{style:nb},l.a.createElement($.C,{style:tb},l.a.createElement($.z,{style:rb},"Budgeted"),l.a.createElement(xt,{binding:Le.totalBudgeted,type:"financial",style:ab,formatter:e=>Object(St.a)(-parseFloat(e||"0"),"financial")})),l.a.createElement($.C,{style:tb},l.a.createElement($.z,{style:ob},"Spent"),l.a.createElement(xt,{binding:Le.totalSpent,type:"financial",style:lb})),l.a.createElement($.C,{style:tb},l.a.createElement($.z,{style:ib},"Balance"),l.a.createElement(xt,{binding:Le.totalBalance,type:"financial",style:cb})))});var ub={color:W.a.n4,alignItems:"center",paddingRight:10},db={flex:1,textAlign:"right"};function fb(){return l.a.createElement(kt.h,{style:ub},l.a.createElement($.C,{style:db},"Received"))}var pb={flex:1,flexDirection:"row"},mb={fontWeight:600},yb={fontWeight:600},gb={fontWeight:600,paddingRight:5};const hb=l.a.memo(function({group:e}){let t=W.a.border,n=e.id;return l.a.createElement($.C,{style:pb},l.a.createElement(kt.k,{name:"budgeted",width:"flex",borderColor:t,textAlign:"right",style:[mb,W.c.tnum],valueProps:{binding:Le.groupBudgeted(n),type:"financial"}}),l.a.createElement(kt.k,{name:"spent",width:"flex",textAlign:"right",borderColor:t,style:[yb,W.c.tnum],valueProps:{binding:Le.groupSumAmount(n),type:"financial"}}),l.a.createElement(kt.k,{name:"balance",width:"flex",borderColor:t,textAlign:"right",style:[gb,W.c.tnum],valueProps:{binding:Le.groupBalance(n),type:"financial"}}))});var bb={flex:1,flexDirection:"row"},Ob={zIndex:100},wb={cursor:"default",margin:1,padding:"0 4px",borderRadius:4},vb={":hover":{boxShadow:"inset 0 0 0 1px "+W.a.n7,backgroundColor:"white"}},Eb={textAlign:"right"},jb={cursor:"pointer",":hover":{textDecoration:"underline"}},Sb={paddingRight:5,textAlign:"right"};const Cb=l.a.memo(function({monthIndex:e,category:t,editing:n,onEdit:r,onBudgetAction:a,onShowActivity:o}){let i=W.a.border,c=Object($.E)();return l.a.createElement($.C,{style:bb},l.a.createElement(kt.k,{name:"budget",sync:!0,exposed:n,width:"flex",borderColor:i,onExpose:()=>r(t.id,e),style:[n&&Ob,W.c.tnum],textAlign:"right",valueStyle:[wb,vb],valueProps:{binding:Le.catBudgeted(t.id),type:"financial",getValueStyle:dp,formatExpr:e=>Object(ke.k)(e),unformatExpr:e=>Object(ke.b)(Ii(e,0))},inputProps:{onBlur:()=>{r(null)}},onSave:n=>{a(e,"budget-amount",{category:t.id,amount:n})}}),l.a.createElement(kt.e,{name:"spent",width:"flex",borderColor:i,style:Eb},l.a.createElement("span",{onClick:()=>o(t.name,t.id,e)},l.a.createElement(xt,{binding:Le.catSumAmount(t.id),type:"financial",getStyle:dp,style:jb}))),l.a.createElement(kt.e,{name:"balance",width:"flex",borderColor:i,style:Sb},l.a.createElement("span",c.getOpenEvents(),l.a.createElement(xy,{category:t,carryover:Le.catCarryover(t.id),balance:Le.catBalance(t.id)})),c.isOpen&&l.a.createElement(eb,{categoryId:t.id,tooltip:c,monthIndex:e,onBudgetAction:a})))});var xb={flex:1},Pb={fontWeight:600,paddingRight:5};function kb({group:e}){return l.a.createElement($.C,{style:xb},l.a.createElement(kt.k,{name:"received",width:"flex",borderColor:W.a.border,textAlign:"right",style:[Pb,W.c.tnum],valueProps:{binding:Le.groupIncomeReceived,type:"financial"}}))}var Ab={flex:1},Db={paddingRight:5,textAlign:"right"},Ib={borderBottomWidth:0},Tb={cursor:"pointer",":hover":{textDecoration:"underline"}};function Mb({category:e,isLast:t,monthIndex:n,onShowActivity:r}){return l.a.createElement($.C,{style:Ab},l.a.createElement(kt.e,{name:"received",width:"flex",borderColor:W.a.border,style:[Db,t&&Ib]},l.a.createElement("span",{onClick:()=>r(e.name,e.id,n)},l.a.createElement(xt,{binding:Le.catSumAmount(e.id),type:"financial",style:Tb}))))}var Rb=n(65);function Bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bb(Object(n),!0).forEach(function(t){Lb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Lb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var zb=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:_b({color:"#242134"},e.style)}),o.createElement("path",{d:"m3.828 9 6.071-6.071-1.414-1.414L0 10l.707.707 7.778 7.778 1.414-1.414L3.828 11H20V9H3.828z",fill:"currentColor"}));function Fb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Nb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fb(Object(n),!0).forEach(function(t){Ub(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ub(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $b=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Nb({color:"#242134"},e.style)}),o.createElement("rect",{x:.5,y:2.5,width:23,height:3,rx:1,ry:1,fill:"currentColor"}),o.createElement("rect",{x:.5,y:10.5,width:23,height:3,rx:1,ry:1,fill:"currentColor"}),o.createElement("rect",{x:.5,y:18.5,width:23,height:3,rx:1,ry:1,fill:"currentColor"})),Wb=n(73),Gb=n(118);function Hb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hb(Object(n),!0).forEach(function(t){Yb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Yb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vb=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:qb({color:"#242134"},e.style)}),o.createElement("path",{d:"M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 5h2v6H9V5zm0 8h2v2H9v-2z",fill:"currentColor"}));function Kb(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Zb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zb(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zb(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Qb={flexDirection:"row",alignItems:"center",color:W.a.r5,backgroundColor:W.a.r10,padding:"4px 8px",borderRadius:4},Jb={width:14,height:14,marginRight:5,color:"currentColor"},Xb={fontSize:14,padding:15,maxWidth:400},eO={marginBottom:"1.15em"},tO={marginBottom:"1.25em",color:W.a.r5},nO={justifyContent:"flex-end",flexDirection:"row"},rO={marginLeft:5};var aO=Object(s.b)(e=>({accounts:e.queries.accounts,failedAccounts:e.account.failedAccounts}),y)(function({id:e,accounts:t,failedAccounts:n,syncAndDownload:r,markAccountSuccess:a,unlinkAccount:i,pushModal:c,closeModal:s,getAccounts:u,addNotification:d}){if(!n)return null;let f=n.get(e);if(!f)return null;let p=Kb(Object(o.useState)(!1),2),m=p[0],y=p[1],g=t.find(t=>t.id===e),h=f.type,b=f.code,O="ITEM_ERROR"===h&&"ITEM_LOGIN_REQUIRED"===b||"INVALID_INPUT"===h&&"INVALID_ACCESS_TOKEN"===b;async function w(){i(g.id),y(!1)}return l.a.createElement($.C,null,l.a.createElement($.d,{bare:!0,style:Qb,onClick:()=>y(!0)},l.a.createElement(Vb,{style:Jb})," ","This account is experiencing connection problems. Let","'","s fix it."),m&&l.a.createElement($.B,{position:"bottom-left",onClose:()=>y(!1),style:Xb},l.a.createElement("div",{style:eO},"The server returned the following error:"),l.a.createElement("div",{style:tO},function(e,t){switch(e.toUpperCase()){case"ITEM_ERROR":switch(t.toUpperCase()){case"NO_ACCOUNTS":return"No open accounts could be found. Did you close the account? If so, unlink the account.";case"ITEM_LOGIN_REQUIRED":return"Your password or something else has changed with your bank and you need to login again."}break;case"INVALID_INPUT":switch(t.toUpperCase()){case"INVALID_ACCESS_TOKEN":return"Item is no longer authorized. You need to login again."}break;case"API_ERROR":switch(t.toUpperCase()){case"PLANNED_MAINTENANCE":return"Our servers are currently undergoing maintenance and will be available again soon."}break;case"RATE_LIMIT_EXCEEDED":return"Rate limit exceeded for this item. Please try again later."}return l.a.createElement(l.a.Fragment,null,"An internal error occurred. Try to login again, or get"," ",l.a.createElement("a",{href:"https://actualbudget.github.io/docs/Contact/",target:"_blank",rel:"noopener noreferrer"},"in touch")," ","for support.")}(f.type,f.code)),l.a.createElement($.C,{style:nO},O?l.a.createElement(l.a.Fragment,null,l.a.createElement($.d,{onClick:w},"Unlink"),l.a.createElement($.d,{primary:!0,onClick:function(){y(!1),async function(e,t,n){let r=(await Object(M.send)("make-plaid-public-token",{bankId:t})).linkToken;return!!r&&(dn(e,r,{onSuccess:n,onClose:n}),!0)}(c,g.bankId,()=>{s(),r(n.size>1?null:g.id)})||d({type:"error",message:"Unable to process this item, sorry!"})},style:rO},"Reauthorize")):l.a.createElement($.d,{onClick:w},"Unlink account"))))});function oO({color:e,onClick:t}){return l.a.createElement(Yi,{style:{width:13,height:13,color:e,marginRight:5},onClick:t})}var lO={flexDirection:"row",marginRight:20,marginTop:-1,"& svg":{transition:"transform .15s"},"& svg:hover":{transform:"scale(1.2)"}};function iO({maxMonths:e,onChange:t}){let n=U().displayMax;if(n<=1)return null;let r=[];for(let a=1;a<=n;a++)r.push(l.a.createElement(oO,{key:a,color:e>=a?W.a.n5:W.a.n8,onClick:()=>t(a)}));return l.a.createElement($.C,{style:lO,title:"Choose the number of months shown at a time"},r)}var cO=n(472),sO=n(601);function uO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uO(Object(n),!0).forEach(function(t){fO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pO=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:dO({color:"#242134"},e.style)}),o.createElement("path",{d:"m12.95 10.707.707-.707L8 4.343 6.586 5.757 10.828 10l-4.242 4.243L8 15.657l4.95-4.95z",fill:"currentColor"}));function mO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mO(Object(n),!0).forEach(function(t){gO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hO=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",style:yO({color:"#242134"},e.style)}),o.createElement("path",{d:"M19 18h-1v-8c0-.6-.4-1-1-1s-1 .4-1 1v8h-3V1c0-.6-.4-1-1-1s-1 .4-1 1v17H8V7c0-.6-.4-1-1-1s-1 .4-1 1v11H3V3c0-.6-.4-1-1-1s-1 .4-1 1v15c-.6 0-1 .4-1 1s.4 1 1 1h18c.6 0 1-.4 1-1s-.4-1-1-1z",fill:"currentColor"}));function bO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bO(Object(n),!0).forEach(function(t){wO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var vO=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:OO({color:"#242134"},e.style)}),o.createElement("path",{d:"M18 9.87V20H2V9.87a4.25 4.25 0 0 0 3-.38V14h10V9.5a4.26 4.26 0 0 0 3 .37zM3 0h4l-.67 6.03A3.43 3.43 0 0 1 3 9C1.34 9 .42 7.73.95 6.15L3 0zm5 0h4l.7 6.3c.17 1.5-.91 2.7-2.42 2.7h-.56A2.38 2.38 0 0 1 7.3 6.3L8 0zm5 0h4l2.05 6.15C19.58 7.73 18.65 9 17 9a3.42 3.42 0 0 1-3.33-2.97L13 0z",fill:"currentColor"}));function EO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?EO(Object(n),!0).forEach(function(t){SO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function SO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var CO=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:jO({color:"#242134"},e.style)}),o.createElement("path",{d:"M17 16v4h-2v-4h-2v-3h6v3h-2zM1 9h6v3H1V9zm6-4h6v3H7V5zM3 0h2v8H3V0zm12 0h2v12h-2V0zM9 0h2v4H9V0zM3 12h2v8H3v-8zm6-4h2v12H9V8z",fill:"currentColor"}));function xO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function PO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xO(Object(n),!0).forEach(function(t){kO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var AO=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:PO({color:"#242134"},e.style)}),o.createElement("path",{d:"M10.416 12a2.643 2.643 0 0 1 .775-1.875L20.732.584a1.768 1.768 0 0 1 2.5 2.5l-8.739 8.739a.25.25 0 0 0 0 .354l8.739 8.739a1.768 1.768 0 0 1-2.5 2.5l-9.541-9.541A2.643 2.643 0 0 1 10.416 12Z",fill:"currentColor"}),o.createElement("path",{d:"M.25 12a2.643 2.643 0 0 1 .775-1.875L10.566.584a1.768 1.768 0 0 1 2.5 2.5l-8.739 8.739a.25.25 0 0 0 0 .354l8.739 8.739a1.768 1.768 0 0 1-2.5 2.5l-9.541-9.541A2.643 2.643 0 0 1 .25 12Z",fill:"currentColor"}));function DO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return IO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return IO(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function IO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function TO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?TO(Object(n),!0).forEach(function(t){RO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const BO=240,_O=600;var LO={flexDirection:"row",alignItems:"center",height:20},zO={color:"inherit"},FO={marginLeft:8},NO={flex:1},UO={flexShrink:0},$O={marginTop:5};function WO({children:e,Icon:t,title:n,style:r,indent:a=0,to:o,exact:i,onClick:c,button:s,forceHover:u=!1,forceActive:d=!1}){const f={backgroundColor:W.a.n2},p={borderLeft:"4px solid "+W.a.p8,paddingLeft:19+a-4,color:W.a.p8},m=[MO(MO(MO({},W.c.mediumText),{},{paddingTop:9,paddingBottom:9,paddingLeft:19+a,paddingRight:10,textDecoration:"none",color:W.a.n9},u?f:{}),d?p:{}),{":hover":f}],y=l.a.createElement($.C,{style:LO},l.a.createElement(t,{width:15,height:15,style:zO}),l.a.createElement($.c,{style:FO},n),l.a.createElement($.C,{style:NO}),s);return l.a.createElement($.C,{style:[UO,r]},c?l.a.createElement(sO.a,{onClick:c},l.a.createElement($.C,{style:m},y)):l.a.createElement($.b,{style:m,to:o,exact:i,activeStyle:p},y),e?l.a.createElement($.C,{style:$O},e):null)}var GO={flexDirection:"row",alignItems:"center",height:16},HO={color:"inherit"},qO={flexShrink:0};function YO({Icon:e,title:t,style:n,to:r,exact:a,onClick:o,bold:i,indent:c=0}){const s={backgroundColor:W.a.n2},u={borderLeft:"4px solid "+W.a.p8,paddingLeft:10+c,color:W.a.p8,fontWeight:i?_O:null},d=[VO,{color:W.a.n9,paddingLeft:14+c,fontWeight:i?_O:null},{":hover":s}],f=l.a.createElement($.C,{style:GO},e&&l.a.createElement(e,{width:12,height:12,style:HO}),l.a.createElement($.c,{style:{marginLeft:e?8:0,color:"inherit"}},t));return l.a.createElement($.C,{style:[qO,n]},o?l.a.createElement(sO.a,{onClick:o},l.a.createElement($.C,{style:d},f)):l.a.createElement($.b,{style:d,to:r,exact:a,activeStyle:u},f))}let VO=[{marginTop:-2,marginBottom:2,paddingTop:4,paddingBottom:4,paddingRight:15,paddingLeft:10,textDecoration:"none",color:W.a.n9},{":hover":{backgroundColor:W.a.n2}},W.c.smallText];var KO={flexShrink:0},ZO={position:"relative",borderLeft:"4px solid transparent"},QO={fontWeight:700},JO={position:"absolute",left:0,top:0,bottom:0,flexDirection:"row",alignItems:"center"};function XO({name:e,account:t,connected:n,failed:r,updated:a,to:o,query:i,style:c,outerStyle:s,onDragChange:u,onDrop:d}){let f=t?t.closed?"account-closed":t.offbudget?"account-offbudget":"account-onbudget":"title",p=Dp({type:f,onDragChange:u,item:{id:t&&t.id},canDrag:null!=t}).dragRef,m=Ip({types:t?[f]:[],id:t&&t.id,onDrop:d}),y=m.dropRef,g=m.dropPos;return l.a.createElement($.C,{innerRef:y,style:[KO,s]},l.a.createElement($.C,null,l.a.createElement(Rp,{pos:g}),l.a.createElement($.C,{innerRef:p},l.a.createElement($.b,{to:o,style:[VO,c,ZO,a&&QO],activeStyle:{borderColor:W.a.p8,color:W.a.p8,fontWeight:c&&c.fontWeight||"normal","& .dot":{backgroundColor:W.a.p8,transform:"translateX(-4.5px)"}}},l.a.createElement($.C,{style:JO},l.a.createElement("div",Object.assign({className:"dot"},Object(lt.css)({marginRight:3,width:5,height:5,borderRadius:5,backgroundColor:r?W.a.r7:W.a.g5,marginLeft:2,transition:"transform .3s",opacity:n?1:0})))),l.a.createElement($.a,{left:e,right:l.a.createElement(xt,{debug:!0,binding:i,type:"financial"})})))))}var ew={fontWeight:_O,marginTop:15},tw={fontWeight:_O,marginTop:13},nw={fontWeight:_O,marginTop:13},rw={marginTop:15},aw={marginTop:15,marginBottom:9};function ow({accounts:e,failedAccounts:t,updatedAccounts:n,getAccountPath:r,allAccountsPath:a,budgetedAccountPath:i,offBudgetAccountPath:c,getBalanceQuery:s,getAllAccountBalance:u,getOnBudgetBalance:d,getOffBudgetBalance:f,showClosedAccounts:p,onAddAccount:m,onToggleClosedAccounts:y,onReorder:g}){let h=DO(Object(o.useState)(!1),2),b=h[0],O=h[1],w=Object(o.useMemo)(()=>e.filter(e=>0===e.closed&&1===e.offbudget),[e]),v=Object(o.useMemo)(()=>e.filter(e=>0===e.closed&&0===e.offbudget),[e]),E=Object(o.useMemo)(()=>e.filter(e=>1===e.closed),[e]);function j(e){O("start"===e.state)}let S=(e,t)=>0===e?{paddingTop:b?15:0,marginTop:b?-15:0}:null;return l.a.createElement($.C,null,l.a.createElement(XO,{name:"All accounts",to:a,query:u(),style:ew}),v.length>0&&l.a.createElement(XO,{name:"For budget",to:i,query:d(),style:tw}),v.map((e,a)=>l.a.createElement(XO,{key:e.id,name:e.name,account:e,connected:!!e.bankId,failed:t&&t.has(e.id),updated:n&&n.includes(e.id),to:r(e),query:s(e),onDragChange:j,onDrop:g,outerStyle:S(a,v.length)})),w.length>0&&l.a.createElement(XO,{name:"Off budget",to:c,query:f(),style:nw}),w.map((e,a)=>l.a.createElement(XO,{key:e.id,name:e.name,account:e,connected:!!e.bankId,failed:t&&t.has(e.id),updated:n&&n.includes(e.id),to:r(e),query:s(e),onDragChange:j,onDrop:g,outerStyle:S(a,w.length)})),E.length>0&&l.a.createElement(YO,{style:rw,title:"Closed accounts"+(p?"":"..."),onClick:y,bold:!0}),p&&E.map((e,t)=>l.a.createElement(XO,{key:e.id,name:e.name,account:e,to:r(e),query:s(e),onDragChange:j,onDrop:g})),l.a.createElement(YO,{style:aw,onClick:m,Icon:Rt,title:"Add account"}))}var lw={flexShrink:0},iw={width:13,height:13,color:W.a.n5};function cw({style:e,onFloat:t}){return l.a.createElement($.C,{className:"float",style:[e,lw]},l.a.createElement($.d,{bare:!0,onClick:t},l.a.createElement(AO,{style:iw})))}var sw={flexShrink:0};function uw(){let e=DO(Object(o.useState)(!1),2),t=e[0],n=e[1],r=Object(o.useCallback)(()=>n(e=>!e),[]),a=Object(u.h)();const i=["/payees","/rules","/settings","/tools"].some(e=>a.pathname.startsWith(e));return Object(o.useEffect)(()=>{i&&n(!0)},[a.pathname]),l.a.createElement($.C,{style:sw},l.a.createElement(WO,{title:"More",Icon:t?Fi:pO,onClick:r,style:{marginBottom:t?8:0},forceActive:!t&&i}),t&&l.a.createElement(l.a.Fragment,null,l.a.createElement(YO,{title:"Payees",Icon:vO,to:"/payees",indent:15}),l.a.createElement(YO,{title:"Rules",Icon:CO,to:"/rules",indent:15}),l.a.createElement(YO,{title:"Settings",Icon:Y,to:"/settings",indent:15})))}var dw={paddingTop:35,height:30,flexDirection:"row",alignItems:"center",margin:"0 8px 23px 20px",transition:"padding .4s"},fw={paddingTop:20,justifyContent:"flex-start"},pw={color:W.a.p7},mw={color:"inherit"},yw={flex:1,flexDirection:"row"},gw={overflow:"auto"},hw={height:1,backgroundColor:W.a.n3,marginTop:15,flexShrink:0};function bw({style:e,budgetName:t,accounts:n,failedAccounts:r,updatedAccounts:a,getBalanceQuery:o,getAllAccountBalance:i,getOnBudgetBalance:c,getOffBudgetBalance:s,showClosedAccounts:u,isFloating:d,onFloat:f,onAddAccount:p,onToggleClosedAccounts:m,onReorder:y}){let g=!Rb.a.isBrowser&&"mac"===Rb.a.OS;return l.a.createElement($.C,{style:[{width:BO,color:W.a.n9,backgroundColor:W.a.n1,"& .float":{opacity:0,transition:"opacity .25s, width .25s",width:g?null:0},"&:hover .float":{opacity:1,width:g?null:"auto"}},e]},g&&l.a.createElement(cw,{style:[{height:d?0:36,alignItems:"flex-end",justifyContent:"center",overflow:"hidden",WebkitAppRegion:"drag",paddingRight:8}],onFloat:f}),l.a.createElement($.C,{style:[dw,g&&fw]},t,!Rb.a.isBrowser&&l.a.createElement($.e,{bare:!0,to:"/settings",style:{display:"inherit",color:W.a.n5,marginLeft:g?0:5,flexShrink:0},activeStyle:pw},l.a.createElement(Y,{width:15,height:15,style:mw})),l.a.createElement($.C,{style:yw}),!g&&l.a.createElement(cw,{onFloat:f})),l.a.createElement($.C,{style:gw},l.a.createElement(WO,{title:"Budget",Icon:te,to:"/budget"}),l.a.createElement(WO,{title:"Reports",Icon:hO,to:"/reports"}),l.a.createElement(WO,{title:"Schedules",Icon:Yi,to:"/schedules"}),l.a.createElement(uw,null),l.a.createElement($.C,{style:hw}),l.a.createElement(ow,{accounts:n,failedAccounts:r,updatedAccounts:a,getAccountPath:e=>`/accounts/${e.id}`,allAccountsPath:"/accounts",budgetedAccountPath:"/accounts/budgeted",offBudgetAccountPath:"/accounts/offbudget",getBalanceQuery:o,getAllAccountBalance:i,getOnBudgetBalance:c,getOffBudgetBalance:s,showClosedAccounts:u,onAddAccount:p,onToggleClosedAccounts:m,onReorder:y})))}var Ow=n(66);function ww(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return vw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vw(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ew={width:160,fontSize:16,fontWeight:500},jw={color:W.a.n9,fontSize:16,fontWeight:500,marginLeft:-5,flex:"0 auto"},Sw={whiteSpace:"nowrap",overflow:"hidden"},Cw={color:"inherit",marginLeft:5},xw={padding:0};function Pw({prefs:e,savePrefs:t}){let n=Object(s.c)(),r=Object(u.g)();const a=ww(Object(o.useState)(!1),2),i=a[0],c=a[1],d=ww(Object(o.useState)(!1),2),f=d[0],p=d[1];let m=[{name:"rename",text:"Rename Budget"},...Rb.a.isBrowser?[{name:"help",text:"Help"}]:[],{name:"close",text:"Close File"}];return i?l.a.createElement($.l,null,l.a.createElement($.n,{style:Ew,defaultValue:e.budgetName,onEnter:async e=>{""!==e.target.value.trim()&&(await t({budgetName:e.target.value}),c(!1))},onBlur:()=>c(!1)})):l.a.createElement($.d,{bare:!0,style:jw,onClick:()=>p(!0)},l.a.createElement($.z,{style:Sw},e.budgetName||"A budget has no name"),l.a.createElement(yp.a,{width:7,height:7,style:Cw}),f&&l.a.createElement($.B,{position:"bottom-left",style:xw,onClose:()=>p(!1)},l.a.createElement($.s,{onMenuSelect:function(e){switch(p(!1),e){case"rename":c(!0);break;case"settings":r.push("/settings");break;case"help":window.open("https://actualbudget.github.io/docs","_blank");break;case"close":n(Object(Ow.b)())}},items:m})))}var kw={flex:1};var Aw=Object(u.k)(Object(s.b)(e=>({accounts:e.queries.accounts,failedAccounts:e.account.failedAccounts,updatedAccounts:e.queries.updatedAccounts,prefs:e.prefs.local,floatingSidebar:e.prefs.global.floatingSidebar}),e=>Object(ue.b)(y,e))(function({accounts:e,failedAccounts:t,updatedAccounts:n,replaceModal:r,prefs:a,floatingSidebar:i,savePrefs:c,saveGlobalPrefs:s,getAccounts:u}){return Object(o.useEffect)(()=>void u(),[u]),l.a.createElement(bw,{isFloating:i,budgetName:l.a.createElement(Pw,{prefs:a,savePrefs:c}),accounts:e,failedAccounts:t,updatedAccounts:n,getBalanceQuery:Te,getAllAccountBalance:Me,getOnBudgetBalance:Re,getOffBudgetBalance:Be,onFloat:()=>s({floatingSidebar:!i}),onReorder:async function(t,n,r){if("bottom"===n){let t=e.findIndex(e=>e.id===r)+1;r=t<e.length?e[t].id:null}await Object(M.send)("account-move",{id:t,targetId:r}),await u()},onAddAccount:()=>r(a["flags.syncAccount"]?"add-account":"add-local-account"),showClosedAccounts:a["ui.showClosedAccounts"],onToggleClosedAccounts:()=>c({"ui.showClosedAccounts":!a["ui.showClosedAccounts"]}),style:[kw,W.c.darkScrollbar]})}));function Dw(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Iw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Iw(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Iw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Tw=l.a.createContext(null);function Mw({children:e}){let t=Object(cO.a)();return l.a.createElement(Tw.Provider,{value:{show:()=>t.emit("show"),hide:()=>t.emit("hide"),on:(e,n)=>(t.on(e,n),()=>t.off(e,n))}},e)}function Rw(){return Object(o.useContext)(Tw)}var Bw={position:"absolute",top:0,bottom:0,left:0};var _w=Object(u.k)(Object(s.b)(e=>({floatingSidebar:e.prefs.global.floatingSidebar}),y)(function({floatingSidebar:e}){let t=Dw(Object(o.useState)(!0),2),n=t[0],r=t[1],a=Rw();return!e&&n&&r(!1),Object(o.useEffect)(()=>{let e=[a.on("show",()=>r(!1)),a.on("hide",()=>r(!0))];return()=>{e.forEach(e=>e())}},[a]),l.a.createElement(l.a.Fragment,null,e&&l.a.createElement($.C,{onMouseOver:()=>r(!1),onMouseLeave:()=>r(!0),style:{position:"absolute",top:0,bottom:0,left:0,width:n?0:160,zIndex:999}}),l.a.createElement($.C,{onMouseOver:e?e=>{e.stopPropagation(),r(!1)}:null,onMouseLeave:e?()=>r(!0):null,style:{position:"absolute",top:50,bottom:e?50:-50,zIndex:1001,borderRadius:"0 6px 6px 0",overflow:"hidden",boxShadow:!e||n?"none":"0 15px 30px 0 rgba(0,0,0,0.25), 0 3px 15px 0 rgba(0,0,0,.5)",transform:`translateY(${e?0:-50}px)\n translateX(${n?-BO:0}px)`,transition:"transform .5s, box-shadow .5s"}},l.a.createElement(Aw,null)),l.a.createElement($.C,{style:[{backgroundColor:W.a.n1,opacity:e?0:1,transform:`translateX(${e?-50:0}px)`,transition:"transform .4s, opacity .2s",width:BO},e&&Bw]}))})),Lw=n(240);function zw(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Fw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fw(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let Nw=l.a.createContext();function Uw({children:e}){let t=Object(o.useRef)([]);return l.a.createElement(Nw.Provider,{value:{sendEvent:function(e){t.current.forEach(t=>t(e))},subscribe:function(e){return t.current.push(e),()=>t.current=t.current.filter(t=>t!==e)}},children:e})}var $w={color:W.a.r5};function Ww(){return l.a.createElement(Ct.a,{binding:{name:"uncategorized-amount",query:_e.calculate({$count:"$id"})}},e=>{const t=e.value;return 0!==t&&l.a.createElement($.e,{bare:!0,to:"/accounts/uncategorized",style:$w},t," uncategorized ",1===t?"transaction":"transactions")})}var Gw={color:"currentColor"},Hw={marginLeft:3};function qw({localPrefs:e,style:t,onSync:n}){let r=zw(Object(o.useState)(!1),2),a=r[0],i=r[1],c=zw(Object(o.useState)(null),2),s=c[0],u=c[1];return Object(o.useEffect)(()=>{return Object(M.listen)("sync-event",({type:t,subtype:n,syncDisabled:r})=>{"start"===t?(i(!0),u(null)):setTimeout(()=>{i(!1)},200),"error"===t?"network"===n?u("offline"):e.cloudFileId?u("error"):u("local"):"success"===t&&u(r?"disabled":null)})},[]),l.a.createElement($.d,{bare:!0,style:Object(lt.css)(t,{WebkitAppRegion:"none",color:"error"===s?W.a.r7:"disabled"===s||"offline"===s||"local"===s?W.a.n9:null},Object(lt.media)(`(min-width: ${Wb.a.breakpoint_medium})`,{color:"error"===s?W.a.r4:"disabled"===s||"offline"===s||"local"===s?W.a.n6:null})),onClick:n},"error"===s?l.a.createElement(tc,{width:13,style:Gw}):l.a.createElement(jn,{animating:a}),l.a.createElement($.z,{style:Hw},"disabled"===s?"Disabled":"offline"===s?"Offline":"Sync"))}var Yw={flexDirection:"row",alignItems:"center"},Vw={marginLeft:-5},Kw={alignSelf:"flex-start",padding:"4px 7px"},Zw={padding:10,maxWidth:400},Qw={fontWeight:600},Jw={color:W.a.n4,fontStyle:"italic"};function Xw({globalPrefs:e,saveGlobalPrefs:t,localPrefs:n}){let r=Object(o.useContext)(Nw).sendEvent,a=zw(Object(o.useState)(!1),2),i=a[0],c=a[1],s=zw(Object(o.useState)(!1),2),u=s[0],d=s[1],f=n["flags.reportBudget"];Object(o.useEffect)(()=>{c(!1)},[n.budgetType]);let p=n.budgetType;return l.a.createElement($.C,{style:Yw},l.a.createElement(iO,{maxMonths:e.maxMonths||1,onChange:e=>t({maxMonths:e})}),f&&l.a.createElement($.C,{style:Vw},l.a.createElement($.f,{bare:!0,loading:i,style:Kw,title:"Learn more about budgeting",onClick:()=>d(!0)},"report"===p?"Report budget":"Rollover budget"),u&&l.a.createElement($.B,{position:"bottom-left",onClose:()=>d(!1),style:Zw},l.a.createElement($.v,null,"You are currently using a"," ",l.a.createElement($.z,{style:Qw},"report"===p?"Report budget":"Rollover budget",".")," ","Switching will not lose any data and you can always switch back."),l.a.createElement($.v,null,l.a.createElement($.f,{primary:!0,loading:i,onClick:function(){c(!0),i||r("budget/switch-type")}},"Switch to a"," ","report"===p?"Rollover budget":"Report budget")),l.a.createElement($.v,{isLast:!0},l.a.createElement("a",{href:"#",style:Jw},"How do these types of budgeting work?")))))}var ev={flexDirection:"row",alignItems:"center",padding:"0 15px",height:36,pointerEvents:"none","& *":{pointerEvents:"auto"}},tv={paddingLeft:80},nv={marginRight:8,"& .arrow-right":{opacity:0,transition:"opacity .3s"},"& .menu":{opacity:1,transition:"opacity .3s"},"&:hover .arrow-right":{opacity:1},"&:hover .menu":{opacity:0}},rv={width:15,height:15},av={width:13,height:13,color:W.a.n5,position:"absolute",top:1,left:1},ov={width:15,height:15,color:W.a.n5,position:"absolute",top:0,left:0},lv={marginRight:5,color:"currentColor"},iv={flex:1},cv={marginLeft:10},sv={marginLeft:10};var uv=Object(u.k)(Object(s.b)(e=>({globalPrefs:e.prefs.global,localPrefs:e.prefs.local,userData:e.user.data,floatingSidebar:e.prefs.global.floatingSidebar}),y)(function({location:e,globalPrefs:t,saveGlobalPrefs:n,localPrefs:r,userData:a,floatingSidebar:o,syncError:i,setAppState:c,style:s,sync:d}){let f=Rw();const p=Object(Gb.a)();return l.a.createElement($.C,{style:[ev,!Rb.a.isBrowser&&"mac"===Rb.a.OS&&o&&tv,s]},o&&l.a.createElement($.d,{bare:!0,style:nv,onMouseEnter:()=>f.show(),onMouseLeave:()=>f.hide(),onClick:()=>{n({floatingSidebar:!o})}},l.a.createElement($.C,{style:rv},l.a.createElement(Ft,{className:"arrow-right",style:av}),l.a.createElement($b,{className:"menu",style:ov}))),l.a.createElement(u.d,null,l.a.createElement(u.b,{path:"/accounts",exact:!0,children:e=>(e.location.state||{}).goBack?l.a.createElement($.d,{onClick:()=>e.history.goBack(),bare:!0},l.a.createElement(zb,{width:10,height:10,style:lv})," ","Back"):null}),l.a.createElement(u.b,{path:"/accounts/:id",exact:!0,children:e=>e.match&&l.a.createElement(aO,{id:e.match.params.id})}),l.a.createElement(u.b,{path:"/budget",exact:!0,children:()=>l.a.createElement(Xw,{globalPrefs:t,saveGlobalPrefs:n,localPrefs:r})})),l.a.createElement($.C,{style:iv}),l.a.createElement(Ww,null),p?l.a.createElement(qw,{style:cv,localPrefs:r,onSync:d}):null,l.a.createElement(Lw.a,{style:sv}))}));function dv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dv(Object(n),!0).forEach(function(t){pv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let mv=null;var yv={flex:1};class gv extends l.a.PureComponent{constructor(e){super(e),this.prewarmMonth=(async(e,t=null)=>{let n="report"===(t=t||this.props.budgetType)?"report-budget-month":"rollover-budget-month",r=await Object(M.send)(n,{month:e});for(let a of r)this.props.spreadsheet.prewarmCache(a.name,a)}),this.onMonthSelect=(async(e,t)=>{let n=this.state.startMonth;this.setState({prewarmStartMonth:e}),this.warmingMonth=e,e<n?await this.prewarmMonth(de.y(e,1)):e>n&&await this.prewarmMonth(de.b(e,t)),this.warmingMonth===e&&this.setState({startMonth:e})}),this.onShowNewCategory=(e=>{this.setState({newCategoryForGroup:e,collapsed:this.state.collapsed.filter(t=>t!==e)})}),this.onHideNewCategory=(()=>{this.setState({newCategoryForGroup:null})}),this.onShowNewGroup=(()=>{this.setState({isAddingGroup:!0})}),this.onHideNewGroup=(()=>{this.setState({isAddingGroup:!1})}),this.setCollapsed=(e=>{this.setState({collapsed:e})}),this.onSaveCategory=(async e=>{let t=this.state.categoryGroups;if("new"===e.id){let n=await this.props.createCategory(e.name,e.cat_group,e.is_income);this.setState({newCategoryForGroup:null,categoryGroups:ep(t,fv(fv({},e),{},{is_income:e.is_income?1:0,id:n}))})}else this.props.updateCategory(e),this.setState({categoryGroups:tp(t,e)})}),this.onDeleteCategory=(async e=>{const t=await Object(M.send)("must-category-transfer",{id:e});let n=this.state.categoryGroups;t?this.props.pushModal("confirm-category-delete",{category:e,onDelete:t=>{e!==t&&(this.props.deleteCategory(e,t),this.setState({categoryGroups:ap(n,e)}))}}):(this.props.deleteCategory(e),this.setState({categoryGroups:ap(n,e)}))}),this.onSaveGroup=(async e=>{let t=this.state.categoryGroups;if("new"===e.id){let n=await this.props.createGroup(e.name);this.setState({isAddingGroup:!1,categoryGroups:op(t,fv(fv({},e),{},{is_income:0,categories:e.categories||[],id:n}))})}else this.props.updateGroup(e),this.setState({categoryGroups:lp(t,e)})}),this.onDeleteGroup=(async e=>{let t=this.state.categoryGroups,n=t.find(t=>t.id===e),r=!1;for(let a of n.categories)if(await Object(M.send)("must-category-transfer",{id:a.id})){r=!0;break}r?this.props.pushModal("confirm-category-delete",{group:e,onDelete:n=>{this.props.deleteGroup(e,n),this.setState({categoryGroups:ip(t,e)})}}):(this.props.deleteGroup(e),this.setState({categoryGroups:ip(t,e)}))}),this.onBudgetAction=((e,t,n)=>{this.props.applyBudgetAction(e,t,n)}),this.onShowActivity=((e,t,n)=>{this.props.history.push({pathname:"/accounts",state:{goBack:!0,filterName:`${e} (${de.g(n,"MMMM yyyy")})`,filter:{category:t,date:{$transform:"$month",$eq:n}}}})}),this.onReorderCategory=(async e=>{let t=this.state.categoryGroups;this.props.moveCategory(e.id,e.groupId,e.targetId),this.setState({categoryGroups:np(t,e.id,e.groupId,e.targetId)})}),this.onReorderGroup=(async e=>{let t=this.state.categoryGroups;this.props.moveCategoryGroup(e.id,e.targetId),this.setState({categoryGroups:rp(t,e.id,e.targetId)})}),this.onToggleCollapse=(()=>{let e=!this.state.summaryCollapsed;this.setState({summaryCollapsed:e}),this.props.savePrefs({"budget.summaryCollapsed":e})}),this.onTitlebarEvent=(async e=>{switch(e){case"budget/switch-type":{let e="rollover"===this.props.budgetType?"report":"rollover";this.props.spreadsheet.disableObservers(),await Object(M.send)("budget-set-type",{type:e}),await this.prewarmAllMonths(this.state.bounds,e),this.props.spreadsheet.enableObservers(),this.props.loadPrefs();break}}});const t=mv||de.d();this.state={initialized:!1,prewarmStartMonth:t,startMonth:t,newCategoryForGroup:null,isAddingGroup:!1,collapsed:e.collapsedPrefs||[],bounds:{start:t,end:t},categoryGroups:null,summaryCollapsed:e.summaryCollapsed}}async loadCategories(){let e=await this.props.getCategories();this.setState({categoryGroups:e.grouped})}async componentDidMount(){let e=this.props,t=e.titlebar,n=e.budgetType;this.loadCategories();let r=await Object(M.send)("get-budget-bounds"),a=r.start,o=r.end;this.setState({bounds:{start:a,end:o}}),this.prewarmAllMonths({start:a,end:o},n);let l=[Object(M.listen)("sync-event",({type:e,tables:t})=>{"success"===e&&(t.includes("categories")||t.includes("category_mapping")||t.includes("category_groups"))&&this.loadCategories()}),Object(M.listen)("undo-event",({tables:e})=>{this.table&&this.table.clearEditing(),e.includes("categories")&&this.loadCategories()}),t.subscribe(this.onTitlebarEvent)];this.cleanup=(()=>{l.forEach(e=>e())})}componentDidUpdate(e,t){t.collapsed!==this.state.collapsed&&this.props.savePrefs({"budget.collapsed":this.state.collapsed}),t.startMonth!==this.state.startMonth&&(mv=this.state.startMonth),this.props.match&&!e.match&&Object(M.send)("get-budget-bounds").then(({start:e,end:t})=>{let n=this.state.bounds;n.start===e&&n.end===t||this.setState({bounds:{start:e,end:t}})})}componentWillUnmount(){this.cleanup&&this.cleanup()}async prewarmAllMonths(e,t=null){let n=this.state.startMonth;e=zp(e,de.y(n,1),de.b(n,4));let r=de.v(e.start,e.end);await Promise.all(r.map(e=>this.prewarmMonth(e,t))),this.setState({initialized:!0})}onCopy(e){this.props.copyPreviousMonthInto(e,this.props.categories)}render(){let e,t=this.props,n=t.maxMonths,r=t.budgetType,a=t.reportComponents,o=t.rolloverComponents,i=this.state,c=i.initialized,s=i.categoryGroups,u=i.prewarmStartMonth,d=i.startMonth,f=i.newCategoryForGroup,p=i.isAddingGroup,m=i.collapsed,y=i.summaryCollapsed,g=i.bounds;return n=n||1,c&&s?(e="report"===r?l.a.createElement(_y,{summaryCollapsed:y,onBudgetAction:this.onBudgetAction,onToggleSummaryCollapse:this.onToggleCollapse},l.a.createElement(Oy,{ref:e=>this.table=e,type:r,categoryGroups:s,prewarmStartMonth:u,startMonth:d,monthBounds:g,maxMonths:n,collapsed:m,setCollapsed:this.setCollapsed,newCategoryForGroup:f,isAddingGroup:p,dataComponents:a,onMonthSelect:this.onMonthSelect,onShowNewCategory:this.onShowNewCategory,onHideNewCategory:this.onHideNewCategory,onShowNewGroup:this.onShowNewGroup,onHideNewGroup:this.onHideNewGroup,onDeleteCategory:this.onDeleteCategory,onDeleteGroup:this.onDeleteGroup,onSaveCategory:this.onSaveCategory,onSaveGroup:this.onSaveGroup,onBudgetAction:this.onBudgetAction,onShowActivity:this.onShowActivity,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup})):l.a.createElement(mh,{categoryGroups:s,summaryCollapsed:y,onBudgetAction:this.onBudgetAction,onToggleSummaryCollapse:this.onToggleCollapse},l.a.createElement(Oy,{ref:e=>this.table=e,type:r,categoryGroups:s,prewarmStartMonth:u,startMonth:d,monthBounds:g,maxMonths:n,collapsed:m,setCollapsed:this.setCollapsed,newCategoryForGroup:f,isAddingGroup:p,dataComponents:o,onMonthSelect:this.onMonthSelect,onShowNewCategory:this.onShowNewCategory,onHideNewCategory:this.onHideNewCategory,onShowNewGroup:this.onShowNewGroup,onHideNewGroup:this.onHideNewGroup,onDeleteCategory:this.onDeleteCategory,onDeleteGroup:this.onDeleteGroup,onSaveCategory:this.onSaveCategory,onSaveGroup:this.onSaveGroup,onBudgetAction:this.onBudgetAction,onShowActivity:this.onShowActivity,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup})),l.a.createElement($.C,{style:yv,innerRef:e=>this.page=e},e)):null}}var hv={paddingLeft:8,paddingRight:8,overflow:"hidden"};var bv=Object(s.b)(e=>({collapsedPrefs:e.prefs.local["budget.collapsed"],summaryCollapsed:e.prefs.local["budget.summaryCollapsed"],budgetType:e.prefs.local.budgetType||"rollover",maxMonths:e.prefs.global.maxMonths,categoryGroups:e.queries.categories.grouped}),y)(function(e){let t=Object(o.useContext)(T.a),n=Object(o.useContext)(Nw),i=Object(o.useMemo)(()=>({SummaryComponent:bg,ExpenseCategoryComponent:Vg,ExpenseGroupComponent:Yg,IncomeCategoryComponent:Zg,IncomeGroupComponent:Kg,BudgetTotalsComponent:Pg,IncomeHeaderComponent:Ig}),[r]),c=Object(o.useMemo)(()=>({SummaryComponent:Hh,ExpenseCategoryComponent:Cb,ExpenseGroupComponent:hb,IncomeCategoryComponent:Mb,IncomeGroupComponent:kb,BudgetTotalsComponent:sb,IncomeHeaderComponent:fb}),[a]);return l.a.createElement($.C,{style:[W.c.page,hv]},l.a.createElement(gv,Object.assign({},e,{reportComponents:i,rolloverComponents:c,spreadsheet:t,titlebar:n})))});function Ov(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ov(Object(n),!0).forEach(function(t){vv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ov(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ev=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 23 3",xmlns:"http://www.w3.org/2000/svg",style:wv({color:"#242134"},e.style)}),o.createElement("path",{d:"M23 1.5A1.5 1.5 0 0 1 21.5 3h-20a1.5 1.5 0 0 1 0-3h20A1.5 1.5 0 0 1 23 1.5z",fillRule:"nonzero",fill:"currentColor"}));function jv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Sv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jv(Object(n),!0).forEach(function(t){Cv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Cv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Pv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var kv={padding:"0 7px"},Av={width:8,height:8},Dv={width:8,height:8},Iv={paddingLeft:0};function Tv({defaultValue:e=0,onChange:t,style:n}){let r=xv(Object(o.useState)(e<=0),2),a=r[0],i=r[1],c=xv(Object(o.useState)(Object(ke.k)(Math.abs(e))),2),s=c[0],u=c[1];function d(e=a){let n=Object(ke.e)(s);t(e?n<0?n:-n:n>0?n:-n)}return l.a.createElement($.o,{leftContent:l.a.createElement($.d,{bare:!0,style:kv,onClick:function(){i(!a),d(!a)}},a?l.a.createElement(Ev,{style:Av}):l.a.createElement(Rt,{style:Dv})),value:s,style:Sv({flex:1,alignItems:"stretch"},n),inputStyle:Iv,onChange:e=>u(e.target.value),onBlur:e=>d()})}var Mv={flexDirection:"row",alignItems:"center"},Rv={margin:"0 5px"};function Bv({defaultValue:e,onChange:t}){let n=xv(Object(o.useState)(e.num1),2),r=n[0],a=n[1],i=xv(Object(o.useState)(e.num2),2),c=i[0],s=i[1];return l.a.createElement($.C,{style:Mv},l.a.createElement(Tv,{defaultValue:r,onChange:e=>{a(e),t({num1:e,num2:c})}}),l.a.createElement($.C,{style:Rv},"and"),l.a.createElement(Tv,{defaultValue:c,onChange:e=>{s(e),t({num1:r,num2:e})}}))}const _v=["children","style"];function Lv(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const zv=50;var Fv={height:zv,borderBottomWidth:1,borderColor:W.a.border,flexDirection:"row",alignItems:"center",paddingLeft:10,paddingRight:10,zIndex:1};const Nv=e=>{let t=e.children,n=e.style,r=Lv(e,_v);return l.a.createElement($.C,Object.assign({style:[Fv,n]},r),t)};function Uv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uv(Object(n),!0).forEach(function(t){Wv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Wv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Gv={flexDirection:"column",alignItems:"flex-start"},Hv={color:W.a.n1,flexShrink:0};function qv({toBudget:e,onClick:t}){return l.a.createElement(Ct.a,{binding:e},({value:e})=>l.a.createElement($.d,{bare:!0,style:Gv,onClick:t},l.a.createElement($.q,{title:e<0?"OVERBUDGETED":"TO BUDGET",style:Hv}),l.a.createElement($.z,{style:[W.c.smallText,{fontWeight:"500",color:e<0?W.a.r4:W.a.n1}]},Object(St.a)(e,"financial"))))}var Yv={flexDirection:"column",alignItems:"flex-start"},Vv={color:W.a.n1},Kv={color:W.a.n1};function Zv({projected:e}){let t=Object(Pt.a)(ze.totalBudgetedSaved)||0,n=Object(Pt.a)(ze.totalSaved)||0,r=e?t:n,a=r<0;return l.a.createElement($.C,{style:Yv},e?l.a.createElement($.q,{title:"PROJECTED SAVINGS",style:Vv}):l.a.createElement($.q,{title:a?"OVERSPENT":"SAVED",style:Kv}),l.a.createElement($.z,{style:[W.c.smallText,{fontWeight:"500",color:e?W.a.y3:a?W.a.r4:W.a.n1}]},Object(St.a)(r,"financial")))}class Qv extends l.a.PureComponent{render(){const e=this.props,t=e.name,n=e.binding,r=e.editing,a=e.style,o=e.textStyle,i=e.categoryId,c=e.month,s=e.onBudgetAction;var u=$v({height:zv-4,transform:"translateX(6px)"},!r&&{opacity:0,position:"absolute",top:0}),d=$v({justifyContent:"center",height:zv-4},r&&{display:"none"});return l.a.createElement(Ct.a,{binding:n},e=>l.a.createElement($.C,{style:a},l.a.createElement(Tv,{value:Object(ke.j)(e.value||0),style:u,focused:r,textStyle:[W.c.smallText,o],onChange:()=>{},onBlur:e=>{s(c,"budget-amount",{category:i,amount:Object(ke.b)(e)})}}),l.a.createElement($.C,{style:d},l.a.createElement($.z,{style:[W.c.smallText,o],"data-testid":t},Object(St.a)(e.value||0,"financial")))))}}var Jv={flex:1},Xv={width:90},eE={textAlign:"right"},tE={width:90,textAlign:"right"},nE={color:W.a.r4};class rE extends l.a.PureComponent{constructor(e){super(e);let t=e.editMode,n=e.blank;this.opacity=t||n?0:1}render(){let e=this.props,t=e.category,n=e.editing,r=e.index,a=e.style,o=e.month,i=e.onBudgetAction,c=Le.catBudgeted(t.id),s=Le.catBalance(t.id),u=l.a.createElement(Nv,{style:[{backgroundColor:n?W.a.p11:"transparent",borderBottomWidth:0,borderTopWidth:r>0?1:0},a],"data-testid":"row"},l.a.createElement($.C,{style:Jv},l.a.createElement($.z,{style:W.c.smallText},t.name)),l.a.createElement($.C,{style:{alignItems:"center",flexDirection:"row",opacity:this.opacity}},l.a.createElement(Qv,{name:"budgeted",binding:c,editing:n,style:Xv,textStyle:[W.c.smallText,eE],categoryId:t.id,month:o,onBudgetAction:i}),l.a.createElement(xt,{name:"balance",binding:s,style:[W.c.smallText,tE],getStyle:e=>e<0&&nE,type:"financial"})));return l.a.createElement("div",null,u)}}var aE={flexDirection:"row",alignItems:"center",backgroundColor:W.a.n11},oE={flex:1},lE={fontWeight:"500"},iE={width:90,fontWeight:"500",textAlign:"right"},cE={width:90,fontWeight:"500",textAlign:"right"},sE={padding:10};class uE extends l.a.PureComponent{constructor(e){super(e);let t=e.editMode,n=e.blank;this.opacity=t||n?0:1}render(){let e=this.props,t=e.group,n=e.editMode,r=e.onAddCategory,a=l.a.createElement(Nv,{style:aE,"data-testid":"totals"},l.a.createElement($.C,{style:oE},l.a.createElement($.z,{style:[W.c.smallText,lE],"data-testid":"name"},t.name)),l.a.createElement($.C,{style:{flexDirection:"row",alignItems:"center",opacity:this.opacity}},l.a.createElement(xt,{binding:Le.groupBudgeted(t.id),style:[W.c.smallText,iE],type:"financial"}),l.a.createElement(xt,{binding:Le.groupBalance(t.id),style:[W.c.smallText,cE],type:"financial"})),n&&l.a.createElement($.C,null,l.a.createElement($.d,{onClick:()=>r(t.id),style:sE},l.a.createElement(Rt,{width:15,height:15,color:W.a.n1}))));return a}}var dE={flexDirection:"row",alignItems:"center",padding:10,backgroundColor:"transparent"},fE={flex:1},pE={width:90,textAlign:"right"},mE={width:90,textAlign:"right"};class yE extends l.a.PureComponent{render(){const e=this.props,t=e.name,n=e.budget,r=e.balance,a=e.style,o=e.nameTextStyle,i=e.amountTextStyle;return l.a.createElement(Nv,{style:[dE,a]},l.a.createElement($.C,{style:fE},l.a.createElement($.z,{style:[W.c.smallText,o],"data-testid":"name"},t)),n&&l.a.createElement(xt,{binding:n,style:[W.c.smallText,pE,i],type:"financial"}),l.a.createElement(xt,{binding:r,style:[W.c.smallText,mE,i],type:"financial"}))}}var gE={marginTop:7,marginBottom:7};class hE extends l.a.PureComponent{render(){const e=this.props,t=e.group,n=e.editMode,r=e.gestures,a=e.month,o=e.onEditCategory,i=e.onReorderCategory,c=e.onAddCategory,s=e.onBudgetAction;return l.a.createElement($.g,{style:gE},l.a.createElement(uE,{group:t,budgeted:Le.groupBudgeted(t.id),balance:Le.groupBalance(t.id),editMode:n,onAddCategory:c,onReorderCategory:i}),t.categories.map((e,t)=>l.a.createElement(rE,{key:e.id,index:t,category:e,editing:void 0,editMode:n,gestures:r,month:a,onEdit:o,onReorder:i,onBudgetAction:s})))}}var bE={flexDirection:"row",alignItems:"center",justifyContent:"flex-end",marginTop:50,marginBottom:5,marginRight:14},OE={width:90},wE={width:90},vE={marginTop:0},EE={fontWeight:"500"},jE={fontWeight:"500"},SE={backgroundColor:W.a.n11};class CE extends l.a.Component{render(){const e=this.props,t=e.type,n=e.group;return l.a.createElement($.C,null,l.a.createElement($.C,{style:bE},"report"===t&&l.a.createElement($.q,{title:"BUDGETED",style:OE}),l.a.createElement($.q,{title:"RECEIVED",style:wE})),l.a.createElement($.g,{style:vE},l.a.createElement(yE,{name:"Income",budget:"report"===t?ze.groupBudgeted(n.id):null,balance:"report"===t?ze.groupSumAmount(n.id):Le.groupSumAmount(n.id),nameTextStyle:EE,amountTextStyle:jE,style:SE}),n.categories.map((e,n)=>l.a.createElement(yE,{key:e.id,type:t,name:e.name,budget:"report"===t?ze.catBudgeted(e.id):null,balance:"report"===t?ze.catSumAmount(e.id):Le.catSumAmount(e.id),index:n}))))}}var xE={flex:"1 0 auto",overflowY:"auto",paddingBottom:15};class PE extends l.a.Component{constructor(...e){super(...e),this.getGroups=Object(Xu.a)(e=>({incomeGroup:e.find(e=>e.is_income),expenseGroups:e.filter(e=>!e.is_income)}))}render(){const e=this.props,t=e.type,n=e.categoryGroups,r=e.editingId,a=e.gestures,o=e.month,i=e.onEditCategory,c=e.onAddCategory,s=e.onReorderCategory,u=e.onReorderGroup,d=e.onBudgetAction,f=this.getGroups(n),p=f.incomeGroup,m=f.expenseGroups;return l.a.createElement($.C,{"data-testid":"budget-groups",style:xE},m.map(e=>l.a.createElement(hE,{key:e.id,group:e,editingId:r,editMode:void 0,gestures:a,month:o,onEditCategory:i,onAddCategory:c,onReorderCategory:s,onReorderGroup:u,onBudgetAction:d})),p&&l.a.createElement(CE,{type:t,group:p}))}}var kE={flex:1,overflowY:"hidden"},AE={flexDirection:"row",flex:"1 0 auto",padding:10,paddingRight:14,backgroundColor:"white",borderBottomWidth:1,borderColor:W.a.n9},DE={flex:1},IE={width:90},TE={color:W.a.n1},ME={color:W.a.n1,textAlign:"right",fontWeight:"500"},RE={width:90},BE={color:W.a.n1},_E={color:W.a.n1,textAlign:"right",fontWeight:"500"},LE={overflowY:"auto"};class zE extends l.a.Component{constructor(...e){super(...e),this.state={editingCategory:null},this.onEditCategory=(e=>{this.setState({editingCategory:e})})}render(){const e=this.props,t=e.type,n=e.categoryGroups,r=e.month,a=e.monthBounds,o=e.editMode,i=e.onPrevMonth,c=e.onNextMonth,s=e.onAddCategory,u=e.onReorderCategory,d=e.onReorderGroup,f=e.onShowBudgetDetails,p=e.onOpenActionSheet,m=e.onBudgetAction;let y=this.state.editingCategory,g=de.d();return l.a.createElement(Bp.a.Provider,{value:de.w(r,t)},l.a.createElement($.C,{style:kE,"data-testid":"budget-table"},l.a.createElement(qE,{currentMonth:r,monthBounds:a,editMode:o,onDone:()=>this.props.onEditMode(!1),onOpenActionSheet:p,onPrevMonth:i,onNextMonth:c}),l.a.createElement($.C,{style:AE},"report"===t?l.a.createElement(Zv,{projected:r>=g}):l.a.createElement(qv,{toBudget:Le.toBudget,onClick:f}),l.a.createElement($.C,{style:DE}),l.a.createElement($.C,{style:IE},l.a.createElement($.q,{title:"BUDGETED",style:TE}),l.a.createElement(xt,{binding:ze.totalBudgetedExpense,type:"financial",style:[W.c.smallText,ME],formatter:e=>Object(St.a)(-parseFloat(e||"0"),"financial")})),l.a.createElement($.C,{style:RE},l.a.createElement($.q,{title:"BALANCE",style:BE}),l.a.createElement(xt,{binding:Le.totalBalance,type:"financial",style:[W.c.smallText,_E]}))),l.a.createElement($.C,{style:LE},o?l.a.createElement(l.a.Fragment,null,l.a.createElement($.C,null,l.a.createElement(PE,{categoryGroups:n,editingId:y,editMode:o,gestures:this.gestures,onEditCategory:()=>{},onAddCategory:s,onReorderCategory:u,onReorderGroup:d}))):l.a.createElement($.C,null,l.a.createElement(PE,{type:t,categoryGroups:n,editingId:y,editMode:o,gestures:this.gestures,month:r,onEditCategory:this.onEditCategory,onAddCategory:s,onReorderCategory:u,onReorderGroup:d,onBudgetAction:m})))))}}var FE={alignItems:"center",flexDirection:"row",flexShrink:0,height:50,justifyContent:"center",backgroundColor:W.a.p5},NE={color:W.a.n11},UE={marginTop:12,marginBottom:12,color:W.a.n11,textAlign:"center"},$E={position:"absolute",top:0,bottom:0,right:0},WE={color:W.a.n11,fontSize:15,fontWeight:"500"},GE={color:W.a.n11},HE={color:"white",position:"absolute",top:0,bottom:0,right:0,backgroundColor:"transparent",paddingLeft:12,paddingRight:12};const qE=Object(s.b)(e=>({localPrefs:e.prefs.local}),y)(function({currentMonth:e,monthBounds:t,editMode:n,onDone:r,onPrevMonth:a,onNextMonth:o,sync:i,localPrefs:c}){let s=e>t.start,u=e<de.y(t.end,1),d={paddingLeft:15,paddingRight:15,backgroundColor:"transparent"};return l.a.createElement($.C,{style:FE},!n&&l.a.createElement($.d,{bare:!0,onClick:s&&a,style:[d,{left:0,opacity:s?1:.6,padding:"5px 30px 5px 0"}]},l.a.createElement(Op,{style:NE,width:"15",height:"15"})),l.a.createElement($.z,{style:[W.c.mediumText,UE]},de.g(e,"MMMM ''yy")),n?l.a.createElement($.d,{bare:!0,onClick:r,style:[d,$E],textStyle:WE},"Done"):l.a.createElement(l.a.Fragment,null,l.a.createElement($.d,{bare:!0,onClick:u&&o,style:[d,{opacity:u?1:.6}]},l.a.createElement(jp,{style:GE,width:"15",height:"15"})),l.a.createElement(qw,{style:HE,localPrefs:c,onSync:i})))});var YE={flex:1,backgroundColor:"white",alignItems:"center",justifyContent:"center",marginBottom:25};class VE extends l.a.Component{constructor(e){super(e),this.prewarmMonth=(async(e,t=null)=>{let n="report"===(t=t||this.props.budgetType)?"report-budget-month":"rollover-budget-month",r=await Object(M.send)(n,{month:e});for(let a of r)this.props.spreadsheet.prewarmCache(a.name,a);this.state.initialized||this.setState({initialized:!0})}),this.onShowBudgetDetails=(()=>{this.props.pushModal("budget-summary",{month:this.state.currentMonth})}),this.onBudgetAction=(e=>{const t=this.state.currentMonth;this.props.applyBudgetAction(t,e,this.state.bounds)}),this.onAddCategory=(e=>{this.props.navigation.navigate("AddCategoryModal",{groupId:e,onAdd:async t=>{let n=await this.props.createCategory(t,e),r=this.state.categoryGroups;this.setState({categoryGroups:ep(r,{name:t,cat_group:e,is_income:0,id:n})})}})}),this.onReorderCategory=((e,{inGroup:t,aroundCategory:n})=>{let r,a,o=this.state.categoryGroups;if(t)r=t;else if(n){let e=n.id,t=n.position,l=o.find(t=>t.categories.find(t=>t.id===e));if("bottom"===t){let t=l.categories,n=t.findIndex(t=>t.id===e);e=n<t.length-1?t[n+1].id:null}r=l.id,a=e}this.props.moveCategory(e,r,a),this.setState({categoryGroups:np(o,e,r,a)})}),this.onReorderGroup=((e,t,n)=>{let r=this.state.categoryGroups;if("bottom"===n){let e=r.findIndex(e=>e.id===t);t=e<r.length-1?r[e+1].id:null}this.props.moveCategoryGroup(e,t),this.setState({categoryGroups:rp(r,e,t)})}),this.sync=(async()=>{const e=await this.props.sync(),t=e.updated;return e.error?"error":t?"updated":null}),this.onPrevMonth=(async()=>{let e=de.y(this.state.currentMonth,1);await this.prewarmMonth(e),this.setState({currentMonth:e})}),this.onNextMonth=(async()=>{let e=de.b(this.state.currentMonth,1);await this.prewarmMonth(e),this.setState({currentMonth:e})}),this.onOpenActionSheet=(()=>{let e=this.props.budgetType,t=["Edit Categories","Copy last month's budget","Set budgets to zero","Set budgets to 3 month average","report"===e&&"Apply to all future budgets","Cancel"].filter(Boolean);this.props.showActionSheetWithOptions({options:t,cancelButtonIndex:t.length-1,title:"Actions"},t=>{switch(t){case 0:this.setState({editMode:!0});break;case 1:this.onBudgetAction("copy-last");break;case 2:this.onBudgetAction("set-zero");break;case 3:this.onBudgetAction("set-3-avg");break;case 4:"report"===e&&this.onBudgetAction("set-all-future")}})}),this.summary=0;const t=de.d();this.state={bounds:{start:t,end:t},currentMonth:t,initialized:!1,editMode:!1,categoryGroups:null}}async loadCategories(){let e=await this.props.getCategories();this.setState({categoryGroups:e.grouped})}async componentDidMount(){this.loadCategories();const e=await Object(M.send)("get-budget-bounds"),t=e.start,n=e.end;this.setState({bounds:{start:t,end:n}}),this.prewarmMonth(this.state.currentMonth);let r=Object(M.listen)("sync-event",({type:e,tables:t})=>{"success"===e&&(t.includes("categories")||t.includes("category_mapping")||t.includes("category_groups"))&&this.loadCategories()});this.cleanup=(()=>{r()})}componentWillUnmount(){}render(){const e=this.state,t=e.currentMonth,n=e.bounds,r=e.editMode,a=e.initialized,o=this.props,i=o.categories,c=o.categoryGroups,s=o.prefs,u=o.budgetType,d=o.navigation,f=o.applyBudgetAction;let p=s.numberFormat||"comma-dot";return c&&a?l.a.createElement(rd,{onSync:this.sync},({refreshing:e,onRefresh:a})=>l.a.createElement(zE,{key:p,categories:i,categoryGroups:c,type:u,month:t,monthBounds:n,editMode:r,navigation:d,onEditMode:e=>this.setState({editMode:e}),onShowBudgetDetails:this.onShowBudgetDetails,onPrevMonth:this.onPrevMonth,onNextMonth:this.onNextMonth,onAddCategory:this.onAddCategory,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup,onOpenActionSheet:()=>{},onBudgetAction:f})):l.a.createElement($.C,{style:YE},l.a.createElement(Dt.a,{width:25,height:25}))}}var KE=Object(s.b)(e=>({categoryGroups:e.queries.categories.grouped,categories:e.queries.categories.list,budgetType:e.prefs.local.budgetType||"rollover",prefs:e.prefs.local,initialBudgetMonth:e.app.budgetMonth}),y)(Object(ed.b)(W.a.p5)(function(e){let t=Object(o.useContext)(T.a);return l.a.createElement(VE,Object.assign({},e,{spreadsheet:t}))}));var ZE=Object(u.k)(class extends l.a.Component{componentDidMount(){const e=e=>{if(!Rb.a.isBrowser&&e.metaKey){const t=this.props.history;switch(e.keyCode){case 49:t.push("/budget");break;case 50:t.push("/reports");break;case 51:t.push("/accounts");break;case 188:"mac"===Rb.a.OS&&t.push("/settings")}}};document.addEventListener("keydown",e),this.cleanupListeners=(()=>{document.removeEventListener("keydown",e)})}componentWillUnmount(){this.cleanupListeners()}render(){return null}});let QE=l.a.createContext({type:"page"});function JE({type:e,current:t,children:n}){return l.a.createElement(QE.Provider,{value:{type:e,current:t}},n)}function XE(){return l.a.useContext(QE)}var ej={fontSize:25,fontWeight:500,marginBottom:15};function tj({name:e}){return l.a.createElement($.z,{style:ej},e)}var nj={paddingLeft:20,paddingRight:20,flex:1};function rj({title:e,modalSize:t,children:n}){let r=XE(),a=r.type,o=r.current,i=Object(u.g)();if("modal"===a){let r=t;return"string"===typeof t&&(r="medium"===t?{width:750,height:600}:{width:600}),l.a.createElement($.t,{title:e,isCurrent:o,size:r,onClose:()=>i.goBack()},n)}return l.a.createElement($.C,{style:[W.c.page,nj]},l.a.createElement(tj,{name:e}),n)}function aj(){return l.a.createElement(rj,{title:"Rules"},l.a.createElement(Zr,null))}var oj={flexDirection:"row",justifyContent:"center",paddingTop:15,paddingBottom:15},lj={fontWeight:"600",textAlign:"right",marginRight:10},ij={display:"flex",flexDirection:"column",textAlign:"left"},cj={alignItems:"center",marginBottom:15},sj={flexDirection:"row",justifyContent:"center",paddingBottom:15},uj={marginRight:10};var dj=function({month:e,modalProps:t}){const n=de.g(de.u(e),"MMM");return l.a.createElement($.t,Object.assign({title:"Budget Details"},t,{animate:!0}),()=>l.a.createElement(Bp.a.Provider,{value:de.w(e)},l.a.createElement($.C,{style:oj},l.a.createElement($.C,{style:[W.c.text,lj]},l.a.createElement(xt,{binding:Le.incomeAvailable,type:"financial"}),l.a.createElement(xt,{binding:Le.lastMonthOverspent,type:"financial"}),l.a.createElement(xt,{binding:Le.totalBudgeted,type:"financial"}),l.a.createElement(xt,{binding:Le.forNextMonth,type:"financial"})),l.a.createElement($.C,{style:[W.c.text,ij]},l.a.createElement($.z,null,"Available Funds"),l.a.createElement($.z,null,"Overspent in ",n),l.a.createElement($.z,null,"Budgeted"),l.a.createElement($.z,null,"For Next Month"))),l.a.createElement($.C,{style:cj},l.a.createElement(Ct.a,{binding:Le.toBudget},({value:e})=>l.a.createElement(l.a.Fragment,null,l.a.createElement($.z,{style:W.c.text},e<0?"Overbudget:":"To budget:"),l.a.createElement($.z,{style:[W.c.text,{fontWeight:"600",fontSize:22,color:e<0?W.a.r4:W.a.n1}]},Object(St.a)(e,"financial"))))),l.a.createElement($.C,{style:sj},l.a.createElement($.d,{style:uj,onClick:t.onClose},"Close"))))},fj=n(241);const pj=["categoryGroups"];function mj(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return yj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yj(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gj(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function hj(e,t,n){const r=n.find(e=>e.id===t),a=r&&1===r.offbudget;return 0===e.offbudget&&a}function bj(e){let t=e.categoryGroups,n=gj(e,pj);return l.a.createElement($.x,n,l.a.createElement("option",{value:""},"Select category..."),t.map(e=>l.a.createElement("optgroup",{key:e.id,label:e.name},e.categories.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name)))))}var Oj={flex:0},wj={width:200,marginBottom:15},vj={marginBottom:15},Ej={marginBottom:15},jj={width:200},Sj={marginBottom:15},Cj={fontSize:12},xj={color:W.a.r6},Pj={flexDirection:"row",justifyContent:"flex-end"},kj={marginRight:10};var Aj=function({account:e,accounts:t,categoryGroups:n,balance:r,canDelete:a,actions:i,modalProps:c}){let s=mj(Object(o.useState)(!1),2),u=s[0],d=s[1],f=t.filter(t=>t.id!==e.id),p=f.filter(e=>0===e.offbudget),m=f.filter(e=>1===e.offbudget);return l.a.createElement($.t,Object.assign({title:"Close Account"},c,{style:Oj,loading:u}),()=>l.a.createElement($.C,null,l.a.createElement($.v,null,"Are you sure you want to close ",l.a.createElement("strong",null,e.name),"?"," ",a?l.a.createElement("span",null,"This account has no transactions so it will be permanently deleted."):l.a.createElement("span",null,"This account has transactions so we can","'","t permanently delete it.")),l.a.createElement(fj.a,{validateOnChange:!1,initialValues:{transfer:"",category:""},onSubmit:(n,{setErrors:a})=>{const o={};0!==r&&""===n.transfer&&(o.transfer="required"),hj(e,n.transfer,t)&&""===n.category&&(o.category="required"),a(o),0===Object.keys(o).length&&(d(!0),i.closeAccount(e.id,n.transfer||null,n.category||null).then(()=>{c.onClose()}))},render:({values:o,errors:s,touched:u,handleChange:f,handleBlur:y,handleSubmit:g,isSubmitting:h,setFieldValue:b})=>l.a.createElement("form",{onSubmit:g},0!==r&&l.a.createElement($.C,null,l.a.createElement($.v,null,"This account has a balance of"," ",l.a.createElement("strong",null,Object(ke.k)(r)),". To close this account, select a different account to transfer this balance to:"),l.a.createElement($.x,{name:"transfer",value:o.transfer,onChange:f,onBlur:y,style:wj},l.a.createElement("option",{value:""},"Select account..."),l.a.createElement("optgroup",{label:"For Budget"},p.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name))),l.a.createElement("optgroup",{label:"Off Budget"},m.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name)))),s.transfer&&l.a.createElement($.j,{style:vj},"Transfer is required"),hj(e,o.transfer,t)&&l.a.createElement($.C,{style:Ej},l.a.createElement($.v,null,"Since you are transferring the balance from a budgeted account to an off-budget account, this transaction must be categorized. Select a category:"),l.a.createElement(bj,{categoryGroups:n,name:"category",value:o.category,onChange:f,onBlur:y,style:jj}),s.category&&l.a.createElement($.j,null,"Category is required"))),!a&&l.a.createElement($.C,{style:Sj},l.a.createElement($.z,{style:Cj},"You can also ",l.a.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),d(!0),i.forceCloseAccount(e.id).then(()=>c.onClose())},style:xj},"force close")," ","the account which will delete it and all its transactions permanently. Doing so may change your budget unexpectedly since money in it may vanish.")),l.a.createElement($.C,{style:Pj},l.a.createElement($.d,{type:"submit",style:kj,onClick:c.onClose},"Cancel"),l.a.createElement($.d,{type:"submit",primary:!0},"Close Account")))})))},Dj=n(205);function Ij(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Tj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Tj(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Mj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mj(Object(n),!0).forEach(function(t){Bj(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bj(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _j(){return null}var Lj={marginBottom:8,flexShrink:0,userSelect:"none"},zj=Rj(Rj({padding:12},W.c.shadow),{},{cursor:"pointer",transition:"transform .20s",fontSize:14,borderRadius:4,flexDirection:"row",alignItems:"center",border:"1px solid "+W.a.n10}),Fj={flex:1},Nj={fontWeight:600},Uj={fontSize:13,color:W.a.n5,flexDirection:"row"},$j={marginLeft:4},Wj={color:W.a.n8},Gj={width:15,height:15,color:W.a.g5},Hj={color:W.a.g5,marginLeft:5};function qj({account:e,offbudget:t,onSelect:n}){return l.a.createElement($.C,{style:[Lj,W.c.mediumText],onClick:n},l.a.createElement($.C,{style:[zj]},l.a.createElement($.C,{style:Fj},l.a.createElement($.C,{style:Nj},e.name),l.a.createElement($.C,{style:Uj},yf(mf(e.type,e.subtype)),l.a.createElement($.z,{style:$j},"...",e.mask))),t?l.a.createElement($.z,{style:Wj},"Off budget"):l.a.createElement(l.a.Fragment,null,l.a.createElement(Dj.a,{style:Gj}),l.a.createElement($.z,{style:Hj},"Budgeted"))))}var Yj={maxWidth:500},Vj={fontSize:15,marginBottom:15,lineHeight:"1.4em"},Kj={maxHeight:300,overflow:"auto",paddingLeft:5,paddingRight:5,marginLeft:-5,marginRight:-5},Zj={flexDirection:"row",justifyContent:"flex-end",marginTop:30},Qj={marginRight:10};function Jj({institution:e,publicToken:t,upgradingId:n,modalProps:r,accounts:a,actions:i}){let c=Ij(Object(o.useState)(()=>a.filter(e=>gf(mf(e.type))).map(e=>e.id)),2),s=c[0],u=c[1];async function d(){let n=await i.connectAccounts(e,t,a.map(e=>e.id),s);i.closeModal(),1===n.length?window.location.hash="/accounts/"+n[0]:n.length>0&&(window.location.hash="/accounts")}return l.a.createElement($.t,Object.assign({title:n?"Link Account":"Link Accounts"},r),()=>l.a.createElement($.C,{style:Yj},l.a.createElement($.z,{style:Vj},"A ",l.a.createElement("strong",null,"budgeted account")," is one where expenses and income affect the budget. Usually things like investments are off budget. We","'","ve chosen some defaults here, but you can change the status if you like."),l.a.createElement($.C,{style:Kj},l.a.createElement($.C,null,0===a.length?l.a.createElement(_j,null):a.map(e=>{let t=s.includes(e.id);return l.a.createElement(qj,{key:e.id,account:e,offbudget:t,onSelect:()=>(function(e){s.includes(e)?u(s.filter(t=>t!==e)):u([...s,e])})(e.id)})}))),l.a.createElement($.C,{style:Zj},l.a.createElement($.d,{style:Qj,onClick:r.onBack},"Back"),l.a.createElement($.d,{primary:!0,onClick:d},n?"Link Account":"Next"))))}var Xj={flex:1},eS={marginLeft:75},tS={marginLeft:75},nS={width:"75%",flexDirection:"row",justifyContent:"flex-end"},rS={userSelect:"none"},aS={flex:1},oS={marginLeft:75},lS={marginLeft:10};var iS=function({modalProps:e,actions:t,history:n}){return l.a.createElement($.t,Object.assign({title:"Create Local Account"},e,{showBack:!1}),()=>l.a.createElement($.C,null,l.a.createElement(fj.a,{validateOnChange:!1,initialValues:{name:"",type:"checking",balance:"0"},validate:()=>({}),onSubmit:async(r,{setErrors:a})=>{const o={};if(r.type||(o.type="required"),r.name||(o.name="required"),isNaN(parseFloat(r.balance))&&(o.balance="format"),a(o),0===Object.keys(o).length){e.onClose();let a=await t.createAccount(r.name,r.type,Object(ke.q)(r.balance),r.offbudget);n.push("/accounts/"+a)}},render:({values:t,errors:n,touched:r,handleChange:a,handleBlur:o,handleSubmit:i,isSubmitting:c,setFieldValue:s})=>l.a.createElement("form",{onSubmit:i},l.a.createElement($.m,{label:"Name",width:"75%"},l.a.createElement($.l,null,l.a.createElement($.n,{name:"name",value:t.name,onChange:a,onBlur:o,style:Xj}))),n.name&&l.a.createElement($.j,{style:eS},"Name is required"),l.a.createElement($.m,{label:"Type",width:"75%"},l.a.createElement($.x,{name:"type",value:t.type,onChange:e=>{s("offbudget",gf(e.target.value)),a(e)},onBlur:o},l.a.createElement("option",{value:"checking"},"Checking / Cash"),l.a.createElement("option",{value:"savings"},"Savings"),l.a.createElement("option",{value:"credit"},"Credit Card"),l.a.createElement("option",{value:"investment"},"Investment"),l.a.createElement("option",{value:"mortgage"},"Mortgage"),l.a.createElement("option",{value:"debt"},"Debt"),l.a.createElement("option",{value:"other"},"Other"))),n.type&&l.a.createElement($.j,{style:tS},"You must select a type"),l.a.createElement($.C,{style:nS},l.a.createElement("label",{style:rS},l.a.createElement("input",{name:"offbudget",type:"checkbox",checked:!!t.offbudget,onChange:a,onBlur:o})," ","Off-budget")),l.a.createElement($.m,{label:"Balance",width:"75%"},l.a.createElement($.n,{name:"balance",value:t.balance,onChange:a,onBlur:o,style:aS})),n.balance&&l.a.createElement($.j,{style:oS},"Balance must be a number"),l.a.createElement($.u,null,l.a.createElement($.d,{onClick:()=>e.onBack(),type:"button"},"Back"),l.a.createElement($.d,{primary:!0,style:lS},"Create")))})))},cS={flex:0,padding:"15px 10px",backgroundColor:W.a.n1,color:"white"},sS={alignSelf:"center",color:W.a.b10,marginBottom:10},uS={flex:1};var dS=Object(s.b)(e=>({dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy",categoryGroups:e.queries.categories.grouped,accounts:e.queries.accounts,payees:e.queries.payees}),y)(function({actions:e,modalProps:t,name:n,accounts:r,categoryGroups:a,payees:o,onSubmit:i,dateFormat:c,createPayee:s}){function u(e){"amount"===n&&(e=Object(ke.b)(e)),i(n,e),t.onClose()}let d,f,p,m={":focus":{boxShadow:0}},y={inputProps:{style:m},containerProps:{style:{height:275}}};switch(n){case"date":{let e=Object(de.c)();d="Date",p=350,f=l.a.createElement(Eo.a,{value:Object(Sn.a)(Object(Hn.a)(e),c),dateFormat:c,focused:!0,embedded:!0,onUpdate:()=>{},onSelect:e=>{u(Object(de.e)(Object(xe.a)(e,"yyyy-MM-dd",new Date)))}});break}case"account":d="Account",f=l.a.createElement(no,Object.assign({value:null,accounts:r,focused:!0,embedded:!0,onSelect:e=>{e&&u(e)}},y));break;case"payee":d="Payee",f=l.a.createElement(Vo,Object.assign({payees:o,accounts:r,value:null,focused:!0,embedded:!0,showManagePayees:!1,onSelect:async e=>{e&&e.startsWith("new:")&&(e=await s(e.slice("new:".length))),u(e)}},y));break;case"notes":d="Notes",f=l.a.createElement($.n,{focused:!0,onEnter:e=>u(e.target.value),style:m});break;case"category":d="Category",f=l.a.createElement(vo,Object.assign({categoryGroups:a,value:null,focused:!0,embedded:!0,showSplitOption:!1,onUpdate:()=>{},onSelect:e=>{u(e)}},y));break;case"amount":d="Amount",f=l.a.createElement($.n,{focused:!0,onEnter:e=>u(e.target.value),style:m})}return l.a.createElement($.t,Object.assign({noAnimation:!0,showHeader:!1,focusAfterClose:!1},t,{padding:0,style:[cS,p&&{minWidth:p}]}),()=>l.a.createElement($.C,null,l.a.createElement(jo.d,{title:d,style:sS}),l.a.createElement($.C,{style:uS},f)))});const fS=["inflow","outflow"];function pS(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function mS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mS(Object(n),!0).forEach(function(t){gS(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mS(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return bS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let OS=[{format:"yyyy mm dd",label:"YYYY MM DD"},{format:"yy mm dd",label:"YY MM DD"},{format:"mm dd yyyy",label:"MM DD YYYY"},{format:"mm dd yy",label:"MM DD YY"},{format:"dd mm yyyy",label:"DD MM YYYY"},{format:"dd mm yy",label:"DD MM YY"}];function wS(e,t){if("string"!==typeof e)return null;function n(e){return e&&1===e.length?"0"+e:e}const r=(e,t)=>n=>{const r=n.replace(/[^\d]/g,"");return[r.slice(0,e),r.slice(e,e+t),r.slice(e+t)]},a=r(4,2),o=r(2,2);let l,i,c,s;switch(t){case"dd mm yyyy":i=(l=o(e))[2],c=l[1],s=l[0];break;case"dd mm yy":i=`20${(l=o(e))[2]}`,c=l[1],s=l[0];break;case"yyyy mm dd":i=(l=a(e))[0],c=l[1],s=l[2];break;case"yy mm dd":i=`20${(l=o(e))[0]}`,c=l[1],s=l[2];break;case"mm dd yy":i=`20${(l=o(e))[2]}`,c=l[0],s=l[1];break;default:case"mm dd yyyy":i=(l=o(e))[2],c=l[0],s=l[1]}let u=`${i}-${n(c)}-${n(s)}`;return Pe.a(Hn.a(u))?u:null}function vS(e,t){if(!e)return null;try{return Object(de.g)(e,t)}catch(n){}return null}function ES(e){let t=e.match(/\.([^.]*)$/);return t?t[1].toLowerCase():"ofx"}var jS={color:W.a.n4,fontStyle:"italic"};function SS({parseDateFormat:e,showParsed:t,dateFormat:n,date:r}){let a=r&&vS(e?wS(r,e):r,n);return l.a.createElement($.z,null,l.a.createElement($.z,null,r||l.a.createElement($.z,{style:jS},"Empty")," ","\u2192"," "),l.a.createElement($.z,{style:{color:a?W.a.g3:W.a.r4}},a||"Invalid"))}function CS(e,t){if(0===e.length||null==t.date)return"yyyy mm dd";let n=e[0][t.date],r=null==n?null:OS.find(e=>null!=wS(n,e.format));return r?r.format:"mm dd yyyy"}function xS(e){if(0===e.length)return{};let t=e[0],n=Object.entries(t);function r(e){return e?e[0]:null}let a=r(n.find(([e,t])=>e.toLowerCase().includes("date"))||n.find(([e,t])=>t.match(/^\d+[-/]\d+[-/]\d+$/))),o=r(n.find(([e,t])=>e.toLowerCase().includes("amount"))||n.find(([e,t])=>t.match(/^-?[.,\d]+$/))),l=r(n.find(([e,t])=>e!==a&&e!==o)),i=r(n.find(([e,t])=>e!==a&&e!==o&&e!==l));return{date:a,amount:o,payee:l,notes:i}}function PS(e,t){let n={};for(let a of Object.entries(t)){var r=hS(a,2);let t=r[0],o=r[1];"payee"===t&&(t="payee_name"),n[t]=e[o||t]}return n}function kS(e,t){if(null==e)return null;return t("string"===typeof e?Object(ke.m)(e):e)}function AS(e,t,n){if(t){let t=kS(e.outflow,e=>-Math.abs(e)),n=t?0:kS(e.inflow,e=>Math.abs(e));return{amount:t||n,outflow:t,inflow:n}}return{amount:kS(e.amount,e=>n?-1*e:e),outflow:null,inflow:null}}var DS={backgroundColor:"white"},IS={textAlign:"right"},TS={textAlign:"right"},MS={textAlign:"right"};function RS({transaction:e,fieldMappings:t,showParsed:n,parseDateFormat:r,dateFormat:a,splitMode:i,flipAmount:c}){let s=Object(o.useMemo)(()=>t?PS(e,t):e,[e,t]),u=AS(s,i,c),d=u.amount,f=u.outflow,p=u.inflow;return d=Object(ke.a)(d),f=Object(ke.a)(f),p=Object(ke.a)(p),l.a.createElement(kt.h,{style:DS},l.a.createElement(kt.e,{width:200,borderColor:W.a.border},n?l.a.createElement(SS,{parseDateFormat:r,dateFormat:a,date:s.date}):vS(s.date,a)),l.a.createElement(kt.e,{width:"flex",borderColor:W.a.border,title:s.imported_payee||s.payee_name},s.payee_name),l.a.createElement(kt.e,{width:"flex",borderColor:W.a.border,title:s.notes},s.notes),i?l.a.createElement(l.a.Fragment,null,l.a.createElement(kt.e,{width:90,borderColor:W.a.border,contentStyle:[IS,W.c.tnum],title:f},f),l.a.createElement(kt.e,{width:90,borderColor:W.a.border,contentStyle:[TS,W.c.tnum],title:p},p)):l.a.createElement(kt.e,{width:90,borderColor:W.a.border,contentStyle:[MS,W.c.tnum],title:d},d))}var BS={fontSize:13,marginBottom:3,color:W.a.n3};function _S({title:e}){return l.a.createElement($.z,{style:BS},e)}function LS({width:e,style:t,options:n,value:r,onChange:a}){return l.a.createElement($.x,{value:r,style:t,onChange:e=>a(e.target.value)},l.a.createElement("option",{value:""},"Choose field..."),n.map(e=>l.a.createElement("option",{key:e,value:e},e)))}var zS={width:120};function FS({transactions:e,fieldMappings:t,parseDateFormat:n,onChange:r}){let a="-";if(e.length>0&&t&&null!=t.date){let n=e[0][t.date],r=n&&n.match(/[/.,-/\\]/);a=r?r[0]:" "}return l.a.createElement($.C,{style:zS},l.a.createElement(jo.d,{title:"Date format"}),l.a.createElement($.x,{value:n||"",onChange:e=>r(e.target.value)},OS.map(e=>l.a.createElement("option",{key:e.format,value:e.format},e.label.replace(/ /g,a)))))}var NS={flex:1,flexDirection:"row",alignItems:"center",userSelect:"none"};function US({value:e,disabled:t,onChange:n}){return l.a.createElement($.C,{style:NS},l.a.createElement(jo.a,{id:"form_flip",checked:e,disabled:t,onChange:n}),l.a.createElement("label",{htmlFor:"form_flip",style:{userSelect:"none",color:t?W.a.n6:null}},"Flip amount"))}var $S={flex:1,flexDirection:"row",alignItems:"center",userSelect:"none"},WS={userSelect:"none"};function GS({value:e,onChange:t}){return l.a.createElement($.C,{style:$S},l.a.createElement(jo.a,{id:"form_split",checked:e,onChange:t}),l.a.createElement("label",{htmlFor:"form_split",style:WS},"Split amount into separate inflow/outflow columns"))}var HS={marginTop:5},qS={width:200},YS={marginRight:5},VS={flex:1},KS={marginRight:5},ZS={flex:1},QS={marginRight:5},JS={width:90},XS={width:90},eC={width:90};function tC({transactions:e,mappings:t,onChange:n,splitMode:r}){if(0===e.length)return null;let a=Object.keys(e[0]);return t=t||{},l.a.createElement($.C,null,l.a.createElement(jo.d,{title:"CSV FIELDS"}),l.a.createElement($.y,{direction:"row",align:"flex-start",spacing:1,style:HS},l.a.createElement($.C,{style:qS},l.a.createElement(_S,{title:"Date"}),l.a.createElement(LS,{width:200,options:a,value:t.date||"",style:YS,onChange:e=>n("date",e)})),l.a.createElement($.C,{style:VS},l.a.createElement(_S,{title:"Payee"}),l.a.createElement(LS,{width:"flex",options:a,value:t.payee||"",style:KS,onChange:e=>n("payee",e)})),l.a.createElement($.C,{style:ZS},l.a.createElement(_S,{title:"Notes"}),l.a.createElement(LS,{width:"flex",options:a,value:t.notes||"",style:QS,onChange:e=>n("notes",e)})),r?l.a.createElement(l.a.Fragment,null,l.a.createElement($.C,{style:JS},l.a.createElement(_S,{title:"Outflow"}),l.a.createElement(LS,{width:90,options:a,value:t.outflow||"",onChange:e=>n("outflow",e)})),l.a.createElement($.C,{style:XS},l.a.createElement(_S,{title:"Inflow"}),l.a.createElement(LS,{width:90,options:a,value:t.inflow||"",onChange:e=>n("inflow",e)}))):l.a.createElement($.C,{style:eC},l.a.createElement(_S,{title:"Amount"}),l.a.createElement(LS,{width:90,options:a,value:t.amount||"",onChange:e=>n("amount",e)}))))}var nC={width:800},rC={alignItems:"center",marginBottom:15},aC={marginRight:10,color:W.a.r4},oC={flex:"unset",height:300,border:"1px solid "+W.a.border},lC={backgroundColor:W.a.n11},iC={textAlign:"center",marginTop:25,color:W.a.n4,fontStyle:"italic"},cC={color:W.a.r4,alignItems:"center",marginTop:10},sC={maxWidth:450,marginBottom:15},uC={marginTop:25},dC={marginTop:25},fC={marginTop:5},pC={marginTop:10},mC={flexDirection:"row",marginTop:25},yC={marginLeft:25},gC={flex:1},hC={alignSelf:"flex-end",flexDirection:"row",alignItems:"center"};var bC=Object(s.b)(e=>({dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy",prefs:e.prefs.local}),y)(function({modalProps:e,options:t,dateFormat:n="MM/dd/yyyy",prefs:r,parseTransactions:a,importTransactions:i,getPayees:c,savePrefs:s}){let u=hS(Object(o.useState)("parsing"),2),d=u[0],f=u[1],p=hS(Object(o.useState)(null),2),m=p[0],y=p[1],g=hS(Object(o.useState)(t.filename),2),h=g[0],b=g[1],O=hS(Object(o.useState)([]),2),w=O[0],v=O[1],E=hS(Object(o.useState)(null),2),j=E[0],S=E[1],C=hS(Object(o.useState)(null),2),x=C[0],P=C[1],k=hS(Object(o.useState)(!1),2),A=k[0],D=k[1],I=hS(Object(o.useState)(!1),2),T=I[0],M=I[1],R=t.accountId,B=t.onImported,_=hS(Object(o.useState)(r[`csv-delimiter-${R}`]||","),2),L=_[0],z=_[1],F=hS(Object(o.useState)(null),2),N=F[0],U=F[1];async function W(e,t){f("parsing");let n=await a(e,t),o=n.errors,l=n.transactions;if(f(null),y(null),o.length>0)y({parsed:!0,message:o[0].message||"Internal error"});else{let t=ES(e);if(b(e),S(t),"csv"!==t&&"qif"!==t||M(r[`flip-amount-${R}-${t}`]||!1),"csv"===t){let e=r[`csv-mappings-${R}`];e=e?JSON.parse(e):xS(l),P(e);let n=!(!e.outflow&&!e.inflow);D(n),U(r[`parse-date-${R}-${t}`]||CS(l,e))}else"qif"===t?U(r[`parse-date-${R}-${t}`]||CS(l,{date:"date"})):(P(null),U(null));v(l.reverse())}}Object(o.useEffect)(()=>{W(t.filename,"csv"===ES(t.filename)?{delimiter:L}:null)},[a,t.filename]);let G=[{name:"Date",width:200},{name:"Payee",width:"flex"},{name:"Notes",width:"flex"}];return A?(G.push({name:"Outflow",width:90,style:{textAlign:"right"}}),G.push({name:"Inflow",width:90,style:{textAlign:"right"}})):G.push({name:"Amount",width:90,style:{textAlign:"right"}}),l.a.createElement($.t,Object.assign({title:"Import transactions"+(j?` (${j.toUpperCase()})`:"")},e,{loading:"parsing"===d,style:nC}),m&&!m.parsed&&l.a.createElement($.C,{style:rC},l.a.createElement($.z,{style:aC},l.a.createElement("strong",null,"Error:")," ",m.message)),(!m||!m.parsed)&&l.a.createElement($.C,{style:oC},l.a.createElement(kt.m,{headers:G}),l.a.createElement(kt.n,{items:w,fields:["payee","amount"],style:lC,getItemKey:e=>e,renderEmpty:()=>l.a.createElement($.C,{style:iC},"No transactions found"),renderItem:({key:e,style:t,item:r,editing:a,focusedField:o})=>l.a.createElement($.C,{key:e,style:t},l.a.createElement(RS,{transaction:r,showParsed:"csv"===j||"qif"===j,parseDateFormat:N,dateFormat:n,fieldMappings:x,splitMode:A,flipAmount:T}))})),m&&m.parsed&&l.a.createElement($.C,{style:cC},l.a.createElement($.z,{style:sC},l.a.createElement("strong",null,"Error:")," ",m.message),m.parsed&&l.a.createElement($.d,{onClick:()=>(function(){const e=window.Actual.openFileDialog({filters:[{name:"Financial Files",extensions:["qif","ofx","qfx","csv"]}]});W(e[0],"csv"===ES(e[0])?{delimiter:L}:null)})()},"Select new file...")),"csv"===j&&l.a.createElement($.C,{style:uC},l.a.createElement(tC,{transactions:w,onChange:function(e,t){P(yS(yS({},x),{},{[e]:""===t?null:t}))},mappings:x,splitMode:A})),("qif"===j||"csv"===j)&&l.a.createElement($.C,{style:dC},l.a.createElement(jo.d,{title:"IMPORT OPTIONS"}),l.a.createElement($.C,{style:fC},l.a.createElement(US,{value:T,disabled:A,onChange:()=>{M(!T)}})),"csv"===j&&l.a.createElement($.C,{style:pC},l.a.createElement(GS,{value:A,onChange:function(){if(null==x)return;let e=!A;D(e);let t=xS(w),n=e?{amount:null,outflow:t.amount,inflow:null}:{amount:t.amount,outflow:null,inflow:null};P(yS(yS({},x),n))}}))),l.a.createElement($.C,{style:mC},("qif"===j||"csv"===j)&&l.a.createElement(FS,{transactions:w,fieldMappings:x,parseDateFormat:N,onChange:U}),"csv"===j&&l.a.createElement($.C,{style:yC},l.a.createElement(jo.d,{title:"CSV DELIMITER"}),l.a.createElement($.x,{value:L,onChange:e=>{z(e.target.value),W(h,{delimiter:e.target.value})}},l.a.createElement("option",{value:","},","),l.a.createElement("option",{value:";"},";"))),l.a.createElement($.C,{style:gC}),l.a.createElement($.C,{style:hC},l.a.createElement($.f,{primary:!0,disabled:0===w.length,loading:"importing"===d,onClick:async function(){f("importing");let t,n=[];for(let e of w){e=x?PS(e,x):e;let r="qfx"===j||"ofx"===j?e.date:wS(e.date,N);if(null==r){t=`Unable to parse date ${e.date||"(empty)"} with given date format`;break}let a=AS(e,A,T).amount;if(null==a){t=`Transaction on ${e.date} has no amount`;break}let o=e,l=(o.inflow,o.outflow,pS(o,fS));n.push(yS(yS({},l),{},{date:r,amount:Object(ke.b)(a)}))}if(t)return f(null),void y({parsed:!1,message:t});"ofx"!==j&&"qfx"!==j&&s({[`parse-date-${R}-${j}`]:N}),"csv"===j&&(s({[`csv-mappings-${R}`]:JSON.stringify(x)}),s({[`csv-delimiter-${R}`]:L})),"csv"!==j&&"qif"!==j||s({[`flip-amount-${R}-${j}`]:T});let r=await i(R,n);r&&await c(),B&&B(r),e.onClose()}},"Import ",w.length," transactions"))))}),OC=n(242);function wC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wC(Object(n),!0).forEach(function(t){EC(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function EC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var jC=e=>o.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:vC({color:"#242134"},e.style)}),o.createElement("path",{d:"M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 11V9h2v6H9v-4zm0-6h2v2H9V5z",fill:"currentColor"}));function SC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function CC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?SC(Object(n),!0).forEach(function(t){xC(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var PC={paddingLeft:2,paddingTop:".11em",alignSelf:"stretch",flexShrink:0,marginRight:5},kC={zIndex:1,lineHeight:1.5};function AC({icon:e,color:t,backgroundColor:n,style:r,children:a}){return l.a.createElement($.C,{style:[CC(CC({color:t,fontSize:13},W.c.shadow),{},{borderRadius:4,backgroundColor:n,padding:10,flexDirection:"row","& a, & a:active, & a:visited":{color:W.a.b3}}),r]},l.a.createElement($.C,{style:PC},l.a.createElement(e,{width:13,style:{color:t,marginTop:2}})),l.a.createElement($.z,{style:kC},a))}var DC={boxShadow:"none",padding:5};function IC({style:e,children:t}){return l.a.createElement(AC,{icon:jC,color:W.a.n4,backgroundColor:"transparent",style:[e,DC]},t)}function TC({style:e,children:t}){return l.a.createElement(AC,{icon:Vb,color:W.a.r2,backgroundColor:W.a.r10,style:e},t)}function MC(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return RC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RC(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function RC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var BC={alignSelf:"center"};var _C={flex:0},LC={fontSize:15},zC={alignItems:"center",marginTop:15},FC={width:20,height:20},NC={marginTop:10,color:W.a.n4},UC={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10,backgroundColor:W.a.g4,borderColor:W.a.g4},$C={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10},WC={color:W.a.n5,fontWeight:600},GC={marginTop:10,color:W.a.n5,fontSize:13,"& a, & a:visited":{color:W.a.n5}},HC={marginTop:10};function qC({modalProps:e,onMoveExternal:t,onSuccess:n,onClose:r}){let a=MC(Object(o.useState)(null),2),i=a[0],c=a[1],s=MC(Object(o.useState)(!1),2),u=s[0],d=s[1],f=MC(Object(o.useState)(null),2),p=f[0],m=f[1],y=Object(o.useRef)(null);async function g(){m(null),c("browser");let e=await t();if(e.error)return m(e.error),void c(null);y.current=e.data,c(null),d(!0)}async function h(){c("accounts"),await n(y.current),c(null)}var b={marginTop:i?30:35};return l.a.createElement($.t,Object.assign({title:"Link Your Bank"},e,{onClose:function(){r&&r(),e.onClose()},style:_C}),()=>l.a.createElement($.C,null,l.a.createElement($.v,{style:LC},"To link your bank account, you will be moved to your browser for enhanced security. Click below and Actual will automatically resume when you have given your bank","'","s credentials."),p&&function(e){return l.a.createElement(TC,{style:BC},"timeout"===e?"Timed out. Please try again.":"An error occurred while linking your account, sorry!")}(p),i?l.a.createElement($.C,{style:zC},l.a.createElement(Dt.a,{color:W.a.n1,style:FC}),l.a.createElement($.C,{style:NC},"browser"===i?"Waiting on browser...":"accounts"===i?"Loading accounts...":null)):u?l.a.createElement($.d,{primary:!0,style:UC,onClick:h},"Success! Click to continue \u2192"):l.a.createElement($.d,{primary:!0,style:$C,onClick:g},"Link bank in browser \u2192"),l.a.createElement("div",{style:b},l.a.createElement($.z,{style:WC},"Why not link it in the app?")),l.a.createElement($.z,{style:GC},"Typing your bank","'","s username and password is one of the most security-sensitive things you can do, and the browser is the most secure app in the world. Why not use it to make sure your information is safe? [TODO: Link to docs article]"),l.a.createElement($.u,{style:HC},l.a.createElement($.d,{onClick:()=>e.onBack()},"Back"))))}function YC(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return VC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VC(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function VC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function KC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ZC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?KC(Object(n),!0).forEach(function(t){QC(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function QC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let JC={color:W.a.n1};function XC(){return null}var ex={marginBottom:8,flexShrink:0,userSelect:"none"},tx=ZC(ZC({padding:12},W.c.shadow),{},{cursor:"pointer",transition:"transform .20s",fontSize:14,borderRadius:4,flexDirection:"row",alignItems:"center",border:"1px solid "+W.a.n10,":hover":JC}),nx=ZC(ZC({},JC),{},{borderColor:W.a.b9,backgroundColor:W.a.b10}),rx={fontWeight:600,flex:1},ax={fontSize:13,color:W.a.n5,flexDirection:"row"},ox={marginLeft:4};function lx({account:e,selected:t,onSelect:n}){return l.a.createElement($.C,{style:[ex,W.c.mediumText],onClick:n},l.a.createElement($.C,{style:[tx,t&&nx]},l.a.createElement($.C,null,l.a.createElement($.C,{style:rx},e.name),l.a.createElement($.C,{style:ax},yf(mf(e.type,e.subtype)),l.a.createElement($.z,{style:ox},"...",e.mask)))))}var ix={maxWidth:500},cx={maxHeight:300,overflow:"auto",paddingLeft:5,paddingRight:5,marginLeft:-5,marginRight:-5},sx={flexDirection:"row",justifyContent:"flex-end",marginTop:30},ux={marginRight:10};function dx({institution:e,publicToken:t,upgradingId:n,modalProps:r,accounts:a,actions:i}){let c=YC(Object(o.useState)([]),2),s=c[0],u=c[1];async function d(){s.length>0&&(n?(i.linkAccount(e,t,s[0],n),i.closeModal()):i.pushModal("configure-linked-accounts",{institution:e,publicToken:t,accounts:s.map(e=>a.find(t=>t.id===e))}))}return l.a.createElement($.t,Object.assign({title:n?"Link Account":"Link Accounts"},r),()=>l.a.createElement($.C,{style:ix},n?l.a.createElement($.v,null,"We found the following accounts. Select the one you want to link with:"):l.a.createElement($.v,null,"We found the following accounts. Select which ones you want to add:"),l.a.createElement($.C,{style:cx},l.a.createElement($.C,null,0===a.length?l.a.createElement(XC,null):a.map(e=>{let t=s.includes(e.id);return l.a.createElement(lx,{key:e.id,account:e,selected:t,onSelect:()=>(function(e){n?u([e]):s.includes(e)?u(s.filter(t=>t!==e)):u([...s,e])})(e.id)})}))),l.a.createElement($.C,{style:sx},l.a.createElement($.d,{style:ux,onClick:r.onClose},"Cancel"),l.a.createElement($.d,{primary:!0,onClick:d},n?"Link Account":"Next"))))}function fx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function px(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fx(Object(n),!0).forEach(function(t){mx(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fx(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mx(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var yx={marginTop:15,color:W.a.r4},gx={flex:0},hx={lineHeight:1.5},bx={marginTop:20,flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},Ox={flex:1,marginLeft:10,marginRight:30};var wx=class extends l.a.Component{constructor(...e){super(...e),this.state={transferCategory:null,error:null},this.onDelete=(()=>{let e=this.state.transferCategory,t=this.props.onDelete;e?(t(e),this.props.modalProps.onClose()):this.setState({error:"required-transfer"})}),this.renderError=(e=>{let t;switch(e){case"required-transfer":t="You must select a category";break;default:t="Something bad happened, sorry!"}return l.a.createElement($.z,{style:yx},t)})}componentDidMount(){setTimeout(()=>{this.input.focus()},200)}render(){const e=this.props,t=e.modalProps,n=e.category,r=e.group,a=e.categoryGroups,o=this.state,i=o.transferCategory,c=o.error,s=!!(n||r).is_income;return l.a.createElement($.t,Object.assign({title:"Confirm Delete"},t,{style:gx}),()=>l.a.createElement($.C,{style:hx},r?l.a.createElement($.c,null,"Categories in the group ",l.a.createElement("strong",null,r.name)," are used by existing transaction",!s&&" or it has a positive leftover balance currently",". ",l.a.createElement("strong",null,"Are you sure you want to delete it?")," If so, you must select another category to transfer existing transactions and balance to."):l.a.createElement($.c,null,l.a.createElement("strong",null,n.name)," is used by existing transactions",!s&&" or it has a positive leftover balance currently",". ",l.a.createElement("strong",null,"Are you sure you want to delete it?")," If so, you must select another category to transfer existing transactions and balance to."),c&&this.renderError(c),l.a.createElement($.C,{style:bx},l.a.createElement($.z,null,"Transfer to:"),l.a.createElement($.C,{style:Ox},l.a.createElement(mo,{ref:e=>this.input=e,categoryGroups:r?a.filter(e=>e.id!==r.id&&!!e.is_income===s):a.filter(e=>!!e.is_income===s).map(e=>px(px({},e),{},{categories:e.categories.filter(e=>e.id!==n.id)})),name:"category",value:i,onChange:e=>this.setState({transferCategory:e.target.value})})),l.a.createElement($.d,{primary:!0,onClick:()=>this.onDelete()},"Delete"))))}},vx={maxWidth:500},Ex={marginBottom:10,lineHeight:"1.4em",fontSize:15},jx={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10},Sx={marginTop:30,marginBottom:10,lineHeight:"1.4em",fontSize:15},Cx={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10,color:W.a.n3};var xx=Object(s.b)(e=>({currentModal:e.modals.currentModal}),e=>Object(ue.b)(y,e))(class extends l.a.Component{constructor(...e){super(...e),this.onConnect=(async()=>{fn(this.props.pushModal)}),this.onCreateLocalAccount=(()=>{(0,this.props.pushModal)("add-local-account")})}render(){const e=this.props.modalProps;return l.a.createElement($.t,Object.assign({title:"Add Account"},e),()=>l.a.createElement($.C,{style:vx},l.a.createElement($.z,{style:Ex},l.a.createElement("strong",null,"Link your bank accounts")," to automatically download transactions. We offer hundreds of banks to sync with, and our service will provide reliable, up-to-date information."),l.a.createElement($.d,{primary:!0,style:jx,onClick:this.onConnect},"Link bank account"),l.a.createElement($.C,{style:Sx},"You can also create a local account if you want to track transactions manually. You can add transactions manually or import QIF/OFX/QFX files."),l.a.createElement($.d,{style:Cx,onClick:this.onCreateLocalAccount},"Create local account")))}}),Px=n(243);function kx({type:e,id:t,noneColor:n=W.a.n8}){var r={color:n};let a;switch(e){case"payees":a=k;break;case"accounts":a=E;break;default:throw new Error("DisplayId: unknown object type: "+e)}return l.a.createElement(a,{idKey:!0},e=>{let n=e[t];return l.a.createElement($.z,{style:null==n?r:null,title:n?n.name:"None"},n?n.name:"None")})}function Ax(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ax(Object(n),!0).forEach(function(t){Ix(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ax(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ix(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Tx={flexDirection:"row",alignItems:"center",justifyContent:"flex-start"},Mx={width:13,height:13,margin:"0 5px"},Rx={textAlign:"right"};const Bx=l.a.memo(function({transaction:e,fields:t,payees:n,categories:r,accounts:a,selected:o}){let i=Object(h.d)(r)[e.category],c=Object(h.b)(a)[e.account],s=Object(At.d)();return l.a.createElement(kt.h,null,l.a.createElement(kt.i,{exposed:!0,focused:!1,onSelect:()=>{s({type:"select",id:e.id})},selected:o}),t.map((t,n)=>{switch(t){case"date":return l.a.createElement(kt.e,{key:n,width:100},e.date);case"imported_payee":return l.a.createElement(kt.e,{key:n,width:"flex"},e.imported_payee);case"payee":return l.a.createElement(kt.a,{key:n,width:"flex",exposed:!0,style:Tx},()=>l.a.createElement(l.a.Fragment,null,e.schedule&&l.a.createElement(Wi,{style:Mx}),l.a.createElement(kx,{type:"payees",id:e.payee})));case"category":return l.a.createElement(kt.e,{key:n,width:"flex",title:i&&i.name},i?i.name:"");case"account":return l.a.createElement(kt.e,{key:n,width:"flex",title:c.name},c.name);case"notes":return l.a.createElement(kt.e,{key:n,width:"flex",title:e.notes},e.notes);case"amount":return l.a.createElement(kt.e,{key:n,width:75,style:[Rx,W.c.tnum]},Object(ke.k)(e.amount));default:return null}}))});var _x={textAlign:"right"};function Lx({transactions:e,schedules:t,renderEmpty:n,fields:r=["date","payee","amount"],style:a}){let i=Object(s.d)(e=>({payees:e.queries.payees,accounts:e.queries.accounts,categories:e.queries.categories.grouped,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"})),c=i.payees,u=i.categories,d=i.accounts,f=i.dateFormat,p=Object(At.e)(),m=Object(At.d)(),y=Object(o.useMemo)(()=>r,[JSON.stringify(r)]),g=Object(o.useMemo)(()=>e.map(e=>(function(e,t){let n=e.date;return Object(Pe.a)(Object(Hn.a)(n))||(n=null),Dx(Dx({},e),{},{date:n?Object(Sn.a)(Object(Hn.a)(n),t):null})})(e,f)),[e]),h=Object(o.useCallback)(({item:e})=>l.a.createElement(Bx,{transaction:e,payees:c,categories:u,accounts:d,fields:y,selected:p&&p.has(e.id)}),[c,u,y,p]);return l.a.createElement(kt.l,{style:a,items:g,renderEmpty:n,headers:l.a.createElement(l.a.Fragment,null,l.a.createElement(kt.i,{exposed:!0,focused:!1,selected:p.size>0,width:20,onSelect:()=>m({type:"select-all"})}),r.map((e,t)=>{switch(e){case"date":return l.a.createElement(kt.e,{key:t,width:100},"Date");case"imported_payee":return l.a.createElement(kt.e,{key:t,width:"flex"},"Imported payee");case"payee":return l.a.createElement(kt.e,{key:t,width:"flex"},"Payee");case"category":return l.a.createElement(kt.e,{key:t,width:"flex"},"Category");case"account":return l.a.createElement(kt.e,{key:t,width:"flex"},"Account");case"notes":return l.a.createElement(kt.e,{key:t,width:"flex"},"Notes");case"amount":return l.a.createElement(kt.e,{key:t,width:75,style:_x},"Amount");default:return null}})),renderItem:h})}function zx(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Fx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fx(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fx(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Nx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ux(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nx(Object(n),!0).forEach(function(t){$x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nx(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wx(e,t,n){return e.map(e=>e===t?n():e)}function Gx(e,t){return e.map((e,n)=>Ux(Ux({},e),{},{error:t[n]}))}function Hx(e,t){let n=["date"];return e.find(e=>"imported_payee"===e.field)&&n.push("imported_payee"),n.push("payee"),t.find(e=>"category"===e.field)?n.push("category"):t.length>0&&!["payee","date","amount"].includes(t[0].field)&&n.push(t[0].field),n.push("amount"),n}var qx={color:W.a.p4};function Yx({fields:e,style:t,value:n,onChange:r}){return l.a.createElement($.C,{style:t},l.a.createElement($.h,{options:e,value:n,onChange:e=>r("field",e),style:qx}))}function Vx({ops:e,type:t,style:n,value:r,formatOp:a=Bn,onChange:o}){return"id"===t&&(e=e.filter(e=>"contains"!==e)),l.a.createElement($.h,{options:e.map(e=>[e,a(e,t)]),value:r,onChange:e=>o("op",e),style:n})}var Kx={padding:7},Zx={width:8,height:8},Qx={padding:7},Jx={width:10,height:10};function Xx({onAdd:e,onDelete:t,style:n}){return l.a.createElement(l.a.Fragment,null,t&&l.a.createElement($.d,{bare:!0,onClick:t,style:Kx},l.a.createElement(rl,{style:Zx})),e&&l.a.createElement($.d,{bare:!0,onClick:e,style:Qx},l.a.createElement(Xo,{style:Jx})))}var eP={fontSize:12,textAlign:"center",color:W.a.r5,marginBottom:5};function tP({type:e}){return l.a.createElement($.z,{style:eP},_n(e))}var nP={padding:"3px 5px"};function rP({error:e,style:t,children:n}){return l.a.createElement($.C,{style:t},l.a.createElement($.y,{direction:"row",align:"center",spacing:1,style:nP},n),e&&l.a.createElement(tP,{type:e}))}var aP={flex:1};function oP({conditionFields:e,ops:t,condition:n,editorStyle:r,isSchedule:a,onChange:o,onDelete:i,onAdd:c}){let s,u=n.field,d=n.op,f=n.value,p=n.type,m=n.options,y=n.error;return"amount"===u&&m&&(m.inflow?u="amount-inflow":m.outflow&&(u="amount-outflow")),s="number"===p&&"isbetween"===d?l.a.createElement(Bv,{defaultValue:f,onChange:e=>o("value",e)}):l.a.createElement(Vl,{field:u,type:p,value:f,multi:"oneOf"===d,onChange:e=>o("value",e)}),l.a.createElement(rP,{style:r,error:y},l.a.createElement(Yx,{fields:e,value:u,onChange:o}),l.a.createElement(Vx,{ops:t,value:d,type:p,onChange:o}),l.a.createElement($.C,{style:aP},s),l.a.createElement($.y,{direction:"row"},l.a.createElement(Xx,{onAdd:c,onDelete:a&&"date"===u?null:i})))}var lP={flex:1},iP={flex:1,flexDirection:"row",alignItems:"center"},cP={marginRight:15,flexDirection:"row"},sP={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},uP={margin:"0 5px"},dP={flexShrink:0},fP={margin:"0 5px"},pP={flexShrink:0};function mP({id:e}){let t=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy"),n=Ee({transform:Object(o.useCallback)(t=>t.filter({id:e}),[])});if(null==n)return null;if(0===n.schedules.length)return l.a.createElement($.C,{style:lP},e);let r=zx(n.schedules,1)[0],a=r&&n.statuses.get(r.id);return l.a.createElement($.C,{style:iP},l.a.createElement($.C,{style:cP},l.a.createElement($.z,{style:sP},"Payee:"," ",l.a.createElement(kx,{type:"payees",id:r._payee,noneColor:W.a.n5})),l.a.createElement($.z,{style:uP}," \u2014 "),l.a.createElement($.z,{style:dP},"Amount: ",(i=r._amount)?"number"===typeof i?Object(ke.k)(i):`${Object(ke.k)(i.num1)} to ${Object(ke.k)(i.num2)}`:Object(ke.k)(0)),l.a.createElement($.z,{style:fP}," \u2014 "),l.a.createElement($.z,{style:pP},"Next: ",de.g(r.next_date,t))),l.a.createElement(vc,{status:a}));var i}let yP=["payee","notes","date","amount","category","account","cleared"].map(e=>[e,Rn(e)]);var gP={padding:"5px 10px",lineHeight:"1em"},hP={flex:1},bP={padding:"5px 10px",color:W.a.p4};function OP({ops:e,action:t,editorStyle:n,onChange:r,onDelete:a,onAdd:o}){let i=t.field,c=t.op,s=t.value,u=t.type,d=t.error,f=t.inputKey,p=void 0===f?"initial":f;return l.a.createElement(rP,{style:n,error:d},"set"===c?l.a.createElement(l.a.Fragment,null,l.a.createElement($.C,{style:gP},Bn(c)),l.a.createElement(Yx,{fields:yP,value:i,onChange:r}),l.a.createElement($.C,{style:hP},l.a.createElement(Vl,{key:p,field:i,type:u,op:c,value:s,onChange:e=>r("value",e)}))):"link-schedule"===c?l.a.createElement(l.a.Fragment,null,l.a.createElement($.C,{style:bP},Bn(c)),l.a.createElement(mP,{id:s||null})):null,l.a.createElement($.y,{direction:"row"},l.a.createElement(Xx,{onAdd:o,onDelete:"link-schedule"!==c&&a})))}var wP={position:"relative",marginLeft:5},vP={width:11,height:11,color:W.a.n4},EP={padding:10,color:W.a.n4,maxWidth:450,lineHeight:1.5};function jP(){let e=zx(Object(o.useState)(),2),t=e[0],n=e[1];return l.a.createElement($.C,{style:wP},l.a.createElement($.C,{onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1)},l.a.createElement(jC,{style:vP})),t&&l.a.createElement($.B,{position:"bottom-left",style:EP},"The stage of a rule allows you to force a specific order. Pre rules always run first, and post rules always run last. Within each stage rules are automatically ordered from least to most specific."))}var SP={fontSize:"inherit"},CP={backgroundColor:W.a.b9,":hover":{backgroundColor:W.a.b9}};function xP({selected:e,children:t,style:n,onSelect:r}){return l.a.createElement($.d,{bare:!0,style:[SP,e&&CP,n],onClick:r},t)}function PP(e){return Ux(Ux({},e),{},{inputKey:""+Math.random()})}var kP={alignSelf:"flex-start"};function AP({conditions:e,conditionFields:t,editorStyle:n,isSchedule:r,onChangeConditions:a}){function o(t){let n=[...e];n.splice(t+1,0,{type:Mn.get("payee"),field:"payee",op:"is",value:null}),a(n)}return 0===e.length?l.a.createElement($.d,{style:kP,onClick:function(){o(-1)}},"Add condition"):l.a.createElement($.y,{spacing:2},e.map((i,c)=>{let s=Tn[i.type].ops;return"date"===i.type&&i.value&&i.value.frequency?s=["is","isapprox"]:i.options&&(i.options.inflow||i.options.outflow)&&(s=s.filter(e=>"isbetween"!==e)),l.a.createElement($.C,{key:c},l.a.createElement(oP,{conditionFields:t,editorStyle:n,ops:s,condition:i,isSchedule:r,onChange:(t,n)=>{!function(t,n,r){a(Wx(e,t,()=>{if("field"===n){let e={field:r};"amount-inflow"===r?(e.field="amount",e.options={inflow:!0}):"amount-outflow"===r&&(e.field="amount",e.options={outflow:!0}),e.type=Mn.get(e.field);let n=Mn.get(t.field);return"string"!==n&&"number"!==n||n!==e.type||"isbetween"===t.op?(e.op=Tn[e.type].ops[0],PP(Fn(null,e))):(e.op=t.op,PP(Fn(t.value,e)))}if("op"===n){let e=r;return"oneOf"!==t.op&&"oneOf"===e?PP(Fn(null!=t.value?[t.value]:[],Ux(Ux({},t),{},{op:r}))):"oneOf"===t.op&&"oneOf"!==e?PP(Fn(t.value.length>0?t.value[0]:null,Ux(Ux({},t),{},{op:r}))):"isbetween"!==t.op&&"isbetween"===e?Fn({num1:Object(ke.b)(t.value),num2:Object(ke.b)(t.value)},Ux(Ux({},t),{},{op:r})):"isbetween"===t.op&&"isbetween"!==e?Fn(Object(ke.j)(t.value.num1||0),Ux(Ux({},t),{},{op:r})):Ux(Ux({},t),{},{op:r})}return"value"===n?Fn(r,t):t}))}(i,t,n)},onDelete:()=>(function(t){a(e.filter(e=>e!==t))})(i),onAdd:()=>o(c)}))}))}let DP=["account","imported_payee","payee","category","date","notes","amount"].map(e=>[e,Rn(e)]).concat([["amount-inflow",Rn("amount",{inflow:!0})],["amount-outflow",Rn("amount",{outflow:!0})]]);var IP={flex:"inherit",maxWidth:"90%"},TP={maxWidth:"100%",width:900,height:"80vh",flexGrow:0,flexShrink:0,flexBasis:"auto",overflow:"hidden"},MP={flexDirection:"row",alignItems:"center",marginBottom:15,padding:"0 20px"},RP={color:W.a.n4,marginRight:15},BP={borderBottom:"1px solid "+W.a.border,padding:20,overflow:"auto",maxHeight:"calc(100% - 300px)"},_P={flexShrink:0},LP={marginBottom:30},zP={color:W.a.n4,marginBottom:15},FP={color:W.a.n4,marginBottom:15},NP={flex:1},UP={alignSelf:"flex-start"},$P={padding:"20px",flex:1},WP={flexDirection:"row",alignItems:"center",marginBottom:12},GP={color:W.a.n4,marginBottom:0},HP={flex:1},qP={border:"1px solid "+W.a.border},YP={marginTop:20};function VP({history:e,modalProps:t,defaultRule:n,onSave:r}){let a=zx(Object(o.useState)(n.conditions.map(Ln)),2),i=a[0],c=a[1],u=zx(Object(o.useState)(n.actions.map(Ln)),2),d=u[0],f=u[1],p=zx(Object(o.useState)(n.stage),2),m=p[0],y=p[1],h=zx(Object(o.useState)([]),2),b=h[0],O=h[1],w=Object(s.c)(),v=Object(o.useRef)(),E=d.some(e=>"link-schedule"===e.op);Object(o.useEffect)(()=>(w(Object(Yn.m)()),Object(Yn.s)(!1),()=>Object(Yn.s)(!0)),[]),Object(o.useEffect)(()=>{if(v.current){let e=v.current,t=e.scrollTop;e.scrollTop=t+1,e.scrollTop=t}!async function(){let e=(await Object(M.send)("make-filters-from-conditions",{conditions:i.map(zn)})).filters;if(e.length>0){let t=(await Object(g.f)(Object(g.c)("transactions").filter({$and:e}).select("*"))).data;O(t)}else O([])}()},[d,i]);let j=Object(At.c)("transactions",b,[]);function S(){C(-1)}function C(e){let t=[...d];t.splice(e+1,0,{type:Mn.get("category"),field:"category",op:"set",value:null}),f(t)}function x(e){y(e)}function P(){Object(M.send)("rule-apply-actions",{transactionIds:[...j.items],actions:d}).then(()=>{f([...d])})}let k={backgroundColor:W.a.n10,borderRadius:4};return l.a.createElement($.t,Object.assign({title:"Rule",padding:0},t,{style:[t.style,IP]}),()=>l.a.createElement($.C,{style:TP},l.a.createElement($.C,{style:MP},l.a.createElement($.z,{style:RP},"Stage of rule:"),l.a.createElement($.y,{direction:"row",align:"center",spacing:1},l.a.createElement(xP,{selected:"pre"===m,onSelect:()=>x("pre")},"Pre"),l.a.createElement(xP,{selected:null===m,onSelect:()=>x(null)},"Default"),l.a.createElement(xP,{selected:"post"===m,onSelect:()=>x("post")},"Post"),l.a.createElement(jP,null))),l.a.createElement($.C,{innerRef:v,style:BP},l.a.createElement($.C,{style:_P},l.a.createElement($.C,{style:LP},l.a.createElement($.z,{style:zP},"If all these conditions match:"),l.a.createElement(AP,{conditions:i,conditionFields:DP,editorStyle:k,isSchedule:E,onChangeConditions:e=>c(e)})),l.a.createElement($.z,{style:FP},"Then apply these actions:"),l.a.createElement($.C,{style:NP},0===d.length?l.a.createElement($.d,{style:UP,onClick:S},"Add action"):l.a.createElement($.y,{spacing:2},d.map((e,t)=>l.a.createElement($.C,{key:t},l.a.createElement(OP,{ops:["set","link-schedule"],action:e,editorStyle:k,onChange:(t,n)=>{!function(e,t,n){f(Wx(d,e,()=>{let r=Ux({},e);return r[t]=n,"field"===t?(r.type=Mn.get(r.field),r.value=null,PP(r)):"op"===t?(r.value=null,r.inputKey=""+Math.random(),PP(r)):r}))}(e,t,n)},onDelete:()=>(function(e){f(d.filter(t=>t!==e))})(e),onAdd:()=>C(t)}))))))),l.a.createElement(At.a,{instance:j},l.a.createElement($.C,{style:$P},l.a.createElement($.C,{style:WP},l.a.createElement($.z,{style:GP},"This rule applies to these transactions:"),l.a.createElement($.C,{style:HP}),l.a.createElement($.d,{disabled:0===j.items.size,onClick:P},"Apply actions (",j.items.size,")")),l.a.createElement(Lx,{transactions:b,fields:Hx(i,d),style:qP}),l.a.createElement($.y,{direction:"row",justify:"flex-end",style:YP},l.a.createElement($.d,{onClick:()=>t.onClose()},"Cancel"),l.a.createElement($.d,{primary:!0,onClick:()=>(async function(){let e=Ux(Ux({},n),{},{stage:m,conditions:i.map(zn),actions:d.map(zn)}),a=e.id?"rule-update":"rule-add",o=await Object(M.send)(a,e),l=o.error,s=o.id;l?(l.conditionErrors&&c(Gx(i,l.conditionErrors)),l.actionErrors&&f(Gx(d,l.actionErrors))):(s&&(e.id=s),r&&r(e),t.onClose())})()},"Save"))))))}var KP=n(244),ZP=n(132);function QP(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return JP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return JP(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function JP(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var XP={flex:1,maxWidth:"90%",maxHeight:"90%"};function ek({modalProps:e,payeeId:t}){let n=QP(Object(o.useState)(!0),2),r=n[0],a=n[1];if((Object(ZP.a)()||Object(ZP.b)())&&"/payees"!==location.pathname)throw new Error(`Possibly invalid use of ManageRulesModal, add the current url '${location.pathname}' to the allowlist if you're confident the modal can never appear on top of the '/rules' page.`);return l.a.createElement($.t,Object.assign({title:"Rules",padding:0,loading:r},e,{style:[e.style,XP]}),()=>l.a.createElement(Zr,{isModal:!0,payeeId:t,setLoading:a}))}function tk(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return nk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nk(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nk(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let rk={color:W.a.p5};var ak={padding:20,maxWidth:500},ok={marginBottom:10,fontWeight:500},lk={margin:0,marginTop:10,maxHeight:140,overflow:"auto"},ik={fontSize:13,marginTop:10,color:W.a.n4,userSelect:"none",display:"flex",alignItems:"center",justifyContent:"center"},ck={marginLeft:3},sk={marginTop:20},uk={marginRight:10},dk={marginRight:10},fk={marginRight:10};function pk({history:e,modalProps:t,payeeIds:n,targetPayeeId:r}){let a=Object(s.d)(e=>({payees:e.queries.payees,modalStack:e.modals.modalStack})),i=a.payees,c=!!a.modalStack.find(e=>"edit-rule"===e.name),u=Object(s.c)(),d=tk(Object(o.useState)(!0),2),f=d[0],p=d[1],m=Object(o.useRef)(null);Object(o.useEffect)(()=>{if(m.current){let e=m.current,t=e.scrollTop;e.scrollTop=t+1,e.scrollTop=t}},[m.current,!0]);let y=tk(Object(o.useState)(()=>n.map(e=>i.find(t=>t.id===e))),1)[0],g=i.find(e=>e.id===r);if(!g)return null;async function h(){let e;if(await Object(M.send)("payees-merge",{targetId:g.id,mergeIds:y.map(e=>e.id)}),f&&!c){e=await Object(M.send)("rule-add-payee-rename",{fromNames:y.map(e=>e.name),to:g.id})}return t.onClose(),e}async function b(){let e=await h();if(e){let t=await Object(M.send)("rule-get",{id:e});u(Object(qn.e)("edit-rule",{rule:t}))}}return l.a.createElement($.t,Object.assign({title:"Merge payee?",padding:0,showHeader:!1},t,{style:t.style}),()=>l.a.createElement($.C,{style:ak},l.a.createElement($.C,null,l.a.createElement($.v,{style:ok},1===y.length?l.a.createElement(l.a.Fragment,null,"The payee ",l.a.createElement($.z,{style:rk},y[0].name)," ","is not used by transactions any more. Would like to merge it with ",l.a.createElement($.z,{style:rk},g.name),"?"):l.a.createElement(l.a.Fragment,null,"The following payees are not used by transactions any more. Would like to merge them with"," ",l.a.createElement($.z,{style:rk},g.name),"?",l.a.createElement("ul",{ref:m,style:lk},y.map(e=>l.a.createElement("li",null,l.a.createElement($.z,{style:rk},e.name)))))),l.a.createElement(IC,null,"Merging will remove the payee and transfer any existing rules to the new payee. If checked below, a rule will be created to do this rename while importing transactions."),!c&&l.a.createElement("label",{style:ik},l.a.createElement("input",{type:"checkbox",checked:f,onChange:e=>p(e.target.checked)}),l.a.createElement($.z,{style:ck},"Automatically rename"," ",1===y.length?"this payee":"these payees"," in the future")),l.a.createElement($.u,{style:sk,focusButton:!0},l.a.createElement($.d,{primary:!0,style:uk,onClick:h,type:"button"},"Merge"),!c&&l.a.createElement($.d,{style:dk,onClick:b,type:"button"},"Merge and edit rule"),l.a.createElement($.d,{style:fk,onClick:()=>t.onBack(),type:"button"},"Do nothing")))))}var mk={maxWidth:500,fontSize:15},yk={color:W.a.p5,fontWeight:600,"& a, & a:visited":{color:W.a.p5}};var gk=Object(s.b)(null,y)(function({modalProps:e,actions:t}){return l.a.createElement($.t,Object.assign({title:"Welcome to Actual"},e),()=>l.a.createElement($.C,{style:mk},l.a.createElement($.v,null,"Actual is a personal finance tool that focuses on beautiful design and a slick user experience."," ",l.a.createElement("strong",null,"Editing your data should be as fast as possible.")," On top of that, we want to provide powerful tools to allow you to do whatever you want with your data."),l.a.createElement($.v,null,"Currently Actual implements budgeting based on a"," ",l.a.createElement($.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Budgeting/howitworks"},"monthly envelope system"),"."),l.a.createElement($.v,null,"In the future, we","'","ll support multiple ways to do budgeting. We","'","re also working hard on custom reports and a lot more things."),l.a.createElement($.v,{style:yk},"Read the"," ",l.a.createElement($.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/"},"documentation")," ","to get started and learn about"," ",l.a.createElement($.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Budgeting/howitworks"},"budgeting"),","," ",l.a.createElement($.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Accounts/overview"},"accounts")," ","and more.")))});var hk=Object(s.b)(e=>({modalStack:e.modals.modalStack,isHidden:e.modals.isHidden,accounts:e.queries.accounts,categoryGroups:e.queries.categories.grouped,categories:e.queries.categories.list,payees:e.queries.payees,budgetId:e.prefs.local&&e.prefs.local.id}),e=>({actions:Object(ue.b)(y,e)}))(function({history:e,modalStack:t,isHidden:n,accounts:r,categoryGroups:a,categories:o,payees:i,budgetId:c,actions:s}){return t.map(({name:i,options:d={}},f)=>{const m={onClose:s.popModal,onBack:s.popModal,showBack:f>0,isCurrent:f===t.length-1,isHidden:n,stackIndex:f};let y=Object(p.c)("/"+i);return l.a.createElement(u.d,{key:i,location:y},l.a.createElement(u.b,{path:"/import-transactions"},l.a.createElement(bC,{modalProps:m,options:d})),l.a.createElement(u.b,{path:"/add-account"},l.a.createElement(xx,{modalProps:m,actions:s})),l.a.createElement(u.b,{path:"/add-local-account"},l.a.createElement(iS,{modalProps:m,actions:s,history:e})),l.a.createElement(u.b,{path:"/close-account"},l.a.createElement(Aj,{modalProps:m,account:d.account,balance:d.balance,canDelete:d.canDelete,accounts:r.filter(e=>0===e.closed),categoryGroups:a,actions:s})),l.a.createElement(u.b,{path:"/select-linked-accounts"},l.a.createElement(dx,{modalProps:m,institution:d.institution,publicToken:d.publicToken,accounts:d.accounts,upgradingId:d.upgradingId,actions:s})),l.a.createElement(u.b,{path:"/configure-linked-accounts"},l.a.createElement(Jj,{modalProps:m,institution:d.institution,publicToken:d.publicToken,accounts:d.accounts,upgradingId:d.upgradingId,actions:s})),l.a.createElement(u.b,{path:"/confirm-category-delete",render:()=>{const e=d.category,t=d.group,n=d.onDelete;return l.a.createElement(wx,{modalProps:m,actions:s,category:o.find(t=>t.id===e),group:a.find(e=>e.id===t),categoryGroups:a,onDelete:n})}}),l.a.createElement(u.b,{path:"/load-backup",render:()=>l.a.createElement(oh.a,{initialState:{backups:[]},didMount:async({setState:e})=>{e({backups:await Object(M.send)("backups-get",{id:c})}),Object(M.listen)("backups-updated",t=>{e({backups:t})})},willUnmount:()=>{Object(M.unlisten)("backups-updated")}},({state:e})=>l.a.createElement(OC.a,{budgetId:c,modalProps:m,actions:s,backups:e.backups}))}),l.a.createElement(u.b,{path:"/manage-rules",render:()=>l.a.createElement(ek,{history:e,modalProps:m,payeeId:d.payeeId})}),l.a.createElement(u.b,{path:"/edit-rule",render:()=>l.a.createElement(VP,{history:e,modalProps:m,defaultRule:d.rule,onSave:d.onSave})}),l.a.createElement(u.b,{path:"/merge-unused-payees",render:()=>l.a.createElement(pk,{history:e,modalProps:m,payeeIds:d.payeeIds,targetPayeeId:d.targetPayeeId})}),l.a.createElement(u.b,{path:"/plaid-external-msg",render:()=>l.a.createElement(qC,{modalProps:m,actions:s,onMoveExternal:d.onMoveExternal,onClose:()=>{d.onClose&&d.onClose(),Object(M.send)("poll-web-token-stop")},onSuccess:d.onSuccess})}),l.a.createElement(u.b,{path:"/create-encryption-key",render:()=>l.a.createElement(Px.a,{key:i,modalProps:m,actions:s,options:d})}),l.a.createElement(u.b,{path:"/fix-encryption-key",render:()=>l.a.createElement(KP.a,{key:i,modalProps:m,actions:s,options:d})}),l.a.createElement(u.b,{path:"/edit-field",render:()=>l.a.createElement(dS,{key:i,modalProps:m,actions:s,name:d.name,onSubmit:d.onSubmit})}),l.a.createElement(u.b,{path:"/welcome-screen"},l.a.createElement(gk,{modalProps:m,actions:s})),l.a.createElement(u.b,{path:"/budget-summary"},l.a.createElement(dj,{key:i,modalProps:m,month:d.month,actions:s})))})}),bk=n(245);function Ok(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wk(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ok(Object(n),!0).forEach(function(t){vk(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ok(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vk(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ek=e=>o.createElement("svg",Object.assign({},e,{fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",style:wk({color:"#242134"},e.style)}),o.createElement("path",{d:"M24 29h5.333M8 29H2.667M16 21l-8 8M16 21l8 8M16 2.667v18.666M16 2.667 8 9.333M16 2.667l8 6.666",fill:"none",stroke:"currentColor",strokeWidth:3.5,strokeMiterlimit:10,strokeLinecap:"round"}));const jk=["modalProps","payees","ruleCounts","categoryGroups","tableNavigatorOpts","initialSelectedIds","ruleActions","onBatchChange","onViewRules","onCreateRule"];function Sk(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ck(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return xk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xk(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xk(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let Pk=Object(Xu.a)(e=>Object(ke.i)(e));function kk(e,t,n){return 1===e?t:n}var Ak={padding:"0 10px"},Dk={borderRadius:4,padding:"3px 6px",backgroundColor:W.a.g9,border:"1px solid "+W.a.g9,color:W.a.g1,fontSize:12},Ik={paddingRight:5},Tk={width:8,height:8,color:W.a.g1};function Mk({ruleCount:e,focused:t,onEdit:n,onClick:r}){return l.a.createElement(kt.a,{name:"rule-count",width:"auto",focused:t,style:Ak,plain:!0},l.a.createElement(kt.b,{style:Dk,onEdit:n,onSelect:r,onFocus:n},l.a.createElement($.z,{style:Ik},e>0?l.a.createElement(l.a.Fragment,null,e," associated ",kk(e,"rule","rules")):l.a.createElement(l.a.Fragment,null,"Create rule")),l.a.createElement(jp,{style:Tk})))}var Rk={alignItems:"stretch"},Bk={backgroundColor:W.a.b9,zIndex:100},_k={color:W.a.n7};let Lk=l.a.memo(({style:e,payee:t,ruleCount:n,categoryGroups:r,selected:a,highlighted:o,hovered:i,editing:c,focusedField:s,onViewRules:u,onCreateRule:d,onHover:f,onEdit:p,onUpdate:m,ruleActions:y})=>{let g=t.id,h=Object(At.d)(),b=a?W.a.b8:W.a.border,O=i||"select"===s;return l.a.createElement(kt.h,{borderColor:b,backgroundColor:a?W.a.b9:O?W.a.hover:"white",highlighted:o,style:[Rk,e,{backgroundColor:i?W.a.hover:null},a&&Bk],"data-focus-key":t.id,onMouseEnter:()=>f&&f(t.id)},l.a.createElement(kt.i,{exposed:null==t.transfer_acct&&(i||a||c),focused:"select"===s,selected:a,onSelect:()=>{h({type:"select",id:t.id})}}),l.a.createElement(kt.f,{value:(t.transfer_acct?"Transfer: ":"")+t.name,valueStyle:!a&&t.transfer_acct&&_k,exposed:"name"===s,width:"flex",onUpdate:e=>!t.transfer_acct&&m(g,"name",e),onExpose:()=>p(g,"name"),inputProps:{readOnly:!!t.transfer_acct}}),l.a.createElement(Mk,{ruleCount:n,focused:"rule-count"===s,onEdit:()=>p(g,"rule-count"),onClick:()=>n>0?u(t.id):d(t.id)}))});var zk={flex:1};const Fk=l.a.forwardRef(({payees:e,ruleCounts:t,navigator:n,categoryGroups:r,highlightedRows:a,ruleActions:i,onUpdate:c,onViewRules:s,onCreateRule:u},d)=>{let f=Ck(Object(o.useState)(null),2),p=f[0],m=f[1],y=Object(At.e)();Object(o.useLayoutEffect)(()=>{let e=[...y][0];d.current.scrollTo(e,"center"),n.onEdit(e,"select")},[]);let g=Object(o.useCallback)(e=>{m(e)},[]);return l.a.createElement($.C,{style:[zk],onMouseLeave:()=>m(null)},l.a.createElement(kt.l,{ref:d,items:e,navigator:n,renderItem:({item:e,editing:n,focusedField:o,onEdit:i})=>l.a.createElement(Lk,{payee:e,ruleCount:t.get(e.id)||0,categoryGroups:r,selected:y.has(e.id),highlighted:a&&a.has(e.id),editing:n,focusedField:o,hovered:p===e.id,onHover:g,onEdit:i,onUpdate:c,onViewRules:s,onCreateRule:u})}))});var Nk={backgroundColor:"white",color:W.a.n4,zIndex:200,userSelect:"none"};function Uk(){let e=W.a.border,t=Object(At.d)(),n=Object(At.e)();return l.a.createElement($.C,null,l.a.createElement(kt.m,{borderColor:e,style:Nk,collapsed:!0,version:"v2"},l.a.createElement(kt.i,{exposed:!0,focused:!1,selected:n.size>0,onSelect:()=>t({type:"select-all"})}),l.a.createElement(kt.a,{value:"Name",width:"flex"})))}var $k={textAlign:"center",color:W.a.n7,fontStyle:"italic",fontSize:13,marginTop:5};function Wk({text:e,style:t}){return l.a.createElement($.C,{style:[$k,t]},e)}var Gk={padding:0},Hk={padding:3,fontSize:11,fontStyle:"italic",color:W.a.n7};function qk({payeesById:e,selectedPayees:t,onDelete:n,onMerge:r,onClose:a}){let o=[...t].some(t=>null==e[t]||e[t].transfer_acct);return l.a.createElement($.B,{position:"bottom",width:250,style:Gk,onClose:a},l.a.createElement($.s,{onMenuSelect:e=>{switch(a(),e){case"delete":n();break;case"merge":r()}},footer:l.a.createElement($.C,{style:Hk},[...t].slice(0,4).map(t=>e[t].name).join(", ")+(t.size>4?", and more":"")),items:[{icon:Nn.a,name:"delete",text:"Delete",disabled:o},{icon:Ek,iconSize:9,name:"merge",text:"Merge",disabled:o||t.size<2},$.s.line]}))}var Yk={height:"100%"},Vk={flexDirection:"row",alignItems:"center",padding:"0 10px 5px"},Kk={marginRight:10},Zk={marginLeft:5},Qk={flex:1},Jk={width:350,borderColor:"transparent",backgroundColor:W.a.n11,":focus":{backgroundColor:"white","::placeholder":{color:W.a.n8}}},Xk={flex:1,border:"1px solid "+W.a.border,borderRadius:4,overflow:"hidden"},eA={marginTop:15};const tA=l.a.forwardRef((e,t)=>{e.modalProps;let n=e.payees,r=e.ruleCounts,a=e.categoryGroups,i=e.tableNavigatorOpts,c=e.initialSelectedIds,s=(e.ruleActions,e.onBatchChange),u=e.onViewRules,d=e.onCreateRule,f=Sk(e,jk),p=Ck(Object(o.useState)(null),2),m=p[0],y=p[1],g=Ck(Object(o.useState)(""),2),h=g[0],b=g[1],O=Object(o.useRef)(null),w=Object(o.useRef)(null),v=Object(o.useRef)(!1),E=Object(o.useMemo)(()=>""===h?n:n.filter(e=>e.name.toLowerCase().includes(h.toLowerCase())),[n,h]),j=Object(At.c)("payees",E,c);function S(e){h!==e&&(O.current&&O.current.setRowAnimation(!1),b(e),v.current=!0)}function C(e){S(""),w.current=e}Object(o.useEffect)(()=>{v.current&&(setTimeout(()=>{O.current&&O.current.setRowAnimation(!0)},0),v.current=!1)}),Object(o.useImperativeHandle)(t,()=>({selectRows:(e,t)=>{I.onEdit(null),j.dispatch({type:"select-all",ids:e}),y(null),t&&e.length>0&&C(e[0])},highlightRow:e=>{I.onEdit(null),y(new Set([e])),C(e)}})),Object(o.useEffect)(()=>{m&&y(null)},[m]),Object(o.useLayoutEffect)(()=>{w.current&&(O.current.scrollTo(w.current),w.current=null)});let x=Object($.D)((e,t,r)=>{n.find(t=>t.id===e)[t]!==r&&s({updated:[{id:e,[t]:r}]})}),P=Object(o.useCallback)(()=>E.filter(e=>null==e.transfer_acct).map(e=>e.id),[E]);function k(){s({deleted:[...j.items].map(e=>({id:e}))}),j.dispatch({type:"select-none"})}async function A(){let e=[...j.items];await f.onMerge(e),I.onEdit(e[0],"name"),j.dispatch({type:"select-none"}),C(e[0])}let D=0===j.items.size,I=Object(kt.o)(E,e=>["select","name","rule-count"].filter(t=>{switch(t){case"select":return null==e.transfer_acct;default:return!0}}),i),T=Pk(n);return l.a.createElement($.C,{style:Yk},l.a.createElement($.C,{style:Vk},l.a.createElement(oh.a,{initialState:{menuOpen:!1}},({state:e,setState:t})=>l.a.createElement($.C,null,l.a.createElement($.d,{bare:!0,style:Kk,disabled:D,onClick:()=>t({menuOpen:!0})},D?"No payees selected":j.items.size+" "+kk(j.items.size,"payee","payees"),l.a.createElement(yp.a,{width:8,height:8,style:Zk})),e.menuOpen&&l.a.createElement(qk,{payeesById:T,selectedPayees:j.items,onClose:()=>t({menuOpen:!1}),onDelete:k,onMerge:A}))),l.a.createElement($.C,{style:Qk}),l.a.createElement($.n,{placeholder:"Filter payees...",value:h,onChange:e=>{S(e.target.value),I.onEdit(null)},style:Jk})),l.a.createElement(At.a,{instance:j,fetchAllIds:P},l.a.createElement($.C,{style:Xk},l.a.createElement(Uk,null),0===E.length?l.a.createElement(Wk,{text:"No payees",style:eA}):l.a.createElement(Fk,{ref:O,payees:E,ruleCounts:r,categoryGroups:a,highlightedRows:m,navigator:I,onUpdate:x,onViewRules:u,onCreateRule:d}))))});function nA(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return rA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return rA(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rA(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var aA=Object(s.b)(e=>({initialPayees:e.queries.payees,lastUndoState:e.app.lastUndoState,categoryGroups:e.queries.categories.grouped}),y)(function({modalProps:e,initialSelectedIds:t,lastUndoState:n,initialPayees:r,categoryGroups:a,initiallyLoadPayees:i,getPayees:c,setLastUndoState:s,pushModal:u}){let d=nA(Object(o.useState)(r),2),f=d[0],p=d[1],m=nA(Object(o.useState)({value:new Map}),2),y=m[0],g=m[1],h=Object(o.useRef)();async function b(){let e=await Object(M.send)("payees-get-rule-counts");e=new Map(Object.entries(e)),g({value:e})}async function O({tables:e,messages:t,meta:n,url:r},a=!1){(e.includes("payees")||e.includes("payee_mapping")||e.includes("payee_rules"))&&(p(await c()),(n&&n.targetId||t.find(e=>"rules"===e.dataset))&&b(),s(null))}return Object(o.useEffect)(()=>{!async function(){let e=await i();await new Promise(e=>setTimeout(e,100)),e&&p(e),b()}();let e=Object(M.listen)("sync-event",async({type:e,tables:t})=>{"applied"===e&&t.includes("rules")&&b()});return()=>{e()}},[]),Object(o.useEffect)(()=>(n.current&&O(n.current,!0),Object(M.listen)("undo-event",O)),[]),l.a.createElement(tA,{ref:h,modalProps:e,payees:f,ruleCounts:y.value,categoryGroups:a,initialSelectedIds:t,lastUndoState:n,onBatchChange:e=>{Object(M.send)("payees-batch-change",e),p(Object(ke.c)(e,f))},onMerge:async([e,...t])=>{await Object(M.send)("payees-merge",{targetId:e,mergeIds:t});let n=f.filter(e=>!t.includes(e.id));t.forEach(t=>{let n=y.value.get(t)||0;y.value.set(e,(y.value.get(e)||0)+n)}),p(n),g({value:y.value})},onViewRules:function(e){u("manage-rules",{payeeId:e})},onCreateRule:function(e){u("edit-rule",{rule:{stage:null,conditions:[{field:"payee",op:"is",value:e,type:"id"}],actions:[{op:"set",field:"category",value:null,type:"id"}]}})}})});function oA(){let e=Object(u.h)();return l.a.createElement(rj,{title:"Payees"},l.a.createElement(aA,{initialSelectedIds:e.state&&e.state.selectedPayee?[e.state.selectedPayee]:null}))}var lA=n(849);var iA=function({amount:e}){return l.a.createElement($.c,{style:[W.c.smallText,{color:e<0?W.a.r5:W.a.g5}]},e>=0?"+":"",Object(ke.k)(e))};function cA(e){return(...t)=>Object(o.useMemo)(()=>e(...t),t)}function sA(e){return e.slice(0,7)}function uA(e){return e}async function dA(e,t){t(await Promise.all(e.map(e=>Object(g.f)(e).then(({data:e})=>e))))}function fA(e,t,n){const r={};return e.forEach(e=>{r[n?n(e[t]):e[t]]=e}),r}function pA(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return mA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mA(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mA(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yA(e,t){return async(n,r)=>{function a(){return Object(g.c)("transactions").filter({$and:[{date:{$gte:e}},{date:{$lte:t}}],"account.offbudget":!1,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]}).calculate({$sum:"$amount"})}return dA([a().filter({amount:{$gt:0}}),a().filter({amount:{$lt:0}})],e=>{r({graphData:{income:e[0],expense:e[1]}})})}}function gA(e,t,n){return async(r,a)=>{function o(r){let a=Object(g.c)("transactions").filter({$and:[{date:{$transform:"$month",$gte:e}},{date:{$transform:"$month",$lte:t}}],"account.offbudget":!1,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]});return n?a.groupBy({$month:"$date"}).select([{date:{$month:"$date"}},{amount:{$sum:"$amount"}}]):a.groupBy("date").select(["date",{amount:{$sum:"$amount"}}])}return dA([Object(g.c)("transactions").filter({date:{$transform:"$month",$lt:e},"account.offbudget":!1}).calculate({$sum:"$amount"}),o().filter({amount:{$gt:0}}),o().filter({amount:{$lt:0}})],r=>{a(function(e,t,n,r){let a=pA(e,3),o=a[0],i=a[1],c=a[2];const s=r?de.v(de.j(t),de.j(n)):de.f(t,n),u=fA(i,"date",r?sA:uA),d=fA(c,"date",r?sA:uA);let f=o,p=0,m=0;const y=s.reduce((e,t)=>{let n=0,a=0;u[t]&&(n=u[t].amount),d[t]&&(a=d[t].amount),p+=a,m+=n,f+=n+a;const o=Hn.a(t),i=l.a.createElement("div",null,l.a.createElement("div",{style:hA},l.a.createElement("strong",null,Sn.a(o,r?"MMMM yyyy":"MMMM d, yyyy"))),l.a.createElement("div",{style:bA},l.a.createElement($.a,{left:"Income:",right:Object(ke.k)(n)}),l.a.createElement($.a,{left:"Expenses:",right:Object(ke.k)(a)}),l.a.createElement($.a,{left:"Change:",right:l.a.createElement("strong",null,Object(ke.k)(n+a))}),l.a.createElement($.a,{left:"Balance:",right:Object(ke.k)(f)})));return e.income.push({x:o,y:Object(ke.j)(n)}),e.expenses.push({x:o,y:Object(ke.j)(a)}),e.balances.push({x:o,y:Object(ke.j)(f),premadeLabel:i,amount:f}),e},{expenses:[],income:[],balances:[]}),g=y.balances;return{graphData:y,balance:g[g.length-1].amount,totalExpenses:p,totalIncome:m,totalChange:g[g.length-1].amount-g[0].amount}}(r,e,t,n))})}}var hA={marginBottom:10},bA={lineHeight:1.5};var OA=n(840),wA=n(853),vA=n(854),EA=n(841),jA=n(847),SA=n(852);function CA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CA(Object(n),!0).forEach(function(t){PA(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function PA(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const kA={fontFamily:'"Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif',fontSize:13,letterSpacing:"normal",fill:W.a.n1,stroke:"transparent"},AA={axis:{fill:"transparent",stroke:"none"},grid:{fill:"none",stroke:"none",pointerEvents:"none"},ticks:{fill:"transparent",size:1,stroke:"none"},axisLabel:kA,tickLabels:kA};var DA={colors:xA(xA({},{blueFadeStart:"rgba(229, 245, 255, 1)",blueFadeEnd:"rgba(229, 245, 255, 0)",redFadeStart:"rgba(255, 243, 242, 1)",redFadeEnd:"rgba(255, 243, 242, 0)"}),{},{red:W.a.r7,blue:W.a.b6}),area:{style:{labels:kA,data:{stroke:W.a.b6,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}}},axis:{style:AA},dependentAxis:{style:xA(xA({},AA),{},{grid:xA(xA({},AA.grid),{},{stroke:"rgba(0,0,0,.2)",strokeDasharray:"1,1"}),tickLabels:xA(xA({},kA),{},{padding:5})})},independentAxis:{style:xA(xA({},AA),{},{axis:xA(xA({},AA.axis),{},{stroke:"rgba(0,0,0,.2)"}),tickLabels:xA(xA({},kA),{},{padding:10})})},bar:{style:{labels:kA,data:{fill:W.a.b6,stroke:"none"}}},line:{style:{labels:kA,data:{fill:"none",stroke:W.a.b6,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}}},voronoi:{style:{labels:kA}},chart:{padding:{top:20,left:65,right:20,bottom:50}}},IA={height:300,position:"relative",flexShrink:0};var TA=class extends l.a.Component{render(){const e=this.props,t=e.style,n=e.children;return l.a.createElement($.C,{style:[IA,t]},l.a.createElement("div",{ref:e=>this.portalHost=e}),l.a.createElement(cp.a,null,({width:e,height:t})=>l.a.createElement("div",{style:{width:e,height:t}},n(e,t,this.portalHost))))}},MA=n(87),RA=n.n(MA),BA=n(850);class _A extends l.a.Component{render(){let e=this.props,t=e.active,n=e.x,r=e.y,a=e.scale,o=e.datum,i=e.portalHost,c=e.offsetX,s=void 0===c?0:c,u=e.offsetY,d=e.position,f=e.light,p=e.forceActive,m=e.style;const y=n-a.x.range()[0];return d||(d=o.labelPosition?o.labelPosition:y<150?"right":"left"),i&&(t||p)?(r=u?u(r):r,RA.a.createPortal(l.a.createElement("div",Object(lt.css)({position:"absolute",top:0,left:s,transform:"right"===d?`translate(calc(${n}px + 15px), calc(${r}px ${f?"":"- 50%"}))`:`translate(calc(${n}px - 100% - 15px), calc(${r}px ${f?"":"- 50%"}))`,zIndex:1e3,pointerEvents:"none",borderRadius:2,boxShadow:f?"none":"0 1px 6px rgba(0, 0, 0, .20)",backgroundColor:f?"transparent":W.a.n1,color:f?"inherit":"white",padding:10},!f&&Object(lt.before)({position:"absolute",display:"inline-block",borderTop:"7px solid transparent",borderBottom:"7px solid transparent",["right"===d?"borderRight":"borderLeft"]:"7px solid "+W.a.n1,["right"===d?"left":"right"]:-6,top:"calc(50% - 7px)",content:'" "'}),m),o.premadeLabel),i)):null}}_A.defaultEvents=BA.a.defaultEvents;var LA=_A,zA={data:{fill:DA.colors.red}},FA={data:{stroke:W.a.n5}};var NA=function({style:e,start:t,end:n,graphData:r,isConcise:a,compact:o}){return l.a.createElement(TA,null,(e,t,n)=>r&&l.a.createElement(OA.a,{scale:{x:"time",y:"linear"},theme:DA,domainPadding:10,width:e,height:t,containerComponent:l.a.createElement(wA.a,{voronoiDimension:"x"})},l.a.createElement(vA.a,null,l.a.createElement(EA.a,{data:r.expenses,style:zA}),l.a.createElement(EA.a,{data:r.income})),l.a.createElement(jA.a,{data:r.balances,labelComponent:l.a.createElement(LA,{portalHost:n}),labels:e=>e.premadeLabel,style:FA}),l.a.createElement(SA.a,{tickFormat:e=>Sn.a(e,a?"MMM ''yy":"MMM d"),tickValues:r.balances.map(e=>e.x),tickCount:Math.min(5,r.balances.length),offsetY:50}),l.a.createElement(SA.a,{dependentAxis:!0,crossAxis:!1})))};function UA(e,t,n){const r=de.d();return n>r&&(n=r),t<e&&(t=e),[t,n]}function $A(e){const t=de.d();return[de.y(t,e),t]}var WA={padding:20,paddingTop:0,flexShrink:0},GA={marginBottom:"15",alignSelf:"flex-start"},HA={marginRight:5},qA={flexDirection:"row",alignItems:"center",marginTop:15},YA={flex:0,backgroundColor:"white"},VA={flex:0,backgroundColor:"white"},KA={marginLeft:15},ZA={marginLeft:15},QA={marginLeft:15},JA={marginLeft:15},XA={marginLeft:15};var eD=function({title:e,start:t,end:n,show1Month:r,allMonths:a,onChangeDates:o}){return l.a.createElement($.C,{style:WA},l.a.createElement($.e,{to:"/reports",bare:!0,style:GA},l.a.createElement(zb,{width:10,height:10,style:HA})," Back"),l.a.createElement($.C,{style:W.c.veryLargeText},e),l.a.createElement($.C,{style:qA},l.a.createElement("div",null,l.a.createElement($.x,{style:YA,onChange:e=>o(...function(e,t,n){const r=e[e.length-1].name;return n<t&&(n=de.b(t,6)),UA(r,t,n)}(a,e.target.value,n)),value:t},a.map(e=>l.a.createElement("option",{key:e.name,value:e.name},e.pretty)))," ","to"," ",l.a.createElement($.x,{style:VA,onChange:e=>o(...function(e,t,n){const r=e[e.length-1].name;return t>n&&(t=de.y(n,6)),UA(r,t,n)}(a,t,e.target.value)),value:n},a.map(e=>l.a.createElement("option",{key:e.name,value:e.name},e.pretty)))),r&&l.a.createElement($.d,{bare:!0,style:KA,onClick:()=>o(...$A(1))},"1 month"),l.a.createElement($.d,{bare:!0,style:ZA,onClick:()=>o(...$A(2))},"3 months"),l.a.createElement($.d,{bare:!0,style:QA,onClick:()=>o(...$A(5))},"6 months"),l.a.createElement($.d,{bare:!0,style:JA,onClick:()=>o(...$A(12))},"1 Year"),l.a.createElement($.d,{bare:!0,style:XA,onClick:()=>o(...function(e){return[e[e.length-1].name,de.d()]}(a))},"All Time")))};function tD(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return nD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nD(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var rD=function(e,t){const n=Object(o.useContext)(T.a),r=tD(Object(o.useState)(null),2),a=r[0],l=r[1];return Object(o.useEffect)(()=>{let e;return t(n,e=>l(e)).then(t=>{e=t}),()=>{e&&e()}},[t]),a};function aD(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return oD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oD(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var lD={minWidth:650,overflow:"hidden"},iD={backgroundColor:"white",paddingLeft:30,paddingRight:30,overflow:"auto"},cD={paddingTop:20,paddingRight:20,flexShrink:0,alignItems:"flex-end",color:W.a.n3},sD={marginBottom:5,minWidth:160},uD={fontWeight:600},dD={marginBottom:5,minWidth:160},fD={fontWeight:600},pD={fontWeight:600},mD={marginTop:30};var yD=function(){const e=aD(Object(o.useState)(null),2),t=e[0],n=e[1],r=aD(Object(o.useState)(de.y(de.d(),30)),2),a=r[0],i=r[1],c=aD(Object(o.useState)(de.c()),2),s=c[0],u=c[1],d=aD(Object(o.useState)(()=>lA.a(Hn.a(s),Hn.a(a))>93),2),f=d[0],p=d[1],m=rD("cash_flow",cA(gA)(a,s,f));if(Object(o.useEffect)(()=>{!async function(){const e=await Object(M.send)("get-earliest-transaction"),t=e?de.s(Hn.a(e.date)):de.d(),r=de.v(t,de.d()).map(e=>({name:e,pretty:de.g(e,"MMMM, yyyy")})).reverse();n(r)}()},[]),!t||!m)return null;const y=m.graphData,g=m.totalExpenses,h=m.totalIncome;return l.a.createElement($.C,{style:[W.c.page,lD]},l.a.createElement(eD,{title:"Cash Flow",allMonths:t,start:de.j(a),end:de.j(s),show1Month:!0,onChangeDates:function(e,t){const n=lA.a(Hn.a(t),Hn.a(e))>93;let r=t+"-31";r>de.c()&&(r=de.c()),i(e+"-01"),u(r),p(n)}}),l.a.createElement($.C,{style:iD},l.a.createElement($.C,{style:cD},l.a.createElement($.a,{style:sD,left:l.a.createElement($.c,null,"Income:"),right:l.a.createElement($.z,{style:uD},Object(ke.k)(h))}),l.a.createElement($.a,{style:dD,left:l.a.createElement($.c,null,"Expenses:"),right:l.a.createElement($.z,{style:fD},Object(ke.k)(g))}),l.a.createElement($.z,{style:pD},l.a.createElement(iA,{amount:h+g}))),l.a.createElement(NA,{start:a,end:s,graphData:y,isConcise:f}),l.a.createElement($.C,{style:mD},l.a.createElement($.v,null,l.a.createElement("strong",null,"How is cash flow calculated?")),l.a.createElement($.v,null,'Cash flow shows the balance of your budgeted accounts over time, and the amount of expenses/income each day or month. Your budgeted accounts are considered to be "cash on hand", so this gives you a picture of how available money fluctuates.'))))};function gD(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return hD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hD(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bD(e,t,n){return async(r,a)=>{if(0===n.length)return null;a(function(e,t,n){const r=de.v(t,n),a=e.map(e=>{let t=e.starting;return r.map(n=>(e.balances[n]&&(t+=e.balances[n].amount),t))});let o=!1,i=0,c=0;return{graphData:{data:r.reduce((e,t,n)=>{let r=0,s=0,u=0;const d=0===e.length?null:e[e.length-1];a.forEach(e=>{const t=e[n];t<0?r+=-t:s+=t,u+=t}),u<0&&(o=!0);const f=Hn.a(t+"-01"),p=d?u-Object(ke.b)(d.y):0,m=l.a.createElement("div",null,l.a.createElement("div",{style:OD},l.a.createElement("strong",null,Sn.a(f,"MMMM yyyy"))),l.a.createElement("div",{style:wD},l.a.createElement($.a,{left:"Assets:",right:Object(ke.k)(s)}),l.a.createElement($.a,{left:"Debt:",right:`-${Object(ke.k)(r)}`}),l.a.createElement($.a,{left:"Net worth:",right:l.a.createElement("strong",null,Object(ke.k)(u))}),l.a.createElement($.a,{left:"Change:",right:Object(ke.k)(p)})));return 0===e.length&&(i=u),c=u,e.push({x:f,y:Object(ke.j)(u),premadeLabel:m}),e},[]),hasNegative:o,start:t,end:n},netWorth:c,totalChange:c-i}}(await Promise.all(n.map(async n=>{let r=gD(await Promise.all([Object(g.f)(Object(g.c)("transactions").filter({account:n.id,date:{$lt:e+"-01"}}).calculate({$sum:"$amount"})).then(({data:e})=>e),Object(g.f)(Object(g.c)("transactions").filter({account:n.id,$and:[{date:{$gte:e+"-01"}},{date:{$lte:t+"-31"}}]}).groupBy({$month:"$date"}).select([{date:{$month:"$date"}},{amount:{$sum:"$amount"}}])).then(({data:e})=>e)]),2),a=r[0],o=r[1];return{id:n.id,balances:fA(o,"date"),starting:a}})),e,t))}}var OD={marginBottom:10},wD={lineHeight:1.5};var vD=n(848);function ED({start:e,end:t,data:n,style:r,scale:a,range:o}){const i=a.y(0),c=a.x(Hn.a(e+"-01")),s=a.x(Hn.a(t+"-01"));return c<0||s<0?null:l.a.createElement("svg",null,l.a.createElement("defs",null,l.a.createElement("clipPath",{id:"positive"},l.a.createElement("rect",{x:c,y:o.y[1],width:s-c,height:i-o.y[1]+1,fill:"#ffffff"})),l.a.createElement("clipPath",{id:"negative"},l.a.createElement("rect",{x:c,y:i+1,width:s-c,height:Math.max(o.y[0]-i-1,0),fill:"#ffffff"})),l.a.createElement("linearGradient",{id:"positive-gradient",gradientUnits:"userSpaceOnUse",x1:0,y1:o.y[1],x2:0,y2:i},l.a.createElement("stop",{offset:"0%",stopColor:DA.colors.blueFadeStart}),l.a.createElement("stop",{offset:"100%",stopColor:DA.colors.blueFadeEnd})),l.a.createElement("linearGradient",{id:"negative-gradient",gradientUnits:"userSpaceOnUse",x1:0,y1:i,x2:0,y2:o.y[0]},l.a.createElement("stop",{offset:"0%",stopColor:DA.colors.redFadeEnd}),l.a.createElement("stop",{offset:"100%",stopColor:DA.colors.redFadeStart}))))}var jD={height:"auto"},SD={data:{clipPath:"url(#negative)",fill:"url(#negative-gradient)",stroke:DA.colors.red,strokeLinejoin:"round"}},CD={data:{fill:"none",stroke:"none"}},xD={ticks:{stroke:"red"}};var PD=function({style:e,start:t,end:n,graphData:r,compact:a}){const o=a?vA.a:OA.a;return l.a.createElement(TA,{style:[e,a&&jD]},(e,t,n)=>r&&l.a.createElement(o,{scale:{x:"time",y:"linear"},theme:DA,domainPadding:{x:0,y:10},width:e,height:t,containerComponent:l.a.createElement(wA.a,{voronoiDimension:"x"}),padding:a&&{top:0,bottom:0,left:0,right:0}},l.a.createElement(ED,{start:r.start,end:r.end,data:r.data}),l.a.createElement(1===r.data.length?EA.a:vD.a,{data:r.data,labelComponent:l.a.createElement(LA,{portalHost:n}),labels:e=>e.premadeLabel,style:{data:1===r.data.length?{width:50}:{clipPath:"url(#positive)",fill:"url(#positive-gradient)"}}}),r.data.length>1&&l.a.createElement(vD.a,{data:r.data,style:SD}),l.a.createElement(vD.a,{data:r.data,style:CD}),!a&&l.a.createElement(SA.a,{style:xD,tickFormat:e=>Sn.a(e,"MMM ''yy"),tickValues:r.data.map(e=>e.x),tickCount:Math.min(5,r.data.length),offsetY:50}),!a&&l.a.createElement(SA.a,{dependentAxis:!0,crossAxis:!r.hasNegative})))};function kD(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return AD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return AD(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function AD(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var DD={minWidth:650,overflow:"hidden"},ID={backgroundColor:"white",padding:"30px",overflow:"auto"},TD={textAlign:"right",paddingRight:20,flexShrink:0},MD={fontWeight:400,marginBottom:5},RD={marginTop:30};var BD=Object(s.b)(e=>({accounts:e.queries.accounts}),e=>Object(ue.b)(y,e))(function({accounts:e}){const t=kD(Object(o.useState)(null),2),n=t[0],r=t[1],a=kD(Object(o.useState)(de.y(de.d(),5)),2),i=a[0],c=a[1],s=kD(Object(o.useState)(de.d()),2),u=s[0],d=s[1],f=rD("net_worth",cA(bD)(i,u,e));return Object(o.useEffect)(()=>{!async function(){const e=await Object(M.send)("get-earliest-transaction"),t=de.d();let n=e?de.s(Hn.a(sA(e.date))):t;const a=de.y(de.d(),12);n>a&&(n=a);const o=de.v(n,de.d()).map(e=>({name:e,pretty:de.g(e,"MMMM, yyyy")})).reverse();r(o)}()},[]),n&&f?l.a.createElement($.C,{style:[W.c.page,DD]},l.a.createElement(eD,{title:"Net Worth",allMonths:n,start:i,end:u,onChangeDates:function(e,t){c(e),d(t)}}),l.a.createElement($.C,{style:ID},l.a.createElement($.C,{style:TD},l.a.createElement($.C,{style:[W.c.largeText,MD]},Object(ke.k)(f.netWorth)),l.a.createElement(iA,{amount:f.totalChange})),l.a.createElement(PD,{start:i,end:u,graphData:f.graphData}),l.a.createElement($.C,{style:RD},l.a.createElement($.v,null,l.a.createElement("strong",null,"How is net worth calculated?")),l.a.createElement($.v,null,'Net worth shows the balance of all accounts over time, including all of your investments. Your "net worth" is considered to be the amount you\'d have if you sold all your assets and paid off as much debt as possible. If you hover over the graph, you can also see the amount of assets and debt individually.')))):null}),_D={color:W.a.n6};var LD=function({start:e,end:t}){let n;return e=Hn.a(e),t=Hn.a(t),n=e.getYear()!==t.getYear()?l.a.createElement("div",null,Sn.a(e,"MMM yyyy")," - ",Sn.a(t,"MMM yyyy")):e.getMonth()!==t.getMonth()?l.a.createElement("div",null,Sn.a(e,"MMM")," - ",Sn.a(t,"MMM yyyy")):Sn.a(t,"MMMM yyyy"),l.a.createElement($.c,{style:_D},n)};function zD({flex:e,to:t,style:n,children:r}){const a={flex:e,margin:15},o=l.a.createElement($.C,{style:[{backgroundColor:"white",borderRadius:2,height:200,boxShadow:"0 2px 6px rgba(0, 0, 0, .15)",transition:"box-shadow .25s",":hover":t&&{boxShadow:"0 4px 6px rgba(0, 0, 0, .15)"}},t?null:a,n]},r);return t?l.a.createElement($.b,{to:t,exact:!0,style:[{textDecoration:"none",flex:e},a]},o):o}var FD={flex:1},ND={flexDirection:"row",padding:20},UD={flex:1},$D={fontWeight:500,marginBottom:5},WD={textAlign:"right"},GD={fontWeight:500,marginBottom:5},HD={color:W.a.n6,fontWeight:300},qD={height:"auto",flex:1};function YD({accounts:e}){const t=de.d(),n=de.y(t,5),r=rD("net_worth",cA(bD)(n,t,e));return r?l.a.createElement(zD,{flex:2,to:"/reports/net-worth"},l.a.createElement($.C,{style:FD},l.a.createElement($.C,{style:ND},l.a.createElement($.C,{style:UD},l.a.createElement($.c,{style:[W.c.mediumText,$D]},"Net Worth"),l.a.createElement(LD,{start:n,end:t})),l.a.createElement($.C,{style:WD},l.a.createElement($.c,{style:[W.c.mediumText,GD]},Object(ke.k)(r.netWorth)),l.a.createElement(iA,{amount:r.totalChange,style:HD}))),l.a.createElement(PD,{start:n,end:t,graphData:r.graphData,compact:!0,style:qD}))):null}var VD={flex:1},KD={flexDirection:"row",padding:20},ZD={flex:1},QD={fontWeight:500,marginBottom:5},JD={textAlign:"right"},XD={color:W.a.n6,fontWeight:300},eI={height:"auto",flex:1},tI={padding:0},nI={textAlign:"right"};function rI(){const e=de.c(),t=de.d()+"-01",n=rD("cash_flow_simple",cA(yA)(t,e));if(!n)return null;const r=n.graphData,a=-(r.expense||0),o=r.income||0;return l.a.createElement(zD,{flex:1,to:"/reports/cash-flow"},l.a.createElement($.C,{style:VD},l.a.createElement($.C,{style:KD},l.a.createElement($.C,{style:ZD},l.a.createElement($.c,{style:[W.c.mediumText,QD]},"Cash Flow"),l.a.createElement(LD,{start:t,end:e})),l.a.createElement($.C,{style:JD},l.a.createElement(iA,{amount:o-a,style:XD}))),l.a.createElement(TA,{style:eI},(e,t,n)=>l.a.createElement(vA.a,{colorScale:[DA.colors.blue,DA.colors.red],width:100,height:t,theme:DA,domain:{x:[0,100],y:[0,Math.max(o,a,100)]},containerComponent:l.a.createElement(wA.a,{voronoiDimension:"x"}),labelComponent:l.a.createElement(LA,{portalHost:n,offsetX:(e-100)/2,offsetY:e=>e+40>t?t-40:e,light:!0,forceActive:!0,style:tI}),padding:{top:0,bottom:0,left:0,right:0}},l.a.createElement(EA.a,{barWidth:13,data:[{x:30,y:Math.max(o,5),premadeLabel:l.a.createElement("div",{style:nI},l.a.createElement("div",null,"Income"),l.a.createElement("div",null,Object(ke.k)(o))),labelPosition:"left"}],labels:e=>e.premadeLabel}),l.a.createElement(EA.a,{barWidth:13,data:[{x:60,y:Math.max(a,5),premadeLabel:l.a.createElement("div",null,l.a.createElement("div",null,"Expenses"),l.a.createElement("div",null,Object(ke.k)(a))),labelPosition:"right",fill:DA.colors.red}],labels:e=>e.premadeLabel})))))}var aI={paddingLeft:40,paddingRight:40,minWidth:700},oI={flexDirection:"row",flex:"0 0 auto"},lI={flex:"0 0 auto",flexDirection:"row"},iI={color:"#a0a0a0",justifyContent:"center",alignItems:"center",width:200};var cI=Object(s.b)(e=>({accounts:e.queries.accounts}),e=>Object(ue.b)(y,e))(function({accounts:e}){return l.a.createElement($.C,{style:[W.c.page,aI]},l.a.createElement($.C,{style:oI},l.a.createElement(YD,{accounts:e}),l.a.createElement(rI,null)),l.a.createElement($.C,{style:lI},l.a.createElement(zD,{style:[iI,W.c.mediumText]},"More reports",l.a.createElement("br",null)," coming soon!")))}),sI={flex:1};var uI=class extends l.a.Component{render(){return l.a.createElement($.C,{style:sI},l.a.createElement(u.b,{path:"/reports",exact:!0,component:cI}),l.a.createElement(u.b,{path:"/reports/net-worth",exact:!0,component:BD}),l.a.createElement(u.b,{path:"/reports/cash-flow",exact:!0,component:yD}))}};function dI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fI(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dI(Object(n),!0).forEach(function(t){pI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pI(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mI=e=>o.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",style:fI({color:"#242134"},e.style)}),o.createElement("path",{d:"M6.847 21.429a3.408 3.408 0 0 1-2.662-1.34l-3.76-4.273a1.714 1.714 0 0 1 2.572-2.263l3.522 4.01a.429.429 0 0 0 .631.014L21.036 3.105a1.715 1.715 0 1 1 2.486 2.362l-14.06 14.8a3.327 3.327 0 0 1-2.615 1.162Z",fill:"currentColor"}));function yI(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return gI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gI(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gI(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let hI=43;var bI={color:"inherit",transform:"rotateZ(90deg)"},OI={padding:0};function wI({schedule:e,status:t,onAction:n}){let r=yI(Object(o.useState)(!1),2),a=r[0],i=r[1];return l.a.createElement($.C,null,l.a.createElement($.d,{bare:!0,onClick:e=>{e.stopPropagation(),i(!0)}},l.a.createElement(Bt.a,{width:15,height:15,style:bI})),a&&l.a.createElement($.B,{position:"bottom-right",width:150,style:OI,onClose:()=>i(!1)},l.a.createElement($.s,{onMenuSelect:t=>{n(t,e.id),i(!1)},items:["due"===t&&{name:"post-transaction",text:"Post transaction"},...e.completed?[{name:"restart",text:"Restart"}]:[{name:"skip",text:"Skip next date"},{name:"complete",text:"Complete"}],{name:"delete",text:"Delete"}]})))}var vI={textAlign:"right",flexDirection:"row",alignItems:"center",padding:"0 5px"},EI={textAlign:"left",color:W.a.n7,lineHeight:"1em",marginRight:10};function jI({amount:e,op:t}){let n=be(e),r=Object(ke.k)(Math.abs(n||0)),a="isapprox"===t||"isbetween"===t;return l.a.createElement(kt.a,{width:100,plain:!0,style:vI},a&&l.a.createElement($.C,{style:EI,title:(a?"Approximately ":"")+r},"~"),l.a.createElement($.z,{style:{flex:1,color:n>0?W.a.g5:null,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:(a?"Approximately ":"")+r},n>0?`+${r}`:`${r}`))}var SI={cursor:"pointer",backgroundColor:"white",":hover":{backgroundColor:W.a.hover}},CI={alignItems:"flex-start"},xI={textAlign:"center"},PI={width:13,height:13},kI={cursor:"pointer",backgroundColor:"white",":hover":{backgroundColor:W.a.hover}},AI={fontStyle:"italic",textAlign:"center",color:W.a.n6},DI={flex:1},II={textAlign:"right"},TI={textAlign:"center"},MI={flex:1,backgroundColor:"transparent"};function RI({schedules:e,statuses:t,filter:n,minimal:r,allowCompleted:a,style:i,onSelect:c,onAction:u,tableStyle:d}){let f=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy"),p=yI(Object(o.useState)(!1),2),m=p[0],y=p[1],g=A(),h=j(),b=Object(o.useMemo)(()=>{if(!n)return e;const r=e=>!!e&&(e.toLowerCase().includes(n.toLowerCase())||n.toLowerCase().includes(e.toLowerCase()));return e.filter(e=>{let n=g.find(t=>e._payee===t.id),a=h.find(t=>e._account===t.id),o=be(e._amount),l=("isapprox"===e._amountOp||"isbetween"===e._amountOp?"~":"")+(o>0?"+":"")+Object(ke.k)(Math.abs(o||0)),i=e.next_date?de.g(e.next_date,f):null;return r(n&&n.name)||r(a&&a.name)||r(l)||r(t.get(e.id))||r(i)})},[e,n,t]),O=Object(o.useMemo)(()=>{if(!a)return b.filter(e=>!e.completed);if(m)return b;let e=b.filter(e=>!e.completed);return b.find(e=>e.completed)&&e.push({type:"show-completed"}),e},[b,m,a]);return l.a.createElement($.C,{style:[DI,d]},l.a.createElement(kt.m,{height:hI,inset:15,version:"v2"},l.a.createElement(kt.e,{width:"flex"},"Payee"),l.a.createElement(kt.e,{width:"flex"},"Account"),l.a.createElement(kt.e,{width:110},"Next date"),l.a.createElement(kt.e,{width:120},"Status"),l.a.createElement(kt.e,{width:100,style:II},"Amount"),!r&&l.a.createElement(kt.e,{width:80,style:TI},"Recurring"),!r&&l.a.createElement(kt.e,{width:40})),l.a.createElement(kt.l,{rowHeight:hI,backgroundColor:"transparent",version:"v2",style:[MI,i],items:O,renderItem:function({item:e}){return"show-completed"===e.type?l.a.createElement(kt.h,{height:hI,inset:15,backgroundColor:"transparent",style:kI,onClick:()=>y(!0)},l.a.createElement(kt.e,{width:"flex",style:AI},"Show completed schedules")):function({item:e}){return l.a.createElement(kt.h,{height:hI,inset:15,backgroundColor:"transparent",onClick:()=>c(e.id),style:SI},l.a.createElement(kt.e,{width:"flex"},l.a.createElement(kx,{type:"payees",id:e._payee})),l.a.createElement(kt.e,{width:"flex"},l.a.createElement(kx,{type:"accounts",id:e._account})),l.a.createElement(kt.e,{width:110},e.next_date?de.g(e.next_date,f):null),l.a.createElement(kt.e,{width:120,style:CI},l.a.createElement(vc,{status:t.get(e.id)})),l.a.createElement(jI,{amount:e._amount,op:e._amountOp}),!r&&l.a.createElement(kt.e,{width:80,style:xI},e._date&&e._date.frequency&&l.a.createElement(mI,{style:PI})),!r&&l.a.createElement(kt.e,{width:40},l.a.createElement(wI,{schedule:e,status:t.get(e.id),onAction:u})))}({item:e})},renderEmpty:n?"No matching schedules":"No schedules",allowPopupsEscape:O.length<6}))}function BI(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return _I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _I(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var LI={alignItems:"flex-end"},zI={backgroundColor:"white"},FI={flexDirection:"row",justifyContent:"space-between",margin:"20px 0",flexShrink:0};function NI(){let e=Object(u.g)(),t=BI(Object(o.useState)(""),2),n=t[0],r=t[1],a=Ee();if(null==a)return null;let i=a.schedules,c=a.statuses;return l.a.createElement(rj,{title:"Schedules"},l.a.createElement($.C,{style:LI},l.a.createElement($.w,{placeholder:"Filter schedules\u2026",value:n,onChange:r})),l.a.createElement($.C,{style:{marginTop:20,flexBasis:(hI-1)*(Math.max(i.length,1)+1),overflow:"hidden"}},l.a.createElement(RI,{schedules:i,filter:n,statuses:c,allowCompleted:!0,onSelect:function(t){e.push(`/schedule/edit/${t}`,{locationPtr:e.location})},onAction:async function(e,t){switch(e){case"post-transaction":await Object(M.send)("schedule/post-transaction",{id:t});break;case"skip":await Object(M.send)("schedule/skip-next-date",{id:t});break;case"complete":await Object(M.send)("schedule/update",{schedule:{id:t,completed:!0}});break;case"restart":await Object(M.send)("schedule/update",{schedule:{id:t,completed:!1},resetNextDate:!0});break;case"delete":await Object(M.send)("schedule/delete",{id:t})}},style:zI})),l.a.createElement($.C,{style:FI},l.a.createElement($.d,{onClick:function(){e.push("/schedule/discover",{locationPtr:e.location})}},"Find schedules"),l.a.createElement($.d,{primary:!0,onClick:function(){e.push("/schedule/edit",{locationPtr:e.location})}},"Add new schedule")))}function UI(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return $I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $I(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let WI=43;var GI={flex:1.5},HI={flex:1},qI={flex:1.5},YI={textAlign:"right"};function VI({schedules:e,loading:t}){let n=XE(),r=Object(At.e)(),a=Object(At.d)();return l.a.createElement($.C,{style:HI},l.a.createElement(kt.m,{height:WI,inset:15,version:"v2"},l.a.createElement(kt.i,{exposed:!0,focused:!1,selected:r.size>0,onSelect:()=>a({type:"select-all"})}),l.a.createElement(kt.e,{width:"flex"},"Payee"),l.a.createElement(kt.e,{width:"flex"},"Account"),l.a.createElement(kt.e,{width:"auto",style:qI},"When"),l.a.createElement(kt.e,{width:100,style:YI},"Amount")),l.a.createElement(kt.l,{rowHeight:WI,version:"v2",backgroundColor:"modal"===n.type?"transparent":void 0,style:{flex:1,backgroundColor:"modal"===n.type?"transparent":void 0},items:e,loading:t,isSelected:e=>r.has(e),renderItem:function({item:e}){let t=r.has(e.id),n=e._conditions.find(e=>"amount"===e.field).op,o=ge(e.date);return l.a.createElement(kt.h,{height:WI,inset:15,backgroundColor:"transparent",onClick:()=>{a({type:"select",id:e.id})},borderColor:t?W.a.b8:W.a.border,style:{cursor:"pointer",backgroundColor:t?W.a.selected:"white",":hover":{backgroundColor:t?W.a.selected:W.a.hover}}},l.a.createElement(kt.i,{exposed:!0,focused:!1,selected:t,onSelect:()=>{a({type:"select",id:e.id})}}),l.a.createElement(kt.e,{width:"flex"},l.a.createElement(kx,{type:"payees",id:e.payee})),l.a.createElement(kt.e,{width:"flex"},l.a.createElement(kx,{type:"accounts",id:e.account})),l.a.createElement(kt.e,{width:"auto",title:o,style:GI},o),l.a.createElement(jI,{amount:e.amount,op:n}))},renderEmpty:"No schedules found"}))}function KI(){let e=XE(),t=Object(u.g)(),n=UI(Object(o.useState)(),2),r=n[0],a=n[1],i=UI(Object(o.useState)(!1),2),c=i[0],s=i[1],d=Object(At.c)("discover-schedules",r,[]);return Object(o.useEffect)(()=>{!async function(){a(await Object(M.send)("schedule/discover"))}()},[]),l.a.createElement(rj,{title:"Found schedules",modalSize:{width:850,height:650}},l.a.createElement($.v,null,"We found some possible schedules in your current transactions. Select the ones you want to create."),l.a.createElement($.v,null,"If you expected a schedule here and don't see it, it might be because the payees of the transactions don't match. Make sure you rename payees on all transactions for a schedule to be the same payee."),l.a.createElement($.v,null,"You can always do this later from \u201cMore Tools\u201d \u2192 \u201cFind Schedules.\u201d"),l.a.createElement(At.a,{instance:d},l.a.createElement(VI,{loading:null==r,schedules:r})),l.a.createElement($.y,{direction:"row",align:"center",justify:"flex-end",style:{paddingTop:20,paddingBottom:"modal"===e.type?0:20}},l.a.createElement($.f,{primary:!0,loading:c,disabled:0===d.items.size,onClick:async function(){let e=r.filter(e=>d.items.has(e.id));s(!0);for(let t of e){let e=await Object(M.send)("schedule/create",{conditions:t._conditions}),n=(await Object(M.send)("make-filters-from-conditions",{conditions:t._conditions})).filters;if(n.length>0){let t=(await Object(g.f)(Object(g.c)("transactions").filter({$and:n}).select("id"))).data;await Object(M.send)("transactions-batch-update",{updated:t.map(t=>({id:t.id,schedule:e}))})}}s(!1),t.goBack()}},"Create schedules")))}function ZI(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return QI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return QI(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function QI(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function JI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XI(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?JI(Object(n),!0).forEach(function(t){eT(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function eT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tT(e,t){let n=XI({},e);return t&&Object.keys(t).forEach(r=>{r in e&&(n[r]=t[r])}),n}function nT(e,t){let n=he(e._conditions),r=(e,t,n,r)=>e?XI(XI({},e),{},{value:r}):null!=r?{op:t,field:n,value:r}:null;return null==t.date?{error:"Date is required"}:null==t.amount?{error:"A valid amount is required"}:{conditions:[r(n.payee,"is","payee",t.payee),r(n.account,"is","account",t.account),r(n.date,"isapprox","date",t.date),{op:t.amountOp,field:"amount",value:t.amount}].filter(Boolean)}}var rT={marginTop:20},aT={flex:1},oT={flex:1},lT={flex:1},iT={marginBottom:3},cT={margin:0,flex:1},sT={padding:"0 10px",color:W.a.n5,fontSize:12},uT={marginTop:20},dT={flex:1},fT={fontSize:13,marginTop:20},pT={color:W.a.n4,fontWeight:600},mT={marginTop:10,color:W.a.n4},yT={marginTop:5,flex:1,flexDirection:"row",alignItems:"center",userSelect:"none"},gT={userSelect:"none"},hT={alignItems:"flex-end",flex:1},bT={marginTop:5,flexDirection:"row",alignItems:"center",userSelect:"none",justifyContent:"flex-end"},OT={userSelect:"none"},wT={width:350,textAlign:"right",color:W.a.n4,marginTop:10,fontSize:13,lineHeight:"1.4em"},vT={marginTop:30},ET={color:W.a.b5,fontSize:13,textAlign:"right",width:350},jT={marginTop:30,flex:1},ST={flexDirection:"row",padding:"5px 0"},CT={color:W.a.n4},xT={flex:1},PT={color:W.a.n6},kT={flexDirection:"row",alignItems:"center"},AT={flex:1},DT={padding:20,color:W.a.n4,textAlign:"center"},IT={color:W.a.r4},TT={border:"1px solid "+W.a.border,borderRadius:4,overflow:"hidden",marginTop:5},MT={marginTop:20},RT={color:W.a.r4},BT={marginRight:10};function _T(){let e=Object(u.i)(),t=e.id,n=e.initialFields,r=null==t,a=A({idKey:!0}),i=Object(u.g)(),c=Object(s.c)(),d=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy"),f=ZI(Object(o.useReducer)((e,t)=>{switch(t.type){case"set-schedule":{let n=t.schedule,r=he(n._conditions),a=new Set(Object.values(r)),o=n._conditions.find(e=>!a.has(e))||n._actions.find(e=>"link-schedule"!==e.op);return XI(XI({},e),{},{schedule:t.schedule,isCustom:o,fields:{payee:n._payee,account:n._account,amount:n._amount||0,amountOp:n._amountOp||"isapprox",date:n._date,posts_transaction:t.schedule.posts_transaction}})}case"set-field":if(!(t.field in e.fields))throw new Error("Unknown field: "+t.field);let n={[t.field]:t.value};return"amountOp"===t.field&&t.value!==e.fields.amountOp&&("isbetween"===t.value?n.amount="number"===typeof e.fields.amount?{num1:e.fields.amount,num2:e.fields.amount}:{num1:0,num2:0}:"isbetween"===e.fields.amountOp&&(n.amount="number"===typeof e.fields.amount?e.fields.amount:e.fields.amount.num1)),XI(XI({},e),{},{fields:XI(XI({},e.fields),n)});case"set-transactions":return XI(XI({},e),{},{transactions:t.transactions});case"set-repeats":return XI(XI({},e),{},{fields:XI(XI({},e.fields),{},{date:t.repeats?{frequency:"monthly",start:de.c(),patterns:[]}:de.c()})});case"set-upcoming-dates":return XI(XI({},e),{},{upcomingDates:t.dates});case"form-error":return XI(XI({},e),{},{error:t.error});case"switch-transactions":return XI(XI({},e),{},{transactionsMode:t.mode});default:throw new Error("Unknown action: "+t.type)}},{schedule:null,upcomingDates:null,error:null,fields:tT({payee:null,account:null,amount:null,amountOp:null,date:null,posts_transaction:!1},n),transactions:[],transactionsMode:r?"matched":"linked"}),2),p=f[0],m=f[1];async function y(){return(await Object(g.f)(Object(g.c)("schedules").filter({id:t}).select("*"))).data[0]}Object(o.useEffect)(()=>{!async function(){if(r){let e={start:de.c(),frequency:"monthly",patterns:[]};m({type:"set-schedule",schedule:{posts_transaction:!1,_date:e,_conditions:[{op:"isapprox",field:"date",value:e}],_actions:[]}})}else{let e=await y();e&&null==p.schedule&&m({type:"set-schedule",schedule:e})}}()},[]),Object(o.useEffect)(()=>{!async function(){let e=p.fields.date;if(null==e)m({type:"set-upcoming-dates",dates:null});else if(e.frequency){let t=(await Object(M.sendCatch)("schedule/get-upcoming-dates",{config:e,count:3})).data;m({type:"set-upcoming-dates",dates:t})}else{let t=de.c();e===t||de.r(e,t)?m({type:"set-upcoming-dates",dates:[e]}):m({type:"set-upcoming-dates",dates:null})}}()},[p.fields.date]),Object(o.useEffect)(()=>{if(p.schedule&&p.schedule.id&&"linked"===p.transactionsMode){return Object(g.d)(Object(g.c)("transactions").filter({schedule:p.schedule.id}).select("*").options({splits:"none"}),e=>m({type:"set-transactions",transactions:e})).unsubscribe}},[p.schedule,p.transactionsMode]),Object(o.useEffect)(()=>{let e,t=!0;if(p.schedule&&"matched"===p.transactionsMode){let n=nT(p.schedule,p.fields),r=n.error,a=n.conditions;if(m({type:"set-transactions",transactions:[]}),r)return void m({type:"form-error",error:r});a=a.map(e=>"description"===e.field?XI(XI({},e),{},{field:"payee"}):"acct"===e.field?XI(XI({},e),{},{field:"account"}):e),Object(M.send)("make-filters-from-conditions",{conditions:a}).then(({filters:n})=>{if(t){let t=Object(g.d)(Object(g.c)("transactions").filter({$and:n}).select("*").options({splits:"none"}),e=>m({type:"set-transactions",transactions:e}));e=t.unsubscribe}})}return()=>{t=!1,e&&e()}},[p.schedule,p.transactionsMode,p.fields]);let h=Object(At.c)("transactions",p.transactions,[]);async function b(e,t){await Object(M.send)("transactions-batch-update",{updated:e.map(e=>({id:e,schedule:t||p.schedule.id}))}),h.dispatch({type:"select-none"})}if(null==p.schedule)return null;function O(e){m({type:"switch-transactions",mode:e}),h.dispatch({type:"select-none"})}let w=a?a[p.fields.payee]:null,v=!!p.fields.date&&!!p.fields.date.frequency;return l.a.createElement(rj,{title:w?`Schedule: ${w.name}`:"Schedule",modalSize:"medium"},l.a.createElement($.y,{direction:"row",style:rT},l.a.createElement(jo.b,{style:aT},l.a.createElement(jo.c,{title:"Payee"}),l.a.createElement(Vo,{value:p.fields.payee,inputProps:{placeholder:"(none)"},onSelect:e=>m({type:"set-field",field:"payee",value:e})})),l.a.createElement(jo.b,{style:oT},l.a.createElement(jo.c,{title:"Account"}),l.a.createElement(no,{includeClosedAccounts:!1,value:p.fields.account,inputProps:{placeholder:"(none)"},onSelect:e=>m({type:"set-field",field:"account",value:e})})),l.a.createElement(jo.b,{style:lT},l.a.createElement($.y,{direction:"row",align:"center",style:iT},l.a.createElement(jo.c,{title:"Amount",style:cT}),l.a.createElement(Vx,{ops:["is","isapprox","isbetween"],value:p.fields.amountOp,formatOp:e=>{switch(e){case"is":return"is exactly";case"isapprox":return"is approximately";case"isbetween":return"is between";default:throw new Error("Invalid op for select: "+e)}},style:sT,onChange:(e,t)=>m({type:"set-field",field:"amountOp",value:t})})),"isbetween"===p.fields.amountOp?l.a.createElement(Bv,{defaultValue:p.fields.amount,onChange:e=>m({type:"set-field",field:"amount",value:e})}):l.a.createElement(Tv,{defaultValue:p.fields.amount,onChange:e=>m({type:"set-field",field:"amount",value:e})}))),l.a.createElement($.C,{style:uT},l.a.createElement(jo.c,{title:"Date"})),l.a.createElement($.y,{direction:"row",align:"flex-start"},l.a.createElement($.C,{style:dT},v?l.a.createElement($l,{value:p.fields.date,onChange:e=>m({type:"set-field",field:"date",value:e})}):l.a.createElement(Eo.a,{value:p.fields.date,onSelect:e=>m({type:"set-field",field:"date",value:e}),dateFormat:d}),p.upcomingDates&&l.a.createElement($.C,{style:fT},l.a.createElement($.z,{style:pT},"Upcoming dates"),l.a.createElement($.y,{direction:"column",spacing:1,style:mT},p.upcomingDates.map(e=>l.a.createElement($.C,{key:e},de.g(e,`${d} EEEE`)))))),l.a.createElement($.C,{style:yT},l.a.createElement(jo.a,{id:"form_repeats",checked:v,onChange:e=>{m({type:"set-repeats",repeats:e.target.checked})}}),l.a.createElement("label",{htmlFor:"form_repeats",style:gT},"Repeats")),l.a.createElement($.C,{style:hT},l.a.createElement($.C,{style:bT},l.a.createElement(jo.a,{id:"form_posts_transaction",checked:p.fields.posts_transaction,onChange:e=>{m({type:"set-field",field:"posts_transaction",value:e.target.checked})}}),l.a.createElement("label",{htmlFor:"form_posts_transaction",style:OT},"Automatically add transaction")),l.a.createElement($.z,{style:wT},"If checked, the schedule will automatically create transactions for you in the specified account"),!r&&p.schedule.rule&&l.a.createElement($.y,{direction:"row",align:"center",style:vT},p.isCustom&&l.a.createElement($.z,{style:ET},"This schedule has custom conditions and actions"),l.a.createElement($.d,{onClick:()=>(async function(e){let t=await Object(M.send)("rule-get",{id:e||p.schedule.rule});c(Object(qn.d)("edit-rule",{rule:t,onSave:async()=>{let e=await y();m({type:"set-schedule",schedule:e})}}))})(),disabled:r},"Edit as rule")))),l.a.createElement($.C,{style:jT},l.a.createElement(At.a,{instance:h},r?l.a.createElement($.C,{style:ST},l.a.createElement($.z,{style:CT},"These transactions match this schedule:"),l.a.createElement($.C,{style:xT}),l.a.createElement($.z,{style:PT},"Select transactions to link on save")):l.a.createElement($.C,{style:kT},l.a.createElement($.d,{bare:!0,style:{color:"linked"===p.transactionsMode?W.a.b4:W.a.n7,marginRight:10,fontSize:14},onClick:()=>O("linked")},"Linked transactions")," ",l.a.createElement($.d,{bare:!0,style:{color:"matched"===p.transactionsMode?W.a.b4:W.a.n7,fontSize:14},onClick:()=>O("matched")},"Find matching transactions"),l.a.createElement($.C,{style:AT}),l.a.createElement(kt.j,{name:"transactions",items:"linked"===p.transactionsMode?[{name:"unlink",text:"Unlink from schedule"}]:[{name:"link",text:"Link to schedule"}],onSelect:(e,t)=>{switch(e){case"link":b(t);break;case"unlink":!async function(e){await Object(M.send)("transactions-batch-update",{updated:e.map(e=>({id:e,schedule:null}))}),h.dispatch({type:"select-none"})}(t)}}})),l.a.createElement(Lx,{renderEmpty:"matched"===p.transactionsMode&&(()=>l.a.createElement($.C,{style:DT},p.error?l.a.createElement($.z,{style:IT},"Could not search: ",p.error):"No transactions found")),transactions:p.transactions,fields:["date","payee","amount"],style:TT}))),l.a.createElement($.y,{direction:"row",justify:"flex-end",align:"center",style:MT},p.error&&l.a.createElement($.z,{style:RT},p.error),l.a.createElement($.d,{style:BT,onClick:()=>i.goBack()},"Cancel"),l.a.createElement($.d,{primary:!0,onClick:async function(){m({type:"form-error",error:null});let e=nT(p.schedule,p.fields),t=e.error,n=e.conditions;if(t)return void m({type:"form-error",error:t});let a=await Object(M.sendCatch)(r?"schedule/create":"schedule/update",{schedule:{id:p.schedule.id,posts_transaction:p.fields.posts_transaction},conditions:n});a.error?m({type:"form-error",error:"An error occurred while saving. Please contact help@actualbudget.com for support."}):(r&&await b([...h.items],a.data),i.goBack())}},r?"Add":"Save")))}function LT(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return zT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zT(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var FT={flexDirection:"row",marginBottom:20,alignItems:"center"},NT={flex:1},UT={marginInline:-20};function $T(){let e=Object(u.h)(),t=Object(u.g)(),n=Ee(Object(o.useCallback)(e=>e.filter({completed:!1}),[])),r=LT(Object(o.useState)(""),2),a=r[0],i=r[1];if(null==n)return null;let c=n.schedules,s=n.statuses;return l.a.createElement(rj,{title:"Link Schedule",modalSize:"medium"},l.a.createElement($.C,{style:FT},l.a.createElement($.z,null,"Choose a schedule to link these transactions to:"),l.a.createElement($.C,{style:NT}),l.a.createElement($.w,{isInModal:!0,width:300,placeholder:"Filter schedules\u2026",value:a,onChange:i})),l.a.createElement(RI,{schedules:c,filter:a,statuses:s,minimal:!0,onSelect:async function(n){let r=e.state.transactionIds;r&&r.length>0&&await Object(M.send)("transactions-batch-update",{updated:r.map(e=>({id:e,schedule:n}))}),t.goBack()},tableStyle:UT}))}var WT={color:W.a.p4},GT={marginTop:20};function HT(){let e=Object(u.h)(),t=Object(u.g)(),n=e.state&&e.state.payees||[],r=n.length>1;return l.a.createElement(rj,{title:"Post transactions?",modalSize:"small"},l.a.createElement($.v,null,n.length>0?l.a.createElement($.z,null,"The ",r?"payees ":"payee ",n.map((e,t)=>l.a.createElement($.z,null,l.a.createElement($.z,{style:WT},l.a.createElement(kx,{key:e,id:e,type:"payees"})),t===n.length-1?" ":t===n.length-2?", and ":", "))):l.a.createElement($.z,null,"There ",r?"are payees ":"is a payee "," that "),l.a.createElement($.z,null,r?"have ":"has "," schedules that are due today. Usually we automatically post transactions for these, but you are offline or syncing failed. In order to avoid duplicate transactions, we let you choose whether or not to create transactions for these schedules.")),l.a.createElement($.v,null,"Be aware that other devices may have already created these transactions. If you have multiple devices, make sure you only do this on one device or you will have duplicate transactions."),l.a.createElement($.v,null,'You can always manually post a transaction later for a due schedule by selecting the schedule and clicking "Post transaction" in the action menu.'),l.a.createElement($.y,{direction:"row",justify:"flex-end",style:GT,spacing:2},l.a.createElement($.d,{onClick:function(){t.goBack()}},"Decide later"),l.a.createElement($.d,{primary:!0,onClick:async function(){await Object(M.send)("schedule/force-run-service"),t.goBack()}},"Post transactions")))}var qT=n(252);const YT=["title","children","style","titleProps"];function VT(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return KT(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return KT(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function KT(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ZT(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var QT={gap:20,alignItems:"flex-start"},JT={fontSize:20,fontWeight:500,flexShrink:0};function XT(e){let t=e.title,n=e.children,r=e.style,a=e.titleProps,o=ZT(e,YT);return l.a.createElement($.C,Object.assign({style:[QT,r]},o),l.a.createElement($.C,Object.assign({style:[JT,a&&a.style]},a),t),n)}var eM={backgroundColor:W.a.n9,alignSelf:"flex-start",alignItems:"flex-start",padding:15,borderRadius:4,border:"1px solid "+W.a.n8,width:"100%"},tM={width:"auto"};function nM({primaryAction:e,children:t}){return l.a.createElement($.C,Object(lt.css)(eM,Object(lt.media)(`(min-width: ${Wb.a.breakpoint_medium})`,tM)),l.a.createElement($.C,{style:{marginBottom:e?10:0,maxWidth:500,lineHeight:1.5,gap:10}},t),e||null)}var rM={marginBottom:25,width:"100%"},aM={width:"auto"},oM={flexShrink:0,alignSelf:"flex-start",color:W.a.p4,marginBottom:25};function lM({children:e}){let t=Object(u.h)(),n=VT(Object(o.useState)("#advanced"===t.hash),2),r=n[0],a=n[1];return r?l.a.createElement(XT,Object.assign({innerRef:e=>{e&&"#advanced"===t.hash&&e.scrollIntoView(!0)},id:"advanced",title:"Advanced Settings"},Object(lt.css)(rM,Object(lt.media)(`(min-width: ${Wb.a.breakpoint_medium})`,aM))),e):l.a.createElement($.r,{id:"advanced",onClick:()=>a(!0),style:oM},"Show advanced settings")}var iM={color:W.a.g4,fontWeight:600};function cM({prefs:e,pushModal:t}){const n=Object(Gb.a)();return e.encryptKeyId?l.a.createElement(nM,{primaryAction:l.a.createElement($.d,{onClick:function(){t("create-encryption-key",{recreate:!0})}},"Generate new key")},l.a.createElement($.z,null,l.a.createElement($.z,{style:iM},"End-to-end Encryption is turned on.")," ","Your data is encrypted with a key that only you have before sending it it out to the cloud. Local data remains unencrypted so if you forget your password you can re-encrypt it."," ",l.a.createElement("a",{href:"https://actualbudget.github.io/docs/Getting-Started/sync/#encryption",target:"_blank",rel:"noopener noreferrer"},"Learn more\u2026"))):n?l.a.createElement(nM,{primaryAction:l.a.createElement($.d,{onClick:()=>t("create-encryption-key")},"Enable encryption\u2026")},l.a.createElement($.z,null,l.a.createElement("strong",null,"End-to-end encryption")," is not enabled. Any data on the server is still protected by the server password, but it's not end-to-end encrypted which means the server owners have the ability to read it. If you want, you can use an additional password to encrypt your data on the server."," ",l.a.createElement("a",{href:"https://actualbudget.github.io/docs/Getting-Started/sync/#encryption",target:"_blank",rel:"noopener noreferrer"},"Learn more\u2026"))):l.a.createElement(nM,{primaryAction:l.a.createElement($.d,{disabled:!0},"Enable encryption\u2026")},l.a.createElement($.z,null,l.a.createElement("strong",null,"End-to-end encryption")," is not available when running without a server. Budget files are always kept unencrypted locally, and encryption is only applied when sending data to a server."," ",l.a.createElement("a",{href:"https://actualbudget.github.io/docs/Getting-Started/sync/#encryption",target:"_blank",rel:"noopener noreferrer"},"Learn more\u2026")))}function sM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return uM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uM(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function uM(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var dM={gap:"1em"},fM={color:W.a.r3,fontWeight:500},pM={display:"flex"},mM={display:"flex"},yM={flexShrink:0,alignSelf:"flex-start",color:W.a.p4};function gM({prefs:e,savePrefs:t}){let n=sM(l.a.useState(!1),2),r=n[0],a=n[1],o=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith("flags.")).map(([e,t])=>[e.replace("flags.",""),t])),i="report"===e.budgetType&&o.reportBudget;return l.a.createElement(nM,{primaryAction:r?l.a.createElement($.C,{style:dM},l.a.createElement("label",{style:{display:"flex",color:i?W.a.n5:"inherit"}},l.a.createElement(jo.a,{id:"report-budget-flag",checked:o.reportBudget,onChange:()=>{t({"flags.reportBudget":!o.reportBudget})},disabled:i})," ",l.a.createElement($.C,null,"Enable budget mode toggle",i&&l.a.createElement($.z,{style:fM},"Switch to a rollover budget before turning off this feature"))),l.a.createElement("label",{style:pM},l.a.createElement(jo.a,{id:"sync-account-flag",checked:o.syncAccount,onChange:()=>{t({"flags.syncAccount":!o.syncAccount})}})," ",l.a.createElement($.C,null,"Enable account syncing")),l.a.createElement("label",{style:mM},l.a.createElement(jo.a,{id:"goal-templates-flag",checked:o.goalTemplatesEnabled,onChange:()=>{t({"flags.goalTemplatesEnabled":!o.goalTemplatesEnabled})}})," ",l.a.createElement($.C,null,"Enable Goal Templates"))):l.a.createElement($.r,{onClick:()=>a(!0),style:yM},"I understand the risks, show experimental features")},l.a.createElement($.z,null,l.a.createElement("strong",null,"Experimental features.")," These features are not fully tested and may not work as expected. THEY MAY CAUSE IRRECOVERABLE DATA LOSS. They may do nothing at all. Only enable them if you know what you are doing."))}function hM({prefs:e}){return l.a.createElement(nM,{primaryAction:l.a.createElement($.d,{onClick:async function(){let t=await Object(M.send)("export-budget");window.Actual.saveFile(t,`${Object(Sn.a)(new Date,"yyyy-MM-dd")}-${e.id}.zip`,"Export budget")}},"Export data")},l.a.createElement($.z,null,l.a.createElement("strong",null,"Export")," your data as a zip file containing"," ",l.a.createElement("code",null,"db.sqlite")," and ",l.a.createElement("code",null,"metadata.json")," files. It can be imported into another Actual instance by clicking the \u201cImport file\u201d button and then choosing \u201cActual\u201d on the Files page."),e.encryptKeyId?l.a.createElement($.z,null,"Even though encryption is enabled, the exported zip file will not have any encryption."):null)}function bM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return OM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return OM(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function OM(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var wM={color:W.a.g3,marginBottom:0,marginLeft:"1em",textAlign:"right",whiteSpace:"pre-wrap"};function vM(e){let t=e.numBlankPayees,n=e.numCleared,r=e.numDeleted,a="";return 0===t&&0===n&&0===r?a="No split transactions found needing repair.":(t>0&&(a+=`Fixed ${t} splits with a blank payee.`),n>0&&(""!==a&&(a+="\n"),a+=`Fixed ${n} splits with the wrong cleared flag.`),r>0&&(""!==a&&(a+="\n"),a+=`Fixed ${r} splits that weren't properly deleted.`)),l.a.createElement($.v,{style:wM},a)}var EM={flexDirection:"row",justifyContent:"space-between",maxWidth:500,width:"100%",alignItems:"center"},jM={alignItems:"flex-start"},SM={margin:0,paddingLeft:"1.5em"},CM={marginBottom:"1em"};function xM(){let e=bM(Object(o.useState)(!1),2),t=e[0],n=e[1],r=bM(Object(o.useState)(null),2),a=r[0],i=r[1];return l.a.createElement(nM,{primaryAction:l.a.createElement($.C,{style:EM},l.a.createElement($.f,{loading:t,onClick:async function(){n(!0);let e=await Object(M.send)("tools/fix-split-transactions");i(e),n(!1)}},"Repair split transactions"),a&&vM(a))},l.a.createElement($.z,null,l.a.createElement("strong",null,"Repair split transactions")," if you are experiencing bugs relating to split transactions and the \u201cReset budget cache\u201d button above does not help. If you see blank payees on splits or account balances (or any balances) are incorrect, this tool may fix them."),l.a.createElement($.C,{style:jM},l.a.createElement($.v,null,"This tool does two things:"),l.a.createElement($.v,null,l.a.createElement("ul",{style:SM},l.a.createElement("li",{style:CM},"Ensures that deleted split transactions are fully deleted. In previous versions of the app, certain split transactions may appear deleted but not all of them are actually deleted. This causes the transactions list to look correct, but certain balances may be incorrect when filtering."),l.a.createElement("li",null,'Sync the payee and cleared flag of a split transaction to the main or "parent" transaction, if appropriate. The payee will only be set if it currently doesn\'t have one.')))))}let PM=[{value:"MM/dd/yyyy",label:"MM/DD/YYYY"},{value:"dd/MM/yyyy",label:"DD/MM/YYYY"},{value:"yyyy-MM-dd",label:"YYYY-MM-DD"},{value:"MM.dd.yyyy",label:"MM.DD.YYYY"},{value:"dd.MM.yyyy",label:"DD.MM.YYYY"}];var kM={marginLeft:5,fontSize:14},AM={marginLeft:5,fontSize:14};function DM({prefs:e,savePrefs:t}){let n=e.dateFormat||"MM/dd/yyyy",r=e.numberFormat||"comma-dot";return l.a.createElement(XT,{title:"Formatting"},l.a.createElement($.z,null,l.a.createElement("label",{htmlFor:"settings-numberFormat"},"Number format: "),l.a.createElement("select",Object.assign({defaultValue:r,id:"settings-numberFormat"},Object(lt.css)(kM),{onChange:function(e){let n=e.target.value;t({numberFormat:n})}}),ke.n.map(e=>l.a.createElement("option",{key:e.value,value:e.value},e.label)))),l.a.createElement($.z,null,l.a.createElement("label",{htmlFor:"settings-dateFormat"},"Date format: "),l.a.createElement("select",Object.assign({defaultValue:n,id:"settings-dateFormat"},Object(lt.css)(AM),{onChange:function(e){let n=e.target.value;t({dateFormat:n})}}),PM.map(e=>l.a.createElement("option",{key:e.value,value:e.value},e.label)))))}function IM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return TM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return TM(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function TM(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var MM={flexDirection:"row",alignItems:"center",overflow:"hidden"},RM={flexShrink:0},BM={backgroundColor:"white",padding:"7px 10px",borderRadius:4,marginLeft:5,overflow:"auto",whiteSpace:"nowrap","::-webkit-scrollbar":{display:"none"}},_M={fontSize:14,marginLeft:5,flexShrink:0,alignSelf:"flex-start"},LM={marginTop:10};function zM({globalPrefs:e,saveGlobalPrefs:t}){let n=IM(Object(o.useState)(!1),2),r=n[0],a=n[1],i=Object(o.useRef)(null);return Object(o.useEffect)(()=>{i.current&&i.current.scrollTo(1e4,0)},[]),l.a.createElement(XT,{title:"General"},l.a.createElement($.C,{style:MM},l.a.createElement($.z,{style:RM},"Store files here: "),l.a.createElement($.z,{innerRef:i,style:BM},e.documentDir),l.a.createElement($.d,{primary:!0,onClick:async function(){let e=await window.Actual.openFileDialog({properties:["openDirectory"]});e&&(t({documentDir:e[0]}),a(!0))},style:_M},"Change location")),r&&l.a.createElement(IC,{style:LM},"A restart is required for this change to take effect"))}function FM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return NM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return NM(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function NM(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function UM(){let e=FM(Object(o.useState)(!1),2),t=e[0],n=e[1];return l.a.createElement(nM,{primaryAction:l.a.createElement($.f,{loading:t,onClick:async function(){n(!0),await Object(M.send)("reset-budget-cache"),n(!1)}},"Reset budget cache")},l.a.createElement($.z,null,l.a.createElement("strong",null,"Reset budget cache")," will clear all cached values for the budget and recalculate the entire budget. All values in the budget are cached for performance reasons, and if there is a bug in the cache you won't see correct values. There is no danger in resetting the cache. Hopefully you never have to do this."))}function $M({resetSync:e}){let t=FM(Object(o.useState)(!1),2),n=t[0],r=t[1];return l.a.createElement(nM,{primaryAction:l.a.createElement($.f,{loading:n,onClick:async function(){r(!0),await e(),r(!1)}},"Reset sync")},l.a.createElement($.z,null,l.a.createElement("strong",null,"Reset sync")," will remove all local data used to track changes for syncing, and create a fresh sync ID on our server. This file on other devices will have to be re-downloaded to use the new sync ID. Use this if there is a problem with syncing and you want to start fresh."))}var WM={gap:5};function GM(){const e=Object(qT.a)();return l.a.createElement(XT,{title:"About",style:WM},l.a.createElement($.z,null,"Client version: v",window.Actual.ACTUAL_VERSION),l.a.createElement($.z,null,"Server version: ",e))}var HM={color:W.a.n6};function qM({prefs:e}){return l.a.createElement(l.a.Fragment,null,l.a.createElement($.z,null,"Budget ID: ",e.id),l.a.createElement($.z,{style:HM},"Sync ID: ",e.groupId||"(none)"))}var YM={flexShrink:0,gap:30},VM={display:"none"},KM={color:"#999"};var ZM=Object(ed.b)(W.a.n10)(Object(s.b)(e=>({prefs:e.prefs.local,globalPrefs:e.prefs.global}),y)(function({loadPrefs:e,savePrefs:t,prefs:n,globalPrefs:r,pushModal:a,resetSync:i,closeBudget:c}){return Object(o.useEffect)(()=>{let t=Object(M.listen)("prefs-updated",()=>{e()});return e(),()=>t()},[e]),l.a.createElement($.C,{style:{marginInline:r.floatingSidebar&&!Object(ne.a)()?"auto":0}},l.a.createElement(rj,{title:"Settings"},l.a.createElement($.C,{style:YM},l.a.createElement(XT,{title:"Budget",style:Object(lt.css)(Object(lt.media)(`(min-width: ${Wb.a.breakpoint_medium})`,VM))},l.a.createElement(jo.b,null,l.a.createElement(jo.c,{title:"Name"}),l.a.createElement($.n,{value:n.budgetName,disabled:!0,style:KM})),l.a.createElement($.d,{onClick:c},"Close Budget")),l.a.createElement(GM,null),!Rb.a.isBrowser&&l.a.createElement(zM,{globalPrefs:r,saveGlobalPrefs:this.props.saveGlobalPrefs}),l.a.createElement(DM,{prefs:n,savePrefs:t}),l.a.createElement(cM,{prefs:n,pushModal:a}),l.a.createElement(hM,{prefs:n}),l.a.createElement(lM,null,l.a.createElement(qM,{prefs:n}),l.a.createElement(UM,null),l.a.createElement($M,{resetSync:i}),l.a.createElement(xM,null),l.a.createElement(gM,{prefs:n,savePrefs:t})))))}));function QM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function JM(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QM(Object(n),!0).forEach(function(t){XM(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eR({path:e,component:t}){return l.a.createElement(u.b,{path:e,children:e=>l.a.createElement($.C,{style:{flex:1,display:e.match?"flex":"none"}},l.a.createElement(t,e))})}function tR({isMobile:e,location:t}){return l.a.createElement(u.d,{location:t},l.a.createElement(u.b,{path:"/"},l.a.createElement(u.b,{path:"/",exact:!0,render:()=>l.a.createElement(u.a,{to:"/budget"})}),l.a.createElement(eR,{path:"/reports",component:uI}),l.a.createElement(eR,{path:"/budget",component:e?KE:bv}),l.a.createElement(u.b,{path:"/schedules",exact:!0,component:NI}),l.a.createElement(u.b,{path:"/schedule/edit",exact:!0,component:_T}),l.a.createElement(u.b,{path:"/schedule/edit/:id",component:_T}),l.a.createElement(u.b,{path:"/schedule/link",component:$T}),l.a.createElement(u.b,{path:"/schedule/discover",component:KI}),l.a.createElement(u.b,{path:"/schedule/posts-offline-notification",component:HT}),l.a.createElement(u.b,{path:"/payees",exact:!0,component:oA}),l.a.createElement(u.b,{path:"/rules",exact:!0,component:aj}),l.a.createElement(u.b,{path:"/settings",component:ZM}),l.a.createElement(u.b,{path:"/accounts/:id",exact:!0,children:t=>{const n=e?pf:Qu;return t.match&&l.a.createElement(n,Object.assign({key:t.match.params.id},t))}}),l.a.createElement(u.b,{path:"/accounts",exact:!0,component:e?Wf:Qu})))}function nR({isMobile:e}){let t=Object(u.h)(),n=ie(t,"locationPtr"),r=[t];for(;n;)r.unshift(n),n=ie(n,"locationPtr");let a=r[0],o=r.slice(1);return l.a.createElement(mn,{location:r[r.length-1]},l.a.createElement(tR,{location:a,isMobile:e}),o.map((t,n)=>l.a.createElement(JE,{key:t.key,type:"modal",current:n===o.length-1},l.a.createElement(tR,{location:t,isMobile:e}))))}var rR={alignItems:"center",color:"#8E8E8F",display:"flex",flexDirection:"column",textDecoration:"none"},aR={color:W.a.p5},oR={color:"inherit",marginBottom:"5px"};function lR({icon:e,name:t,path:n}){return l.a.createElement(d.b,{to:n,style:rR,activeStyle:aR},l.a.createElement(e,{width:22,height:22,style:oR}),t)}var iR=JM(JM({backgroundColor:"white",borderTop:`1px solid ${W.a.n10}`,bottom:0},W.c.shadow),{},{display:"flex",height:"80px",justifyContent:"space-around",paddingTop:10,width:"100%"});function cR(){return l.a.createElement("div",{style:iR},l.a.createElement(lR,{name:"Budget",path:"/budget",icon:te,isActive:!1}),l.a.createElement(lR,{name:"Accounts",path:"/accounts",icon:Q,isActive:!1}),l.a.createElement(lR,{name:"Settings",path:"/settings",icon:Y,isActive:!1}))}var sR={height:"100%",backgroundColor:W.a.n10},uR={flexDirection:"row",flex:1},dR={flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",width:"100%"},fR={WebkitAppRegion:"drag",position:"absolute",top:0,left:0,right:0,zIndex:1e3},pR={flex:1,display:"flex",overflow:"auto",position:"relative"};class mR extends l.a.Component{constructor(e){super(e),this.state={isMobile:Object(ne.a)()},this.history=Object(p.a)();let t=this.history.push;this.history.push=((e,n)=>{let r=function(e){return ae(ae({},e),{},{_version:le})}(e.state||n);return"object"===typeof e?t.call(this.history,JM(JM({},e),{},{state:r})):t.call(this.history,e,r)}),window.__history=this.history,_.setUndoState("url",window.location.href),this.cleanup=this.history.listen(e=>{_.setUndoState("url",window.location.href)}),this.handleWindowResize=this.handleWindowResize.bind(this)}handleWindowResize(){this.setState({isMobile:Object(ne.a)(),windowWidth:window.innerWidth})}componentDidMount(){"/subscribe"===this.history.location.pathname&&this.history.push("/"),this.props.getAccounts().then(e=>{0===e.length&&this.history.push("/accounts")}),m.a.setScope("app"),setTimeout(async()=>{await this.props.sync(),Object(B.a)(this.props.addNotification,this.props.resetSync,this.history)},100),window.addEventListener("resize",this.handleWindowResize)}componentWillUnmount(){this.cleanup(),window.removeEventListener("resize",this.handleWindowResize)}render(){return l.a.createElement(u.c,{history:this.history},l.a.createElement(f.a,null,l.a.createElement($.C,{style:sR},l.a.createElement(ZE,null),l.a.createElement($.C,{style:uR},!this.state.isMobile&&l.a.createElement(_w,null),l.a.createElement("div",{style:dR},!this.state.isMobile&&l.a.createElement(uv,{style:fR}),l.a.createElement("div",{style:pR},l.a.createElement(bk.a,null),l.a.createElement(Zf,null),l.a.createElement(nR,{isMobile:this.state.isMobile}),l.a.createElement(hk,{history:this.history})),this.state.isMobile&&l.a.createElement(u.d,null,l.a.createElement(u.b,{path:"/budget",component:cR}),l.a.createElement(u.b,{path:"/accounts",component:cR}),l.a.createElement(u.b,{path:"/settings",component:cR})))))))}}t.a=Object(s.b)(null,y)(function(e){let t=Object(o.useMemo)(()=>l.a.createElement(mR,e),[e]);return l.a.createElement(R,null,l.a.createElement(Uw,null,l.a.createElement(Mw,null,l.a.createElement(N,null,l.a.createElement(P,null,l.a.createElement(v,null,l.a.createElement(i.a,{backend:c.a},t)))))))})},61:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return d});var r=n(0),a=n(71),o=n(77);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(t,n){if(!t)throw new Error("SheetValue binding is required");if(e.IS_TESTING&&"string"!==typeof t&&!t.name&&(t=s(s({},t),{},{name:t.value.toString()})),null==(t="string"===typeof t?{name:t,value:null}:t).name)throw new Error("Binding name is now required");let i=Object(r.useContext)(a.a)||"__global",c=function(e){let t=e.indexOf("!");return-1!==t?{sheet:e.slice(0,t),name:e.slice(t+1)}:{sheet:null,name:e}}(t.name);c.sheet&&(i=c.sheet,t=s(s({},t),{},{name:c.name}));let u=Object(r.useContext)(o.a),d=l(Object(r.useState)({name:i+"!"+t.name,value:void 0===t.value?null:t.value,query:t.query}),2),f=d[0],p=d[1],m=Object(r.useRef)(n),y=Object(r.useRef)(f.value);return Object(r.useLayoutEffect)(()=>{m.current=n,y.current=f.value}),Object(r.useLayoutEffect)(()=>(t.query&&u.createQuery(i,t.name,t.query),u.bind(i,t,null,e=>{m.current&&m.current(e),e.value!==y.current&&p(e)})),[i,t.name]),f.value}}).call(this,n(15))},610:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(31),l=n(8),i=n(47),c=n(33),s=n(1),u=n(2),d=n(73),f=n(252),p=n(240),m=n(245),y=n(66),g=n(113),h=n(3),b=n(102);var O=n(132),w=n(118);function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach(function(t){j(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(){let e=S(Object(r.useState)(!1),2),t=e[0],n=e[1],a=Object(l.g)(),o=Object(l.h)();return Object(r.useEffect)(()=>{!async function(){let e=e=>{o.pathname!==e?a.push(e):n(!0)};if(null==await Object(h.send)("get-server-url"))a.push("/config-server");else{let t=await Object(h.send)("subscribe-needs-bootstrap"),n=t.error,r=t.bootstrapped;n?a.push("/error",{error:n}):e(r?"/login":"/bootstrap")}}()},[a,o]),{checked:t}}var P={fontSize:40,fontWeight:700,color:u.a.p3,marginBottom:20};function k({text:e}){return a.a.createElement(s.z,{style:P},e)}var A=E(E({padding:10,fontSize:15,border:"none"},u.c.shadow),{},{":focus":E({border:"none"},u.c.shadow)});const D=a.a.forwardRef((e,t)=>a.a.createElement(s.n,Object.assign({},e,{style:[A,e.style]})));u.a.p4,u.a.n9,u.a.n9;u.a.n2;function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var M={maxWidth:500,marginTop:-30},R={fontSize:16,color:u.a.n2,lineHeight:1.5},B={marginTop:20,color:u.a.r4,borderRadius:4,fontSize:15},_={display:"flex",flexDirection:"row",marginTop:30},L={flex:1,marginRight:10},z={fontSize:15},F={fontSize:15,marginLeft:10},N={flexDirection:"row",flexFlow:"row wrap",justifyContent:"center",marginTop:15},U={color:u.a.n4},$={color:u.a.n4,margin:5,marginRight:15},W={color:u.a.n4,margin:5},G={marginLeft:15};function H(){var e;e=u.a.p5,Object(r.useEffect)(()=>{Object(b.a)(e)},[e,b.a]);let t=Object(o.c)(),n=Object(l.g)(),i=I(Object(r.useState)(""),2),c=i[0],d=i[1],f=Object(w.a)();Object(r.useEffect)(()=>{d(f)},[f]);let p=I(Object(r.useState)(!1),2),m=p[0],v=p[1],E=I(Object(r.useState)(null),2),j=E[0],S=E[1];async function C(){await Object(h.send)("set-server-url",{url:null}),await t(Object(g.b)()),n.push("/")}return a.a.createElement(a.a.Fragment,null,a.a.createElement(s.C,{style:M},a.a.createElement(k,{text:"Where's the server?"}),a.a.createElement(s.z,{style:R},f?a.a.createElement(a.a.Fragment,null,"Existing sessions will be logged out and you will log in to this server. We will validate that Actual is running at this URL."):a.a.createElement(a.a.Fragment,null,"There is no server configured. After running the server, specify the URL here to use the app. You can always change this later. We will validate that Actual is running at this URL.")),j&&a.a.createElement(s.z,{style:B},function(e){switch(e){case"network-failure":return"Server is not running at this URL. Make sure you have HTTPS set up properly.";default:return"Server does not look like an Actual server. Is it set up correctly?"}}(j)),a.a.createElement("form",{style:_,onSubmit:e=>{e.preventDefault(),async function(){if(""===c||m)return;S(null),v(!0);let e=(await Object(h.send)("set-server-url",{url:c})).error;if("network-failure"!==e||c.startsWith("http://")||c.startsWith("https://"))e?(v(!1),S(e)):(v(!1),await t(Object(g.c)()),n.push("/"));else{let e=(await Object(h.send)("set-server-url",{url:"https://"+c})).error;e?(d("https://"+c),S(e)):(await t(Object(g.c)()),n.push("/")),v(!1)}}()}},a.a.createElement(D,{autoFocus:!0,placeholder:"https://example.com",value:c,onChange:e=>d(e.target.value),style:L}),a.a.createElement(s.f,{primary:!0,loading:m,style:z},"OK"),f&&a.a.createElement(s.d,{bare:!0,type:"button",style:F,onClick:()=>n.goBack()},"Cancel")),a.a.createElement(s.C,{style:N},f?a.a.createElement(s.d,{bare:!0,style:U,onClick:C},"Stop using a server"):a.a.createElement(a.a.Fragment,null,a.a.createElement(s.d,{bare:!0,style:$,onClick:function(){d(window.location.origin)}},"Use ",window.location.origin.replace(/https?:\/\//,"")),a.a.createElement(s.d,{bare:!0,style:W,onClick:C},"Don't use a server"),(Object(O.a)()||Object(O.b)())&&a.a.createElement(s.d,{primary:!0,style:G,onClick:async function(){await Object(h.send)("set-server-url",{url:null}),await t(Object(y.d)({testMode:!0})),window.__history.push("/")}},"Create test file")))))}var q=n(139),Y=n(43),V=n(48);function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var J=e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:Z({color:"#242134"},e.style)}),r.createElement("path",{d:"M23.113 5.954 21.849 4.69l.881-.88a1.914 1.914 0 1 0-2.707-2.71L9.04 12.085a6.014 6.014 0 1 0 2.707 2.707l3.739-3.737.762.762a1.75 1.75 0 1 0 2.475-2.475l-.763-.762 1.416-1.417 1.264 1.263a1.788 1.788 0 0 0 2.473 0 1.751 1.751 0 0 0 0-2.472Zm-16.737 8.5a3 3 0 1 1-3 3 3 3 0 0 1 3-2.998Z",fill:"currentColor"}));function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach(function(t){te(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ne=e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:ee({color:"#242134"},e.style)}),r.createElement("path",{d:"M10.664 20.073a1.249 1.249 0 1 0-.507 2.447A10.739 10.739 0 1 0 2.4 16.1a.25.25 0 0 1-.084.3l-1 .726a1 1 0 0 0 .377 1.787l3.946.849a1.062 1.062 0 0 0 .21.022 1 1 0 0 0 .978-.79l.945-4.4a1 1 0 0 0-1.565-1.02l-1.361.989a.25.25 0 0 1-.386-.128 8.255 8.255 0 1 1 6.205 5.643Z",fill:"currentColor"}));function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach(function(t){oe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:ae({color:"#242134"},e.style)}),r.createElement("path",{d:"M24 11.113a5.765 5.765 0 0 0-5.216-5.952.249.249 0 0 1-.191-.12 7.684 7.684 0 0 0-14.1 2.294.251.251 0 0 1-.227.2A4.643 4.643 0 0 0 .624 9.774 4.47 4.47 0 0 0 0 12.223a4.293 4.293 0 0 0 1.235 3.1 4.624 4.624 0 0 0 1.78 1.062.963.963 0 0 0 1.243-.86v-.026a.985.985 0 0 0-.658-1.033 2.58 2.58 0 0 1-.96-.572A2.374 2.374 0 0 1 2 12.109a2.588 2.588 0 0 1 2.586-2.588 2.7 2.7 0 0 1 .535.054.989.989 0 0 0 .811-.184 1 1 0 0 0 .392-.779c.085-5.736 8.293-7.372 10.818-2.044a.974.974 0 0 0 .941.57 3.733 3.733 0 0 1 3 1.309 3.888 3.888 0 0 1 .9 2.812 3.428 3.428 0 0 1-1.473 2.667.973.973 0 0 0-.4.964l.01.059a.968.968 0 0 0 1.525.608A5.4 5.4 0 0 0 24 11.113Z",fill:"currentColor"}),r.createElement("path",{d:"M12.231 9.7a6.5 6.5 0 1 0 6.5 6.5 6.508 6.508 0 0 0-6.5-6.5Zm3.124 4.155a.75.75 0 0 1 .15 1.05l-2.905 3.87a1.493 1.493 0 0 1-1.1.6h-.111a1.485 1.485 0 0 1-1.055-.443l-1.5-1.5a.75.75 0 0 1 1.066-1.06l1.3 1.3a.249.249 0 0 0 .376-.026L14.305 14a.751.751 0 0 1 1.05-.149Z",fill:"currentColor"}));function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(n),!0).forEach(function(t){se(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ue=e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:ce({color:"#242134"},e.style)}),r.createElement("path",{d:"M24 10.663A5.817 5.817 0 0 0 22.228 6.5a5.711 5.711 0 0 0-3.447-1.585.249.249 0 0 1-.191-.12 7.684 7.684 0 0 0-14.1 2.294.251.251 0 0 1-.227.2A4.59 4.59 0 0 0 0 11.859a4.324 4.324 0 0 0 1.236 3.21 5.529 5.529 0 0 0 3.605 1.377 1 1 0 0 0 .985-1.015 1.023 1.023 0 0 0-1.015-.985 3.3 3.3 0 0 1-2.172-.8A2.374 2.374 0 0 1 2 11.859a2.576 2.576 0 0 1 .954-2.007 2.6 2.6 0 0 1 2.167-.527 1 1 0 0 0 1.2-.919 5.686 5.686 0 0 1 10.82-2.088.959.959 0 0 0 .941.57 3.687 3.687 0 0 1 2.758 1.049A3.752 3.752 0 0 1 22 10.663a3.835 3.835 0 0 1-3.438 3.791 1 1 0 0 0 .132 1.992.961.961 0 0 0 .131-.009A5.807 5.807 0 0 0 24 10.663Z",fill:"currentColor"}),r.createElement("path",{d:"M15.5 17.446h-1.75a.25.25 0 0 1-.25-.25v-7.25a1.5 1.5 0 1 0-3 0V17.2a.25.25 0 0 1-.25.25H8.5a1 1 0 0 0-.707 1.707l3.5 3.5a1 1 0 0 0 1.414 0l3.5-3.5a1 1 0 0 0-.707-1.707Z",fill:"currentColor"})),de=n(117);function fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(n),!0).forEach(function(t){me(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ye=e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:pe({color:"#242134"},e.style)}),r.createElement("path",{d:"M21.941 3.607 18.87.554A1.912 1.912 0 0 0 17.527 0H8.9A1.9 1.9 0 0 0 7 1.9V5H3.4a1.9 1.9 0 0 0-1.9 1.9v15.21A1.9 1.9 0 0 0 3.4 24h11.7a1.9 1.9 0 0 0 1.9-1.895V19h3.6a1.9 1.9 0 0 0 1.9-1.895V4.949a1.882 1.882 0 0 0-.559-1.342ZM14.5 22H4a.5.5 0 0 1-.5-.5v-14A.5.5 0 0 1 4 7h7.784a.5.5 0 0 1 .35.143L14.85 9.8a.5.5 0 0 1 .15.357V21.5a.5.5 0 0 1-.5.5Zm5.5-5h-2.75a.25.25 0 0 1-.25-.25v-6.8a1.892 1.892 0 0 0-.558-1.341L13.37 5.554A1.9 1.9 0 0 0 12.028 5H9.25A.25.25 0 0 1 9 4.75V2.5a.5.5 0 0 1 .5-.5l7.756-.026a.5.5 0 0 1 .351.143L20.35 4.8a.5.5 0 0 1 .15.357V16.5a.5.5 0 0 1-.5.5Z",fill:"currentColor"}));function ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function he(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(n),!0).forEach(function(t){be(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ge(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Oe=e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:he({color:"#242134"},e.style)}),r.createElement("path",{d:"M3.566 15.457a1 1 0 0 0-.5-.844 2.248 2.248 0 0 1-.431-.329A2.371 2.371 0 0 1 2 12.5a2.588 2.588 0 0 1 2.585-2.588 2.645 2.645 0 0 1 .536.056A1 1 0 0 0 6.324 9c.081-5.754 8.3-7.363 10.818-2.045a.97.97 0 0 0 .941.571 3.7 3.7 0 0 1 3 1.3 3.874 3.874 0 0 1 .908 2.811 3.428 3.428 0 0 1-1.1 2.375 1.316 1.316 0 0 0-.42 1.089.912.912 0 0 0 1.476.628A5.408 5.408 0 0 0 24 11.418a5.763 5.763 0 0 0-5.22-5.866.25.25 0 0 1-.19-.12 7.685 7.685 0 0 0-14.1 2.3.251.251 0 0 1-.227.2 4.642 4.642 0 0 0-3.643 2.24A4.471 4.471 0 0 0 0 12.619a4.287 4.287 0 0 0 1.235 3.09 4.177 4.177 0 0 0 .852.645 1 1 0 0 0 1.478-.9Z",fill:"currentColor"}),r.createElement("path",{d:"M18.5 15.8a6.5 6.5 0 1 0-6.5 6.5 6.508 6.508 0 0 0 6.5-6.5Zm-7.25 1.25v-.55a1.257 1.257 0 0 1 .986-1.221 1.125 1.125 0 1 0-1.361-1.1.75.75 0 1 1-1.5 0 2.625 2.625 0 1 1 3.538 2.461.25.25 0 0 0-.163.234v.18a.75.75 0 0 1-1.5 0ZM12 18.8a1 1 0 1 1-1 1 1 1 0 0 1 1-1Z",fill:"currentColor"}));function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach(function(t){Ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function je(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Se(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e){return"unknown"===e.state?"This is a cloud-based file but it's state is unknown because you are offline.":e.encryptKeyId?e.hasKey?"This file is encrypted and you have key to access it.":"This file is encrypted and you do not have the key for it.":null}function xe({state:e,onDelete:t,onUpload:n,onClose:r,onDownload:o}){return a.a.createElement(s.s,{onMenuSelect:function(e){switch(r(),e){case"delete":t()}},items:[{name:"delete",text:"Delete"}]})}var Pe={width:16,height:16},ke={padding:0};function Ae({state:e,onDelete:t}){let n=je(Object(r.useState)(!1),2),o=n[0],l=n[1];return a.a.createElement(s.C,null,a.a.createElement(s.d,{bare:!0,onClick:e=>{e.stopPropagation(),l(!0)}},a.a.createElement(de.a,{style:Pe})),o&&a.a.createElement(s.B,{position:"bottom-right",style:ke,onClose:()=>l(!1)},a.a.createElement(xe,{state:e,onDelete:t,onClose:()=>l(!1)})))}var De={width:18,height:18,color:"currentColor"},Ie={marginLeft:5};function Te({file:e}){let t,n,r;switch(e.state){case"unknown":t=Oe,n="Network unavailable",r=u.a.n7;break;case"remote":t=ue,n="Available for download";break;case"local":case"broken":t=ye,n="Local";break;default:t=le,n="Syncing"}return a.a.createElement(s.C,{style:{color:r,alignItems:"center",flexDirection:"row",marginTop:8}},a.a.createElement(t,{color:r,style:De}),a.a.createElement(s.z,{style:Ie},n))}var Me=ve(ve({flexDirection:"row",justifyContent:"space-between",alignItems:"center"},u.c.shadow),{},{margin:10,padding:"12px 15px",backgroundColor:"white",borderRadius:6,flexShrink:0,cursor:"pointer",":hover":{backgroundColor:u.a.hover}}),Re={alignItems:"flex-start"},Be={fontSize:16,fontWeight:700},_e={flex:"0 0 auto",flexDirection:"row",alignItems:"center"};function Le({file:e,onSelect:t,onDelete:n}){let o=Object(r.useRef)(!1);return a.a.createElement(s.C,{onClick:()=>(async function(e){o.current||(o.current=!0,await t(e),o.current=!1)})(e),title:Ce(e),style:[Me]},a.a.createElement(s.C,{style:Re},a.a.createElement(s.z,{style:[Be]},e.name),a.a.createElement(Te,{file:e})),a.a.createElement(s.C,{style:_e},e.encryptKeyId&&a.a.createElement(J,{style:{width:13,height:13,marginRight:8,color:e.hasKey?u.a.b5:u.a.n8}}),a.a.createElement(Ae,{state:e.state,onDelete:()=>n(e)})))}var ze={flex:1,maxHeight:310,overflow:"auto","& *":{userSelect:"none"}};class Fe extends a.a.Component{render(){const e=this.props,t=e.files,n=e.onSelect,r=e.onDelete;return a.a.createElement(s.C,{style:ze},t.map((e,t)=>a.a.createElement(Le,{key:e.id||e.cloudFileId,file:e,onSelect:n,onDelete:r})))}}var Ne={padding:10,marginRight:5},Ue={width:18,height:18,color:u.a.n1};function $e({onRefresh:e}){let t=je(Object(r.useState)(!1),2),n=t[0],o=t[1];let l=n?V.a:ne;return a.a.createElement(s.d,{bare:!0,style:Ne,onClick:async function(){o(!0),await e(),o(!1)}},a.a.createElement(l,{color:u.a.n1,style:Ue}))}var We={boxShadow:"none",backgroundColor:"transparent"},Ge={flex:1},He={margin:20},qe={position:"absolute",right:0,top:0,bottom:0,justifyContent:"center",marginRight:5},Ye={flexDirection:"row",justifyContent:"flex-end",padding:25,paddingLeft:5},Ve={marginLeft:10,color:u.a.n4},Ke={marginLeft:15},Ze={marginLeft:15};var Qe=class extends a.a.Component{constructor(...e){super(...e),this.creating=!1,this.onCreate=(({testMode:e}={})=>{this.creating||(this.creating=!0,this.props.actions.createBudget({testMode:e}))})}render(){let e=this.props,t=e.modalProps,n=e.files,r=void 0===n?[]:n,o=e.actions,l=e.onDownload;return a.a.createElement(s.t,Object.assign({},t,{noAnimation:!0,showHeader:!1,showOverlay:!1,padding:0,style:We}),()=>a.a.createElement(s.C,{style:Ge},a.a.createElement(s.C,null,a.a.createElement(s.z,{style:[u.c.veryLargeText,He]},"Files"),a.a.createElement(s.C,{style:qe},a.a.createElement($e,{onRefresh:()=>{o.getUserData(),o.loadAllFiles()}}))),a.a.createElement(Fe,{files:r,actions:o,onSelect:e=>{"remote"===e.state?l(e.cloudFileId):o.loadBudget(e.id)},onDelete:e=>o.pushModal("delete-budget",{file:e})}),a.a.createElement(s.C,{style:Ye},a.a.createElement(s.d,{bare:!0,style:Ve,onClick:e=>{e.preventDefault(),o.pushModal("import")}},"Import file"),a.a.createElement(s.d,{primary:!0,onClick:()=>this.onCreate(),style:Ke},"Create new file"),(Object(O.a)()||Object(O.b)())&&a.a.createElement(s.d,{primary:!0,onClick:()=>this.onCreate({testMode:!0}),style:Ze},"Create test file"))))}};function Je(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Xe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var et={padding:15,paddingTop:0,paddingBottom:25,width:500,lineHeight:"1.5em"},tt={backgroundColor:u.a.r4,alignSelf:"center",border:0,marginTop:10,padding:"10px 30px",fontSize:14},nt={marginTop:20},rt={alignSelf:"center",marginTop:10,padding:"10px 30px",fontSize:14},at={color:u.a.r4,borderColor:u.a.r4},ot={border:0,backgroundColor:u.a.r4};function lt({modalProps:e,actions:t,file:n}){let o=Je(Object(r.useState)(null),2),l=o[0],i=o[1];async function c(){i("cloud"),await t.deleteBudget(n.id,n.cloudFileId),i(null),e.onBack()}async function u(){i("local"),await t.deleteBudget(n.id),i(null),e.onBack()}let d=n.cloudFileId&&"broken"!==n.state;return a.a.createElement(s.t,Object.assign({},e,{title:"Delete "+n.name,padding:0,showOverlay:!1,onClose:e.onBack}),()=>a.a.createElement(s.C,{style:et},d&&a.a.createElement(a.a.Fragment,null,a.a.createElement(s.z,null,"This is a ",a.a.createElement("strong",null,"hosted file")," which we store to make it available for download on any device. You can delete it from our servers which will remove it from all of your devices."),a.a.createElement(s.f,{primary:!0,loading:"cloud"===l,style:tt,onClick:c},"Delete file from all devices")),n.id&&a.a.createElement(a.a.Fragment,null,a.a.createElement(s.z,{style:[d&&nt]},d?a.a.createElement(s.z,null,"You can also delete just the local copy. This will remove all local data and the file will be listed as available for download."):a.a.createElement(s.z,null,"broken"===n.state?a.a.createElement(s.z,null,"This is a ",a.a.createElement("strong",null,"hosted file")," but it was created by another user. You can only delete the local copy."):a.a.createElement(s.z,null,"This a ",a.a.createElement("strong",null,"local file")," which is not stored on our servers.")," ","Deleting it will remove it and all of its backup permanently.")),a.a.createElement(s.f,{primary:!d,loading:"local"===l,style:[rt,d?at:ot],onClick:u},"Delete file locally"))))}function it(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ct(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var st={width:400},ut={lineHeight:1.5,marginTop:20},dt={color:u.a.r4,marginBottom:15},ft={fontSize:25,fontWeight:700,marginBottom:20},pt={fontWeight:700},mt={color:u.a.n5},yt={fontWeight:700},gt={color:u.a.n5},ht={fontWeight:700},bt={color:u.a.n5},Ot={flexDirection:"row",marginTop:20,alignItems:"center"},wt={flex:1},vt={marginRight:10};var Et=function({modalProps:e,actions:t}){const n=it(Object(r.useState)(!1),1)[0];function o(e){switch(e){case"ynab4":t.pushModal("import-ynab4");break;case"ynab5":t.pushModal("import-ynab5");break;case"actual":t.pushModal("import-actual")}}let l={padding:10,border:"1px solid "+u.a.border,borderRadius:6,marginBottom:10,display:"block"};return a.a.createElement(s.t,Object.assign({},e,{noAnimation:!0,showHeader:!1,showOverlay:!1,style:st}),()=>a.a.createElement(s.C,{style:[u.c.smallText,ut]},n&&a.a.createElement(s.c,{style:dt},function(e){switch(e){case"not-ynab4":return"This file is not valid. Please select a .ynab4 file";default:return"An unknown error occurred while importing. Sorry! We have been notified of this issue."}}(n)),a.a.createElement(s.C,null,a.a.createElement(s.C,{style:ft},"Import from:"),a.a.createElement(s.C,null,a.a.createElement(s.d,{style:l,onClick:()=>o("ynab4")},a.a.createElement("span",{style:pt},"YNAB4"),a.a.createElement(s.C,{style:mt},"The old unsupported desktop app")),a.a.createElement(s.d,{style:l,onClick:()=>o("ynab5")},a.a.createElement("span",{style:yt},"nYNAB"),a.a.createElement(s.C,{style:gt},a.a.createElement("div",null,"The newer web app"))),a.a.createElement(s.d,{style:l,onClick:()=>o("actual")},a.a.createElement("span",{style:ht},"Actual"),a.a.createElement(s.C,{style:bt},a.a.createElement("div",null,"Import a file exported from Actual"))))),a.a.createElement(s.C,{style:Ot},a.a.createElement(s.C,{style:wt}),a.a.createElement(s.d,{style:vt,onClick:()=>e.onBack()},"Back"))))};function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return St(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return St(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ct={width:400},xt={lineHeight:1.5,marginTop:20},Pt={color:u.a.r4,marginBottom:15},kt={"& > div":{lineHeight:"1.7em"}},At={alignSelf:"center"},Dt={flexDirection:"row",marginTop:20,alignItems:"center"},It={flex:1},Tt={marginRight:10};var Mt=function({modalProps:e,availableImports:t}){const n=Object(o.c)(),l=jt(Object(r.useState)(!1),2),i=l[0],c=l[1],d=jt(Object(r.useState)(!1),2),f=d[0],p=d[1];async function m(){const e=await window.Actual.openFileDialog({properties:["openFile"],filters:[{name:"actual",extensions:["zip"]}]});if(e){p(!0),c(!1);try{await n(Object(y.h)(e[0],"actual"))}catch(t){c(t.message)}finally{p(!1)}}}return a.a.createElement(s.t,Object.assign({},e,{showHeader:!1,showOverlay:!1,noAnimation:!0,style:Ct}),()=>a.a.createElement(s.C,{style:[u.c.smallText,xt]},i&&a.a.createElement(s.c,{style:Pt},function(e){switch(e){case"parse-error":return"Unable to parse file. Please select a JSON file exported from nYNAB.";case"not-ynab5":return"This file is not valid. Please select a JSON file exported from nYNAB.";default:return"An unknown error occurred while importing. Sorry! We have been notified of this issue."}}(i)),a.a.createElement(s.C,{style:kt},a.a.createElement(s.v,null,'You can import data from another Actual account or instance. First export your data from a different account, and it will give you a compressed file. This file is simple zip file that contains the "db.sqlite" and "metadata.json" files.'),a.a.createElement(s.v,null,"Select one of these compressed files and import it here."),a.a.createElement(s.C,{style:At},a.a.createElement(s.f,{loading:f,primary:!0,onClick:m},"Select file..."))),a.a.createElement(s.C,{style:Dt},a.a.createElement(s.C,{style:It}),a.a.createElement(s.d,{style:Tt,onClick:()=>e.onBack()},"Back"))))};function Rt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var _t={width:400},Lt={lineHeight:1.5,marginTop:20},zt={color:u.a.r4,marginBottom:15},Ft={alignItems:"center"},Nt={flexDirection:"row",marginTop:20,alignItems:"center"},Ut={flex:1},$t={marginRight:10};var Wt=function({modalProps:e,availableImports:t}){const n=Object(o.c)(),l=Rt(Object(r.useState)(!1),2),i=l[0],c=l[1],d=Rt(Object(r.useState)(!1),2),f=d[0],p=d[1];async function m(){const e=await window.Actual.openFileDialog({properties:["openFile"],filters:[{name:"ynab",extensions:["zip"]}]});if(e){p(!0),c(!1);try{await n(Object(y.h)(e[0],"ynab4"))}catch(t){c(t.message)}finally{p(!1)}}}return a.a.createElement(s.t,Object.assign({},e,{showHeader:!1,showOverlay:!1,noAnimation:!0,style:_t}),()=>a.a.createElement(s.C,{style:[u.c.smallText,Lt]},i&&a.a.createElement(s.c,{style:zt},function(e){switch(e){case"not-ynab4":return"This file is not valid. Please select a compressed ynab4 zip file.";default:return"An unknown error occurred while importing. Sorry! We have been notified of this issue."}}(i)),a.a.createElement(s.C,{style:Ft},a.a.createElement(s.v,null,'To import data from YNAB4, locate where your YNAB4 data is stored. It is usually in your Documents folder under YNAB. Your data is a directory inside that with the ".ynab4" suffix.'),a.a.createElement(s.v,null,"When you've located your data,"," ",a.a.createElement("strong",null,"compress it into a zip file"),'. On macOS, right-click the folder and select "Compress". On Windows, right-click and select "Send to > Compressed (zipped) folder". Upload the zipped folder for importing.'),a.a.createElement(s.C,null,a.a.createElement(s.f,{loading:f,primary:!0,onClick:m},"Select zip file..."))),a.a.createElement(s.C,{style:Nt},a.a.createElement(s.C,{style:Ut}),a.a.createElement(s.d,{style:$t,onClick:()=>e.onBack()},"Back"))))};function Gt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ht(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ht(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var qt={width:400},Yt={lineHeight:1.5,marginTop:20},Vt={color:u.a.r4,marginBottom:15},Kt={alignItems:"center","& > div":{lineHeight:"1.7em"}},Zt={flexDirection:"row",marginTop:20,alignItems:"center"},Qt={flex:1},Jt={marginRight:10};var Xt=function({modalProps:e,availableImports:t}){const n=Object(o.c)(),l=Gt(Object(r.useState)(!1),2),i=l[0],c=l[1],d=Gt(Object(r.useState)(!1),2),f=d[0],p=d[1];async function m(){const e=await window.Actual.openFileDialog({properties:["openFile"],filters:[{name:"ynab",extensions:["json"]}]});if(e){p(!0),c(!1);try{await n(Object(y.h)(e[0],"ynab5"))}catch(t){c(t.message)}finally{p(!1)}}}return a.a.createElement(s.t,Object.assign({},e,{showHeader:!1,showOverlay:!1,noAnimation:!0,style:qt}),()=>a.a.createElement(s.C,{style:[u.c.smallText,Yt]},i&&a.a.createElement(s.c,{style:Vt},function(e){switch(e){case"parse-error":return"Unable to parse file. Please select a JSON file exported from nYNAB.";case"not-ynab5":return"This file is not valid. Please select a JSON file exported from nYNAB.";default:return"An unknown error occurred while importing. Sorry! We have been notified of this issue."}}(i)),a.a.createElement(s.C,{style:Kt},a.a.createElement(s.v,null,a.a.createElement(s.i,{asAnchor:!0,href:"https://actualbudget.github.io/docs/Getting-Started/migration/nynab",target:"_blank"},"Read here")," ","for instructions on how to migrate your data from YNAB. You need to export your data as JSON, and that page explains how to do that."),a.a.createElement(s.v,null,"Once you have exported your data, select the file and Actual will import it. Budgets may not match up exactly because things work slightly differently, but you should be able to fix up any problems."),a.a.createElement(s.C,null,a.a.createElement(s.f,{loading:f,primary:!0,onClick:m},"Select file..."))),a.a.createElement(s.C,{style:Zt},a.a.createElement(s.C,{style:Qt}),a.a.createElement(s.d,{style:Jt,onClick:()=>e.onBack()},"Back"))))},en=n(242),tn=n(243),nn=n(244);function rn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function an(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rn(Object(n),!0).forEach(function(t){on(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function on(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ln={flex:1,padding:50};var cn=Object(o.b)(e=>({modalStack:e.modals.modalStack,isHidden:e.modals.isHidden,budgets:e.budgets.budgets,availableImports:e.budgets.availableImports,globalPrefs:e.prefs.global,allFiles:e.budgets.allFiles,isLoggedIn:!!e.user.data}),e=>({actions:Object(Y.b)(c,e)}))(function({modalStack:e,isHidden:t,allFiles:n,availableImports:r,globalPrefs:o,isLoggedIn:l,actions:i}){let c=e.map(({name:o,options:c},s)=>{const u={onClose:i.closeModal,onPush:i.pushModal,onBack:i.popModal,isCurrent:s===e.length-1,isHidden:t,stackIndex:s};switch(o){case"select-budget":return a.a.createElement(Qe,{key:o,modalProps:u,files:n,actions:i,isLoggedIn:l,onDownload:e=>i.downloadBudget(e)});case"delete-budget":return a.a.createElement(lt,{key:o,modalProps:u,actions:i,file:c.file});case"import":return a.a.createElement(Et,{key:o,modalProps:u,actions:i,availableImports:r});case"import-ynab4":return a.a.createElement(Wt,{key:o,modalProps:u,actions:i});case"import-ynab5":return a.a.createElement(Xt,{key:o,modalProps:u,actions:i});case"import-actual":return a.a.createElement(Mt,{key:o,modalProps:u,actions:i});case"load-backup":return a.a.createElement(q.a,{key:o,initialState:{backups:[]},didMount:async({setState:e})=>{e({backups:await Object(h.send)("backups-get",{id:c.budgetId})})}},({state:e})=>a.a.createElement(en.a,{budgetId:c.budgetId,modalProps:an(an({},u),{},{onClose:i.popModal}),backupDisabled:!0,actions:i,backups:e.backups}));case"create-encryption-key":return a.a.createElement(tn.a,{key:o,modalProps:u,actions:i,options:c});case"fix-encryption-key":return a.a.createElement(nn.a,{key:o,modalProps:u,actions:i,options:c});default:throw new Error("Unknown modal: "+o)}});return a.a.createElement(s.C,{style:ln},c)}),sn={position:"absolute",bottom:0,left:0,right:0,justifyContent:"center",flexDirection:"row",marginBottom:15,zIndex:5e3},un={marginLeft:15};function dn(){const e=Object(w.a)();return a.a.createElement(s.C,{style:sn},a.a.createElement(s.z,null,e?a.a.createElement(a.a.Fragment,null,"Using server: ",a.a.createElement("strong",null,e)):a.a.createElement("strong",null,"No server configured")),a.a.createElement(s.b,{bare:!0,to:"/config-server",style:un},"Change"))}function fn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var mn={display:"flex",flexDirection:"column",alignItems:"stretch",marginTop:30},yn={marginTop:10},gn={flexDirection:"row",alignItems:"center",fontSize:15,marginTop:20},hn={userSelect:"none"},bn={flex:1};function On({buttons:e,onSetPassword:t,onError:n}){let o=fn(Object(r.useState)(""),2),l=o[0],i=o[1],c=fn(Object(r.useState)(""),2),u=c[0],d=c[1],f=fn(Object(r.useState)(!1),2),p=f[0],m=f[1],y=fn(Object(r.useState)(!1),2),g=y[0],h=y[1];async function b(e){e.preventDefault(),g||(l===u?(h(!0),await t(l),h(!1)):n("password-match"))}return a.a.createElement("form",{style:mn,onSubmit:b},a.a.createElement(D,{autoFocus:!0,placeholder:"Password",type:p?"text":"password",value:l,onChange:e=>i(e.target.value),onEnter:b}),a.a.createElement(D,{placeholder:"Confirm password",type:p?"text":"password",value:u,onChange:e=>d(e.target.value),style:yn,onEnter:b}),a.a.createElement(s.C,{style:gn},a.a.createElement("label",{style:hn},a.a.createElement("input",{type:"checkbox",onChange:function(e){m(e.target.checked)}})," Show password"),a.a.createElement(s.C,{style:bn}),e,a.a.createElement(s.f,{primary:!0,loading:g},"OK")))}function wn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var En={maxWidth:450,marginTop:-30},jn={fontSize:16,color:u.a.n2,lineHeight:1.4},Sn={marginTop:20,color:u.a.r4,borderRadius:4,fontSize:15},Cn={fontSize:15,color:u.a.b4,marginRight:15};function xn(){let e=Object(o.c)(),t=wn(Object(r.useState)(null),2),n=t[0],l=t[1];return x().checked?a.a.createElement(a.a.Fragment,null,a.a.createElement(s.C,{style:En},a.a.createElement(k,{text:"Bootstrap this Actual instance"}),a.a.createElement(s.z,{style:jn},"Set a password for this server instance"),n&&a.a.createElement(s.z,{style:Sn},function(e){switch(e){case"invalid-password":return"Password cannot be empty";case"password-match":return"Passwords do not match";case"network-failure":return"Unable to contact the server";default:return"Whoops, an error occurred on our side! We'll try to get it fixed soon."}}(n)),a.a.createElement(On,{buttons:a.a.createElement(s.d,{bare:!0,style:Cn,onClick:async function(){await e(Object(y.d)({demoMode:!0}))}},"Try Demo"),onSetPassword:async function(t){l(null);let n=(await Object(h.send)("subscribe-bootstrap",{password:t})).error;n?l(n):e(Object(g.b)())},onError:l}))):null}function Pn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return kn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var An={maxWidth:500,marginTop:-30},Dn={fontSize:16,color:u.a.n2,lineHeight:1.4},In={marginTop:20,color:u.a.r4,borderRadius:4,fontSize:15},Tn={marginTop:20,color:u.a.g4,borderRadius:4,fontSize:15},Mn={fontSize:15,marginRight:10};function Rn(){let e=Object(l.g)(),t=Pn(Object(r.useState)(null),2),n=t[0],o=t[1],i=Pn(Object(r.useState)(null),2),c=i[0],u=i[1];return a.a.createElement(a.a.Fragment,null,a.a.createElement(s.C,{style:An},a.a.createElement(k,{text:"Change server password"}),a.a.createElement(s.z,{style:Dn},"This will change the password for this server instance. All existing sessions will stay logged in."),n&&a.a.createElement(s.z,{style:In},function(e){switch(e){case"invalid-password":return"Password cannot be empty";case"password-match":return"Passwords do not match";case"network-failure":return"Unable to contact the server";default:return"Internal server error"}}(n)),c&&a.a.createElement(s.z,{style:Tn},c),a.a.createElement(On,{buttons:a.a.createElement(s.d,{bare:!0,type:"button",style:Mn,onClick:()=>e.push("/")},"Cancel"),onSetPassword:async function(t){o(null);let n=(await Object(h.send)("subscribe-change-password",{password:t})).error;n?o(n):(u("Password successfully changed"),setTimeout(()=>{e.push("/")},1500))},onError:o})))}var Bn={alignItems:"center"},_n={fontSize:16,color:u.a.n2,lineHeight:1.4},Ln={marginTop:20};function zn(){let e=Object(l.g)(),t=(Object(l.h)().state||{}).error;return a.a.createElement(s.C,{style:Bn},a.a.createElement(s.z,{style:_n},function(e){switch(e){case"network-failure":return"Unable to access server. Make sure the configured URL for the server is accessible.";default:return"Server returned an error while checking its status."}}(t)),a.a.createElement(s.d,{onClick:function(){e.push("/")},style:Ln},"Try again"))}function Fn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Nn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Un={maxWidth:450,marginTop:-30},$n={fontSize:16,color:u.a.n2,lineHeight:1.4},Wn={marginTop:20,color:u.a.r4,borderRadius:4,fontSize:15},Gn={display:"flex",flexDirection:"row",marginTop:30},Hn={flex:1,marginRight:10},qn={fontSize:15},Yn={flexDirection:"row",justifyContent:"center",marginTop:15},Vn={fontSize:15,color:u.a.b4,marginLeft:10};function Kn(){let e=Object(o.c)(),t=Fn(Object(r.useState)(""),2),n=t[0],l=t[1],i=Fn(Object(r.useState)(!1),2),c=i[0],u=i[1],d=Fn(Object(r.useState)(null),2),f=d[0],p=d[1];return x().checked?a.a.createElement(a.a.Fragment,null,a.a.createElement(s.C,{style:Un},a.a.createElement(k,{text:"Sign in to this Actual instance"}),a.a.createElement(s.z,{style:$n},"If you lost your password, you likely still have access to your server to manually reset it."),f&&a.a.createElement(s.z,{style:Wn},function(e){switch(e){case"invalid-password":return"Invalid password";case"network-failure":return"Unable to contact the server";default:return"Whoops, an error occurred on our side! We'll try to get it fixed soon."}}(f)),a.a.createElement("form",{style:Gn,onSubmit:async function(t){if(t.preventDefault(),""===n||c)return;p(null),u(!0);let r=(await Object(h.send)("subscribe-sign-in",{password:n})).error;u(!1),r?p(r):e(Object(g.b)())}},a.a.createElement(D,{autoFocus:!0,placeholder:"Password",type:"password",onChange:e=>l(e.target.value),style:Hn}),a.a.createElement(s.f,{primary:!0,loading:c,style:qn},"Sign in")),a.a.createElement(s.C,{style:Yn},a.a.createElement(s.d,{bare:!0,style:Vn,onClick:async function(){await e(Object(y.d)({demoMode:!0}))}},"Try Demo \u2192")))):null}function Zn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jn={color:u.a.n7,":hover":{color:u.a.n2},margin:15,marginLeft:17,[`@media (min-width: ${d.a.breakpoint_medium})`]:{position:"absolute",bottom:0,right:0,marginLeft:15,marginRight:17,zIndex:5001}};function Xn(){const e=Object(f.a)();return a.a.createElement(s.z,{style:Jn,href:"https://actualbudget.github.io/docs/Release-Notes/"},`App: v${window.Actual.ACTUAL_VERSION} | Server: ${e}`)}var er={height:"100%",minHeight:500},tr={position:"absolute",top:0,left:0,right:0,height:40,WebkitAppRegion:"drag"},nr={position:"absolute",bottom:40,right:15},rr={position:"relative",left:"initial",right:"initial"},ar={alignItems:"center",bottom:0,justifyContent:"center",left:0,padding:20,position:"absolute",right:0,top:0},or={position:"absolute",top:0,right:0,padding:"6px 10px",zIndex:4e3},lr={padding:"4px 7px"};t.a=Object(o.b)(e=>{let t=e.modals.modalStack;return{files:e.budgets.allFiles,userData:e.user.data,managerHasInitialized:e.app.managerHasInitialized,loadingText:e.app.loadingText,currentModals:t.map(e=>e.name)}},c)(class extends a.a.Component{constructor(e){super(e),this.mounted=!0,this.history=Object(i.a)(),window.__history=this.history}async componentDidMount(){let e=null!=this.props.loadingText;this.props.managerHasInitialized?this.showModal():e||this.props.setAppState({loadingText:""}),await this.props.getUserData()&&await this.props.loadAllFiles(),this.props.setAppState(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zn(Object(n),!0).forEach(function(t){Qn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({managerHasInitialized:!0},e?null:{loadingText:null}))}async showModal(){if(this.props.managerHasInitialized){let e=this.props,t=e.currentModals,n=e.userData,r=e.files,a=e.replaceModal;r&&n&&(r.length>0?t.includes("select-budget")||a("select-budget"):this.props.createBudget())}}componentDidUpdate(e){this.mounted&&(this.props.managerHasInitialized===e.managerHasInitialized&&this.props.files===e.files&&this.props.userData===e.userData||this.showModal())}componentWillUnmount(){this.mounted=!1}render(){let e=this.props,t=e.userData,n=e.managerHasInitialized,r=e.loadingText;if(!n)return null;let o=null!=r;return a.a.createElement(l.c,{history:this.history},a.a.createElement(s.C,{style:er},a.a.createElement(s.C,{style:tr}),a.a.createElement(s.C,{style:nr},a.a.createElement(m.a,{style:rr})),!o&&a.a.createElement(s.C,{style:ar},t?a.a.createElement(a.a.Fragment,null,a.a.createElement(l.d,null,a.a.createElement(l.b,{exact:!0,path:"/config-server",component:H}),a.a.createElement(l.b,{exact:!0,path:"/change-password",component:Rn}),a.a.createElement(l.b,{exact:!0,path:"/",component:cn}),a.a.createElement(l.b,{path:"/",render:()=>a.a.createElement(l.a,{to:"/"})})),a.a.createElement(s.C,{style:or},a.a.createElement(l.d,null,a.a.createElement(l.b,{exact:!0,path:"/config-server",component:null}),a.a.createElement(l.b,{exact:!0,path:"/",render:()=>a.a.createElement(p.a,{style:lr})})))):a.a.createElement(l.d,null,a.a.createElement(l.b,{exact:!0,path:"/login",component:Kn}),a.a.createElement(l.b,{exact:!0,path:"/error",component:zn}),a.a.createElement(l.b,{exact:!0,path:"/config-server",component:H}),a.a.createElement(l.b,{exact:!0,path:"/bootstrap",component:xn}),a.a.createElement(l.b,{path:"/",render:()=>a.a.createElement(l.a,{to:"/bootstrap"})}))),a.a.createElement(l.d,null,a.a.createElement(l.b,{exact:!0,path:"/config-server",component:null}),a.a.createElement(l.b,{path:"/",component:dn})),a.a.createElement(Xn,null)))}})},612:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(31),l=n(43),i=n(33),c=n(1),s=n(2);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=e=>r.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:d({color:"#242134"},e.style)}),r.createElement("path",{d:"M10 8.586 2.929 1.515 1.515 2.929 8.586 10l-7.071 7.071 1.414 1.414L10 11.414l7.071 7.071 1.414-1.414L11.414 10l7.071-7.071-1.414-1.414L10 8.586z",fill:"currentColor"}));var m={position:"absolute",bottom:0,right:0,margin:"15px 17px",backgroundColor:s.a.p6,color:"white",padding:"7px 10px",borderRadius:4,zIndex:1e4,maxWidth:450},y={flexDirection:"row",alignItems:"center"},g={marginRight:10,fontWeight:700},h={flex:1},b={marginTop:-1},O={color:"white",textDecoration:"underline"},w={color:"white",textDecoration:"underline"},v={display:"inline",padding:"1px 7px 2px 7px"},E={color:"white"},j={marginTop:10,fontWeight:500};t.a=Object(o.b)(e=>({updateInfo:e.app.updateInfo,showUpdateNotification:e.app.showUpdateNotification}),e=>Object(l.b)(i,e))(function({updateInfo:e,showUpdateNotification:t,updateApp:n,setAppState:r}){if(e&&t){let t=e.releaseNotes;return a.a.createElement(c.C,{style:m},a.a.createElement(c.C,{style:y},a.a.createElement(c.C,{style:g},a.a.createElement(c.z,null,"App updated to ",e.version)),a.a.createElement(c.C,{style:h}),a.a.createElement(c.C,{style:b},a.a.createElement(c.z,null,a.a.createElement(c.r,{onClick:n,style:O},"Restart")," ","(",a.a.createElement(c.r,{style:w,onClick:()=>window.Actual.openURLInBrowser("https://actualbudget.github.io/docs/Release-Notes/")},"notes"),")",a.a.createElement(c.d,{bare:!0,style:v,onClick:()=>(function(e){e({updateInfo:null,showUpdateNotification:!1})})(r)},a.a.createElement(p,{width:9,style:E}))))),t&&a.a.createElement(c.C,{style:j},t))}return null})},618:function(e,t,n){"use strict";function r(e){console.log("[Exception]",e)}function a(e){}n.r(t),n.d(t,"captureException",function(){return r}),n.d(t,"captureBreadcrumb",function(){return a})},62:function(e,t,n){"use strict";n.d(t,"d",function(){return a}),n.d(t,"e",function(){return o}),n.d(t,"b",function(){return l}),n.d(t,"f",function(){return i}),n.d(t,"c",function(){return c}),n.d(t,"a",function(){return s});var r=n(11);function a(e,t){return{type:r.a.PUSH_MODAL,name:e,options:t}}function o(e,t){return{type:r.a.REPLACE_MODAL,name:e,options:t}}function l(){return{type:r.a.HIDE_MODALS}}function i(){return{type:r.a.SHOW_MODALS}}function c(){return{type:r.a.POP_MODAL}}function s(){return{type:r.a.CLOSE_MODAL}}},65:function(e,t,n){"use strict";const r=navigator.platform&&"win32"===navigator.platform.toLowerCase(),a=navigator.platform&&navigator.platform.toUpperCase().indexOf("MAC")>=0,o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);t.a={OS:r?"windows":a?"mac":"linux",env:"web",isBrowser:!!window.Actual.IS_FAKE_WEB,isReactNativeWeb:!1,isProbablySafari:o}},66:function(e,t,n){"use strict";n.d(t,"m",function(){return f}),n.d(t,"k",function(){return p}),n.d(t,"l",function(){return m}),n.d(t,"i",function(){return y}),n.d(t,"j",function(){return g}),n.d(t,"b",function(){return h}),n.d(t,"c",function(){return b}),n.d(t,"e",function(){return O}),n.d(t,"d",function(){return w}),n.d(t,"h",function(){return v}),n.d(t,"n",function(){return E}),n.d(t,"a",function(){return j}),n.d(t,"f",function(){return S}),n.d(t,"g",function(){return C});var r=n(3),a=n(138),o=n(11),l=n(74),i=n(62),c=n(101),s=n(158);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){return(t,n)=>{null!=n().app.loadingText&&t(Object(l.b)({loadingText:e}))}}function p(){return async e=>{const t=await Object(r.send)("get-budgets");e({type:o.a.SET_BUDGETS,budgets:t})}}function m(){return async e=>{const t=await Object(r.send)("get-remote-files");e({type:o.a.SET_REMOTE_FILES,files:t})}}function y(){return async(e,t)=>{const n=await Object(r.send)("get-budgets"),a=await Object(r.send)("get-remote-files");return e({type:o.a.SET_ALL_FILES,budgets:n,remoteFiles:a}),t().budgets.allFiles}}function g(e,t="",n={}){return async(a,o)=>{a(Object(l.b)({loadingText:t}));let f=(await Object(r.send)("load-budget",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:e},n))).error;if(f){if("out-of-sync-migrations"===f||"out-of-sync-data"===f)if("undefined"!==typeof confirm){confirm("This budget cannot be loaded with this version of the app. Make sure the app is up-to-date. Do you want to load a backup?")&&a(Object(i.d)("load-backup",{budgetId:e}))}else alert("This budget cannot be loaded with this version of the app. Make sure the app is up-to-date.");else"budget-not-found"===f?alert("Budget file could not be found. If you changed something manually, please restart the app."):alert("Error loading budget. Please open a issue on GitHub for support.");return void a(Object(l.b)({loadingText:null}))}a(Object(i.a)()),await a(Object(c.b)());const p=o().prefs.local;a(Object(l.b)({loadingText:null})),a(Object(l.b)({maxMonths:p.maxMonths})),a(Object(s.a)())}}function h(){return async(e,t)=>{const n=t().prefs.local;n&&n.id&&(e({type:o.a.CLOSE_BUDGET}),e(Object(l.b)({loadingText:"Closing..."})),await Object(r.send)("close-budget"),e(Object(l.b)({loadingText:null})),localStorage.getItem("SharedArrayBufferOverride")&&location.reload())}}function b(){return async(e,t)=>{let n=t().prefs.local;n&&n.id&&e({type:o.a.CLOSE_BUDGET})}}function O(e,t){return async n=>{await Object(r.send)("delete-budget",{id:e,cloudFileId:t}),await n(y())}}function w({testMode:e,demoMode:t}={}){return async(n,a)=>{n(Object(l.b)({loadingText:e||t?"Making demo...":""})),t?await Object(r.send)("create-demo-budget"):await Object(r.send)("create-budget",{testMode:e}),n(Object(i.a)()),await n(y()),await n(Object(c.b)()),n(Object(s.a)()),n(Object(l.b)({loadingText:null}))}}function v(e,t){return async(n,a)=>{const o=(await Object(r.send)("import-budget",{filepath:e,type:t})).error;if(o)throw new Error(o);n(Object(i.a)()),await n(Object(c.b)()),n(Object(s.a)())}}function E(e){return async t=>{let n=(await Object(r.send)("upload-budget",{id:e})).error;return n?{error:n}:(await t(y()),{})}}function j(e){return async t=>{t(Object(l.b)({loadingText:"Downloading..."})),await t(h()),t(S(e,{replace:!0}))}}function S(e,{replace:t}={}){return async n=>{n(Object(l.b)({loadingText:"Downloading..."}));let o=await Object(r.send)("download-budget",{fileId:e,replace:t}),s=o.id,u=o.error;if(u){if("decrypt-failure"===u.reason){let r={hasExistingKey:u.meta&&u.meta.isMissingKey,cloudFileId:e,onSuccess:()=>{n(S(e,{replace:t}))}};n(Object(i.d)("fix-encryption-key",r)),n(Object(l.b)({loadingText:null}))}else{if("file-exists"===u.reason)return alert(`A file with id "${u.meta.id}" already exists with the name "${u.meta.name}". `+"This file will be replaced. This probably happened because files were manually moved around outside of Actual."),n(S(e,{replace:!0}));n(Object(l.b)({loadingText:null})),alert(Object(a.b)(u))}return null}return await Promise.all([n(Object(c.a)()),n(y()),n(g(s))]),n(Object(l.b)({loadingText:null})),s}}function C(){return async e=>{let t=await Object(r.send)("get-ynab4-files");return e({type:"SET_AVAILABLE_IMPORTS",imports:t}),t}}},69:function(e,t,n){"use strict";n.d(t,"a",function(){return u}),n.d(t,"b",function(){return d}),n.d(t,"e",function(){return f}),n.d(t,"d",function(){return p}),n.d(t,"c",function(){return m});var r=n(58),a=n(10),o=n(11);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const s={newTransactions:[],matchedTransactions:[],lastTransaction:null,updatedAccounts:[],accounts:[],categories:{grouped:[],list:[]},payees:[],earliestTransaction:null};function u(e=s,t){switch(t.type){case o.a.SET_NEW_TRANSACTIONS:return i(i({},e),{},{newTransactions:t.newTransactions||[],matchedTransactions:t.matchedTransactions||[],updatedAccounts:t.updatedAccounts||[]});case o.a.UPDATE_NEW_TRANSACTIONS:return i(i({},e),{},{newTransactions:e.newTransactions.filter(e=>e!==t.changedId),matchedTransactions:e.matchedTransactions.filter(e=>e!==t.changedId)});case o.a.SET_LAST_TRANSACTION:return i(i({},e),{},{lastTransaction:t.transaction});case o.a.MARK_ACCOUNT_READ:return i(i({},e),{},{updatedAccounts:e.updatedAccounts.filter(e=>e!==t.accountId)});case o.a.LOAD_ACCOUNTS:return i(i({},e),{},{accounts:t.accounts});case o.a.UPDATE_ACCOUNT:return i(i({},e),{},{accounts:e.accounts.map(e=>e.id===t.account.id?i(i({},e),t.account):e)});case o.a.LOAD_CATEGORIES:return i(i({},e),{},{categories:t.categories});case o.a.LOAD_PAYEES:return i(i({},e),{},{payees:t.payees});case o.a.ADD_CATEGORY:{let n={id:"temp",name:t.name};return i(i({},e),{},{categories:{grouped:e.categories.grouped.map(e=>e.id===t.groupId?i(i({},e),{},{categories:[n,...e.categories]}):e),list:[n,...e.categories.list]}})}case o.a.DELETE_CATEGORY:return i(i({},e),{},{categories:{grouped:e.categories.grouped.map(e=>i(i({},e),{},{categories:e.categories.filter(e=>e.id!==t.id)})),list:e.categories.list.filter(e=>e.id!==t.id)}})}return e}const d=Object(r.a)(e=>Object(a.i)(e)),f=Object(r.a)(e=>Object(a.i)(e)),p=Object(r.a)(e=>{let t={};return e.forEach(e=>{e.categories.forEach(e=>{t[e.id]=e})}),t}),m=Object(r.a)((e,t)=>{let n=d(t);return e.filter(e=>{if(e.transfer_acct){let t=n[e.transfer_acct];return null!=t&&!t.closed}return!0})})},71:function(e,t,n){"use strict";var r=n(0),a=n.n(r);t.a=a.a.createContext(void 0)},73:function(e,t,n){"use strict";t.a={breakpoint_narrow:"512px",breakpoint_medium:"768px",breakpoint_wide:"1024px"}},74:function(e,t,n){"use strict";(function(e){n.d(t,"b",function(){return o}),n.d(t,"d",function(){return l}),n.d(t,"c",function(){return i}),n.d(t,"e",function(){return c}),n.d(t,"a",function(){return s});var r=n(3),a=n(11);function o(e){return{type:a.a.SET_APP_STATE,state:e}}function l(){return async t=>{e.Actual.applyAppUpdate(),t(o({updateInfo:null}))}}function i(e){return{type:a.a.SET_LAST_UNDO_STATE,undoState:e}}function c(e,t){return n=>Object(r.send)("upload-file-web",{filename:e,contents:t})}function s(){return e=>Object(r.send)("app-focused")}}).call(this,n(15))},75:function(e,t,n){"use strict";n.d(t,"b",function(){return r}),n.d(t,"a",function(){return l});const r={ESC:27,TAB:9,ENTER:13,SHIFT:16,ALT:18,META:91,CTRL:17,SPACE:32,UP:38,DOWN:40,J:74,K:75,X:88};let a={},o={shift:!1,ctrl:!1,alt:!1,meta:!1};function l(e){return!!o[e]}document.addEventListener("keydown",e=>{if(e.keyCode===r.SHIFT&&(o.shift=!0),e.keyCode===r.CTRL&&(o.ctrl=!0),e.keyCode===r.ALT&&(o.alt=!0),e.keyCode===r.META&&(o.meta=!0),!e.target||!e.target.matches("input")){let t=a[e.key.toUpperCase()];t&&t.length>0&&(t[t.length-1](o),e.preventDefault(),e.stopPropagation())}}),document.addEventListener("keyup",e=>{e.keyCode===r.SHIFT&&(o.shift=!1),e.keyCode===r.CTRL&&(o.ctrl=!1),e.keyCode===r.ALT&&(o.alt=!1),e.keyCode===r.META&&(o.meta=!1)})},77:function(e,t,n){"use strict";var r=n(0),a=n.n(r);t.a=a.a.createContext(void 0)},78:function(e,t,n){"use strict";n.d(t,"a",function(){return d}),n.d(t,"k",function(){return f}),n.d(t,"d",function(){return p}),n.d(t,"g",function(){return m}),n.d(t,"v",function(){return y}),n.d(t,"n",function(){return g}),n.d(t,"o",function(){return h}),n.d(t,"e",function(){return b}),n.d(t,"w",function(){return O}),n.d(t,"h",function(){return w}),n.d(t,"l",function(){return v}),n.d(t,"m",function(){return E}),n.d(t,"f",function(){return j}),n.d(t,"j",function(){return S}),n.d(t,"u",function(){return C}),n.d(t,"c",function(){return x}),n.d(t,"p",function(){return P}),n.d(t,"b",function(){return k}),n.d(t,"r",function(){return A}),n.d(t,"i",function(){return D}),n.d(t,"s",function(){return R}),n.d(t,"t",function(){return B}),n.d(t,"q",function(){return _});var r=n(301),a=n.n(r),o=n(3),l=n(11),i=n(62),c=n(128);const s=["categories"];function u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function d(e,t,n){return async function(){switch(t){case"budget-amount":await Object(o.send)("budget/budget-amount",{month:e,category:n.category,amount:n.amount});break;case"copy-last":await Object(o.send)("budget/copy-previous-month",{month:e});break;case"set-zero":await Object(o.send)("budget/set-zero",{month:e});break;case"set-3-avg":await Object(o.send)("budget/set-3month-avg",{month:e});break;case"apply-goal-template":await Object(o.send)("budget/apply-goal-template",{month:e});break;case"overwrite-goal-template":await Object(o.send)("budget/overwrite-goal-template",{month:e});break;case"hold":await Object(o.send)("budget/hold-for-next-month",{month:e,amount:n.amount});break;case"reset-hold":await Object(o.send)("budget/reset-hold",{month:e});break;case"cover":await Object(o.send)("budget/cover-overspending",{month:e,to:n.to,from:n.from});break;case"transfer-available":await Object(o.send)("budget/transfer-available",{month:e,amount:n.amount,category:n.category});break;case"transfer-category":await Object(o.send)("budget/transfer-category",{month:e,amount:n.amount,from:n.from,to:n.to});break;case"carryover":await Object(o.send)("budget/set-carryover",{startMonth:e,category:n.category,flag:n.flag})}}}function f(){return async function(e){const t=await Object(o.send)("get-categories");return e({type:l.a.LOAD_CATEGORIES,categories:t}),t}}function p(e,t,n){return async function(r){let a=await Object(o.send)("category-create",{name:e,groupId:t,isIncome:n});return r(f()),a}}function m(e,t){return async function(n,r){let a=(await Object(o.send)("category-delete",{id:e,transferId:t})).error;if(a){switch(a){case"category-type":n(Object(c.b)({type:"error",message:"A category must be transferred to another of the same type (expense or income)"}));break;default:n(Object(c.a)())}throw new Error(a)}n(f()),n(v())}}function y(e){return async t=>{await Object(o.send)("category-update",e),t(f())}}function g(e,t,n){return async(r,a)=>{await Object(o.send)("category-move",{id:e,groupId:t,targetId:n}),await r(f())}}function h(e,t){return async n=>{await Object(o.send)("category-group-move",{id:e,targetId:t}),await n(f())}}function b(e){return async t=>{let n=await Object(o.send)("category-group-create",{name:e});return t(f()),n}}function O(e){e.categories;const t=u(e,s);return async e=>{await Object(o.send)("category-group-update",t),await e(f())}}function w(e,t){return async function(n,r){await Object(o.send)("category-group-delete",{id:e,transferId:t}),await n(f()),await n(v())}}function v(){return async function(e){let t=await Object(o.send)("payees-get");return e({type:l.a.LOAD_PAYEES,payees:t}),t}}function E(){return async function(e,t){if(0===t().queries.payees.length)return e(v())}}function j(e){return async t=>Object(o.send)("payee-create",{name:e.trim()})}function S(){return async function(e){const t=await Object(o.send)("accounts-get");return e({type:l.a.LOAD_ACCOUNTS,accounts:t}),t}}function C(e){return async function(t){t({type:l.a.UPDATE_ACCOUNT,account:e}),await Object(o.send)("account-update",e)}}function x(e,t,n,r){return async function(a){let l=await Object(o.send)("account-create",{name:e,type:t,balance:n,offBudget:r});return await a(S()),await a(v()),l}}function P(e){return async function(t,n){const r=await Object(o.send)("account-properties",{id:e}),a=r.balance,l=r.numTransactions,c=n().queries.accounts.find(t=>t.id===e);t(Object(i.d)("close-account",{account:c,balance:a,canDelete:0===l}))}}function k(e,t,n,r){return async function(a){await Object(o.send)("account-close",{id:e,transferAccountId:t,categoryId:n,forced:r}),a(S())}}function A(e){return async function(t){await Object(o.send)("account-reopen",{id:e}),t(S())}}function D(e){return k(e,null,null,!0)}let I=a()(()=>Object(o.send)("undo"),100),T=a()(()=>Object(o.send)("redo"),100),M=!0;function R(e){M=e}function B(){return async()=>{M&&I()}}function _(){return async()=>{M&&T()}}},79:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(14);const l=["numberOfLines","style","innerRef"];function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}t.a=function(e){e.numberOfLines,e.style;const t=e.innerRef,n=i(e,l);return a.a.createElement("span",Object.assign({},n,{ref:t,className:`${e.className||""} ${Object(o.css)(e.style)}`}))}},814:function(e,t,n){"use strict";n.r(t);n(457),n(458),n(460);var r=n(0),a=n.n(r),o=n(87),l=n.n(o),i=n(31),c=n(43),s=n(608),u=n(33),d=n(11),f=n(34);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const g={banks:[],failedAccounts:new Map,accountsSyncing:null};function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach(function(t){O(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const w={loadingText:null,updateInfo:null,showUpdateNotification:!0,managerHasInitialized:!1,lastUndoState:{current:null},lastSplitState:{current:null}};function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach(function(t){j(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e,t){let n=new Set,r=e.map(e=>{if(e.cloudFileId){if(null==t)return E(E({},e),{},{state:"unknown"});let r=t.find(t=>e.cloudFileId===t.fileId);return r?(n.add(r.fileId),r.groupId===e.groupId?E(E({},e),{},{name:r.name,deleted:r.deleted,encryptKeyId:r.encryptKeyId,hasKey:r.hasKey,state:"synced"}):E(E({},e),{},{name:r.name,deleted:r.deleted,encryptKeyId:r.encryptKeyId,hasKey:r.hasKey,state:"detached"})):E(E({},e),{},{state:"broken"})}return E(E({},e),{},{state:"local"})}),a=((o=r.concat((t||[]).filter(e=>!n.has(e.fileId)).map(e=>({cloudFileId:e.fileId,groupId:e.groupId,name:e.name,deleted:e.deleted,encryptKeyId:e.encryptKeyId,hasKey:e.hasKey,state:"remote"}))).filter(e=>!e.deleted)).sort((e,t)=>{let n=e.name.toLowerCase(),r=t.name.toLowerCase(),a=n<r?-1:n>r?1:0;return 0===a&&(a=e.id<t.id?-1:e.id>t.id?1:0),a}),o);var o;return a.filter(e=>"broken"!==e.state).concat(a.filter(e=>"broken"===e.state))}const C={budgets:[],availableImports:[],remoteFiles:null,allFiles:null};function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const A={selectedCell:null};var D=function(e=A,t){switch(t.type){case d.a.DEBUG_CELL:return P(P({},e),{},{selectedCell:t.sheet?{sheet:t.sheet,name:t.name}:null})}return e};function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I(Object(n),!0).forEach(function(t){M(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const R={modalStack:[],isHidden:!1};var B=function(e=R,t){switch(t.type){case d.a.PUSH_MODAL:return T(T({},e),{},{modalStack:[...e.modalStack,{name:t.name,options:t.options}]});case d.a.REPLACE_MODAL:return T(T({},e),{},{modalStack:[{name:t.name,options:t.options}]});case d.a.POP_MODAL:return T(T({},e),{},{modalStack:e.modalStack.slice(0,-1)});case d.a.CLOSE_MODAL:return T(T({},e),{},{modalStack:[]});case d.a.HIDE_MODALS:return T(T({},e),{},{isHidden:!0});case d.a.SHOW_MODALS:return T(T({},e),{},{isHidden:!1});case d.a.SET_APP_STATE:if("loadingText"in t.state)return T(T({},e),{},{isHidden:null!=t.state.loadingText});break;case d.a.SIGN_OUT:return R}return e};function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach(function(t){z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const F={notifications:[]};var N=n(10);function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U(Object(n),!0).forEach(function(t){W(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const G={local:null,global:null};function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach(function(t){Y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const V={};var K=n(69);function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){J(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const X={stage:null,fromYNAB:!1};function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach(function(t){ne(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const re={data:null};var ae={app:function(e=w,t){switch(t.type){case d.a.SET_APP_STATE:return b(b({},e),t.state);case d.a.SET_LAST_UNDO_STATE:return e.lastUndoState.current=t.undoState,e;case d.a.SET_LAST_SPLIT_STATE:return e.lastSplitState.current=t.splitState,e}return e},queries:K.a,account:function(e=g,t){switch(t.type){case d.a.LOAD_BANKS:return m(m({},e),{},{banks:t.banks});case d.a.SET_ACCOUNTS_SYNCING:return m(m({},e),{},{accountsSyncing:t.name});case d.a.ACCOUNT_SYNC_STATUS:{let n=new Map(e.failedAccounts);return t.failed?n.set(t.id,{type:t.errorType,code:t.errorCode}):n.delete(t.id),m(m({},e),{},{failedAccounts:n})}case d.a.ACCOUNT_SYNC_FAILURES:{let n=new Map;return t.syncErrors.forEach(e=>{n.set(e.id,{type:e.type,code:e.code})}),m(m({},e),{},{failedAccounts:n})}}return e},debug:D,profile:function(e=V,t){switch(t.type){case d.a.SET_PROFILE:return q(q({},e),t.profile)}return e},prefs:function(e=G,t){switch(t.type){case d.a.SET_PREFS:return t.prefs&&Object(N.o)(t.prefs.numberFormat||"comma-dot"),{local:t.prefs,global:t.globalPrefs};case d.a.MERGE_LOCAL_PREFS:return t.prefs.numberFormat&&Object(N.o)(t.prefs.numberFormat),$($({},e),{},{local:$($({},e.local),t.prefs)});case d.a.MERGE_GLOBAL_PREFS:return $($({},e),{},{global:$($({},e.global),t.globalPrefs)})}return e},modals:B,notifications:function(e=F,t){switch(t.type){case d.a.ADD_NOTIFICATION:return e.notifications.find(e=>e.id===t.notification.id)?e:L(L({},e),{},{notifications:[...e.notifications,t.notification]});case d.a.REMOVE_NOTIFICATION:return L(L({},e),{},{notifications:e.notifications.filter(e=>e.id!==t.id)})}return e},budgets:function(e=C,t){switch(t.type){case d.a.SET_BUDGETS:return E(E({},e),{},{budgets:t.budgets,allFiles:S(t.budgets,e.remoteFiles)});case d.a.SET_REMOTE_FILES:return E(E({},e),{},{remoteFiles:t.files,allFiles:S(e.budgets,t.files)});case d.a.SET_ALL_FILES:return E(E({},e),{},{budgets:t.budgetes,remoteFiles:t.remoteFiles,allFiles:S(t.budgets,t.remoteFiles)});case d.a.SET_AVAILABLE_IMPORTS:return E(E({},e),{},{availableImports:t.imports});case d.a.SIGN_OUT:return E(E({},e),{},{allFiles:null})}return e},tutorial:function(e=X,t){switch(t.type){case d.a.SET_TUTORIAL_STAGE:return Q(Q({},e),{},{deactivated:!1,stage:t.stage,fromYNAB:"fromYNAB"in t?t.fromYNAB:e.fromYNAB});case d.a.DEACTIVATE_TUTORIAL:return Q(Q({},e),{},{stage:null})}return e},user:function(e=re,t){switch(t.type){case d.a.GET_USER_DATA:return te(te({},e),{},{data:t.data})}return e}},oe=n(3),le=n(443),ie=n(606);function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){ue(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n(813);const de=Object(c.c)(ae);const fe=Object(c.d)(function(e,t){return t.type===d.a.CLOSE_BUDGET&&(e={budgets:e.budgets,user:e.user,prefs:{local:null,global:e.prefs.global},app:se(se({},w),{},{updateInfo:e.updateInfo,showUpdateNotification:e.showUpdateNotification,managerHasInitialized:e.app.managerHasInitialized,loadingText:e.app.loadingText})}),de(e,t)},void 0,Object(c.a)(s.a)),pe=Object(c.b)(u,fe.dispatch);Object(ie.a)(pe,fe),window.__actionsForMenu=pe,window.$send=oe.send,window.$query=f.f,window.$q=f.c,l.a.render(a.a.createElement(i.a,{store:fe},a.a.createElement(le.a,null)),document.getElementById("root"))},9:function(e,t,n){"use strict";(function(e){n.d(t,"g",function(){return U}),n.d(t,"e",function(){return K}),n.d(t,"a",function(){return J}),n.d(t,"h",function(){return ee}),n.d(t,"f",function(){return ae}),n.d(t,"c",function(){return le}),n.d(t,"d",function(){return se}),n.d(t,"b",function(){return de}),n.d(t,"i",function(){return ye}),n.d(t,"k",function(){return ge}),n.d(t,"m",function(){return Ee}),n.d(t,"j",function(){return xe}),n.d(t,"n",function(){return ke}),n.d(t,"l",function(){return Ie}),n.d(t,"o",function(){return Te});var r=n(0),a=n.n(r),o=n(31),l=n(160),i=n(129),c=n(2),s=n(48),u=n(115),d=n(114),f=n(205),p=n(75),m=n(1),y=n(97),g=n(470),h=n(204),b=n(42),O=n(93),w=n(189),v=n(26);const E=["width","name","borderColor","truncate","children","style","contentStyle"],j=["width","name","exposed","focused","value","formatter","textAlign","onExpose","borderColor","children","plain","style","valueStyle"],S=["backgroundColor","borderColor","inset","collapsed","focused","highlighted","children","height","style"],C=["value","onUpdate","onBlur"],x=["inputProps","onUpdate","onBlur","textAlign","error"],P=["value","children","onUpdate","onBlur"],k=["dateSelectProps"],A=["onDelete","style"],D=["focused","selected","partial","style","onSelect","onEdit"],I=["valueProps","valueStyle","inputProps","sync","textAlign","onSave"],T=["headers","children","version"],M=["fields"],R=["items","count","headers","contentHeader","loading","rowHeight","backgroundColor","renderItem","renderEmpty","getItemKey","loadMore","style","navigator","listRef","onScroll","version","animated","allowPopupsEscape","isSelected"];function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach(function(t){L(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function N(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const U=32,$=c.a.n11;function W(e,t){document.hasFocus()?e&&e(t):t.stopPropagation()}const G=a.a.createContext({backgroundColor:"white",borderColor:c.a.n9});function H({backgroundColor:e,borderColor:t,children:n}){let o=Object(r.useMemo)(()=>({backgroundColor:e,borderColor:t}),[e,t]);return a.a.createElement(G.Provider,{value:o},n)}var q={flex:1,flexBasis:0},Y={flex:1,padding:"0 5px",justifyContent:"center"},V={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};const K=a.a.forwardRef(function(e,t){let n=e.width,o=e.name,l=e.borderColor,i=e.truncate,s=void 0===i||i,u=e.children,d=e.style,f=e.contentStyle,p=N(e,E),y=Object(r.useContext)(G),g=y.backgroundColor,h=y.borderColor;return l&&(h=l),a.a.createElement(m.C,Object.assign({innerRef:t},p,{style:["flex"===n?q:{width:n},{position:"relative",borderTopWidth:h?1:0,borderBottomWidth:h?1:0,borderColor:h,backgroundColor:g},c.c.smallText,d],"data-testid":o}),a.a.createElement(m.C,{style:[Y,f]},s?a.a.createElement(m.z,{style:V},u):u))});var Z={flex:1,padding:"0 5px",justifyContent:"center"},Q={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function J(t){let n=t.width,o=t.name,l=t.exposed,i=t.focused,s=t.value,u=t.formatter,d=t.textAlign,f=t.onExpose,p=t.borderColor,y=t.children,g=t.plain,h=t.style,b=t.valueStyle,O=N(t,j),v=Object(r.useRef)(null),E=Object(r.useRef)(null),S=Object(r.useContext)(G),C=S.backgroundColor,x=S.borderColor;Object(w.b)(E,void 0!==i?i:l),p&&(x=p);const P="flex"===n?{flex:1,flexBasis:0}:{width:n},k={position:"relative",textAlign:d||"left",justifyContent:"center",borderTopWidth:x?1:0,borderBottomWidth:x?1:0,borderColor:x,backgroundColor:C};return a.a.createElement(m.C,Object.assign({innerRef:E,style:[P,k,h],className:"animated-cell"},O,{"data-testid":o}),g?y:l?y():a.a.createElement(m.C,{style:[Z,c.c.smallText,b],onMouseDown:e=>v.current=[e.clientX,e.clientY],onMouseUp:e=>{v.current&&Math.abs(e.clientX-v.current[0])<5&&Math.abs(e.clientY-v.current[1])<5&&f&&f(o)},onClick:e.IS_TESTING&&(()=>f&&f(o))},a.a.createElement(m.z,{style:Q},u?u(s):s)))}var X={marginTop:-1};function ee(e){let t=e.backgroundColor,n=void 0===t?"white":t,o=e.borderColor,l=void 0===o?c.a.border:o,i=e.inset,s=void 0===i?0:i,u=e.collapsed,d=(e.focused,e.highlighted),f=e.children,p=e.height,y=e.style,g=N(e,S),h=z(Object(r.useState)(!1),2),b=h[0],O=h[1],w=Object(r.useRef)(!1),v=Object(r.useRef)(null),E=Object(r.useRef)(null);return Object(r.useEffect)(()=>{d&&!w.current&&v.current&&(v.current.classList.add("animated"),O(!0),clearTimeout(E.current),E.current=setTimeout(()=>{O(!1),E.current=setTimeout(()=>{v.current&&v.current.classList.remove("animated")},500)},500))},[d]),Object(r.useEffect)(()=>{w.current=d}),a.a.createElement(H,{backgroundColor:b?c.a.y9:n,borderColor:b?c.a.y8:l},a.a.createElement(m.C,Object.assign({innerRef:v,style:[{flexDirection:"row",height:p||U,flex:"0 0 "+(p||U)+"px",userSelect:"text","&.animated .animated-cell":{transition:".7s background-color"}},u&&X,y],"data-testid":"row"},g),0!==s&&a.a.createElement(K,{width:s}),f,0!==s&&a.a.createElement(K,{width:s})))}const te={backgroundColor:"white",padding:"5px 3px",margin:"0 1px"},ne={backgroundColor:"transparent","::selection":{backgroundColor:"#d9d9d9"}};function re(e){let t=e.value,n=e.onUpdate,o=e.onBlur,l=N(e,C),i=z(Object(r.useState)(t),2),c=i[0],s=i[1];return a.a.createElement(m.n,Object.assign({},l,{value:c,onUpdate:e=>s(e),onBlur:function(e){n&&n(c),o&&W(o,e)},onKeyDown:function(e){e.keyCode!==p.b.ENTER&&e.keyCode!==p.b.TAB&&e.stopPropagation(),e.keyCode===p.b.ESC?c!==t&&s(t):oe(e)&&n&&n(c)},style:[te,l.readOnly?ne:null,l.style]}))}function ae(e){let t=e.inputProps,n=e.onUpdate,r=e.onBlur,o=e.textAlign,l=e.error,i=N(e,x);var c={textAlign:o};return a.a.createElement(J,Object.assign({textAlign:o},i),()=>a.a.createElement(a.a.Fragment,null,a.a.createElement(re,Object.assign({value:i.value,onUpdate:n,onBlur:r,style:[c,t&&t.style]},t)),l&&a.a.createElement(m.B,{key:"error",targetHeight:U,width:180,position:"bottom-left"},l)))}function oe(e){switch(e.keyCode){case p.b.TAB:case p.b.ENTER:return e.preventDefault(),!0}}function le(e){let t=e.value,n=e.children,o=e.onUpdate,l=e.onBlur,i=N(e,P),c=z(Object(r.useState)(t),2),s=c[0],u=c[1],d=z(Object(r.useState)(t),2),f=d[0],p=d[1];function m(e){document.hasFocus()&&(o&&o(s),W(l,e))}function y(e){oe(e)&&o&&o(s)}return f!==t&&(u(t),p(t)),a.a.createElement(J,Object.assign({},i,{value:t}),()=>n({onBlur:m,onKeyDown:y,onUpdate:e=>u(e),onSave:e=>{u(e),o&&o(e)},shouldSaveFromKey:oe,inputStyle:te}))}var ie={minWidth:225};Object(i.scope)(e=>{return e(function(e){let t=e.props,n=t.dateSelectProps,r=N(t,k);e.updater;const o=n.inputProps,l=void 0===o?{}:o;return a.a.createElement(J,Object.assign({},r,{style:_({zIndex:r.exposed?1:0},r.style)}),()=>a.a.createElement(y.a,Object.assign({},n,{tooltipStyle:ie,inputProps:_(_({},l),{},{onBlur:e=>W(l&&l.onBlur,e),style:[te,{zIndex:300}]})})))})});var ce={alignItems:"center",userSelect:"none"};function se(e){let t=e.onDelete,n=e.style,r=N(e,A);return a.a.createElement(J,Object.assign({},r,{name:"delete",width:20,style:[ce,n],onClick:e=>{e.stopPropagation(),t&&t()}}),()=>a.a.createElement(u.a,{width:7,height:7}))}var ue={flexDirection:"row",alignItems:"center",cursor:"default",transition:"box-shadow .15s",":focus":{outline:0,boxShadow:`0 0 0 3px white, 0 0 0 5px ${c.a.b5}`}};const de=a.a.forwardRef(({style:e,disabled:t,clickBehavior:n,onSelect:r,onEdit:o,children:l},i)=>a.a.createElement(m.C,{innerRef:i,className:"cell-button",tabIndex:"0",onKeyDown:e=>{e.keyCode!==p.b.X&&e.keyCode!==p.b.SPACE||(e.preventDefault(),t||r&&r())},style:[ue,e],onFocus:()=>o&&o(),"data-testid":"cell-button",onClick:"none"===n?null:()=>{t||(r&&r(),o&&o())}},l));var fe={alignItems:"center",userSelect:"none"},pe={width:12,height:12,border:"1px solid "+c.a.n8,borderRadius:3,justifyContent:"center",alignItems:"center",":focus":{border:"1px solid "+c.a.b5,boxShadow:"0 1px 2px "+c.a.b5}},me={color:"white"};function ye(e){let t=e.focused,n=e.selected,r=e.partial,o=e.style,l=e.onSelect,i=e.onEdit,s=N(e,D);var u={backgroundColor:r?c.a.b9:c.a.b5,borderColor:r?c.a.b9:c.a.b5};return a.a.createElement(J,Object.assign({},s,{focused:t,name:"select",width:20,style:[fe,o],onClick:e=>{e.stopPropagation(),l&&l(),i&&i()}}),()=>a.a.createElement(de,{style:[pe,n&&u],onEdit:i,onSelect:l,clickBehavior:"none"},n&&a.a.createElement(f.a,{width:6,height:6,style:me})))}function ge(e){let t=e.valueProps,n=e.valueStyle,r=e.inputProps,o=(e.sync,e.textAlign),l=e.onSave,i=N(e,I);var c={textAlign:o};const s=t.binding,u=t.type,d=t.getValueStyle,f=t.formatExpr,p=t.unformatExpr;return a.a.createElement(O.a,{binding:s,onChange:()=>{i.exposed&&r&&r.onBlur&&r.onBlur()}},e=>a.a.createElement(J,Object.assign({valueStyle:d?[n,d(e.value)]:n,textAlign:o},i,{value:e.value,formatter:e=>i.formatter?i.formatter(e,u):Object(b.a)(e,u),"data-cellname":e.name}),()=>a.a.createElement(re,Object.assign({value:f?f(e.value):e.value,onUpdate:e=>{l(p?p(e):e)},style:c},r))))}var he={position:"absolute",top:0,left:0,right:0,bottom:0,transition:"background-color 1.8s",backgroundColor:"white"};Object(i.scope)(e=>{function t({inst:e}){e.el.style.transitionDuration="0s",e.el.style.backgroundColor=c.a.y9,setTimeout(()=>{e.el&&(e.el.style.transitionDuration="1.8s",e.el.style.backgroundColor="white")},0)}return e(function({inst:e,state:{activated:t,highlightOff:n}}){return a.a.createElement(m.C,{innerRef:t=>e.el=t,style:he})},{getInitialState:({props:e})=>({activated:!1,highlightOff:!0}),componentWillReceiveProps(e,n){if(!e.props.active&&n.active)return t(e)},componentDidMount(e){if(e.props.active)return t(e)}})});var be={borderRadius:"6px 6px 0 0",overflow:"hidden",flexShrink:0},Oe={zIndex:200},we={color:c.a.n4,fontWeight:500},ve={color:c.a.n4};function Ee(e){let t=e.headers,n=e.children,r=e.version,o=N(e,T);return a.a.createElement(m.C,{style:"v2"===r&&be},a.a.createElement(ee,Object.assign({backgroundColor:"white",borderColor:c.a.border,collapsed:!0},o,{style:[Oe,"v2"===r?we:ve,o.style]}),t?t.map(e=>a.a.createElement(J,{key:e.name,value:e.name,width:e.width,style:e.style,valueStyle:e.valueStyle})):n))}var je={color:c.a.b3},Se={marginRight:5},Ce={padding:0};function xe({name:e,keyHandlers:t,items:n,onSelect:o}){let l=Object(v.e)(),i=z(Object(r.useState)(null),2),c=i[0],s=i[1];return 0===l.size?null:a.a.createElement(m.C,null,a.a.createElement(h.a,{keys:t||{}}),a.a.createElement(m.d,{bare:!0,style:je,onClick:()=>s(!0)},a.a.createElement(d.a,{width:8,height:8,style:Se}),l.size," ",e),c&&a.a.createElement(m.B,{position:"bottom-right",width:200,style:Ce,onClose:()=>s(!1)},a.a.createElement(m.s,{onMenuSelect:e=>{o(e,[...l]),s(!1)},items:n})))}let Pe={position:"absolute",willChange:"transform",width:"100%"};const ke=a.a.forwardRef((e,t)=>{let n=e.fields,r=N(e,M),o=Te(r.items,n);return a.a.createElement(Ie,Object.assign({},r,{navigator:o}))});var Ae={justifyContent:"center",alignItems:"center",fontStyle:"italic",color:c.a.n6,flex:1},De={flex:1,outline:"none","& .animated .animated-row":{transition:".25s transform"}};const Ie=a.a.forwardRef((e,t)=>{let n=e.items,o=e.count,i=e.headers,u=e.contentHeader,d=e.loading,f=e.rowHeight,p=void 0===f?U:f,y=e.backgroundColor,h=void 0===y?$:y,b=e.renderItem,O=e.renderEmpty,v=e.getItemKey,E=e.loadMore,j=e.style,S=e.navigator,C=(e.listRef,e.onScroll),x=e.version,P=void 0===x?"v1":x,k=e.animated,A=e.allowPopupsEscape,D=e.isSelected,I=N(e,R);S||(S={onEdit:()=>{},editingId:null,focusedField:null,getNavigatorProps:e=>e});let T=S,M=T.onEdit,B=T.editingId,_=T.focusedField,L=T.getNavigatorProps,z=Object(r.useRef)(null),F=Object(r.useRef)(null),W=Object(r.useRef)(null),G=Object(r.useRef)(null),H=Object(r.useRef)(!1);function q({index:e,style:t,key:r}){let o=n[e],l=B===o.id,i=D&&D(o.id),c=b({item:o,editing:l,focusedField:l&&_,onEdit:M,index:e,position:t.top});return a.a.createElement(m.C,{key:r,className:"animated-row",style:[Pe,{zIndex:l||i?101:"auto",transform:"translateY(var(--pos))"}],nativeStyle:{"--pos":`${t.top-1}px`},"data-focus-key":o.id},c)}function Y(e,t){return t*(p-1)+(p-1)/2-e/2+2*(p-1)}function V({overscanStartIndex:e,overscanStopIndex:t}){E&&t>n.length-100&&E()}if(Object(r.useImperativeHandle)(t,()=>({scrollTo:(e,t="smart")=>{let r=n.findIndex(t=>t.id===e);-1!==r&&(z.current?z.current.scrollToItem(r,t):G.current=r)},scrollToTop:()=>{z.current&&z.current.scrollTo(0)},getScrolledItem:()=>{if(W.current){let e=W.current.scrollTop,t=z.current.getStartIndexForOffset(e);return n[t].id}return 0},setRowAnimation:e=>{z.current&&z.current.setRowAnimation(e)},edit(e,n,r){M(e,n),e&&r&&t.scrollTo(e)},anchor(){z.current&&z.current.anchor()},unanchor(){z.current&&z.current.unanchor()},isAnchored:()=>z.current&&z.current.isAnchored()})),Object(r.useLayoutEffect)(()=>{!H.current&&F.current&&(z.current&&z.current.setRowAnimation(!0),H.current=!0)}),d)return a.a.createElement(m.C,{style:[{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:h}]},a.a.createElement(s.a,{width:25,color:c.a.n1}));let K=0===(o||n.length);return a.a.createElement(m.C,Object.assign({style:[De,j],tabIndex:"1"},L(I),{"data-testid":"table"}),i&&a.a.createElement(Ee,Object.assign({version:P,height:p},Array.isArray(i)?{headers:i}:{children:i})),a.a.createElement(m.C,{style:{flex:1,backgroundColor:h}},K?function(e){return null==e?null:"function"===typeof e?e():a.a.createElement(m.C,{style:Ae},e)}(O):a.a.createElement(l.a,null,({width:e,height:t})=>0===e||0===t?null:a.a.createElement(m.p.Provider,{value:!A&&F},a.a.createElement(w.a,null,a.a.createElement(g.a,{ref:z,header:u,innerRef:F,outerRef:W,width:e,height:t,renderRow:q,itemCount:o||n.length,itemSize:p-1,itemKey:v||((e,t)=>n[e].id),indexForKey:e=>n.findIndex(t=>t.id===e),initialScrollOffset:G.current?Y(t,G.current):0,version:P,animated:k,overscanCount:5,onItemsRendered:V,onScroll:C}))))))});function Te(e,t,n={}){let a="function"!==typeof t?()=>t:t,l=n.initialEditingId,i=n.initialFocusedField,c=n.moveKeys,s=z(Object(r.useState)(l||null),2),u=s[0],d=s[1],f=z(Object(r.useState)(i||null),2),m=f[0],y=f[1],g=Object(r.useRef)(),h=Object(o.e)(),b=Object(r.useRef)(0),O=Object(r.useCallback)((e,t)=>{d(e),y(e?t:null)},[]);function w(){g.current.focus(),O(null),setTimeout(()=>{O(u,m)},100)}function v(t){if(u){let n=a(e.find(e=>e.id===u)),r=n.indexOf(m)+t;r<0?function(){let t=e.findIndex(e=>e.id===u);if(t>0){let n=e[t-1],r=a(n);O(n.id,r[r.length-1])}else w()}():r>=n.length?function(){let t=e.findIndex(e=>e.id===u);if(t<e.length-1){let n=e[t+1],r=a(n);O(n.id,r[0])}else w()}():y(n[r])}}function E(t){if(u){let n=e.findIndex(e=>e.id===u);for(;;){if(!((n+=t)>=0&&n<e.length)){w();break}{const t=e[n];if(a(t).includes(m)){O(t.id,m);break}}}}}function j(e){switch(e){case"left":v(-1);break;case"right":v(1);break;case"up":E(-1);break;case"down":E(1);break;default:throw new Error("Unknown direction: "+e)}}return Object(r.useEffect)(()=>{b.current=h.getState().modals.modalStack.length},[]),{onEdit:O,editingId:u,focusedField:m,getNavigatorProps:function(e){return _(_({},e),{},{innerRef:g,onKeyDown:t=>{if(e&&e.onKeyDown&&e.onKeyDown(t),t.isPropagationStopped())return;let n=c&&c[m]&&c[m];if(n&&n[t.keyCode])t.preventDefault(),t.stopPropagation(),j(n[t.keyCode]);else switch(t.keyCode){case p.b.UP:case p.b.K:"INPUT"!==t.target.tagName&&j("up");break;case p.b.DOWN:case p.b.J:"INPUT"!==t.target.tagName&&j("down");break;case p.b.ENTER:case p.b.TAB:t.preventDefault(),t.stopPropagation(),j(t.keyCode===p.b.ENTER?t.shiftKey?"up":"down":t.shiftKey?"left":"right")}},onBlur:e=>{let t=b.current,n=h.getState().modals.modalStack.length;!document.hasFocus()||null!=e.relatedTarget&&g.current.contains(e.relatedTarget)||t!==n||O(null)}})}}}}).call(this,n(15))},90:function(e,t,n){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const l=n(200);let i=40,c=[],s={url:null,openModal:null,selectedItems:null};e.exports={setUndoState:function(e,t){s[e]=t,s.id=l.v4Sync()},getUndoState:function(e){return s[e]},getTaggedState:function(e){return c.find(t=>t.id===e)},snapshot:function(){let e=a(a({},s),{},{id:l.v4Sync()});return c.unshift(e),c=c.slice(0,i),e.id},gc:function(e){c=c.filter(t=>t.id!==e)}}},93:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return d});var r=n(0),a=n(71),o=n(77);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d({binding:t,initialValue:n,children:i,onChange:c}){if(!t)throw new Error("SheetValue binding is required");if(e.IS_TESTING&&"string"!==typeof t&&!t.name&&(t=s(s({},t),{},{name:t.value.toString()})),null==(t="string"===typeof t?{name:t,value:null}:t).name)throw new Error("Binding name is now required");let u=Object(r.useContext)(o.a),d=Object(r.useContext)(a.a)||"__global",f=l(Object(r.useState)({name:d+"!"+t.name,value:null!=n?n:t.value,query:t.query}),2),p=f[0],m=f[1],y=Object(r.useRef)(c),g=Object(r.useRef)(p.value);return Object(r.useLayoutEffect)(()=>{y.current=c,g.current=p.value}),Object(r.useLayoutEffect)(()=>(t.query&&u.createQuery(d,t.name,t.query),u.bind(d,t,null,e=>{y.current&&y.current(e),e.value!==g.current&&m(e)})),[d,t.name]),null!=p.value?i(p,function(){throw new Error("setCell is not implemented anymore")}):null}}).call(this,n(15))},97:function(e,t,n){"use strict";n.d(t,"a",function(){return P});var r=n(0),a=n.n(r),o=n(465),l=n(464),i=n(838),c=n(839),s=n(834),u=n(463),d=n(467),f=n.n(d),p=(n(665),n(5)),m=n(2),y=n(1),g=n(468),h=n.n(g),b=n(469),O=n.n(b);function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let E={"& .pika-single.actual-date-picker":{color:m.a.n11,background:m.a.n1,border:"none",boxShadow:"0 0px 4px rgba(0, 0, 0, .25)",borderRadius:4},"& .actual-date-picker":{"& .pika-lendar":{float:"none",width:"auto"},"& .pika-label":{backgroundColor:m.a.n1},"& .pika-prev":{backgroundImage:`url(${h.a})`},"& .pika-next":{backgroundImage:`url(${O.a})`},"& .pika-table th":{color:m.a.n11,"& abbr":{textDecoration:"none"}},"& .pika-button":{backgroundColor:m.a.n2,color:m.a.n11},"& .is-today .pika-button":{textDecoration:"underline"},"& .is-selected .pika-button":{backgroundColor:m.a.n5,boxShadow:"none"}}};var j={flex:1};let S=a.a.forwardRef(({value:e,dateFormat:t,onUpdate:n,onSelect:s},u)=>{let d=Object(r.useRef)(null),p=Object(r.useRef)(null);return Object(r.useImperativeHandle)(u,()=>({handleInputKeyDown(e){let t=null;switch(e.keyCode){case 37:e.preventDefault(),t=o.a(d.current.getDate(),1);break;case 38:e.preventDefault(),t=o.a(d.current.getDate(),7);break;case 39:e.preventDefault(),t=l.a(d.current.getDate(),1);break;case 40:e.preventDefault(),t=l.a(d.current.getDate(),7)}t&&(d.current.setDate(t,!0),n&&n(t))}}),[]),Object(r.useLayoutEffect)(()=>(d.current=new f.a({theme:"actual-date-picker",keyboardInput:!1,defaultDate:e?i.a(e,t,new Date):new Date,setDefaultDate:!0,toString:e=>c.a(e,t),parse:e=>i.a(e,t,new Date),onSelect:s}),p.current.appendChild(d.current.el),()=>{d.current.destroy()}),[]),Object(r.useEffect)(()=>{d.current.getDate()!==e&&d.current.setDate(i.a(e,t,new Date),!0)},[e,t]),a.a.createElement(y.C,{style:[E,j],innerRef:p})});function C(e){return 13===e.keyCode}var x={padding:0,minWidth:225};function P({containerProps:e,inputProps:t,tooltipStyle:n,value:o,isOpen:l,embedded:d,dateFormat:f="yyyy-MM-dd",focused:m,openOnFocus:g=!0,inputRef:h,shouldSaveFromKey:b=C,tableBehavior:O,onUpdate:v,onSelect:E}){let j=Object(r.useMemo)(()=>{if(o){let e=s.a(o);if(u.a(e))return c.a(e,f)}return""},[o,f]),P=Object(r.useRef)(null),k=w(Object(r.useState)(j),2),A=k[0],D=k[1],I=w(Object(r.useState)(d||l||!1),2),T=I[0],M=I[1],R=Object(r.useRef)(null);Object(r.useLayoutEffect)(()=>{h&&(h.current=R.current)},[]);let B=w(Object(r.useState)(A),2),_=B[0],L=B[1],z=Object(r.useRef)(_);Object(r.useEffect)(()=>{z.current=A},[A]),Object(r.useEffect)(()=>D(j),[j]),Object(r.useEffect)(()=>{if(Object(p.i)(f).test(A)){let e=i.a(A,Object(p.h)(f),new Date);u.a(e)&&(v&&v(c.a(e,"yyyy-MM-dd")),L(c.a(e,f)))}else if(Object(p.n)(f).test(A)){let e=i.a(A,Object(p.m)(f),new Date);u.a(e)&&(v&&v(c.a(e,"yyyy-MM-dd")),L(c.a(e,f)))}else{let e=i.a(A,f,new Date);if(u.a(e)){let t=c.a(e,"yyyy-MM-dd");v&&v(t),L(A)}}},[A]);return a.a.createElement(y.C,e,a.a.createElement(y.n,Object.assign({focused:m},t,{inputRef:R,value:A,onKeyDown:function(e){if(e.keyCode>=37&&e.keyCode<=40&&!e.shiftKey&&!e.metaKey&&!e.altKey&&T)P.current.handleInputKeyDown(e);else if(27===e.keyCode)D(j),L(j),j===A?T&&(d||e.stopPropagation(),M(!1)):(M(!0),v&&v(o));else if(b(e)){D(_),M(!1);let n=i.a(_,f,new Date);E(c.a(n,"yyyy-MM-dd")),T&&z.current!==_&&(e.stopPropagation(),e.preventDefault());let r=(t||{}).onKeyDown;r&&r(e)}else T||(M(!0),R.current&&R.current.setSelectionRange(0,1e4))},onChange:function(e){D(e.target.value)},onFocus:e=>{!d&&g&&M(!0),t&&t.onFocus&&t.onFocus(e)},onBlur:e=>{if(d||M(!1),t&&t.onBlur&&t.onBlur(e),!O)if(""===A)L(null),E(null);else{D(_||"");let e=i.a(_,f,new Date);e instanceof Date&&!isNaN(e)&&E(c.a(e,"yyyy-MM-dd"))}}})),T&&(F=a.a.createElement(S,{ref:P,value:_,dateFormat:f,onUpdate:e=>{L(c.a(e,f)),v&&v(c.a(e,"yyyy-MM-dd"))},onSelect:e=>{D(c.a(e,f)),E(c.a(e,"yyyy-MM-dd")),M(!1)}}),d?F:a.a.createElement(y.B,{position:"bottom-left",offset:2,style:[x,n]},F)));var F}},99:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"b",function(){return s}),n.d(t,"a",function(){return u});class c{constructor(e){this.state=l({filterExpressions:e.filterExpressions||[],selectExpressions:e.selectExpressions||[],groupExpressions:e.groupExpressions||[],orderExpressions:e.orderExpressions||[],calculation:!1,rawMode:!1,withDead:!1,validateRefs:!0,limit:null,offset:null},e)}filter(e){return new c(l(l({},this.state),{},{filterExpressions:[...this.state.filterExpressions,e]}))}unfilter(e){let t=new Set(e);return new c(l(l({},this.state),{},{filterExpressions:this.state.filterExpressions.filter(e=>!t.has(Object.keys(e)[0]))}))}select(e=[]){Array.isArray(e)||(e=[e]);let t=new c(l(l({},this.state),{},{selectExpressions:e}));return t.state.calculation=!1,t}calculate(e){let t=this.select({result:e});return t.state.calculation=!0,t}groupBy(e){return Array.isArray(e)||(e=[e]),new c(l(l({},this.state),{},{groupExpressions:[...this.state.groupExpressions,...e]}))}orderBy(e){return Array.isArray(e)||(e=[e]),new c(l(l({},this.state),{},{orderExpressions:[...this.state.orderExpressions,...e]}))}limit(e){return new c(l(l({},this.state),{},{limit:e}))}offset(e){return new c(l(l({},this.state),{},{offset:e}))}raw(){return new c(l(l({},this.state),{},{rawMode:!0}))}withDead(){return new c(l(l({},this.state),{},{withDead:!0}))}withoutValidatedRefs(){return new c(l(l({},this.state),{},{validateRefs:!1}))}options(e){return new c(l(l({},this.state),{},{tableOptions:e}))}serialize(){return this.state}}function s(e,t){let n=e.serialize().orderExpressions;if(0===n.length)return t?l({order:"asc"},t):null;let a=n[0];if("string"===typeof a)return{field:a,order:"asc"};let o=r(Object.keys(a),1)[0];return{field:o,order:a[o]}}function u(e){return new c({table:e})}}},[[814,4,3]]]);
2
+ //# sourceMappingURL=main.af4b5d4a.chunk.js.map