import{i as b,c as x}from"./app-a6cKceqE.js";import{_ as G}from"./app-C3oVnfUH.js";import{_ as N}from"./app-B8JChEZz.js";import{_ as B}from"./app-CignoBaV.js";import{_ as P}from"./app-CQ-vNlMj.js";import{_ as V}from"./app-B2nvVMhu.js";import{_ as w}from"./app-pTasQb95.js";import{_ as A}from"./app-DwtlHtUX.js";import{D as O}from"./app-7GBSHA5C.js";import{aa as D,r as h,J as L,o,g as u,b as r,w as C,a as i,u as s,ae as R,t as y,f as I,h as m,c as $}from"./app-BYcXwl4U.js";import"./app-CLawzVMq.js";import"./app-BeFNDz9n.js";import"./app-BDgR0DSb.js";import"./app-DxjODhok.js";import"./app-DPDEogA0.js";import"./app-D7QVa3_6.js";import"./app-CO4sV-Ic.js";import"./app-yt37eDzA.js";import"./app-BG60hdvp.js";import"./app-BQ5ggxk2.js";import"./app-SxAW7vhf.js";import"./app-D3zbrzdO.js";import"./app-CrjU8lgK.js";import"./app-BHl80pFw.js";function T(){b(this),this.success=this.$NotifyReloadSuccess("保存成功")}const j=i("td",{class:"title"},"启用脚本设置",-1),J=i("td",null,"脚本代码",-1),M={key:0,class:"comment"},E={key:0,class:"green"},U={key:1,class:"red"},z={key:2,class:"red"},H={key:0,href:"/servers/user-scripts",target:"_blank"},X={key:1,class:"comment"},F=i("span",{class:"green"},"管理员审核结果：审核通过。",-1),K=[F],Q={class:"comment"},W={__name:"ScriptConfigBox",props:["id","v-script-config","comment","v-auditing-status"],emits:["change"],setup(l,{emit:a}){const c=l,f=a,d=D("$utils"),{config:t,auditingStatus:p}=function(){let e=c.vScriptConfig;e==null&&(e={isPrior:!1,isOn:!1,code:"",auditingCode:""});let _=null;if(e.auditingCodeMD5!=null&&e.auditingCodeMD5.length>0&&e.auditingCode!=null&&e.auditingCode.length>0&&(e.code=e.auditingCode,c.vAuditingStatus!=null))for(let v=0;v<c.vAuditingStatus.length;v++){let k=c.vAuditingStatus[v];if(k.md5==e.auditingCodeMD5){_=k;break}}return e.code.length==0&&(e.code=`



`),{config:h(e),auditingStatus:h(_)}}(),S=function(){f("change",t.value)},n=function(e){t.value.code=e,S()},g=function(){return d.CURRENT_CTX.teaCommon.teaIsPlus};return L(()=>t.value.isOn,function(){S()}),(e,_)=>(o(),u("div",null,[r(O,null,{default:C(()=>[i("tbody",null,[i("tr",null,[j,i("td",null,[r(A,{modelValue:s(t).isOn,"onUpdate:modelValue":_[0]||(_[0]=v=>s(t).isOn=v)},null,8,["modelValue"])])])]),i("tbody",null,[i("tr",{style:R({opacity:s(t).isOn?1:.5})},[J,i("td",null,[s(p)!=null?(o(),u("p",M,[s(p).isPassed?(o(),u("span",E,"管理员审核结果：审核通过。")):s(p).isRejected?(o(),u("span",U,"管理员审核结果：驳回     驳回理由："+y(s(p).rejectedReason),1)):(o(),u("span",z,[I("当前脚本将在审核后生效，请耐心等待审核结果。 "),g()?(o(),u("a",H,"去审核 »")):m("",!0)]))])):m("",!0),s(p)==null?(o(),u("p",X,K)):m("",!0),r(w,{id:l.id,type:"text/javascript","read-only":!1,onChange:n},{default:C(()=>[I(y(s(t).code),1)]),_:1},8,["id"]),i("p",Q,y(l.comment),1)])],4)])]),_:1})]))}},q={__name:"ScriptGroupConfigBox",props:["v-group","v-auditing-status","v-is-location"],emits:["change"],setup(l,{emit:a}){const c=l,f=a,{group:d,script:t}=function(){let n=c.vGroup;n==null&&(n={isPrior:!1,isOn:!0,scripts:[]}),n.scripts==null&&(n.scripts=[]);let g=null;return n.scripts.length>0&&(g=n.scripts[n.scripts.length-1]),{group:h(n),script:h(g)}}(),p=function(n){d.value.scripts=[n],S()},S=function(){f("change",d.value)};return(n,g)=>(o(),u("div",null,[n.vIsLocation?(o(),$(O,{key:0},{default:C(()=>[n.vIsLocation?(o(),$(V,{key:0,"v-config":s(d)},null,8,["v-config"])):m("",!0)]),_:1})):m("",!0),i("div",{style:R({opacity:!n.vIsLocation||s(d).isPrior?1:.5})},[r(W,{"v-script-config":s(t),"v-auditing-status":n.vAuditingStatus,comment:"在接收到客户端请求之后立即调用。预置req、resp变量。",onChange:p,"v-is-location":n.vIsLocation},null,8,["v-script-config","v-auditing-status","v-is-location"])],4)]))}},Y=["value"],Z=i("h5",{class:"!mb-4"},"请求初始化",-1),tt=i("p",{class:"comment"},"在请求刚初始化时调用，此时自定义报头等尚未生效。",-1),st=i("h5",{class:"group-header"},"准备发送请求",-1),it=i("p",{class:"comment"},"在准备执行请求或者转发请求之前调用，此时自定义报头、源站等已准备好。",-1),nt={__name:"HTTPRequestScriptsConfigBox",props:["vRequestScriptsConfig","v-auditing-status","v-is-location"],setup(l){const a=l,{config:c}=function(){let t=a.vRequestScriptsConfig;return t==null&&(t={}),{config:h(t)}}(),f=function(t){c.value.initGroup=t},d=function(t){c.value.requestGroup=t};return(t,p)=>(o(),u("div",null,[i("input",{type:"hidden",name:"requestScriptsJSON",value:JSON.stringify(s(c))},null,8,Y),Z,tt,i("div",null,[r(q,{"v-group":s(c).initGroup,"v-auditing-status":t.vAuditingStatus,onChange:f,"v-is-location":t.vIsLocation},null,8,["v-group","v-auditing-status","v-is-location"])]),st,it,i("div",null,[r(q,{"v-group":s(c).requestGroup,"v-auditing-status":t.vAuditingStatus,onChange:d,"v-is-location":t.vIsLocation},null,8,["v-group","v-auditing-status","v-is-location"])])]))}},et={key:0},ot=["value"],at={key:1},Nt={__name:"index",setup(l){const a=x(new T);return(c,f)=>(o(),$(G,{ctx:s(a)},{default:C(()=>[s(a).featureIsOn?(o(),u("div",et,[r(P,{action:"$",onSuccess:s(a).success},{default:C(()=>[i("input",{type:"hidden",name:"webId",value:s(a).webId},null,8,ot),r(nt,{"v-request-scripts-config":s(a).requestScriptsConfig,"v-auditing-status":s(a).auditingStatus},null,8,["v-request-scripts-config","v-auditing-status"]),r(B)]),_:1},8,["onSuccess"])])):m("",!0),s(a).featureIsOn?m("",!0):(o(),u("div",at,[r(N)]))]),_:1},8,["ctx"]))}};export{Nt as default};
