From 8a051b531d141849526b6c5572c857038f13997d Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 18 Mar 2021 20:00:13 +0100 Subject: [PATCH] import response view --- cookbook/integration/integration.py | 2 +- cookbook/static/vue/import_response_view.html | 1 + .../static/vue/js/import_response_view.js | 1 + cookbook/static/vue/js/recipe_view.js | 2 +- cookbook/templates/import_response.html | 34 ++++++ cookbook/templates/sw.js | 2 +- cookbook/urls.py | 1 + cookbook/views/import_export.py | 10 +- .../ImportResponseView/ImportResponseView.vue | 110 ++++++++++++++++++ vue/src/apps/ImportResponseView/main.js | 8 ++ vue/src/utils/api.js | 10 ++ vue/vue.config.js | 4 + vue/webpack-stats.json | 2 +- 13 files changed, 181 insertions(+), 6 deletions(-) create mode 100644 cookbook/static/vue/import_response_view.html create mode 100644 cookbook/static/vue/js/import_response_view.js create mode 100644 cookbook/templates/import_response.html create mode 100644 vue/src/apps/ImportResponseView/ImportResponseView.vue create mode 100644 vue/src/apps/ImportResponseView/main.js diff --git a/cookbook/integration/integration.py b/cookbook/integration/integration.py index 1745de44..39d08c2b 100644 --- a/cookbook/integration/integration.py +++ b/cookbook/integration/integration.py @@ -109,7 +109,7 @@ class Integration: il.msg += 'ERROR ' + _('Importer expected a .zip file. Did you choose the correct importer type for your data ?') + '\n' if len(ignored_recipes) > 0: - il.msg += _('The following recipes were ignored because they already existed:') + ' ' + ', '.join(ignored_recipes) + '\n' + il.msg += '\n' + _('The following recipes were ignored because they already existed:') + ' ' + ', '.join(ignored_recipes) + '\n\n' il.keyword = self.keyword il.msg += (_('Imported %s recipes.') % Recipe.objects.filter(keywords=self.keyword).count()) + '\n' diff --git a/cookbook/static/vue/import_response_view.html b/cookbook/static/vue/import_response_view.html new file mode 100644 index 00000000..27032984 --- /dev/null +++ b/cookbook/static/vue/import_response_view.html @@ -0,0 +1 @@ +Vue App
\ No newline at end of file diff --git a/cookbook/static/vue/js/import_response_view.js b/cookbook/static/vue/js/import_response_view.js new file mode 100644 index 00000000..745ac32b --- /dev/null +++ b/cookbook/static/vue/js/import_response_view.js @@ -0,0 +1 @@ +(function(t){function n(n){for(var r,i,c=n[0],s=n[1],u=n[2],l=0,d=[];li?i=n+1:o=n+1;break}tn&&(o=i,r=a),!e)return[0,r,o];var s=Math.floor(r/o);return[s,r-s*o,o]}var a={methods:{makeToast:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return i(t,n,e)}}};function i(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=new r["a"];o.$bvToast.toast(n,{title:t,variant:e,toaster:"b-toaster-top-center",solid:!0})}var c={methods:{_:function(t){return s(t)}}};function s(t){return window.gettext(t)}var u={methods:{resolveDjangoUrl:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return f(t,n)}}};function f(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==n?window.Urls[t](n):window.Urls[t]()}function l(t){return window.USER_PREF[t]}function d(t,n){if(l("use_fractions")){var e="",r=o(t*n,9,!0);return r[0]>0&&(e+=r[0]),r[1]>0&&(e+=" ".concat(r[1],"").concat(r[2],"")),e}return p(t*n)}function p(t){var n=l("user_fractions")?l("user_fractions"):2;return+(Math.round(t+"e+".concat(n))+"e-".concat(n))}}}); \ No newline at end of file diff --git a/cookbook/static/vue/js/recipe_view.js b/cookbook/static/vue/js/recipe_view.js index 84307478..7aecdb4c 100644 --- a/cookbook/static/vue/js/recipe_view.js +++ b/cookbook/static/vue/js/recipe_view.js @@ -1 +1 @@ -(function(e){function t(t){for(var i,r,o=t[0],c=t[1],l=t[2],p=0,f=[];p0?s("div",{staticClass:"col-md-6 order-md-1 col-sm-12 order-sm-2 col-12 order-2"},[s("div",{staticClass:"card border-primary"},[s("div",{staticClass:"card-body"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col col-md-8"},[s("h4",{staticClass:"card-title"},[s("i",{staticClass:"fas fa-pepper-hot"}),e._v(" "+e._s(e._("Ingredients")))])])]),s("br"),s("div",{staticClass:"row"},[s("div",{staticClass:"col-md-12"},[s("table",{staticClass:"table table-sm"},[e._l(e.recipe.steps,(function(t){return[e._l(t.ingredients,(function(t){return[s("Ingredient",{key:t.id,attrs:{ingredient:t,ingredient_factor:e.ingredient_factor},on:{"checked-state-changed":e.updateIngredientCheckedState}})]}))]}))],2)])])])])]):e._e(),s("div",{staticClass:"col-12 order-1 col-sm-12 order-sm-1 col-md-6 order-md-2"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-12"},[null!==e.recipe.image?s("img",{staticClass:"img img-fluid rounded",staticStyle:{"max-height":"30vh"},attrs:{src:e.recipe.image,alt:e._("Recipe Image")}}):e._e()])]),s("div",{staticClass:"row",staticStyle:{"margin-top":"2vh","margin-bottom":"2vh"}},[s("div",{staticClass:"col-12"},[s("Nutrition",{attrs:{recipe:e.recipe,ingredient_factor:e.ingredient_factor}})],1)])])]),e.recipe.internal?e._e():[e.recipe.file_path.includes(".pdf")?s("div",[s("PdfViewer",{attrs:{recipe:e.recipe}})],1):e._e(),e.recipe.file_path.includes(".png")||e.recipe.file_path.includes(".jpg")||e.recipe.file_path.includes(".jpeg")||e.recipe.file_path.includes(".gif")?s("div",[s("ImageViewer",{attrs:{recipe:e.recipe}})],1):e._e()],e._l(e.recipe.steps,(function(t,i){return s("div",{key:t.id,staticStyle:{"margin-top":"1vh"}},[s("Step",{attrs:{recipe:e.recipe,step:t,ingredient_factor:e.ingredient_factor,index:i,start_time:e.start_time},on:{"update-start-time":e.updateStartTime,"checked-state-changed":e.updateIngredientCheckedState}})],1)}))],2),s("add-recipe-to-book",{attrs:{recipe:e.recipe}})],2)},n=[function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"my-auto",staticStyle:{"padding-right":"4px"}},[s("i",{staticClass:"fas fa-user-clock fa-2x text-primary"})])},function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"my-auto",staticStyle:{"padding-right":"4px"}},[s("i",{staticClass:"far fa-clock fa-2x text-primary"})])},function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"my-auto",staticStyle:{"padding-right":"4px"}},[s("i",{staticClass:"fas fa-pizza-slice fa-2x text-primary"})])}],r=s("b85c"),o=s("5f5b"),c=(s("2dd8"),s("bc3a")),l=s.n(c),d=s("fa7d");function p(e){var t=Object(d["g"])("api:recipe-detail",e);return void 0!==window.SHARE_UID&&(t+="?share="+window.SHARE_UID),l.a.get(t).then((function(e){return e.data})).catch((function(e){_(e,"There was an error loading a resource!","danger")}))}function f(e){return l.a.post(Object(d["g"])("api:cooklog-list"),e).then((function(e){Object(d["f"])("Saved","Cook Log entry saved!","success")})).catch((function(e){_(e,"There was an error creating a resource!","danger")}))}function u(e){return l.a.get(Object(d["g"])("api:recipebook-list")+"?query="+e).then((function(e){return e.data})).catch((function(e){_(e,"There was an error creating a resource!","danger")}))}function m(e){return l.a.post(Object(d["g"])("api:recipebookentry-list"),e).then((function(e){Object(d["f"])("Saved","Recipe Book entry saved!","success")})).catch((function(e){_(e,"There was an error creating a resource!","danger")}))}function _(e,t){if("response"in e){console.log(e.response);var s="statusText"in e.response?e.response.statusText:Object(d["e"])("Error");t+="\n\n"+JSON.stringify(e.response.data),Object(d["f"])(s,t,"danger")}else Object(d["f"])("Error",t,"danger"),console.log(e)}l.a.defaults.xsrfCookieName="csrftoken",l.a.defaults.xsrfHeaderName="X-CSRFTOKEN";var v=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("hr"),"TEXT"===e.step.type?[e.recipe.steps.length>1?s("div",{staticClass:"row"},[s("div",{staticClass:"col col-md-8"},[s("h5",{staticClass:"text-primary"},[e.step.name?[e._v(e._s(e.step.name))]:[e._v(e._s(e._("Step"))+" "+e._s(e.index+1))],0!==e.step.time?s("small",{staticClass:"text-muted",staticStyle:{"margin-left":"4px"}},[s("i",{staticClass:"fas fa-user-clock"}),e._v(" "+e._s(e.step.time)+" "+e._s(e._("min"))+" ")]):e._e(),""!==e.start_time?s("small",{staticClass:"d-print-none"},[s("b-link",{attrs:{id:"id_reactive_popover_"+e.step.id,href:"#"},on:{click:e.openPopover}},[e._v(" "+e._s(e.moment(e.start_time).add(e.step.time_offset,"minutes").format("HH:mm"))+" ")])],1):e._e()],2)]),s("div",{staticClass:"col col-md-4",staticStyle:{"text-align":"right"}},[s("b-button",{staticClass:"shadow-none",class:{"text-primary":e.details_visible,"text-success":!e.details_visible},staticStyle:{border:"none",background:"none"},on:{click:function(t){e.details_visible=!e.details_visible}}},[s("i",{staticClass:"far fa-check-circle"})])],1)]):e._e(),s("b-collapse",{attrs:{id:"collapse-1"},model:{value:e.details_visible,callback:function(t){e.details_visible=t},expression:"details_visible"}},[s("div",{staticClass:"row"},[e.step.ingredients.length>0&&e.recipe.steps.length>1?s("div",{staticClass:"col col-md-4"},[s("table",{staticClass:"table table-sm"},[e._l(e.step.ingredients,(function(t){return[s("Ingredient",{key:t.id,attrs:{ingredient:t,ingredient_factor:e.ingredient_factor},on:{"checked-state-changed":function(s){return e.$emit("checked-state-changed",t)}}})]}))],2)]):e._e(),s("div",{staticClass:"col",class:{"col-md-8":e.recipe.steps.length>1,"col-md-12":e.recipe.steps.length<=1}},[s("compile-component",{attrs:{code:e.step.ingredients_markdown,ingredient_factor:e.ingredient_factor}})],1)])])]:e._e(),"TIME"===e.step.type?[s("div",{staticClass:"row"},[s("div",{staticClass:"col-md-8 offset-md-2",staticStyle:{"text-align":"center"}},[s("h4",{staticClass:"text-primary"},[e.step.name?[e._v(e._s(e.step.name))]:[e._v(e._s(e._("Step"))+" "+e._s(e.index+1))]],2),0!==e.step.time?s("span",{staticClass:"text-muted",staticStyle:{"margin-left":"4px"}},[s("i",{staticClass:"fa fa-stopwatch"}),e._v(" "+e._s(e.step.time)+" "+e._s(e._("min")))]):e._e(),""!==e.start_time?s("b-link",{staticClass:"d-print-none",attrs:{id:"id_reactive_popover_"+e.step.id,href:"#"},on:{click:e.openPopover}},[e._v(" "+e._s(e.moment(e.start_time).add(e.step.time_offset,"minutes").format("HH:mm"))+" ")]):e._e()],1),s("div",{staticClass:"col-md-2",staticStyle:{"text-align":"right"}},[s("b-button",{staticClass:"shadow-none",class:{"text-primary":e.details_visible,"text-success":!e.details_visible},staticStyle:{border:"none",background:"none"},on:{click:function(t){e.details_visible=!e.details_visible}}},[s("i",{staticClass:"far fa-check-circle"})])],1)]),s("b-collapse",{attrs:{id:"collapse-1"},model:{value:e.details_visible,callback:function(t){e.details_visible=t},expression:"details_visible"}},[""!==e.step.instruction?s("div",{staticClass:"row"},[s("div",{staticClass:"col col-md-12",staticStyle:{"text-align":"center"}},[s("compile-component",{attrs:{code:e.step.ingredients_markdown,ingredient_factor:e.ingredient_factor}})],1)]):e._e()])]:e._e(),""!==e.start_time?s("div",[s("b-popover",{ref:"id_reactive_popover_"+e.step.id,attrs:{target:"id_reactive_popover_"+e.step.id,triggers:"click",placement:"bottom",title:e._("Step start time")}},[s("div",[s("b-form-group",{staticClass:"mb-1",attrs:{label:"Time","label-for":"popover-input-1","label-cols":"3"}},[s("b-form-input",{attrs:{type:"datetime-local",id:"popover-input-1",size:"sm"},model:{value:e.set_time_input,callback:function(t){e.set_time_input=t},expression:"set_time_input"}})],1)],1),s("div",{staticClass:"row",staticStyle:{"margin-top":"1vh"}},[s("div",{staticClass:"col-12",staticStyle:{"text-align":"right"}},[s("b-button",{staticStyle:{"margin-right":"8px"},attrs:{size:"sm",variant:"secondary"},on:{click:e.closePopover}},[e._v("Cancel")]),s("b-button",{attrs:{size:"sm",variant:"primary"},on:{click:e.updateTime}},[e._v("Ok")])],1)])])],1):e._e()],2)},b=[],g=(s("a9e3"),function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("tr",{on:{click:function(t){return e.$emit("checked-state-changed",e.ingredient)}}},[e.ingredient.is_header?[s("td",{attrs:{colspan:"5"}},[s("b",[e._v(e._s(e.ingredient.note))])])]:[s("td",[e.ingredient.checked?s("i",{staticClass:"far fa-check-circle text-success"}):e._e(),e.ingredient.checked?e._e():s("i",{staticClass:"far fa-check-circle text-primary"})]),s("td",[0!==e.ingredient.amount?s("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.ingredient.amount))}}):e._e()]),s("td",[null===e.ingredient.unit||e.ingredient.no_amount?e._e():s("span",[e._v(e._s(e.ingredient.unit.name))])]),s("td",[null!==e.ingredient.food?[null!==e.ingredient.food.recipe?s("a",{attrs:{href:e.resolveDjangoUrl("view_recipe",e.ingredient.food.recipe),target:"_blank",rel:"noopener noreferrer"}},[e._v(e._s(e.ingredient.food.name))]):e._e(),null===e.ingredient.food.recipe?s("span",[e._v(e._s(e.ingredient.food.name))]):e._e()]:e._e()],2),s("td",[e.ingredient.note?s("div",[s("span",{directives:[{name:"b-popover",rawName:"v-b-popover.hover",value:e.ingredient.note,expression:"ingredient.note",modifiers:{hover:!0}}],staticClass:"d-print-none"},[s("i",{staticClass:"far fa-comment"})]),s("div",{staticClass:"d-none d-print-block"},[s("i",{staticClass:"far fa-comment-alt"}),e._v(" "+e._s(e.ingredient.note)+" ")])]):e._e()])]],2)}),h=[],j={name:"Ingredient",props:{ingredient:Object,ingredient_factor:{type:Number,default:1}},mixins:[d["b"]],data:function(){return{checked:!1}},methods:{calculateAmount:function(e){return Object(d["d"])(e,this.ingredient_factor)}}},y=j,C=s("2877"),k=Object(C["a"])(y,g,h,!1,null,null,null),w=k.exports,x=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s(e.compiled,{tag:"component",attrs:{ingredient_factor:e.ingredient_factor,code:e.code}})],1)},O=[],S=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.number))}})},E=[],T={name:"ScalableNumber",props:{number:Number,factor:{type:Number,default:4}},methods:{calculateAmount:function(e){return Object(d["d"])(e,this.factor)}}},$=T,P=Object(C["a"])($,S,E,!1,null,null,null),M=P.exports,z={name:"CompileComponent",props:["code","ingredient_factor"],data:function(){return{compiled:null}},mounted:function(){this.compiled=i["default"].component("compiled-component",{props:["ingredient_factor","code"],components:{ScalableNumber:M},template:"
".concat(this.code,"
")})}},N=z,D=Object(C["a"])(N,x,O,!1,null,null,null),R=D.exports,U=s("c1df"),H=s.n(U);i["default"].prototype.moment=H.a;var I={name:"Step",mixins:[d["a"]],components:{Ingredient:w,CompileComponent:R},props:{step:Object,ingredient_factor:Number,index:Number,recipe:Object,start_time:String},data:function(){return{details_visible:!0,set_time_input:""}},mounted:function(){this.set_time_input=H()(this.start_time).add(this.step.time_offset,"minutes").format("yyyy-MM-DDTHH:mm")},methods:{calculateAmount:function(e){return Object(d["d"])(e,this.ingredient_factor)},updateTime:function(){var e=H()(this.set_time_input).add(-1*this.step.time_offset,"minutes").format("yyyy-MM-DDTHH:mm");this.$emit("update-start-time",e),this.closePopover()},closePopover:function(){this.$refs["id_reactive_popover_".concat(this.step.id)].$emit("close")},openPopover:function(){this.$refs["id_reactive_popover_".concat(this.step.id)].$emit("open")}}},A=I,L=Object(C["a"])(A,v,b,!1,null,null,null),B=L.exports,V=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("div",{staticClass:"dropdown"},[e._m(0),s("div",{staticClass:"dropdown-menu dropdown-menu-right",attrs:{"aria-labelledby":"dropdownMenuLink"}},[s("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("edit_recipe",e.recipe.id)}},[s("i",{staticClass:"fas fa-pencil-alt fa-fw"}),e._v(" "+e._s(e._("Edit")))]),e.recipe.internal?e._e():s("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("edit_convert_recipe",e.recipe.id)}},[s("i",{staticClass:"fas fa-exchange-alt fa-fw"}),e._v(" "+e._s(e._("Convert to internal recipe")))]),s("button",{staticClass:"dropdown-item",on:{click:function(t){return e.$bvModal.show("id_modal_add_book")}}},[s("i",{staticClass:"fas fa-bookmark fa-fw"}),e._v(" "+e._s(e._("Add to Book"))+" ")]),e.recipe.internal?s("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("view_shopping")+"?r=["+e.recipe.id+","+e.servings_value+"]",target:"_blank",rel:"noopener noreferrer"}},[s("i",{staticClass:"fas fa-shopping-cart fa-fw"}),e._v(" "+e._s(e._("Add to Shopping"))+" ")]):e._e(),s("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("new_meal_plan")+"?recipe="+e.recipe.id,target:"_blank",rel:"noopener noreferrer"}},[s("i",{staticClass:"fas fa-calendar fa-fw"}),e._v(" "+e._s(e._("Add to Plan"))+" ")]),s("button",{staticClass:"dropdown-item",on:{click:function(t){return e.$bvModal.show("id_modal_cook_log")}}},[s("i",{staticClass:"fas fa-clipboard-list fa-fw"}),e._v(" "+e._s(e._("Log Cooking"))+" ")]),s("button",{staticClass:"dropdown-item",attrs:{onclick:"window.print()"}},[s("i",{staticClass:"fas fa-print fa-fw"}),e._v(" "+e._s(e._("Print"))+" ")]),s("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("view_export")+"?r="+e.recipe.id,target:"_blank",rel:"noopener noreferrer"}},[s("i",{staticClass:"fas fa-file-export fa-fw"}),e._v(" "+e._s(e._("Export")))]),e.recipe.internal?s("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("new_share_link",e.recipe.id),target:"_blank",rel:"noopener noreferrer"}},[s("i",{staticClass:"fas fa-share-alt fa-fw"}),e._v(" "+e._s(e._("Share")))]):e._e()])]),s("cook-log",{attrs:{recipe:e.recipe}})],1)},F=[function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("a",{staticClass:"btn shadow-none",attrs:{href:"#",role:"button",id:"dropdownMenuLink","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"}},[s("i",{staticClass:"fas fa-ellipsis-v"})])}],q=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("b-modal",{staticClass:"modal",attrs:{id:"id_modal_cook_log",title:e._("Log Recipe Cooking"),"ok-title":e._("Save"),"cancel-title":e._("Close")},on:{ok:function(t){return e.logCook()}}},[s("p",[e._v(e._s(e._("All fields are optional and can be left empty.")))]),s("form",[s("label",{attrs:{for:"id_log_servings"}},[e._v(e._s(e._("Servings")))]),s("input",{directives:[{name:"model",rawName:"v-model",value:e.logObject.servings,expression:"logObject.servings"}],staticClass:"form-control",attrs:{type:"number",id:"id_log_servings"},domProps:{value:e.logObject.servings},on:{input:function(t){t.target.composing||e.$set(e.logObject,"servings",t.target.value)}}}),s("label",{staticStyle:{"margin-top":"2vh"}},[e._v(e._s(e._("Rating"))+" - "),s("span",{attrs:{id:"id_rating_show"}},[e._v(e._s(e.logObject.rating)+"/5")])]),s("b-form-rating",{model:{value:e.logObject.rating,callback:function(t){e.$set(e.logObject,"rating",t)},expression:"logObject.rating"}}),s("label",{staticStyle:{"margin-top":"2vh"},attrs:{for:"id_date"}},[e._v(e._s(e._("Date")))]),s("input",{directives:[{name:"model",rawName:"v-model",value:e.logObject.created_at,expression:"logObject.created_at"}],staticClass:"form-control",attrs:{type:"datetime-local",id:"id_date"},domProps:{value:e.logObject.created_at},on:{input:function(t){t.target.composing||e.$set(e.logObject,"created_at",t.target.value)}}})],1)])],1)},J=[];i["default"].prototype.moment=H.a,i["default"].use(o["a"]);var K={name:"CookLog",mixins:[d["a"]],props:{recipe:Object},data:function(){return{logObject:{recipe:this.recipe.id,servings:0,rating:0,created_at:H()().format("yyyy-MM-DDTHH:mm")}}},methods:{logCook:function(){f(this.logObject)}}},G=K,X=Object(C["a"])(G,q,J,!1,null,null,null),W=X.exports,Q={name:"RecipeContextMenu",mixins:[d["b"],d["a"]],components:{CookLog:W},data:function(){return{servings_value:0}},props:{recipe:Object,servings:{type:Number,default:-1}},mounted:function(){this.servings_value=-1===this.servings?this.recipe.servings:this.servings}},Y=Q,Z=Object(C["a"])(Y,V,F,!1,null,null,null),ee=Z.exports,te=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("iframe",{staticStyle:{border:"none"},attrs:{src:e.pdfUrl,width:"100%",height:"700px"}})])},se=[],ie={name:"PdfViewer",mixins:[d["b"]],props:{recipe:Object},computed:{pdfUrl:function(){return"/static/pdfjs/viewer.html?file="+Object(d["g"])("api_get_recipe_file",this.recipe.id)}}},ae=ie,ne=Object(C["a"])(ae,te,se,!1,null,null,null),re=ne.exports,oe=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticStyle:{"text-align":"center"}},[s("b-img",{attrs:{src:e.pdfUrl,alt:e._("External Recipe Image")}})],1)},ce=[],le={name:"ImageViewer",mixins:[d["a"]],props:{recipe:Object},computed:{pdfUrl:function(){return Object(d["g"])("api_get_recipe_file",this.recipe.id)}}},de=le,pe=Object(C["a"])(de,oe,ce,!1,null,null,null),fe=pe.exports,ue=function(){var e=this,t=e.$createElement,s=e._self._c||t;return null!==e.recipe.nutrition?s("div",[s("div",{staticClass:"card border-success"},[s("div",{staticClass:"card-body"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-12"},[s("h4",{staticClass:"card-title"},[s("i",{staticClass:"fas fa-carrot"}),e._v(" "+e._s(e._("Nutrition")))])])]),s("div",{staticClass:"row"},[s("div",{staticClass:"col-6"},[s("i",{staticClass:"fas fa-fire fa-fw text-primary"}),e._v(" "+e._s(e._("Calories"))+" ")]),s("div",{staticClass:"col-6"},[s("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.calories))}}),e._v(" kcal ")])]),s("div",{staticClass:"row"},[s("div",{staticClass:"col-6"},[s("i",{staticClass:"fas fa-bread-slice fa-fw text-primary"}),e._v(" "+e._s(e._("Carbohydrates"))+" ")]),s("div",{staticClass:"col-6"},[s("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.carbohydrates))}}),e._v(" g ")])]),s("div",{staticClass:"row"},[s("div",{staticClass:"col-6"},[s("i",{staticClass:"fas fa-cheese fa-fw text-primary"}),e._v(" "+e._s(e._("Fats"))+" ")]),s("div",{staticClass:"col-6"},[s("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.fats))}}),e._v(" g ")])]),s("div",{staticClass:"row"},[s("div",{staticClass:"col-6"},[s("i",{staticClass:"fas fa-drumstick-bite fa-fw text-primary"}),e._v(" "+e._s(e._("Proteins"))+" ")]),s("div",{staticClass:"col-6"},[s("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.proteins))}}),e._v(" g ")])])])])]):e._e()},me=[],_e={name:"Nutrition",mixins:[d["a"]],props:{recipe:Object,ingredient_factor:Number},methods:{calculateAmount:function(e){return Object(d["d"])(e,this.ingredient_factor)}}},ve=_e,be=Object(C["a"])(ve,ue,me,!1,null,null,null),ge=be.exports,he=function(){var e=this,t=e.$createElement,s=e._self._c||t;return e.recipe.keywords.length>0?s("div",e._l(e.recipe.keywords,(function(t){return s("small",{key:t.id,staticStyle:{padding:"2px"}},[e._v(" "+e._s(t.icon)+" "+e._s(t.name)+" ")])})),0):e._e()},je=[],ye={name:"Keywords",props:{recipe:Object}},Ce=ye,ke=Object(C["a"])(Ce,he,je,!1,null,null,null),we=ke.exports,xe=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},Oe=[function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"row"},[s("div",{staticClass:"col",staticStyle:{"text-align":"center"}},[s("i",{staticClass:"fas fa-spinner fa-spin fa-10x"})])])}],Se={name:"LoadingSpinner",props:{recipe:Object}},Ee=Se,Te=Object(C["a"])(Ee,xe,Oe,!1,null,null,null),$e=Te.exports,Pe=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",[s("b-modal",{staticClass:"modal",attrs:{id:"id_modal_add_book",title:e._("Add to Book"),"ok-title":e._("Add"),"cancel-title":e._("Close")},on:{ok:function(t){return e.addToBook()}}},[s("multiselect",{attrs:{options:e.books,"preserve-search":!0,placeholder:e._("Select Book"),label:"name","track-by":"id",id:"id_books",multiple:!1},on:{"search-change":e.loadBook},model:{value:e.selected_book,callback:function(t){e.selected_book=t},expression:"selected_book"}})],1)],1)},Me=[],ze=s("8e5f"),Ne=s.n(ze);i["default"].prototype.moment=H.a,i["default"].use(o["a"]);var De={name:"AddRecipeToBook",mixins:[d["a"]],components:{Multiselect:Ne.a},props:{recipe:Object},data:function(){return{books:[],selected_book:null}},mounted:function(){this.loadBook("")},methods:{loadBook:function(e){var t=this;u(e).then((function(e){t.books=e}))},addToBook:function(){m({recipe:this.recipe.id,book:this.selected_book.id})}}},Re=De,Ue=(s("60bc"),Object(C["a"])(Re,Pe,Me,!1,null,null,null)),He=Ue.exports;i["default"].prototype.moment=H.a,i["default"].use(o["a"]);var Ie={name:"RecipeView",mixins:[d["a"],d["b"],d["c"]],components:{PdfViewer:re,ImageViewer:fe,Ingredient:w,Step:B,RecipeContextMenu:ee,Nutrition:ge,Keywords:we,LoadingSpinner:$e,AddRecipeToBook:He},computed:{ingredient_factor:function(){return this.servings/this.recipe.servings}},data:function(){return{loading:!0,recipe:void 0,ingredient_count:0,servings:1,start_time:""}},mounted:function(){this.loadRecipe(window.RECIPE_ID)},methods:{loadRecipe:function(e){var t=this;p(e).then((function(e){0!==window.USER_SERVINGS&&(e.servings=window.USER_SERVINGS),t.servings=e.servings;var s,i=0,a=Object(r["a"])(e.steps);try{for(a.s();!(s=a.n()).done;){var n=s.value;t.ingredient_count+=n.ingredients.length;var o,c=Object(r["a"])(n.ingredients);try{for(c.s();!(o=c.n()).done;){var l=o.value;t.$set(l,"checked",!1)}}catch(d){c.e(d)}finally{c.f()}n.time_offset=i,i+=n.time}}catch(d){a.e(d)}finally{a.f()}i>0&&(t.start_time=H()().format("yyyy-MM-DDTHH:mm")),t.recipe=e,t.loading=!1}))},updateStartTime:function(e){this.start_time=e},updateIngredientCheckedState:function(e){var t,s=Object(r["a"])(this.recipe.steps);try{for(s.s();!(t=s.n()).done;){var i,a=t.value,n=Object(r["a"])(a.ingredients);try{for(n.s();!(i=n.n()).done;){var o=i.value;o.id===e.id&&this.$set(o,"checked",!o.checked)}}catch(c){n.e(c)}finally{n.f()}}}catch(c){s.e(c)}finally{s.f()}}}},Ae=Ie,Le=Object(C["a"])(Ae,a,n,!1,null,null,null),Be=Le.exports;i["default"].config.productionTip=!1,new i["default"]({render:function(e){return e(Be)}}).$mount("#app")},4678:function(e,t,s){var i={"./af":"2bfb","./af.js":"2bfb","./ar":"8e73","./ar-dz":"a356","./ar-dz.js":"a356","./ar-kw":"423e","./ar-kw.js":"423e","./ar-ly":"1cfd","./ar-ly.js":"1cfd","./ar-ma":"0a84","./ar-ma.js":"0a84","./ar-sa":"8230","./ar-sa.js":"8230","./ar-tn":"6d83","./ar-tn.js":"6d83","./ar.js":"8e73","./az":"485c","./az.js":"485c","./be":"1fc1","./be.js":"1fc1","./bg":"84aa","./bg.js":"84aa","./bm":"a7fa","./bm.js":"a7fa","./bn":"9043","./bn-bd":"9686","./bn-bd.js":"9686","./bn.js":"9043","./bo":"d26a","./bo.js":"d26a","./br":"6887","./br.js":"6887","./bs":"2554","./bs.js":"2554","./ca":"d716","./ca.js":"d716","./cs":"3c0d","./cs.js":"3c0d","./cv":"03ec","./cv.js":"03ec","./cy":"9797","./cy.js":"9797","./da":"0f14","./da.js":"0f14","./de":"b469","./de-at":"b3eb","./de-at.js":"b3eb","./de-ch":"bb71","./de-ch.js":"bb71","./de.js":"b469","./dv":"598a","./dv.js":"598a","./el":"8d47","./el.js":"8d47","./en-au":"0e6b","./en-au.js":"0e6b","./en-ca":"3886","./en-ca.js":"3886","./en-gb":"39a6","./en-gb.js":"39a6","./en-ie":"e1d3","./en-ie.js":"e1d3","./en-il":"7333","./en-il.js":"7333","./en-in":"ec2e","./en-in.js":"ec2e","./en-nz":"6f50","./en-nz.js":"6f50","./en-sg":"b7e9","./en-sg.js":"b7e9","./eo":"65db","./eo.js":"65db","./es":"898b","./es-do":"0a3c","./es-do.js":"0a3c","./es-mx":"b5b7","./es-mx.js":"b5b7","./es-us":"55c9","./es-us.js":"55c9","./es.js":"898b","./et":"ec18","./et.js":"ec18","./eu":"0ff2","./eu.js":"0ff2","./fa":"8df4","./fa.js":"8df4","./fi":"81e9","./fi.js":"81e9","./fil":"d69a","./fil.js":"d69a","./fo":"0721","./fo.js":"0721","./fr":"9f26","./fr-ca":"d9f8","./fr-ca.js":"d9f8","./fr-ch":"0e49","./fr-ch.js":"0e49","./fr.js":"9f26","./fy":"7118","./fy.js":"7118","./ga":"5120","./ga.js":"5120","./gd":"f6b4","./gd.js":"f6b4","./gl":"8840","./gl.js":"8840","./gom-deva":"aaf2","./gom-deva.js":"aaf2","./gom-latn":"0caa","./gom-latn.js":"0caa","./gu":"e0c5","./gu.js":"e0c5","./he":"c7aa","./he.js":"c7aa","./hi":"dc4d","./hi.js":"dc4d","./hr":"4ba9","./hr.js":"4ba9","./hu":"5b14","./hu.js":"5b14","./hy-am":"d6b6","./hy-am.js":"d6b6","./id":"5038","./id.js":"5038","./is":"0558","./is.js":"0558","./it":"6e98","./it-ch":"6f12","./it-ch.js":"6f12","./it.js":"6e98","./ja":"079e","./ja.js":"079e","./jv":"b540","./jv.js":"b540","./ka":"201b","./ka.js":"201b","./kk":"6d79","./kk.js":"6d79","./km":"e81d","./km.js":"e81d","./kn":"3e92","./kn.js":"3e92","./ko":"22f8","./ko.js":"22f8","./ku":"2421","./ku.js":"2421","./ky":"9609","./ky.js":"9609","./lb":"440c","./lb.js":"440c","./lo":"b29d","./lo.js":"b29d","./lt":"26f9","./lt.js":"26f9","./lv":"b97c","./lv.js":"b97c","./me":"293c","./me.js":"293c","./mi":"688b","./mi.js":"688b","./mk":"6909","./mk.js":"6909","./ml":"02fb","./ml.js":"02fb","./mn":"958b","./mn.js":"958b","./mr":"39bd","./mr.js":"39bd","./ms":"ebe4","./ms-my":"6403","./ms-my.js":"6403","./ms.js":"ebe4","./mt":"1b45","./mt.js":"1b45","./my":"8689","./my.js":"8689","./nb":"6ce3","./nb.js":"6ce3","./ne":"3a39","./ne.js":"3a39","./nl":"facd","./nl-be":"db29","./nl-be.js":"db29","./nl.js":"facd","./nn":"b84c","./nn.js":"b84c","./oc-lnc":"167b","./oc-lnc.js":"167b","./pa-in":"f3ff","./pa-in.js":"f3ff","./pl":"8d57","./pl.js":"8d57","./pt":"f260","./pt-br":"d2d4","./pt-br.js":"d2d4","./pt.js":"f260","./ro":"972c","./ro.js":"972c","./ru":"957c","./ru.js":"957c","./sd":"6784","./sd.js":"6784","./se":"ffff","./se.js":"ffff","./si":"eda5","./si.js":"eda5","./sk":"7be6","./sk.js":"7be6","./sl":"8155","./sl.js":"8155","./sq":"c8f3","./sq.js":"c8f3","./sr":"cf1e","./sr-cyrl":"13e9","./sr-cyrl.js":"13e9","./sr.js":"cf1e","./ss":"52bd","./ss.js":"52bd","./sv":"5fbd","./sv.js":"5fbd","./sw":"74dc","./sw.js":"74dc","./ta":"3de5","./ta.js":"3de5","./te":"5cbb","./te.js":"5cbb","./tet":"576c","./tet.js":"576c","./tg":"3b1b","./tg.js":"3b1b","./th":"10e8","./th.js":"10e8","./tk":"5aff","./tk.js":"5aff","./tl-ph":"0f38","./tl-ph.js":"0f38","./tlh":"cf755","./tlh.js":"cf755","./tr":"0e81","./tr.js":"0e81","./tzl":"cf51","./tzl.js":"cf51","./tzm":"c109","./tzm-latn":"b53d","./tzm-latn.js":"b53d","./tzm.js":"c109","./ug-cn":"6117","./ug-cn.js":"6117","./uk":"ada2","./uk.js":"ada2","./ur":"5294","./ur.js":"5294","./uz":"2e8c","./uz-latn":"010e","./uz-latn.js":"010e","./uz.js":"2e8c","./vi":"2921","./vi.js":"2921","./x-pseudo":"fd7e","./x-pseudo.js":"fd7e","./yo":"7f33","./yo.js":"7f33","./zh-cn":"5c3a","./zh-cn.js":"5c3a","./zh-hk":"49ab","./zh-hk.js":"49ab","./zh-mo":"3a6c","./zh-mo.js":"3a6c","./zh-tw":"90ea","./zh-tw.js":"90ea"};function a(e){var t=n(e);return s(t)}function n(e){if(!s.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}a.keys=function(){return Object.keys(i)},a.resolve=n,e.exports=a,a.id="4678"},fa7d:function(e,t,s){"use strict";s.d(t,"c",(function(){return n})),s.d(t,"f",(function(){return r})),s.d(t,"a",(function(){return o})),s.d(t,"e",(function(){return c})),s.d(t,"b",(function(){return l})),s.d(t,"g",(function(){return d})),s.d(t,"d",(function(){return f}));s("99af");var i=s("59e4");function a(e,t,s){var i=Math.floor(e),a=1,n=i+1,r=1;if(e!==i)while(a<=t&&r<=t){var o=(i+n)/(a+r);if(e===o){a+r<=t?(a+=r,i+=n,r=t+1):a>r?r=t+1:a=t+1;break}et&&(a=r,i=n),!s)return[0,i,a];var c=Math.floor(i/a);return[c,i-c*a,a]}var n={methods:{makeToast:function(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return r(e,t,s)}}};function r(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=new i["a"];a.$bvToast.toast(t,{title:e,variant:s,toaster:"b-toaster-top-center",solid:!0})}var o={methods:{_:function(e){return c(e)}}};function c(e){return window.gettext(e)}var l={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 f(e,t){if(p("use_fractions")){var s="",i=a(e*t,9,!0);return i[0]>0&&(s+=i[0]),i[1]>0&&(s+=" ".concat(i[1],"").concat(i[2],"")),s}return u(e*t)}function u(e){var t=p("user_fractions")?p("user_fractions"):2;return+(Math.round(e+"e+".concat(t))+"e-".concat(t))}}}); \ No newline at end of file +(function(e){function t(t){for(var s,r,c=t[0],o=t[1],l=t[2],u=0,p=[];u0?i("div",{staticClass:"col-md-6 order-md-1 col-sm-12 order-sm-2 col-12 order-2"},[i("div",{staticClass:"card border-primary"},[i("div",{staticClass:"card-body"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col col-md-8"},[i("h4",{staticClass:"card-title"},[i("i",{staticClass:"fas fa-pepper-hot"}),e._v(" "+e._s(e._("Ingredients")))])])]),i("br"),i("div",{staticClass:"row"},[i("div",{staticClass:"col-md-12"},[i("table",{staticClass:"table table-sm"},[e._l(e.recipe.steps,(function(t){return[e._l(t.ingredients,(function(t){return[i("Ingredient",{key:t.id,attrs:{ingredient:t,ingredient_factor:e.ingredient_factor},on:{"checked-state-changed":e.updateIngredientCheckedState}})]}))]}))],2)])])])])]):e._e(),i("div",{staticClass:"col-12 order-1 col-sm-12 order-sm-1 col-md-6 order-md-2"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col-12"},[null!==e.recipe.image?i("img",{staticClass:"img img-fluid rounded",staticStyle:{"max-height":"30vh"},attrs:{src:e.recipe.image,alt:e._("Recipe Image")}}):e._e()])]),i("div",{staticClass:"row",staticStyle:{"margin-top":"2vh","margin-bottom":"2vh"}},[i("div",{staticClass:"col-12"},[i("Nutrition",{attrs:{recipe:e.recipe,ingredient_factor:e.ingredient_factor}})],1)])])]),e.recipe.internal?e._e():[e.recipe.file_path.includes(".pdf")?i("div",[i("PdfViewer",{attrs:{recipe:e.recipe}})],1):e._e(),e.recipe.file_path.includes(".png")||e.recipe.file_path.includes(".jpg")||e.recipe.file_path.includes(".jpeg")||e.recipe.file_path.includes(".gif")?i("div",[i("ImageViewer",{attrs:{recipe:e.recipe}})],1):e._e()],e._l(e.recipe.steps,(function(t,s){return i("div",{key:t.id,staticStyle:{"margin-top":"1vh"}},[i("Step",{attrs:{recipe:e.recipe,step:t,ingredient_factor:e.ingredient_factor,index:s,start_time:e.start_time},on:{"update-start-time":e.updateStartTime,"checked-state-changed":e.updateIngredientCheckedState}})],1)}))],2),i("add-recipe-to-book",{attrs:{recipe:e.recipe}})],2)},n=[function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"my-auto",staticStyle:{"padding-right":"4px"}},[i("i",{staticClass:"fas fa-user-clock fa-2x text-primary"})])},function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"my-auto",staticStyle:{"padding-right":"4px"}},[i("i",{staticClass:"far fa-clock fa-2x text-primary"})])},function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"my-auto",staticStyle:{"padding-right":"4px"}},[i("i",{staticClass:"fas fa-pizza-slice fa-2x text-primary"})])}],r=i("b85c"),c=i("5f5b"),o=(i("2dd8"),i("7c15")),l=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("hr"),"TEXT"===e.step.type?[e.recipe.steps.length>1?i("div",{staticClass:"row"},[i("div",{staticClass:"col col-md-8"},[i("h5",{staticClass:"text-primary"},[e.step.name?[e._v(e._s(e.step.name))]:[e._v(e._s(e._("Step"))+" "+e._s(e.index+1))],0!==e.step.time?i("small",{staticClass:"text-muted",staticStyle:{"margin-left":"4px"}},[i("i",{staticClass:"fas fa-user-clock"}),e._v(" "+e._s(e.step.time)+" "+e._s(e._("min"))+" ")]):e._e(),""!==e.start_time?i("small",{staticClass:"d-print-none"},[i("b-link",{attrs:{id:"id_reactive_popover_"+e.step.id,href:"#"},on:{click:e.openPopover}},[e._v(" "+e._s(e.moment(e.start_time).add(e.step.time_offset,"minutes").format("HH:mm"))+" ")])],1):e._e()],2)]),i("div",{staticClass:"col col-md-4",staticStyle:{"text-align":"right"}},[i("b-button",{staticClass:"shadow-none",class:{"text-primary":e.details_visible,"text-success":!e.details_visible},staticStyle:{border:"none",background:"none"},on:{click:function(t){e.details_visible=!e.details_visible}}},[i("i",{staticClass:"far fa-check-circle"})])],1)]):e._e(),i("b-collapse",{attrs:{id:"collapse-1"},model:{value:e.details_visible,callback:function(t){e.details_visible=t},expression:"details_visible"}},[i("div",{staticClass:"row"},[e.step.ingredients.length>0&&e.recipe.steps.length>1?i("div",{staticClass:"col col-md-4"},[i("table",{staticClass:"table table-sm"},[e._l(e.step.ingredients,(function(t){return[i("Ingredient",{key:t.id,attrs:{ingredient:t,ingredient_factor:e.ingredient_factor},on:{"checked-state-changed":function(i){return e.$emit("checked-state-changed",t)}}})]}))],2)]):e._e(),i("div",{staticClass:"col",class:{"col-md-8":e.recipe.steps.length>1,"col-md-12":e.recipe.steps.length<=1}},[i("compile-component",{attrs:{code:e.step.ingredients_markdown,ingredient_factor:e.ingredient_factor}})],1)])])]:e._e(),"TIME"===e.step.type?[i("div",{staticClass:"row"},[i("div",{staticClass:"col-md-8 offset-md-2",staticStyle:{"text-align":"center"}},[i("h4",{staticClass:"text-primary"},[e.step.name?[e._v(e._s(e.step.name))]:[e._v(e._s(e._("Step"))+" "+e._s(e.index+1))]],2),0!==e.step.time?i("span",{staticClass:"text-muted",staticStyle:{"margin-left":"4px"}},[i("i",{staticClass:"fa fa-stopwatch"}),e._v(" "+e._s(e.step.time)+" "+e._s(e._("min")))]):e._e(),""!==e.start_time?i("b-link",{staticClass:"d-print-none",attrs:{id:"id_reactive_popover_"+e.step.id,href:"#"},on:{click:e.openPopover}},[e._v(" "+e._s(e.moment(e.start_time).add(e.step.time_offset,"minutes").format("HH:mm"))+" ")]):e._e()],1),i("div",{staticClass:"col-md-2",staticStyle:{"text-align":"right"}},[i("b-button",{staticClass:"shadow-none",class:{"text-primary":e.details_visible,"text-success":!e.details_visible},staticStyle:{border:"none",background:"none"},on:{click:function(t){e.details_visible=!e.details_visible}}},[i("i",{staticClass:"far fa-check-circle"})])],1)]),i("b-collapse",{attrs:{id:"collapse-1"},model:{value:e.details_visible,callback:function(t){e.details_visible=t},expression:"details_visible"}},[""!==e.step.instruction?i("div",{staticClass:"row"},[i("div",{staticClass:"col col-md-12",staticStyle:{"text-align":"center"}},[i("compile-component",{attrs:{code:e.step.ingredients_markdown,ingredient_factor:e.ingredient_factor}})],1)]):e._e()])]:e._e(),""!==e.start_time?i("div",[i("b-popover",{ref:"id_reactive_popover_"+e.step.id,attrs:{target:"id_reactive_popover_"+e.step.id,triggers:"click",placement:"bottom",title:e._("Step start time")}},[i("div",[i("b-form-group",{staticClass:"mb-1",attrs:{label:"Time","label-for":"popover-input-1","label-cols":"3"}},[i("b-form-input",{attrs:{type:"datetime-local",id:"popover-input-1",size:"sm"},model:{value:e.set_time_input,callback:function(t){e.set_time_input=t},expression:"set_time_input"}})],1)],1),i("div",{staticClass:"row",staticStyle:{"margin-top":"1vh"}},[i("div",{staticClass:"col-12",staticStyle:{"text-align":"right"}},[i("b-button",{staticStyle:{"margin-right":"8px"},attrs:{size:"sm",variant:"secondary"},on:{click:e.closePopover}},[e._v("Cancel")]),i("b-button",{attrs:{size:"sm",variant:"primary"},on:{click:e.updateTime}},[e._v("Ok")])],1)])])],1):e._e()],2)},d=[],u=(i("a9e3"),i("fa7d")),p=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("tr",{on:{click:function(t){return e.$emit("checked-state-changed",e.ingredient)}}},[e.ingredient.is_header?[i("td",{attrs:{colspan:"5"}},[i("b",[e._v(e._s(e.ingredient.note))])])]:[i("td",[e.ingredient.checked?i("i",{staticClass:"far fa-check-circle text-success"}):e._e(),e.ingredient.checked?e._e():i("i",{staticClass:"far fa-check-circle text-primary"})]),i("td",[0!==e.ingredient.amount?i("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.ingredient.amount))}}):e._e()]),i("td",[null===e.ingredient.unit||e.ingredient.no_amount?e._e():i("span",[e._v(e._s(e.ingredient.unit.name))])]),i("td",[null!==e.ingredient.food?[null!==e.ingredient.food.recipe?i("a",{attrs:{href:e.resolveDjangoUrl("view_recipe",e.ingredient.food.recipe),target:"_blank",rel:"noopener noreferrer"}},[e._v(e._s(e.ingredient.food.name))]):e._e(),null===e.ingredient.food.recipe?i("span",[e._v(e._s(e.ingredient.food.name))]):e._e()]:e._e()],2),i("td",[e.ingredient.note?i("div",[i("span",{directives:[{name:"b-popover",rawName:"v-b-popover.hover",value:e.ingredient.note,expression:"ingredient.note",modifiers:{hover:!0}}],staticClass:"d-print-none"},[i("i",{staticClass:"far fa-comment"})]),i("div",{staticClass:"d-none d-print-block"},[i("i",{staticClass:"far fa-comment-alt"}),e._v(" "+e._s(e.ingredient.note)+" ")])]):e._e()])]],2)},f=[],m={name:"Ingredient",props:{ingredient:Object,ingredient_factor:{type:Number,default:1}},mixins:[u["b"]],data:function(){return{checked:!1}},methods:{calculateAmount:function(e){return Object(u["d"])(e,this.ingredient_factor)}}},_=m,v=i("2877"),b=Object(v["a"])(_,p,f,!1,null,null,null),g=b.exports,h=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i(e.compiled,{tag:"component",attrs:{ingredient_factor:e.ingredient_factor,code:e.code}})],1)},j=[],y=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.number))}})},C=[],k={name:"ScalableNumber",props:{number:Number,factor:{type:Number,default:4}},methods:{calculateAmount:function(e){return Object(u["d"])(e,this.factor)}}},w=k,x=Object(v["a"])(w,y,C,!1,null,null,null),O=x.exports,S={name:"CompileComponent",props:["code","ingredient_factor"],data:function(){return{compiled:null}},mounted:function(){this.compiled=s["default"].component("compiled-component",{props:["ingredient_factor","code"],components:{ScalableNumber:O},template:"
".concat(this.code,"
")})}},E=S,T=Object(v["a"])(E,h,j,!1,null,null,null),$=T.exports,P=i("c1df"),M=i.n(P);s["default"].prototype.moment=M.a;var z={name:"Step",mixins:[u["a"]],components:{Ingredient:g,CompileComponent:$},props:{step:Object,ingredient_factor:Number,index:Number,recipe:Object,start_time:String},data:function(){return{details_visible:!0,set_time_input:""}},mounted:function(){this.set_time_input=M()(this.start_time).add(this.step.time_offset,"minutes").format("yyyy-MM-DDTHH:mm")},methods:{calculateAmount:function(e){return Object(u["d"])(e,this.ingredient_factor)},updateTime:function(){var e=M()(this.set_time_input).add(-1*this.step.time_offset,"minutes").format("yyyy-MM-DDTHH:mm");this.$emit("update-start-time",e),this.closePopover()},closePopover:function(){this.$refs["id_reactive_popover_".concat(this.step.id)].$emit("close")},openPopover:function(){this.$refs["id_reactive_popover_".concat(this.step.id)].$emit("open")}}},N=z,D=Object(v["a"])(N,l,d,!1,null,null,null),R=D.exports,U=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("div",{staticClass:"dropdown"},[e._m(0),i("div",{staticClass:"dropdown-menu dropdown-menu-right",attrs:{"aria-labelledby":"dropdownMenuLink"}},[i("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("edit_recipe",e.recipe.id)}},[i("i",{staticClass:"fas fa-pencil-alt fa-fw"}),e._v(" "+e._s(e._("Edit")))]),e.recipe.internal?e._e():i("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("edit_convert_recipe",e.recipe.id)}},[i("i",{staticClass:"fas fa-exchange-alt fa-fw"}),e._v(" "+e._s(e._("Convert to internal recipe")))]),i("button",{staticClass:"dropdown-item",on:{click:function(t){return e.$bvModal.show("id_modal_add_book")}}},[i("i",{staticClass:"fas fa-bookmark fa-fw"}),e._v(" "+e._s(e._("Add to Book"))+" ")]),e.recipe.internal?i("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("view_shopping")+"?r=["+e.recipe.id+","+e.servings_value+"]",target:"_blank",rel:"noopener noreferrer"}},[i("i",{staticClass:"fas fa-shopping-cart fa-fw"}),e._v(" "+e._s(e._("Add to Shopping"))+" ")]):e._e(),i("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("new_meal_plan")+"?recipe="+e.recipe.id,target:"_blank",rel:"noopener noreferrer"}},[i("i",{staticClass:"fas fa-calendar fa-fw"}),e._v(" "+e._s(e._("Add to Plan"))+" ")]),i("button",{staticClass:"dropdown-item",on:{click:function(t){return e.$bvModal.show("id_modal_cook_log")}}},[i("i",{staticClass:"fas fa-clipboard-list fa-fw"}),e._v(" "+e._s(e._("Log Cooking"))+" ")]),i("button",{staticClass:"dropdown-item",attrs:{onclick:"window.print()"}},[i("i",{staticClass:"fas fa-print fa-fw"}),e._v(" "+e._s(e._("Print"))+" ")]),i("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("view_export")+"?r="+e.recipe.id,target:"_blank",rel:"noopener noreferrer"}},[i("i",{staticClass:"fas fa-file-export fa-fw"}),e._v(" "+e._s(e._("Export")))]),e.recipe.internal?i("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("new_share_link",e.recipe.id),target:"_blank",rel:"noopener noreferrer"}},[i("i",{staticClass:"fas fa-share-alt fa-fw"}),e._v(" "+e._s(e._("Share")))]):e._e()])]),i("cook-log",{attrs:{recipe:e.recipe}})],1)},H=[function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("a",{staticClass:"btn shadow-none",attrs:{href:"#",role:"button",id:"dropdownMenuLink","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"}},[i("i",{staticClass:"fas fa-ellipsis-v"})])}],I=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("b-modal",{staticClass:"modal",attrs:{id:"id_modal_cook_log",title:e._("Log Recipe Cooking"),"ok-title":e._("Save"),"cancel-title":e._("Close")},on:{ok:function(t){return e.logCook()}}},[i("p",[e._v(e._s(e._("All fields are optional and can be left empty.")))]),i("form",[i("label",{attrs:{for:"id_log_servings"}},[e._v(e._s(e._("Servings")))]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.logObject.servings,expression:"logObject.servings"}],staticClass:"form-control",attrs:{type:"number",id:"id_log_servings"},domProps:{value:e.logObject.servings},on:{input:function(t){t.target.composing||e.$set(e.logObject,"servings",t.target.value)}}}),i("label",{staticStyle:{"margin-top":"2vh"}},[e._v(e._s(e._("Rating"))+" - "),i("span",{attrs:{id:"id_rating_show"}},[e._v(e._s(e.logObject.rating)+"/5")])]),i("b-form-rating",{model:{value:e.logObject.rating,callback:function(t){e.$set(e.logObject,"rating",t)},expression:"logObject.rating"}}),i("label",{staticStyle:{"margin-top":"2vh"},attrs:{for:"id_date"}},[e._v(e._s(e._("Date")))]),i("input",{directives:[{name:"model",rawName:"v-model",value:e.logObject.created_at,expression:"logObject.created_at"}],staticClass:"form-control",attrs:{type:"datetime-local",id:"id_date"},domProps:{value:e.logObject.created_at},on:{input:function(t){t.target.composing||e.$set(e.logObject,"created_at",t.target.value)}}})],1)])],1)},A=[];s["default"].prototype.moment=M.a,s["default"].use(c["a"]);var L={name:"CookLog",mixins:[u["a"]],props:{recipe:Object},data:function(){return{logObject:{recipe:this.recipe.id,servings:0,rating:0,created_at:M()().format("yyyy-MM-DDTHH:mm")}}},methods:{logCook:function(){Object(o["e"])(this.logObject)}}},B=L,V=Object(v["a"])(B,I,A,!1,null,null,null),F=V.exports,q={name:"RecipeContextMenu",mixins:[u["b"],u["a"]],components:{CookLog:F},data:function(){return{servings_value:0}},props:{recipe:Object,servings:{type:Number,default:-1}},mounted:function(){this.servings_value=-1===this.servings?this.recipe.servings:this.servings}},J=q,K=Object(v["a"])(J,U,H,!1,null,null,null),G=K.exports,X=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("iframe",{staticStyle:{border:"none"},attrs:{src:e.pdfUrl,width:"100%",height:"700px"}})])},W=[],Q={name:"PdfViewer",mixins:[u["b"]],props:{recipe:Object},computed:{pdfUrl:function(){return"/static/pdfjs/viewer.html?file="+Object(u["g"])("api_get_recipe_file",this.recipe.id)}}},Y=Q,Z=Object(v["a"])(Y,X,W,!1,null,null,null),ee=Z.exports,te=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticStyle:{"text-align":"center"}},[i("b-img",{attrs:{src:e.pdfUrl,alt:e._("External Recipe Image")}})],1)},ie=[],se={name:"ImageViewer",mixins:[u["a"]],props:{recipe:Object},computed:{pdfUrl:function(){return Object(u["g"])("api_get_recipe_file",this.recipe.id)}}},ae=se,ne=Object(v["a"])(ae,te,ie,!1,null,null,null),re=ne.exports,ce=function(){var e=this,t=e.$createElement,i=e._self._c||t;return null!==e.recipe.nutrition?i("div",[i("div",{staticClass:"card border-success"},[i("div",{staticClass:"card-body"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col-12"},[i("h4",{staticClass:"card-title"},[i("i",{staticClass:"fas fa-carrot"}),e._v(" "+e._s(e._("Nutrition")))])])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-fire fa-fw text-primary"}),e._v(" "+e._s(e._("Calories"))+" ")]),i("div",{staticClass:"col-6"},[i("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.calories))}}),e._v(" kcal ")])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-bread-slice fa-fw text-primary"}),e._v(" "+e._s(e._("Carbohydrates"))+" ")]),i("div",{staticClass:"col-6"},[i("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.carbohydrates))}}),e._v(" g ")])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-cheese fa-fw text-primary"}),e._v(" "+e._s(e._("Fats"))+" ")]),i("div",{staticClass:"col-6"},[i("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.fats))}}),e._v(" g ")])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-drumstick-bite fa-fw text-primary"}),e._v(" "+e._s(e._("Proteins"))+" ")]),i("div",{staticClass:"col-6"},[i("span",{domProps:{innerHTML:e._s(e.calculateAmount(e.recipe.nutrition.proteins))}}),e._v(" g ")])])])])]):e._e()},oe=[],le={name:"Nutrition",mixins:[u["a"]],props:{recipe:Object,ingredient_factor:Number},methods:{calculateAmount:function(e){return Object(u["d"])(e,this.ingredient_factor)}}},de=le,ue=Object(v["a"])(de,ce,oe,!1,null,null,null),pe=ue.exports,fe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return e.recipe.keywords.length>0?i("div",e._l(e.recipe.keywords,(function(t){return i("small",{key:t.id,staticStyle:{padding:"2px"}},[e._v(" "+e._s(t.icon)+" "+e._s(t.name)+" ")])})),0):e._e()},me=[],_e={name:"Keywords",props:{recipe:Object}},ve=_e,be=Object(v["a"])(ve,fe,me,!1,null,null,null),ge=be.exports,he=i("d76c"),je=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("b-modal",{staticClass:"modal",attrs:{id:"id_modal_add_book",title:e._("Add to Book"),"ok-title":e._("Add"),"cancel-title":e._("Close")},on:{ok:function(t){return e.addToBook()}}},[i("multiselect",{attrs:{options:e.books,"preserve-search":!0,placeholder:e._("Select Book"),label:"name","track-by":"id",id:"id_books",multiple:!1},on:{"search-change":e.loadBook},model:{value:e.selected_book,callback:function(t){e.selected_book=t},expression:"selected_book"}})],1)],1)},ye=[],Ce=i("8e5f"),ke=i.n(Ce);s["default"].prototype.moment=M.a,s["default"].use(c["a"]);var we={name:"AddRecipeToBook",mixins:[u["a"]],components:{Multiselect:ke.a},props:{recipe:Object},data:function(){return{books:[],selected_book:null}},mounted:function(){this.loadBook("")},methods:{loadBook:function(e){var t=this;Object(o["b"])(e).then((function(e){t.books=e}))},addToBook:function(){Object(o["a"])({recipe:this.recipe.id,book:this.selected_book.id})}}},xe=we,Oe=(i("60bc"),Object(v["a"])(xe,je,ye,!1,null,null,null)),Se=Oe.exports;s["default"].prototype.moment=M.a,s["default"].use(c["a"]);var Ee={name:"RecipeView",mixins:[u["a"],u["b"],u["c"]],components:{PdfViewer:ee,ImageViewer:re,Ingredient:g,Step:R,RecipeContextMenu:G,Nutrition:pe,Keywords:ge,LoadingSpinner:he["a"],AddRecipeToBook:Se},computed:{ingredient_factor:function(){return this.servings/this.recipe.servings}},data:function(){return{loading:!0,recipe:void 0,ingredient_count:0,servings:1,start_time:""}},mounted:function(){this.loadRecipe(window.RECIPE_ID)},methods:{loadRecipe:function(e){var t=this;Object(o["d"])(e).then((function(e){0!==window.USER_SERVINGS&&(e.servings=window.USER_SERVINGS),t.servings=e.servings;var i,s=0,a=Object(r["a"])(e.steps);try{for(a.s();!(i=a.n()).done;){var n=i.value;t.ingredient_count+=n.ingredients.length;var c,o=Object(r["a"])(n.ingredients);try{for(o.s();!(c=o.n()).done;){var l=c.value;t.$set(l,"checked",!1)}}catch(d){o.e(d)}finally{o.f()}n.time_offset=s,s+=n.time}}catch(d){a.e(d)}finally{a.f()}s>0&&(t.start_time=M()().format("yyyy-MM-DDTHH:mm")),t.recipe=e,t.loading=!1}))},updateStartTime:function(e){this.start_time=e},updateIngredientCheckedState:function(e){var t,i=Object(r["a"])(this.recipe.steps);try{for(i.s();!(t=i.n()).done;){var s,a=t.value,n=Object(r["a"])(a.ingredients);try{for(n.s();!(s=n.n()).done;){var c=s.value;c.id===e.id&&this.$set(c,"checked",!c.checked)}}catch(o){n.e(o)}finally{n.f()}}}catch(o){i.e(o)}finally{i.f()}}}},Te=Ee,$e=Object(v["a"])(Te,a,n,!1,null,null,null),Pe=$e.exports;s["default"].config.productionTip=!1,new s["default"]({render:function(e){return e(Pe)}}).$mount("#app")},4678:function(e,t,i){var s={"./af":"2bfb","./af.js":"2bfb","./ar":"8e73","./ar-dz":"a356","./ar-dz.js":"a356","./ar-kw":"423e","./ar-kw.js":"423e","./ar-ly":"1cfd","./ar-ly.js":"1cfd","./ar-ma":"0a84","./ar-ma.js":"0a84","./ar-sa":"8230","./ar-sa.js":"8230","./ar-tn":"6d83","./ar-tn.js":"6d83","./ar.js":"8e73","./az":"485c","./az.js":"485c","./be":"1fc1","./be.js":"1fc1","./bg":"84aa","./bg.js":"84aa","./bm":"a7fa","./bm.js":"a7fa","./bn":"9043","./bn-bd":"9686","./bn-bd.js":"9686","./bn.js":"9043","./bo":"d26a","./bo.js":"d26a","./br":"6887","./br.js":"6887","./bs":"2554","./bs.js":"2554","./ca":"d716","./ca.js":"d716","./cs":"3c0d","./cs.js":"3c0d","./cv":"03ec","./cv.js":"03ec","./cy":"9797","./cy.js":"9797","./da":"0f14","./da.js":"0f14","./de":"b469","./de-at":"b3eb","./de-at.js":"b3eb","./de-ch":"bb71","./de-ch.js":"bb71","./de.js":"b469","./dv":"598a","./dv.js":"598a","./el":"8d47","./el.js":"8d47","./en-au":"0e6b","./en-au.js":"0e6b","./en-ca":"3886","./en-ca.js":"3886","./en-gb":"39a6","./en-gb.js":"39a6","./en-ie":"e1d3","./en-ie.js":"e1d3","./en-il":"7333","./en-il.js":"7333","./en-in":"ec2e","./en-in.js":"ec2e","./en-nz":"6f50","./en-nz.js":"6f50","./en-sg":"b7e9","./en-sg.js":"b7e9","./eo":"65db","./eo.js":"65db","./es":"898b","./es-do":"0a3c","./es-do.js":"0a3c","./es-mx":"b5b7","./es-mx.js":"b5b7","./es-us":"55c9","./es-us.js":"55c9","./es.js":"898b","./et":"ec18","./et.js":"ec18","./eu":"0ff2","./eu.js":"0ff2","./fa":"8df4","./fa.js":"8df4","./fi":"81e9","./fi.js":"81e9","./fil":"d69a","./fil.js":"d69a","./fo":"0721","./fo.js":"0721","./fr":"9f26","./fr-ca":"d9f8","./fr-ca.js":"d9f8","./fr-ch":"0e49","./fr-ch.js":"0e49","./fr.js":"9f26","./fy":"7118","./fy.js":"7118","./ga":"5120","./ga.js":"5120","./gd":"f6b4","./gd.js":"f6b4","./gl":"8840","./gl.js":"8840","./gom-deva":"aaf2","./gom-deva.js":"aaf2","./gom-latn":"0caa","./gom-latn.js":"0caa","./gu":"e0c5","./gu.js":"e0c5","./he":"c7aa","./he.js":"c7aa","./hi":"dc4d","./hi.js":"dc4d","./hr":"4ba9","./hr.js":"4ba9","./hu":"5b14","./hu.js":"5b14","./hy-am":"d6b6","./hy-am.js":"d6b6","./id":"5038","./id.js":"5038","./is":"0558","./is.js":"0558","./it":"6e98","./it-ch":"6f12","./it-ch.js":"6f12","./it.js":"6e98","./ja":"079e","./ja.js":"079e","./jv":"b540","./jv.js":"b540","./ka":"201b","./ka.js":"201b","./kk":"6d79","./kk.js":"6d79","./km":"e81d","./km.js":"e81d","./kn":"3e92","./kn.js":"3e92","./ko":"22f8","./ko.js":"22f8","./ku":"2421","./ku.js":"2421","./ky":"9609","./ky.js":"9609","./lb":"440c","./lb.js":"440c","./lo":"b29d","./lo.js":"b29d","./lt":"26f9","./lt.js":"26f9","./lv":"b97c","./lv.js":"b97c","./me":"293c","./me.js":"293c","./mi":"688b","./mi.js":"688b","./mk":"6909","./mk.js":"6909","./ml":"02fb","./ml.js":"02fb","./mn":"958b","./mn.js":"958b","./mr":"39bd","./mr.js":"39bd","./ms":"ebe4","./ms-my":"6403","./ms-my.js":"6403","./ms.js":"ebe4","./mt":"1b45","./mt.js":"1b45","./my":"8689","./my.js":"8689","./nb":"6ce3","./nb.js":"6ce3","./ne":"3a39","./ne.js":"3a39","./nl":"facd","./nl-be":"db29","./nl-be.js":"db29","./nl.js":"facd","./nn":"b84c","./nn.js":"b84c","./oc-lnc":"167b","./oc-lnc.js":"167b","./pa-in":"f3ff","./pa-in.js":"f3ff","./pl":"8d57","./pl.js":"8d57","./pt":"f260","./pt-br":"d2d4","./pt-br.js":"d2d4","./pt.js":"f260","./ro":"972c","./ro.js":"972c","./ru":"957c","./ru.js":"957c","./sd":"6784","./sd.js":"6784","./se":"ffff","./se.js":"ffff","./si":"eda5","./si.js":"eda5","./sk":"7be6","./sk.js":"7be6","./sl":"8155","./sl.js":"8155","./sq":"c8f3","./sq.js":"c8f3","./sr":"cf1e","./sr-cyrl":"13e9","./sr-cyrl.js":"13e9","./sr.js":"cf1e","./ss":"52bd","./ss.js":"52bd","./sv":"5fbd","./sv.js":"5fbd","./sw":"74dc","./sw.js":"74dc","./ta":"3de5","./ta.js":"3de5","./te":"5cbb","./te.js":"5cbb","./tet":"576c","./tet.js":"576c","./tg":"3b1b","./tg.js":"3b1b","./th":"10e8","./th.js":"10e8","./tk":"5aff","./tk.js":"5aff","./tl-ph":"0f38","./tl-ph.js":"0f38","./tlh":"cf755","./tlh.js":"cf755","./tr":"0e81","./tr.js":"0e81","./tzl":"cf51","./tzl.js":"cf51","./tzm":"c109","./tzm-latn":"b53d","./tzm-latn.js":"b53d","./tzm.js":"c109","./ug-cn":"6117","./ug-cn.js":"6117","./uk":"ada2","./uk.js":"ada2","./ur":"5294","./ur.js":"5294","./uz":"2e8c","./uz-latn":"010e","./uz-latn.js":"010e","./uz.js":"2e8c","./vi":"2921","./vi.js":"2921","./x-pseudo":"fd7e","./x-pseudo.js":"fd7e","./yo":"7f33","./yo.js":"7f33","./zh-cn":"5c3a","./zh-cn.js":"5c3a","./zh-hk":"49ab","./zh-hk.js":"49ab","./zh-mo":"3a6c","./zh-mo.js":"3a6c","./zh-tw":"90ea","./zh-tw.js":"90ea"};function a(e){var t=n(e);return i(t)}function n(e){if(!i.o(s,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return s[e]}a.keys=function(){return Object.keys(s)},a.resolve=n,e.exports=a,a.id="4678"},"7c15":function(e,t,i){"use strict";i.d(t,"d",(function(){return r})),i.d(t,"c",(function(){return c})),i.d(t,"e",(function(){return o})),i.d(t,"b",(function(){return l})),i.d(t,"a",(function(){return d}));var s=i("bc3a"),a=i.n(s),n=i("fa7d");function r(e){var t=Object(n["g"])("api:recipe-detail",e);return void 0!==window.SHARE_UID&&(t+="?share="+window.SHARE_UID),a.a.get(t).then((function(e){return e.data})).catch((function(e){u(e,"There was an error loading a resource!","danger")}))}function c(e){var t=Object(n["g"])("api:importlog-detail",e);return a.a.get(t).then((function(e){return e.data})).catch((function(e){u(e,"There was an error loading a resource!","danger")}))}function o(e){return a.a.post(Object(n["g"])("api:cooklog-list"),e).then((function(e){Object(n["f"])("Saved","Cook Log entry saved!","success")})).catch((function(e){u(e,"There was an error creating a resource!","danger")}))}function l(e){return a.a.get(Object(n["g"])("api:recipebook-list")+"?query="+e).then((function(e){return e.data})).catch((function(e){u(e,"There was an error creating a resource!","danger")}))}function d(e){return a.a.post(Object(n["g"])("api:recipebookentry-list"),e).then((function(e){Object(n["f"])("Saved","Recipe Book entry saved!","success")})).catch((function(e){u(e,"There was an error creating a resource!","danger")}))}function u(e,t){if("response"in e){console.log(e.response);var i="statusText"in e.response?e.response.statusText:Object(n["e"])("Error");t+="\n\n"+JSON.stringify(e.response.data),Object(n["f"])(i,t,"danger")}else Object(n["f"])("Error",t,"danger"),console.log(e)}a.a.defaults.xsrfCookieName="csrftoken",a.a.defaults.xsrfHeaderName="X-CSRFTOKEN"},d76c:function(e,t,i){"use strict";var s=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},a=[function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"row"},[i("div",{staticClass:"col",staticStyle:{"text-align":"center"}},[i("i",{staticClass:"fas fa-spinner fa-spin fa-10x"})])])}],n={name:"LoadingSpinner",props:{recipe:Object}},r=n,c=i("2877"),o=Object(c["a"])(r,s,a,!1,null,null,null);t["a"]=o.exports},fa7d:function(e,t,i){"use strict";i.d(t,"c",(function(){return n})),i.d(t,"f",(function(){return r})),i.d(t,"a",(function(){return c})),i.d(t,"e",(function(){return o})),i.d(t,"b",(function(){return l})),i.d(t,"g",(function(){return d})),i.d(t,"d",(function(){return p}));i("99af");var s=i("59e4");function a(e,t,i){var s=Math.floor(e),a=1,n=s+1,r=1;if(e!==s)while(a<=t&&r<=t){var c=(s+n)/(a+r);if(e===c){a+r<=t?(a+=r,s+=n,r=t+1):a>r?r=t+1:a=t+1;break}et&&(a=r,s=n),!i)return[0,s,a];var o=Math.floor(s/a);return[o,s-o*a,a]}var n={methods:{makeToast:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return r(e,t,i)}}};function r(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=new s["a"];a.$bvToast.toast(t,{title:e,variant:i,toaster:"b-toaster-top-center",solid:!0})}var c={methods:{_:function(e){return o(e)}}};function o(e){return window.gettext(e)}var l={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 u(e){return window.USER_PREF[e]}function p(e,t){if(u("use_fractions")){var i="",s=a(e*t,9,!0);return s[0]>0&&(i+=s[0]),s[1]>0&&(i+=" ".concat(s[1],"").concat(s[2],"")),i}return f(e*t)}function f(e){var t=u("user_fractions")?u("user_fractions"):2;return+(Math.round(e+"e+".concat(t))+"e-".concat(t))}}}); \ No newline at end of file diff --git a/cookbook/templates/import_response.html b/cookbook/templates/import_response.html new file mode 100644 index 00000000..e47ef734 --- /dev/null +++ b/cookbook/templates/import_response.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} +{% load render_bundle from webpack_loader %} +{% load static %} +{% load i18n %} +{% load l10n %} + +{% block title %}{% trans 'Import' %}{% endblock %} + +{% block content %} + +
+ +
+ + +{% endblock %} + + +{% block script %} + + + {% if debug %} + + {% else %} + + {% endif %} + + + + {% render_bundle 'chunk-vendors' %} + {% render_bundle 'import_response_view' %} +{% endblock %} \ No newline at end of file diff --git a/cookbook/templates/sw.js b/cookbook/templates/sw.js index 5924313c..af71bd4b 100644 --- a/cookbook/templates/sw.js +++ b/cookbook/templates/sw.js @@ -1 +1 @@ -(function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="249e")})({"00ee":function(t,e,n){var r=n("b622"),o=r("toStringTag"),i={};i[o]="z",t.exports="[object z]"===String(i)},"06cf":function(t,e,n){var r=n("83ab"),o=n("d1e7"),i=n("5c6c"),a=n("fc6a"),c=n("c04e"),s=n("5135"),u=n("0cfb"),l=Object.getOwnPropertyDescriptor;e.f=r?l:function(t,e){if(t=a(t),e=c(e,!0),u)try{return l(t,e)}catch(n){}if(s(t,e))return i(!o.f.call(t,e),t[e])}},"0cfb":function(t,e,n){var r=n("83ab"),o=n("d039"),i=n("cc12");t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},"14c3":function(t,e,n){var r=n("c6b6"),o=n("9263");t.exports=function(t,e){var n=t.exec;if("function"===typeof n){var i=n.call(t,e);if("object"!==typeof i)throw TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(t))throw TypeError("RegExp#exec called on incompatible receiver");return o.call(t,e)}},"1d80":function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},"23cb":function(t,e,n){var r=n("a691"),o=Math.max,i=Math.min;t.exports=function(t,e){var n=r(t);return n<0?o(n+e,0):i(n,e)}},"23e7":function(t,e,n){var r=n("da84"),o=n("06cf").f,i=n("9112"),a=n("6eeb"),c=n("ce4e"),s=n("e893"),u=n("94ca");t.exports=function(t,e){var n,l,f,h,p,d,g=t.target,y=t.global,m=t.stat;if(l=y?r:m?r[g]||c(g,{}):(r[g]||{}).prototype,l)for(f in e){if(p=e[f],t.noTargetGet?(d=o(l,f),h=d&&d.value):h=l[f],n=u(y?f:g+(m?".":"#")+f,t.forced),!n&&void 0!==h){if(typeof p===typeof h)continue;s(p,h)}(t.sham||h&&h.sham)&&i(p,"sham",!0),a(l,f,p,t)}}},"241c":function(t,e,n){var r=n("ca84"),o=n("7839"),i=o.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},"249e":function(t,e,n){"use strict";n.r(e);n("d3b7");function r(t,e,n,r,o,i,a){try{var c=t[i](a),s=c.value}catch(u){return void n(u)}c.done?e(s):Promise.resolve(s).then(r,o)}function o(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,s,"next",t)}function s(t){r(a,o,i,c,s,"throw",t)}c(void 0)}))}}n("466d"),n("ac1f"),n("4d63"),n("25f0"),n("96cf"),n("40b9");const i=(t,...e)=>{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},a=i;class c extends Error{constructor(t,e){const n=a(t,e);super(n),this.name=t,this.details=e}}const s={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!==typeof registration?registration.scope:""},u=t=>[s.prefix,t,s.suffix].filter(t=>t&&t.length>0).join("-"),l=t=>{for(const e of Object.keys(s))t(e)},f={updateDetails:t=>{l(e=>{"string"===typeof t[e]&&(s[e]=t[e])})},getGoogleAnalyticsName:t=>t||u(s.googleAnalytics),getPrecacheName:t=>t||u(s.precache),getPrefix:()=>s.prefix,getRuntimeName:t=>t||u(s.runtime),getSuffix:()=>s.suffix};n("c700");let h;function p(){if(void 0===h){const e=new Response("");if("body"in e)try{new Response(e.body),h=!0}catch(t){h=!1}h=!1}return h}async function d(t,e){let n=null;if(t.url){const e=new URL(t.url);n=e.origin}if(n!==self.location.origin)throw new c("cross-origin-copy-response",{origin:n});const r=t.clone(),o={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},i=e?e(o):o,a=p()?r.body:await r.blob();return new Response(a,i)}n("741b");const g={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!==typeof registration?registration.scope:""},y=t=>[g.prefix,t,g.suffix].filter(t=>t&&t.length>0).join("-"),m=t=>{for(const e of Object.keys(g))t(e)},v={updateDetails:t=>{m(e=>{"string"===typeof t[e]&&(g[e]=t[e])})},getGoogleAnalyticsName:t=>t||y(g.googleAnalytics),getPrecacheName:t=>t||y(g.precache),getPrefix:()=>g.prefix,getRuntimeName:t=>t||y(g.runtime),getSuffix:()=>g.suffix},w=(t,...e)=>{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},x=w;class b extends Error{constructor(t,e){const n=x(t,e);super(n),this.name=t,this.details=e}}const _=t=>{const e=new URL(String(t),location.href);return e.href.replace(new RegExp("^"+location.origin),"")};function E(t,e){const n=new URL(t);for(const r of e)n.searchParams.delete(r);return n.href}async function R(t,e,n,r){const o=E(e.url,n);if(e.url===o)return t.match(e,r);const i={...r,ignoreSearch:!0},a=await t.keys(e,i);for(const c of a){const e=E(c.url,n);if(o===e)return t.match(c,r)}}class S{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}const O=new Set;async function P(){for(const t of O)await t()}function N(t){return new Promise(e=>setTimeout(e,t))}n("6aa8");function k(t){return"string"===typeof t?new Request(t):t}class j{constructor(t,e){this._cacheKeys={},Object.assign(this,e),this.event=e.event,this._strategy=t,this._handlerDeferred=new S,this._extendLifetimePromises=[],this._plugins=[...t.plugins],this._pluginStateMap=new Map;for(const n of this._plugins)this._pluginStateMap.set(n,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(t){const{event:e}=this;let n=k(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const r=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(i){throw new b("plugin-error-request-will-fetch",{thrownError:i})}const o=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this._strategy.fetchOptions);for(const n of this.iterateCallbacks("fetchDidSucceed"))t=await n({event:e,request:o,response:t});return t}catch(a){throw r&&await this.runCallbacks("fetchDidFail",{error:a,event:e,originalRequest:r.clone(),request:o.clone()}),a}}async fetchAndCachePut(t){const e=await this.fetch(t),n=e.clone();return this.waitUntil(this.cachePut(t,n)),e}async cacheMatch(t){const e=k(t);let n;const{cacheName:r,matchOptions:o}=this._strategy,i=await this.getCacheKey(e,"read"),a={...o,cacheName:r};n=await caches.match(i,a);for(const c of this.iterateCallbacks("cachedResponseWillBeUsed"))n=await c({cacheName:r,matchOptions:o,cachedResponse:n,request:i,event:this.event})||void 0;return n}async cachePut(t,e){const n=k(t);await N(0);const r=await this.getCacheKey(n,"write");if(!e)throw new b("cache-put-with-no-response",{url:_(r.url)});const o=await this._ensureResponseSafeToCache(e);if(!o)return!1;const{cacheName:i,matchOptions:a}=this._strategy,c=await self.caches.open(i),s=this.hasCallback("cacheDidUpdate"),u=s?await R(c,r.clone(),["__WB_REVISION__"],a):null;try{await c.put(r,s?o.clone():o)}catch(l){throw"QuotaExceededError"===l.name&&await P(),l}for(const f of this.iterateCallbacks("cacheDidUpdate"))await f({cacheName:i,oldResponse:u,newResponse:o.clone(),request:r,event:this.event});return!0}async getCacheKey(t,e){if(!this._cacheKeys[e]){let n=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))n=k(await t({mode:e,request:n,event:this.event,params:this.params}));this._cacheKeys[e]=n}return this._cacheKeys[e]}hasCallback(t){for(const e of this._strategy.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const n of this.iterateCallbacks(t))await n(e)}*iterateCallbacks(t){for(const e of this._strategy.plugins)if("function"===typeof e[t]){const n=this._pluginStateMap.get(e),r=r=>{const o={...r,state:n};return e[t](o)};yield r}}waitUntil(t){return this._extendLifetimePromises.push(t),t}async doneWaiting(){let t;while(t=this._extendLifetimePromises.shift())await t}destroy(){this._handlerDeferred.resolve()}async _ensureResponseSafeToCache(t){let e=t,n=!1;for(const r of this.iterateCallbacks("cacheWillUpdate"))if(e=await r({request:this.request,response:e,event:this.event})||void 0,n=!0,!e)break;return n||e&&200!==e.status&&(e=void 0),e}}class T{constructor(t={}){this.cacheName=v.getRuntimeName(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,n="string"===typeof t.request?new Request(t.request):t.request,r="params"in t?t.params:void 0,o=new j(this,{event:e,request:n,params:r}),i=this._getResponse(o,n,e),a=this._awaitComplete(i,o,n,e);return[i,a]}async _getResponse(t,e,n){await t.runCallbacks("handlerWillStart",{event:n,request:e});let r=void 0;try{if(r=await this._handle(e,t),!r||"error"===r.type)throw new b("no-response",{url:e.url})}catch(o){for(const i of t.iterateCallbacks("handlerDidError"))if(r=await i({error:o,event:n,request:e}),r)break;if(!r)throw o}for(const i of t.iterateCallbacks("handlerWillRespond"))r=await i({event:n,request:e,response:r});return r}async _awaitComplete(t,e,n,r){let o,i;try{o=await t}catch(i){}try{await e.runCallbacks("handlerDidRespond",{event:r,request:n,response:o}),await e.doneWaiting()}catch(a){i=a}if(await e.runCallbacks("handlerDidComplete",{event:r,request:n,response:o,error:i}),e.destroy(),i)throw i}}class C extends T{constructor(t={}){t.cacheName=f.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=!1!==t.fallbackToNetwork,this.plugins.push(C.copyRedirectedCacheableResponsesPlugin)}async _handle(t,e){const n=await e.cacheMatch(t);return n||(e.event&&"install"===e.event.type?await this._handleInstall(t,e):await this._handleFetch(t,e))}async _handleFetch(t,e){let n;if(!this._fallbackToNetwork)throw new c("missing-precache-entry",{cacheName:this.cacheName,url:t.url});return n=await e.fetch(t),n}async _handleInstall(t,e){this._useDefaultCacheabilityPluginIfNeeded();const n=await e.fetch(t),r=await e.cachePut(t,n.clone());if(!r)throw new c("bad-precaching-response",{url:t.url,status:n.status});return n}_useDefaultCacheabilityPluginIfNeeded(){let t=null,e=0;for(const[n,r]of this.plugins.entries())r!==C.copyRedirectedCacheableResponsesPlugin&&(r===C.defaultPrecacheCacheabilityPlugin&&(t=n),r.cacheWillUpdate&&e++);0===e?this.plugins.push(C.defaultPrecacheCacheabilityPlugin):e>1&&null!==t&&this.plugins.splice(t,1)}}C.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:t}){return!t||t.status>=400?null:t}},C.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:t}){return t.redirected?await d(t):t}};n("95a8");const A=(t,...e)=>{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},q=A;class L extends Error{constructor(t,e){const n=q(t,e);super(n),this.name=t,this.details=e}}n("e6d2");const M="GET",U=t=>t&&"object"===typeof t?t:{handle:t};class I{constructor(t,e,n=M){this.handler=U(e),this.match=t,this.method=n}setCatchHandler(t){this.catchHandler=U(t)}}class D extends I{constructor(t,e,n){const r=({url:e})=>{const n=t.exec(e.href);if(n&&(e.origin===location.origin||0===n.index))return n.slice(1)};super(r,e,n)}}class F{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",t=>{const{request:e}=t,n=this.handleRequest({request:e,event:t});n&&t.respondWith(n)})}addCacheListener(){self.addEventListener("message",t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data;0;const n=Promise.all(e.urlsToCache.map(e=>{"string"===typeof e&&(e=[e]);const n=new Request(...e);return this.handleRequest({request:n,event:t})}));t.waitUntil(n),t.ports&&t.ports[0]&&n.then(()=>t.ports[0].postMessage(!0))}})}handleRequest({request:t,event:e}){const n=new URL(t.url,location.href);if(!n.protocol.startsWith("http"))return void 0;const r=n.origin===location.origin,{params:o,route:i}=this.findMatchingRoute({event:e,request:t,sameOrigin:r,url:n});let a=i&&i.handler;const c=t.method;if(!a&&this._defaultHandlerMap.has(c)&&(a=this._defaultHandlerMap.get(c)),!a)return void 0;let s;try{s=a.handle({url:n,request:t,event:e,params:o})}catch(l){s=Promise.reject(l)}const u=i&&i.catchHandler;return s instanceof Promise&&(this._catchHandler||u)&&(s=s.catch(async r=>{if(u){0;try{return await u.handle({url:n,request:t,event:e,params:o})}catch(i){r=i}}if(this._catchHandler)return this._catchHandler.handle({url:n,request:t,event:e});throw r})),s}findMatchingRoute({url:t,sameOrigin:e,request:n,event:r}){const o=this._routes.get(n.method)||[];for(const i of o){let o;const a=i.match({url:t,sameOrigin:e,request:n,event:r});if(a)return o=a,(Array.isArray(a)&&0===a.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"===typeof a)&&(o=void 0),{route:i,params:o}}return{}}setDefaultHandler(t,e=M){this._defaultHandlerMap.set(e,U(t))}setCatchHandler(t){this._catchHandler=U(t)}registerRoute(t){this._routes.has(t.method)||this._routes.set(t.method,[]),this._routes.get(t.method).push(t)}unregisterRoute(t){if(!this._routes.has(t.method))throw new L("unregister-route-but-not-found-with-method",{method:t.method});const e=this._routes.get(t.method).indexOf(t);if(!(e>-1))throw new L("unregister-route-route-not-registered");this._routes.get(t.method).splice(e,1)}}let W;const H=()=>(W||(W=new F,W.addFetchListener(),W.addCacheListener()),W);function K(t,e,n){let r;if("string"===typeof t){const o=new URL(t,location.href);0;const i=({url:t})=>t.href===o.href;r=new I(i,e,n)}else if(t instanceof RegExp)r=new D(t,e,n);else if("function"===typeof t)r=new I(t,e,n);else{if(!(t instanceof I))throw new L("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});r=t}const o=H();return o.registerRoute(r),r}function G(t){const e=H();e.setCatchHandler(t)}class B extends T{async _handle(t,e){let n,r=await e.cacheMatch(t);if(r)0;else{0;try{r=await e.fetchAndCachePut(t)}catch(o){n=o}0}if(!r)throw new b("no-response",{url:t.url,error:n});return r}}const Y={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};class $ extends T{constructor(t={}){super(t),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(Y),this._networkTimeoutSeconds=t.networkTimeoutSeconds||0}async _handle(t,e){const n=[];const r=[];let o;if(this._networkTimeoutSeconds){const{id:i,promise:a}=this._getTimeoutPromise({request:t,logs:n,handler:e});o=i,r.push(a)}const i=this._getNetworkPromise({timeoutId:o,request:t,logs:n,handler:e});r.push(i);const a=await e.waitUntil((async()=>await e.waitUntil(Promise.race(r))||await i)());if(!a)throw new b("no-response",{url:t.url});return a}_getTimeoutPromise({request:t,logs:e,handler:n}){let r;const o=new Promise(e=>{const o=async()=>{e(await n.cacheMatch(t))};r=setTimeout(o,1e3*this._networkTimeoutSeconds)});return{promise:o,id:r}}async _getNetworkPromise({timeoutId:t,request:e,logs:n,handler:r}){let o,i;try{i=await r.fetchAndCachePut(e)}catch(a){o=a}return t&&clearTimeout(t),!o&&i||(i=await r.cacheMatch(e)),i}}class z extends T{constructor(t){super(t),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(Y)}async _handle(t,e){const n=e.fetchAndCachePut(t).catch(()=>{});let r,o=await e.cacheMatch(t);if(o)0;else{0;try{o=await n}catch(i){r=i}}if(!o)throw new b("no-response",{url:t.url,error:r});return o}}n("d2e2");const J=(t,...e)=>{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},Q=J;class V extends Error{constructor(t,e){const n=Q(t,e);super(n),this.name=t,this.details=e}}function X(t){t.then(()=>{})}class Z{constructor(t,e,{onupgradeneeded:n,onversionchange:r}={}){this._db=null,this._name=t,this._version=e,this._onupgradeneeded=n,this._onversionchange=r||(()=>this.close())}get db(){return this._db}async open(){if(!this._db)return this._db=await new Promise((t,e)=>{let n=!1;setTimeout(()=>{n=!0,e(new Error("The open request was blocked and timed out"))},this.OPEN_TIMEOUT);const r=indexedDB.open(this._name,this._version);r.onerror=()=>e(r.error),r.onupgradeneeded=t=>{n?(r.transaction.abort(),r.result.close()):"function"===typeof this._onupgradeneeded&&this._onupgradeneeded(t)},r.onsuccess=()=>{const e=r.result;n?e.close():(e.onversionchange=this._onversionchange.bind(this),t(e))}}),this}async getKey(t,e){return(await this.getAllKeys(t,e,1))[0]}async getAll(t,e,n){return await this.getAllMatching(t,{query:e,count:n})}async getAllKeys(t,e,n){const r=await this.getAllMatching(t,{query:e,count:n,includeKeys:!0});return r.map(t=>t.key)}async getAllMatching(t,{index:e,query:n=null,direction:r="next",count:o,includeKeys:i=!1}={}){return await this.transaction([t],"readonly",(a,c)=>{const s=a.objectStore(t),u=e?s.index(e):s,l=[],f=u.openCursor(n,r);f.onsuccess=()=>{const t=f.result;t?(l.push(i?t:t.value),o&&l.length>=o?c(l):t.continue()):c(l)}})}async transaction(t,e,n){return await this.open(),await new Promise((r,o)=>{const i=this._db.transaction(t,e);i.onabort=()=>o(i.error),i.oncomplete=()=>r(),n(i,t=>r(t))})}async _call(t,e,n,...r){const o=(n,o)=>{const i=n.objectStore(e),a=i[t].apply(i,r);a.onsuccess=()=>o(a.result)};return await this.transaction([e],n,o)}close(){this._db&&(this._db.close(),this._db=null)}}Z.prototype.OPEN_TIMEOUT=2e3;const tt={readonly:["get","count","getKey","getAll","getAllKeys"],readwrite:["add","put","clear","delete"]};for(const[yt,mt]of Object.entries(tt))for(const t of mt)t in IDBObjectStore.prototype&&(Z.prototype[t]=async function(e,...n){return await this._call(t,e,yt,...n)});const et=async t=>{await new Promise((e,n)=>{const r=indexedDB.deleteDatabase(t);r.onerror=()=>{n(r.error)},r.onblocked=()=>{n(new Error("Delete blocked"))},r.onsuccess=()=>{e()}})};n("d8a5");const nt="workbox-expiration",rt="cache-entries",ot=t=>{const e=new URL(t,location.href);return e.hash="",e.href};class it{constructor(t){this._cacheName=t,this._db=new Z(nt,1,{onupgradeneeded:t=>this._handleUpgrade(t)})}_handleUpgrade(t){const e=t.target.result,n=e.createObjectStore(rt,{keyPath:"id"});n.createIndex("cacheName","cacheName",{unique:!1}),n.createIndex("timestamp","timestamp",{unique:!1}),et(this._cacheName)}async setTimestamp(t,e){t=ot(t);const n={url:t,timestamp:e,cacheName:this._cacheName,id:this._getId(t)};await this._db.put(rt,n)}async getTimestamp(t){const e=await this._db.get(rt,this._getId(t));return e.timestamp}async expireEntries(t,e){const n=await this._db.transaction(rt,"readwrite",(n,r)=>{const o=n.objectStore(rt),i=o.index("timestamp").openCursor(null,"prev"),a=[];let c=0;i.onsuccess=()=>{const n=i.result;if(n){const r=n.value;r.cacheName===this._cacheName&&(t&&r.timestamp=e?a.push(n.value):c++),n.continue()}else r(a)}}),r=[];for(const o of n)await this._db.delete(rt,o.id),r.push(o.url);return r}_getId(t){return this._cacheName+"|"+ot(t)}}class at{constructor(t,e={}){this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=e.maxEntries,this._maxAgeSeconds=e.maxAgeSeconds,this._matchOptions=e.matchOptions,this._cacheName=t,this._timestampModel=new it(t)}async expireEntries(){if(this._isRunning)return void(this._rerunRequested=!0);this._isRunning=!0;const t=this._maxAgeSeconds?Date.now()-1e3*this._maxAgeSeconds:0,e=await this._timestampModel.expireEntries(t,this._maxEntries),n=await self.caches.open(this._cacheName);for(const r of e)await n.delete(r,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,X(this.expireEntries()))}async updateTimestamp(t){await this._timestampModel.setTimestamp(t,Date.now())}async isURLExpired(t){if(this._maxAgeSeconds){const e=await this._timestampModel.getTimestamp(t),n=Date.now()-1e3*this._maxAgeSeconds;return e[ct.prefix,t,ct.suffix].filter(t=>t&&t.length>0).join("-"),ut=t=>{for(const e of Object.keys(ct))t(e)},lt={updateDetails:t=>{ut(e=>{"string"===typeof t[e]&&(ct[e]=t[e])})},getGoogleAnalyticsName:t=>t||st(ct.googleAnalytics),getPrecacheName:t=>t||st(ct.precache),getPrefix:()=>ct.prefix,getRuntimeName:t=>t||st(ct.runtime),getSuffix:()=>ct.suffix},ft=new Set;function ht(t){ft.add(t)}class pt{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:n,cachedResponse:r})=>{if(!r)return null;const o=this._isResponseDateFresh(r),i=this._getCacheExpiration(n);X(i.expireEntries());const a=i.updateTimestamp(e.url);if(t)try{t.waitUntil(a)}catch(c){0}return o?r:null},this.cacheDidUpdate=async({cacheName:t,request:e})=>{const n=this._getCacheExpiration(t);await n.updateTimestamp(e.url),await n.expireEntries()},this._config=t,this._maxAgeSeconds=t.maxAgeSeconds,this._cacheExpirations=new Map,t.purgeOnQuotaError&&ht(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(t){if(t===lt.getRuntimeName())throw new V("expire-custom-caches-only");let e=this._cacheExpirations.get(t);return e||(e=new at(t,this._config),this._cacheExpirations.set(t,e)),e}_isResponseDateFresh(t){if(!this._maxAgeSeconds)return!0;const e=this._getDateHeaderTimestamp(t);if(null===e)return!0;const n=Date.now();return e>=n-1e3*this._maxAgeSeconds}_getDateHeaderTimestamp(t){if(!t.headers.has("date"))return null;const e=t.headers.get("date"),n=new Date(e),r=n.getTime();return isNaN(r)?null:r}async deleteCacheAndMetadata(){for(const[t,e]of this._cacheExpirations)await self.caches.delete(t),await e.delete();this._cacheExpirations=new Map}}var dt="offline-html",gt="/offline/";self.addEventListener("install",function(){var t=o(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.waitUntil(caches.open(dt).then((function(t){return t.add(new Request(gt,{cache:"reload"}))})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),[{'url':'static/vue/css/chunk-vendors.css'},{'url':'static/vue/js/chunk-vendors.js'},{'url':'static/vue/js/offline_view.js'},{'url':'static/vue/js/recipe_view.js'},{'url':'static/vue/manifest.json'},{'url':'static/vue/offline_view.html'},{'url':'static/vue/recipe_view.html'}],G((function(t){var e=t.event;switch(e.request.destination){case"document":return console.log("Triggered fallback HTML"),caches.open(dt).then((function(t){return t.match(gt)}));default:return console.log("Triggered response ERROR"),Response.error()}})),K((function(t){var e=t.request;return"image"===e.destination}),new B({cacheName:"images",plugins:[new pt({maxEntries:20})]})),K((function(t){var e=t.request;return"script"===e.destination||"style"===e.destination}),new z({cacheName:"assets"})),K(new RegExp("jsreverse"),new z({cacheName:"assets"})),K(new RegExp("jsi18n"),new z({cacheName:"assets"})),K(new RegExp("api/recipe/([0-9]+)"),new $({cacheName:"api-recipe",plugins:[new pt({maxEntries:50})]})),K(new RegExp("api/*"),new $({cacheName:"api",plugins:[new pt({maxEntries:50})]})),K((function(t){var e=t.request;return"document"===e.destination}),new $({cacheName:"html",plugins:[new pt({maxAgeSeconds:2592e3,maxEntries:50})]}))},"25f0":function(t,e,n){"use strict";var r=n("6eeb"),o=n("825a"),i=n("d039"),a=n("ad6d"),c="toString",s=RegExp.prototype,u=s[c],l=i((function(){return"/a/b"!=u.call({source:"a",flags:"b"})})),f=u.name!=c;(l||f)&&r(RegExp.prototype,c,(function(){var t=o(this),e=String(t.source),n=t.flags,r=String(void 0===n&&t instanceof RegExp&&!("flags"in s)?a.call(t):n);return"/"+e+"/"+r}),{unsafe:!0})},2626:function(t,e,n){"use strict";var r=n("d066"),o=n("9bf2"),i=n("b622"),a=n("83ab"),c=i("species");t.exports=function(t){var e=r(t),n=o.f;a&&e&&!e[c]&&n(e,c,{configurable:!0,get:function(){return this}})}},"2d00":function(t,e,n){var r,o,i=n("da84"),a=n("342f"),c=i.process,s=c&&c.versions,u=s&&s.v8;u?(r=u.split("."),o=r[0]+r[1]):a&&(r=a.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/),r&&(o=r[1]))),t.exports=o&&+o},"342f":function(t,e,n){var r=n("d066");t.exports=r("navigator","userAgent")||""},"3bbe":function(t,e,n){var r=n("861d");t.exports=function(t){if(!r(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},"40b9":function(t,e,n){"use strict";try{self["workbox:core:6.1.2"]&&_()}catch(r){}},"428f":function(t,e,n){var r=n("da84");t.exports=r},"44ad":function(t,e,n){var r=n("d039"),o=n("c6b6"),i="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},"44e7":function(t,e,n){var r=n("861d"),o=n("c6b6"),i=n("b622"),a=i("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[a])?!!e:"RegExp"==o(t))}},"466d":function(t,e,n){"use strict";var r=n("d784"),o=n("825a"),i=n("50c4"),a=n("1d80"),c=n("8aa5"),s=n("14c3");r("match",1,(function(t,e,n){return[function(e){var n=a(this),r=void 0==e?void 0:e[t];return void 0!==r?r.call(e,n):new RegExp(e)[t](String(n))},function(t){var r=n(e,t,this);if(r.done)return r.value;var a=o(t),u=String(this);if(!a.global)return s(a,u);var l=a.unicode;a.lastIndex=0;var f,h=[],p=0;while(null!==(f=s(a,u))){var d=String(f[0]);h[p]=d,""===d&&(a.lastIndex=c(u,i(a.lastIndex),l)),p++}return 0===p?null:h}]}))},4930:function(t,e,n){var r=n("605d"),o=n("2d00"),i=n("d039");t.exports=!!Object.getOwnPropertySymbols&&!i((function(){return!Symbol.sham&&(r?38===o:o>37&&o<41)}))},"4d63":function(t,e,n){var r=n("83ab"),o=n("da84"),i=n("94ca"),a=n("7156"),c=n("9bf2").f,s=n("241c").f,u=n("44e7"),l=n("ad6d"),f=n("9f7f"),h=n("6eeb"),p=n("d039"),d=n("69f3").set,g=n("2626"),y=n("b622"),m=y("match"),v=o.RegExp,w=v.prototype,x=/a/g,b=/a/g,_=new v(x)!==x,E=f.UNSUPPORTED_Y,R=r&&i("RegExp",!_||E||p((function(){return b[m]=!1,v(x)!=x||v(b)==b||"/a/i"!=v(x,"i")})));if(R){var S=function(t,e){var n,r=this instanceof S,o=u(t),i=void 0===e;if(!r&&o&&t.constructor===S&&i)return t;_?o&&!i&&(t=t.source):t instanceof S&&(i&&(e=l.call(t)),t=t.source),E&&(n=!!e&&e.indexOf("y")>-1,n&&(e=e.replace(/y/g,"")));var c=a(_?new v(t,e):v(t,e),r?this:w,S);return E&&n&&d(c,{sticky:n}),c},O=function(t){t in S||c(S,t,{configurable:!0,get:function(){return v[t]},set:function(e){v[t]=e}})},P=s(v),N=0;while(P.length>N)O(P[N++]);w.constructor=S,S.prototype=w,h(o,"RegExp",S)}g("RegExp")},"4d64":function(t,e,n){var r=n("fc6a"),o=n("50c4"),i=n("23cb"),a=function(t){return function(e,n,a){var c,s=r(e),u=o(s.length),l=i(a,u);if(t&&n!=n){while(u>l)if(c=s[l++],c!=c)return!0}else for(;u>l;l++)if((t||l in s)&&s[l]===n)return t||l||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},"50c4":function(t,e,n){var r=n("a691"),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},5135:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},5692:function(t,e,n){var r=n("c430"),o=n("c6cd");(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.9.1",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},"56ef":function(t,e,n){var r=n("d066"),o=n("241c"),i=n("7418"),a=n("825a");t.exports=r("Reflect","ownKeys")||function(t){var e=o.f(a(t)),n=i.f;return n?e.concat(n(t)):e}},"5c6c":function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},"605d":function(t,e,n){var r=n("c6b6"),o=n("da84");t.exports="process"==r(o.process)},6547:function(t,e,n){var r=n("a691"),o=n("1d80"),i=function(t){return function(e,n){var i,a,c=String(o(e)),s=r(n),u=c.length;return s<0||s>=u?t?"":void 0:(i=c.charCodeAt(s),i<55296||i>56319||s+1===u||(a=c.charCodeAt(s+1))<56320||a>57343?t?c.charAt(s):i:t?c.slice(s,s+2):a-56320+(i-55296<<10)+65536)}};t.exports={codeAt:i(!1),charAt:i(!0)}},"69f3":function(t,e,n){var r,o,i,a=n("7f9a"),c=n("da84"),s=n("861d"),u=n("9112"),l=n("5135"),f=n("c6cd"),h=n("f772"),p=n("d012"),d=c.WeakMap,g=function(t){return i(t)?o(t):r(t,{})},y=function(t){return function(e){var n;if(!s(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}};if(a){var m=f.state||(f.state=new d),v=m.get,w=m.has,x=m.set;r=function(t,e){return e.facade=t,x.call(m,t,e),e},o=function(t){return v.call(m,t)||{}},i=function(t){return w.call(m,t)}}else{var b=h("state");p[b]=!0,r=function(t,e){return e.facade=t,u(t,b,e),e},o=function(t){return l(t,b)?t[b]:{}},i=function(t){return l(t,b)}}t.exports={set:r,get:o,has:i,enforce:g,getterFor:y}},"6aa8":function(t,e,n){"use strict";try{self["workbox:strategies:6.1.2"]&&_()}catch(r){}},"6eeb":function(t,e,n){var r=n("da84"),o=n("9112"),i=n("5135"),a=n("ce4e"),c=n("8925"),s=n("69f3"),u=s.get,l=s.enforce,f=String(String).split("String");(t.exports=function(t,e,n,c){var s,u=!!c&&!!c.unsafe,h=!!c&&!!c.enumerable,p=!!c&&!!c.noTargetGet;"function"==typeof n&&("string"!=typeof e||i(n,"name")||o(n,"name",e),s=l(n),s.source||(s.source=f.join("string"==typeof e?e:""))),t!==r?(u?!p&&t[e]&&(h=!0):delete t[e],h?t[e]=n:o(t,e,n)):h?t[e]=n:a(e,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||c(this)}))},7156:function(t,e,n){var r=n("861d"),o=n("d2bb");t.exports=function(t,e,n){var i,a;return o&&"function"==typeof(i=e.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(t,a),t}},7418:function(t,e){e.f=Object.getOwnPropertySymbols},"741b":function(t,e,n){"use strict";try{self["workbox:core:6.1.2"]&&_()}catch(r){}},7839:function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"7f9a":function(t,e,n){var r=n("da84"),o=n("8925"),i=r.WeakMap;t.exports="function"===typeof i&&/native code/.test(o(i))},"825a":function(t,e,n){var r=n("861d");t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},"83ab":function(t,e,n){var r=n("d039");t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},"861d":function(t,e){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},8925:function(t,e,n){var r=n("c6cd"),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(t){return o.call(t)}),t.exports=r.inspectSource},"8aa5":function(t,e,n){"use strict";var r=n("6547").charAt;t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},"90e3":function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},9112:function(t,e,n){var r=n("83ab"),o=n("9bf2"),i=n("5c6c");t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},9263:function(t,e,n){"use strict";var r=n("ad6d"),o=n("9f7f"),i=RegExp.prototype.exec,a=String.prototype.replace,c=i,s=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),u=o.UNSUPPORTED_Y||o.BROKEN_CARET,l=void 0!==/()??/.exec("")[1],f=s||l||u;f&&(c=function(t){var e,n,o,c,f=this,h=u&&f.sticky,p=r.call(f),d=f.source,g=0,y=t;return h&&(p=p.replace("y",""),-1===p.indexOf("g")&&(p+="g"),y=String(t).slice(f.lastIndex),f.lastIndex>0&&(!f.multiline||f.multiline&&"\n"!==t[f.lastIndex-1])&&(d="(?: "+d+")",y=" "+y,g++),n=new RegExp("^(?:"+d+")",p)),l&&(n=new RegExp("^"+d+"$(?!\\s)",p)),s&&(e=f.lastIndex),o=i.call(h?n:f,y),h?o?(o.input=o.input.slice(g),o[0]=o[0].slice(g),o.index=f.lastIndex,f.lastIndex+=o[0].length):f.lastIndex=0:s&&o&&(f.lastIndex=f.global?o.index+o[0].length:e),l&&o&&o.length>1&&a.call(o[0],n,(function(){for(c=1;c=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;N(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=r}catch(o){Function("r","regeneratorRuntime = r")(r)}},"9bf2":function(t,e,n){var r=n("83ab"),o=n("0cfb"),i=n("825a"),a=n("c04e"),c=Object.defineProperty;e.f=r?c:function(t,e,n){if(i(t),e=a(e,!0),i(n),o)try{return c(t,e,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},"9f7f":function(t,e,n){"use strict";var r=n("d039");function o(t,e){return RegExp(t,e)}e.UNSUPPORTED_Y=r((function(){var t=o("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),e.BROKEN_CARET=r((function(){var t=o("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},a691:function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},ac1f:function(t,e,n){"use strict";var r=n("23e7"),o=n("9263");r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},ad6d:function(t,e,n){"use strict";var r=n("825a");t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},b041:function(t,e,n){"use strict";var r=n("00ee"),o=n("f5df");t.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},b622:function(t,e,n){var r=n("da84"),o=n("5692"),i=n("5135"),a=n("90e3"),c=n("4930"),s=n("fdbf"),u=o("wks"),l=r.Symbol,f=s?l:l&&l.withoutSetter||a;t.exports=function(t){return i(u,t)&&(c||"string"==typeof u[t])||(c&&i(l,t)?u[t]=l[t]:u[t]=f("Symbol."+t)),u[t]}},c04e:function(t,e,n){var r=n("861d");t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},c430:function(t,e){t.exports=!1},c6b6:function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},c6cd:function(t,e,n){var r=n("da84"),o=n("ce4e"),i="__core-js_shared__",a=r[i]||o(i,{});t.exports=a},c700:function(t,e,n){"use strict";try{self["workbox:precaching:6.1.2"]&&_()}catch(r){}},c8ba:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}t.exports=n},ca84:function(t,e,n){var r=n("5135"),o=n("fc6a"),i=n("4d64").indexOf,a=n("d012");t.exports=function(t,e){var n,c=o(t),s=0,u=[];for(n in c)!r(a,n)&&r(c,n)&&u.push(n);while(e.length>s)r(c,n=e[s++])&&(~i(u,n)||u.push(n));return u}},cc12:function(t,e,n){var r=n("da84"),o=n("861d"),i=r.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},ce4e:function(t,e,n){var r=n("da84"),o=n("9112");t.exports=function(t,e){try{o(r,t,e)}catch(n){r[t]=e}return e}},d012:function(t,e){t.exports={}},d039:function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},d066:function(t,e,n){var r=n("428f"),o=n("da84"),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},d1e7:function(t,e,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);e.f=i?function(t){var e=o(this,t);return!!e&&e.enumerable}:r},d2bb:function(t,e,n){var r=n("825a"),o=n("3bbe");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,t.call(n,[]),e=n instanceof Array}catch(i){}return function(n,i){return r(n),o(i),e?t.call(n,i):n.__proto__=i,n}}():void 0)},d2e2:function(t,e,n){"use strict";try{self["workbox:core:6.1.2"]&&_()}catch(r){}},d3b7:function(t,e,n){var r=n("00ee"),o=n("6eeb"),i=n("b041");r||o(Object.prototype,"toString",i,{unsafe:!0})},d784:function(t,e,n){"use strict";n("ac1f");var r=n("6eeb"),o=n("d039"),i=n("b622"),a=n("9263"),c=n("9112"),s=i("species"),u=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")})),l=function(){return"$0"==="a".replace(/./,"$0")}(),f=i("replace"),h=function(){return!!/./[f]&&""===/./[f]("a","$0")}(),p=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));t.exports=function(t,e,n,f){var d=i(t),g=!o((function(){var e={};return e[d]=function(){return 7},7!=""[t](e)})),y=g&&!o((function(){var e=!1,n=/a/;return"split"===t&&(n={},n.constructor={},n.constructor[s]=function(){return n},n.flags="",n[d]=/./[d]),n.exec=function(){return e=!0,null},n[d](""),!e}));if(!g||!y||"replace"===t&&(!u||!l||h)||"split"===t&&!p){var m=/./[d],v=n(d,""[t],(function(t,e,n,r,o){return e.exec===a?g&&!o?{done:!0,value:m.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),{REPLACE_KEEPS_$0:l,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:h}),w=v[0],x=v[1];r(String.prototype,t,w),r(RegExp.prototype,d,2==e?function(t,e){return x.call(t,this,e)}:function(t){return x.call(t,this)})}f&&c(RegExp.prototype[d],"sham",!0)}},d8a5:function(t,e,n){"use strict";try{self["workbox:expiration:6.1.2"]&&_()}catch(r){}},da84:function(t,e,n){(function(e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this,n("c8ba"))},e6d2:function(t,e,n){"use strict";try{self["workbox:routing:6.1.2"]&&_()}catch(r){}},e893:function(t,e,n){var r=n("5135"),o=n("56ef"),i=n("06cf"),a=n("9bf2");t.exports=function(t,e){for(var n=o(e),c=a.f,s=i.f,u=0;u{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},a=i;class c extends Error{constructor(t,e){const n=a(t,e);super(n),this.name=t,this.details=e}}const s={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!==typeof registration?registration.scope:""},u=t=>[s.prefix,t,s.suffix].filter(t=>t&&t.length>0).join("-"),l=t=>{for(const e of Object.keys(s))t(e)},f={updateDetails:t=>{l(e=>{"string"===typeof t[e]&&(s[e]=t[e])})},getGoogleAnalyticsName:t=>t||u(s.googleAnalytics),getPrecacheName:t=>t||u(s.precache),getPrefix:()=>s.prefix,getRuntimeName:t=>t||u(s.runtime),getSuffix:()=>s.suffix};n("c700");let h;function p(){if(void 0===h){const e=new Response("");if("body"in e)try{new Response(e.body),h=!0}catch(t){h=!1}h=!1}return h}async function d(t,e){let n=null;if(t.url){const e=new URL(t.url);n=e.origin}if(n!==self.location.origin)throw new c("cross-origin-copy-response",{origin:n});const r=t.clone(),o={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},i=e?e(o):o,a=p()?r.body:await r.blob();return new Response(a,i)}n("741b");const g={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!==typeof registration?registration.scope:""},y=t=>[g.prefix,t,g.suffix].filter(t=>t&&t.length>0).join("-"),m=t=>{for(const e of Object.keys(g))t(e)},v={updateDetails:t=>{m(e=>{"string"===typeof t[e]&&(g[e]=t[e])})},getGoogleAnalyticsName:t=>t||y(g.googleAnalytics),getPrecacheName:t=>t||y(g.precache),getPrefix:()=>g.prefix,getRuntimeName:t=>t||y(g.runtime),getSuffix:()=>g.suffix},w=(t,...e)=>{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},x=w;class b extends Error{constructor(t,e){const n=x(t,e);super(n),this.name=t,this.details=e}}const _=t=>{const e=new URL(String(t),location.href);return e.href.replace(new RegExp("^"+location.origin),"")};function E(t,e){const n=new URL(t);for(const r of e)n.searchParams.delete(r);return n.href}async function R(t,e,n,r){const o=E(e.url,n);if(e.url===o)return t.match(e,r);const i={...r,ignoreSearch:!0},a=await t.keys(e,i);for(const c of a){const e=E(c.url,n);if(o===e)return t.match(c,r)}}class S{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}const O=new Set;async function P(){for(const t of O)await t()}function N(t){return new Promise(e=>setTimeout(e,t))}n("6aa8");function k(t){return"string"===typeof t?new Request(t):t}class j{constructor(t,e){this._cacheKeys={},Object.assign(this,e),this.event=e.event,this._strategy=t,this._handlerDeferred=new S,this._extendLifetimePromises=[],this._plugins=[...t.plugins],this._pluginStateMap=new Map;for(const n of this._plugins)this._pluginStateMap.set(n,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(t){const{event:e}=this;let n=k(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const r=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(i){throw new b("plugin-error-request-will-fetch",{thrownError:i})}const o=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this._strategy.fetchOptions);for(const n of this.iterateCallbacks("fetchDidSucceed"))t=await n({event:e,request:o,response:t});return t}catch(a){throw r&&await this.runCallbacks("fetchDidFail",{error:a,event:e,originalRequest:r.clone(),request:o.clone()}),a}}async fetchAndCachePut(t){const e=await this.fetch(t),n=e.clone();return this.waitUntil(this.cachePut(t,n)),e}async cacheMatch(t){const e=k(t);let n;const{cacheName:r,matchOptions:o}=this._strategy,i=await this.getCacheKey(e,"read"),a={...o,cacheName:r};n=await caches.match(i,a);for(const c of this.iterateCallbacks("cachedResponseWillBeUsed"))n=await c({cacheName:r,matchOptions:o,cachedResponse:n,request:i,event:this.event})||void 0;return n}async cachePut(t,e){const n=k(t);await N(0);const r=await this.getCacheKey(n,"write");if(!e)throw new b("cache-put-with-no-response",{url:_(r.url)});const o=await this._ensureResponseSafeToCache(e);if(!o)return!1;const{cacheName:i,matchOptions:a}=this._strategy,c=await self.caches.open(i),s=this.hasCallback("cacheDidUpdate"),u=s?await R(c,r.clone(),["__WB_REVISION__"],a):null;try{await c.put(r,s?o.clone():o)}catch(l){throw"QuotaExceededError"===l.name&&await P(),l}for(const f of this.iterateCallbacks("cacheDidUpdate"))await f({cacheName:i,oldResponse:u,newResponse:o.clone(),request:r,event:this.event});return!0}async getCacheKey(t,e){if(!this._cacheKeys[e]){let n=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))n=k(await t({mode:e,request:n,event:this.event,params:this.params}));this._cacheKeys[e]=n}return this._cacheKeys[e]}hasCallback(t){for(const e of this._strategy.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const n of this.iterateCallbacks(t))await n(e)}*iterateCallbacks(t){for(const e of this._strategy.plugins)if("function"===typeof e[t]){const n=this._pluginStateMap.get(e),r=r=>{const o={...r,state:n};return e[t](o)};yield r}}waitUntil(t){return this._extendLifetimePromises.push(t),t}async doneWaiting(){let t;while(t=this._extendLifetimePromises.shift())await t}destroy(){this._handlerDeferred.resolve()}async _ensureResponseSafeToCache(t){let e=t,n=!1;for(const r of this.iterateCallbacks("cacheWillUpdate"))if(e=await r({request:this.request,response:e,event:this.event})||void 0,n=!0,!e)break;return n||e&&200!==e.status&&(e=void 0),e}}class T{constructor(t={}){this.cacheName=v.getRuntimeName(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,n="string"===typeof t.request?new Request(t.request):t.request,r="params"in t?t.params:void 0,o=new j(this,{event:e,request:n,params:r}),i=this._getResponse(o,n,e),a=this._awaitComplete(i,o,n,e);return[i,a]}async _getResponse(t,e,n){await t.runCallbacks("handlerWillStart",{event:n,request:e});let r=void 0;try{if(r=await this._handle(e,t),!r||"error"===r.type)throw new b("no-response",{url:e.url})}catch(o){for(const i of t.iterateCallbacks("handlerDidError"))if(r=await i({error:o,event:n,request:e}),r)break;if(!r)throw o}for(const i of t.iterateCallbacks("handlerWillRespond"))r=await i({event:n,request:e,response:r});return r}async _awaitComplete(t,e,n,r){let o,i;try{o=await t}catch(i){}try{await e.runCallbacks("handlerDidRespond",{event:r,request:n,response:o}),await e.doneWaiting()}catch(a){i=a}if(await e.runCallbacks("handlerDidComplete",{event:r,request:n,response:o,error:i}),e.destroy(),i)throw i}}class C extends T{constructor(t={}){t.cacheName=f.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=!1!==t.fallbackToNetwork,this.plugins.push(C.copyRedirectedCacheableResponsesPlugin)}async _handle(t,e){const n=await e.cacheMatch(t);return n||(e.event&&"install"===e.event.type?await this._handleInstall(t,e):await this._handleFetch(t,e))}async _handleFetch(t,e){let n;if(!this._fallbackToNetwork)throw new c("missing-precache-entry",{cacheName:this.cacheName,url:t.url});return n=await e.fetch(t),n}async _handleInstall(t,e){this._useDefaultCacheabilityPluginIfNeeded();const n=await e.fetch(t),r=await e.cachePut(t,n.clone());if(!r)throw new c("bad-precaching-response",{url:t.url,status:n.status});return n}_useDefaultCacheabilityPluginIfNeeded(){let t=null,e=0;for(const[n,r]of this.plugins.entries())r!==C.copyRedirectedCacheableResponsesPlugin&&(r===C.defaultPrecacheCacheabilityPlugin&&(t=n),r.cacheWillUpdate&&e++);0===e?this.plugins.push(C.defaultPrecacheCacheabilityPlugin):e>1&&null!==t&&this.plugins.splice(t,1)}}C.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:t}){return!t||t.status>=400?null:t}},C.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:t}){return t.redirected?await d(t):t}};n("95a8");const A=(t,...e)=>{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},q=A;class L extends Error{constructor(t,e){const n=q(t,e);super(n),this.name=t,this.details=e}}n("e6d2");const M="GET",U=t=>t&&"object"===typeof t?t:{handle:t};class I{constructor(t,e,n=M){this.handler=U(e),this.match=t,this.method=n}setCatchHandler(t){this.catchHandler=U(t)}}class D extends I{constructor(t,e,n){const r=({url:e})=>{const n=t.exec(e.href);if(n&&(e.origin===location.origin||0===n.index))return n.slice(1)};super(r,e,n)}}class F{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",t=>{const{request:e}=t,n=this.handleRequest({request:e,event:t});n&&t.respondWith(n)})}addCacheListener(){self.addEventListener("message",t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data;0;const n=Promise.all(e.urlsToCache.map(e=>{"string"===typeof e&&(e=[e]);const n=new Request(...e);return this.handleRequest({request:n,event:t})}));t.waitUntil(n),t.ports&&t.ports[0]&&n.then(()=>t.ports[0].postMessage(!0))}})}handleRequest({request:t,event:e}){const n=new URL(t.url,location.href);if(!n.protocol.startsWith("http"))return void 0;const r=n.origin===location.origin,{params:o,route:i}=this.findMatchingRoute({event:e,request:t,sameOrigin:r,url:n});let a=i&&i.handler;const c=t.method;if(!a&&this._defaultHandlerMap.has(c)&&(a=this._defaultHandlerMap.get(c)),!a)return void 0;let s;try{s=a.handle({url:n,request:t,event:e,params:o})}catch(l){s=Promise.reject(l)}const u=i&&i.catchHandler;return s instanceof Promise&&(this._catchHandler||u)&&(s=s.catch(async r=>{if(u){0;try{return await u.handle({url:n,request:t,event:e,params:o})}catch(i){r=i}}if(this._catchHandler)return this._catchHandler.handle({url:n,request:t,event:e});throw r})),s}findMatchingRoute({url:t,sameOrigin:e,request:n,event:r}){const o=this._routes.get(n.method)||[];for(const i of o){let o;const a=i.match({url:t,sameOrigin:e,request:n,event:r});if(a)return o=a,(Array.isArray(a)&&0===a.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"===typeof a)&&(o=void 0),{route:i,params:o}}return{}}setDefaultHandler(t,e=M){this._defaultHandlerMap.set(e,U(t))}setCatchHandler(t){this._catchHandler=U(t)}registerRoute(t){this._routes.has(t.method)||this._routes.set(t.method,[]),this._routes.get(t.method).push(t)}unregisterRoute(t){if(!this._routes.has(t.method))throw new L("unregister-route-but-not-found-with-method",{method:t.method});const e=this._routes.get(t.method).indexOf(t);if(!(e>-1))throw new L("unregister-route-route-not-registered");this._routes.get(t.method).splice(e,1)}}let W;const H=()=>(W||(W=new F,W.addFetchListener(),W.addCacheListener()),W);function K(t,e,n){let r;if("string"===typeof t){const o=new URL(t,location.href);0;const i=({url:t})=>t.href===o.href;r=new I(i,e,n)}else if(t instanceof RegExp)r=new D(t,e,n);else if("function"===typeof t)r=new I(t,e,n);else{if(!(t instanceof I))throw new L("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});r=t}const o=H();return o.registerRoute(r),r}function G(t){const e=H();e.setCatchHandler(t)}class B extends T{async _handle(t,e){let n,r=await e.cacheMatch(t);if(r)0;else{0;try{r=await e.fetchAndCachePut(t)}catch(o){n=o}0}if(!r)throw new b("no-response",{url:t.url,error:n});return r}}const Y={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};class $ extends T{constructor(t={}){super(t),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(Y),this._networkTimeoutSeconds=t.networkTimeoutSeconds||0}async _handle(t,e){const n=[];const r=[];let o;if(this._networkTimeoutSeconds){const{id:i,promise:a}=this._getTimeoutPromise({request:t,logs:n,handler:e});o=i,r.push(a)}const i=this._getNetworkPromise({timeoutId:o,request:t,logs:n,handler:e});r.push(i);const a=await e.waitUntil((async()=>await e.waitUntil(Promise.race(r))||await i)());if(!a)throw new b("no-response",{url:t.url});return a}_getTimeoutPromise({request:t,logs:e,handler:n}){let r;const o=new Promise(e=>{const o=async()=>{e(await n.cacheMatch(t))};r=setTimeout(o,1e3*this._networkTimeoutSeconds)});return{promise:o,id:r}}async _getNetworkPromise({timeoutId:t,request:e,logs:n,handler:r}){let o,i;try{i=await r.fetchAndCachePut(e)}catch(a){o=a}return t&&clearTimeout(t),!o&&i||(i=await r.cacheMatch(e)),i}}class z extends T{constructor(t){super(t),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(Y)}async _handle(t,e){const n=e.fetchAndCachePut(t).catch(()=>{});let r,o=await e.cacheMatch(t);if(o)0;else{0;try{o=await n}catch(i){r=i}}if(!o)throw new b("no-response",{url:t.url,error:r});return o}}n("d2e2");const J=(t,...e)=>{let n=t;return e.length>0&&(n+=" :: "+JSON.stringify(e)),n},Q=J;class V extends Error{constructor(t,e){const n=Q(t,e);super(n),this.name=t,this.details=e}}function X(t){t.then(()=>{})}class Z{constructor(t,e,{onupgradeneeded:n,onversionchange:r}={}){this._db=null,this._name=t,this._version=e,this._onupgradeneeded=n,this._onversionchange=r||(()=>this.close())}get db(){return this._db}async open(){if(!this._db)return this._db=await new Promise((t,e)=>{let n=!1;setTimeout(()=>{n=!0,e(new Error("The open request was blocked and timed out"))},this.OPEN_TIMEOUT);const r=indexedDB.open(this._name,this._version);r.onerror=()=>e(r.error),r.onupgradeneeded=t=>{n?(r.transaction.abort(),r.result.close()):"function"===typeof this._onupgradeneeded&&this._onupgradeneeded(t)},r.onsuccess=()=>{const e=r.result;n?e.close():(e.onversionchange=this._onversionchange.bind(this),t(e))}}),this}async getKey(t,e){return(await this.getAllKeys(t,e,1))[0]}async getAll(t,e,n){return await this.getAllMatching(t,{query:e,count:n})}async getAllKeys(t,e,n){const r=await this.getAllMatching(t,{query:e,count:n,includeKeys:!0});return r.map(t=>t.key)}async getAllMatching(t,{index:e,query:n=null,direction:r="next",count:o,includeKeys:i=!1}={}){return await this.transaction([t],"readonly",(a,c)=>{const s=a.objectStore(t),u=e?s.index(e):s,l=[],f=u.openCursor(n,r);f.onsuccess=()=>{const t=f.result;t?(l.push(i?t:t.value),o&&l.length>=o?c(l):t.continue()):c(l)}})}async transaction(t,e,n){return await this.open(),await new Promise((r,o)=>{const i=this._db.transaction(t,e);i.onabort=()=>o(i.error),i.oncomplete=()=>r(),n(i,t=>r(t))})}async _call(t,e,n,...r){const o=(n,o)=>{const i=n.objectStore(e),a=i[t].apply(i,r);a.onsuccess=()=>o(a.result)};return await this.transaction([e],n,o)}close(){this._db&&(this._db.close(),this._db=null)}}Z.prototype.OPEN_TIMEOUT=2e3;const tt={readonly:["get","count","getKey","getAll","getAllKeys"],readwrite:["add","put","clear","delete"]};for(const[yt,mt]of Object.entries(tt))for(const t of mt)t in IDBObjectStore.prototype&&(Z.prototype[t]=async function(e,...n){return await this._call(t,e,yt,...n)});const et=async t=>{await new Promise((e,n)=>{const r=indexedDB.deleteDatabase(t);r.onerror=()=>{n(r.error)},r.onblocked=()=>{n(new Error("Delete blocked"))},r.onsuccess=()=>{e()}})};n("d8a5");const nt="workbox-expiration",rt="cache-entries",ot=t=>{const e=new URL(t,location.href);return e.hash="",e.href};class it{constructor(t){this._cacheName=t,this._db=new Z(nt,1,{onupgradeneeded:t=>this._handleUpgrade(t)})}_handleUpgrade(t){const e=t.target.result,n=e.createObjectStore(rt,{keyPath:"id"});n.createIndex("cacheName","cacheName",{unique:!1}),n.createIndex("timestamp","timestamp",{unique:!1}),et(this._cacheName)}async setTimestamp(t,e){t=ot(t);const n={url:t,timestamp:e,cacheName:this._cacheName,id:this._getId(t)};await this._db.put(rt,n)}async getTimestamp(t){const e=await this._db.get(rt,this._getId(t));return e.timestamp}async expireEntries(t,e){const n=await this._db.transaction(rt,"readwrite",(n,r)=>{const o=n.objectStore(rt),i=o.index("timestamp").openCursor(null,"prev"),a=[];let c=0;i.onsuccess=()=>{const n=i.result;if(n){const r=n.value;r.cacheName===this._cacheName&&(t&&r.timestamp=e?a.push(n.value):c++),n.continue()}else r(a)}}),r=[];for(const o of n)await this._db.delete(rt,o.id),r.push(o.url);return r}_getId(t){return this._cacheName+"|"+ot(t)}}class at{constructor(t,e={}){this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=e.maxEntries,this._maxAgeSeconds=e.maxAgeSeconds,this._matchOptions=e.matchOptions,this._cacheName=t,this._timestampModel=new it(t)}async expireEntries(){if(this._isRunning)return void(this._rerunRequested=!0);this._isRunning=!0;const t=this._maxAgeSeconds?Date.now()-1e3*this._maxAgeSeconds:0,e=await this._timestampModel.expireEntries(t,this._maxEntries),n=await self.caches.open(this._cacheName);for(const r of e)await n.delete(r,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,X(this.expireEntries()))}async updateTimestamp(t){await this._timestampModel.setTimestamp(t,Date.now())}async isURLExpired(t){if(this._maxAgeSeconds){const e=await this._timestampModel.getTimestamp(t),n=Date.now()-1e3*this._maxAgeSeconds;return e[ct.prefix,t,ct.suffix].filter(t=>t&&t.length>0).join("-"),ut=t=>{for(const e of Object.keys(ct))t(e)},lt={updateDetails:t=>{ut(e=>{"string"===typeof t[e]&&(ct[e]=t[e])})},getGoogleAnalyticsName:t=>t||st(ct.googleAnalytics),getPrecacheName:t=>t||st(ct.precache),getPrefix:()=>ct.prefix,getRuntimeName:t=>t||st(ct.runtime),getSuffix:()=>ct.suffix},ft=new Set;function ht(t){ft.add(t)}class pt{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:n,cachedResponse:r})=>{if(!r)return null;const o=this._isResponseDateFresh(r),i=this._getCacheExpiration(n);X(i.expireEntries());const a=i.updateTimestamp(e.url);if(t)try{t.waitUntil(a)}catch(c){0}return o?r:null},this.cacheDidUpdate=async({cacheName:t,request:e})=>{const n=this._getCacheExpiration(t);await n.updateTimestamp(e.url),await n.expireEntries()},this._config=t,this._maxAgeSeconds=t.maxAgeSeconds,this._cacheExpirations=new Map,t.purgeOnQuotaError&&ht(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(t){if(t===lt.getRuntimeName())throw new V("expire-custom-caches-only");let e=this._cacheExpirations.get(t);return e||(e=new at(t,this._config),this._cacheExpirations.set(t,e)),e}_isResponseDateFresh(t){if(!this._maxAgeSeconds)return!0;const e=this._getDateHeaderTimestamp(t);if(null===e)return!0;const n=Date.now();return e>=n-1e3*this._maxAgeSeconds}_getDateHeaderTimestamp(t){if(!t.headers.has("date"))return null;const e=t.headers.get("date"),n=new Date(e),r=n.getTime();return isNaN(r)?null:r}async deleteCacheAndMetadata(){for(const[t,e]of this._cacheExpirations)await self.caches.delete(t),await e.delete();this._cacheExpirations=new Map}}var dt="offline-html",gt="/offline/";self.addEventListener("install",function(){var t=o(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.waitUntil(caches.open(dt).then((function(t){return t.add(new Request(gt,{cache:"reload"}))})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),[{'url':'static/vue/css/chunk-vendors.css'},{'url':'static/vue/import_response_view.html'},{'url':'static/vue/js/chunk-vendors.js'},{'url':'static/vue/js/import_response_view.js'},{'url':'static/vue/js/offline_view.js'},{'url':'static/vue/js/recipe_view.js'},{'url':'static/vue/manifest.json'},{'url':'static/vue/offline_view.html'},{'url':'static/vue/recipe_view.html'}],G((function(t){var e=t.event;switch(e.request.destination){case"document":return console.log("Triggered fallback HTML"),caches.open(dt).then((function(t){return t.match(gt)}));default:return console.log("Triggered response ERROR"),Response.error()}})),K((function(t){var e=t.request;return"image"===e.destination}),new B({cacheName:"images",plugins:[new pt({maxEntries:20})]})),K((function(t){var e=t.request;return"script"===e.destination||"style"===e.destination}),new z({cacheName:"assets"})),K(new RegExp("jsreverse"),new z({cacheName:"assets"})),K(new RegExp("jsi18n"),new z({cacheName:"assets"})),K(new RegExp("api/recipe/([0-9]+)"),new $({cacheName:"api-recipe",plugins:[new pt({maxEntries:50})]})),K(new RegExp("api/*"),new $({cacheName:"api",plugins:[new pt({maxEntries:50})]})),K((function(t){var e=t.request;return"document"===e.destination}),new $({cacheName:"html",plugins:[new pt({maxAgeSeconds:2592e3,maxEntries:50})]}))},"25f0":function(t,e,n){"use strict";var r=n("6eeb"),o=n("825a"),i=n("d039"),a=n("ad6d"),c="toString",s=RegExp.prototype,u=s[c],l=i((function(){return"/a/b"!=u.call({source:"a",flags:"b"})})),f=u.name!=c;(l||f)&&r(RegExp.prototype,c,(function(){var t=o(this),e=String(t.source),n=t.flags,r=String(void 0===n&&t instanceof RegExp&&!("flags"in s)?a.call(t):n);return"/"+e+"/"+r}),{unsafe:!0})},2626:function(t,e,n){"use strict";var r=n("d066"),o=n("9bf2"),i=n("b622"),a=n("83ab"),c=i("species");t.exports=function(t){var e=r(t),n=o.f;a&&e&&!e[c]&&n(e,c,{configurable:!0,get:function(){return this}})}},"2d00":function(t,e,n){var r,o,i=n("da84"),a=n("342f"),c=i.process,s=c&&c.versions,u=s&&s.v8;u?(r=u.split("."),o=r[0]+r[1]):a&&(r=a.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/),r&&(o=r[1]))),t.exports=o&&+o},"342f":function(t,e,n){var r=n("d066");t.exports=r("navigator","userAgent")||""},"3bbe":function(t,e,n){var r=n("861d");t.exports=function(t){if(!r(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},"40b9":function(t,e,n){"use strict";try{self["workbox:core:6.1.2"]&&_()}catch(r){}},"428f":function(t,e,n){var r=n("da84");t.exports=r},"44ad":function(t,e,n){var r=n("d039"),o=n("c6b6"),i="".split;t.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},"44e7":function(t,e,n){var r=n("861d"),o=n("c6b6"),i=n("b622"),a=i("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[a])?!!e:"RegExp"==o(t))}},"466d":function(t,e,n){"use strict";var r=n("d784"),o=n("825a"),i=n("50c4"),a=n("1d80"),c=n("8aa5"),s=n("14c3");r("match",1,(function(t,e,n){return[function(e){var n=a(this),r=void 0==e?void 0:e[t];return void 0!==r?r.call(e,n):new RegExp(e)[t](String(n))},function(t){var r=n(e,t,this);if(r.done)return r.value;var a=o(t),u=String(this);if(!a.global)return s(a,u);var l=a.unicode;a.lastIndex=0;var f,h=[],p=0;while(null!==(f=s(a,u))){var d=String(f[0]);h[p]=d,""===d&&(a.lastIndex=c(u,i(a.lastIndex),l)),p++}return 0===p?null:h}]}))},4930:function(t,e,n){var r=n("605d"),o=n("2d00"),i=n("d039");t.exports=!!Object.getOwnPropertySymbols&&!i((function(){return!Symbol.sham&&(r?38===o:o>37&&o<41)}))},"4d63":function(t,e,n){var r=n("83ab"),o=n("da84"),i=n("94ca"),a=n("7156"),c=n("9bf2").f,s=n("241c").f,u=n("44e7"),l=n("ad6d"),f=n("9f7f"),h=n("6eeb"),p=n("d039"),d=n("69f3").set,g=n("2626"),y=n("b622"),m=y("match"),v=o.RegExp,w=v.prototype,x=/a/g,b=/a/g,_=new v(x)!==x,E=f.UNSUPPORTED_Y,R=r&&i("RegExp",!_||E||p((function(){return b[m]=!1,v(x)!=x||v(b)==b||"/a/i"!=v(x,"i")})));if(R){var S=function(t,e){var n,r=this instanceof S,o=u(t),i=void 0===e;if(!r&&o&&t.constructor===S&&i)return t;_?o&&!i&&(t=t.source):t instanceof S&&(i&&(e=l.call(t)),t=t.source),E&&(n=!!e&&e.indexOf("y")>-1,n&&(e=e.replace(/y/g,"")));var c=a(_?new v(t,e):v(t,e),r?this:w,S);return E&&n&&d(c,{sticky:n}),c},O=function(t){t in S||c(S,t,{configurable:!0,get:function(){return v[t]},set:function(e){v[t]=e}})},P=s(v),N=0;while(P.length>N)O(P[N++]);w.constructor=S,S.prototype=w,h(o,"RegExp",S)}g("RegExp")},"4d64":function(t,e,n){var r=n("fc6a"),o=n("50c4"),i=n("23cb"),a=function(t){return function(e,n,a){var c,s=r(e),u=o(s.length),l=i(a,u);if(t&&n!=n){while(u>l)if(c=s[l++],c!=c)return!0}else for(;u>l;l++)if((t||l in s)&&s[l]===n)return t||l||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},"50c4":function(t,e,n){var r=n("a691"),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},5135:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},5692:function(t,e,n){var r=n("c430"),o=n("c6cd");(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.9.1",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},"56ef":function(t,e,n){var r=n("d066"),o=n("241c"),i=n("7418"),a=n("825a");t.exports=r("Reflect","ownKeys")||function(t){var e=o.f(a(t)),n=i.f;return n?e.concat(n(t)):e}},"5c6c":function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},"605d":function(t,e,n){var r=n("c6b6"),o=n("da84");t.exports="process"==r(o.process)},6547:function(t,e,n){var r=n("a691"),o=n("1d80"),i=function(t){return function(e,n){var i,a,c=String(o(e)),s=r(n),u=c.length;return s<0||s>=u?t?"":void 0:(i=c.charCodeAt(s),i<55296||i>56319||s+1===u||(a=c.charCodeAt(s+1))<56320||a>57343?t?c.charAt(s):i:t?c.slice(s,s+2):a-56320+(i-55296<<10)+65536)}};t.exports={codeAt:i(!1),charAt:i(!0)}},"69f3":function(t,e,n){var r,o,i,a=n("7f9a"),c=n("da84"),s=n("861d"),u=n("9112"),l=n("5135"),f=n("c6cd"),h=n("f772"),p=n("d012"),d=c.WeakMap,g=function(t){return i(t)?o(t):r(t,{})},y=function(t){return function(e){var n;if(!s(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}};if(a){var m=f.state||(f.state=new d),v=m.get,w=m.has,x=m.set;r=function(t,e){return e.facade=t,x.call(m,t,e),e},o=function(t){return v.call(m,t)||{}},i=function(t){return w.call(m,t)}}else{var b=h("state");p[b]=!0,r=function(t,e){return e.facade=t,u(t,b,e),e},o=function(t){return l(t,b)?t[b]:{}},i=function(t){return l(t,b)}}t.exports={set:r,get:o,has:i,enforce:g,getterFor:y}},"6aa8":function(t,e,n){"use strict";try{self["workbox:strategies:6.1.2"]&&_()}catch(r){}},"6eeb":function(t,e,n){var r=n("da84"),o=n("9112"),i=n("5135"),a=n("ce4e"),c=n("8925"),s=n("69f3"),u=s.get,l=s.enforce,f=String(String).split("String");(t.exports=function(t,e,n,c){var s,u=!!c&&!!c.unsafe,h=!!c&&!!c.enumerable,p=!!c&&!!c.noTargetGet;"function"==typeof n&&("string"!=typeof e||i(n,"name")||o(n,"name",e),s=l(n),s.source||(s.source=f.join("string"==typeof e?e:""))),t!==r?(u?!p&&t[e]&&(h=!0):delete t[e],h?t[e]=n:o(t,e,n)):h?t[e]=n:a(e,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||c(this)}))},7156:function(t,e,n){var r=n("861d"),o=n("d2bb");t.exports=function(t,e,n){var i,a;return o&&"function"==typeof(i=e.constructor)&&i!==n&&r(a=i.prototype)&&a!==n.prototype&&o(t,a),t}},7418:function(t,e){e.f=Object.getOwnPropertySymbols},"741b":function(t,e,n){"use strict";try{self["workbox:core:6.1.2"]&&_()}catch(r){}},7839:function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"7f9a":function(t,e,n){var r=n("da84"),o=n("8925"),i=r.WeakMap;t.exports="function"===typeof i&&/native code/.test(o(i))},"825a":function(t,e,n){var r=n("861d");t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},"83ab":function(t,e,n){var r=n("d039");t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},"861d":function(t,e){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},8925:function(t,e,n){var r=n("c6cd"),o=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(t){return o.call(t)}),t.exports=r.inspectSource},"8aa5":function(t,e,n){"use strict";var r=n("6547").charAt;t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},"90e3":function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},9112:function(t,e,n){var r=n("83ab"),o=n("9bf2"),i=n("5c6c");t.exports=r?function(t,e,n){return o.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},9263:function(t,e,n){"use strict";var r=n("ad6d"),o=n("9f7f"),i=RegExp.prototype.exec,a=String.prototype.replace,c=i,s=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),u=o.UNSUPPORTED_Y||o.BROKEN_CARET,l=void 0!==/()??/.exec("")[1],f=s||l||u;f&&(c=function(t){var e,n,o,c,f=this,h=u&&f.sticky,p=r.call(f),d=f.source,g=0,y=t;return h&&(p=p.replace("y",""),-1===p.indexOf("g")&&(p+="g"),y=String(t).slice(f.lastIndex),f.lastIndex>0&&(!f.multiline||f.multiline&&"\n"!==t[f.lastIndex-1])&&(d="(?: "+d+")",y=" "+y,g++),n=new RegExp("^(?:"+d+")",p)),l&&(n=new RegExp("^"+d+"$(?!\\s)",p)),s&&(e=f.lastIndex),o=i.call(h?n:f,y),h?o?(o.input=o.input.slice(g),o[0]=o[0].slice(g),o.index=f.lastIndex,f.lastIndex+=o[0].length):f.lastIndex=0:s&&o&&(f.lastIndex=f.global?o.index+o[0].length:e),l&&o&&o.length>1&&a.call(o[0],n,(function(){for(c=1;c=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;N(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=r}catch(o){Function("r","regeneratorRuntime = r")(r)}},"9bf2":function(t,e,n){var r=n("83ab"),o=n("0cfb"),i=n("825a"),a=n("c04e"),c=Object.defineProperty;e.f=r?c:function(t,e,n){if(i(t),e=a(e,!0),i(n),o)try{return c(t,e,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},"9f7f":function(t,e,n){"use strict";var r=n("d039");function o(t,e){return RegExp(t,e)}e.UNSUPPORTED_Y=r((function(){var t=o("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),e.BROKEN_CARET=r((function(){var t=o("^r","gy");return t.lastIndex=2,null!=t.exec("str")}))},a691:function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},ac1f:function(t,e,n){"use strict";var r=n("23e7"),o=n("9263");r({target:"RegExp",proto:!0,forced:/./.exec!==o},{exec:o})},ad6d:function(t,e,n){"use strict";var r=n("825a");t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},b041:function(t,e,n){"use strict";var r=n("00ee"),o=n("f5df");t.exports=r?{}.toString:function(){return"[object "+o(this)+"]"}},b622:function(t,e,n){var r=n("da84"),o=n("5692"),i=n("5135"),a=n("90e3"),c=n("4930"),s=n("fdbf"),u=o("wks"),l=r.Symbol,f=s?l:l&&l.withoutSetter||a;t.exports=function(t){return i(u,t)&&(c||"string"==typeof u[t])||(c&&i(l,t)?u[t]=l[t]:u[t]=f("Symbol."+t)),u[t]}},c04e:function(t,e,n){var r=n("861d");t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},c430:function(t,e){t.exports=!1},c6b6:function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},c6cd:function(t,e,n){var r=n("da84"),o=n("ce4e"),i="__core-js_shared__",a=r[i]||o(i,{});t.exports=a},c700:function(t,e,n){"use strict";try{self["workbox:precaching:6.1.2"]&&_()}catch(r){}},c8ba:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}t.exports=n},ca84:function(t,e,n){var r=n("5135"),o=n("fc6a"),i=n("4d64").indexOf,a=n("d012");t.exports=function(t,e){var n,c=o(t),s=0,u=[];for(n in c)!r(a,n)&&r(c,n)&&u.push(n);while(e.length>s)r(c,n=e[s++])&&(~i(u,n)||u.push(n));return u}},cc12:function(t,e,n){var r=n("da84"),o=n("861d"),i=r.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},ce4e:function(t,e,n){var r=n("da84"),o=n("9112");t.exports=function(t,e){try{o(r,t,e)}catch(n){r[t]=e}return e}},d012:function(t,e){t.exports={}},d039:function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},d066:function(t,e,n){var r=n("428f"),o=n("da84"),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},d1e7:function(t,e,n){"use strict";var r={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!r.call({1:2},1);e.f=i?function(t){var e=o(this,t);return!!e&&e.enumerable}:r},d2bb:function(t,e,n){var r=n("825a"),o=n("3bbe");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,t.call(n,[]),e=n instanceof Array}catch(i){}return function(n,i){return r(n),o(i),e?t.call(n,i):n.__proto__=i,n}}():void 0)},d2e2:function(t,e,n){"use strict";try{self["workbox:core:6.1.2"]&&_()}catch(r){}},d3b7:function(t,e,n){var r=n("00ee"),o=n("6eeb"),i=n("b041");r||o(Object.prototype,"toString",i,{unsafe:!0})},d784:function(t,e,n){"use strict";n("ac1f");var r=n("6eeb"),o=n("d039"),i=n("b622"),a=n("9263"),c=n("9112"),s=i("species"),u=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")})),l=function(){return"$0"==="a".replace(/./,"$0")}(),f=i("replace"),h=function(){return!!/./[f]&&""===/./[f]("a","$0")}(),p=!o((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]}));t.exports=function(t,e,n,f){var d=i(t),g=!o((function(){var e={};return e[d]=function(){return 7},7!=""[t](e)})),y=g&&!o((function(){var e=!1,n=/a/;return"split"===t&&(n={},n.constructor={},n.constructor[s]=function(){return n},n.flags="",n[d]=/./[d]),n.exec=function(){return e=!0,null},n[d](""),!e}));if(!g||!y||"replace"===t&&(!u||!l||h)||"split"===t&&!p){var m=/./[d],v=n(d,""[t],(function(t,e,n,r,o){return e.exec===a?g&&!o?{done:!0,value:m.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}}),{REPLACE_KEEPS_$0:l,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:h}),w=v[0],x=v[1];r(String.prototype,t,w),r(RegExp.prototype,d,2==e?function(t,e){return x.call(t,this,e)}:function(t){return x.call(t,this)})}f&&c(RegExp.prototype[d],"sham",!0)}},d8a5:function(t,e,n){"use strict";try{self["workbox:expiration:6.1.2"]&&_()}catch(r){}},da84:function(t,e,n){(function(e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this,n("c8ba"))},e6d2:function(t,e,n){"use strict";try{self["workbox:routing:6.1.2"]&&_()}catch(r){}},e893:function(t,e,n){var r=n("5135"),o=n("56ef"),i=n("06cf"),a=n("9bf2");t.exports=function(t,e){for(var n=o(e),c=a.f,s=i.f,u=0;u/', import_export.import_response, name='view_import_response'), path('export/', import_export.export_recipe, name='view_export'), path('view/recipe/', views.recipe_view, name='view_recipe'), diff --git a/cookbook/views/import_export.py b/cookbook/views/import_export.py index b067afd5..c19b5cb6 100644 --- a/cookbook/views/import_export.py +++ b/cookbook/views/import_export.py @@ -3,7 +3,9 @@ import threading from io import BytesIO from django.contrib import messages +from django.http import HttpResponseRedirect from django.shortcuts import render +from django.urls import reverse from django.utils.translation import gettext as _ from cookbook.forms import ExportForm, ImportForm, ImportExportBase @@ -48,8 +50,7 @@ def import_recipe(request): t.setDaemon(True) t.start() - messages.add_message(request, messages.SUCCESS, 'Import started') - return render(request, 'import.html', {'form': form}) + return HttpResponseRedirect(reverse('view_import_response', args=[il.pk])) except NotImplementedError: messages.add_message(request, messages.ERROR, _('Importing is not implemented for this provider')) else: @@ -78,3 +79,8 @@ def export_recipe(request): form = ExportForm(initial={'recipes': recipe}, space=request.space) return render(request, 'export.html', {'form': form}) + + +@group_required('user') +def import_response(request, pk): + return render(request, 'import_response.html', {'pk': pk}) diff --git a/vue/src/apps/ImportResponseView/ImportResponseView.vue b/vue/src/apps/ImportResponseView/ImportResponseView.vue new file mode 100644 index 00000000..be403c98 --- /dev/null +++ b/vue/src/apps/ImportResponseView/ImportResponseView.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/vue/src/apps/ImportResponseView/main.js b/vue/src/apps/ImportResponseView/main.js new file mode 100644 index 00000000..1f193b54 --- /dev/null +++ b/vue/src/apps/ImportResponseView/main.js @@ -0,0 +1,8 @@ +import Vue from 'vue' +import App from './ImportResponseView.vue' + +Vue.config.productionTip = false + +new Vue({ + render: h => h(App), +}).$mount('#app') diff --git a/vue/src/utils/api.js b/vue/src/utils/api.js index 3dda8be8..41dc8f84 100644 --- a/vue/src/utils/api.js +++ b/vue/src/utils/api.js @@ -18,6 +18,16 @@ export function apiLoadRecipe(recipe_id) { }) } +export function apiLoadImportLog(id) { + let url = resolveDjangoUrl('api:importlog-detail', id) + + return axios.get(url).then((response) => { + return response.data + }).catch((err) => { + handleError(err, 'There was an error loading a resource!', 'danger') + }) +} + export function apiLogCooking(cook_log) { return axios.post(resolveDjangoUrl('api:cooklog-list',), cook_log).then((response) => { diff --git a/vue/vue.config.js b/vue/vue.config.js index 48ce9581..2cbabfa3 100644 --- a/vue/vue.config.js +++ b/vue/vue.config.js @@ -9,6 +9,10 @@ const pages = { entry: './src/apps/OfflineView/main.js', chunks: ['chunk-vendors'] }, + 'import_response_view': { + entry: './src/apps/ImportResponseView/main.js', + chunks: ['chunk-vendors'] + }, } module.exports = { diff --git a/vue/webpack-stats.json b/vue/webpack-stats.json index f387805d..509f4d0a 100644 --- a/vue/webpack-stats.json +++ b/vue/webpack-stats.json @@ -1 +1 @@ -{"status":"done","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.css","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\css\\chunk-vendors.css"},{"name":"js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"offline_view":[{"name":"js/offline_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\offline_view.js"}],"recipe_view":[{"name":"js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"}]}} \ No newline at end of file +{"status":"done","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.css","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\css\\chunk-vendors.css"},{"name":"js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"import_response_view":[{"name":"js/import_response_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\import_response_view.js"}],"offline_view":[{"name":"js/offline_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\offline_view.js"}],"recipe_view":[{"name":"js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"}]}} \ No newline at end of file