import{z as e,E as t,G as s,F as i,r as n}from"./vendor-s2rfM_Vj.js";import{Q as l,o as a,R as r}from"./apis-DdFSvwR4.js";import{a as o,u as c,n as d,f as h}from"./newtab-BWIjnu6l.js";import{C as g,d as x,e as u,S as p,O as m,W as j}from"./constant-Dkm_Y9q1.js";import{i as v,j as w,B as f,h as y,k as b,L as C,l as k,I as S,S as z}from"./t-r-vendor-gn7FMrPE.js";import"./index-Bf7N7lFc.js";const I=""+new URL("jump2workPage-D5XAemP3.png",import.meta.url).href,F=""+new URL("quickChangeSE-C4g2YpTq.png",import.meta.url).href,E=t("p")({name:"TextUI",class:"t1xd3qu5",propsAsIs:!1,vars:{"t1xd3qu5-0":[e=>e.active?"var(--theme-white8)":""]}}),B=t("div")({name:"ColorBoxUI",class:"cr7za3w",propsAsIs:!1,vars:{"cr7za3w-0":[e=>e.color1],"cr7za3w-1":[e=>e.color2]}}),A=t("div")({name:"WrapUI",class:"w1ppz0hg",propsAsIs:!1});function L(t){return e.jsxs(A,{onClick:t.onClick,children:[e.jsx(B,{color1:t.color1,color2:t.color2}),e.jsx(E,{active:t.active?1:0,children:t.title})]})}const O=t("div")({name:"SettingUI",class:"sl4xlgk",propsAsIs:!1,vars:{"sl4xlgk-0":[e=>e.alignitems||"center"]}}),R=t("label")({name:"LabelUI",class:"lzxr7bk",propsAsIs:!1}),T=t("div")({name:"ContentUI",class:"c1dchhpk",propsAsIs:!1}),U=t=>e.jsxs(O,{alignitems:t.alignItems,children:[e.jsx(R,{children:t.title}),e.jsx(T,{children:t.children})]}),N=t("h1")({name:"TitleUI",class:"t1vdw8wy",propsAsIs:!1,vars:{"t1vdw8wy-0":[e=>e.mt?"16px":"0"],"t1vdw8wy-1":[e=>e.isblack?"var(--white9)":"var(--td-brand-color-6)"]}}),W=t=>{const s=o((e=>e.isBlack));return e.jsx(N,{isblack:s?1:0,mt:t.mt??1,children:t.children})},q=s`
  width: var(--setting-wrap-width);
  transition: all 0.2s ease-in-out;
`,$=i.main`
  width: 100%;
  height: 100%;
  padding: 16px 48px 200px 16px;
  overflow: auto;
  .ovo-weather-loading {
    border-radius: 4px;
    opacity: 0.5;
  }
`,M=i.div`
  ${q}
  display: flex;
  flex-flow: row wrap;
  justify-content: left;
  align-items: center;
`,P=i.div`
  ${q}
`,G=i.div`
  border-radius: 4px;
  > h1 {
    transition: all 0.3s ease-in-out;
  }
  @keyframes setting-flash {
    0% {
    }
    20% {
      color: var(--td-brand-color-7);
    }
    50% {
      color: var(--td-brand-color-7);
      text-shadow: 0 0 4px var(--td-brand-color-3);
    }
    60% {
      color: var(--td-brand-color-7);
      text-shadow: 0 0 4px var(--td-brand-color-3);
    }
    100% {
    }
  }
  &.ovo-setting-active > h1 {
    animation: setting-flash 2s alternate;
  }
`,V=i.div`
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  text-align: right;
`,Y=i.div`
  font-size: 12px;
  color: ${({highlight:e})=>e?"var(--td-brand-color-8)":""};
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transform: scale(0.8);
  transform-origin: center;
  transition: all 0.2s ease-in;
  user-select: none;
  &:hover {
    color: var(--td-brand-color-9);
    transform: scale(1);
    background-color: var(--white1);
  }
`,D=i.div`
  display: flex;
  align-items: center;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 8px;
  &:hover {
    background-color: var(--white1);
    iframe {
      pointer-events: none;
    }
  }
`,J=i.div`
  display: flex;
  align-items: center;
  .t-input-adornment {
    height: 24px;
    .t-input--auto-width {
      height: 24px;
      .t-input {
        height: 24px;
        .t-fake-arrow {
          color: var(--theme-white9);
        }
      }
    }
  }
  .t-input--auto-width {
    min-height: 30px;
  }
`,Q=()=>{const t=o((e=>e.isBlack)),s=o((e=>e.setIsBlack)),i=()=>{s(!t);document.getElementsByTagName("html")[0].setAttribute("ovo-theme",t?"light":"dark")},E=o((e=>e.themeColor)),B=o((e=>e.setThemeColor)),A=o((e=>e.clock)),O=o((e=>e.setClock)),R=o((e=>e.setAppSetting)),T=o((e=>e.appSetting)),N=o((e=>e.searchSetting)),q=o((e=>e.setSearchSetting)),Q=o((e=>e.navigation)),X=o((e=>e.setNavigation)),H=o((e=>e.simpleMode)),K=o((e=>e.setSimpleMode)),Z=c((e=>e.backgroundInfo)),_=c((e=>e.setBackgroundInfo)),ee=o((e=>e.oneLang)),te=o((e=>e.setOneLang)),se=o((e=>e.weatherStyle)),ie=o((e=>e.setWeatherStyle)),[ne,le]=n.useState("主题"),[ae,re]=n.useState(0),oe=o((e=>e.jumpWorkPage)),[ce,de]=n.useState(oe.split("://")[0]?oe.split("://")[0]+"://":"https://"),[he,ge]=n.useState(oe.split("://")[1]),{handleMessage:xe}=h(),ue=o((e=>e.setJumpWorkPage)),pe=e.jsx(z,{autoWidth:!0,options:["http://","https://"].map((e=>({label:e}))),defaultValue:"http://",value:ce,onChange:e=>de(e)}),me=n.useMemo((()=>{var s,n,o,c,h,z,W;return[{title:"主题",mt:0,content:e.jsxs(e.Fragment,{children:[e.jsx(U,{title:"浅色模式",children:e.jsx(v,{size:"large",value:!t,onChange:i})}),e.jsx(U,{title:"主题色",alignItems:"flex-start",children:e.jsx(M,{children:g.map((t=>e.jsx(L,{...t,active:E===t.id,onClick:()=>(async e=>{E!==e.id&&(B(e.id),await a(e.path),g.forEach((t=>{e.id!==t.id&&r(t.path)})))})(t)},t.title)))})})]})},{title:"时钟",content:e.jsxs(e.Fragment,{children:[" ",e.jsx(U,{title:"显示",children:e.jsx(v,{size:"large",value:A.show,onChange:e=>O("show",e)})}),e.jsx(U,{title:"日期",children:e.jsx(v,{size:"large",value:A.date,onChange:e=>O("date",e)})}),e.jsx(U,{title:"秒数",children:e.jsx(v,{size:"large",value:A.second,onChange:e=>O("second",e)})}),e.jsx(U,{title:"样式",children:e.jsx(w,{options:x,onClick:({value:e})=>"number"==typeof e&&O("type",+e),children:e.jsx(f,{ghost:!0,style:{fontSize:12,height:26},children:(null==(s=x.find((e=>e.value===A.type)))?void 0:s.content)??"无特效"})})})]})},{title:"图标",content:e.jsxs(e.Fragment,{children:[e.jsx(U,{title:"显示名称",children:e.jsx(v,{size:"large",value:T.showName,onChange:e=>R("showName",e)})}),e.jsx(U,{title:"透明度",children:e.jsx(P,{children:e.jsx(y,{label:({value:e})=>`${e}%`,value:T.opacity,onChange:e=>R("opacity",e)})})}),e.jsx(U,{title:"触感",children:e.jsx(w,{options:u,onClick:({value:e})=>R("hover",e),children:e.jsx(f,{ghost:!0,style:{fontSize:12,height:26},children:(null==(n=u.find((e=>e.value===T.hover)))?void 0:n.content)??"无特效"})})})]})},{title:"背景",content:e.jsxs(e.Fragment,{children:[e.jsx(U,{title:"毛玻璃",children:e.jsx(P,{children:e.jsx(y,{label:({value:e})=>`${e}%`,value:Z.backgroundBlur,onChange:e=>_({...Z,backgroundBlur:e})})})}),e.jsx(U,{title:"饱和度",children:e.jsx(P,{children:e.jsx(y,{label:({value:e})=>+e/2+"%",value:(null==Z?void 0:Z.backgroundSaturate)??100,min:0,max:200,onChange:e=>_({...Z,backgroundSaturate:e})})})})]})},{title:"搜索",content:e.jsxs(e.Fragment,{children:[e.jsx(U,{title:"搜索引擎",children:e.jsx(d,{SE:p,cur:N.curSE,itemWidth:28,setCurSE:e=>q("curSE",e)})}),e.jsx(U,{title:"自动翻译",children:e.jsx(v,{size:"large",value:N.showTranslate,onChange:e=>q("showTranslate",e)})}),(null==(c=null==(o=null==window?void 0:window.chrome)?void 0:o.storage)?void 0:c.sync)&&e.jsx(U,{title:"过滤广告",children:e.jsx(b,{content:"目前支持的站点: 百度、Bing",destroyOnClose:!0,showArrow:!0,theme:"default",children:e.jsx(v,{size:"large",value:N.adsFilter,onChange:e=>q("adsFilter",e)})})}),(null==(z=null==(h=null==window?void 0:window.chrome)?void 0:h.storage)?void 0:z.sync)&&e.jsx(U,{title:"快捷切换引擎",children:e.jsx(b,{content:e.jsx("div",{style:{padding:"4px 8px"},children:e.jsx("img",{src:F,alt:"case",style:{width:400,height:"auto",borderRadius:4,opacity:.8}})}),destroyOnClose:!0,showArrow:!0,theme:"default",children:e.jsx(v,{size:"large",value:N.quickChangeSE,onChange:e=>q("quickChangeSE",e)})})})]})},{title:"格言",content:e.jsxs(e.Fragment,{children:[e.jsx(U,{title:"开启",children:e.jsx(v,{size:"large",value:null==ee?void 0:ee.show,onChange:e=>te("show",e)})}),e.jsx(U,{title:"位置",children:e.jsx(w,{options:m,onClick:({value:e})=>te("position",e),children:e.jsx(f,{ghost:!0,style:{fontSize:12,height:26},children:(null==(W=m.find((e=>e.value===ee.position)))?void 0:W.content)??"正上"})})})]})},{title:"天气",content:e.jsxs(e.Fragment,{children:[e.jsx(U,{title:"显示",children:e.jsx(v,{size:"large",value:null==se?void 0:se.show,onChange:e=>ie("show",e)})}),e.jsx(U,{title:"样式",children:e.jsx(C,{size:"small",className:"ovo-weather-loading",loading:ae<Object.keys(j).length/2,showOverlay:!0,children:Object.keys(j).filter((e=>!isNaN(Number(e)))).map(((s,i)=>e.jsxs(D,{id:s,style:{opacity:ae<Object.keys(j).length/2?0:1,transition:"opacity 0.5s"},onClick:()=>ie("style",s),children:[e.jsxs("span",{style:{marginRight:8},children:["样式 ",i+1]}),e.jsx("iframe",{width:"300",height:"20px",scrolling:"no",src:`https://i.tianqi.com?c=code&id=${s}&color=%23${t?"FFFFFF":"000000"}&icon=1&site=12&lang=cn`,sandbox:"allow-scripts allow-same-origin",onLoad:()=>{re((e=>e+1))}})]},s)))})})]})},{title:"侧边栏",content:e.jsx(e.Fragment,{children:e.jsx(U,{title:"一直显示",children:e.jsx(v,{size:"large",value:Q.alwaysShow,onChange:e=>(e=>{X("show",e),X("alwaysShow",e)})(e)})})})},{title:"一键跳转",content:e.jsx(e.Fragment,{children:e.jsx(U,{title:"目标网址",children:e.jsx(b,{content:e.jsxs("div",{style:{padding:"4px 8px"},children:[e.jsx("img",{src:I,alt:"case",style:{width:400,height:"auto",borderRadius:4,opacity:.8}}),e.jsx("p",{children:"同时按下Shift+W,快捷跳转指定页面"}),e.jsx("b",{children:"适用场景"}),e.jsx("p",{children:"1.快速打开常用页面"}),e.jsx("p",{children:"2.上班摸鱼，需要快速切换到工作页面"})]}),destroyOnClose:!0,showArrow:!0,placement:"right-bottom",theme:"default",children:e.jsxs(J,{children:[e.jsx(k,{prepend:pe,children:e.jsx(S,{value:he,size:"small",placeholder:"请输入网址,点击【确认】",onChange:ge})}),e.jsx(f,{style:{marginLeft:4},size:"small",onClick:()=>{const e=he?ce+he:"";l(e)?(xe.success("设置成功"),ue(e)):xe.warning("请输入正确的网址")},children:"保存"})]})})})})},{title:"简易模式",content:e.jsxs(e.Fragment,{children:[e.jsx(U,{title:"开启",children:e.jsx(v,{size:"large",value:H.isSimple,onChange:e=>K("isSimple",e)})}),e.jsx(U,{title:"开关常驻",children:e.jsx(v,{size:"large",value:H.alwaysShow,onChange:e=>K("alwaysShow",e)})})]})}]}),[t,E,A,T,Z,N,Q,H,ee,se,ae,oe,he,ce]),je=n.useRef(null),[ve,we]=n.useState(me.map(((e,t)=>({title:e.title,id:e.title,highlight:0===t}))));return n.useEffect((()=>{const e=()=>{const e=je.current&&je.current.getBoundingClientRect(),t=e.top+e.height/2,s=je.current.scrollTop;let i=0,n=1/0;s<=0?i=0:me.forEach(((e,s)=>{const l=document.getElementById(e.title),a=l&&l.getBoundingClientRect(),r=a.top+a.height/2,o=Math.abs(t-r);o<n&&(i=s,n=o)}));const l=ve.map(((e,t)=>({...e,highlight:t===i})));we(l)};return je.current&&je.current.addEventListener("scroll",e,{passive:!0}),()=>{je.current&&je.current.removeEventListener("scroll",e)}}),[ve]),n.useEffect((()=>{const e=document.getElementById(ne);null==e||e.classList.add("ovo-setting-active"),setTimeout((()=>{null==e||e.classList.remove("ovo-setting-active")}),1500)}),[ne]),e.jsxs($,{ref:je,children:[me.map((t=>e.jsxs(G,{id:t.title,children:[e.jsx(W,{mt:(null==t?void 0:t.mt)??1,children:t.title}),t.content]},t.title))),e.jsx(V,{children:ve.map((t=>e.jsx(Y,{highlight:t.highlight?1:0,onClick:()=>(e=>{const t=document.getElementById(e.id);le(e.id),null==t||t.scrollIntoView({behavior:"smooth",block:"center"})})(t),children:t.title},t.id)))})]})};export{Q as default};
