import{E as e,r as s,z as a,C as t}from"./vendor-s2rfM_Vj.js";import{Q as i,d as n,Y as o,Z as r,t as l}from"./apis-DdFSvwR4.js";import{a as c}from"./constant-Dkm_Y9q1.js";import{c as d,d as p,A as m,e as x}from"./newtab-BWIjnu6l.js";import{G as u}from"./GroupSelector-DE_oQW1L.js";import{l as h,I as v,C as j,B as g,S as I}from"./t-r-vendor-gn7FMrPE.js";import"./index-Bf7N7lFc.js";import"./Index-DDcvGMwD.js";const f=e("div")({name:"WrapUI",class:"w1kohdsn",propsAsIs:!1}),A=e("div")({name:"HeaderUI",class:"hkbxwqh",propsAsIs:!1}),k=e("h1")({name:"TitleUI",class:"trjsenl",propsAsIs:!1}),C=e("div")({name:"ContentUI",class:"cebudk1",propsAsIs:!1}),_=e("div")({name:"ContentLeftUI",class:"cduiisw",propsAsIs:!1}),z=e("div")({name:"ContentRightUI",class:"ccwav9v",propsAsIs:!1}),w=e("div")({name:"InputWrapUI",class:"i1fn8kwx",propsAsIs:!1}),b=e("div")({name:"ColorPickerWrapUI",class:"c16n5ktw",propsAsIs:!1}),S=e("img")({name:"ImageUI",class:"i1qxwtp6",propsAsIs:!1}),N=e("div")({name:"AvatarWrapUI",class:"ankx26s",propsAsIs:!1,vars:{"ankx26s-0":[({size:e})=>e],"ankx26s-1":[({active:e})=>e?1:0],"ankx26s-2":[({active:e})=>e?"3px":0],"ankx26s-3":[({active:e})=>e?"6px":0]}}),U=e("footer")({name:"FooterUI",class:"f1o3r3nh",propsAsIs:!1}),E="_image-enter_dzahr_1",F="_image-enter-active_dzahr_5",y="_image-exit_dzahr_14",P="_image-exit-active_dzahr_18",W="_image-exit-done_dzahr_23",G="_color-picker_dzahr_27",M=({handleVisible:e})=>{const{currentNavId:M,navigationInfo:O}=d(),[T,V]=s.useState(O.find((e=>e.id===M))),q=p((e=>e.addAppOption)),[D,H]=s.useState("https://"),[R,B]=s.useState(q&&q.url||""),[L,Q]=s.useState(q&&q.name||""),[X,Y]=s.useState(""),[Z,J]=s.useState((()=>getComputedStyle(document.documentElement).getPropertyValue("--td-brand-color-6").trim())),[K,$]=s.useState(!1),ee=a.jsx(I,{autoWidth:!0,size:"large",showArrow:!1,value:D,onChange:e=>H(e),options:["http://","https://"].map((e=>({label:e,value:e})))}),se=s.useMemo((()=>i(D+R)),[R]),ae=s.useMemo((()=>!!(null==X?void 0:X.length)),[X]),te=s.useCallback(n((async(e,s)=>{const a=e+s,t=await o(a);if(se&&t){const{code:e,data:s,msg:t}=await r(a);200===e?Y(s):console.log(t)}else Y("")}),1e3),[se]),{setCurrentNavApps:ie,setCurrentNavId:ne}=d();return s.useEffect((()=>{$(!X)}),[X]),s.useEffect((()=>{se&&te(D,R)}),[R]),a.jsxs(f,{children:[a.jsxs(A,{children:[a.jsx(k,{children:"自定义应用"}),a.jsx(u,{targetNav:T,setTargetNav:V})]}),a.jsxs(C,{children:[a.jsxs(_,{children:[a.jsx(w,{children:a.jsx(h,{prepend:ee,children:a.jsx(v,{placeholder:"请输入网址",suffixIcon:a.jsx("i",{className:"ovo link"}),size:"large",value:R,onChange:B})})}),a.jsx(w,{children:a.jsx(v,{placeholder:"请输入应用名称",suffixIcon:a.jsx("i",{className:"ovo edit"}),size:"large",value:L,onChange:Q})}),a.jsx(t,{in:K,timeout:500,classNames:{enter:E,enterActive:F,exit:y,exitActive:P,exitDone:W},unmountOnExit:!0,children:a.jsxs(b,{className:G,children:[a.jsxs("label",{children:[a.jsx("i",{className:"ovo color",style:{marginRight:8}}),"背景色:"," "]}),a.jsx(j,{value:Z,onChange:J,colorModes:["monochrome"],popupProps:{placement:"right"},showPrimaryColorPreview:!1,format:"HEX"})]})})]}),a.jsxs(z,{children:[a.jsx(N,{size:"100px",active:K?1:0,onClick:()=>$(!0),children:a.jsx(m,{text:L||"V",size:"100px",fontSize:"56px",bg:Z,color:"#FFFFFF"})}),a.jsx(t,{in:ae,timeout:500,classNames:{enter:E,enterActive:F,exit:y,exitActive:P,exitDone:W},unmountOnExit:!0,children:a.jsx(N,{size:"100px",active:K?0:1,onClick:()=>$(!1),children:a.jsx(S,{loading:"lazy",src:X,draggable:"false"})})})]})]}),a.jsx(U,{children:a.jsx(g,{disabled:!L||!se,onClick:()=>{const s={id:l(),name:L,size:"1*1",icon:K?"":X,url:D+R,type:c.website,background:q&&!K?"transparent":Z};setTimeout((()=>{ne(null==T?void 0:T.id);const e=[...(null==T?void 0:T.apps)??[],s];ie(e),void 0!==(null==T?void 0:T.id)&&V({...T,apps:e}),x(s)}),200),e(!1)},children:"添加"})})]})};export{M as default};
