import{J as v}from"./index-UcVXCjOs.js";import{a4 as y,i as t,a6 as b,M as f,bd as x,g as o,be as g}from"./app-JmgyQoR0.js";import{a as k,g as T}from"./theme-store-0-WTQMQ_.js";import{b as w,a as B,c,h as C,t as V,l as i,j as n,K as r,E as d,z as m,u as p}from"./vue-y3KLWBaS.js";const M={class:"_formRoot"},N={class:"_formBlock",style:{display:"flex",gap:"var(--margin)","flex-wrap":"wrap"}},E=p("i",{class:"ph-eye ph-bold ph-lg"},null,-1),J=p("i",{class:"ph-check ph-bold ph-lg"},null,-1),K=w({__name:"theme.install",setup(S){let a=B(null);function u(l){let e;try{e=v.parse(l)}catch(s){return o({type:"error",text:t.ts._theme.invalid}),!1}return g(e)?T().some(s=>s.id===e.id)?(o({type:"info",text:t.ts._theme.alreadyInstalled}),!1):e:(o({type:"error",text:t.ts._theme.invalid}),!1)}function h(l){const e=u(l);e&&x(e,!1)}async function _(l){const e=u(l);e&&(await k(e),o({type:"success",text:t.t("_theme.installed",{name:e.name})}))}return c(()=>[]),c(()=>[]),y({title:t.ts._theme.install,icon:"ph-download-simple ph-bold ph-lg"}),(l,e)=>(C(),V("div",M,[i(b,{modelValue:a.value,"onUpdate:modelValue":e[0]||(e[0]=s=>a.value=s),class:"_formBlock"},{label:n(()=>[r(d(m(t).ts._theme.code),1)]),_:1},8,["modelValue"]),p("div",N,[i(f,{disabled:a.value==null,inline:"",onClick:e[1]||(e[1]=()=>h(a.value))},{default:n(()=>[E,r(" "+d(m(t).ts.preview),1)]),_:1},8,["disabled"]),i(f,{disabled:a.value==null,primary:"",inline:"",onClick:e[2]||(e[2]=()=>_(a.value))},{default:n(()=>[J,r(" "+d(m(t).ts.install),1)]),_:1},8,["disabled"])])]))}});export{K as default};
