text: !function e(t,n,a){function r(o,i){if(!n[o]){if(!t[o]){var l="function"==typeof require&&require;if(!i&&l)return l(o,!0);if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return r(n?n:e)},u,u.exports,e,t,n,a)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<a.length;o++)r(a[o]);return r}({"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/action-creators.js":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function r(e){return function(t){t({type:"WAIT"}),i["default"].post(l,e(null)).then(function(n){t({type:"STOP_WAIT"}),t(e(n))},function(e){console.log("error",e),t({type:"STOP_WAIT"}),t({type:"ERROR"})})}}function s(e){return function(t){return t(e)}}Object.defineProperty(n,"__esModule",{value:!0}),n.unauthorized=n.online=n.offline=n.removeQueueTask=n.enqueueNewExpense=n.setFirstDayOfWeek=n.setCurrency=n.deleteCategory=n.editCategory=n.newCategory=n.deleteExpense=n.editExpense=n.newExpense=n.updateState=void 0;var o=e("./ajax"),i=a(o),l=window.context.backend_url+"/dispatch";n.updateState=function(e){var t=e.newState;return s({type:"UPDATE_STATE",newState:t})},n.newExpense=function(e){var t=e.amount,n=e.categoryId,a=e.comment,s=e.date;return r(function(e){return{type:"NEW_EXPENSE",amount:t,categoryId:n,comment:a,id:e,date:s}})},n.editExpense=function(e){var t=e.id,n=e.amount,a=e.categoryId,s=e.comment,o=e.date;return r(function(){return{type:"EDIT_EXPENSE",id:t,amount:n,categoryId:a,comment:s,date:o}})},n.deleteExpense=function(e){return r(function(t){return{type:"DELETE_EXPENSE",id:e}})},n.newCategory=function(e){var t=e.title,n=e.parentId;return r(function(e){return{type:"NEW_CATEGORY",id:e,title:t,parentId:n}})},n.editCategory=function(e){var t=e.id,n=e.title,a=void 0===n?null:n,s=e.parentId,o=void 0===s?null:s;return r(function(e){return{type:"EDIT_CATEGORY",id:t,title:a,parentId:o}})},n.deleteCategory=function(e){var t=e.id;return r(function(e){return{type:"DELETE_CATEGORY",id:t}})},n.setCurrency=function(e){var t=e.currency;return r(function(e){return{type:"SET_CURRENCY",currency:t}})},n.setFirstDayOfWeek=function(e){var t=e.firstDayOfWeek;return r(function(e){return{type:"SET_FIRST_DAY_OF_WEEK",firstDayOfWeek:t}})},n.enqueueNewExpense=function(e){var t=e.amount,n=e.categoryId,a=e.comment,r=e.date;return s({type:"QUEUE_PUSH",data:{type:"NEW_EXPENSE",id:-1,amount:t,categoryId:n,comment:a,date:r}})},n.removeQueueTask=function(e){var t=e.id;return s({type:"QUEUE_REMOVE",id:t})},n.offline=function(){return s({type:"OFFLINE"})},n.online=function(){return s({type:"ONLINE"})},n.unauthorized=function(e){var t=e.value;return s({type:"UNAUTHORIZED",value:t})}},{"./ajax":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/ajax.js"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/ajax.js":[function(e,t,n){"use strict";var a=e("es6-promise");t.exports.get=function(e){var t=void 0;return new a.Promise(function(n,a){t=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),t.onreadystatechange=function(){if(t.readyState==XMLHttpRequest.DONE)if(200==t.status)if(t.responseText)try{n(JSON.parse(t.responseText))}catch(e){console.error("Response text is not null, but it's not a valid JSON: "+t.responseText),n(null)}else n(null);else a({code:t.status,responseText:t.responseText})},t.withCredentials=!0,t.open("GET",e,!0),t.send()})},t.exports.post=function(e,t){return new a.Promise(function(n,a){var r=void 0;r=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"),r.onreadystatechange=function(){if(r.readyState==XMLHttpRequest.DONE)if(200==r.status)if(r.responseText)try{n(JSON.parse(r.responseText))}catch(e){console.error("Response text is not null, but it's not a valid JSON: "+r.responseText),n(null)}else n(null);else a({code:r.status,responseText:r.responseText})},r.withCredentials=!0,r.open("POST",e,!0),r.send(JSON.stringify(t))})}},{"es6-promise":"es6-promise"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/arrays.js":[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.asc=function(e,t){return e>t?1:t>e?-1:0},n.desc=function(e,t){return t>e?1:e>t?-1:0},n.find=function(e,t){return e.filter(t)[0]}},{}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/EditCategoryList.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("react-dom"),i=(a(o),e("react-addons-update")),l=a(i),c=e("../../arrays"),u=e("../presentational/ModalContainer"),d=a(u),f=s["default"].createClass({displayName:"EditCategoryList",getInitialState:function(){return{mode:null,renamingId:null,renamingText:null,newCategoryTitle:null,newCategoryParentId:null}},onRenameBegin:function(e){this.setState((0,l["default"])(this.state,{mode:{$set:"RENAME"},renamingId:{$set:e.id},renamingText:{$set:e.title}}))},onRenameFinished:function(e){""!==this.state.renamingText&&(this.props.onRenameCategory(this.state.renamingId,this.state.renamingText),this.setState((0,l["default"])(this.state,{mode:{$set:null}})))},onRenameCanceled:function(e){this.setState((0,l["default"])(this.state,{mode:{$set:null}}))},onRename:function(e){this.setState((0,l["default"])(this.state,{renamingText:{$set:e.target.value}}))},onMoveBegin:function(e){this.setState((0,l["default"])(this.state,{mode:{$set:"MOVE"},moveCategoryId:{$set:e.id},moveOldParentId:{$set:e.parentId},moveNewParentId:{$set:e.parentId}}))},onMoveFinished:function(e){-1!==this.state.moveNewParentId&&(this.props.onMoveCategory(this.state.moveCategoryId,this.state.moveNewParentId),this.setState((0,l["default"])(this.state,{mode:{$set:null}})))},onMoveCanceled:function(e){this.setState((0,l["default"])(this.state,{mode:{$set:null}}))},onMoveParentChange:function(e){this.setState((0,l["default"])(this.state,{mode:{$set:"MOVE"},moveNewParentId:{$set:parseInt(e.target.value)}}))},onNewCategoryBegin:function(e){this.setState((0,l["default"])(this.state,{mode:{$set:"NEW_CATEGORY"},newCategoryTitle:{$set:""},newCategoryParentId:{$set:e.id}}))},onNewCategoryCanceled:function(){this.setState((0,l["default"])(this.state,{mode:{$set:""}}))},onNewCategoryTitleChange:function(e){this.setState((0,l["default"])(this.state,{newCategoryTitle:{$set:e.target.value}}))},onNewCategoryFinished:function(){""!==this.state.newCategoryTitle&&(this.props.onNewCategory(this.state.newCategoryTitle,this.state.newCategoryParentId),this.setState((0,l["default"])(this.state,{mode:{$set:""}})))},onDeleteBegin:function(e){var t=this.context.store.getState(),n=t.history,a=n.filter(function(t){return t.categoryId===e.id});0===a.length?this.props.onDeleteCategory(e.id):this.setState((0,l["default"])(this.state,{mode:{$set:"DELETE"},deleteId:{$set:e.id}}))},onDeleteCanceled:function(){this.setState((0,l["default"])(this.state,{mode:{$set:""}}))},onDeleteFinished:function(){""!==this.state.newCategoryTitle&&(this.props.onDeleteCategory(this.state.deleteId),this.setState((0,l["default"])(this.state,{mode:{$set:""}})))},renderRecurse:function(e,t){var n=this,a=this.context.store.getState(),r=a.categoryList,o=a.rootCategoryId,i=(r.filter(function(e){return e.id===o})[0],e.slice().sort(function(e,t){return e.order-t.order}));return i.map(function(e){var a=e.childIdList.map(function(e){return r.filter(function(t){return t.id===e})[0]}),o=["edit-category-list__category"];o=o.join(" ");var i=null;if(a.length>0){var l=a.length>0?n.renderRecurse(a,t+1):"";i=s["default"].createElement("div",{key:e.id+"-children",className:"edit-category-list__children"},l)}return[s["default"].createElement("div",{key:e.id,className:o},s["default"].createElement("div",{className:"edit-category-list__category__content"},s["default"].createElement("div",{className:"edit-category-list__category__title"},e.title)," ",s["default"].createElement("div",{className:"edit-category-list__category__controls"},s["default"].createElement("i",{title:"Rename...",onClick:function(t){return n.onRenameBegin(e)},className:"icon icon-pen icon1x","aria-hidden":"true"}),s["default"].createElement("i",{title:"Add sub category...",onClick:function(t){return n.onNewCategoryBegin(e)},className:"icon icon-plus icon1x","aria-hidden":"true"}),s["default"].createElement("i",{title:"Move...",onClick:function(t){return n.onMoveBegin(e)},className:"icon icon-reply icon1x","aria-hidden":"true"}),s["default"].createElement("i",{title:"Delete...",onClick:function(t){return n.onDeleteBegin(e)},className:"icon icon-trash_can icon1x warning","aria-hidden":"true"})))),i]})},render:function(){function e(t,n){var a=arguments.length<=2||void 0===arguments[2]?0:arguments[2];if(t.id==n)return[];for(var o="",i=0;a>i;++i)o+=String.fromCharCode(parseInt("00A0",16)),o+=String.fromCharCode(parseInt("00A0",16));var l=[s["default"].createElement("option",{value:t.id,key:t.id},o+t.title)];return t.childIdList.map(function(t){var s=(0,c.find)(r,function(e){return e.id===t});return e(s,n,a+1)}).forEach(function(e){return e.forEach(function(e){l.push(e)})}),l}var t=this,n=this.context.store.getState(),a=n.rootCategoryId,r=n.categoryList,o=n.history,i=r.filter(function(e){return e.id===a})[0],l=r.filter(function(e){return e.parentId===a}),u=this.renderRecurse(l,0);if(this.props.allowEmpty){var f=["edit-category-list__category"];null===this.props.value&&f.push("edit-category-list__category--selected"),f=f.join(" "),u.unshift(s["default"].createElement("div",{key:"empty",className:f},s["default"].createElement("div",{className:"edit-category-list__empty"},"Do not filter by category")))}var m=function(e){e&&e.focus()},p=o.filter(function(e){return e.categoryId===t.state.deleteId}).length;return s["default"].createElement("div",{className:"edit-category-list"},s["default"].createElement(d["default"],{visible:"RENAME"===this.state.mode,onCancel:this.onRenameCanceled,onSave:this.onRenameFinished},s["default"].createElement("label",null,"New title: ",s["default"].createElement("input",{value:this.state.renamingText,onChange:this.onRename,ref:m})),s["default"].createElement("button",{onClick:this.onRenameFinished,disabled:""===this.state.renamingText},"Save"),s["default"].createElement("button",{onClick:this.onRenameCanceled},"Cancel")),s["default"].createElement(d["default"],{visible:"NEW_CATEGORY"===this.state.mode,onCancel:this.onNewCategoryCanceled,onSave:this.onNewCategoryFinished},s["default"].createElement("label",null,"New category title: ",s["default"].createElement("input",{value:this.state.newCategoryTitle,onChange:this.onNewCategoryTitleChange,ref:m})),s["default"].createElement("button",{onClick:this.onNewCategoryFinished,disabled:""===this.state.newCategoryTitle},"Save"),s["default"].createElement("button",{onClick:this.onNewCategoryCanceled},"Cancel")),s["default"].createElement(d["default"],{visible:"MOVE"===this.state.mode,onCancel:this.onMoveCanceled,onSave:this.onMoveFinished},s["default"].createElement("label",null,"Move to:"," ",s["default"].createElement("select",{onChange:this.onMoveParentChange,value:this.state.moveNewParentId},e(i,this.state.moveCategoryId))),s["default"].createElement("button",{onClick:this.onMoveFinished,disabled:this.state.moveNewParentId===this.state.moveOldParentId},"Save"),s["default"].createElement("button",{onClick:this.onMoveCanceled},"Cancel")),s["default"].createElement(d["default"],{visible:"DELETE"===this.state.mode,onCancel:this.onDeleteCanceled,onSave:this.onDeleteFinished},s["default"].createElement("div",{className:"modal-container__msg warning"},"Are you sure that you want to delete this category?"),s["default"].createElement("div",{className:"modal-container__msg warning"},p>0?p>1?"You have "+p+" expenses in this category, all of them will be deleted too!":"You have 1 expense in this category, it will be removed too!":null),s["default"].createElement("div",{className:"modal-container__controls"},s["default"].createElement("button",{className:"warning",onClick:this.onDeleteFinished},"Delete"),s["default"].createElement("button",{onClick:this.onDeleteCanceled},"Cancel"))),u,s["default"].createElement("div",{className:"edit-category-list__new-root-category"},s["default"].createElement("a",{href:"#",className:"pseudo edit-category-list__new-root-category__link",onClick:function(e){return t.onNewCategoryBegin(i)}},"Add new root category...")))}});f.contextTypes={store:s["default"].PropTypes.object},n["default"]=f},{"../../arrays":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/arrays.js","../presentational/ModalContainer":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/ModalContainer.jsx",react:"react","react-addons-update":"react-addons-update","react-dom":"react-dom"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/EditExpense.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("react-addons-update"),i=a(o),l=e("../presentational/NumberInput.jsx"),c=a(l),u=e("../presentational/CategoryPicker.jsx"),d=a(u),f=e("../presentational/DateTimePicker.jsx"),m=a(f),p=e("moment"),h=a(p),y=s["default"].createClass({displayName:"EditExpense",getInitialState:function(){var e=this,t=this.context.store.getState(),n=t.rootCategoryId,a=t.categoryList,r=t.history;if("undefined"!=typeof this.props.expenseId){var s=r.filter(function(t){return t.id===e.props.expenseId})[0];return{id:s.id,amount:c["default"].wrapState(s.amount/100),categoryId:s.categoryId,date:s.date,comment:s.comment,mode:"EDIT"}}var o=a.sort(function(e,t){return e.order-t.order}).filter(function(e){return e.parentId===n}),i=o.length>0?o[0].id:-1;return{amount:c["default"].wrapState(0),categoryId:i,date:(0,h["default"])().valueOf(),comment:"",mode:"NEW"}},onSubmit:function(e){if(e.preventDefault(),"NEW"===this.state.mode)this.props.onAdd({amount:Math.floor(100*c["default"].unwrapState(this.state.amount)),categoryId:this.state.categoryId,comment:this.state.comment,date:this.state.date}),this.setState(this.getInitialState());else{if("EDIT"!==this.state.mode)throw new Error("Illegal mode: "+this.state.mode);this.props.onSave({id:this.state.id,amount:Math.floor(100*c["default"].unwrapState(this.state.amount)),categoryId:this.state.categoryId,comment:this.state.comment,date:this.state.date})}},onAmountChange:function(e){this.setState((0,i["default"])(this.state,{amount:{$set:e}}))},onChangeComment:function(e){this.setState((0,i["default"])(this.state,{comment:{$set:e.target.value}}))},onChangeDate:function(e){this.setState((0,i["default"])(this.state,{date:{$set:e}}))},onChangeCategory:function(e){this.setState((0,i["default"])(this.state,{categoryId:{$set:e}}))},onNewCategory:function(e,t){this.props.onAddCategory({title:e,parentId:t})},onCancel:function(){this.props.onCancel()},render:function(){var e=this.context.store.getState(),t=e.userSettings,n=t.firstDayOfWeek;return s["default"].createElement("form",{onSubmit:this.onSubmit,className:"edit-expense"},s["default"].createElement("div",{className:"edit-expense__row"},s["default"].createElement("table",null,s["default"].createElement("tbody",null,s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__label"},"Amount: ")),s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__input"},s["default"].createElement(c["default"],{value:this.state.amount,onChange:this.onAmountChange}))),s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__label"},"Date:")),s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__input"},s["default"].createElement(m["default"],{timestamp:this.state.date,onChange:this.onChangeDate,firstDayOfWeek:n}))),s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__label"},"Comment:")),s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__input"},s["default"].createElement("textarea",{value:this.state.comment,onChange:this.onChangeComment,rows:"3"}))))),s["default"].createElement("table",null,s["default"].createElement("tbody",null,s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__label"},"Category: ")),s["default"].createElement("tr",null,s["default"].createElement("td",{className:"edit-expense__field__input"},s["default"].createElement("div",{className:"edit-expense__category-picker-wrapper"},s["default"].createElement(d["default"],{categoryList:this.context.store.getState().categoryList,rootCategoryId:this.context.store.getState().rootCategoryId,value:this.state.categoryId,onChange:this.onChangeCategory,editingEnabled:!0,onNewCategory:this.onNewCategory}))))))),s["default"].createElement("div",{className:"edit-expense__controls"},"NEW"===this.state.mode?s["default"].createElement("button",{disabled:0===c["default"].unwrapState(this.state.amount),type:"submit"},"Add"):s["default"].createElement("button",{disabled:0===c["default"].unwrapState(this.state.amount),type:"submit"},"Save"),"EDIT"===this.state.mode?s["default"].createElement("button",{type:"button",onClick:this.onCancel},"Cancel"):null))}});y.contextTypes={store:s["default"].PropTypes.object},n["default"]=y},{"../presentational/CategoryPicker.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/CategoryPicker.jsx","../presentational/DateTimePicker.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/DateTimePicker.jsx","../presentational/NumberInput.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/NumberInput.jsx",moment:"moment",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/ExpenseList.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("react-addons-update"),i=(a(o),e("moment")),l=a(i),c=e("../../money"),u=a(c),d=e("../presentational/ModalContainer"),f=(a(d),e("./EditExpense")),m=(a(f),e("../../action-creators"),s["default"].createClass({displayName:"ExpenseList",render:function(){function e(e,t){for(var n=[],a=null,r=null,s=0;s<e.length;++s){var o=e[s],i=t(o);(null===a||t(o)!==r)&&(a=[],n.push(a)),a.push(o),r=i}return n}function t(e){var n=o.filter(function(t){return t.id===e.parentId})[0];return null!==n.parentId?t(n).concat(e):[e]}var n=this,a=this.props.data,r=this.context.store.getState(),o=r.categoryList,i=r.userSettings,c=i.currency,d=u["default"].format(u["default"].settings.byCurrency[c]),f=a.sort(function(e,t){return t.date-e.date}),m=e(f,function(e){return(0,l["default"])(e.date).format("YYYY MM DD")});return s["default"].createElement("div",{className:"expense-list"},m.map(function(e){var a=(0,l["default"])(e[0].date).format("MMMM Do YYYY (dddd)");return s["default"].createElement("div",{key:a,className:"expense-list__group"},s["default"].createElement("div",{className:"expense-list__group__title"},a),e.map(function(e){var a,r,i=o.filter(function(t){return t.id===e.categoryId})[0];return e.comment?(a=e.comment,r=t(i).map(function(e){return e.title}).join(" / ")):(a=t(i).map(function(e){return e.title}).join(" / "),r=""),s["default"].createElement("div",{key:e.id,className:"expense-list__expense"},s["default"].createElement("div",{className:"expense-list__expense__time"},(0,l["default"])(e.date).format("HH:mm")),s["default"].createElement("div",null,s["default"].createElement("div",{className:"expense-list__expense__first-line"},s["default"].createElement("div",{className:"expense-list__expense__amount"},d(e.amount)),s["default"].createElement("div",{className:"expense-list__expense__desc1"}," "," — ",a)),s["default"].createElement("div",{className:"expense-list__expense__desc2"},r)),s["default"].createElement("div",{className:"expense-list__expense__controls"},s["default"].createElement("a",{href:"#",className:"pseudo warning",onClick:function(t){t.preventDefault(),n.props.onDelete(e.id)}},"Delete"),s["default"].createElement("a",{href:"#",className:"pseudo",onClick:function(t){t.preventDefault(),n.props.onEdit(e.id)}},"Edit")))}))}))}}));m.contextTypes={store:s["default"].PropTypes.object},n["default"]=m},{"../../action-creators":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/action-creators.js","../../money":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/money.js","../presentational/ModalContainer":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/ModalContainer.jsx","./EditExpense":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/EditExpense.jsx",moment:"moment",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/History.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("react-addons-update"),i=a(o),l=e("moment"),c=a(l),u=e("../presentational/ModalContainer"),d=a(u),f=e("./EditExpense"),m=a(f),p=e("../../action-creators"),h=e("./ExpenseList"),y=a(h),v=e("../presentational/CategoryPicker"),_=a(v),E=e("../../arrays"),g=Object,C=g.keys,b=s["default"].createClass({displayName:"History",getInitialState:function(){var e=(0,c["default"])();e.startOf("month");var t=e.valueOf();e.endOf("month");var n=e.valueOf();return{editingExpense:!1,deletingExpense:!1,filterDateFrom:t,filterDateTo:n,filterDateItem:e.year()+"-"+e.month(),filterCategory:null,filterComment:""}},onExpenseDelete:function(e){this.props.onDelete(e)},onExpenseEdit:function(e){this.setState((0,i["default"])(this.state,{editingExpense:{$set:!0},editingExpenseId:{$set:e}}))},onCancelEditingExpense:function(){this.setState((0,i["default"])(this.state,{editingExpense:{$set:!1}}))},onExpenseSave:function(e){this.context.store.dispatch((0,p.editExpense)(e)),this.setState((0,i["default"])(this.state,{editingExpense:{$set:!1}}))},onExpenseEditCancel:function(){this.setState((0,i["default"])(this.state,{editingExpense:{$set:!1}}))},onFilterByYearMonth:function(e,t){var n=(0,c["default"])().year(e).month(t);n.startOf("month");var a=n.valueOf();n.endOf("month");var r=n.valueOf();this.setState((0,i["default"])(this.state,{filterDateFrom:{$set:a},filterDateTo:{$set:r},filterDateItem:{$set:e+"-"+t}}))},onFilterByYear:function(e){var t=(0,c["default"])().year(e);t.startOf("year");var n=t.valueOf();t.endOf("year");var a=t.valueOf();this.setState((0,i["default"])(this.state,{filterDateFrom:{$set:n},filterDateTo:{$set:a},filterDateItem:{$set:e}}))},onFilterByCategory:function(e){this.setState((0,i["default"])(this.state,{filterCategory:{$set:e}}))},onFilterByComment:function(e){this.setState((0,i["default"])(this.state,{filterComment:{$set:e.target.value}}))},render:function(){var e=this,t=this.context.store.getState(),n=t.history,a=t.rootCategoryId,r=t.categoryList,o=this.state,i=o.filterDateFrom,l=o.filterDateTo,u=o.filterDateItem,f=o.filterCategory,p=o.filterComment,h={};n.forEach(function(e){var t=(0,c["default"])(e.date).month(),n=(0,c["default"])(e.date).year();n in h||(h[n]=[]),-1==h[n].indexOf(t)&&h[n].push(t)});var v=n.filter(function(e){return e.date>=i&&e.date<=l});return null!==f&&(v=v.filter(function(e){return e.categoryId===f})),""!==p&&(v=v.filter(function(e){return-1!=e.comment.indexOf(p)})),0===n.length?s["default"].createElement("div",{className:"history"},s["default"].createElement("div",{className:"empty-history-msg"},"You have no expenses yet")):s["default"].createElement("div",{className:"history"},s["default"].createElement(d["default"],{visible:this.state.editingExpense,onCancel:this.onCancelEditingExpense},s["default"].createElement(m["default"],{expenseId:this.state.editingExpenseId,onSave:this.onExpenseSave,onCancel:this.onExpenseEditCancel})),s["default"].createElement("div",{className:"history__results"},0!=i&&l!=Number.MAX_VALUE?s["default"].createElement("div",{className:"history__current-filter"},s["default"].createElement("span",{className:"history__current-filter__title"},"Showing records:"),"  ",s["default"].createElement("span",null,(0,c["default"])(i).format("MMMM Do YYYY"))," — ",s["default"].createElement("span",null,(0,c["default"])(l).format("MMMM Do YYYY")),null!==f?s["default"].createElement("span",null,", in category „",r.filter(function(e){return e.id===f})[0].title,"“"):null,""!==p?s["default"].createElement("span",null,", with comment, containing „",p,"“"):null):null,s["default"].createElement(y["default"],{data:v,onEdit:this.onExpenseEdit,onDelete:this.onExpenseDelete})),s["default"].createElement("div",{className:"history__filters"},s["default"].createElement("div",{className:"history__title"},"Filter by date"),s["default"].createElement("div",{className:"history__year-month-filter"},C(h).sort(E.desc).map(function(t){return s["default"].createElement("div",{key:t,className:"history__year-month-filter__year-block"},u===t?s["default"].createElement("div",{className:"history__year-month-filter__item history__year-month-filter__item--active history__year-month-filter__year"},s["default"].createElement("span",null,t,":")):s["default"].createElement("div",{className:"history__year-month-filter__year history__year-month-filter__item"},s["default"].createElement("a",{href:"#",className:"pseudo",onClick:function(n){n.preventDefault(),e.onFilterByYear(t)}},t,":")),h[t].sort(E.desc).map(function(n){var a=(0,c["default"])().month(n).year(t);return u===t+"-"+n?s["default"].createElement("div",{key:n,className:"history__year-month-filter__item history__year-month-filter__month history__year-month-filter__item--active"},s["default"].createElement("span",null,a.format("MMMM"))):s["default"].createElement("div",{key:n,className:"history__year-month-filter__month history__year-month-filter__item"},s["default"].createElement("a",{href:"#",className:"pseudo",onClick:function(a){a.preventDefault(),e.onFilterByYearMonth(t,n)}},a.format("MMMM")))}))}))),s["default"].createElement("div",{className:"history__filters"},s["default"].createElement("div",{className:"history__title"},"Filter by category"),s["default"].createElement("div",{className:"history__category-filter"},s["default"].createElement(_["default"],{rootCategoryId:a,categoryList:r,allowEmpty:!0,emptyText:"Do not filter by category",value:this.state.filterCategory,onChange:this.onFilterByCategory})),s["default"].createElement("div",{className:"history__title"},"Filter by comment"),s["default"].createElement("div",{className:"history__comment-filter"},s["default"].createElement("input",{type:"text",value:this.state.filterComment,onChange:this.onFilterByComment}))))}});b.contextTypes={store:s["default"].PropTypes.object},n["default"]=b},{"../../action-creators":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/action-creators.js","../../arrays":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/arrays.js","../presentational/CategoryPicker":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/CategoryPicker.jsx","../presentational/ModalContainer":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/ModalContainer.jsx","./EditExpense":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/EditExpense.jsx","./ExpenseList":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/ExpenseList.jsx",moment:"moment",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/Root.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("moment"),i=(a(o),e("react-addons-update")),l=a(i),c=e("../../action-creators.js"),u=e("../presentational/NumberInput.jsx"),d=(a(u),e("./EditExpense.jsx")),f=a(d),m=e("../presentational/TabsContainer.jsx"),p=a(m),h=e("../presentational/WaitIndicator.jsx"),y=a(h),v=e("../presentational/ErrorPanel.jsx"),_=a(v),E=e("./History.jsx"),g=a(E),C=e("./Statistics.jsx"),b=a(C),x=e("./Settings"),k=a(x),N=e("../presentational/UserPanel"),j=a(N),D=s["default"].createClass({displayName:"Root",getInitialState:function(){return{activeTab:"Add expense"}},componentDidMount:function(){var e=this;this.unsubscribe=this.context.store.subscribe(function(){e.forceUpdate()})},componentUnmount:function(){this.unsubscribe()},onAdd:function(e){this.context.store.dispatch((0,c.newExpense)(e))},onAddCategory:function(e){this.context.store.dispatch((0,c.newCategory)(e))},onDelete:function(e){this.context.store.dispatch((0,c.deleteExpense)(e))},onSwitchTab:function(e){this.setState((0,l["default"])(this.state,{activeTab:{$set:e}}))},render:function(){var e,t=this.context.store,n=t.getState(),a=n.error,r=void 0===a?null:a,o=n.history,i=n.waiting;if("UNAUTHORIZED"===r)e=s["default"].createElement("div",{className:"unauthorized"},s["default"].createElement("div",{className:"unauthorized__caption"},"To use this application you should be authorized with Google Account"),s["default"].createElement("div",{className:"unauthorized__button"},s["default"].createElement("a",{href:window.context.backend_url+"/login?redirect="+encodeURIComponent(window.location.href)},s["default"].createElement("img",{className:"unhovered",src:"images/google_signin_buttons/web/1x/btn_google_signin_light_normal_web.png"}))));else{var l={};0===o.length&&(l.History="You have no expenses yet",l.Statistics="You have no expenses yet"),e=s["default"].createElement("div",null,s["default"].createElement(p["default"],{titleList:["Add expense","History","Statistics","Settings"],active:this.state.activeTab,onSwitch:this.onSwitchTab,disabled:l},s["default"].createElement("div",null,s["default"].createElement(f["default"],{onAdd:this.onAdd})),s["default"].createElement("div",null,s["default"].createElement(g["default"],{onDelete:this.onDelete})),s["default"].createElement("div",null,s["default"].createElement(b["default"],null)),s["default"].createElement("div",null,s["default"].createElement(k["default"],null))),s["default"].createElement(y["default"],{waiting:i}),s["default"].createElement(_["default"],{isError:null!==r}),s["default"].createElement(j["default"],null))}return s["default"].createElement("div",null,s["default"].createElement("div",{className:"logo"},s["default"].createElement("span",{className:"logo__title__span"},"MONEYTRACK")),e)}});D.contextTypes={store:s["default"].PropTypes.object},n["default"]=D},{"../../action-creators.js":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/action-creators.js","../presentational/ErrorPanel.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/ErrorPanel.jsx","../presentational/NumberInput.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/NumberInput.jsx","../presentational/TabsContainer.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/TabsContainer.jsx","../presentational/UserPanel":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/UserPanel.jsx","../presentational/WaitIndicator.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/WaitIndicator.jsx","./EditExpense.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/EditExpense.jsx","./History.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/History.jsx",
  "./Settings":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/Settings.jsx","./Statistics.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/Statistics.jsx",moment:"moment",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/Settings.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("react-addons-update"),i=a(o),l=e("../presentational/TabsContainer"),c=a(l),u=e("./UserSettings"),d=a(u),f=e("./EditCategoryList"),m=a(f),p=e("../../action-creators.js"),h=s["default"].createClass({displayName:"Settings",getInitialState:function(){return{active:"Categories"}},onNewCategory:function(e,t){this.context.store.dispatch((0,p.newCategory)({title:e,parentId:t}))},onRenameCategory:function(e,t){this.context.store.dispatch((0,p.editCategory)({id:e,title:t}))},onMoveCategory:function(e,t){this.context.store.dispatch((0,p.editCategory)({id:e,parentId:t}))},onDeleteCategory:function(e){this.context.store.dispatch((0,p.deleteCategory)({id:e}))},onSwitch:function(e){this.setState((0,i["default"])(this.state,{active:{$set:e}}))},render:function(){return s["default"].createElement("div",{className:"statistics"},s["default"].createElement(c["default"],{titleList:["Categories","User settings"],active:this.state.active,onSwitch:this.onSwitch},s["default"].createElement(m["default"],{onNewCategory:this.onNewCategory,onRenameCategory:this.onRenameCategory,onMoveCategory:this.onMoveCategory,onDeleteCategory:this.onDeleteCategory}),s["default"].createElement(d["default"],null)))}});h.contextTypes={store:s["default"].PropTypes.object},n["default"]=h},{"../../action-creators.js":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/action-creators.js","../presentational/TabsContainer":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/TabsContainer.jsx","./EditCategoryList":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/EditCategoryList.jsx","./UserSettings":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/UserSettings.jsx",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/Statistics.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("react-addons-update"),i=(a(o),e("moment")),l=(a(i),e("./SumTableStatistics")),c=a(l),u=s["default"].createClass({displayName:"Statistics",render:function(){var e=this.context.store.getState(),t=e.history;return 0===t.length?s["default"].createElement("div",{className:"sum-table-statistics"},s["default"].createElement("div",{className:"empty-history-msg"},"You have no expenses yet")):s["default"].createElement("div",{className:"statistics"},s["default"].createElement(c["default"],null))}});u.contextTypes={store:s["default"].PropTypes.object},n["default"]=u},{"./SumTableStatistics":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/SumTableStatistics.jsx",moment:"moment",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/SumTableStatistics.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(n,"__esModule",{value:!0});var s=e("react"),o=a(s),i=e("react-addons-update"),l=a(i),c=e("moment"),u=a(c),d=e("../presentational/TabsContainer"),f=a(d),m=e("../../money"),p=a(m),h=e("../../arrays"),y=p["default"].format(),v=Object,_=v.keys,E=o["default"].createClass({displayName:"SumTableStatistics",getInitialState:function(){var e=Object.keys(this.getYearMonthCategoryExpenseMap()).map(function(e){return parseInt(e)}).sort(h.desc);return{activeYear:e[0],showChild:!1,showAtRoot:!1,showDif:!1}},getYearMonthCategoryExpenseMap:function(){var e=this.context.store.getState(),t=e.history,n={};return t.forEach(function(e){var t=(0,u["default"])(e.date).month(),a=(0,u["default"])(e.date).year(),r=e.categoryId;a in n||(n[a]=[]),t in n[a]||(n[a][t]=[]),r in n[a][t]||(n[a][t][r]=[]),n[a][t][r].push(e)}),n},onChangeChild:function(e){this.setState((0,l["default"])(this.state,{showChild:{$set:!this.state.showChild}}))},onChangeShotAtRoot:function(e){this.setState((0,l["default"])(this.state,{showAtRoot:{$set:!this.state.showAtRoot}}))},onChangeShotDif:function(e){this.setState((0,l["default"])(this.state,{showDif:{$set:!this.state.showDif}}))},render:function(){function e(t,n,a){var r=d.filter(function(e){return e.parentId===n.id}),s=r.map(function(n){return e(t,n,a)}).reduce(function(e,t){return e+t},0),o=r.map(function(e){return t[e.id][a]}).reduce(function(e,t){return e+t},0);return o+s}function t(e){var t={};return Object.keys(e).forEach(function(n){Object.keys(e[n]).forEach(function(a){t[a]||(t[a]=0),t[a]+=e[n][a]})}),o["default"].createElement("tr",{key:"total"},o["default"].createElement("td",{className:"sum-table-statistics__year__total__title"},"Total:"),Object.keys(t).sort(p).map(function(e){var n=t[e],a=t[e-1],r=a?n-a:null;return o["default"].createElement("td",{key:e,className:"sum-table-statistics__year__total__value"},y(n),v(r))}))}function n(e){var n=[],a=d.filter(function(e){return e.parentId===m});return a.forEach(function(t){n.push.apply(n,r(E(e,t,0)))}),n.push(t(e)),n}function a(e){var t={};return d.forEach(function(n){t[n.id]={},Object.keys(e).sort(p).map(function(a){var r=e[a],s=r[n.id]||[],o=s.reduce(function(e,t){return e+t.amount},0);t[n.id][a]=o})}),t}var s=this,i=this.context.store.getState(),c=i.history,d=i.categoryList,m=i.rootCategoryId,p=function(e,t){return e-t},h=this.getYearMonthCategoryExpenseMap(),v=function(e){return s.state.showDif?e?e>0?o["default"].createElement("div",{className:"sum-table-statistics__year__value__dif sum-table-statistics__year__value__dif--plus"},"+"+y(e)):o["default"].createElement("div",{className:"sum-table-statistics__year__value__dif sum-table-statistics__year__value__dif--minus"},"-"+y(-e)):o["default"].createElement("div",{className:"sum-table-statistics__year__value__dif sum-table-statistics__year__value__dif--zero"},"0"):o["default"].createElement("div",null)},E=function g(t,n,a){var i=[],l=t[n.id];return i.push(o["default"].createElement("tr",{key:n.id},o["default"].createElement("td",{style:{paddingLeft:20*a+"px"},className:"sum-table-statistics__year__category"},n.title),_(l).sort(p).map(function(a){var r=l[a]+e(t,n,a),s=null;if(l[a-1]){var i=l[a-1]+e(t,n,a-1);s=i?r-i:null}return o["default"].createElement("td",{key:n.id+"-"+a,className:"sum-table-statistics__year__value"},y(r),v(s))}))),s.state.showChild&&!function(){var e=[];d.filter(function(e){return e.parentId===n.id}).forEach(function(n){e.push.apply(e,r(g(t,n,a+1)))}),s.state.showAtRoot&&e.unshift(o["default"].createElement("tr",{key:n.id+"-self"},o["default"].createElement("td",{style:{paddingLeft:20*(a+1)+"px"},className:"sum-table-statistics__year__category"},"(at root)"),_(l).sort(p).map(function(e){var t=l[e],a=l[e-1],r=a?t-a:null;return o["default"].createElement("td",{key:n.id+"-"+e,className:"sum-table-statistics__year__value"},y(t),v(r))}))),i.push.apply(i,e)}(),i};return 0===c.length?o["default"].createElement("div",{className:"sum-table-statistics"},o["default"].createElement("div",{className:"empty-history-msg"},"You have no expenses yet")):o["default"].createElement(f["default"],{className:"sum-table-statistics",titleList:Object.keys(h).sort(p),active:(this.state.activeYear||"").toString(),onSwitch:function(e){s.setState((0,l["default"])(s.state,{activeYear:{$set:e}}))}},Object.keys(h).sort(p).map(function(e){var t=a(h[e]);return o["default"].createElement("div",{key:e},o["default"].createElement("div",{className:"sum-table-statistics__controls"},o["default"].createElement("label",null,o["default"].createElement("input",{type:"checkbox",checked:s.state.showChild,onChange:s.onChangeChild})," show child categories"),o["default"].createElement("label",null,o["default"].createElement("input",{type:"checkbox",disabled:!s.state.showChild,checked:s.state.showAtRoot,onChange:s.onChangeShotAtRoot})," show 'at root'"),o["default"].createElement("label",null,o["default"].createElement("input",{type:"checkbox",checked:s.state.showDif,onChange:s.onChangeShotDif})," show difference")),o["default"].createElement("table",{className:"sum-table-statistics__year"},o["default"].createElement("tbody",null,o["default"].createElement("tr",null,o["default"].createElement("td",null),_(h[e]).sort(p).map(function(t){var n=(0,u["default"])().year(parseInt(e)).month(parseInt(t));return o["default"].createElement("td",{key:e+"-"+t,className:"sum-table-statistics__year__month"},n.format("MMMM"))})),n(t))))}))}});E.contextTypes={store:o["default"].PropTypes.object},n["default"]=E},{"../../arrays":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/arrays.js","../../money":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/money.js","../presentational/TabsContainer":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/TabsContainer.jsx",moment:"moment",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/UserSettings.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("react-addons-update"),i=(a(o),e("../../action-creators")),l=s["default"].createClass({displayName:"UserSettings",onChangeCurrency:function(e){this.context.store.dispatch((0,i.setCurrency)({currency:e.target.value}))},onChangeFirstDayOfWeek:function(e){this.context.store.dispatch((0,i.setFirstDayOfWeek)({firstDayOfWeek:e.target.value}))},render:function(){var e=this.context.store.getState().userSettings,t=e.currency,n=e.firstDayOfWeek;return s["default"].createElement("table",null,s["default"].createElement("tbody",null,s["default"].createElement("tr",null,s["default"].createElement("td",null,s["default"].createElement("label",null,"Currency:")),s["default"].createElement("td",null,s["default"].createElement("select",{value:t,onChange:this.onChangeCurrency},s["default"].createElement("option",{value:"USD"},"U.S. dollars"),s["default"].createElement("option",{value:"EUR"},"Euro"),s["default"].createElement("option",{value:"RUR"},"Russian rubles")))),s["default"].createElement("tr",null,s["default"].createElement("td",null,s["default"].createElement("label",null,"First day of week:")),s["default"].createElement("td",null,s["default"].createElement("select",{value:n,onChange:this.onChangeFirstDayOfWeek},s["default"].createElement("option",{value:"SUNDAY"},"Sunday"),s["default"].createElement("option",{value:"MONDAY"},"Monday"))))))}});l.contextTypes={store:s["default"].PropTypes.object},n["default"]=l},{"../../action-creators":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/action-creators.js",react:"react","react-addons-update":"react-addons-update"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/CategoryPicker.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"CategoryPicker",propTypes:{rootCategoryId:s["default"].PropTypes.number,categoryList:s["default"].PropTypes.arrayOf(s["default"].PropTypes.object),allowEmpty:s["default"].PropTypes.bool,value:s["default"].PropTypes.number},onChange:function(e){this.props.onChange(e)},renderRecurse:function(e,t){var n=this,a=e.slice().sort(function(e,t){return e.order-t.order});return a.map(function(e){var a=e.childIdList.map(function(e){return n.props.categoryList.filter(function(t){return t.id===e})[0]}),r=["category-picker__category"];n.props.value===e.id&&r.push("category-picker__category--selected"),r=r.join(" ");var o={paddingLeft:5+20*t+"px"};if(a.length>0){var i=a.length>0?n.renderRecurse(a,t+1):"";return[s["default"].createElement("div",{key:e.id,className:r,style:o,onClick:function(){return n.onChange(e.id)}},s["default"].createElement("div",{className:"category-picker__category__title"},e.title)),i]}return[s["default"].createElement("div",{key:e.id,className:r,style:o,onClick:function(){return n.onChange(e.id)}},s["default"].createElement("div",{className:"category-picker__category__title"},e.title))]})},render:function(){var e=this,t=this.props.categoryList.filter(function(t){return t.parentId===e.props.rootCategoryId}),n=this.renderRecurse(t,0);if(this.props.allowEmpty){var a=["category-picker__category"];null===this.props.value&&a.push("category-picker__category--selected"),a=a.join(" "),n.unshift(s["default"].createElement("div",{key:"empty",className:a,onClick:function(){return e.onChange(null)}},s["default"].createElement("div",{className:"category-picker__category__empty category-picker__category__title"},this.props.emptyText||"Not selected")))}return s["default"].createElement("div",{className:"category-picker"},n)}});n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/DateTimePicker.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("moment"),i=a(o),l=e("./ModalContainer"),c=a(l),u=e("./TabsContainer"),d=(a(u),e("./VSpinner")),f=a(d),m=e("./HSpinner"),p=a(m),h=s["default"].createClass({displayName:"TimePicker",onHoursUp:function(){var e=this.props.timestamp,t=(0,i["default"])(e);t.add(1,"hours"),this.props.onChange(t.valueOf())},onHoursDown:function(){var e=this.props.timestamp,t=(0,i["default"])(e);t.subtract(1,"hours"),this.props.onChange(t.valueOf())},onMinutesUp:function(){var e=this.props.timestamp,t=(0,i["default"])(e);t.add(1,"minutes"),this.props.onChange(t.valueOf())},onMinutesDown:function(){var e=this.props.timestamp,t=(0,i["default"])(e);t.subtract(1,"minutes"),this.props.onChange(t.valueOf())},onChangeHours:function(e){var t=e.target.value;t.length>2&&(t=t.substring(1));var n=parseInt(t);if(!(Number.isNaN(n)||0>n)){n>24&&(n=0);var a=this.props.timestamp,r=(0,i["default"])(a);r.hours(n),this.props.onChange(r.valueOf())}},onChangeMinutes:function(e){var t=e.target.value;t.length>2&&(t=t.substring(1));var n=parseInt(t);if(!(Number.isNaN(n)||0>n)){n>60&&(n=0);var a=this.props.timestamp,r=(0,i["default"])(a);r.minutes(parseInt(n)),this.props.onChange(r.valueOf())}},render:function(){var e=this.props.timestamp,t=(0,i["default"])(e);return s["default"].createElement("div",{className:"time-picker"},s["default"].createElement(f["default"],{onUp:this.onHoursUp,onDown:this.onHoursDown},s["default"].createElement("input",{className:"time-picker__input",value:t.format("HH"),onChange:this.onChangeHours})),s["default"].createElement(f["default"],{onUp:this.onMinutesUp,onDown:this.onMinutesDown},s["default"].createElement("input",{className:"time-picker__input",value:t.format("mm"),onChange:this.onChangeMinutes})))}}),y=s["default"].createClass({displayName:"DatePicker",onChange:function(e,t,n,a){var r=this.props.timestamp,s=(0,i["default"])(r);s.year(e),s.month(t),s.week(n),s.day(a),this.props.onChange(s.valueOf())},onPrevMonth:function(){var e=(0,i["default"])(this.props.timestamp);e.subtract(1,"month"),this.props.onChange(e.valueOf())},onNextMonth:function(){var e=(0,i["default"])(this.props.timestamp);e.add(1,"month"),this.props.onChange(e.valueOf())},render:function(){var e=this,t=this.props,n=t.timestamp,a=t.firstDayOfWeek,r=void 0===a?"SUNDAY":a,o=[0,1,2,3,4,5,6],l=[0,1,2,3,4,5],c=(0,i["default"])(n),u=(0,i["default"])(n).date(1).startOf("MONDAY"===r?"isoweek":"week").valueOf();return s["default"].createElement("div",{className:"date-picker"},s["default"].createElement(p["default"],{onUp:this.onNextMonth,onDown:this.onPrevMonth},s["default"].createElement("div",{className:"date-picker__months__title"},c.format("YYYY, MMMM"))),s["default"].createElement("table",{className:"date-picker__calendar"},s["default"].createElement("thead",null,s["default"].createElement("tr",null,o.map(function(e){return s["default"].createElement("td",{key:"header_day_"+e,className:"date-picker__calendar__header date-picker__calendar__cell"},(0,i["default"])(u).add(e,"days").format("ddd"))}))),s["default"].createElement("tbody",null,l.map(function(t){return s["default"].createElement("tr",{key:"week_"+t},o.map(function(n){var a=(0,i["default"])(u).add(t,"weeks").add(n,"days"),r="date-picker__calendar__cell";return a.week()===c.week()&&a.day()==c.day()&&a.year()===c.year()&&a.month()===c.month()&&(r+=" date-picker__calendar__cell--active"),a.month()!==c.month()&&(r+=" date-picker__calendar__cell--another-month"),(6==a.isoWeekday()||7==a.isoWeekday())&&(r+=" date-picker__calendar__cell--weekend"),s["default"].createElement("td",{key:"week_"+t+"_day_"+n,onClick:function(t){return e.onChange(a.year(),a.month(),a.week(),a.day())},className:r},a.format("D"))}))}))))}}),v=s["default"].createClass({displayName:"DateTimePicker",getInitialState:function(){return{timestamp:this.props.timestamp,visible:!1}},onChange:function(e){this.setState({timestamp:e})},onClick:function(e){e.preventDefault(),this.setState({visible:!this.state.visible,timestamp:this.props.timestamp})},onSave:function(){this.setState({visible:!1,timestamp:this.props.timestamp}),this.props.onChange(this.state.timestamp)},onCancel:function(){this.setState({visible:!1})},render:function(){var e=this.props,t=e.timestamp,n=e.firstDayOfWeek,a=void 0===n?"SUNDAY":n;return s["default"].createElement("div",{className:"date-time-picker"},s["default"].createElement("div",{className:"pseudo-input-text",onClick:this.onClick},s["default"].createElement("i",{title:"Change date...",className:"icon icon-calendar icon1x","aria-hidden":"true"})," ",(0,i["default"])(t).format("HH:mm DD.MM.YYYY")),this.state.visible?s["default"].createElement(c["default"],{onCancel:this.onCancel},s["default"].createElement("div",{className:"date-time-picker__modal-content"},s["default"].createElement("div",{className:"date-time-picker__modal-content__section"},s["default"].createElement(h,{timestamp:this.state.timestamp,onChange:this.onChange})),s["default"].createElement("div",{className:"date-time-picker__modal-content__section"},s["default"].createElement(y,{timestamp:this.state.timestamp,onChange:this.onChange,firstDayOfWeek:a})),s["default"].createElement("div",{className:"date-time-picker__modal-content__section date-time-picker__modal-content__controls"},s["default"].createElement("button",{type:"button",onClick:this.onSave},"Save"),s["default"].createElement("button",{type:"button",onClick:this.onCancel},"Cancel")))):s["default"].createElement("span",null))}});v.unwrapState=function(e){return e.timestamp},n["default"]=v},{"./HSpinner":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/HSpinner.js","./ModalContainer":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/ModalContainer.jsx","./TabsContainer":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/TabsContainer.jsx","./VSpinner":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/VSpinner.js",moment:"moment",react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/ErrorPanel.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"ErrorPanel",render:function(){return this.props.isError?s["default"].createElement("div",{className:"error-panel"},"Something has gone wrong, sorry :( Please, reload the page"):null}});n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/HSpinner.js":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"HorSpinner",render:function(){return s["default"].createElement("div",{className:"h-counter"},s["default"].createElement("button",{type:"button",className:"h-counter__button h-counter__button--down",onClick:this.props.onDown},s["default"].createElement("div",{className:"arrow-left"})),s["default"].createElement("div",{className:"h-counter__middle"},this.props.children),s["default"].createElement("button",{type:"button",className:"h-counter__button h-counter__button--up",onClick:this.props.onUp},s["default"].createElement("div",{className:"arrow-right"})))}});n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/ModalContainer.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"ModalContainer",onCancel:function(e){e.target===this.refs.root&&this.props.onCancel&&this.props.onCancel(e)},onSave:function(e){13===e.keyCode&&this.props.onSave?this.props.onSave(e):27===e.keyCode&&this.props.onCancel&&this.props.onCancel(e)},render:function(){return this.props.visible!==!1?s["default"].createElement("div",{className:"modal-container",onClick:this.onCancel,ref:"root",onKeyUp:this.onSave},s["default"].createElement("div",{className:"modal-container__column"},s["default"].createElement("div",{className:"modal-container__column__cell"},this.props.children))):null}});n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/NumberInput.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=e("../../numbers"),i=s["default"].createClass({displayName:"NumberInput",propTypes:{value:s["default"].PropTypes.shape({number:s["default"].PropTypes.number.isRequired,text:s["default"].PropTypes.string.isRequired})},getDefaultProps:function(){return{number:0,text:""}},onChange:function(e){var t=e.target.value;t=t.replace(/\s/g,""),t=t.replace(/,/g,"."),t=/^0[0-9]+/.test(t)?t.substring(1):t,(0,o.isNumber)(t)&&this.props.onChange({text:t,number:(0,o.getNumber)(t)})},getValue:function(){return(0,o.getNumber)(this.state.value)},setValue:function(e){(0,o.isNumber)(e)&&this.setState({value:e})},render:function(){return s["default"].createElement("input",{value:this.props.value.text,onChange:this.onChange})}});i.wrapState=function(e){e=parseFloat(e);var t=0===e?"":""+e;return{number:e,text:t}},i.unwrapState=function(e){return e.number},n["default"]=i},{"../../numbers":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/numbers.js",react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/TabsContainer.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"TabsContainer",propTypes:{titleList:s["default"].PropTypes.arrayOf(s["default"].PropTypes.string),active:s["default"].PropTypes.string,checkTitleAndChildrenCount:function(e){if(e.titleList.length!==s["default"].Children.count(e.children))throw new Error("Length of titleList property and children count should be equal")}},onClick:function(e){var t=this;return function(n){n.preventDefault(),t.props.onSwitch(e)}},render:function(){var e=this,t=this.props.disabled||{},n=this.props.titleList.indexOf(this.props.active),a="tabs-container"+(this.props.className?" "+this.props.className:"");return s["default"].createElement("div",{className:a},s["default"].createElement("div",{className:"tabs-container__labels"},this.props.titleList.map(function(n){return n===e.props.active?s["default"].createElement("span",{key:n,className:"tabs-container__labels__label tabs-container__labels__label--active"},n):t[n]?s["default"].createElement("span",{key:n,className:"tabs-container__labels__label tabs-container__labels__label--disabled",title:t[n]},n):s["default"].createElement("span",{key:n,className:"tabs-container__labels__label"},s["default"].createElement("a",{href:"#",className:"pseudo",title:t[n],onClick:e.onClick(n)},n))})),s["default"].createElement("div",{className:"tabs-container__content"},s["default"].Children.map(this.props.children,function(e,t){return t===n?e:null})))}});o.contextTypes={store:s["default"].PropTypes.object},n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/UserPanel.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"UserPanel",render:function(){return s["default"].createElement("div",{className:"user-panel"},s["default"].createElement("a",{href:window.context.backend_url+"/logout?redirect="+encodeURIComponent(window.location.href)},"Log out"))}});n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/VSpinner.js":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"VSpinner",render:function(){return s["default"].createElement("div",{className:"v-counter"},s["default"].createElement("button",{type:"button",className:"v-counter__button v-counter__button--up",onClick:this.props.onUp},s["default"].createElement("div",{className:"arrow-up"})),s["default"].createElement("div",{className:"v-counter__middle"},this.props.children),s["default"].createElement("button",{type:"button",className:"v-counter__button v-counter__button--down",onClick:this.props.onDown},s["default"].createElement("div",{className:"arrow-down"})))}});n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/presentational/WaitIndicator.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(n,"__esModule",{value:!0});var r=e("react"),s=a(r),o=s["default"].createClass({displayName:"WaitIndicator",render:function(){return this.props.waiting?s["default"].createElement("div",{className:"wait-indicator"},"Please, wait..."):null}});n["default"]=o},{react:"react"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/entry-point-desktop.jsx":[function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s=e("es6-promise"),o=e("react"),i=a(o),l=e("react-dom"),c=a(l),u=e("react-addons-update"),d=a(u),f=e("redux"),m=e("redux-logger"),p=a(m),h=e("redux-thunk"),y=a(h),v=e("react-redux"),_=e("moment"),E=a(_),g=e("./ajax"),C=a(g),b=e("./components/containers/Root.jsx"),x=a(b);e("./arrays");"PROD"===window.context.env&&"http:"===window.location.protocol&&(window.location.href=window.location.href.replace(/^http/,"https"));var k=window.context.backend_url+"/dispatch";C["default"].get(k).then(function(e){return e},function(e){return console.error(e),console.error("Failed to load state, use default state"),s.Promise.resolve({error:"UNAUTHORIZED"})}).then(function(e){var t=function(){var t=arguments.length<=0||void 0===arguments[0]?e:arguments[0],n=arguments[1],a=n.type;n.status;switch(a){case"WAIT":return(0,d["default"])(t,{waiting:{$set:!0}});case"STOP_WAIT":return(0,d["default"])(t,{waiting:{$set:!1}});case"ERROR":return(0,d["default"])(t,{error:{$set:!0}});case"NEW_EXPENSE":var s=function(){var e=parseFloat(n.amount),a=parseInt(n.categoryId),r=n.comment,s=n.id,o=(0,E["default"])(n.date).valueOf(),i=!isNaN(e)&&t.categoryList.filter(function(e){return e.id===a}).length>0;return i?{v:(0,d["default"])(t,{history:{$push:[{id:s,amount:e,categoryId:a,comment:r,date:o}]}})}:void console.error("Invalid action",n)}();if("object"===("undefined"==typeof s?"undefined":r(s)))return s.v;break;case"EDIT_EXPENSE":var o=function(){var e=n.id,a=parseFloat(n.amount),r=parseInt(n.categoryId),s=n.comment,o=(0,E["default"])(n.date).valueOf(),i=t.history.map(function(t){return t.id===e?{id:e,amount:a,categoryId:r,comment:s,date:o}:t});return{v:(0,d["default"])(t,{history:{$set:i}})}}();if("object"===("undefined"==typeof o?"undefined":r(o)))return o.v;break;case"DELETE_EXPENSE":return(0,d["default"])(t,{history:{$set:t.history.filter(function(e){return e.id!==n.id})}});case"NEW_CATEGORY":var i=function(){var e=parseFloat(n.id),a=n.title,r=n.parentId,s={id:e,title:a,parentId:r,childIdList:[]},o=t.categoryList.map(function(t){return t.id===r?(0,d["default"])(t,{childIdList:{$push:[e]}}):t});return o=o.concat([s]),{v:(0,d["default"])(t,{categoryList:{$set:o}})}}();if("object"===("undefined"==typeof i?"undefined":r(i)))return i.v;break;case"EDIT_CATEGORY":var l=function(){var e=parseFloat(n.id),a=n.title,r=n.parentId,s=t.categoryList;return null!==a&&(s=s.map(function(t){return t.id===e?(0,d["default"])(t,{title:{$set:a}}):t})),null!==r&&!function(){var n=t.categoryList.filter(function(t){return t.id==e})[0],a=n.parentId;a!==r&&(s=s.map(function(t){if(t.id===e)return(0,d["default"])(t,{parentId:{$set:r}});if(t.id===a){var n=t.childIdList.filter(function(t){return t!==e});return(0,d["default"])(t,{childIdList:{$set:n}})}if(t.id===r){var n=t.childIdList.concat([e]);return(0,d["default"])(t,{childIdList:{$set:n}})}return t}))}(),{v:(0,d["default"])(t,{categoryList:{$set:s}})}}();if("object"===("undefined"==typeof l?"undefined":r(l)))return l.v;break;case"DELETE_CATEGORY":var c=function(){var e=n.id,a=t.categoryList.filter(function(t){return t.id==e})[0],r=a.parentId,s=t.categoryList.filter(function(t){return t.id!==e}).map(function(e){return e.id===r?(0,d["default"])(e,{childIdList:{$set:e.childIdList.filter(function(e){return e!==n.id})}}):e});return{v:(0,d["default"])(t,{categoryList:{$set:s}})}}();if("object"===("undefined"==typeof c?"undefined":r(c)))return c.v;break;case"SET_CURRENCY":var u=n.currency;return(0,d["default"])(t,{userSettings:{currency:{$set:u}}});case"SET_FIRST_DAY_OF_WEEK":var f=n.firstDayOfWeek;return(0,d["default"])(t,{userSettings:{firstDayOfWeek:{$set:f}}});default:console.warn("Unhandled action",n)}return t},n=(0,f.applyMiddleware)(y["default"],(0,p["default"])())(f.createStore)(t);c["default"].render(i["default"].createElement(v.Provider,{store:n},i["default"].createElement(x["default"],null)),document.getElementById("react"))},function(e){console.error(e)})["catch"](function(e){console.error(e)})},{"./ajax":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/ajax.js","./arrays":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/arrays.js","./components/containers/Root.jsx":"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/components/containers/Root.jsx","es6-promise":"es6-promise",moment:"moment",react:"react","react-addons-update":"react-addons-update","react-dom":"react-dom","react-redux":"react-redux",redux:"redux","redux-logger":"redux-logger","redux-thunk":"redux-thunk"}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/money.js":[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n["default"]={format:function(e){
  return function(t){e=e||{};for(var n=e.groupDelim||" ",a=e.decimalDelim||".",r=e.currency||"",s=e.currencyBefore||!1,o="",i=parseInt(t/100),l=parseInt(t%100);i>=1e3;){var c=i%1e3;o=c+o,100>c&&(o="0"+o),10>c&&(o="0"+o),o=n+o,i=parseInt(i/1e3)}return o=i+o,o+=a,10>l&&(o+="0"),o+=l,s?o=r+o:o+=r,o}},formatString:function(e){return function(t){var n,a=e.currency||"",r=e.currencyBefore||!1;return n=r?a+t:t+a}},settings:{byCurrency:{USD:{currency:"$",currencyBefore:!0},EUR:{currency:" "+String.fromCharCode(parseInt("8364"))},RUR:{currency:" "+String.fromCharCode(parseInt("8381"))}}}}},{}],"/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/numbers.js":[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.isNumber=function(e){return/^[0-9]*([,.][0-9]*)?$/.test(e)?!0:void 0},n.getNumber=function(e){return""===e||"."===e||","===e?0:parseFloat(e)}},{}]},{},["/Users/koluch/Dropbox/dev/js/moneytrack/frontend/scripts/entry-point-desktop.jsx"]);