(window.webpackJsonp=window.webpackJsonp||[]).push([[78],{855:function(e,t,n){"use strict";n.r(t);var r=n(7),l=(n(29),n(8),{props:{value:Boolean},data:function(){return{processing:!1,newName:"",newUrl:"",newAuthHeaderValue:""}},watch:{show:{handler:function(e){e&&this.init()}}},computed:{show:{get:function(){return this.value},set:function(e){this.$emit("input",e)}}},methods:{submitForm:function(){var e=this;return Object(r.a)(regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(n=document.activeElement)||void 0===n||null===(r=n.blur)||void 0===r||r.call(n),t.next=3,e.$nextTick();case 3:if(e.newName&&e.newUrl){t.next=6;break}return e.$toast.error(e.$strings.ToastProviderNameAndUrlRequired),t.abrupt("return");case 6:e.processing=!0,e.$axios.$post("/api/custom-metadata-providers",{name:e.newName,url:e.newUrl,mediaType:"book",authHeaderValue:e.newAuthHeaderValue}).then((function(data){e.$emit("added",data.provider),e.$toast.success(e.$strings.ToastProviderCreatedSuccess),e.show=!1})).catch((function(t){var n,r=(null===(n=t.response)||void 0===n?void 0:n.data)||"Unknown error";console.error("Failed to add provider",t),e.$toast.error(e.$strings.ToastProviderCreatedFailed+": "+r)})).finally((function(){e.processing=!1}));case 8:case"end":return t.stop()}}),t)})))()},init:function(){this.processing=!1,this.newName="",this.newUrl="",this.newAuthHeaderValue=""}},mounted:function(){}}),o=n(4),component=Object(o.a)(l,(function(){var e=this,t=e._self._c;return t("modals-modal",{ref:"modal",attrs:{name:"custom-metadata-provider",width:600,height:"unset",processing:e.processing},scopedSlots:e._u([{key:"outer",fn:function(){return[t("div",{staticClass:"absolute top-0 left-0 p-5 w-2/3 overflow-hidden"},[t("p",{staticClass:"text-3xl text-white truncate"},[e._v(e._s(e.$strings.HeaderAddCustomMetadataProvider))])])]},proxy:!0}]),model:{value:e.show,callback:function(t){e.show=t},expression:"show"}},[e._v(" "),t("form",{on:{submit:function(t){return t.preventDefault(),e.submitForm.apply(null,arguments)}}},[t("div",{staticClass:"px-4 w-full flex items-center text-sm py-6 rounded-lg bg-bg shadow-lg border border-black-300 overflow-y-auto overflow-x-hidden",staticStyle:{"min-height":"400px","max-height":"80vh"}},[t("div",{staticClass:"w-full p-8"},[t("div",{staticClass:"flex mb-2"},[t("div",{staticClass:"w-3/4 p-1"},[t("ui-text-input-with-label",{attrs:{label:e.$strings.LabelName,"trim-whitespace":""},model:{value:e.newName,callback:function(t){e.newName=t},expression:"newName"}})],1),e._v(" "),t("div",{staticClass:"w-1/4 p-1"},[t("ui-text-input-with-label",{attrs:{value:"Book",readonly:"",label:e.$strings.LabelMediaType}})],1)]),e._v(" "),t("div",{staticClass:"w-full mb-2 p-1"},[t("ui-text-input-with-label",{attrs:{label:"URL","trim-whitespace":""},model:{value:e.newUrl,callback:function(t){e.newUrl=t},expression:"newUrl"}})],1),e._v(" "),t("div",{staticClass:"w-full mb-2 p-1"},[t("ui-text-input-with-label",{attrs:{label:e.$strings.LabelProviderAuthorizationValue,type:"password"},model:{value:e.newAuthHeaderValue,callback:function(t){e.newAuthHeaderValue=t},expression:"newAuthHeaderValue"}})],1),e._v(" "),t("div",{staticClass:"flex px-1 pt-4"},[t("div",{staticClass:"grow"}),e._v(" "),t("ui-btn",{attrs:{color:"bg-success",type:"submit"}},[e._v(e._s(e.$strings.ButtonAdd))])],1)])])])])}),[],!1,null,null,null);t.default=component.exports;installComponents(component,{UiTextInputWithLabel:n(121).default,UiBtn:n(42).default,ModalsModal:n(39).default})}}]);