import{_ as e}from"./index133.js?v=1761009159";import{K as r,bq as a,k as t}from"./utils-lib.js?v=1761009159";import{c as l,g as s,e as i,U as o,C as u,G as m,v as p,x as n,y as d,N as v,B as c,A as y,D as _,K as f}from"./base-lib.js?v=1761009159";import{u as b,S as g}from"./useStore4.js?v=1761009159";import{i as j,h as x,p as h,o as w,m as V,b as C,a as U}from"./useController15.js?v=1761009159";import"./index106.js?v=1761009159";import"./validator.js?v=1761009159";import"./column.js?v=1761009159";import"./index.vue_vue_type_style_index_0_scoped_cdc7f4d3_lang.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./site.js?v=1761009159";import"./useController6.js?v=1761009159";import"./config.js?v=1761009159";const k=l({__name:"traffic",setup(l,{expose:k}){const{isBindExtranet:q,siteInfo:B}=b();g();const{BtForm:I,submit:E}=r({data:j,options:e=>s(()=>{var r;return[{type:"custom",render:()=>i(a,{label:"是否启用"},{default:()=>[i(o,{modelValue:e.value.value,"onUpdate:modelValue":r=>e.value.value=r,onChange:r=>x(r,e.value)},{default:()=>[u("启用流量控制")]})]})},{type:"select",label:"限制方案",key:"type",options:h.value,attrs:{style:"width: 24rem;",onChange:r=>{const{perserver:a,perip:t,limit_rate:l}=h.value[r].items;e.value.perserver=a,e.value.perip=t,e.value.limit_rate=l}}},{type:"custom",render:()=>i(a,{label:"并发限制",prop:"perserver"},{default:()=>[i(t,{modelValue:e.value.perserver,"onUpdate:modelValue":r=>e.value.perserver=r,type:"number",width:"24rem",class:"mr-1rem"},null),i("div",{class:"text-tertiary text-small"},[u("* 限制当前站点最大并发数")])]}),rules:{perserver:[{required:!0,message:"请输入并发限制",trigger:"blur"},{validator:(e,r,a)=>{r>65535?a(new Error("不能大于65535")):a()}}]}},{type:"custom",render:()=>i(a,{label:"单IP限制",prop:"perip"},{default:()=>[i(t,{modelValue:e.value.perip,"onUpdate:modelValue":r=>e.value.perip=r,type:"number",width:"24rem",class:"mr-1rem"},null),i("span",{class:"text-tertiary text-small"},[u("* 限制单个IP访问最大并发数")])]}),rules:{perip:[{required:!0,message:"请输入单IP限制",trigger:"blur"},{validator:(e,r,a)=>{r>65535?a(new Error("不能大于65535")):a()}}]}},{type:"custom",render:()=>i(a,{label:"流量限制",prop:"limit_rate"},{default:()=>[i(t,{modelValue:e.value.limit_rate,"onUpdate:modelValue":r=>e.value.limit_rate=r,type:"number",width:"24rem",class:"mr-1rem"},null),i("span",{class:"text-tertiary text-small"},[u("* 限制每个请求的流量上限（单位：KB）")])]}),rules:{limit_rate:[{required:!0,message:"请输入流量限制",trigger:"blur"}]}},...(null==(r=B.value)?void 0:r.id)?[{type:"custom",render:()=>i(a,{label:" "},{default:()=>[i(m,{type:"primary",onClick:E},{default:()=>[e.value.value?"保存":"保存并启用"]})]})}]:[]]}),submit:async(e,r)=>(await r(),await w(e.value))});return k({onConfirm:E}),(r,a)=>{const t=e;return p(),n("div",{class:f(["h-full",{"p-2rem":d(U)}])},[d(V)?(p(),v(t,{key:0,width:"36rem"},{content:c(()=>[u(y(d(C)),1)]),_:1})):_("",!0),i(d(I))],2)}}});export{k as default};
