import{aC as e,aK as a,B as t,b as l,e as s}from"./utils-lib.js?v=1761009159";import{c as n,r as u,g as i,w as r,q as o,a6 as p,H as d,I as c,y as v,v as m,x as y,z as f,D as g,N as h,B as _,F as x,b0 as b,Q as k,C as j,e as C,J as w,ak as V,al as S,G as T,aC as U}from"./base-lib.js?v=1761009159";import{B}from"./index115.js?v=1761009159";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang5.js?v=1761009159";import{getJavaProjectConfigList as O,getFileBody as q,saveFileBody as z}from"./site.js?v=1761009159";import{u as D,S as I}from"./useStore4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./ace.js?v=1761009159";const L={class:"h-full relative"},E={key:0,class:"bg-darkTertiary flex items-center justify-center h-[72rem]"},F={key:0},G={class:"inline-block text-secondary items-center flex"},J={class:"max-w-[55rem] truncate leading-[1.3] inline-block"},K=["onClick"],M={class:"my-12px"},N={key:0,class:"flex"},Q={key:1,class:"text-secondary"},A={key:1,class:"bg-darkTertiary flex items-center justify-center h-full"},P={class:"bg-white px-48px py-16px text-default flex items-center"},R=n({__name:"index",props:{compData:{default:()=>({})}},setup(n,{expose:R}){const{siteInfo:W}=D(),{jumpTabEvent:X}=I(),Y=l(),Z=u(!1),$=u(""),ee=u(!1),ae=u([]),te=u(""),le=u(!1),se=u(""),ne=u(!1);let ue=[],ie={};const re=u(""),oe=i(()=>{var e;return{readOnly:"spring"===(null==(e=ae.value.find(e=>e.path===$.value))?void 0:e.type)}}),pe=async e=>{if(ee.value)try{if(e.data)return te.value=e.data;le.value=!0;let a=e.path;if("spring"===e.type&&(a=se.value,ne.value=ue.includes(a),ie[a]))return void(te.value=ie[a]);const{data:t}=await q({path:a});te.value=t.data,le.value=!1}catch(t){a(t),te.value=""}finally{le.value=!1}},de=async e=>{pe(ae.value.find(a=>a.path===e))},ce=async()=>{let e=Y.load("正在保存内容，请稍候...");try{let e=$.value.includes("spring")?se.value:ae.value.find(e=>e.path===$.value).path;const a=await z({data:te.value,encoding:"utf-8",path:e});Y.msg({dangerouslyUseHTMLString:!0,message:"<div>".concat(a.msg,"</div>"),type:a.status?"success":"error",duration:a.status?2e3:0,showClose:!a.status,customClass:"!max-w-[70rem]"})}catch(a){}finally{e.close()}};r(()=>W.value,e=>{var a;(null==(a=W.value.project_config)?void 0:a.bind_extranet)&&(ee.value=!!W.value.project_config.bind_extranet)},{immediate:!0});const ve=async()=>{let e=W.value.project_type.toLowerCase();re.value=e,ee.value=!0,(async()=>{try{Z.value=!0;const{data:e}=await O({project_name:W.value.name});if(!e.status)return void Y.error(e.msg);ue=[],ie={};const a=e.data.filter(e=>"伪静态配置文件"!==e.name&&!e.type.includes("spring")),t=e.data.filter(e=>"伪静态配置文件"!==e.name&&e.type.includes("spring")&&e.status);if(ae.value=[...a,...t.length?[{name:"Spring配置",path:"spring",type:"spring",options:t.map(e=>("local_spring"===e.type?ue.push(e.path):ie[e.path]=e.data,{label:e.path,value:e.path,type:e.type})),status:!0}]:[]],ae.value.length>0){const e=ae.value.find(e=>!0===e.status);e&&($.value=e.path,t.length>0&&(se.value=t[0].path)),pe(e)}}catch(e){a(e)}finally{Z.value=!1}})()};return o(ve),R({init:ve}),p(()=>{ae.value=[]}),(a,l)=>{const n=V,u=S,i=B,r=T,o=s,p=U,O=e,q=d("bt-loading");return c((m(),y("div",L,[v(ae).length?g("",!0):(m(),y("div",E,l[4]||(l[4]=[f("div",{class:"bg-white px-48px py-16px text-default"},"暂无配置文件",-1)]))),v(ae).length?(m(),h(O,{key:1,type:"card",modelValue:v($),"onUpdate:modelValue":l[3]||(l[3]=e=>k($)?$.value=e:null),onChange:de},{default:_(()=>[(m(!0),y(x,null,b(v(ae),e=>(m(),y(x,null,[e.status?(m(),h(p,{key:e.path,label:e.name,lazy:!0,name:e.path},{default:_(()=>[v(ee)?(m(),y("div",F,[f("span",G,[l[5]||(l[5]=j(" 文件位置： ",-1)),c(f("div",J,[C(H,{text:e.path},null,8,["text"])],512),[[w,"spring"!==e.type]]),c(C(u,{class:"!w-[26rem]",modelValue:v(se),"onUpdate:modelValue":l[0]||(l[0]=e=>k(se)?se.value=e:null),onChange:a=>pe(e)},{default:_(()=>[(m(!0),y(x,null,b(e.options,e=>(m(),h(n,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onChange"]),[[w,"spring"===e.type]]),f("span",{class:"ml-[2rem] svgtofont-el-document-copy cursor-pointer",onClick:a=>v(t)({value:"spring"===e.type?v(se):e.path})},null,8,K)]),f("div",M,[c(C(i,{class:"!h-[54rem] !w-[64rem] border border-dark rounded-base",modelValue:v(te),"onUpdate:modelValue":l[1]||(l[1]=e=>k(te)?te.value=e:null),request:!1,onSave:ce,editorOption:v(oe)},null,8,["modelValue","editorOption"]),[[q,v(le)]])]),"spring"!==e.type||v(ne)?(m(),y("div",N,[C(r,{type:"primary",onClick:ce},{default:_(()=>l[6]||(l[6]=[j("保存",-1)])),_:1,__:[6]})])):(m(),y("div",Q,"此文件为jar内部文件，不允许编辑"))])):(m(),y("div",A,[f("div",P,[l[8]||(l[8]=j("请开启 ",-1)),C(o,{onClick:l[2]||(l[2]=e=>v(X)("mapping"))},{default:_(()=>l[7]||(l[7]=[j("外网映射",-1)])),_:1,__:[7]}),l[9]||(l[9]=j(" 后查看配置信息",-1))])]))]),_:2},1032,["label","name"])):g("",!0)],64))),256))]),_:1},8,["modelValue"])):g("",!0)])),[[q,v(Z)],[q,"正在加载配置文件，请稍后...","title"]])}}});export{R as default};
