const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BookShelf-DmN0EcU9.js","./vendor-B4RITwN5.js","./vendor-C9cXVWQA.css","./loading-BSPlXMjv.js","./loading-CBQeIji2.css","./BookShelf-Bs01BdYY.css","./BookChapter-BDwWiA-_.js","./BookChapter-B8PYup72.css","./config-MMLbq8EV.js","./config-B2IgxNHB.css"])))=>i.map(i=>d[i]); import{o as u,c as C,r as Ie,a as se,b as le,d as x,e as d,w as c,f,u as s,l as O,g,F as P,E as Ve,h as ge,p as Te,i as Ne,j as D,k as $e,m as w,n as me,s as Y,q as G,t as X,v as Se,x as _e,y as ie,z as Re,A as H,B as fe,C as Le,D as Oe,G as ue,V as Pe,H as De,I as Z,J as Je,K as ye,L as Ae,M as R,N as je,O as Ke,P as j,Q as be,R as ke,S as q,T as He,U as Me,W as qe,X as Fe,Y as We,Z as ze,_ as Ge,$ as Qe,a0 as Xe,a1 as Ye}from"./vendor-B4RITwN5.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function o(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(n){if(n.ep)return;n.ep=!0;const l=o(n);fetch(n.href,l)}})();const Ze="modulepreload",et=function(e,t){return new URL(e,t).href},de={},ne=function(t,o,r){let n=Promise.resolve();if(o&&o.length>0){const l=document.getElementsByTagName("link"),i=document.querySelector("meta[property=csp-nonce]"),b=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));n=Promise.all(o.map(p=>{if(p=et(p,r),p in de)return;de[p]=!0;const k=p.endsWith(".css"),V=k?'[rel="stylesheet"]':"";if(!!r)for(let a=l.length-1;a>=0;a--){const y=l[a];if(y.href===p&&(!k||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${p}"]${V}`))return;const _=document.createElement("link");if(_.rel=k?"stylesheet":Ze,k||(_.as="script",_.crossOrigin=""),_.href=p,b&&_.setAttribute("nonce",b),document.head.appendChild(_),k)return new Promise((a,y)=>{_.addEventListener("load",a),_.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${p}`)))})}))}return n.then(()=>t()).catch(l=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l})},J=(e,t)=>{const o=e.__vccOpts||e;for(const[r,n]of t)o[r]=n;return o},tt={};function ot(e,t){const o=Ie("router-view");return u(),C(o)}const nt=J(tt,[["render",ot]]),ve=[{path:"/",name:"shelf",component:()=>ne(()=>import("./BookShelf-DmN0EcU9.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)},{path:"/chapter",name:"chapter",component:()=>ne(()=>import("./BookChapter-BDwWiA-_.js"),__vite__mapDeps([6,1,2,3,4,7]),import.meta.url)}];se({history:le(),routes:ve});const B=e=>(Te("data-v-35b7188a"),e=e(),Ne(),e),rt=B(()=>g("br",null,null,-1)),st=B(()=>g("br",null,null,-1)),lt=B(()=>g("br",null,null,-1)),it=B(()=>g("br",null,null,-1)),at=B(()=>g("br",null,null,-1)),ct=B(()=>g("br",null,null,-1)),ut=B(()=>g("br",null,null,-1)),dt=B(()=>g("br",null,null,-1)),pt=B(()=>g("br",null,null,-1)),ht=B(()=>g("br",null,null,-1)),gt=B(()=>g("br",null,null,-1)),mt={style:{"margin-top":"20px"}},St=B(()=>g("code",null,"^$()[]{}.?+*|",-1)),_t=B(()=>g("br",null,null,-1)),ft=B(()=>g("code",null,"(?s)",-1)),yt=B(()=>g("br",null,null,-1)),bt=B(()=>g("code",null,"(?m)",-1)),kt=B(()=>g("br",null,null,-1)),vt=B(()=>g("code",null,"(?i)",-1)),Ct=B(()=>g("br",null,null,-1)),wt={__name:"SourceHelp",setup(e){return(t,o)=>{const r=Ve,n=ge;return u(),x(P,null,[d(r,{icon:s(O),href:"/help/#appHelp",target:"_blank"},{default:c(()=>[f("APP帮助文档")]),_:1},8,["icon"]),rt,d(r,{icon:s(O),href:"/help/#ruleHelp",target:"_blank"},{default:c(()=>[f("书源制作教程")]),_:1},8,["icon"]),st,d(r,{icon:s(O),href:"/help/#jsHelp",target:"_blank"},{default:c(()=>[f("js变量和函数")]),_:1},8,["icon"]),lt,d(r,{icon:s(O),href:"/help/#xpathHelp",target:"_blank"},{default:c(()=>[f("xpath语法教程")]),_:1},8,["icon"]),it,d(r,{icon:s(O),href:"/help/#regexHelp",target:"_blank"},{default:c(()=>[f("正则表达式教程")]),_:1},8,["icon"]),at,d(r,{icon:s(O),href:"/help/#txtTocRuleHelp",target:"_blank"},{default:c(()=>[f("txt目录正则说明")]),_:1},8,["icon"]),ct,d(r,{icon:s(O),href:"/help/#debugHelp",target:"_blank"},{default:c(()=>[f("书源调试说明")]),_:1},8,["icon"]),ut,d(r,{icon:s(O),href:"/help/#httpTTSHelp",target:"_blank"},{default:c(()=>[f("在线朗读规则")]),_:1},8,["icon"]),dt,d(r,{icon:s(O),href:"/help/#webDavBookHelp",target:"_blank"},{default:c(()=>[f(" WebDav书籍简明使用教程")]),_:1},8,["icon"]),pt,d(r,{icon:s(O),href:"/help/#webDavHelp",target:"_blank"},{default:c(()=>[f(" WebDav备份教程")]),_:1},8,["icon"]),ht,d(r,{icon:s(O),href:"https://regexr-cn.com/",target:"_blank"},{default:c(()=>[f("正则表达式在线验证工具")]),_:1},8,["icon"]),gt,g("div",mt,[g("span",null,[d(n,null,{default:c(()=>[St,f(" 这些是Java正则特殊符号,匹配需转义")]),_:1})]),_t,g("span",null,[d(n,null,{default:c(()=>[ft,f(" 前缀表示跨行解析")]),_:1})]),yt,g("span",null,[d(n,null,{default:c(()=>[bt,f(" 前缀表示逐行匹配")]),_:1})]),kt,g("span",null,[d(n,null,{default:c(()=>[vt,f(" 前缀表示忽略大小写")]),_:1})]),Ct])],64)}}},Bt=J(wt,[["__scopeId","data-v-35b7188a"]]),Ut=1e3,Ce=D(localStorage.getItem("remoteIp")),U=$e.create({timeout:120*Ut});U.interceptors.request.use(e=>(e.baseURL=ae(),e));const Bo=e=>{Ce.value=e,localStorage.setItem("remoteIp",e)},ae=()=>Ce.value||location.origin,we=()=>{const{hostname:e,port:t}=new URL(ae());return`${e}:${Number(t)+1}`},xt=/source/i.test(location.href),Et=e=>{throw xt&&w({message:"后端错误,检查网络或者阅读app",type:"error"}),e};U.interceptors.response.use(e=>e,Et);const It=()=>U.get("/getReadConfig"),Vt=e=>U.post("/saveReadConfig",e),Tt=e=>U.post("/saveBookProgress",e),Nt=e=>{e&&navigator.sendBeacon(`${ae()}/saveBookProgress`,JSON.stringify(e))},$t=()=>U.get("/getBookshelf"),Rt=e=>U.get("/getChapterList?url="+encodeURIComponent(e)),Lt=(e,t)=>U.get("/getBookContent?url="+encodeURIComponent(e)+"&index="+t),Ot=(e,t,o)=>{const r=`ws://${we()}/searchBook`,n=new WebSocket(r);n.onopen=()=>{n.send(`{"key":"${e}"}`)},n.onmessage=({data:l})=>t(l),n.onclose=()=>{o()}},Pt=e=>U.post("/saveBook",e),Dt=e=>U.post("/deleteBook",e),Q=/bookSource/i.test(location.href),Jt=()=>Q?U.get("/getBookSources"):U.get("/getRssSources"),At=e=>Q?U.post("/saveBookSource",e):U.post("/saveRssSource",e),jt=e=>Q?U.post("/saveBookSources",e):U.post("/saveRssSources",e),Kt=e=>Q?U.post("/deleteBookSources",e):U.post("/deleteRssSources",e),Ht=(e,t,o,r)=>{const n=`ws://${we()}/${Q?"bookSource":"rssSource"}Debug`,l=new WebSocket(n);l.onopen=()=>{l.send(JSON.stringify({tag:e,key:t}))},l.onmessage=({data:i})=>o(i),l.onclose=()=>{w({message:"调试已关闭!",type:"info"}),r()}},K={getReadConfig:It,saveReadConfig:Vt,saveBookProgress:Tt,saveBookProgressWithBeacon:Nt,getBookShelf:$t,getChapterList:Rt,getBookContent:Lt,search:Ot,saveBook:Pt,deleteBook:Dt,getSources:Jt,saveSources:jt,saveSource:At,deleteSource:Kt,debug:Ht},z=e=>e==null||e.length===0||/^\s+$/.test(e),ce=e=>"bookSourceName"in e,Mt=e=>ce(e)?!z(e.bookSourceName)&&!z(e.bookSourceUrl)&&!z(e.bookSourceType):!z(e.sourceName)&&!z(e.sourceName),ee=e=>ce(e)?e.bookSourceUrl:e.sourceUrl,qt=(e,t)=>{var o,r,n,l,i,b,p,k;return ce(e)?(((o=e.bookSourceName)==null?void 0:o.includes(t))||((r=e.bookSourceUrl)==null?void 0:r.includes(t))||((n=e.bookSourceGroup)==null?void 0:n.includes(t))||((l=e.bookSourceComment)==null?void 0:l.includes(t)))??!1:(((i=e.sourceName)==null?void 0:i.includes(t))||((b=e.sourceUrl)==null?void 0:b.includes(t))||((p=e.sourceGroup)==null?void 0:p.includes(t))||((k=e.sourceComment)==null?void 0:k.includes(t)))??!1},re=e=>{const t=new Map;return e.forEach(o=>t.set(ee(o),o)),t},Ft={ruleSearch:{},ruleBookInfo:{},ruleToc:{},ruleContent:{},ruleReview:{},ruleExplore:{}},Wt={},F=/bookSource/i.test(location.href),pe=F?Ft:Wt,M=me("source",{state:()=>({bookSources:[],rssSources:[],savedSources:[],currentSource:pe,currentTab:localStorage.getItem("tabName")||"editTab",editTabSource:{},isDebuging:!1}),getters:{sources:e=>F?e.bookSources:e.rssSources,sourcesMap:e=>re(e.sources),savedSourcesMap:e=>re(e.savedSources),currentSourceUrl:e=>F?e.currentSource.bookSourceUrl:e.currentSource.sourceUrl,searchKey:e=>F?e.currentSource.ruleSearch.checkKeyWord||"我的":null},actions:{startDebug(){this.currentTab="editDebug",this.isDebuging=!0},debugFinish(){this.isDebuging=!1},saveSources(e){F?this.bookSources=e:this.rssSources=e},setPushReturnSources(e){this.savedSources=e},deleteSources(e){let t=F?this.bookSources:this.rssSources;e.forEach(o=>{let r=t.indexOf(o);r>-1&&t.splice(r,1)})},saveCurrentSource(){let e=this.currentSource,t=this.sourcesMap;t.set(ee(e),JSON.parse(JSON.stringify(e))),this.saveSources(Array.from(t.values()))},changeCurrentSource(e){this.currentSource=JSON.parse(JSON.stringify(e))},changeTabName(e){this.currentTab=e,localStorage.setItem("tabName",e)},changeEditTabSource(e){this.editTabSource=JSON.parse(JSON.stringify(e))},editHistory(e){let t;if(localStorage.getItem("history"))t=JSON.parse(localStorage.getItem("history")),t.new.push(e),t.new.length>50&&t.new.shift(),t.old.length>50&&t.old.shift(),localStorage.setItem("history",JSON.stringify(t));else{const o={new:[e],old:[]};localStorage.setItem("history",JSON.stringify(o))}},editHistoryUndo(){if(localStorage.getItem("history")){let e=JSON.parse(localStorage.getItem("history"));e.old.push(this.currentSource),e.new.length&&(this.currentSource=e.new.pop()),localStorage.setItem("history",JSON.stringify(e))}},clearAllHistory(){localStorage.setItem("history",JSON.stringify({new:[],old:[]}))},clearEdit(){this.editTabSource={},this.currentSource=pe},clearAllSource(){this.bookSources=[],this.rssSources=[],this.savedSources=[]}}}),zt={__name:"SourceItem",props:["source"],setup(e){const t=e,o=M(),{savedSourcesMap:r,currentSourceUrl:n}=Y(o),l=G(()=>ee(t.source)),i=p=>{o.changeCurrentSource(p)},b=G(()=>{const p=r.value;return p.size==0?!1:!p.has(l.value)});return(p,k)=>{const V=ie,E=Re;return u(),C(E,{size:"large",border:"",label:s(l),class:_e({error:s(b),edit:s(l)==s(n)})},{default:c(()=>[f(X(e.source.bookSourceName||e.source.sourceName)+" ",1),d(V,{text:"",icon:s(Se),onClick:k[0]||(k[0]=_=>i(e.source))},null,8,["icon"])]),_:1},8,["label","class"])}}},Gt=J(zt,[["__scopeId","data-v-830cee5a"]]),Qt={class:"tool"},Xt={__name:"SourceList",setup(e){const t=M(),o=D([]),r=D(""),{sources:n,sourcesMap:l}=Y(t),i=G(()=>{const a=r.value;return a===""?n.value:n.value.filter(y=>qt(y,a))}),b=G(()=>{const a=o.value;if(a.length==0)return[];const y=r.value==""?l.value:re(i.value);return a.reduce((I,v)=>{const T=y.get(v);return T&&I.push(T),I},[])}),p=()=>{const a=b.value;K.deleteSource(a).then(({data:y})=>{if(!y.isSuccess)return w.error(y.errorMsg);t.deleteSources(a);const I=De(o.value);a.forEach(v=>{const T=I.indexOf(ee(v));T>-1&&I.splice(T,1)}),o.value=I})},k=()=>{t.clearAllSource(),o.value=[]},V=()=>{const a=document.createElement("input");a.type="file",a.accept=".json,.txt",a.addEventListener("change",y=>{const I=y.target.files[0];var v=new FileReader;v.readAsText(I),v.onload=()=>{try{const T=JSON.parse(v.result);t.saveSources(T)}catch{w({message:"上传的源格式错误",type:"error"})}}}),a.click()},E=/bookSource/.test(window.location.href),_=()=>{const a=document.createElement("a");let y=o.value.length===0?i.value:b.value,I=E?"BookSource":"RssSource";a.download=`${I}_${Date().replace(/.*?\s(\d+)\s(\d+)\s(\d+:\d+:\d+).*/,"$2$1$3").replace(/:/g,"")}.json`;let v=new Blob([JSON.stringify(y,null,4)],{type:"application/json"});a.href=window.URL.createObjectURL(v),a.click()};return(a,y)=>{const I=Z,v=ie,T=Je;return u(),x(P,null,[d(I,{modelValue:s(r),"onUpdate:modelValue":y[0]||(y[0]=N=>H(r)?r.value=N:null),class:"search","prefix-icon":s(fe),placeholder:"筛选源"},null,8,["modelValue","prefix-icon"]),g("div",Qt,[d(v,{onClick:V,icon:s(Le)},{default:c(()=>[f("打开")]),_:1},8,["icon"]),d(v,{disabled:s(i).length===0,onClick:_,icon:s(Oe)},{default:c(()=>[f(" 导出")]),_:1},8,["disabled","icon"]),d(v,{type:"danger",icon:s(ue),onClick:p,disabled:s(b).length===0},{default:c(()=>[f("删除")]),_:1},8,["icon","disabled"]),d(v,{type:"danger",icon:s(ue),onClick:k,disabled:s(n).length===0},{default:c(()=>[f("清空")]),_:1},8,["icon","disabled"])]),d(T,{id:"source-list",modelValue:s(o),"onUpdate:modelValue":y[1]||(y[1]=N=>H(o)?o.value=N:null)},{default:c(()=>[d(s(Pe),{style:{height:"100%","overflow-y":"auto","overflow-x":"hidden"},"data-key":N=>N.bookSourceUrl||N.sourceUrl,"data-sources":s(i),"data-component":Gt,"estimate-size":45},null,8,["data-key","data-sources"])]),_:1},8,["modelValue"])],64)}}},Yt=J(Xt,[["__scopeId","data-v-cd1572ca"]]),Zt={__name:"SourceDebug",setup(e){const t=M(),o=D(""),r=D("");ye(()=>t.isDebuging,()=>{t.isDebuging&&l()});const n=b=>{let p=document.querySelector("#debug-text");p.scrollTop=p.scrollHeight,o.value+=b+` `},l=async()=>{o.value="";try{await K.saveSource(t.currentSource)}catch(b){throw t.debugFinish(),b}K.debug(t.currentSourceUrl,r.value||t.searchKey,n,t.debugFinish)},i=G(()=>/bookSource/.test(window.location.href));return(b,p)=>{const k=Z;return u(),x(P,null,[s(i)?(u(),C(k,{key:0,id:"debug-key",modelValue:s(r),"onUpdate:modelValue":p[0]||(p[0]=V=>H(r)?r.value=V:null),placeholder:"搜索书名、作者","prefix-icon":s(fe),style:{"padding-bottom":"4px"},onKeydown:Ae(l,["enter"])},null,8,["modelValue","prefix-icon"])):R("",!0),d(k,{id:"debug-text",modelValue:s(o),"onUpdate:modelValue":p[1]||(p[1]=V=>H(o)?o.value=V:null),type:"textarea",readonly:"",rows:"29",placeholder:"这里用于输出调试信息"},null,8,["modelValue"])],64)}}},eo=J(Zt,[["__scopeId","data-v-97ed449e"]]),Uo=me("book",{state:()=>({connectStatus:"正在连接后端服务器……",connectType:"",newConnect:!0,searchBooks:[],shelf:[],catalog:[],readingBook:{index:0,chapterPos:0},popCataVisible:!1,contentLoading:!0,showContent:!1,config:{theme:0,font:0,fontSize:18,readWidth:800,infiniteLoading:!1,customFontName:"",jumpDuration:1e3,spacing:{paragraph:1,line:.8,letter:0}},miniInterface:!1,readSettingsVisible:!1}),getters:{bookProgress:e=>{var i;if(e.catalog.length==0)return;const{index:t,chapterPos:o,bookName:r,bookAuthor:n}=e.readingBook;let l=(i=e.catalog[t])==null?void 0:i.title;if(l)return{name:r,author:n,durChapterIndex:t,durChapterPos:o,durChapterTime:new Date().getTime(),durChapterTitle:l}}},actions:{setConnectStatus(e){this.connectStatus=e},setConnectType(e){this.connectType=e},resetConnect(){this.connectStatus="正在连接后端服务器……",this.connectType="",this.clearBooks()},setNewConnect(e){this.newConnect=e},addBooks(e){this.shelf=e},clearBooks(){this.shelf=[]},setCatalog(e){this.catalog=e},setPopCataVisible(e){this.popCataVisible=e},setContentLoading(e){this.contentLoading=e},setReadingBook(e){this.readingBook=e},setConfig(e){Object.assign(this.config,e)},setReadSettingsVisible(e){this.readSettingsVisible=e},setShowContent(e){this.showContent=e},setMiniInterface(e){this.miniInterface=e},async setSearchBooks(e){e.forEach(t=>{this.shelf.find(r=>r.bookUrl==t.bookUrl)===void 0&&this.searchBooks.push(t)})},clearSearchBooks(){this.searchBooks=[]},async saveBookProgress(){return this.bookProgress?K.saveBookProgress(this.bookProgress):Promise.resolve()}}}),to=je(),oo={__name:"SourceJson",setup(e){const t=M(),o=D(""),r=async n=>{try{t.changeEditTabSource(JSON.parse(n))}catch{w({message:"粘贴的源格式错误",type:"error"})}};return Ke(async()=>{let n=t.editTabSource;Object.keys(n).length>0?o.value=JSON.stringify(n,null,4):o.value=""}),(n,l)=>{const i=Z;return u(),C(i,{id:"source-json",modelValue:s(o),"onUpdate:modelValue":l[0]||(l[0]=b=>H(o)?o.value=b:null),type:"textarea",placeholder:"这里输出序列化的JSON数据,可直接导入'阅读'APP",rows:"30",onChange:r,style:{"margin-bottom":"4px"}},null,8,["modelValue"])}}},no=J(oo,[["__scopeId","data-v-7e91a802"]]),ro={__name:"SourceTabTools",setup(e){const t=M(),{currentTab:o}=Y(t),r=D([["editTab","编辑源"],["editDebug","调试源"],["editList","源列表"],["editHelp","帮助信息"]]);return(n,l)=>{const i=no,b=eo,p=Yt,k=Bt,V=be,E=ke;return u(),C(E,{modelValue:s(o),"onUpdate:modelValue":l[0]||(l[0]=_=>H(o)?o.value=_:null)},{default:c(()=>[(u(!0),x(P,null,j(s(r),(_,a)=>(u(),C(V,{key:_[0],name:_[0],label:_[1]},{default:c(()=>[a==0?(u(),C(i,{key:0})):R("",!0),a==1?(u(),C(b,{key:1})):R("",!0),a==2?(u(),C(p,{key:2})):R("",!0),a==3?(u(),C(k,{key:3})):R("",!0)]),_:2},1032,["name","label"]))),128))]),_:1},8,["modelValue"])}}},so=J(ro,[["__scopeId","data-v-dcce2457"]]),lo={class:"menu flex-column-center"},io={class:"hotkeys-header flex-space-between"},ao=["id"],co={key:0},uo={class:"hotkeys-settings flex-column-center"},po={class:"title"},ho={class:"hotkeys-item__content"},go={key:0},mo={key:0},So={__name:"ToolBar",setup(e){const t=M(),o=()=>{const m=w({message:"加载中……",showClose:!0,duration:0});K.getSources().then(({data:S})=>{S.isSuccess?(t.changeTabName("editList"),t.saveSources(S.data),w({message:`成功拉取${S.data.length}条源`,type:"success"})):w({message:S.errorMsg??"后端错误",type:"error"})}).finally(()=>m.close())},r=()=>{let m=t.sources;if(t.changeTabName("editList"),m.length===0)return w({message:"空空如也",type:"info"});w({message:"正在推送中",type:"info"}),K.saveSources(m).then(({data:S})=>{if(S.isSuccess){let h=S.data;if(Array.isArray(h)){let A="";m.length>h.length&&(A=` 推送失败的源将用红色字体标注!`,t.setPushReturnSources(h)),w({message:`批量推送源到「阅读3.0APP」 共计: ${m.length} 条 成功: ${h.length} 条 失败: ${m.length-h.length} 条${A}`,type:"success"})}}else w({message:`批量推送源失败! ErrorMsg: ${S.errorMsg}`,type:"error"})})},n=()=>{t.changeTabName("editTab"),t.changeEditTabSource(t.currentSource)},l=()=>{t.changeCurrentSource(t.editTabSource)},i=()=>{t.editHistoryUndo()},b=()=>{t.clearEdit(),w({message:"已清除",type:"success"})},p=()=>{t.clearEdit(),t.clearAllHistory(),w({message:"已清除所有历史记录",type:"success"})},k=()=>{let m=/bookSource/.test(location.href),S=t.currentSource;Mt(S)?K.saveSource(S).then(({data:h})=>{h.isSuccess?(w({message:`源《${m?S.bookSourceName:S.sourceName}》已成功保存到「阅读3.0APP」`,type:"success"}),t.saveCurrentSource()):w({message:`源《${m?S.bookSourceName:S.sourceName}》保存失败! ErrorMsg: ${h.errorMsg}`,type:"error"})}):w({message:"请检查<必填>项是否全部填写",type:"error"})},V=()=>{t.startDebug()},E=D(Array.of({name:"⇈推送源",hotKeys:[],action:r},{name:"⇊拉取源",hotKeys:[],action:o},{name:"⋙生成源",hotKeys:[],action:n},{name:"⋘编辑源",hotKeys:[],action:l},{name:"✗清空表单",hotKeys:[],action:b},{name:"↶撤销操作",hotKeys:[],action:i},{name:"↷重做操作",hotKeys:[],action:p},{name:"⇏调试源",hotKeys:[],action:V},{name:"✓保存源",hotKeys:[],action:k})),_=D(!0),a=D(!1),y=D(-1),I=()=>{a.value||(_.value=!1),a.value=!1};ye(_,m=>{if(!m){q.unbind("*"),W(),N();return}W(),q.unbind(),q("*",S=>{S.preventDefault();let h=q.getPressedKeyString();h.length==1&&h[0]=="esc"||a.value&&y.value>-1&&(E.value[y.value].hotKeys=h)})},{immediate:!0});const v=m=>{a.value=!0,w({message:"按ESC键或者点击空白处结束录入",type:"info"}),E.value[m].hotKeys=[],y.value=m},T=()=>{const m=[];E.value.forEach(({hotKeys:S})=>{m.push(S)}),L(m),_.value=!1},N=()=>{q.filter=()=>!0,E.value.forEach(({hotKeys:m,action:S})=>{m.length!=0&&q(m.join("+"),h=>{h.preventDefault(),S.call(null)})})},L=m=>{localStorage.setItem("legado_web_hotkeys",JSON.stringify(m))};function W(){try{const m=JSON.parse(localStorage.getItem("legado_web_hotkeys"));return!Array.isArray(m)||m.length==0?!1:(E.value.forEach((S,h)=>S.hotKeys=m[h]),!0)}catch{w({message:"快捷键配置错误",type:"error"}),localStorage.removeItem("legado_web_hotkeys")}return!1}return He(()=>{W()&&(_.value=!1)}),(m,S)=>{const h=ie,A=ge,xe=qe;return u(),x(P,null,[g("div",lo,[(u(!0),x(P,null,j(s(E),$=>(u(),C(h,{size:"large",key:$.name,onClick:$.action},{default:c(()=>[f(X($.name),1)]),_:2},1032,["onClick"]))),128)),d(h,{size:"large",onClick:S[0]||(S[0]=()=>_.value=!0)},{default:c(()=>[f("快捷键")]),_:1})]),d(xe,{modelValue:s(_),"onUpdate:modelValue":S[1]||(S[1]=$=>H(_)?_.value=$:null),"show-close":!1,"before-close":I},{header:c(({titleClass:$,titleId:te})=>[g("div",io,[g("div",{id:te,class:_e($)},[f(" 快捷键设置 "),s(a)?(u(),x("span",co,[d(A,null,{default:c(()=>[f(" / 录入中 ")]),_:1})])):R("",!0)],10,ao),d(h,{disabled:s(a),onClick:T,icon:s(Me)},{default:c(()=>[f("保存")]),_:1},8,["disabled","icon"])])]),default:c(()=>[g("div",uo,[(u(!0),x(P,null,j(s(E),($,te)=>(u(),x("div",{key:$.name,class:"hotkeys-item flex-space-between"},[g("span",po,[d(A,null,{default:c(()=>[f(X($.name),1)]),_:2},1024)]),g("div",ho,[(u(!0),x(P,null,j($.hotKeys,(oe,Ee)=>(u(),x("div",{key:oe},[g("kbd",null,X(oe),1),Ee+1<$.hotKeys.length?(u(),x("span",go,[d(A,null,{default:c(()=>[f("+")]),_:1})])):R("",!0)]))),128)),$.hotKeys.length==0?(u(),x("span",mo,"未设置")):R("",!0)]),d(h,{disabled:s(a),text:"",icon:s(Se),onClick:oe=>v(te)},{default:c(()=>[f("编辑")]),_:2},1032,["disabled","icon","onClick"])]))),128))])]),_:1},8,["modelValue"])],64)}}},_o=J(So,[["__scopeId","data-v-9fd45dad"]]),fo={__name:"SourceTabForm",props:["config"],setup(e){const t=M(),{currentSource:o}=Y(t);return(r,n)=>{const l=Z,i=Fe,b=We,p=ze,k=Ge,V=Qe,E=Xe,_=be,a=ke;return u(),C(a,{id:"source-edit"},{default:c(()=>[(u(!0),x(P,null,j(Object.values(e.config),({name:y,children:I})=>(u(),C(_,{label:y,key:y},{default:c(()=>[d(E,{"label-position":"right","label-width":"auto"},{default:c(()=>[(u(!0),x(P,null,j(I,({type:v,title:T,namespace:N,id:L,array:W,hint:m,required:S})=>(u(),C(V,{label:T,key:T,required:S},{default:c(()=>[v=="String"&&typeof N>"u"?(u(),C(l,{key:0,type:"textarea",modelValue:s(o)[L],"onUpdate:modelValue":h=>s(o)[L]=h,placeholder:m,autosize:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])):R("",!0),v=="String"&&typeof N<"u"?(u(),C(l,{key:1,type:"textarea",modelValue:s(o)[N][L],"onUpdate:modelValue":h=>s(o)[N][L]=h,placeholder:m,autosize:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])):R("",!0),v=="Boolean"?(u(),C(i,{key:2,modelValue:s(o)[L],"onUpdate:modelValue":h=>s(o)[L]=h},null,8,["modelValue","onUpdate:modelValue"])):R("",!0),v=="Number"?(u(),C(b,{key:3,modelValue:s(o)[L],"onUpdate:modelValue":h=>s(o)[L]=h,min:0},null,8,["modelValue","onUpdate:modelValue"])):R("",!0),v=="Array"?(u(),C(k,{key:4,modelValue:s(o)[L],"onUpdate:modelValue":h=>s(o)[L]=h},{default:c(()=>[(u(!0),x(P,null,j(W,(h,A)=>(u(),C(p,{value:A,key:h,label:h},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):R("",!0)]),_:2},1032,["label","required"]))),128))]),_:2},1024)]),_:2},1032,["label"]))),128))]),_:1})}}},yo=J(fo,[["__scopeId","data-v-bced2b97"]]),bo={base:{name:"基础",children:[{title:"源类型",id:"bookSourceType",type:"Array",array:["文本","音频","图片","文件"],required:!0},{title:"源域名",id:"bookSourceUrl",type:"String",hint:"通常填写网站主页,例: https://www.qidian.com",required:!0},{title:"源名称",id:"bookSourceName",type:"String",hint:"会显示在源列表",required:!0},{title:"源分组",id:"bookSourceGroup",type:"String",hint:"描述源的特征信息"},{title:"源注释",id:"bookSourceComment",type:"String",hint:"描述源作者和状态"},{title:"登录地址",id:"loginUrl",type:"String",hint:"填写网站登录网址,仅在需要登录的源有用"},{title:"登录界面",id:"loginUi",type:"String",hint:"自定义登录界面"},{title:"登录检测",id:"loginCheckJs",type:"String",hint:"登录检测js"},{title:"封面解密",id:"coverDecodeJs",type:"String",hint:"封面解密js"},{title:"链接验证",id:"bookUrlPattern",type:"String",hint:"书籍URL正则,当详情页URL与源URL的域名不一致时有效,用于添加网址"},{title:"请求头",id:"header",type:"String",hint:"客户端标识"},{title:"变量说明",id:"variableComment",type:"String",hint:"书源变量说明"},{title:"并发率",id:"concurrentRate",type:"String",hint:"并发率,如1000(访问间隔1000ms)或者1/1000(1000ms内访问1次)"},{title:"js库",id:"jsLib",type:"String",hint:"js库, 可填写js或者key-value object获取在线js文件"}]},search:{name:"搜索",children:[{title:"搜索地址",id:"searchUrl",type:"String",hint:"[域名可省略]/search.php@kw={{key}}"},{title:"校验文字",namespace:"ruleSearch",id:"checkKeyWord",type:"String",hint:"校验关键字,强烈建议填写"},{title:"列表规则",namespace:"ruleSearch",id:"bookList",type:"String",hint:"选择书籍节点 (规则结果为List)"},{title:"书名规则",namespace:"ruleSearch",id:"name",type:"String",hint:"选择节点书名 (规则结果为String)"},{title:"作者规则",namespace:"ruleSearch",id:"author",type:"String",hint:"选择节点作者 (规则结果为String)"},{title:"分类规则",namespace:"ruleSearch",id:"kind",type:"String",hint:"选择节点分类信息 (规则结果为String)"},{title:"字数规则",namespace:"ruleSearch",id:"wordCount",type:"String",hint:"选择节点字数信息 (规则结果为String)"},{title:"最新章节",namespace:"ruleSearch",id:"lastChapter",type:"String",hint:"选择节点最新章节 (规则结果为String)"},{title:"简介规则",namespace:"ruleSearch",id:"intro",type:"String",hint:"选择节点书籍简介 (规则结果为String)"},{title:"封面规则",namespace:"ruleSearch",id:"coverUrl",type:"String",hint:"选择节点书籍封面 (规则结果为String类型的url)"},{title:"详情地址",namespace:"ruleSearch",id:"bookUrl",type:"String",hint:"选择书籍详情页网址 (规则结果为String类型的url)"}]},find:{name:"发现",children:[{title:"发现地址",id:"exploreUrl",type:"String",hint:"单个发现格式::或者{url:,title:,style:...};前者用换行符或者&&连接,后者放在数组内;可用js动态生成"},{title:"列表规则",namespace:"ruleExplore",id:"bookList",type:"String",hint:"选择书籍节点 (规则结果为List)"},{title:"书名规则",namespace:"ruleExplore",id:"name",type:"String",hint:"选择节点书名 (规则结果为String)"},{title:"作者规则",namespace:"ruleExplore",id:"author",type:"String",hint:"选择节点作者 (规则结果为String)"},{title:"分类规则",namespace:"ruleExplore",id:"kind",type:"String",hint:"选择节点分类信息 (规则结果为String)"},{title:"字数规则",namespace:"ruleExplore",id:"wordCount",type:"String",hint:"选择节点字数信息 (规则结果为String)"},{title:"最新章节",namespace:"ruleExplore",id:"lastChapter",type:"String",hint:"选择节点最新章节 (规则结果为String)"},{title:"简介规则",namespace:"ruleExplore",id:"intro",type:"String",hint:"选择节点书籍简介 (规则结果为String)"},{title:"封面规则",namespace:"ruleExplore",id:"coverUrl",type:"String",hint:"选择节点书籍封面 (规则结果为String类型的url)"},{title:"详情地址",namespace:"ruleExplore",id:"bookUrl",type:"String",hint:"选择书籍详情页网址 (规则结果为String类型的url)"}]},detail:{name:"详情",children:[{title:"预处理",namespace:"ruleBookInfo",id:"init",type:"String",hint:"用于加速详情信息检索,只支持AllInOne规则"},{title:"书名规则",namespace:"ruleBookInfo",id:"name",type:"String",hint:"选择节点书名 (规则结果为String)"},{title:"作者规则",namespace:"ruleBookInfo",id:"author",type:"String",hint:"选择节点作者 (规则结果为String)"},{title:"分类规则",namespace:"ruleBookInfo",id:"kind",type:"String",hint:"选择节点分类信息 (规则结果为String)"},{title:"字数规则",namespace:"ruleBookInfo",id:"wordCount",type:"String",hint:"选择节点字数信息 (规则结果为String)"},{title:"最新章节",namespace:"ruleBookInfo",id:"lastChapter",type:"String",hint:"选择节点最新章节 (规则结果为String)"},{title:"简介规则",namespace:"ruleBookInfo",id:"intro",type:"String",hint:"选择节点书籍简介 (规则结果为String)"},{title:"封面规则",namespace:"ruleBookInfo",id:"coverUrl",type:"String",hint:"选择节点书籍封面 (规则结果为String类型的url)"},{title:"目录地址",namespace:"ruleBookInfo",id:"tocUrl",type:"String",hint:"选择书籍详情页网址 (规则结果为String类型的url, 与详情页相同时可省略)"},{title:"修改书籍",namespace:"ruleBookInfo",id:"canReName",type:"String",hint:"允许修改书名作者(规则结果为String类型, 默认不允许)"},{title:"下载URL",namespace:"ruleBookInfo",id:"downloadUrls",type:"String",hint:"文件类书源下载地址 (规则结果为String类型的url, 多个链接返回数组)"}]},directory:{name:"目录",children:[{title:"更新前JS",namespace:"ruleToc",id:"preUpdateJs",type:"String",hint:"更新目录前调用JS 动态更新目录链接"},{title:"列表规则",namespace:"ruleToc",id:"chapterList",type:"String",hint:"选择目录列表的章节节点 (规则结果为List)"},{title:"章节名称",namespace:"ruleToc",id:"chapterName",type:"String",hint:"选择章节名称 (规则结果为String)"},{title:"章节地址",namespace:"ruleToc",id:"chapterUrl",type:"String",hint:"选择章节链接 (规则结果为String类型的Url)"},{title:"标题处理",namespace:"ruleToc",id:"formatJs",type:"String",hint:"遍历去重后的章节列表的回调,提供index(章节序号从1开始)、title(章节标题)变量,额外提供gInt(初始值0),返回值作为新的标题"},{title:"卷名标识",namespace:"ruleToc",id:"isVolume",type:"String",hint:"章节名称是否是卷名 (规则结果为Bool)"},{title:"章节信息",namespace:"ruleToc",id:"updateTime",type:"String",hint:"选择章节信息(如更新时间) (规则结果为String)"},{title:"收费标识",namespace:"ruleToc",id:"isVip",type:"String",hint:"章节是否为VIP章节 (规则结果为Bool)"},{title:"购买标识",namespace:"ruleToc",id:"isPay",type:"String",hint:"章节是否为已购买 (规则结果为Bool)"},{title:"翻页规则",namespace:"ruleToc",id:"nextTocUrl",type:"String",hint:"选择目录下一页链接 (规则结果为List或String)"}]},content:{name:"正文",children:[{title:"正文规则",namespace:"ruleContent",id:"content",type:"String",hint:"选择正文内容 (规则结果为String)"},{title:"标题规则",namespace:"ruleContent",id:"title",type:"String",hint:"获取结果将会覆盖章节标题 (规则结果为String)"},{title:"翻页规则",namespace:"ruleContent",id:"nextContentUrl",type:"String",hint:"选择下一分页(不是下一章)链接 (规则结果为String类型的Url)"},{title:"脚本注入",namespace:"ruleContent",id:"webJs",type:"String",hint:"注入javascript,用于模拟鼠标点击等,必须有返回值,一般为String类型"},{title:"资源正则",namespace:"ruleContent",id:"sourceRegex",type:"String",hint:"匹配资源的url特征,用于嗅探"},{title:"替换规则",namespace:"ruleContent",id:"replaceRegex",type:"String",hint:"多页内容合并后替换,用于正文净化"},{title:"图片样式",namespace:"ruleContent",id:"imageStyle",type:"String",hint:"FULL:铺满 不填:默认样式"},{title:"图片解密",namespace:"ruleContent",id:"imageDecode",type:"String",hint:"填写JavaScript 返回解密图片的bytes "},{title:"购买操作",namespace:"ruleContent",id:"payAction",type:"String",hint:"填写JavaScript 返回购买链接或者调用购买接口"}]},other:{name:"其他",children:[{title:"启用搜索",id:"enabled",type:"Boolean"},{title:"启用发现",id:"enabledExplore",type:"Boolean"},{title:"CookieJar",id:"enabledCookieJar",type:"Boolean"},{title:"搜索权重",id:"weight",type:"Number"},{title:"排序编号",id:"customOrder",type:"Number"}]}},ko={base:{name:"基础",children:[{title:"源域名",id:"sourceUrl",type:"String",hint:"通常填写网站主页,例: https://www.qidian.com",required:!0},{title:"图标",id:"sourceIcon",type:"String",hint:"填写图片网络链接"},{title:"源名称",id:"sourceName",type:"String",hint:"会显示在源列表",required:!0},{title:"源分组",id:"sourceGroup",type:"String",hint:"描述源的特征信息"},{title:"源注释",id:"sourceComment",type:"String",hint:"描述源作者和状态"},{title:"分类地址",id:"sortUrl",type:"String",hint:`名称1::链接1 名称2::链接2`},{title:"登录地址",id:"loginUrl",type:"String",hint:"填写网站登录网址,仅在需要登录的源有用"},{title:"登录界面",id:"loginUi",type:"String",hint:"自定义登录界面"},{title:"登录检测",id:"loginCheckJs",type:"String",hint:"登录检测js"},{title:"封面解密",id:"coverDecodeJs",type:"String",hint:"封面解密js"},{title:"请求头",id:"header",type:"String",hint:"客户端标识"},{title:"变量说明",id:"variableComment",type:"String",hint:"源变量说明"},{title:"并发率",id:"concurrentRate",type:"String",hint:"并发率"}]},list:{name:"列表",children:[{title:"列表规则",id:"ruleArticles",type:"String",hint:"规则结果为List"},{title:"翻页规则",id:"ruleNextPage",type:"String",hint:"下一页链接 规则结果为List或String"},{title:"标题规则",id:"ruleTitle",type:"String",hint:"文章标题 规则结果为String"},{title:"时间规则",id:"rulePubDate",type:"String",hint:"文章发布时间 规则结果为String"},{title:"描述规则",id:"ruleDescription",type:"String",hint:"文章简要描述 规则结果为String"},{title:"图片规则",id:"ruleImage",type:"String",hint:"文章图片链接 规则结果为String"},{title:"链接规则",id:"ruleLink",type:"String",hint:"文章链接 规则结果为String"}]},webView:{name:"WebView",children:[{title:"内容规则",id:"ruleContent",type:"String",hint:"文章正文"},{title:"样式规则",id:"style",type:"String",hint:"文章正文样式 填写css"},{title:"注入规则",id:"injectJs",type:"String",hint:"注入网页的JavaScript"},{title:"黑名单",id:"contentBlacklist",type:"String",hint:"webView链接加载黑名单,英文逗号隔开"},{title:"白名单",id:"contentWhitelist",type:"String",hint:"webView链接加载白名单,英文逗号隔开"},{title:"链接拦截",id:"shouldOverrideUrlLoading",type:"String",hint:"填写js,变量url为当前资源链接,返回true拦截"}]},other:{name:"其他",children:[{title:"列表样式",id:"articleStyle",type:"Array",array:["默认","大图","双列"]},{title:"加载地址",id:"loadWithBaseUrl",type:"Boolean"},{title:"启用JS",id:"enableJs",type:"Boolean"},{title:"启用",id:"enabled",type:"Boolean"},{title:"Cookie",id:"enabledCookieJar",type:"Boolean"},{title:"单URL",id:"singleUrl",type:"Boolean"},{title:"排序编号",id:"customOrder",type:"Number"}]}},vo={class:"editor"},Co={__name:"SourceEditor",setup(e){let t;return/bookSource/i.test(location.href)?(t=bo,document.title="书源管理"):(t=ko,document.title="订阅源管理"),(o,r)=>{const n=yo,l=_o,i=so;return u(),x("div",vo,[d(n,{class:"left",config:s(t)},null,8,["config"]),d(l),d(i,{class:"right"})])}}},he=J(Co,[["__scopeId","data-v-5fe2b79d"]]),Be=[{path:"/bookSource",name:"book-home",component:he},{path:"/rssSource",name:"rss-home",component:he}];se({history:le(),routes:Be});const Ue=se({history:le(),routes:ve.concat(Be)});Ue.afterEach(e=>{e.name=="shelf"&&(document.title="书架")});Ye(nt).use(to).use(Ue).mount("#app");ne(()=>import("./config-MMLbq8EV.js"),__vite__mapDeps([8,1,2,9]),import.meta.url);export{K as A,J as _,ae as b,Bo as s,Uo as u};