import{_ as e}from"./public.js?v=1753954525509";import{_ as t}from"./index.vue_vue_type_script_setup_true_lang.js?v=1753954525509";import{_ as r}from"./index.vue_vue_type_script_setup_true_lang9.js?v=1753954525509";import{_ as a}from"./index100.js?v=1753954525509";import{aP as l}from"./page_layout.js?v=1753954525509";import{bb as s}from"./site.js?v=1753954525509";import{k as o,P as i,r as p,e as n,o as d,U as _,V as u,Q as x,a2 as y,W as m,X as h,a3 as c,a1 as v,j as f}from"./vue.js?v=1753954525509";import{cA as P,cG as g,aq as S,bY as $,bX as b}from"./naive.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";import"./index96.js?v=1753954525509";const j={class:"m-15px"},k={class:"w-440px"},w={class:"list-none!"},H={class:"list-none!"},U={class:"list-none!"},q=o({__name:"index",emits:["refresh"],setup(o,{expose:q,emit:E}){const{t:C}=i(),X=E,A=()=>{"2"===Q.proxy_type?Q.proxy_host="$http_host":Q.proxy_host=""},G=e=>{if("2"===Q.proxy_type)return void(Q.proxy_host="$http_host");let t=e.replace(/^http[s]?:\/\//,"");t=t.replace(/(:|\?|\/|\\)(.*)$/,""),Q.proxy_host=t},I=p(null),N=[{label:C("Site.Proxy.index_11"),value:"1"},{label:C("Site.Proxy.index_12"),value:"2"}],Q=n({domains:"",proxy_type:"1",url:"http://",unx:"",proxy_host:"$http_host",remark:""}),R={domains:{required:!0,trigger:["blur","change"],validator:(e,t)=>{if(""===t.trim())return new Error(C("Site.PHP.add_site_23"));const r=t.trim().split("\n")[0].split(":")[1];return!(r&&(!l(r)||Number(r)<100))||new Error(C("Site.Proxy.index_13"))}},url:{required:!0,trigger:["blur","change"],validator:(e,t)=>{if(!t.replace(/^http[s]?:\/\//,""))return new Error(C("Site.Proxy.index_14"));let r=t.replace(/^http[s]?:\/\//,"");return r=r.replace(/(:|\?|\/|\\)(.*)$/,""),/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(r)?Q.proxy_host="$http_host":Q.proxy_host=r,!0}},unx:{required:!0,message:C("Site.PHP.add_site_26"),trigger:["blur","change"]},proxy_host:{required:!0,message:C("Site.PHP.add_site_26"),trigger:["blur","change"]}},V=e=>{const t=e.trim().split("\n")[0].split(":")[0];t&&(Q.remark=t)};return d((()=>{})),q({onConfirm:async()=>{var e;await(null==(e=I.value)?void 0:e.validate());let t={remark:Q.remark,proxy_type:"1"==Q.proxy_type,proxy_pass:"1"==Q.proxy_type?Q.url:Q.unx,domains:Q.domains,proxy_host:Q.proxy_host};await s(t),X("refresh")}}),(l,s)=>{const o=a,i=P,p=g,n=S,d=r,q=$,E=b,C=t,X=e;return _(),u("div",j,[x(C,{ref_key:"formRef",ref:I,model:h(Q),rules:R},{default:y((()=>[x(i,{label:l.$t("Site.PHP.add_site_4"),path:"domains"},{default:y((()=>[m("div",k,[x(o,{value:h(Q).domains,"onUpdate:value":[s[0]||(s[0]=e=>h(Q).domains=e),V]},{default:y((()=>[m("p",null,c(l.$t("Site.PHP.add_site_5")),1),m("p",null,c(l.$t("Site.PHP.add_site_6")),1),m("p",null,c(l.$t("Site.PHP.add_site_7")),1)])),_:1},8,["value"])])])),_:1},8,["label"]),x(q,null,{default:y((()=>[x(i,{label:l.$t("Site.Proxy.index_1")},{default:y((()=>[x(p,{value:h(Q).proxy_type,"onUpdate:value":[s[1]||(s[1]=e=>h(Q).proxy_type=e),A],options:N,class:"w-120px"},null,8,["value"])])),_:1},8,["label"]),"1"==h(Q).proxy_type?(_(),v(i,{key:0,path:"url",class:"w-310px"},{default:y((()=>[x(n,{value:h(Q).url,"onUpdate:value":s[2]||(s[2]=e=>h(Q).url=e),onInput:G},null,8,["value"])])),_:1})):(_(),v(i,{key:1,path:"unx",class:"w-310px"},{default:y((()=>[x(d,{"checked-type":["dir","file"],value:h(Q).unx,"onUpdate:value":s[3]||(s[3]=e=>h(Q).unx=e),onChange:G},null,8,["value"])])),_:1}))])),_:1}),x(i,{label:l.$t("Site.Proxy.index_2"),path:"proxy_host",class:"w-570px"},{default:y((()=>[x(E,{trigger:"hover"},{trigger:y((()=>[x(n,{value:h(Q).proxy_host,"onUpdate:value":s[4]||(s[4]=e=>h(Q).proxy_host=e)},null,8,["value"])])),default:y((()=>[f(" "+c(l.$t("Site.Proxy.index_4")),1)])),_:1})])),_:1},8,["label"]),x(i,{label:l.$t("Site.Proxy.index_3"),class:"w-570px"},{default:y((()=>[x(n,{value:h(Q).remark,"onUpdate:value":s[5]||(s[5]=e=>h(Q).remark=e),placeholder:l.$t("Site.Proxy.index_5")},null,8,["value","placeholder"])])),_:1},8,["label"])])),_:1},8,["model"]),x(X,{class:"mt-16px"},{default:y((()=>[m("li",null,c(l.$t("Site.Proxy.index_6")),1),m("li",null,c(l.$t("Site.Proxy.index_7")),1),m("li",w,c(l.$t("Site.Proxy.index_8")),1),m("li",H,c(l.$t("Site.Proxy.index_9")),1),m("li",U,c(l.$t("Site.Proxy.index_10")),1)])),_:1})])}}});export{q as default};
