(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{1002:function(e,r,t){"use strict";t.r(r);var n=t(0),o=(t(11),t(98),t(32),t(4)),c=t(673),l=o.default.extend({props:{errorMessage:{type:String,default:""}},data:function(){return{file:null,valid:!1,uploadSingleFileRules:c.h}},computed:{exampleFormat:function(){return JSON.stringify([{text:"Dog",suffix_key:"a",background_color:"#FF0000",text_color:"#ffffff"},{text:"Cat",suffix_key:"c",background_color:"#FF0000",text_color:"#ffffff"}],null,4)}}}),f=t(84),d=t(88),m=t.n(d),h=t(300),v=t(591),x=t(585),_=t(985),y=t(646),$=t(121),component=Object(f.a)(l,(function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("v-card",[t("v-card-title",{domProps:{textContent:e._s(e.$t("labels.importLabels"))}}),e._v(" "),t("v-card-text",[t("v-form",{ref:"form",model:{value:e.valid,callback:function(r){e.valid=r},expression:"valid"}},[t("h3",[e._v(e._s(e.$t("labels.importMessage1")))]),e._v(" "),e.exampleFormat?t("v-sheet",{staticClass:"mb-5 pa-5",attrs:{dark:!e.$vuetify.theme.dark,light:e.$vuetify.theme.dark}},[t("pre",[e._v(e._s(e.exampleFormat))])]):e._e(),e._v(" "),t("v-file-input",{attrs:{accept:".json","error-messages":e.errorMessage,label:e.$t("labels.filePlaceholder"),rules:e.uploadSingleFileRules(e.$t("rules.uploadFileRules")),outlined:"","prepend-icon":""},on:{change:function(r){return e.$emit("clear")},"click:clear":function(r){return e.$emit("clear")}},model:{value:e.file,callback:function(r){e.file=r},expression:"file"}}),e._v(" "),t("v-btn",{staticClass:"text-capitalize",attrs:{disabled:!e.valid,color:"primary"},on:{click:function(r){return e.$emit("upload",e.file)}}},[e._v("\n        Import\n      ")])],1)],1)],1)}),[],!1,null,null,null),k=component.exports;m()(component,{VBtn:h.a,VCard:v.a,VCardText:x.b,VCardTitle:x.c,VFileInput:_.a,VForm:y.a,VSheet:$.a});var F=o.default.extend({components:{FormImport:k},layout:"project",validate:function(e){var r=e.params,t=e.query,n=e.app;return!!["category","span","relation"].includes(t.type)&&(!!/^\d+$/.test(r.id)&&n.$services.project.findById(r.id).then((function(e){return e.canDefineLabel})))},data:function(){return{errorMessage:""}},computed:{projectId:function(){return this.$route.params.id},service:function(){var e=this.$route.query.type;return"category"===e?this.$services.categoryType:"span"===e?this.$services.spanType:this.$services.relationType}},methods:{upload:function(e){var r=this;return Object(n.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,r.service.upload(r.projectId,e);case 3:r.$router.push("/projects/".concat(r.projectId,"/labels")),t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),r.errorMessage=t.t0.message;case 9:case"end":return t.stop()}}),t,null,[[0,6]])})))()},clearErrorMessage:function(){this.errorMessage=""}}}),j=Object(f.a)(F,(function(){var e=this,r=e.$createElement;return(e._self._c||r)("form-import",{attrs:{"error-message":e.errorMessage},on:{clear:e.clearErrorMessage,upload:e.upload}})}),[],!1,null,null,null);r.default=j.exports},673:function(e,r,t){"use strict";t.d(r,"c",(function(){return n})),t.d(r,"i",(function(){return o})),t.d(r,"e",(function(){return c})),t.d(r,"a",(function(){return l})),t.d(r,"f",(function(){return f})),t.d(r,"b",(function(){return d})),t.d(r,"h",(function(){return m})),t.d(r,"d",(function(){return h})),t.d(r,"g",(function(){return v}));t(7);var n=function(e){return[function(r){return!!r||e.labelRequired},function(r){return r&&r.length<=30||e.labelLessThan30Chars}]},o=function(e){return[function(r){return!!r||e.userNameRequired},function(r){return r&&r.length<=30||e.userNameLessThan30Chars}]},c=function(e){return[function(r){return!!r||e.projectNameRequired},function(r){return r&&r.length<=30||e.projectNameLessThan30Chars}]},l=function(e){return[function(r){return!!r||e.descriptionRequired},function(r){return r&&r.length<=100||e.descriptionLessThan30Chars}]},f=function(e){return[function(r){return!!r||e.projectTypeRequired}]},d=function(e){return[function(r){return!!r||e.fileFormatRequired}]},m=function(e){return[function(r){return!!r||e.fileRequired},function(r){return!r||r.size<1e6||e.fileLessThan1MB}]},h=function(e){return[function(r){return!!r||e.passwordRequired},function(r){return r&&r.length<=30||e.passwordLessThan30Chars}]},v=function(){return[function(e){return!!e||"Name is required"}]}}}]);