import{c9 as e,ca as s}from"./site.js?v=20260328163632";import{B as a}from"./index199.js?v=20260328163632";import{l as t,K as r,t as o,x as l,M as n,v as i,cj as u}from"./utils-lib.js?v=20260328163632";import{g as m}from"./index37.js?v=20260328163632";import{k as p,r as c,c as v,O as d,o as h,V as y,W as x,Y as b}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index91.js?v=20260328163632";import"./index92.js?v=20260328163632";import"./useMethod4.js?v=20260328163632";import"./store4.js?v=20260328163632";const j={class:"p-20px"},f=p({__name:"install-version",setup(p,{expose:f}){const g=c([]),_=[{content:t("最新的开发版如无法正常部署项目，请降低版本后重试")}],w={labelStyle:"min-width: 100px"},P=c({formAttrs:{labelWidth:"auto"},formItems:[]}),k=c({label:t("名称"),attrs:w,ruleKey:"name",rules:[{validator:(e,s,a)=>""===s?new Error(t("名称不能为空")):!/[^\x00-\x7F]/.test(s)||new Error(t("名称不能为中文")),trigger:["blur","input"]}],children:[{type:"input",key:"name",attrs:{placeholder:t("请输入名称，不能为中文"),clearable:!0,class:"!w-310px"}}]}),A=v((()=>({label:t("Python版本"),attrs:w,ruleKey:"version",rules:[r({message:t("请选择Python版本"),trigger:["blur","change"]})],children:[{type:"custom",render:()=>d(a,{modelValue:V.value.version,"onUpdate:modelValue":e=>V.value.version=e,options:g.value,"consistent-menu-width":!1,class:"!w-310px",placeholder:t("请选择Python版本"),onIconClick:()=>C(1),icon:"el-refresh"},null)}]}))),I=v((()=>(P.value.formItems=[k.value,A.value],P.value))),[K,V,q]=o(I),C=(s=0)=>{l({request:e({force:s}),success:e=>{g.value=Array.isArray(e.data)?e.data.map((e=>({label:()=>d("div",null,[e.version+(e.date?" [ ".concat(e.date," ] "):" "),d("span",{class:"stable"===e.version_stage?"text-primary":"text-danger"},["stable"===e.version_stage?t("稳定版"):t("开发版")])]),value:e.version}))):[],e.data.length&&(V.value.version=e.data[0].version),s&&n.success(t("Python版本，刷新成功"))}})};return h((()=>C())),f({onConfirm:async()=>{var e;await(null==(e=q.value)?void 0:e.validate());return(await l({loading:t("正在安装Python环境，请稍后..."),request:s(V.value),message:!0,success:e=>{u(t("Python环境安装日志"),{name:"install_python",onRefresh:m}),m()}})).status}}),(e,s)=>(y(),x("div",j,[d(b(K)),d(b(i),{options:_})]))}});export{f as default};
