import{r as f,o as a,g as _,a as t,u as o,f as c,b as d,L as T,F as w,D as P,w as n,c as h,h as m,t as O,d as v,e as y,i as b}from"./app-BYcXwl4U.js";import{_ as S}from"./app-Wy4FFEmL.js";import{a as r,_ as $}from"./app-DxbU-QrX.js";import{P as W}from"./app-0YmIdYYs.js";import{_ as D}from"./app-Ufpj4Ll4.js";const H=["value"],A={class:"ui fields inline"},E=t("div",{class:"ui field",style:{"padding-left":"0.1em",width:"6.8em",color:"grey"}},"源站协议",-1),J=t("div",{class:"ui field",style:{width:"21em",color:"grey"}},"源站地址（Host:Port）",-1),L={class:"ui field flex items-center",style:{color:"grey"}},R={class:"ui fields inline",style:{"margin-top":"0.6em"}},I={class:"ui field"},M={key:2,label:"对象存储"},j={class:"ui field"},q={class:"ui field"},z={class:"ui field"},G=["onClick"],K=t("i",{class:"icon remove icon small"},null,-1),Q=[K],X={style:{"margin-top":"1em"}},oe={__name:"OriginInputBox",props:["v-family","v-oss-types"],setup(x,{expose:C}){const k=x,V=f(),{origins:p,isAdding:Y,family:i,ossTypes:g}=function(){let s=k.vFamily;s==null&&(s="http");let l=k.vOssTypes;return l==null&&(l=[]),{origins:f([]),isAdding:f(!1),family:f(s),ossTypes:f(l)}}(),B=function(){let s="";switch(i.value){case"http":s="http";break;case"tcp":s="tcp";break;case"udp":s="udp";break}p.value.push({id:"",host:"",isPrimary:!0,isPrimaryValue:1,scheme:s}),setTimeout(function(){let l=V.value;l!=null&&l[l.length-1].focus()},10)},N=function(s){p.value.$remove(s)},U=function(s){s.isPrimary=s.isPrimaryValue==1};return C({changeFamily:function(s){i.value=s,p.value.forEach(function(l){let e="";switch(i.value){case"http":e="http";break;case"tcp":e="tcp";break;case"udp":e="udp";break}l.scheme=e})}}),(s,l)=>(a(),_("div",null,[t("input",{type:"hidden",name:"originsJSON",value:JSON.stringify(o(p))},null,8,H),t("div",null,[t("div",A,[E,J,t("div",L,[c("优先级  "),d(S,{content:"优先级：优先使用主源站，如果主源站无法连接时才会连接备用源站"})])]),d(T),(a(!0),_(w,null,P(o(p),(e,F)=>(a(),_("div",null,[t("div",R,[t("div",I,[d($,{modelValue:e.scheme,"onUpdate:modelValue":u=>e.scheme=u},{default:n(()=>[o(i)=="http"?(a(),h(r,{key:0,value:"http"},{default:n(()=>[c("http://")]),_:1})):m("",!0),o(i)=="http"?(a(),h(r,{key:1,value:"https"},{default:n(()=>[c("https://")]),_:1})):m("",!0),o(i)=="http"&&o(g).length>0?(a(),_("optgroup",M)):m("",!0),o(i)=="http"?(a(!0),_(w,{key:3},P(o(g),u=>(a(),h(r,{value:u.code},{default:n(()=>[c(O(u.name),1)]),_:2},1032,["value"]))),256)):m("",!0),o(i)=="tcp"?(a(),h(r,{key:4,value:"tcp"},{default:n(()=>[c("tcp://")]),_:1})):m("",!0),o(i)=="tcp"?(a(),h(r,{key:5,value:"tls"},{default:n(()=>[c("tls://")]),_:1})):m("",!0),o(i)=="udp"?(a(),h(r,{key:6,value:"udp"},{default:n(()=>[c("udp://")]),_:1})):m("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),t("div",j,[v(t("div",null,' 请在创建网站后，再在对应网站设置"源站"功能中进行添加对象存储源站。 ',512),[[y,e.scheme!=null&&e.scheme.startsWith("oss:")]]),v(t("div",null,[d(D,{type:"text",placeholder:"源站地址",modelValue:e.host,"onUpdate:modelValue":u=>e.host=u,ref_for:!0,ref_key:"originHostRef",ref:V,style:{width:"20em"}},null,8,["modelValue","onUpdate:modelValue"])],512),[[y,!e.scheme.startsWith("oss:")]])]),t("div",q,[v(t("div",null,null,512),[[y,e.scheme!=null&&e.scheme.startsWith("oss:")]]),v(t("div",null,[d($,{modelValue:e.isPrimaryValue,"onUpdate:modelValue":u=>e.isPrimaryValue=u,onChange:u=>U(e)},{default:n(()=>[d(r,{value:"1"},{default:n(()=>[c("主")]),_:1}),d(r,{value:"0"},{default:n(()=>[c("备")]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])],512),[[y,!e.scheme.startsWith("oss:")]])]),t("div",z,[t("a",{href:"",title:"删除",onClick:b(u=>N(F),["prevent"])},Q,8,G)])])]))),256))]),t("div",X,[d(W,{type:"button",onClick:l[0]||(l[0]=b(e=>B(),["prevent"]))})])]))}};export{oe as _};
