(function(e){function t(t){for(var n,a,c=t[0],s=t[1],u=t[2],p=0,h=[];p1){var i=n[1];t[i]=e(r)}})),t}n["default"].use(i["a"]),t["a"]=new i["a"]({locale:Object({NODE_ENV:"production",BASE_URL:""}).VUE_APP_I18N_LOCALE||"en",fallbackLocale:Object({NODE_ENV:"production",BASE_URL:""}).VUE_APP_I18N_FALLBACK_LOCALE||"en",messages:o()})},a625:function(e){e.exports=JSON.parse('{"import_running":"Er wordt geïmporteerd, even geduld!","all_fields_optional":"Alle velden zijn optioneel en kunnen leeg gelaten worden.","convert_internal":"Zet om naar intern recept","Log_Recipe_Cooking":"Log Bereiding","External_Recipe_Image":"Externe Afbeelding Recept","Add_to_Book":"Voeg toe aan Boek","Add_to_Shopping":"Voeg toe aan Boodschappenlijst","Add_to_Plan":"Voeg toe aan Plan","Step_start_time":"Starttijd stap","Select_Book":"Selecteer Boek","Recipe_Image":"Afbeelding Recept","Import_finished":"Importeren gereed","View_Recipes":"Bekijk Recepten","Log_Cooking":"Log Bereiding","Proteins":"Eiwitten","Fats":"Vetten","Carbohydrates":"Koolhydraten","Calories":"Calorieën","Nutrition":"Voedingswaarde","Date":"Datum","Share":"Deel","Export":"Exporteren","Rating":"Beoordeling","Close":"Sluiten","Add":"Voeg toe","Ingredients":"Ingrediënten","min":"min","Servings":"Porties","Waiting":"Wachten","Preparation":"Bereiding","Edit":"Bewerken","Open":"Open","Save":"Opslaan","Step":"Stap","Search":"Zoeken","Import":"Importeer","Print":"Afdrukken","Information":"Informatie","Keywords":"Etiketten","Books":"Boeken","show_only_internal":"Toon alleen interne recepten","New_Recipe":"Nieuw Recept","Url_Import":"Importeer URL","Reset_Search":"Zoeken resetten","or":"of","and":"en","Recently_Viewed":"Recent bekeken","External":"Externe","Settings":"Instellingen","Meal_Plan":"Maaltijdplan","New":"Nieuw","Supermarket":"Supermarkt","Categories":"Categorieën","Category":"Categorie","Selected":"Geselecteerd"}')},dfc6:function(e){e.exports=JSON.parse('{"err_fetching_resource":"","err_creating_resource":"","err_updating_resource":"","err_deleting_resource":"","success_fetching_resource":"","success_creating_resource":"","success_updating_resource":"","success_deleting_resource":"","import_running":"","all_fields_optional":"","convert_internal":"","show_only_internal":"","Log_Recipe_Cooking":"","External_Recipe_Image":"","Add_to_Book":"","Add_to_Shopping":"","Add_to_Plan":"","Step_start_time":"","Meal_Plan":"","Select_Book":"","Recipe_Image":"","Import_finished":"","View_Recipes":"","Log_Cooking":"","New_Recipe":"","Url_Import":"","Reset_Search":"","Recently_Viewed":"","Load_More":"","Keywords":"","Books":"","Proteins":"","Fats":"","Carbohydrates":"","Calories":"","Nutrition":"","Date":"","Share":"","Export":"","Copy":"","Rating":"","Close":"","Link":"","Add":"","New":"","Success":"","Ingredients":"","Supermarket":"","Categories":"","Category":"","Selected":"","min":"","Servings":"","Waiting":"","Preparation":"","External":"","Size":"","Files":"","File":"","Edit":"","Cancel":"","Delete":"","Open":"","Ok":"","Save":"","Step":"","Search":"","Import":"","Print":"","Settings":"","or":"","and":"","Information":"","Download":""}')},edd4:function(e){e.exports=JSON.parse('{"err_fetching_resource":"There was an error fetching a resource!","err_creating_resource":"There was an error creating a resource!","err_updating_resource":"There was an error updating a resource!","err_deleting_resource":"There was an error deleting a resource!","success_fetching_resource":"Successfully fetched a resource!","success_creating_resource":"Successfully created a resource!","success_updating_resource":"Successfully updated a resource!","success_deleting_resource":"Successfully deleted a resource!","import_running":"Import running, please wait!","all_fields_optional":"All fields are optional and can be left empty.","convert_internal":"Convert to internal recipe","show_only_internal":"Show only internal recipes","Log_Recipe_Cooking":"Log Recipe Cooking","External_Recipe_Image":"External Recipe Image","Add_to_Book":"Add to Book","Add_to_Shopping":"Add to Shopping","Add_to_Plan":"Add to Plan","Step_start_time":"Step start time","Meal_Plan":"Meal Plan","Select_Book":"Select Book","Recipe_Image":"Recipe Image","Import_finished":"Import finished","View_Recipes":"View Recipes","Log_Cooking":"Log Cooking","New_Recipe":"New Recipe","Url_Import":"Url Import","Reset_Search":"Reset Search","Recently_Viewed":"Recently Viewed","Load_More":"Load More","Keywords":"Keywords","Books":"Books","Proteins":"Proteins","Fats":"Fats","Carbohydrates":"Carbohydrates","Calories":"Calories","Nutrition":"Nutrition","Date":"Date","Share":"Share","Export":"Export","Copy":"Copy","Rating":"Rating","Close":"Close","Link":"Link","Add":"Add","New":"New","Success":"Success","Ingredients":"Ingredients","Supermarket":"Supermarket","Categories":"Categories","Category":"Category","Selected":"Selected","min":"min","Servings":"Servings","Waiting":"Waiting","Preparation":"Preparation","External":"External","Size":"Size","Files":"Files","File":"File","Edit":"Edit","Cancel":"Cancel","Delete":"Delete","Open":"Open","Ok":"Open","Save":"Save","Step":"Step","Search":"Search","Import":"Import","Print":"Print","Settings":"Settings","or":"or","and":"and","Information":"Information","Download":"Download"}')},fa7d:function(e,t,r){"use strict";r.d(t,"c",(function(){return o})),r.d(t,"f",(function(){return a})),r.d(t,"a",(function(){return c})),r.d(t,"e",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"g",(function(){return d})),r.d(t,"d",(function(){return h}));r("99af");var n=r("59e4");function i(e,t,r){var n=Math.floor(e),i=1,o=n+1,a=1;if(e!==n)while(i<=t&&a<=t){var c=(n+o)/(i+a);if(e===c){i+a<=t?(i+=a,n+=o,a=t+1):i>a?a=t+1:i=t+1;break}et&&(i=a,n=o),!r)return[0,n,i];var s=Math.floor(n/i);return[s,n-s*i,i]}var o={methods:{makeToast:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return a(e,t,r)}}};function a(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=new n["a"];i.$bvToast.toast(t,{title:e,variant:r,toaster:"b-toaster-top-center",solid:!0})}var c={methods:{_:function(e){return s(e)}}};function s(e){return window.gettext(e)}var u={methods:{resolveDjangoUrl:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return d(e,t)}}};function d(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==t?window.Urls[e](t):window.Urls[e]()}function p(e){return window.USER_PREF[e]}function h(e,t){if(p("use_fractions")){var r="",n=i(e*t,9,!0);return n[0]>0&&(r+=n[0]),n[1]>0&&(r+=" ".concat(n[1],"").concat(n[2],"")),r}return b(e*t)}function b(e){var t=p("user_fractions")?p("user_fractions"):2;return+(Math.round(e+"e+".concat(t))+"e-".concat(t))}},fd4d:function(e,t,r){"use strict";r.r(t);r("e260"),r("e6cf"),r("cca6"),r("a79d");var n=r("a026"),i=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{attrs:{id:"app"}},[r("div",{staticClass:"row"},[r("div",{staticClass:"col col-md-12"},[r("h3",[e._v(e._s(e.$t("Files"))+" "),r("span",{staticClass:"float-right"},[r("file-editor",{on:{change:function(t){return e.loadInitial()}}})],1)])])]),r("div",{staticClass:"row",staticStyle:{"margin-top":"2vh"}},[r("div",{staticClass:"col col-md-12"},[r("b-progress",{attrs:{max:e.max_file_size_mb}},[r("b-progress-bar",{attrs:{value:e.current_file_size_mb}},[r("span",[r("strong",{staticClass:"text-dark "},[e._v(e._s(e.current_file_size_mb.toFixed(2))+" / "+e._s(e.max_file_size_mb)+" MB")])])])],1)],1)]),r("div",{staticClass:"row",staticStyle:{"margin-top":"2vh"}},[r("div",{staticClass:"col col-md-12"},[r("table",{staticClass:"table"},[r("thead",[r("tr",[r("th",[e._v(e._s(e.$t("Name")))]),r("th",[e._v(e._s(e.$t("Size"))+" (MB)")]),r("th",[e._v(e._s(e.$t("Download")))]),r("th",[e._v(e._s(e.$t("Edit")))])])]),e._l(e.files,(function(t){return r("tr",{key:t.id},[r("td",[e._v(e._s(t.name))]),r("td",[e._v(e._s(t.file_size_kb/1e3))]),r("td",[r("a",{attrs:{href:t.file,target:"_blank",rel:"noreferrer nofollow"}},[e._v(e._s(e.$t("Download")))])]),r("td",[r("file-editor",{attrs:{file_id:t.id},on:{change:function(t){return e.loadInitial()}}})],1)])}))],2)])])])},o=[],a=r("5f5b"),c=(r("2dd8"),r("fa7d")),s=r("2b2d"),u=r("bc3a"),d=r.n(u),p=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[r("b-button",{directives:[{name:"b-modal",rawName:"v-b-modal",value:"modal-file-editor"+e.file_id,expression:"'modal-file-editor'+file_id"}],class:{"btn-success":void 0===e.file_id}},[this.file_id?[e._v(e._s(e.$t("Edit")))]:[e._v(e._s(e.$t("New")))]],2),r("b-modal",{attrs:{id:"modal-file-editor"+e.file_id,title:e.$t("File")},on:{ok:function(t){return e.modalOk()}},scopedSlots:e._u([{key:"modal-footer",fn:function(){return[r("b-button",{attrs:{size:"sm",variant:"success"},on:{click:function(t){return e.modalOk()}}},[e._v(" "+e._s(e.$t("Ok"))+" ")]),r("b-button",{attrs:{size:"sm",variant:"secondary"},on:{click:function(t){return e.$bvModal.hide("modal-file-editor"+e.file_id)}}},[e._v(" "+e._s(e.$t("Cancel"))+" ")]),r("b-button",{attrs:{size:"sm",variant:"danger"},on:{click:function(t){return e.deleteFile()}}},[e._v(" "+e._s(e.$t("Delete"))+" ")])]},proxy:!0}])},[void 0!==e.file?[e._v(" "+e._s(e.$t("Name"))+" "),r("b-input",{model:{value:e.file.name,callback:function(t){e.$set(e.file,"name",t)},expression:"file.name"}}),r("br"),e._v(" "+e._s(e.$t("File"))+" "),r("b-form-file",{model:{value:e.file.file,callback:function(t){e.$set(e.file,"file",t)},expression:"file.file"}})]:e._e(),r("br"),r("br")],2)],1)},h=[],b=(r("a9e3"),r("d3b7"),r("25f0"),r("b0c0"),{name:"FileEditor",data:function(){return{file:void 0}},props:{file_id:Number},mounted:function(){void 0!==this.file_id?this.loadFile(this.file_id.toString()):this.file={name:"",file:void 0}},methods:{loadFile:function(e){var t=this,r=new s["a"];r.retrieveUserFile(e).then((function(e){t.file=e.data}))},modalOk:function(){void 0===this.file_id?(console.log("CREATING"),this.createFile()):(console.log("UPDATING"),this.updateFile())},updateFile:function(){var e=this,t=new s["a"],r=void 0;"string"===typeof this.file.file||this.file.file instanceof String||(r=this.file.file),t.updateUserFile(this.file.id,this.file.name,r).then((function(t){Object(c["f"])(e.$t("Success"),e.$t("success_updating_resource"),"success"),e.$emit("change")})).catch((function(t){Object(c["f"])(e.$t("Error"),e.$t("err_updating_resource")+"\n"+t.response.data,"danger"),console.log(t.request,t.response)}))},createFile:function(){var e=this,t=new s["a"];t.createUserFile(this.file.name,this.file.file).then((function(t){Object(c["f"])(e.$t("Success"),e.$t("success_creating_resource"),"success"),e.$emit("change"),e.file={name:"",file:void 0}})).catch((function(t){Object(c["f"])(e.$t("Error"),e.$t("err_creating_resource")+"\n"+t.response.data,"danger"),console.log(t.request,t.response)}))},deleteFile:function(){var e=this,t=new s["a"];t.destroyUserFile(this.file.id).then((function(t){Object(c["f"])(e.$t("Success"),e.$t("success_deleting_resource"),"success"),e.$emit("change")})).catch((function(t){Object(c["f"])(e.$t("Error"),e.$t("err_deleting_resource")+"\n"+t.response.data,"danger"),console.log(t.request,t.response)}))}}}),f=b,l=r("2877"),O=Object(l["a"])(f,p,h,!1,null,null,null),j=O.exports;n["default"].use(a["a"]),d.a.defaults.xsrfHeaderName="X-CSRFToken",d.a.defaults.xsrfCookieName="csrftoken";var v={name:"UserFileView",mixins:[c["b"],c["c"]],components:{FileEditor:j},data:function(){return{files:[],current_file_size_mb:window.CURRENT_FILE_SIZE_MB,max_file_size_mb:window.MAX_FILE_SIZE_MB}},mounted:function(){this.$i18n.locale=window.CUSTOM_LOCALE,this.loadInitial()},methods:{loadInitial:function(){var e=this,t=new s["a"];t.listUserFiles().then((function(t){e.files=t.data}))}}},m=v,g=Object(l["a"])(m,i,o,!1,null,null,null),y=g.exports,P=r("9225");n["default"].config.productionTip=!1,new n["default"]({i18n:P["a"],render:function(e){return e(y)}}).$mount("#app")}});