text: (this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{14:function(e,t,a){},16:function(e,t,a){},20:function(e,t,a){e.exports=a(33)},25:function(e,t,a){},26:function(e,t,a){},30:function(e,t,a){},33:function(e,t,a){"use strict";a.r(t);var i=a(0),s=a.n(i),r=a(17),n=a.n(r),l=(a(25),a(2)),o=a(3),c=a(5),d=a(4),m=a(19),u=(a(26),a(8)),p=a.n(u),h=a(9),f=a(11),g=(a(14),function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).handleKeyPress=function(e){13===e.keyCode&&i.inputRef.current.blur()},i.handleBlur=function(e){var t=e.target.value;t!==i.props.title&&i.props.setItemTitle(i.props.listName,i.state.itemID,t)},i.inputRef=s.a.createRef(),i.state={itemID:e.itemID,title:i.props.title,dueDate:i.props.dueDate,completed:i.props.completed,priority:i.props.priority,pressedKeys:{}},i.handleCheck=i.handleCheck.bind(Object(f.a)(i)),i}return Object(o.a)(a,[{key:"handleCheck",value:function(e){var t=e.target.checked;this.props.setItemCompleted(this.props.listName,this.state.itemID,t)}},{key:"handleItemSelection",value:function(e){this.props.setSelectedItem(this.state.itemID)}},{key:"handleCmdDelete",value:function(e){var t=this.state.pressedKeys;91===e.keyCode&&t[8]?(t[e.keyCode]="keydown"===e.type,t[8]=!1):91!==e.keyCode||t[8]?8===e.keyCode&&!0===t[91]&&(this.props.handleDelete(),t={},this.setState({pressedKeys:t})):t[e.keyCode]="keydown"===e.type}},{key:"componentDidUpdate",value:function(e){e.title===this.props.title&&e.itemID===this.props.itemID&&e.dueDate===this.props.dueDate&&e.priority===this.props.priority&&e.completed===this.props.completed||this.setState({title:this.props.title,itemID:this.props.itemID,dueDate:this.props.dueDate,priority:this.props.priority,completed:this.props.completed})}},{key:"render",value:function(){var e=this,t=this.state.title,a=this.state.dueDate,i=this.state.completed,r=function(e){if(""===e||void 0===e||null===e)return"";var t=new Date,a=t.getFullYear(),i=parseInt(e.substring(0,4)),s=parseInt(e.substring(5,7)),r=parseInt(e.substring(8,10)),n=new Date(i+"-"+s+"-"+r+" 00:00");if(n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()){var l=new Date;l.setDate(l.getDate()-1);var o=new Date;if(o.setDate(o.getDate()+1),n.getDate()===t.getDate())return"Today";if(n.getDate()===l.getDate())return"Yesterday";if(n.getDate()===o.getDate())return"Tomorrow"}return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s-1]+" "+r+(a===i?"":", "+i)}(a),n="pr-2 col-2 text-right item-due-date font-small"+(function(e){if(""===e)return!1;var t=new Date-1;return new Date(e+" 00:00")<t}(a)?" text-danger":""),l="row no-gutters justify-content-center pt-1 pb-1 pl-4 pr-1 align-items-center todo-item"+(this.state.completed?" completed":"")+(this.state.itemID===this.props.selectedItemID?" selected-item":""),o=function(e){if("high"===e)return"rgb(218, 56, 73)";if("medium"===e)return"rgb(254, 192, 47)";if("low"===e)return"rgb(21, 127, 251)"}(this.state.priority),c="ml-2 form-control-sm title-input"+(this.state.itemID===this.props.selectedItemID?" selected-item-input":"");return s.a.createElement("div",{className:l,onClick:function(t){return e.handleItemSelection(t)},onContextMenu:function(t){return e.handleItemSelection(t)},style:{borderColor:o}},s.a.createElement("div",{className:"col-10 text-left align-items-center"},s.a.createElement("input",{className:"form-check-input",type:"checkbox",value:"",checked:i,onChange:this.handleCheck}),s.a.createElement("input",{spellCheck:"false",className:c,value:t,ref:this.inputRef,onKeyDown:function(t){e.handleKeyPress(t),e.handleCmdDelete(t)},onBlur:function(t){return e.handleBlur(t)},onChange:function(t){return e.setState({title:t.target.value})},autoComplete:"off"})),s.a.createElement("div",{className:n},r))}}]),a}(i.Component));var y=a(18),v=(a(29),function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(){return Object(l.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"handleClear",value:function(){this.props.handleCalendarOverlayClear()}},{key:"setDate",value:function(e){var t=function(e){var t=e.getDate();t<10&&(t="0"+t.toString());var a=e.getMonth()+1;a<10&&(a="0"+a.toString());return e.getFullYear().toString()+"-"+a+"-"+t}(e);this.props.setDueDate(t)}},{key:"render",value:function(){var e=this,t=void 0;return""!==this.props.currentlySelectedDate&&void 0!==this.props.currentlySelectedDate&&null!==this.props.currentlySelectedDate&&(t=new Date(this.props.currentlySelectedDate+" 00:00")),s.a.createElement("div",{className:"calendar-overlay shadow"},s.a.createElement(y.a,{value:t,onChange:function(t){return e.setDate(t)}}),s.a.createElement("div",{className:"row mt-4"},s.a.createElement("div",{className:"col-6"},s.a.createElement("button",{type:"button",className:"btn btn-secondary calendar-overlay-button",onClick:function(){return e.handleClear()}},"Clear")),s.a.createElement("div",{className:"col-6"},s.a.createElement("button",{type:"button",className:"btn btn-primary  calendar-overlay-button",onClick:function(){return e.props.handleCalendarOverlayOK()}},"OK"))))}}]),a}(i.Component));var D=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(){var e;Object(l.a)(this,a);for(var i=arguments.length,s=new Array(i),r=0;r<i;r++)s[r]=arguments[r];return(e=t.call.apply(t,[this].concat(s))).state={selectedPriority:e.props.currentlySelectedPriority},e}return Object(o.a)(a,[{key:"handlePriorityItemClick",value:function(e){var t=e.target.innerHTML.toLowerCase();this.setState({selectedPriority:t}),this.props.handlePrioritiesOverlayClick(t)}},{key:"render",value:function(){var e=this,t="priorities-overlay-item text-left"+("high"===this.props.currentlySelectedPriority?" text-danger":""),a="priorities-overlay-item text-left"+("medium"===this.props.currentlySelectedPriority?" text-warning":""),i="priorities-overlay-item text-left"+("low"===this.props.currentlySelectedPriority?" text-primary":"");return s.a.createElement("div",{className:"overlay priorities-overlay shadow"},s.a.createElement("div",{className:t,onClick:function(t){return e.handlePriorityItemClick(t)}},"High"),s.a.createElement("div",{className:a,onClick:function(t){return e.handlePriorityItemClick(t)}},"Medium"),s.a.createElement("div",{className:i,onClick:function(t){return e.handlePriorityItemClick(t)}},"Low"))}}]),a}(i.Component);function b(e,t,a){return t<10&&(t="0"+t.toString()),a<10&&(a="0"+a.toString()),e+"-"+t+"-"+a}function N(e,t,a){for(var i=0,s=0;s<e.length;s++)if(e[s]===t&&++i===a)return s;if(1===i)return e.indexOf(t)}var I=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).state={calendarOverlayDisplaying:!1,prioritiesOverlayDisplaying:!1,addItemValue:"",addItemDate:"",addItemPriority:"low",listItems:i.props.items,addItemDateKeywords:"",addItemPriorityKeywords:"",completedItemsShowing:!1},i.inputRef=s.a.createRef(),i}return Object(o.a)(a,[{key:"componentDidMount",value:function(){p()(document).ready((function(){p()("#completed-items").hide()}))}},{key:"keyPress",value:function(e){var t=document.getElementById("addItemInput").value;if(""!==this.state.addItemDate&&(t=k(t,this.state.addItemDateKeywords)),""!==this.state.addItemPriorityKeywords&&(t=k(t,this.state.addItemPriorityKeywords)),t=t.replace(/\s+/g," ").trim(),13===e.keyCode&&""!==t){this.props.addListItem(this.props.name,t,this.state.addItemDate,"",this.state.addItemPriority,this.props.color),p()("#addItemInput").val(""),this.handleCalendarOverlayOK(),this.setState({addItemDate:"",addItemValue:"",addItemDateKeywords:"",addItemPriority:"low",keywordSet:!1}),p()(document).find(".add-item-input-container").show();var a=p.a.Event("keyDown");a.which=8,p()("#addItemInput").trigger(a)}}},{key:"handleInput",value:function(e){var t="both"===this.props.keywords||"dates"===this.props.keywords,a="both"===this.props.keywords||"priorities"===this.props.keywords,i=t?function(e){for(var t=["today","tomorrow","yesterday","yday","tmr","monday","mon","tuesday","tue","wednesday","thursday","friday","saturday","sunday"],a=["january","jan","february","feb","march","april","may","june","july","august","aug","september","sep","october","oct","november","nov","december","dec"],i=["1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st"],s=e.toLowerCase().split(" "),r=!1,n=!1,l=null,o="",c="",d=[],m="",u=0;u<s.length;u++){var p=s[u];if(-1!==t.indexOf(p)){o=p,r=!0;break}}if(!1===r){for(var h=0;h<s.length;h++){var f=s[h];-1!==a.indexOf(f)&&d.push(f)}if(d.length>0)for(var g=0;g<d.length;g++){var y=N(s,d[g],g+1),v=[];y-1>=0&&v.push({index:y-1,date:s[y-1]}),y+1<s.length&&v.push({index:y+1,date:s[y+1]});for(var D=0;D<v.length;D++){var I=v[D].date,k=v[D].index;if(-1!==i.indexOf(I)){m=I,l=k>y;break}}if(""===m)for(var S=0;S<v.length;S++){var E=parseInt(v[S].date),w=v[S].index;if(E>0&&E<=31){m=E,l=w>y;break}}if(""!==m){n=!0,c=d[g];break}}}var C=new Date,O=C.getFullYear(),L=C.getMonth()+1,x=C.getDate(),j=C.getDay()+1;if(!r&&!n)return{date:"",keywords:""};if(r&&!n){if("today"===o)return{date:b(O,L,x),keywords:o};if("yesterday"===o||"yday"===o){var T=new Date;return T.setDate(T.getDate()-1),{date:b(T.getFullYear(),T.getMonth()+1,T.getDate()),keywords:o}}if("tomorrow"===o||"tmr"===o){var P=new Date;return P.setDate(P.getDate()+1),{date:b(P.getFullYear(),P.getMonth()+1,P.getDate()),keywords:o}}var A=function(e,t){var a=7-e+t;7!==a&&(a%=7);return a}(j,function(e){var t=["","sunday","monday","tuesday","wednesday","thursday","friday","saturday"].indexOf(e);if(-1===t){t=["","sun","mon","tue","wed","thu","fri","sat"].indexOf(e)}return t}(o)),R=new Date;return R.setDate(R.getDate()+A),{date:b(R.getFullYear(),R.getMonth()+1,R.getDate()),keywords:o}}if(n&&!r){var F=C.getDate(),J=function(e){return"jan"===e?1:"feb"===e?2:"aug"===e?8:"sep"===e?9:"oct"===e?10:"nov"===e?11:"dec"===e?12:["","january","february","march","april","may","june","july","august","september","october","november","december"].indexOf(e)}(c),K=parseInt(m),z=O;J<L?z=O+1:J===L?K<F&&(z=O+1):z=O;var W=l?c+" "+m:m+" "+c;return{date:b(z,J,K),keywords:W}}}(e.target.value):{date:this.state.addItemDate,keywords:""},s=a?function(e){for(var t=["!high","!medium","!low","!lo","!hi","!med"],a=e.toLowerCase().split(" "),i="",s=0;s<a.length;s++){var r=a[s];if(-1!==t.indexOf(r)){i=r;break}}return""===i?{priority:"low",keywords:""}:{priority:function(e){if("!lo"===e||"!low"===e)return"low";if("!med"===e||"!medium"===e)return"medium";if("!hi"===e||"!high"===e)return"high"}(i),keywords:i}}(e.target.value):{priority:this.state.addItemPriority,keywords:""},r=i.date,n=i.keywords,l=s.priority,o=s.keywords;""===n&&""!==this.state.addItemDateKeywords&&-1!==e.target.value.indexOf(this.state.addItemDateKeywords)&&(r=this.state.addItemDate,n=this.state.addItemDateKeywords),""===o&&-1!==e.target.value.indexOf(this.state.addItemPriorityKeywords)&&(l=this.state.addItemPriority,o=this.state.addItemPriorityKeywords),this.setState({addItemValue:e.target.value,addItemDate:r,addItemDateKeywords:n,addItemPriority:l,addItemPriorityKeywords:o})}},{key:"setAddItemDate",value:function(e){this.setState({addItemDate:e})}},{key:"handleDelete",value:function(e,t){this.props.deleteListItem(this.props.name,e,t)}},{key:"handleCalendarOverlayOK",value:function(){this.setState({calendarOverlayDisplaying:!1})}},{key:"handleCalendarOverlayClear",value:function(){this.setState({calendarOverlayDisplaying:!1,addItemDate:""})}},{key:"handleShowCalendarOverlay",value:function(e){var t=7*e.clientX/12;p()(".calendar-overlay").css("left",t+"px"),this.state.calendarOverlayDisplaying?this.setState({calendarOverlayDisplaying:!1}):this.setState({calendarOverlayDisplaying:!0})}},{key:"handleShowPrioritiesOverlay",value:function(e){var t=7*e.clientX/12;p()(".priorities-overlay").css("left",t+"px"),this.state.prioritiesOverlayDisplaying?this.setState({prioritiesOverlayDisplaying:!1}):this.setState({prioritiesOverlayDisplaying:!0})}},{key:"handlePrioritiesOverlayClick",value:function(e){this.setState({addItemPriority:e,prioritiesOverlayDisplaying:!1})}},{key:"getIndexOfFirstCompletedItem",value:function(){for(var e=this.props.items,t=0;t<e.length;t++)if(e[t].completed)return t;return-1}},{key:"getPriorityIconClasses",value:function(){var e="fas fa-balance-scale-left priorities-base";return"high"===this.state.addItemPriority?e+=" text-danger":"medium"===this.state.addItemPriority?e+=" text-warning":"low"===this.state.addItemPriority&&(e+=" text-primary"),e}},{key:"handleCloseOverlays",value:function(e){(this.state.calendarOverlayDisplaying||this.state.prioritiesOverlayDisplaying)&&("calendar-overlay"!==e.target.id&&"priorities-overlay"!==e.target.id?this.setState({calendarOverlayDisplaying:!1,prioritiesOverlayDisplaying:!1}):"calendar-overlay"===e.target.id?this.setState({prioritiesOverlayDisplaying:!1}):"priorities-overlay"===e.target.id&&this.setState({calendarOverlayDisplaying:!1}),this.inputRef.current.focus())}},{key:"getCalendarIconClasses",value:function(){var e="fas fa-calendar-alt calendar-base";return""!==this.state.addItemDate&&(e+=" calendar-selected"),e}},{key:"handleCompletedSeparatorClick",value:function(){this.setState({completedItemsShowing:!this.state.completedItemsShowing}),p()(document).find("#completed-items").slideToggle("fast")}},{key:"render",value:function(){var e=this,t=this.props.name,a=this.state.calendarOverlayDisplaying?"":"d-none",i=this.state.prioritiesOverlayDisplaying?"":"d-none",r=function(e){if(""===e)return"";var t=(new Date).getFullYear(),a=parseInt(e.substring(0,4)),i=parseInt(e.substring(5,7)),s=parseInt(e.substring(8,10));return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][i-1]+" "+s+(t===a?"":", "+a)}(this.state.addItemDate),n='Add a task to "'+t+'"'+(""===r?"":" on "+r),l=this.state.addItemValue,o=this.getPriorityIconClasses(),c=this.getCalendarIconClasses();p()(document).find(".add-item-input-container").show();var d=this.getIndexOfFirstCompletedItem(),m=[],u=[];-1!==d?(m=this.props.items.slice(0,d),u=this.props.items.slice(d,this.props.items.length)):(m=this.props.items.slice(),u=[]);var f="",y="fas fa-plus-square mr-2";"Today"===t?(f="Nothing due today, let's get ahead!",y="fas fa-exclamation-circle mr-2"):"All"===t?(f="Nothing due, kick back and relax.",y="fas fa-exclamation-circle mr-2"):"Next 7 Days"===t?(f="Nothing due in the next week, let's get ahead!",y="fas fa-exclamation-circle mr-2"):(f=u.length>0?"Nothing due at the moment.":"Add an item above",y="fas fa-exclamation-circle mr-2");var b="fas fa-sort-down mr-2 base"+(this.state.completedItemsShowing?"":" icon-rotated");return s.a.createElement("div",{className:"container-fluid todolist",onClick:function(t){return e.handleCloseOverlays(t)}},s.a.createElement("h3",{className:"list-name text-left pl-1 my-4"},t),s.a.createElement("div",{className:"add-item-input-container"},s.a.createElement("div",{className:"input-group mb-4"},s.a.createElement("input",{spellCheck:"false",suppressContentEditableWarning:!0,id:"addItemInput",placeholder:n,className:"form-control form-control-sm text-left editable"+("Today"===t||"Next 7 Days"===t||"All"===t?" d-none":""),type:"text",defaultValue:l,onInput:function(t){return e.handleInput(t)},onKeyDown:function(t){return e.keyPress(t)},ref:this.inputRef,onClick:function(){return e.props.hideAddListOverlay()},autoComplete:"off"}),s.a.createElement("div",{className:"input-group-append"+("Today"===t||"Next 7 Days"===t||"All"===t?" d-none":""),onClick:function(t){e.handleShowPrioritiesOverlay(t),e.props.hideAddListOverlay()}},s.a.createElement("span",{className:"input-group-text icon"},s.a.createElement("i",{className:o}))),s.a.createElement("div",{id:"priorities-overlay",className:i},s.a.createElement(D,{handlePrioritiesOverlayClick:function(t){return e.handlePrioritiesOverlayClick(t)},currentlySelectedPriority:this.state.addItemPriority})),s.a.createElement("div",{className:"input-group-append",onClick:function(t){e.handleShowCalendarOverlay(t),e.props.hideAddListOverlay()}},s.a.createElement("span",{className:"input-group-text icon"+("Today"===t||"Next 7 Days"===t||"All"===t?" d-none":"")},s.a.createElement("i",{className:c}))))),s.a.createElement("div",{id:"calendar-overlay",className:a},s.a.createElement(v,{setDueDate:function(t){return e.setAddItemDate(t)},handleCalendarOverlayOK:function(){return e.handleCalendarOverlayOK()},handleCalendarOverlayClear:function(){return e.handleCalendarOverlayClear()},currentlySelectedDate:this.state.addItemDate})),s.a.createElement("div",{className:"todolist-items"},s.a.createElement("div",{id:"incompleted-items"},s.a.createElement("span",{className:"pl-2 font-small font-grey "+(0===m.length?"":"d-none"),style:{pointerEvents:"none"}},s.a.createElement("i",{className:y}),f),m.map((function(a,i){return s.a.createElement("div",{className:"list-item",key:a.itemID},s.a.createElement(h.b,{id:a.itemID},s.a.createElement(g,{listName:t,title:a.title,description:a.description,priority:a.priority,dueDate:a.dueDate,completed:a.completed,itemID:a.itemID,setItemCompleted:function(t,a,i){return e.props.setItemCompleted(t,a,i)},setItemTitle:function(t,a,i){return e.props.setItemTitle(t,a,i)},setSelectedItem:function(t){return e.props.setSelectedItem(t)},selectedItemID:e.props.selectedItemID,handleDelete:function(){return e.handleDelete(a.itemID,a.originalList)}})),s.a.createElement(h.a,{id:a.itemID,className:"delete-menu px-2 py-1 shadow-sm"},s.a.createElement(h.c,{data:{foo:"bar"},className:"delete-menu-item px-1",onClick:function(){return e.handleDelete(a.itemID,a.originalList)}},s.a.createElement("div",{className:"row align-items-center justify-content-left"},s.a.createElement("i",{className:"fas fa-trash col-1"}),s.a.createElement("span",{className:"col-6"},"Delete")))))}))),s.a.createElement("div",{style:{cursor:"pointer"},className:"completed-separator mt-2 mb-2 font-small text-left "+(0===u.length||"Today"===t||"Next 7 Days"===t||"All"===t?"d-none":""),onClick:function(){return e.handleCompletedSeparatorClick()}},s.a.createElement("i",{id:"completed-separator-icon",className:b}),"Completed"),s.a.createElement("div",{id:"completed-items",className:"Today"===t||"Next 7 Days"===t||"All"===t?"d-none":""},u.map((function(a,i){return s.a.createElement("div",{className:"list-item",key:a.itemID},s.a.createElement(h.b,{id:a.itemID},s.a.createElement(g,{listName:t,title:a.title,description:a.description,priority:a.priority,dueDate:a.dueDate,completed:a.completed,itemID:a.itemID,setItemCompleted:function(t,a,i){return e.props.setItemCompleted(t,a,i)},setItemTitle:function(t,a,i){return e.props.setItemTitle(t,a,i)},setSelectedItem:function(t){return e.props.setSelectedItem(t)},selectedItemID:e.props.selectedItemID,handleDelete:function(){e.handleDelete(a.itemID,a.originalList)}})),s.a.createElement(h.a,{id:a.itemID.toString(),className:"delete-menu px-2 py-1 shadow-sm"},s.a.createElement(h.c,{data:{foo:"bar"},className:"delete-menu-item px-1",onClick:function(){return e.handleDelete(a.itemID,a.originalList)}},s.a.createElement("div",{className:"row align-items-center justify-content-left"},s.a.createElement("i",{className:"fas fa-trash col-1"}),s.a.createElement("span",{className:"col-6"},"Delete")))))}))),s.a.createElement("div",{id:"bottom-line",className:"list-item"+(this.state.completedItemsShowing||0===u.length||"Today"===t||"All"===t||"Next 7 Days"===t?" d-none":"")})))}}]),a}(i.Component);function k(e,t){if(""===t)return e;var a=e.toLowerCase().indexOf(t),i=a+t.length;return e.substring(0,a)+e.substring(i,e.length)}var S=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).handleTitleInputBlur=function(e){var t=e.target.value;t!==i.props.selectedItemTitle&&i.props.setItemTitle(i.props.listName,i.props.selectedItemID,t)},i.handleTitleInputKeyPress=function(e){13===e.keyCode&&i.titleInputRef.current.blur()},i.handleDescInputBlur=function(e){var t=e.target.value;t!==i.props.selectedItemDescription&&i.props.setItemDescription(i.props.listName,i.props.selectedItemID,t)},i.handleDescInputKeyPress=function(e){9===e.keyCode&&i.descInputRef.current.blur()},i.titleInputRef=s.a.createRef(),i.descInputRef=s.a.createRef(),i.state={itemID:i.props.selectedItemID,title:i.props.selectedItemTitle,dueDate:i.props.selectedItemDueDate,priority:i.props.selectedItemPriority,description:i.props.selectedItemDescription,completed:i.props.selectedItemCompleted,calendarOverlayDisplaying:!1,prioritiesOverlayDisplaying:!1},i.handleCheck=i.handleCheck.bind(Object(f.a)(i)),i}return Object(o.a)(a,[{key:"handleCalendarOverlayOK",value:function(){this.setState({calendarOverlayDisplaying:!1})}},{key:"handleCalendarOverlayClear",value:function(){this.setState({calendarOverlayDisplaying:!1,dueDate:""}),this.props.setItemDueDate(this.props.listName,this.state.itemID,"")}},{key:"handleShowCalendarOverlay",value:function(){this.state.calendarOverlayDisplaying?this.setState({calendarOverlayDisplaying:!1}):this.setState({calendarOverlayDisplaying:!0})}},{key:"handleShowPrioritiesOverlay",value:function(){this.state.prioritiesOverlayDisplaying?this.setState({prioritiesOverlayDisplaying:!1}):this.setState({prioritiesOverlayDisplaying:!0})}},{key:"handleCheck",value:function(e){var t=e.target.checked;this.props.setItemCompleted(this.props.listName,this.state.itemID,t)}},{key:"handleCalendarChange",value:function(e){this.props.setItemDueDate(this.props.listName,this.state.itemID,e)}},{key:"handlePriorityChange",value:function(e){this.props.setItemPriority(this.props.listName,this.state.itemID,e),this.setState({priority:e,prioritiesOverlayDisplaying:!1})}},{key:"componentDidUpdate",value:function(e){e.selectedItemTitle===this.props.selectedItemTitle&&e.selectedItemDueDate===this.props.selectedItemDueDate&&e.selectedItemCompleted===this.props.selectedItemCompleted&&e.selectedItemDescription===this.props.selectedItemDescription&&e.selectedItemPriority===this.props.selectedItemPriority&&e.selectedItemID===this.props.selectedItemID||this.setState({title:this.props.selectedItemTitle,dueDate:this.props.selectedItemDueDate,completed:this.props.selectedItemCompleted,description:this.props.selectedItemDescription,priority:this.props.selectedItemPriority,itemID:this.props.selectedItemID})}},{key:"render",value:function(){var e=this,t="col-1 offset-md-4 details-priority-picker";"high"===this.state.priority?t+=" text-danger":"medium"===this.state.priority?t+=" text-warning":"low"===this.state.priority&&(t+=" text-primary");var a=this.state.calendarOverlayDisplaying?"":"d-none",i=this.state.prioritiesOverlayDisplaying?"":"d-none";return s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{className:"details-container "+(""===this.state.itemID?"d-none":"")},s.a.createElement("div",{id:"details-top-row",className:"row align-items-center mt-4 pb-3 justify-content-around mb-4"},s.a.createElement("div",{className:"col-1 details-top-row-check d-flex justify-content-center"},s.a.createElement("input",{className:"mx-auto",type:"checkbox",value:"",checked:this.state.completed,onChange:this.handleCheck})),s.a.createElement("div",{className:"details-date-picker col-4"+(E(this.state.dueDate)?" text-danger":""===this.state.dueDate||void 0===this.state.dueDate||null===this.state.dueDate?"":" text-primary"),onClick:function(){e.handleShowCalendarOverlay(),e.props.hideAddListOverlay()}},s.a.createElement("span",{className:"mr-2"},s.a.createElement("i",{className:"fas fa-calendar-alt"})),function(e){if(""===e||void 0===e||null===e)return"Due Date";var t=new Date,a=t.getFullYear(),i=parseInt(e.substring(0,4)),s=parseInt(e.substring(5,7)),r=parseInt(e.substring(8,10)),n=new Date(i+"-"+s+"-"+r+" 00:00");if(n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()){var l=new Date;l.setDate(l.getDate()-1);var o=new Date;if(o.setDate(o.getDate()+1),n.getDate()===t.getDate())return"Today";if(n.getDate()===l.getDate())return"Yesterday";if(n.getDate()===o.getDate())return"Tomorrow"}return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s-1]+" "+r+(a===i?"":", "+i)}(this.state.dueDate)),s.a.createElement("div",{className:t,onClick:function(){e.handleShowPrioritiesOverlay(),e.props.hideAddListOverlay()}},s.a.createElement("i",{className:"fas fa-balance-scale-left"})),s.a.createElement("div",{className:"details-delete-btn col-1",onClick:function(){e.props.handleDelete(e.props.listName,e.state.itemID,e.props.selectedItemList),e.props.hideAddListOverlay()}},s.a.createElement("i",{className:"fas fa-trash"}))),s.a.createElement("div",{id:"calendar-overlay",className:a},s.a.createElement(v,{setDueDate:function(t){return e.handleCalendarChange(t)},handleCalendarOverlayOK:function(){return e.handleCalendarOverlayOK()},handleCalendarOverlayClear:function(){return e.handleCalendarOverlayClear()},currentlySelectedDate:this.state.dueDate})),s.a.createElement("div",{id:"priorities-overlay",className:i},s.a.createElement(D,{handlePrioritiesOverlayClick:function(t){return e.handlePriorityChange(t)},currentlySelectedPriority:this.state.priority})),s.a.createElement("div",{id:"details-title-input-container",className:"mb-4"},s.a.createElement("input",{spellCheck:"false",className:"details-title-input",placeholder:"Title",value:this.state.title,onKeyDown:function(t){return e.handleTitleInputKeyPress(t)},onBlur:function(t){return e.handleTitleInputBlur(t)},ref:this.titleInputRef,onChange:function(t){return e.setState({title:t.target.value})},onClick:function(){return e.props.hideAddListOverlay()},autoComplete:"off"})),s.a.createElement("div",{id:"details-desc-input-container",className:"details-desc-input-container"},s.a.createElement("textarea",{id:"details-desc-input",spellCheck:"false",value:this.state.description,placeholder:"Description",ref:this.descInputRef,onKeyDown:function(t){return e.handleDescInputKeyPress(t)},onBlur:function(t){return e.handleDescInputBlur(t)},onChange:function(t){return e.setState({description:t.target.value})},onClick:function(){return e.props.hideAddListOverlay()},autoComplete:"off"})),s.a.createElement("div",{className:"details-list-name d-flex align-items-center",style:{fontWeight:"600",pointerEvents:"none"}},s.a.createElement("i",{className:"font-grey fas fa-tasks sidebar-icon mr-2"}),s.a.createElement("span",{className:"font-grey "},this.props.selectedItemList),s.a.createElement("i",{className:"ml-2 fa fa-circle",style:{fontSize:"8px",color:this.props.selectedItemColor,paddingTop:"3px"}}))),s.a.createElement("div",{id:"details-placeholder",className:"row h-100 align-items-center justify-content-center font-italic"+(""!==this.state.itemID?"d-none":"")},s.a.createElement("div",{className:"col-12 text-center my-auto",style:{fontSize:"14px"}},"Click on an item to see it's details ",s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("i",{className:"fas fa-tasks",style:{fontSize:"20px"}}))))}}]),a}(i.Component);function E(e){if(""===e||void 0===e)return!1;var t=new Date-1;return new Date(e+" 00:00")<t}a(16);var w=a(13),C=(a(30),function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).handleGoogleOAuth=function(e){var t=e.profileObj.email,a=e.profileObj.givenName,s=e.profileObj.lastName,r=i.hashGoogleInfo(e),n=JSON.stringify({username:t});fetch("http://localhost:9000/accountExists",{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then((function(e){return e.json()})).then((function(e){e?i.props.verifyLogin(t,r,"Google"):i.props.createAccount(t,a,s,r,"Google")}))},i.state={email:"",password:"",usernameEntered:!1,nextClicked:!1},i.passwordInput=s.a.createRef(),i.inputRef=s.a.createRef(),i}return Object(o.a)(a,[{key:"componentDidUpdate",value:function(){!1===this.state.usernameEntered&&""!==this.state.email&&this.setState({usernameEntered:!0})}},{key:"handleEmailInput",value:function(e){var t=""===e.target.value;this.setState({email:e.target.value,usernameEntered:!t})}},{key:"handleEmailEnter",value:function(e){!this.state.usernameEntered||13!==e.keyCode&&9!==e.keyCode||(e.preventDefault(),this.setState({nextClicked:!0}),this.passwordInput.current.focus())}},{key:"handlePasswordEnter",value:function(e){this.state.nextClicked&&13===e.keyCode&&""!==e.target.value&&(e.preventDefault(),this.props.verifyLogin(this.state.email,this.state.password,"Conventional"))}},{key:"handlePasswordInput",value:function(e){this.setState({password:e.target.value})}},{key:"handleLoginBtnClick",value:function(e){e.preventDefault(),this.state.nextClicked?this.props.verifyLogin(this.state.email,this.state.password,"Conventional"):this.setState({nextClicked:!0})}},{key:"reverseStr",value:function(e){return""===e||void 0===e||null===e?"3279ruwejsdnma;lno3 -5pyr eo;dilzk mnd1[  0vcp89'a jklt4-]1-83rdusah13":e.split("").reverse().join("")}},{key:"hashGoogleInfo",value:function(e){var t=e.profileObj;return"d9afspiuflj2kw0r392[pwiua esfljdkf[werpuasidflz;jk3dm2'- rw9eafpuisdjlzkc;3 j 80[weoadhls;jk 23np8we9asoudlh;zkxrj  f[2 e"+this.reverseStr(t.givenName)+"483ruoeifdsjlvsgrhw4q5983;rlfkjDSGN,FDGHWB0YQ934TP8weio;gljgkhwtr07qy480rwuepjGKHRJIUWY5-03[94APW'OE;JTSKGNJWNLP8Q4029W"+this.reverseStr(t.familyName)+"0283ROWIELFKDSK[p9 peua4oliwfjkdsfhdiouaotil;fewtq0uogprijsldhuoijao'ortk4ripfdhig;fk';wple-9stdpygihpfj'kQ"+this.reverseStr(t.googleId)+"948otwrjafj408w[8aer9pifsdjqp49w;'etoisfaj49w0ep[orsiaj[w9eosdilhva5a049P;TJRpiJ0IO_*)OIPLYT(H08pytoi4ljwef"+this.reverseStr(t.email)+"30rweisdjfak]Oi;gjanljrL;J;u;OFTYITF8d35q54tr1q2t4awregfghoikhliop'o=]iioufdrye5a243twretriot89y8upo'p[]pjuyb9tvrdw4teqrwteyrty0jpo"}},{key:"render",value:function(){var e=this,t="not yet"!==this.props.loginInfo;return this.state.nextClicked&&!t&&this.passwordInput.current.focus(),s.a.createElement("div",{className:"Login pb-5 px-4 pt-4"},s.a.createElement("br",null),s.a.createElement("div",{className:"text-left"},s.a.createElement("img",{style:{width:"156.33px",height:"45px"},src:"https://iili.io/JQP1Pp.png"})),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("h5",{className:"text-left",style:{fontWeight:"600"}},"Log in to your account"),s.a.createElement("br",null),s.a.createElement("div",{className:"d-flex justify-content-center"},s.a.createElement("div",{className:"google-btn",style:{cursor:"pointer"}},s.a.createElement("div",{className:"google-icon-wrapper"},s.a.createElement("img",{className:"google-icon",alt:"",src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"})),s.a.createElement("div",{className:"google-button-text"},s.a.createElement(w.GoogleLogin,{clientId:"777242510220-80aoinvqo7q39g1iqtafjet4stv1nnu7.apps.googleusercontent.com",render:function(e){return s.a.createElement("a",{onClick:e.onClick,disabled:e.disabled,className:"btn-text no-bg-no-borders text-white text-center"},"Log in with Google")},buttonText:"Log in with Google",onSuccess:this.handleGoogleOAuth,onFailure:function(e){alert("Google OAuth Failed.\n"+JSON.stringify(e))},cookiePolicy:"single_host_origin"})))),s.a.createElement("br",null),s.a.createElement("div",{className:"or-separator my-2 w-100 text-center font-grey"},s.a.createElement("span",{className:"px-1"},"or")),s.a.createElement("div",{className:"font-small-login-reg text-danger"+("not yet"===this.props.loginInfo?" d-none":"")},"auth type"===this.props.loginInfo?"Please log in using the method you created your account.":"Please provide a valid username and password."),s.a.createElement("br",null),s.a.createElement("form",{className:"font-grey font-small-login-reg"},s.a.createElement("label",{htmlFor:"login-email-input",style:{fontWeight:"500"}},"Email Address"," "),s.a.createElement("div",{className:"input-group input-group-sm"},s.a.createElement("input",{type:"email",className:"form-control form-control-sm"+(this.state.usernameEntered?" input-validated":"")+(t&&"username does not exist"===this.props.loginInfo?" border-danger":""),id:"login-email-input","aria-describedby":"emailHelp",onChange:function(t){return e.handleEmailInput(t)},onKeyDown:function(t){return e.handleEmailEnter(t)},disabled:this.state.nextClicked&&"username does not exist"!==this.props.loginInfo,ref:this.inputRef}),s.a.createElement("div",{className:"input-group-append"+(this.state.nextClicked&&"username does not exist"!==this.props.loginInfo?"":" d-none")},s.a.createElement("span",{className:"input-group-text email-check"},s.a.createElement("i",{className:"fas fa-check"})))),s.a.createElement("div",{className:"form-group"+(this.state.nextClicked?"":" d-none")},s.a.createElement("br",null),s.a.createElement("label",{htmlFor:"login-password-input",style:{fontWeight:"500"}},"Password"),s.a.createElement("input",{type:"password",className:"form-control form-control-sm"+(t?" border-danger":""),id:"login-password-input",onChange:function(t){return e.handlePasswordInput(t)},ref:this.passwordInput})),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("button",{className:"btn btn-primary px-4 font-small-login-reg",type:this.state.nextClicked?"submit":"button",disabled:!this.state.usernameEntered||""===this.inputRef.current.value,onClick:function(t){return e.handleLoginBtnClick(t)}},this.state.nextClicked?"Log In":"Next"),s.a.createElement("span",{className:"ml-3 font-small-login-reg"},"Don't have an account?"," ",s.a.createElement("span",{onClick:function(){e.props.switchToRegister()},className:"text-primary toggle-prompt-text",style:{cursor:"pointer"}},"Sign Up"))))}}]),a}(i.Component)),O=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).handleGoogleOAuth=function(e){var t=e.profileObj.email,a=e.profileObj.givenName,s=e.profileObj.lastName,r=i.hashGoogleInfo(e),n=JSON.stringify({username:t});fetch("http://localhost:9000/accountExists",{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then((function(e){return e.json()})).then((function(e){e?i.props.verifyLogin(t,r,"Google"):i.props.createAccount(t,a,s,r,"Google")}))},i.state={email:"",password:"",firstName:"",lastName:""},i.passwordInput=s.a.createRef(),i}return Object(o.a)(a,[{key:"handleEmailChange",value:function(e){this.setState({email:e.target.value})}},{key:"handleFirstNameChange",value:function(e){this.setState({firstName:e.target.value})}},{key:"handleLastNameChange",value:function(e){this.setState({lastName:e.target.value})}},{key:"handlePasswordChange",value:function(e){this.setState({password:e.target.value})}},{key:"handleSubmit",value:function(){var e=this.state.email,t=this.state.firstName,a=this.state.lastName,i=this.state.password;this.props.createAccount(e,t,a,i,"Conventional")}},{key:"handleKeyDown",value:function(e){13===e.keyCode&&this.handleSubmit()}},{key:"reverseStr",value:function(e){return""===e||void 0===e||null===e?"3279ruwejsdnma;lno3 -5pyr eo;dilzk mnd1[  0vcp89'a jklt4-]1-83rdusah13":e.split("").reverse().join("")}},{key:"hashGoogleInfo",value:function(e){var t=e.profileObj;return"d9afspiuflj2kw0r392[pwiua esfljdkf[werpuasidflz;jk3dm2'- rw9eafpuisdjlzkc;3 j 80[weoadhls;jk 23np8we9asoudlh;zkxrj  f[2 e"+this.reverseStr(t.givenName)+"483ruoeifdsjlvsgrhw4q5983;rlfkjDSGN,FDGHWB0YQ934TP8weio;gljgkhwtr07qy480rwuepjGKHRJIUWY5-03[94APW'OE;JTSKGNJWNLP8Q4029W"+this.reverseStr(t.familyName)+"0283ROWIELFKDSK[p9 peua4oliwfjkdsfhdiouaotil;fewtq0uogprijsldhuoijao'ortk4ripfdhig;fk';wple-9stdpygihpfj'kQ"+this.reverseStr(t.googleId)+"948otwrjafj408w[8aer9pifsdjqp49w;'etoisfaj49w0ep[orsiaj[w9eosdilhva5a049P;TJRpiJ0IO_*)OIPLYT(H08pytoi4ljwef"+this.reverseStr(t.email)+"30rweisdjfak]Oi;gjanljrL;J;u;OFTYITF8d35q54tr1q2t4awregfghoikhliop'o=]iioufdrye5a243twretriot89y8upo'p[]pjuyb9tvrdw4teqrwteyrty0jpo"}},{key:"render",value:function(){var e=this,t="",a=new Array(4).fill(!1);"username already exists"===this.props.registerInfo?t="An account with that email already exists. ":"invalid email"===this.props.registerInfo?t="Please enter a valid email address.":"password length"===this.props.registerInfo?t="Password must be at least 6 characters.":"empty field(s)"===this.props.registerInfo&&(t="Please fill in all fields.",a[0]=""===this.state.email,a[1]=""===this.state.firstName,a[2]=""===this.state.lastName,a[3]=""===this.state.password);var i="username already exists"===this.props.registerInfo||"invalid email"===this.props.registerInfo||a[0],r=a[1],n=a[2],l="password length"===this.props.registerInfo||a[3];return s.a.createElement("div",{className:"Register py-5 px-4"},s.a.createElement("h5",{className:"text-left",style:{fontWeight:"600"}},"Create your account"),s.a.createElement("br",null),s.a.createElement("br",null),s.a.createElement("div",{className:"d-flex justify-content-center"},s.a.createElement("div",{className:"google-btn google-btn-lg",style:{cursor:"pointer"}},s.a.createElement("div",{className:"google-icon-wrapper"},s.a.createElement("img",{className:"google-icon",alt:"",src:"https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg"})),s.a.createElement("div",{className:"google-button-text"},s.a.createElement(w.GoogleLogin,{clientId:"777242510220-80aoinvqo7q39g1iqtafjet4stv1nnu7.apps.googleusercontent.com",render:function(e){return s.a.createElement("a",{onClick:e.onClick,disabled:e.disabled,className:"btn-text no-bg-no-borders text-white text-center"},"Sign up with Google")},buttonText:"Sign Up with Google",onSuccess:this.handleGoogleOAuth,onFailure:function(e){alert("Google OAuth Failed.\n"+JSON.stringify(e))},cookiePolicy:"single_host_origin"})))),s.a.createElement("br",null),s.a.createElement("div",{className:"or-separator my-2 w-100 text-center font-grey"},s.a.createElement("span",{className:"px-1"},"or")),s.a.createElement("div",{className:"font-small-login-reg text-danger py-2"+(""===t?" d-none":"")},t),s.a.createElement("form",{className:"font-grey font-small-login-reg"},s.a.createElement("label",{htmlFor:"login-email-input",style:{fontWeight:"500"}},"Email Address"," "),s.a.createElement("div",{className:"input-group input-group-sm mb-3"},s.a.createElement("input",{type:"email",className:"form-control form-control-sm"+(i?" border-danger":""),id:"login-email-input","aria-describedby":"emailHelp",onChange:function(t){return e.handleEmailChange(t)}})),s.a.createElement("label",{htmlFor:"login-firstName-input",style:{fontWeight:"500"}},"First Name"," "),s.a.createElement("div",{className:"input-group input-group-sm mb-3"},s.a.createElement("br",null),s.a.createElement("input",{type:"text",className:"form-control form-control-sm "+(r?" border-danger":""),id:"login-firstName-input","aria-describedby":"emailHelp",onChange:function(t){return e.handleFirstNameChange(t)}})),s.a.createElement("label",{htmlFor:"login-lastName-input",style:{fontWeight:"500"}},"Last Name"," "),s.a.createElement("div",{className:"input-group input-group-sm mb-3"},s.a.createElement("br",null),s.a.createElement("input",{type:"text",className:"form-control form-control-sm"+(n?" border-danger":""),id:"login-lastName-input","aria-describedby":"emailHelp",onChange:function(t){return e.handleLastNameChange(t)}})),s.a.createElement("div",{className:"form-group"},s.a.createElement("label",{htmlFor:"login-password-input",style:{fontWeight:"500"}},"Password"),s.a.createElement("input",{type:"password",className:"form-control form-control-sm"+(l?" border-danger":""),id:"login-password-input",onChange:function(t){return e.handlePasswordChange(t)},onKeyDown:function(t){return e.handleKeyDown(t)},ref:this.passwordInput})),s.a.createElement("br",null),s.a.createElement("button",{className:"btn btn-primary px-4 font-small-login-reg",type:"button",onClick:function(){return e.handleSubmit()}},"Sign Up"),s.a.createElement("span",{className:"ml-3 font-small-login-reg"},"Already have an account?"," ",s.a.createElement("span",{onClick:function(){e.props.switchToLogin()},className:"text-primary toggle-prompt-text",style:{cursor:"pointer"}},"Log In"))))}}]),a}(i.Component),L=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).state={selectedList:i.props.currentlySelectedListName},i}return Object(o.a)(a,[{key:"selectList",value:function(e){var t=e.currentTarget.dataset.listName;this.setState({selectedList:t}),this.props.setSelectedList(t)}},{key:"createProfileAbbreviation",value:function(){return void 0===this.props.firstName||null===this.props.firstName||""===this.props.firstName&&void 0===this.props.lastName||null===this.props.lastName||""===this.props.lastName?this.props.username.substring(0,2):void 0===this.props.firstName||null===this.props.firstName||""===this.props.firstName&&void 0!==this.props.lastName&&null!==this.props.lastName&&""!==this.props.lastName?this.props.lastName.substring(0,2):void 0!==this.props.firstName&&null!==this.props.firstName&&(""!==this.props.firstName&&void 0===this.props.lastName||null===this.props.lastName||""===this.props.lastName)?this.props.firstName.substring(0,2):this.props.firstName.toUpperCase().substring(0,1)+this.props.lastName.toUpperCase().substring(0,1)}},{key:"render",value:function(){var e=this,t=this.props.currentlySelectedListName,a=this.props.lists.slice(0,this.props.lists.length-3),i=0,r=0,n=0;this.props.lists.length>0&&(i=x(this.props.lists[this.props.lists.length-3]),r=x(this.props.lists[this.props.lists.length-2]),n=x(this.props.lists[this.props.lists.length-1]));var l=this.createProfileAbbreviation();return s.a.createElement("div",{className:"sidebar-container pt-5"},s.a.createElement("div",{className:"profile-icon mb-4 text-center"},s.a.createElement("span",{style:{color:"white",backgroundColor:"rgb(21, 127, 251)",borderRadius:"50%",paddingLeft:"11px",paddingRight:"11px",paddingTop:"10px",paddingBottom:"10px",fontSize:"16px",pointerEvents:"none"}},l)),s.a.createElement("div",{className:"text-center font-small sidebar-item py-1 pt-3",style:{pointerEvents:"none",fontWeight:"600",color:"rgb(113, 123, 133)"}},"Smart Lists"),s.a.createElement("div",{id:"sidebar-today",className:"sidebar-item py-2 pl-4 .no-gutters row align-items-center justify-content-left"+("Today"===t?" selected-sidebar-item":""),"data-list-name":"Today",onClick:function(t){return e.selectList(t)}},s.a.createElement("i",{className:"fas fa-calendar-day sidebar-icon col-1 mr-2"}),s.a.createElement("div",{className:"col-5 text-left p-0 sidebar-list-name"},"Today"),s.a.createElement("div",{className:"col-1 sidebar-list-color text-left invisible"},s.a.createElement("i",{className:"fa fa-circle",style:{fontSize:"8px"}})),s.a.createElement("div",{className:"col-1 font-small"},i>0?i:"")),s.a.createElement("div",{id:"sidebar-next-7-days",className:"sidebar-item py-2 pl-4 .no-gutters row align-items-center justify-content-left"+("Next 7 Days"===t?" selected-sidebar-item":""),onClick:function(t){return e.selectList(t)},"data-list-name":"Next 7 Days"},s.a.createElement("i",{className:"fas fa-calendar-week sidebar-icon col-1 mr-2"}),s.a.createElement("div",{className:"col-5 text-left p-0 sidebar-list-name"},"Next 7 Days"),s.a.createElement("div",{className:"col-1 sidebar-list-color text-left invisible"},s.a.createElement("i",{className:"fa fa-circle",style:{fontSize:"8px"}})),s.a.createElement("div",{className:"col-1 font-small"},r>0?r:"")),s.a.createElement("div",{id:"sidebar-all",className:"sidebar-item py-2 pl-4 .no-gutters row align-items-center justify-content-left"+("All"===t?" selected-sidebar-item":""),onClick:function(t){return e.selectList(t)},"data-list-name":"All"},s.a.createElement("i",{className:"fas fa-calendar sidebar-icon col-1 mr-2"}),s.a.createElement("div",{className:"col-5 text-left p-0 sidebar-list-name"},"All"),s.a.createElement("div",{className:"col-1 sidebar-list-color text-left invisible"},s.a.createElement("i",{className:"fa fa-circle",style:{fontSize:"8px"}})),s.a.createElement("div",{className:"col-1 font-small"},n>0?n:"")),s.a.createElement("div",{className:"text-center font-small sidebar-item py-1 pt-5",style:{pointerEvents:"none",fontWeight:"600",color:"rgb(113, 123, 133)"}},"Your Lists"),s.a.createElement("div",{id:"personal-lists"},a.map((function(a,i){var r=x(a),n=a.name.length>11?a.name.substring(0,11)+"...":a.name;return s.a.createElement("div",{key:a.name},s.a.createElement(h.b,{id:a.name},s.a.createElement("div",{className:"sidebar-item py-2 pl-4 .no-gutters row align-items-center justify-content-left"+(t===a.name?" selected-sidebar-item":""),onClick:function(t){return e.selectList(t)},"data-list-name":a.name},s.a.createElement("i",{className:"fas fa-tasks sidebar-icon col-1 mr-2"}),s.a.createElement("div",{className:"col-5 text-left p-0 sidebar-list-name"},n),s.a.createElement("div",{className:"col-1 sidebar-list-color text-left"},s.a.createElement("i",{className:"fa fa-circle",style:{color:a.color,fontSize:"8px"}})),s.a.createElement("div",{className:"col-1 font-small"},r>0?r:""))),s.a.createElement(h.a,{id:a.name,className:"sidebar-context-menu p-0 shadow-sm"},s.a.createElement(h.c,{data:{listName:a.name},className:"sidebar-context-menu-item px-2 py-1",onClick:function(){return e.props.showEditListOverlay(a.name,a.color)}},s.a.createElement("div",{className:"row align-items-center justify-content-left"},s.a.createElement("i",{className:"fas fa-edit col-1"}),s.a.createElement("span",{className:"col-6"},"Edit"))),s.a.createElement(h.c,{data:{listName:a.name},className:"sidebar-context-menu-item px-2 py-1",onClick:function(t){t.preventDefault(),window.confirm('Are you sure you want to delete "'+a.name+'"? \n\nDeleting it will permanently delete all of its items.')&&e.props.deleteList(a.name)}},s.a.createElement("div",{className:"row align-items-center justify-content-left"},s.a.createElement("i",{className:"fas fa-trash col-1"}),s.a.createElement("span",{className:"col-6"},"Delete")))))}))),s.a.createElement("div",{className:"createListBtn text-center sidebar-icon sidebar-item py-2",style:{borderBottom:"none"},onClick:function(){return e.props.showAddListOverlay()}},s.a.createElement("i",{className:"fas fa-plus-circle"})))}}]),a}(i.Component);function x(e){for(var t=e.items,a=0,i=0;i<t.length;i++)t[i].completed||a++;return a}var j=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(){return Object(l.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"render",value:function(){var e=this,t=this.props.title;void 0!==t&&t.length>16?t=t.substring(0,16)+"...":void 0!==t&&0===t.length&&(t="[Empty Title]"),void 0!==t&&"[Empty Title]"!==t&&(t='"'+t+'"');var a=(this.props.listName,this.props.originalList),i="notification p-3 shadow"+(this.props.displaying?" notification-displayed":"");return s.a.createElement("div",{className:i},s.a.createElement("div",null,t," was deleted from ",s.a.createElement("br",null),'"',a,'"'),s.a.createElement("div",{className:"row"},s.a.createElement("div",{className:"col-9"}),s.a.createElement("div",{className:"col-3 text-primary undo-button",style:{cursor:"pointer",fontWeight:"600"},onClick:function(){e.props.undo(),e.props.hideNotification()}},"Undo")))}}]),a}(i.Component),T=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(){return Object(l.a)(this,a),t.apply(this,arguments)}return Object(o.a)(a,[{key:"render",value:function(){var e=this;return s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{className:"toolbar-icon col-10 mx-1 text-center d-flex justify-content-center align-items-center",onClick:function(){return e.props.handleShowSettingsOverlay()}},s.a.createElement("i",{className:"fas fa-cogs"})),s.a.createElement("div",{className:"toolbar-icon col-10 mx-1 text-center d-flex justify-content-center align-items-center",onClick:function(t){(t.preventDefault(),"Today"!==e.props.currentlySelectedListName&&"Next 7 Days"!==e.props.currentlySelectedListName&&"All"!==e.props.currentlySelectedListName)&&(window.confirm('Clear all completed items for "'+e.props.currentlySelectedListName+'"?')&&e.props.deleteAllCompletedItems())}},s.a.createElement("i",{className:"fas fa-hand-sparkles"})),s.a.createElement("div",{className:"toolbar-icon col-10 mx-1 text-center d-flex justify-content-center align-items-center"},s.a.createElement("i",{className:"fas fa-share-alt"})),s.a.createElement("div",{className:"toolbar-icon col-10 mx-1 text-center d-flex justify-content-center align-items-center",onClick:function(){return e.props.handleLogOut()}},s.a.createElement("i",{className:"fas fa-sign-out-alt"})))}}]),a}(i.Component),P=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).state={selectedColor:"",listName:"",issue:""},i}return Object(o.a)(a,[{key:"selectColor",value:function(e){var t=e.currentTarget.dataset.color;this.setState({selectedColor:t}),this.props.focusTitleInput()}},{key:"handleSubmit",value:function(){var e=this.state.listName,t=this.state.selectedColor;!function(e,t){for(var a=0;a<e.length;a++)if(e[a].name===t)return!0;return!1}(this.props.lists,e)?(this.props.createList(e,t),this.props.hideOverlay(),this.setState({selectedColor:"",listName:"",issue:""})):this.setState({issue:"List name already exists."})}},{key:"render",value:function(){var e=this,t=this.state.issue,a="add-list-overlay shadow font-grey p-4"+(this.props.displaying?" add-list-overlay-displayed":"");return s.a.createElement("div",{className:a,onKeyDown:function(t){13===t.keyCode&&""!==e.state.listName&&""!==e.state.selectedColor&&e.handleSubmit()}},s.a.createElement("div",{className:"text-center",style:{pointerEvents:"none"}},s.a.createElement("h5",null,"Add List")),s.a.createElement("label",{htmlFor:"add-list-title-input"},"Title"),s.a.createElement("input",{id:"add-list-title-input",className:"form-control form-control-sm",ref:this.props.addListTitleRef,onChange:function(t){e.setState({listName:t.currentTarget.value,issue:""})},autoComplete:"off"}),s.a.createElement("span",{className:"text-right"},s.a.createElement("small",{className:"text-right text-danger"+(""!==this.state.issue?"":" invisible")},t)),s.a.createElement("br",null),s.a.createElement("label",{htmlFor:"add-list-color-input"},"Color"),s.a.createElement("div",{className:"d-flex justify-content-around"},["#FDC5F5","#861388","#80242f","#f76f90","#e01e37","#FFD166","#fb5607","#ffcdb2","#8cb369","#29BF12","#06EFB1","#0496FF","#5390d9","#023e7d","#5448C8","#131200","#d9d9d9"].map((function(t,a){var i=function(e,t){var a=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),s=parseInt(e.substring(5,7),16);a=parseInt(a*(100+t)/100),i=parseInt(i*(100+t)/100),s=parseInt(s*(100+t)/100),i=i<255?i:255,s=s<255?s:255;var r=1===(a=a<255?a:255).toString(16).length?"0"+a.toString(16):a.toString(16),n=1===i.toString(16).length?"0"+i.toString(16):i.toString(16),l=1===s.toString(16).length?"0"+s.toString(16):s.toString(16);return"#"+r+n+l}(t,-30)+"BB";return s.a.createElement("i",{key:t,className:"fa fa-circle add-list-overlay-color"+(e.state.selectedColor===t?" add-list-overlay-color-selected":""),style:{fontSize:"13px",color:t,borderColor:e.state.selectedColor===t?i:"rgba(0, 0, 0, 0)",backgroundColor:e.state.selectedColor===t?i:"rgba(0, 0, 0, 0)"},"data-color":t,onClick:function(t){return e.selectColor(t)}})}))),s.a.createElement("div",{className:"d-flex justify-content-center mt-5 pb-2"},s.a.createElement("button",{className:"btn btn-sm btn-secondary mr-2 px-3",style:{borderRadius:"5px"},onClick:function(){e.setState({selectedColor:"",listName:"",listNameExists:!1}),e.props.hideOverlay()}},"Cancel"),s.a.createElement("button",{className:"btn btn-sm btn-primary ml-2 px-3",style:{borderRadius:"5px"},onClick:function(){return e.handleSubmit()},disabled:""===this.state.listName||""===this.state.selectedColor},"Save")))}}]),a}(i.Component);var A=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).state={selectedColor:void 0,listName:void 0,issue:""},i}return Object(o.a)(a,[{key:"selectColor",value:function(e){var t=e.currentTarget.dataset.color;this.setState({selectedColor:t}),this.props.focusTitleInput()}},{key:"handleSubmit",value:function(){var e=this.state.listName,t=this.state.selectedColor;!function(e,t,a){for(var i=0;i<t.length;i++)if(t[i].name===a&&t[i].name!==e)return!0;return!1}(this.props.startingName,this.props.lists,e)?(this.setState({selectedColor:void 0,listName:void 0}),this.props.editList(this.props.startingName,e,t),this.props.hideOverlay()):this.setState({issue:"List name already exists."})}},{key:"render",value:function(){var e=this,t=this.state.issue;void 0!==this.state.listName&&void 0!==this.state.selectedColor||""===this.props.startingColor||""===this.props.startingName||this.setState({selectedColor:this.props.startingColor,listName:this.props.startingName});var a="add-list-overlay shadow font-grey p-4"+(this.props.displaying?" add-list-overlay-displayed":"");return s.a.createElement("div",{className:a,onKeyDown:function(t){13===t.keyCode&&""!==e.state.listName&&""!==e.state.selectedColor&&e.handleSubmit()}},s.a.createElement("div",{className:"text-center",style:{pointerEvents:"none"}},s.a.createElement("h5",null,"Edit List")),s.a.createElement("label",{htmlFor:"add-list-title-input"},"Title"),s.a.createElement("input",{id:"add-list-title-input",className:"form-control form-control-sm",ref:this.props.editListTitleRef,onChange:function(t){e.setState({listName:t.currentTarget.value,issue:""})},autoComplete:"off"}),s.a.createElement("span",{className:"text-right"},s.a.createElement("small",{className:"text-right text-danger"+(""!==this.state.issue?"":" invisible")},t)),s.a.createElement("br",null),s.a.createElement("label",{htmlFor:"add-list-color-input"},"Color"),s.a.createElement("div",{className:"d-flex justify-content-around"},["#FDC5F5","#861388","#80242f","#f76f90","#e01e37","#FFD166","#fb5607","#ffcdb2","#8cb369","#29BF12","#06EFB1","#0496FF","#5390d9","#023e7d","#5448C8","#131200","#d9d9d9"].map((function(t,a){var i=function(e,t){var a=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),s=parseInt(e.substring(5,7),16);a=parseInt(a*(100+t)/100),i=parseInt(i*(100+t)/100),s=parseInt(s*(100+t)/100),i=i<255?i:255,s=s<255?s:255;var r=1===(a=a<255?a:255).toString(16).length?"0"+a.toString(16):a.toString(16),n=1===i.toString(16).length?"0"+i.toString(16):i.toString(16),l=1===s.toString(16).length?"0"+s.toString(16):s.toString(16);return"#"+r+n+l}(t,-30)+"BB";return s.a.createElement("i",{key:t,className:"fa fa-circle add-list-overlay-color"+(e.state.selectedColor===t?" add-list-overlay-color-selected":""),style:{fontSize:"13px",color:t,borderColor:e.state.selectedColor===t?i:"rgba(0, 0, 0, 0)",backgroundColor:e.state.selectedColor===t?i:"rgba(0, 0, 0, 0)"},"data-color":t,onClick:function(t){return e.selectColor(t)}})}))),s.a.createElement("div",{className:"d-flex justify-content-center mt-5 pb-2"},s.a.createElement("button",{className:"btn btn-sm btn-secondary mr-2 px-3",style:{borderRadius:"5px"},onClick:function(){e.setState({selectedColor:void 0,listName:void 0}),e.props.hideOverlay()}},"Cancel"),s.a.createElement("button",{className:"btn btn-sm btn-primary ml-2 px-3",style:{borderRadius:"5px"},onClick:function(){return e.handleSubmit()},disabled:""===this.state.listName||""===this.state.selectedColor},"Save")))}}]),a}(i.Component);var R=a(10),F=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){return Object(l.a)(this,a),t.call(this,e)}return Object(o.a)(a,[{key:"setSorting",value:function(e){var t=e.currentTarget.dataset.type;this.props.setSortingSetting(t)}},{key:"setKeywords",value:function(e){var t=e.currentTarget.dataset.type;"both"===this.props.keywords?"dates"===t?this.props.setKeywordsSetting("priorities"):"priorities"===t&&this.props.setKeywordsSetting("dates"):"none"===this.props.keywords?"dates"===t?this.props.setKeywordsSetting("dates"):"priorities"===t&&this.props.setKeywordsSetting("priorities"):"dates"===this.props.keywords&&"priorities"===t||"priorities"===this.props.keywords&&"dates"===t?this.props.setKeywordsSetting("both"):("dates"===this.props.keywords&&"dates"===t||"priorities"===this.props.keywords&&"priorities"===t)&&this.props.setKeywordsSetting("none")}},{key:"render",value:function(){var e,t=this,a="both"===this.props.keywords||"priorities"===this.props.keywords,i="both"===this.props.keywords||"dates"===this.props.keywords,r="priorities first"===this.props.sorting,n="dates first"===this.props.sorting,l="settings-overlay shadow font-grey p-4"+(this.props.displaying?" settings-overlay-displayed":"");return s.a.createElement("div",{className:l},s.a.createElement("div",{className:"text-center",style:{pointerEvents:"none"}},s.a.createElement("h5",null,"Settings")),s.a.createElement("input",{style:{width:0,opacity:0},ref:this.props.settingsRef}),s.a.createElement("div",null,s.a.createElement("label",{htmlFor:"keyword-settings"},"Keyword Setting when Adding Items"),s.a.createElement("div",{id:"keyword-settings",className:"form-group"},s.a.createElement("div",{className:"form-check ml-2"},s.a.createElement("input",{className:"form-check-input settings-radio",type:"checkbox",id:"keywords-check-dates","data-type":"dates",checked:i,onClick:function(e){return t.setKeywords(e)}}),s.a.createElement("label",{className:"form-check-label settings-label",htmlFor:"keywords-check-dates"},"Dates")),s.a.createElement("div",{className:"form-check ml-2"},s.a.createElement("input",{className:"form-check-input settings-radio",type:"checkbox",id:"keywords-check-priority","data-type":"priorities",checked:a,onClick:function(e){return t.setKeywords(e)}}),s.a.createElement("label",{className:"form-check-label settings-label",htmlFor:"keywords-check-priorities"},"Priorities"))),s.a.createElement("br",null),s.a.createElement("div",{className:"form-group"},s.a.createElement("label",{htmlFor:"sorting-settings"},"Item Sorting"),s.a.createElement("div",{id:"sorting-settings",className:"form-check ml-2"},s.a.createElement("input",{className:"form-check-input settings-radio",type:"radio",name:"sorting-radio",id:"sorting-radio-1",value:"option1","data-type":"dates first",checked:n,onClick:function(e){return t.setSorting(e)}}),s.a.createElement("label",{className:"form-check-label settings-label",htmlFor:"sorting-radio-1"},"Dates First")),s.a.createElement("div",{className:"form-check ml-2"},s.a.createElement("input",(e={className:"form-check-input settings-radio",type:"radio",name:"exampleRadios"},Object(R.a)(e,"name","sorting-radio"),Object(R.a)(e,"id","sorting-radio-2"),Object(R.a)(e,"value","option2"),Object(R.a)(e,"checked",r),Object(R.a)(e,"data-type","priorities first"),Object(R.a)(e,"onClick",(function(e){return t.setSorting(e)})),e)),s.a.createElement("label",{className:"form-check-label settings-label",htmlFor:"sorting-radio-2"},"Priorities First"))),s.a.createElement("br",null)),s.a.createElement("div",{className:"d-flex justify-content-center",onClick:function(){return t.props.hideSettingsOverlay()}},s.a.createElement("button",{className:"btn btn btn-primary px-4"},"OK")))}}]),a}(i.Component);var J=a(31),K=new m.a,z=function(e){Object(c.a)(a,e);var t=Object(d.a)(a);function a(e){var i;return Object(l.a)(this,a),(i=t.call(this,e)).state={docTitle:"Log in | Doozy",loggedIn:"not yet",registered:"not yet",loginOrRegister:"login",lists:[],username:"",currentlySelectedListIndex:0,currentlySelectedListName:"",currentlySelectedItemID:"",bgURL:"",firstName:"",lastName:"",loaded:!1,notificationDisplaying:!1,lastDeletedItem:{},lastDeletedItemListName:"",addListOverlayDisplaying:!1,editListOverlayDisplaying:!1,settingsOverlayDisplaying:!1,editListName:"",editListColor:"",sorting:"",background:"random",keywords:"both"},i.addListTitleRef=s.a.createRef(),i.editListTitleRef=s.a.createRef(),i.settingsRef=s.a.createRef(),i}return Object(o.a)(a,[{key:"componentDidMount",value:function(){var e=this,t="",a="",i="",s="not yet",r=this.state.docTitle;if(void 0!==K.get("DoozyLogin")){t=K.get("DoozyLogin").email,a=K.get("DoozyLogin").firstName,i=K.get("DoozyLogin").lastName,s="successful";var n=new Date;n.setDate(n.getDate()+7),K.set("DoozyLogin",{email:t,firstName:a,lastName:i},{path:"/",expires:n}),r="Lists | Doozy"}if(""!==t){var l=JSON.stringify({username:t});fetch("http://localhost:9000/getSettings",{method:"POST",headers:{"Content-Type":"application/json"},body:l}).then((function(e){return e.json()})).then((function(n){var l="random"===n.background?B():'url("'+n.background+'")';e.setState({bgURL:l,username:t,firstName:a,lastName:i,loggedIn:s,docTitle:r,sorting:n.sorting,keywords:n.keywords,background:l})}))}else p()("#login-register").removeClass("d-none"),this.setState({username:t,firstName:a,lastName:i,loggedIn:s,docTitle:r,sorting:"dates first",bgURL:B(),background:"random",keywords:"both"})}},{key:"componentDidUpdate",value:function(){!1===this.state.loaded&&"successful"===this.state.loggedIn&&(this.setState({loaded:!0}),this.getLists())}},{key:"verifyLogin",value:function(e,t,a){var i=this;console.log("verify login with",e,t,a);var s=JSON.stringify({username:e,password:t,authType:a});fetch("http://localhost:9000/verifyLogin",{method:"POST",headers:{"Content-Type":"application/json"},body:s}).then((function(e){return e.json()})).then((function(t){if(t.success){i.setState({docTitle:"Lists | Doozy",loggedIn:"successful",username:e,firstName:t.firstName,lastName:t.lastName,sorting:t.sorting,keywords:t.keywords,background:t.background}),i.getLists();var a=new Date;a.setDate(a.getDate()+7),K.set("DoozyLogin",{email:e,firstName:t.firstName,lastName:t.lastName},{path:"/",expires:a})}else"username does not exist"===t.info?i.setState({loggedIn:"username does not exist"}):"auth type"===t.info?i.setState({loggedIn:"auth type",loginOrRegister:"login"}):"incorrect password"===t.info&&i.setState({loggedIn:"incorrect password"})}))}},{key:"createAccount",value:function(e,t,a,i,s){var r=this;if(""===e||""===t||""===a||""===i)this.setState({registered:"empty field(s)"});else if(function(e){if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e))return!0;return!1}(e))if(i.length<6)this.setState({registered:"password length"});else{var n=JSON.stringify({username:e,firstName:t,lastName:a,password:i,authType:s});fetch("http://localhost:9000/createAccount",{method:"POST",headers:{"Content-Type":"application/json"},body:n}).then((function(e){return e.json()})).then((function(i){if(i.success){r.setState({docTitle:"Lists | Doozy",loggedIn:"successful",registered:"successful",username:e,firstName:t,lastName:a,sorting:"dates first",keywords:!0,background:"random"}),r.getLists();var s=new Date;s.setDate(s.getDate()+7),K.set("DoozyLogin",{email:e,firstName:t,lastName:a},{path:"/",expires:s})}else"username already exists"===i.info&&r.setState({registered:"username already exists"})}))}else this.setState({registered:"invalid email"})}},{key:"deleteAllCompletedItems",value:function(e){var t=this;if("Today"!==e&&"Next 7 Days"!==e&&"All"!==e){for(var a=this.state.lists.slice(),i=0;i<a.length;i++)if(a[i].name===e){for(var s=a[i].items,r=0,n=0;n<s.length;n++)if(s[n].completed){r=n;break}s=s.slice(0,r);break}var l=JSON.stringify({username:this.state.username,listName:e});fetch("http://localhost:9000/deleteCompletedItems",{method:"POST",headers:{"Content-Type":"application/json"},body:l}).then((function(e){return e.json()})).then((function(e){t.setState({lists:a}),t.getLists(t.state.currentlySelectedListName,t.state.currentlySelectedListIndex)}))}}},{key:"setSelectedItem",value:function(e){this.setState({currentlySelectedItemID:e,addListOverlayDisplaying:!1})}},{key:"setSelectedList",value:function(e){var t;if("Today"===e&&(t=this.state.lists.length-3),"Next 7 Days"===e&&(t=this.state.lists.length-2),"All"===e)t=this.state.lists.length-1;else for(var a=0;a<this.state.lists.length;a++)if(this.state.lists[a].name===e){t=a;break}this.setState({currentlySelectedListName:e,currentlySelectedListIndex:t,currentlySelectedItemID:"",addListOverlayDisplaying:!1})}},{key:"toggleLoginRegister",value:function(){"login"===this.state.loginOrRegister?this.setState({docTitle:"Sign Up | Doozy",loginOrRegister:"register"}):"register"===this.state.loginOrRegister&&this.setState({docTitle:"Log In | Doozy",loginOrRegister:"login"})}},{key:"getCurrentlySelectedItem",value:function(){if(""===this.state.currentlySelectedItemID)return{title:"",description:"",dueDate:"",priority:"",completed:!1,itemID:""};for(var e=this.state.lists.slice(this.state.currentlySelectedListIndex)[0].items,t=0;t<e.length;t++)if(e[t].itemID===this.state.currentlySelectedItemID)return e[t];return{title:"",description:"",dueDate:"",priority:"",completed:!1,itemID:""}}},{key:"getLists",value:function(e,t){var a=this,i=JSON.stringify({username:this.state.username});fetch("http://localhost:9000/getLists",{method:"POST",headers:{"Content-Type":"application/json"},body:i}).then((function(e){return e.json()})).then((function(i){var s=i;if(s=a.appendSmartLists(s),void 0!==e&&void 0!==t)a.setState({lists:s,currentlySelectedListIndex:t,currentlySelectedListName:e});else{var r="successful"===a.state.registered?0:s.length-1,n=s[r].name;a.setState({lists:s,currentlySelectedListIndex:r,currentlySelectedListName:n})}}))}},{key:"appendSmartLists",value:function(e){var t=this.getNext7Days(e),a=this.getToday(e),i=this.getAll(e);return e.push(a),e.push(t),e.push(i),e}},{key:"getNext7Days",value:function(e){for(var t={name:"Next 7 Days",color:"",items:[]},a=0;a<e.length;a++)for(var i=e[a].items,s=0;s<i.length;s++)Y(i[s].dueDate)&&(i[s].originalList=e[a].name,i[s].color=e[a].color,t.items.push(i[s]));var r="dates first"===this.state.sorting?W:G;return t.items.sort(r),t}},{key:"getAll",value:function(e){for(var t={name:"All",color:"",items:[]},a=0;a<e.length;a++){for(var i=e[a].items,s=0;s<i.length;s++)i[s].originalList=e[a].name,i[s].color=e[a].color;t.items=t.items.concat(e[a].items)}var r="dates first"===this.state.sorting?W:G;return t.items.sort(r),t}},{key:"getToday",value:function(e){for(var t={name:"Today",color:"",items:[]},a=M(new Date),i=0;i<e.length;i++)for(var s=e[i].items,r=0;r<s.length;r++)s[r].dueDate===a&&(s[r].originalList=e[i].name,s[r].color=e[i].color,t.items.push(s[r]));var n="dates first"===this.state.sorting?W:G;return t.items.sort(n),t}},{key:"addListItem",value:function(e,t,a,i,s,r,n,l){for(var o=this.state.lists.slice(),c="dates first"===this.state.sorting?W:G,d=null,m={title:t,description:i,dueDate:a,priority:s,completed:void 0!==l&&l,originalList:e,color:r,itemID:void 0===n?(new J).toString():n},u=0;u<o.length;u++)if(o[u].name===e){var p=o[u].items;p.push(m),d=m.itemID,p.sort(c);break}a===M(new Date)&&(o[o.length-3].items.push(m),o[o.length-3].items.sort(c)),Y(a)&&(o[o.length-2].items.push(m),o[o.length-2].items.sort(c)),o[o.length-1].items.push(m),o[o.length-1].items.sort(c),this.setState({lists:o,currentlySelectedItemID:d});var h=JSON.stringify({username:this.state.username,listName:e,title:t,dueDate:a,description:i,priority:s,itemID:d});fetch("http://localhost:9000/addListItem",{method:"POST",headers:{"Content-Type":"application/json"},body:h})}},{key:"deleteListItem",value:function(e,t,a){for(var i,s="",r=this.state.lists.slice(),n=0;n<r.length;n++)if(r[n].name===e||r[n].name===a){for(var l=r[n].items,o=-1,c=0;c<l.length;c++)if(l[c].itemID===t){o=c,s=l[c].dueDate,i=l[c];break}l=l.splice(o,1)}var d=-1;if(s===M(new Date)){l=r[r.length-3].items;for(var m=0;m<l.length;m++)if(l[m].itemID===t){d=m;break}l=l.splice(d,1)}if(Y(s)){l=r[r.length-2].items;for(var u=0;u<l.length;u++)if(l[u].itemID===t){d=u;break}l=l.splice(d,1)}l=r[r.length-1].items;for(var p=0;p<l.length;p++)if(l[p].itemID===t){d=p;break}l=l.splice(d,1),this.setState({lists:r,currentlySelectedItemID:"",lastDeletedItem:i,lastDeletedItemListName:e});var h=JSON.stringify({username:this.state.username,listName:"All"===e||"Next 7 Days"===e||"Today"===e?i.originalList:e,itemID:t});fetch("http://localhost:9000/deleteListItem",{method:"POST",headers:{"Content-Type":"application/json"},body:h}).then((function(e){return e.text()})),this.handleDisplayNotification()}},{key:"setItemTitle",value:function(e,t,a){for(var i=this.state.lists.slice(),s=void 0,r=0;r<i.length;r++)if(i[r].name===e){for(var n=i[r].items,l=0;l<n.length;l++)if(n[l].itemID===t){n[l].title=a,s=n[l];break}break}if(s.originalList!==e)for(var o=0;o<i.length;o++)if(i[o].name===s.originalList){for(var c=i[o].items,d=0;d<c.length;d++)if(c[d].itemID===t){c[d].title=a;break}break}i=i.slice(0,i.length-3),i=this.appendSmartLists(i);var m=JSON.stringify({username:this.state.username,listName:"All"===e||"Next 7 Days"===e||"Today"===e?s.originalList:e,itemID:t,title:a});fetch("http://localhost:9000/setItemTitle",{method:"POST",headers:{"Content-Type":"application/json"},body:m}).then((function(e){return e.text()}))}},{key:"setItemCompleted",value:function(e,t,a){for(var i="dates first"===this.state.sorting?W:G,s=this.state.lists.slice(),r=void 0,n=0;n<s.length;n++)if(s[n].name===e){for(var l=s[n].items,o=0;o<l.length;o++)if(l[o].itemID===t){l[o].completed=a,r=l[o],l.sort(i);break}break}if(r.originalList!==e)for(var c=0;c<s.length;c++)if(s[c].name===r.originalList){for(var d=s[c].items,m=0;m<d.length;m++)if(d[m].itemID===t){d[m].completed=a,d.sort(i);break}break}s=s.slice(0,s.length-3),s=this.appendSmartLists(s),this.setState({lists:s});var u=JSON.stringify({username:this.state.username,listName:"All"===e||"Next 7 Days"===e||"Today"===e?r.originalList:e,itemID:t,completed:a});fetch("http://localhost:9000/setItemCompleted",{method:"POST",headers:{"Content-Type":"application/json"},body:u})}},{key:"setItemDueDate",value:function(e,t,a){for(var i="dates first"===this.state.sorting?W:G,s=this.state.lists.slice(),r=void 0,n=0;n<s.length;n++)if(s[n].name===e){for(var l=s[n].items,o=0;o<l.length;o++)if(l[o].itemID===t){l[o].dueDate=a,r=l[o],l.sort(i);break}break}if(r.originalList!==e)for(var c=0;c<s.length;c++)if(s[c].name===r.originalList){for(var d=s[c].items,m=0;m<d.length;m++)if(d[m].itemID===t){d[m].dueDate=a,d.sort(i);break}break}s=s.slice(0,s.length-3),s=this.appendSmartLists(s),this.setState({lists:s});var u=JSON.stringify({username:this.state.username,listName:"All"===e||"Next 7 Days"===e||"Today"===e?r.originalList:e,itemID:t,dueDate:a});fetch("http://localhost:9000/setItemDueDate",{method:"POST",headers:{"Content-Type":"application/json"},body:u})}},{key:"setItemPriority",value:function(e,t,a){for(var i="dates first"===this.state.sorting?W:G,s=this.state.lists.slice(),r=void 0,n=0;n<s.length;n++)if(s[n].name===e){for(var l=s[n].items,o=0;o<l.length;o++)if(l[o].itemID===t){l[o].priority=a,r=l[o],l.sort(i);break}break}if(r.originalList!==e)for(var c=0;c<s.length;c++)if(s[c].name===r.originalList){for(var d=s[c].items,m=0;m<d.length;m++)if(d[m].itemID===t){d[m].priority=a,d.sort(i);break}break}s=s.slice(0,s.length-3),s=this.appendSmartLists(s),this.setState({lists:s});var u=JSON.stringify({username:this.state.username,listName:"All"===e||"Next 7 Days"===e||"Today"===e?r.originalList:e,itemID:t,priority:a});fetch("http://localhost:9000/setItemPriority",{method:"POST",headers:{"Content-Type":"application/json"},body:u})}},{key:"setItemDescription",value:function(e,t,a){for(var i=this.state.lists.slice(),s=void 0,r=0;r<i.length;r++)if(i[r].name===e){for(var n=i[r].items,l=0;l<n.length;l++)if(n[l].itemID===t){n[l].description=a,s=n[l];break}break}if(s.originalList!==e)for(var o=0;o<i.length;o++)if(i[o].name===s.originalList){for(var c=i[o].items,d=0;d<c.length;d++)if(c[d].itemID===t){c[d].description=a;break}break}this.setState({lists:i});var m=JSON.stringify({username:this.state.username,listName:"All"===e||"Next 7 Days"===e||"Today"===e?s.originalList:e,itemID:t,description:a});fetch("http://localhost:9000/setItemDescription",{method:"POST",headers:{"Content-Type":"application/json"},body:m})}},{key:"handleLogOut",value:function(){K.remove("DoozyLogin"),this.setState({docTitle:"Log in | Doozy",loggedIn:"not yet",registered:"not yet",loginOrRegister:"login",lists:[],username:"",currentlySelectedListIndex:0,currentlySelectedListName:"",currentlySelectedItemID:"",firstName:"",lastName:"",loaded:!1})}},{key:"createEmptyList",value:function(e,t){var a={name:e,color:t,items:[]},i=this.state.lists.slice();i.splice(i.length-3,0,a),this.setState({lists:i,currentlySelectedListIndex:i.length-4,currentlySelectedListName:e});var s=JSON.stringify({username:this.state.username,listName:e,color:t});fetch("http://localhost:9000/createEmptyList",{method:"POST",headers:{"Content-Type":"application/json"},body:s})}},{key:"focusAddListOverlayTitleInput",value:function(){this.addListTitleRef.current.focus()}},{key:"focusEditListOverlayTitleInput",value:function(){this.editListTitleRef.current.focus()}},{key:"deleteList",value:function(e){for(var t=-1,a=this.state.lists.slice(),i=0;i<a.length;i++)if(a[i].name===e){t=i;break}a.splice(t,1),a=a.slice(0,a.length-3),a=this.appendSmartLists(a),this.setState({lists:a,currentlySelectedItemID:"",currentlySelectedListIndex:t-1>=0?t-1:2,currentlySelectedListName:t-1>=0?a[t-1].name:a[2].name});var s=JSON.stringify({username:this.state.username,listName:e});fetch("http://localhost:9000/deleteList",{method:"POST",headers:{"Content-Type":"application/json"},body:s})}},{key:"editList",value:function(e,t,a){for(var i=this.state.lists.slice(),s=0;s<i.length;s++)if(i[s].name===e){i[s].name=t,i[s].color=a;for(var r=i[s].items,n=0;n<r.length;n++)r[n].originalList=t,r[n].color=a;break}this.setState({lists:i});var l=JSON.stringify({username:this.state.username,oldName:e,newName:t,color:a});fetch("http://localhost:9000/editList",{method:"POST",headers:{"Content-Type":"application/json"},body:l})}},{key:"handleDisplayNotification",value:function(){var e=this;!1===this.state.notificationDisplaying&&(this.setState({notificationDisplaying:!0}),setTimeout((function(){e.setState({notificationDisplaying:!1})}),4500))}},{key:"handleShowAddListOverlay",value:function(){var e=this;this.setState({addListOverlayDisplaying:!0}),p()(".add-list-overlay-color-selected").removeClass(".add-list-overlay-color-selected"),this.addListTitleRef.current.value="",setTimeout((function(){e.addListTitleRef.current.focus()}),500)}},{key:"handleShowEditListOverlay",value:function(e,t){var a=this;this.setState({editListOverlayDisplaying:!0,editListColor:t,editListName:e}),this.editListTitleRef.current.value=e,setTimeout((function(){a.editListTitleRef.current.focus()}),500)}},{key:"handleShowSettingsOverlay",value:function(){var e=this;this.setState({settingsOverlayDisplaying:!0}),setTimeout((function(){e.settingsRef.current.focus()}),500)}},{key:"handleHideAddListOverlay",value:function(){this.setState({addListOverlayDisplaying:!1})}},{key:"handleHideEditListOverlay",value:function(){this.setState({editListOverlayDisplaying:!1,editListColor:"",editListName:""})}},{key:"setBackgroundSetting",value:function(e){this.setState({background:e,bgURL:'url("'+e+'")'})}},{key:"setKeywordsSetting",value:function(e){this.setState({keywords:e});var t=JSON.stringify({username:this.state.username,keywords:e});fetch("http://localhost:9000/setKeywordSetting",{method:"POST",headers:{"Content-Type":"application/json"},body:t})}},{key:"setSortingSetting",value:function(e){var t=this;this.setState({sorting:e});var a=JSON.stringify({username:this.state.username,sorting:e});fetch("http://localhost:9000/setSortingSetting",{method:"POST",headers:{"Content-Type":"application/json"},body:a}).then((function(){t.getLists(t.state.currentlySelectedListName,t.state.currentlySelectedListIndex)}))}},{key:"render",value:function(){var e=this;document.title=this.state.docTitle;var t=this.state.lists.slice(this.state.currentlySelectedListIndex,this.state.currentlySelectedListIndex+1),a="";void 0!==this.state.lastDeletedItem&&(a=this.state.lastDeletedItem.title);var i=this.getCurrentlySelectedItem(),r="row align-items-center"+("successful"===this.state.loggedIn?"":" d-none"),n="container-fluid align-items-center"+("successful"===this.state.loggedIn?" d-none":" d-flex ");return s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{id:"login-register",style:{backgroundImage:this.state.bgURL},className:n},s.a.createElement("div",{className:"login-section"+("login"===this.state.loginOrRegister?"":" d-none")},s.a.createElement(C,{loginInfo:this.state.loggedIn,verifyLogin:function(t,a,i){return e.verifyLogin(t,a,i)},createAccount:function(t,a,i,s,r){return e.createAccount(t,a,i,s,r)},switchToRegister:function(){return e.toggleLoginRegister()}})),s.a.createElement("div",{className:"register-section"+("register"===this.state.loginOrRegister?"":" d-none")},s.a.createElement(O,{switchToLogin:function(){return e.toggleLoginRegister()},verifyLogin:function(t,a,i){return e.verifyLogin(t,a,i)},createAccount:function(t,a,i,s,r){return e.createAccount(t,a,i,s,r)},registerInfo:this.state.registered}))),s.a.createElement("div",{id:"app",style:{backgroundImage:this.state.bgURL},className:r,onKeyDown:function(t){27===t.keyCode&&(e.state.addListOverlayDisplaying?e.setState({addListOverlayDisplaying:!1}):e.state.settingsOverlayDisplaying?e.setState({settingsOverlayDisplaying:!1}):e.state.editListOverlayDisplaying&&e.setState({editListOverlayDisplaying:!1}))}},s.a.createElement(P,{id:"addListOverlay",displaying:this.state.addListOverlayDisplaying,addListTitleRef:this.addListTitleRef,lists:this.state.lists,hideOverlay:function(){return e.handleHideAddListOverlay()},createList:function(t,a){return e.createEmptyList(t,a)},focusTitleInput:function(){return e.focusAddListOverlayTitleInput()}}),s.a.createElement(A,{id:"editListOverlay",displaying:this.state.editListOverlayDisplaying,editListTitleRef:this.editListTitleRef,lists:this.state.lists,hideOverlay:function(){return e.handleHideEditListOverlay()},focusTitleInput:function(){return e.focusEditListOverlayTitleInput()},startingName:this.state.editListName,startingColor:this.state.editListColor,editList:function(t,a,i){return e.editList(t,a,i)}}),s.a.createElement(F,{settingsRef:this.settingsRef,displaying:this.state.settingsOverlayDisplaying,sorting:this.state.sorting,keywords:this.state.keywords,background:this.state.background,setKeywordsSetting:function(t){return e.setKeywordsSetting(t)},setSortingSetting:function(t){return e.setSortingSetting(t)},setBackgroundSetting:function(t){return e.setBackgroundSetting(t)},hideSettingsOverlay:function(){return e.setState({settingsOverlayDisplaying:!1})}}),s.a.createElement(j,{displaying:this.state.notificationDisplaying,hideNotification:function(){return e.setState({notificationDisplaying:!1})},title:a,undo:function(){void 0!==e.state.lastDeletedItem.itemID&&e.addListItem(e.state.lastDeletedItem.originalList,e.state.lastDeletedItem.title,e.state.lastDeletedItem.dueDate,e.state.lastDeletedItem.description,e.state.lastDeletedItem.priority,e.state.lastDeletedItem.color,e.state.lastDeletedItem.itemID,e.state.lastDeletedItem.completed)},listName:this.state.lastDeletedItemListName,originalList:this.state.lastDeletedItem.originalList}),s.a.createElement("div",{id:"sidebar",className:"p-0"},s.a.createElement(L,{username:this.state.username,lists:this.state.lists,firstName:this.state.firstName,lastName:this.state.lastName,currentlySelectedListName:this.state.currentlySelectedListName,setSelectedList:function(t){return e.setSelectedList(t)},showAddListOverlay:function(){return e.handleShowAddListOverlay()},deleteList:function(t){return e.deleteList(t)},showEditListOverlay:function(t,a){return e.handleShowEditListOverlay(t,a)}})),t.map((function(t,a){return s.a.createElement(s.a.Fragment,{key:t.name},s.a.createElement("div",{id:"todolist",className:"col-5"},s.a.createElement(I,{color:t.color,name:t.name,items:t.items,keywords:e.state.keywords,addListItem:function(t,a,i,s,r,n){return e.addListItem(t,a,i,s,r,n)},deleteListItem:function(t,a,i){return e.deleteListItem(t,a,i)},setItemTitle:function(t,a,i){return e.setItemTitle(t,a,i)},setItemCompleted:function(t,a,i){return e.setItemCompleted(t,a,i)},setSelectedItem:function(t){return e.setSelectedItem(t)},selectedItemID:e.state.currentlySelectedItemID,hideAddListOverlay:function(){return e.handleHideAddListOverlay()}})),s.a.createElement("div",{id:"details",className:"col-4"},s.a.createElement(S,{listName:t.name,selectedItemID:i.itemID,selectedItemColor:i.color,selectedItemList:i.originalList,selectedItemTitle:i.title,selectedItemDueDate:i.dueDate,selectedItemDescription:i.description,selectedItemPriority:i.priority,selectedItemCompleted:i.completed,setItemTitle:function(t,a,i){return e.setItemTitle(t,a,i)},setItemCompleted:function(t,a,i){return e.setItemCompleted(t,a,i)},setItemDueDate:function(t,a,i){return e.setItemDueDate(t,a,i)},setItemPriority:function(t,a,i){return e.setItemPriority(t,a,i)},setItemDescription:function(t,a,i){return e.setItemDescription(t,a,i)},handleDelete:function(t,a,i){return e.deleteListItem(t,a,i)},hideAddListOverlay:function(){return e.handleHideAddListOverlay()}})),s.a.createElement("div",{className:"col-1"}),s.a.createElement("div",{id:"toolbar",className:"row col-1 justify-content-center"},s.a.createElement(T,{handleLogOut:function(){return e.handleLogOut()},deleteAllCompletedItems:function(){e.deleteAllCompletedItems(e.state.currentlySelectedListName)},currentlySelectedListName:e.state.currentlySelectedListName,handleShowSettingsOverlay:function(){return e.handleShowSettingsOverlay()}})))}))))}}]),a}(i.Component);function W(e,t){if(e.completed&&!t.completed)return 1;if(!e.completed&&t.completed)return-1;if(""===e.dueDate&&""!==t.dueDate)return 1;if(""!==e.dueDate&&""===t.dueDate)return-1;if(e.dueDate===t.dueDate){var a=["low","medium","high"],i=a.indexOf(e.priority),s=a.indexOf(t.priority);return i!==s?s-i:e.itemID-t.itemID}return new Date(e.dueDate+" 00:00")-new Date(t.dueDate+" 00:00")}function G(e,t){if(e.completed&&!t.completed)return 1;if(!e.completed&&t.completed)return-1;var a=["low","medium","high"],i=a.indexOf(e.priority),s=a.indexOf(t.priority);if(s===i){if(""===e.dueDate&&""!==t.dueDate)return 1;if(""!==e.dueDate&&""===t.dueDate)return-1;var r=new Date(e.dueDate+" 00:00"),n=new Date(t.dueDate+" 00:00");return e.dueDate!==t.dueDate?r-n:e.itemID-t.itemID}return s-i}function B(){var e=["https://iili.io/J4xbBS.jpg","https://iili.io/J4xtQ2.jpg","https://iili.io/J4z92e.jpg","https://iili.io/J4zdpj.jpg","https://iili.io/J4zJkb.jpg","https://iili.io/J4zWZl.jpg","https://iili.io/J4Weln.jpg","https://iili.io/J4WhoN.jpg","https://iili.io/J4WOKX.jpg","https://iili.io/J4WUN4.jpg","https://iili.io/J4WgDl.jpg","https://iili.io/J4WmDQ.jpg","https://iili.io/J4X9WB.jpg","https://iili.io/J4XHiP.jpg","https://iili.io/J4WyxV.jpg","https://iili.io/JPNuGR.jpg","https://iili.io/JPN53N.jpg","https://iili.io/JPNTCv.jpg","https://iili.io/JiKSp4.jpg","https://iili.io/Jszxun.jpg","https://iili.io/JszAG4.jpg","https://iili.io/JszIZG.jpg","https://iili.io/Jszzjs.jpg","https://iili.io/Jszunf.jpg"];return'url("'+e[Math.floor(Math.random()*Math.floor(e.length))]+'")'}function M(e){var t=e.getDate();t<10&&(t="0"+t.toString());var a=e.getMonth()+1;return a<10&&(a="0"+a.toString()),e.getFullYear().toString()+"-"+a+"-"+t}function Y(e){for(var t=new Date,a=0;a<7;a++){var i=M(t);if(e===i)return!0;t.setDate(t.getDate()+1)}return e===(i=M(t))}function q(e,t){this.setTimeout(e,t)}q.prototype.setTimeout=function(e,t){var a=this;this.timer&&clearTimeout(this.timer),this.finished=!1,this.callback=e,this.time=t,this.timer=setTimeout((function(){a.finished=!0,e()}),t),this.start=Date.now()},q.prototype.add=function(e){this.finished||(e=this.time-(Date.now()-this.start)+e,this.setTimeout(this.callback,e))};Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));n.a.render(s.a.createElement(s.a.StrictMode,null,s.a.createElement(z,null)),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)}))}},[[20,1,2]]]);
  //# sourceMappingURL=main.c0420798.chunk.js.map