import{_ as k}from"./dialog.vue_vue_type_script_setup_true_lang-3928baa8.js";import{_ as C}from"./base-button.vue_vue_type_script_setup_true_lang-4041aa1c.js";import{_ as P}from"./alert.vue_vue_type_script_setup_true_lang-2df1d0f6.js";import{_ as B}from"./icon-publish-8507a7dd.js";import{o as l,h as c,f as t,d as z,a5 as T,r as f,b as o,w as r,a as m,u as e,e as g,c as j,G as E,F as L,H as N,W as A,a6 as O,m as V}from"./app-e2c1adb4.js";import"./transition-314b73c3.js";import"./dialog-e6df4d57.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./ExclamationCircleIcon-0d70cb72.js";import"./XCircleIcon-d7d84b59.js";function S(b,_){return l(),c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[t("path",{d:"M8.75 2.75a.75.75 0 0 0-1.5 0v5.69L5.03 6.22a.75.75 0 0 0-1.06 1.06l3.5 3.5a.75.75 0 0 0 1.06 0l3.5-3.5a.75.75 0 0 0-1.06-1.06L8.75 8.44V2.75Z"}),t("path",{d:"M3.5 9.75a.75.75 0 0 0-1.5 0v1.5A2.75 2.75 0 0 0 4.75 14h6.5A2.75 2.75 0 0 0 14 11.25v-1.5a.75.75 0 0 0-1.5 0v1.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-1.5Z"})])}const W={key:0,class:"relative flex flex-col items-start justify-center gap-4 px-6 py-4"},I={class:"flex w-full items-start gap-4"},M={class:"flex size-16 shrink-0"},R=t("div",{class:"flex-1"},[t("h3",{class:"text-xl font-semibold leading-6 text-gray-600"}," Publish Translations "),t("p",{class:"mt-1 text-sm text-gray-500"}," Be cautious when publishing, as this action will update your project with all translations and changes made in the database, overwriting project files. ")],-1),$={key:0,class:"w-full text-center"},D=t("strong",null,"Warning:",-1),F=t("span",null,"Download",-1),H={key:1,class:"relative flex flex-col items-start justify-center gap-4 px-6 py-4"},U=t("div",{class:"mx-auto flex size-12 shrink-0 items-center justify-center"},[t("span",{role:"img",class:"text-4xl"},"🤔")],-1),Z=t("div",{class:"w-full text-center"},[t("h3",{class:"text-xl font-semibold leading-6 text-gray-600"}," What are you trying to do? "),t("p",{class:"mt-4 text-sm text-gray-500"}," Add languages to your project, then come back to publish translations when you're ready. ")],-1),G=[U,Z],ot=z({__name:"publish-translations",props:{canPublish:{type:Boolean},isProductionEnv:{type:Boolean}},setup(b){const _=T(),{close:d}=N(),i=f(!1),n=f(!1),v=()=>{i.value=!0,A.post(route("ltu.translation.export"),{},{preserveScroll:!0,onSuccess:()=>{i.value=!1,d()}})},x=()=>{n.value=!0,fetch(route("ltu.translation.download")).then(async s=>{let h=await s.blob();n.value=!1;const a=document.createElement("a"),u=window.URL.createObjectURL(h);a.download="lang.zip",a.href=u,document.body.appendChild(a),a.click(),document.body.removeChild(a),n.value=!1,d()}).catch(s=>{_.error("Something went wrong, please try again.",{icon:!0,position:O.BOTTOM_CENTER})})};return(s,h)=>{const a=V,u=B,w=P,p=C,y=k;return l(),c(L,null,[o(a,{title:"Add Languages"}),o(y,{size:"lg"},{default:r(()=>[s.canPublish?(l(),c("div",W,[t("div",I,[t("div",M,[o(u,{class:"size-16 text-blue-300"})]),R]),s.isProductionEnv?(l(),c("div",$,[o(w,{variant:"warning",class:"text-left"},{default:r(()=>[D,m(" This is a Production Environment. Publishing translations will causing issues with version control and other developers, Please use the download button below instead. ")]),_:1}),o(p,{disabled:e(i)||e(n),"is-loading":e(n),variant:"dark",size:"lg",class:"mt-4","full-width":"",target:"_blank",onClick:x},{default:r(()=>[o(e(S),{class:"size-4"}),F]),_:1},8,["disabled","is-loading"])])):g("",!0)])):(l(),c("div",H,G)),t("div",{class:E(["grid grid-cols-1 gap-6 border-t px-6 py-4",{"md:grid-cols-2":s.canPublish}])},[o(p,{variant:"secondary",type:"button",size:"lg",tabindex:"1",onClick:e(d)},{default:r(()=>[m(" Close ")]),_:1},8,["onClick"]),s.canPublish?(l(),j(p,{key:0,variant:"primary",type:"button",size:"lg",disabled:e(i)||e(n),"is-loading":e(i),onClick:v},{default:r(()=>[m(" Publish ")]),_:1},8,["disabled","is-loading"])):g("",!0)],2)]),_:1})],64)}}});export{ot as default};
