import{u as E}from"./chunk-EN4B57RQ-2RHJdNk9.js";import{h as l,j as p}from"./codemirror-core-DIzFijqu.js";import{v as j}from"./react-dom-BT-HHJs9.js";import{v as B,w as I,x as a}from"./index-tO5nu8Yv.js";import{Q as c}from"./qq_manager-5qPnyoE7.js";var O=j((r,s)=>{const{Component:h,children:d,startContent:u,endContent:C,thumbIcon:g,getBaseProps:k,getInputProps:b,getWrapperProps:N,getThumbProps:x,getThumbIconProps:m,getLabelProps:n,getStartContentProps:t,getEndContentProps:e}=E({...r,ref:s}),o=typeof g=="function"?g(m({includeStateProps:!0})):g&&l.cloneElement(g,m()),i=u&&l.cloneElement(u,t()),w=C&&l.cloneElement(C,e());return p.jsxs(h,{...k(),children:[p.jsx("input",{...b()}),p.jsxs("span",{...N(),children:[u&&i,p.jsx("span",{...x(),children:g&&o}),C&&w]}),d&&p.jsx("span",{...n(),children:d})]})});O.displayName="HeroUI.Switch";var A=O;const f=r=>JSON.parse(JSON.stringify(r)),P=I.withTypes(),T=B.withTypes(),R=()=>{const r=T(n=>n.config.value),s=P();return{config:r,createNetworkConfig:async(n,t)=>{const e=Object.keys(r.network).reduce((i,w)=>{const S=w;return i.concat(r.network[S].map(y=>y.name))},[]);if(t.name&&e.includes(t.name))throw new Error("已经存在相同的配置项名");const o=f(r);return o.network[n].push(t),await c.setOB11Config(o),s(a(o)),o},refreshConfig:async()=>{const n=await c.getOB11Config();return JSON.stringify(n)===JSON.stringify(r)?r:(s(a(n)),n)},updateConfig:async n=>(await c.setOB11Config(n),s(a(n)),n),updateSingleConfig:async(n,t)=>{const e=f(r);return e[n]=t,await c.setOB11Config(e),s(a(e)),e},updateNetworkConfig:async(n,t)=>{const e=f(r),o=t.name,i=e.network[n].findIndex(w=>w.name===o);if(i===-1)throw new Error("找不到对应的配置项");return e.network[n][i]=t,await c.setOB11Config(e),s(a(e)),e},deleteNetworkConfig:async(n,t)=>{const e=f(r),o=e.network[n].findIndex(i=>i.name===t);if(o===-1)throw new Error("找不到对应的配置项");return e.network[n].splice(o,1),await c.setOB11Config(e),s(a(e)),e},enableNetworkConfig:async(n,t)=>{const e=f(r),o=e.network[n].findIndex(i=>i.name===t);if(o===-1)throw new Error("找不到对应的配置项");return e.network[n][o].enable=!e.network[n][o].enable,await c.setOB11Config(e),s(a(e)),e},enableDebugNetworkConfig:async(n,t)=>{const e=f(r),o=e.network[n].findIndex(i=>i.name===t);if(o===-1)throw new Error("找不到对应的配置项");return e.network[n][o].debug=!e.network[n][o].debug,await c.setOB11Config(e),s(a(e)),e},mergeConfig:async n=>{const t=f(r);return Object.assign(t,n),await c.setOB11Config(t),s(a(t)),t},saveConfigWithoutNetwork:async n=>(n.network=r.network,await c.setOB11Config(n),s(a(n)),n)}};export{A as s,R as u};
