import{E as e,r as s,z as n}from"./vendor-s2rfM_Vj.js";import{d as o,u as r,a as t,c as a,f as i}from"./newtab-BWIjnu6l.js";import{D as l,R as d,g as c,B as f}from"./t-r-vendor-gn7FMrPE.js";import"./index-Bf7N7lFc.js";import"./constant-Dkm_Y9q1.js";import"./apis-DdFSvwR4.js";const h=e("div")({name:"DiffUI",class:"d1cd68i5",propsAsIs:!1}),m=e("header")({name:"DiffHeaderUI",class:"df4tlw",propsAsIs:!1}),u=e("div")({name:"DiffContentUI",class:"d1tx8qmj",propsAsIs:!1}),g=e("div")({name:"DiffItemUI",class:"dunb177",propsAsIs:!1}),p=e("div")({name:"DiffItemTitleUI",class:"dvqaj8r",propsAsIs:!1}),I=e("div")({name:"DiffItemContentUI",class:"dg03nzh",propsAsIs:!1}),v=e("footer")({name:"DiffFooterUI",class:"d1pubr65",propsAsIs:!1}),j="_diff-dialog_suknf_1",x=({})=>{const e=o((e=>e.diffInfo)),x=o((e=>e.setDiffInfo)),y=Object.keys(e),b={backgroundInfo:"背景",styleInfo:"定制",navigationInfo:"导航"},{handleMessage:k}=i(),w=r((e=>e.setBackgroundInfo)),A=t((e=>e.setStyleInfo)),{setNavigationInfo:D}=a(),[C,O]=s.useState((()=>e?y.reduce(((s,n)=>e[n].equal?s:[...s,{title:n,mergeType:"both"}]),[]):[]));console.log("%c 💗 mergeDiffInfo ","color: #f00",C);const U=(s,n)=>{const o=e[s],r=C.find((e=>e.title===s)).mergeType;switch(console.warn("WAYLON info",o),r){case"current":n(o.origin);break;case"introduce":n(o.target);break;case"both":Array.isArray(o.origin)?n([...o.origin,...o.target.filter((e=>!o.origin.some((s=>s.id===e.id))))]):n({...o.origin,...o.target})}};return n.jsx(l,{className:j,style:{padding:8,overflow:"visible",backgroundColor:"var(--theme-black7)",backdropFilter:"url(#ovo-filter) brightness(1.1)",boxShadow:"var(--shadow-elevation-medium)"},width:"var(--setting-dialog-width)",visible:!!e&&y.length>0&&C.length>0,mode:"modal",onClose:()=>x(!1),preventScrollThrough:!0,showOverlay:!0,theme:"default",footer:!1,header:!1,closeBtn:!1,closeOnEscKeydown:!1,closeOnOverlayClick:!1,confirmOnEnter:!1,destroyOnClose:!0,children:n.jsxs(h,{children:[n.jsxs(m,{children:[n.jsx("p",{children:"下列信息存在冲突！"}),n.jsx("span",{children:"请谨慎选择数据合并的方式，避免数据丢失！"})]}),n.jsx(u,{children:C.map((({title:e,mergeType:s})=>n.jsxs(g,{children:[n.jsxs(p,{children:[b[e],":"," "]}),n.jsx(I,{children:n.jsxs(d.Group,{value:s,onChange:s=>((e,s)=>{O((n=>n.map((n=>n.title===e?{...n,mergeType:s}:n))))})(e,s),variant:"primary-filled",defaultValue:"introduce",style:{justifyContent:"space-evenly",width:"100%"},children:[n.jsx(d.Button,{value:"current",children:"当前版本"}),n.jsx(d.Button,{value:"introduce",children:"传入版本"}),n.jsx(d.Button,{value:"both",children:"合并差异"})]})})]},e)))}),n.jsx(v,{children:n.jsx(c,{content:"确认以目前的勾选方式变更信息",theme:"danger",onConfirm:()=>{e&&(e.backgroundInfo.equal||U("backgroundInfo",w),e.styleInfo.equal||U("styleInfo",A),e.navigationInfo.equal||U("navigationInfo",D),k.success("变更成功"),x(!1))},children:n.jsx(f,{theme:"danger",children:"确认变更"})})})]})})};export{x as default};
