import{o,c as _,w as i,j as $,n as C,aa as y,r as T,g as p,u as t,h as n,b as s,f as d,t as w,a as h,i as R}from"./app-DnroACXc.js";import{i as P,c as H}from"./app-DckefXYL.js";import{_ as N}from"./app-DgsA44Do.js";import{_ as L}from"./app-CeaP97on.js";import{_ as B}from"./app-NIO7GT0c.js";import"./app-B8VsrFxM.js";import{_ as S}from"./app-e3qO8P9V.js";import{s as m,L as O}from"./app-DM6WPmnv.js";import{N as v}from"./app-CUPmXIij.js";import{N as E}from"./app-C9iVkiu5.js";import"./app-B2-Q9WJQ.js";import"./app-DAKlLAys.js";import"./app-xECxwo4T.js";import"./app-BBDtZW3a.js";import"./app-Co2SIBzr.js";import"./app-B0NrURRk.js";import"./app-C7P1WxYu.js";import"./app-R-vSvFIF.js";import"./app-HaDoyrq5.js";import"./app-CYYQ_Zep.js";import"./app-Cmxxk_WX.js";import"./app-CF8nmC-F.js";import"./app-B09rlSqG.js";import"./app-uFawAv7F.js";import"./app-BJhJ7lM8.js";import"./app-Dd07dUxy.js";import"./app-Dpl5YSiv.js";import"./app-NVAx7Sc3.js";import"./app-CF0qXH5Q.js";import"./app-BtWF1kMA.js";import"./app-CGj1gg44.js";import"./app-B4bUdtyo.js";import"./app-BeuOvIof.js";import"./app-DSjO_8RR.js";import"./app-CZGZgDLc.js";import"./app-Cu6FD8m8.js";import"./app-DrIi-dNq.js";import"./app-zueB50zj.js";function G(){const{utils:c}=P(this);this.createRewriteRule=function(){c.popup("/servers/server/settings/rewrite/createPopup?webId="+this.webId,{height:c.POPUP_HEIGHT_LG,callback:function(){c.success("保存成功",function(){c.reload()})}})}}const b={__name:"HTTPRewriteLabelsLabel",props:["v-class"],setup(c){return(r,f)=>(o(),_(S,{class:C(r.vClass)},{default:i(()=>[$(r.$slots,"default")]),_:3},8,["class"]))}},V={key:0,class:"comment"},W={key:1},j={class:"label-group mt-1"},U={key:0},z={key:1},A=["onClick"],D=["onClick"],K={key:2,class:"comment flex items-center"},M=h("i",{class:"icon bars grey"},null,-1),q={__name:"HTTPRewriteRuleList",props:["v-web-id","v-rewrite-rules"],setup(c){const r=y("$utils"),f=y("$Tea"),l=c,{rewriteRules:u}=function(){let a=l.vRewriteRules;return a==null&&(a=[]),{rewriteRules:T(a)}}(),k=function(a){r.popup("/servers/server/settings/rewrite/updatePopup?webId="+l.vWebId+"&rewriteRuleId="+a,{height:r.POPUP_HEIGHT_LG,callback:function(){window.location.reload()}})},I=function(a){r.confirm("确定要删除此重写规则吗？",function(){f.action("/servers/server/settings/rewrite/delete").params({webId:l.vWebId,rewriteRuleId:a}).post().refresh()})},x=function(a){f.action("/servers/server/settings/rewrite/sort").post().params({webId:l.vWebId,rewriteRuleIds:a}).success(function(){r.success("保存成功")})};return(a,Q)=>(o(),p("div",null,[t(u).length==0?(o(),p("p",V,"暂时还没有重写规则。")):n("",!0),t(u).length>0?(o(),p("div",W,[s(O,{items:t(u),onSort:x},{default:i(()=>[s(t(m),{rowReorder:"",headerStyle:"width: 3em"}),s(t(m),{header:"匹配规则"},{body:i(({data:e})=>[d(w(e.pattern)+" ",1),h("div",j,[e.isBreak?(o(),_(b,{key:0},{default:i(()=>[d("BREAK")]),_:1})):n("",!0),e.mode=="redirect"&&e.redirectStatus!=307?(o(),_(b,{key:1},{default:i(()=>[d(w(e.redirectStatus),1)]),_:2},1024)):n("",!0),e.proxyHost.length>0?(o(),_(b,{key:2},{default:i(()=>[d("Host: "+w(e.proxyHost),1)]),_:2},1024)):n("",!0)])]),_:1}),s(t(m),{header:"转发目标"},{body:i(({data:e})=>[d(w(e.replace),1)]),_:1}),s(t(m),{header:"转发方式"},{body:i(({data:e})=>[e.mode=="proxy"?(o(),p("span",U,"隐式")):n("",!0),e.mode=="redirect"?(o(),p("span",z,"显示")):n("",!0)]),_:1}),s(t(m),{header:"状态",headerClass:"two wide"},{body:i(({data:e})=>[s(B,{"v-is-on":e.isOn},null,8,["v-is-on"])]),_:1}),s(t(m),{header:"操作",headerClass:"two op"},{body:i(({data:e})=>[h("a",{href:"",onClick:R(g=>k(e.id),["prevent"])},"修改",8,A),d("   "),h("a",{href:"",onClick:R(g=>I(e.id),["prevent"])},"删除",8,D)]),_:1})]),_:1},8,["items"])])):n("",!0),t(u).length>0?(o(),p("p",K,[d("拖动左侧的"),M,d("图标可以对重写规则进行排序。 ")])):n("",!0)]))}},F={key:0},J={key:1},Oe={__name:"index",setup(c){const r=H(new G);return(f,l)=>(o(),_(N,{ctx:t(r)},{default:i(()=>[t(r).featureIsOn?(o(),p("div",F,[s(E,{secondary:""},{tabs:i(()=>[s(v,{href:".?serverId="+t(r).serverId,name:"重写规则列表",active:""},null,8,["href"]),s(v,{separator:""}),s(v,{onClick:l[0]||(l[0]=R(u=>t(r).createRewriteRule(),["prevent"])),name:"创建重写规则","action-create":""})]),_:1}),s(q,{"v-web-id":t(r).webId,"v-rewrite-rules":t(r).rewriteRules},null,8,["v-web-id","v-rewrite-rules"])])):n("",!0),t(r).featureIsOn?n("",!0):(o(),p("div",J,[s(L)]))]),_:1},8,["ctx"]))}};export{Oe as default};
