From 04ab4ce0385d4077960cb2f43c6dcbc7af89a661 Mon Sep 17 00:00:00 2001 From: troyeguo <13820674+troyeguo@users.noreply.github.com> Date: Tue, 14 Jul 2026 08:08:15 +0800 Subject: [PATCH] Refactor voice list handling to use KookitConfig constants - Replaced references to officialVoiceList and azureTTSVoiceList with KookitConfig.OfficialVoiceList and KookitConfig.AzureTTSVoiceList respectively in handleFetchPlugins function. --- src/assets/lib/kookit-extra-browser.min.js | 2 +- src/constants/ttsList.tsx | 3736 -------------------- src/store/actions/manager.tsx | 8 +- 3 files changed, 5 insertions(+), 3741 deletions(-) diff --git a/src/assets/lib/kookit-extra-browser.min.js b/src/assets/lib/kookit-extra-browser.min.js index 5d2eabca..ad74c9c3 100644 --- a/src/assets/lib/kookit-extra-browser.min.js +++ b/src/assets/lib/kookit-extra-browser.min.js @@ -1 +1 @@ -import e from"axios";import{Storage as t}from"megajs";import{Buffer as o}from"buffer";import{S3Client as i,ListObjectsV2Command as r,DeleteObjectCommand as n,PutObjectCommand as s,GetObjectCommand as a}from"@aws-sdk/client-s3";import d from"crypto-js";import{AuthType as l,createClient as c}from"webdav/dist/web/index.js";import{SSE as u}from"sse.js";import{isElectron as h}from"react-device-detect";function p(e,t,o,i){return new(o||(o=Promise))((function(r,n){function s(e){try{d(i.next(e))}catch(e){n(e)}}function a(e){try{d(i.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))}const f=e=>"json"===e?"application/json":["jpg","jpeg","png","gif","bmp"].includes(e)?"image/"+e:"zip"===e?"application/zip":"epub"===e?"application/epub+zip":"txt"===e?"text/plain":"pdf"===e?"application/pdf":"mobi"===e?"application/x-mobipocket-ebook":"azw3"===e||"azw"===e?"application/vnd.amazon.ebook":"cbz"===e?"application/x-cbz":"cbr"===e?"application/x-cbr":"cbt"===e?"application/x-cbt":"cb7"===e?"application/x-cb7":"fb2"===e?"application/x-fictionbook+xml":"html"===e?"text/html":"css"===e?"text/css":"js"===e?"application/javascript":"xml"===e?"application/xml":"xhtml"===e?"application/xhtml+xml":"opf"===e?"application/oebps-package+xml":"ncx"===e?"application/x-dtbncx+xml":"mp3"===e?"audio/mpeg":"wav"===e?"audio/wav":"ogg"===e?"audio/ogg":"mp4"===e?"video/mp4":"webm"===e?"video/webm":"avi"===e?"video/x-msvideo":"wmv"===e?"video/x-ms-wmv":"flv"===e?"video/x-flv":"m3u8"===e?"application/x-mpegURL":"ts"===e?"video/MP2T":"3gp"===e?"video/3gpp":"3g2"===e?"video/3gpp2":"db"===e?"application/x-sqlite3":void 0,g=["books","notes","bookmarks","plugins","words"],y=e=>{const t=atob(e),o=t.length,i=new Uint8Array(o);for(let e=0;e{let t="";const o=new Uint8Array(e),i=o.byteLength;for(let e=0;ee>>>t|e<<32-t,i=(e,t,o)=>e&t^~e&o,r=(e,t,o)=>e&t^e&o^t&o,n=e=>o(e,2)^o(e,13)^o(e,22),s=e=>o(e,6)^o(e,11)^o(e,25),a=e=>o(e,7)^o(e,18)^e>>>3,d=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],l=8*e.length,c=(960-(8*e.length+1)%512)%512,u=e.length+Math.ceil((c+1)/8)+8,h=new Uint8Array(u);h.set(e),h[e.length]=128;new DataView(h.buffer,h.byteLength-8).setBigUint64(0,BigInt(l),!1);for(let e=0;e>>10)+c[e-7]+a(c[e-15])+c[e-16]>>>0);let[u,f,g,y,m,v,k,b]=d;for(let e=0;e<64;e++){const o=b+s(m)+i(m,v,k)+t[e]+c[e]>>>0,a=n(u)+r(u,f,g)>>>0;b=k,k=v,v=m,m=y+o>>>0,y=g,g=f,f=u,u=o+a>>>0}d[0]=d[0]+u>>>0,d[1]=d[1]+f>>>0,d[2]=d[2]+g>>>0,d[3]=d[3]+y>>>0,d[4]=d[4]+m>>>0,d[5]=d[5]+v>>>0,d[6]=d[6]+k>>>0,d[7]=d[7]+b>>>0}var p;const f=new ArrayBuffer(32),g=new DataView(f);return d.forEach(((e,t)=>{g.setUint32(4*t,e,!1)})),f}const k={_chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",encode(e){if("string"!=typeof e)throw new Error("Input must be a string");let t="",o=0;const i=this._stringToUtf8Bytes(e),r=i.length;for(;o>2,d=(3&e)<<4|n>>4,l=(15&n)<<2|s>>6,c=63&s;t+=this._chars.charAt(a),t+=this._chars.charAt(d),t+=o-2>=r?"=":this._chars.charAt(l),t+=o-1>=r?"=":this._chars.charAt(c)}return t},decode(e){if("string"!=typeof e)throw new Error("Input must be a string");for(e=e.replace(/[^A-Za-z0-9+/]/g,"");e.length%4!=0;)e+="=";const t=[];let o=0;const i=e.length;for(;o>4,d=(15&r)<<4|n>>2,l=(3&n)<<6|s;t.push(a),-1!==n&&t.push(d),-1!==s&&t.push(l)}return this._utf8BytesToString(t)},_stringToUtf8Bytes(e){const t=[];for(let o=0;o>6),t.push(128|63&i);else if(55296==(64512&i)&&o+1>18),t.push(128|e>>12&63),t.push(128|e>>6&63),t.push(128|63&e)}else t.push(239,191,189),o--}else t.push(224|i>>12),t.push(128|i>>6&63),t.push(128|63&i)}return t},_utf8BytesToString(e){let t="",o=0;for(;o65535){const o=e-65536;t+=String.fromCharCode(55296|o>>10),t+=String.fromCharCode(56320|1023&o)}else t+=String.fromCharCode(e)}else t+="�"}else t+="�"}return t},encodeURL(e){return this.encode(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},decodeURL(e){for(e=e.replace(/-/g,"+").replace(/_/g,"/");e.length%4;)e+="=";return this.decode(e)}},b=e=>{const t=(e,t)=>{const o=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(o>>16)<<16|65535&o},o=(e,o,i,r,n,s)=>{return t((a=t(t(o,e),t(r,s)))<<(d=n)|a>>>32-d,i);var a,d},i=(e,t,i,r,n,s,a)=>o(t&i|~t&r,e,t,n,s,a),r=(e,t,i,r,n,s,a)=>o(t&r|i&~r,e,t,n,s,a),n=(e,t,i,r,n,s,a)=>o(t^i^r,e,t,n,s,a),s=(e,t,i,r,n,s,a)=>o(i^(t|~r),e,t,n,s,a),a=e.length,d=1+(a+8>>6),l=new Array(16*d).fill(0);for(let t=0;t>2]|=e[t]<>2]|=128<{let t="";for(let o=0;o<4;o++)t+=("0"+(e>>8*o&255).toString(16)).slice(-2);return t})).join("")};class S{constructor(e){this.queue=[],this.runningTasks=0,this.totalTasks=0,this.completedTasks=0,this.hasFailedTasks=!1,this.downloadedSize=0,this.maxConcurrency=e}addTask(e){return p(this,void 0,void 0,(function*(){return this.totalTasks++,new Promise(((t,o)=>{if(this.hasFailedTasks)return void t(void 0);const i=()=>p(this,void 0,void 0,(function*(){try{this.runningTasks++;const o=yield e();return this.completedTasks++,t(o),o}catch(e){throw this.completedTasks++,o(e),e}finally{this.runningTasks--,this.runNext()}}));this.runningTasks0&&this.runningTasks"application/json"===e?"json":e.startsWith("image/")?e.split("/")[1]:"application/zip"===e?"zip":"application/epub+zip"===e?"epub":"text/plain"===e?"txt":"application/pdf"===e?"pdf":"application/x-mobipocket-ebook"===e?"mobi":"application/vnd.amazon.ebook"===e?"azw3":"application/x-cbz"===e?"cbz":"application/x-cbr"===e?"cbr":"application/x-cbt"===e?"cbt":"application/x-cb7"===e?"cb7":"application/x-fictionbook+xml"===e?"fb2":"text/html"===e?"html":"text/css"===e?"css":"application/javascript"===e?"js":"application/xml"===e?"xml":"application/xhtml+xml"===e?"xhtml":"application/oebps-package+xml"===e?"opf":"application/x-dtbncx+xml"===e?"ncx":"audio/mpeg"===e?"mp3":"audio/wav"===e?"wav":"audio/ogg"===e?"ogg":"video/mp4"===e?"mp4":"video/webm"===e?"webm":"video/x-msvideo"===e?"avi":"video/x-ms-wmv"===e?"wmv":"video/x-flv"===e?"flv":"application/x-mpegURL"===e?"m3u8":"video/MP2T"===e?"ts":"video/3gpp"===e?"3gp":"video/3gpp2"===e?"3g2":"application/x-sqlite3"===e?"db":"",databaseList:g,configList:["themeColors","readingTime","appVersion","cloudSyncTime","lastSyncTime","recentBooks","koreaderBooks","recentAdd","deletedBooks","favoriteBooks","shelfList","txtParsers","aiModelConfig","readingStats","noteTags","recordLocation","thirdpartyToken","sortedShelfList","kindleDeviceList","thirdpartyToken","opdsCatalogs","opdsCatalogList"],copyArrayBuffer:e=>{var t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t},base64ToArrayBuffer:y,arrayBufferToBase64:m,generateSHA256Hash:function(e){return p(this,void 0,void 0,(function*(){const t=(new TextEncoder).encode(e),o="undefined"!=typeof crypto&&crypto.subtle?yield crypto.subtle.digest("SHA-256",t):v(t);return Array.from(new Uint8Array(o)).map((e=>e.toString(16).padStart(2,"0"))).join("")}))},getDisableThinkingParams:e=>{const t=new Set(["anthropic","zhipu","doubao","moonshot","deepseek"]),o=new Set(["qwen","hunyuan","siliconflow","infini"]);return e&&"custom"!==e?t.has(e)?{thinking:{type:"disabled"}}:o.has(e)?{enable_thinking:!1}:{}:{}},EmailProviders:["gmail.com","qq.com","163.com","yahoo.com","sina.com","sina.cn","126.com","outlook.com","yeah.net","foxmail.com","hotmail.com","protonmail.com","proton.me","icloud.com","mail.com","live.com","aliyun.com","sohu.com","yandex.com","naver.com","mail.ru","yahoo.co.jp","139.com","189.com","yandex.ru","189.cn"],Base64:k};const E={cloudUrl:"https://cloud.koodoreader.com",cloudCNUrl:"https://cloud.koodoreader.cn",testUrl:"https://cloudtest.960960.xyz",devUrl:"http://192.168.28.159:8000"},C={callbackUrl:"https://web.koodoreader.com/",cnCallbackUrl:"https://web.koodoreader.cn/",dropboxClientId:"vnc67byrssocvy1",yandexClientId:"e5305b62f53844b1994f77a840fd0a37",pcloudClientId:"pg8ten0B3vH",boxClientId:"ltimecqanmpxoaicn9qw3es6l3sdl1ya",duboxClientId:"kc0Ls6xLZugGgLLVhZ8yhUU1cRkRoKNU",yiyiwuClientId:"100197197",microsoftClientId:"506df58a-29ab-4020-afc5-6f423dc80f35",googleClientId:"1051055003225-ph1f5fvh328dhv7bco5jitlnfhg6ks2t.apps.googleusercontent.com",appleClientId:"com.koodoreader.auth",facebookClientId:"2845583825559500",githubClientId:"Ov23liJVzfvJMMEEZ8v2",adriveClientId:"a128ae7b9c094545af623de61dc0a1ef"},T={google:{clientId:C.googleClientId,scopes:["openid email profile"],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{prompt:"consent",scope:"openid email profile"}},microsoft:{clientId:C.microsoftClientId,scopes:["openid","profile","User.Read","offline_access"],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"openid profile User.Read offline_access"}},facebook:{clientId:C.facebookClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:""}},github:{clientId:C.githubClientId,scopes:["user:email"],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"user:email"}},apple:{clientId:C.appleClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{}},email:{clientId:"",scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:""}}},x=["backgroundColor","textColor","fontSize","margin","letterSpacing","paraSpacing","scale","brightness","fontFamily","subFontFamily","lineHeight","textAlign","textOrientation","convertChinese","selectAction","fullTranslationMode","readerMode","pdfReaderMode","isBold","isIndent","isSliding","isUnderline","isShadow","isItalic","isInvert","isBionic","isHyphenation","isOrphanWidow","isKeepPDFBackground","isAllowScript","isStartFromEven"];var F={CloudMode:"test",CloudConfig:E,ConvertLangMap:{en:"English",zhCN:"Chinese",zhTW:"Chinese",zhMO:"Chinese",tr:"Turkish",ar:"Arabic",ro:"Romanian",pl:"Polish",cs:"Czech",ja:"Japanese",ta:"Tamil",uk:"Ukrainian",sl:"Slovenian",bo:"Tibetan",id:"Indonesian",hy:"Armenian",el:"Greek",hu:"Hungarian",hi:"Hindi",bg:"Bulgarian",nl:"Dutch",it:"Italian",bn:"Bengali",tl:"Tagalog",sv:"Swedish",ga:"Irish",ko:"Korean",de:"German",ru:"Russian",es:"Spanish",fr:"French",fa:"Persian",ptBR:"Portuguese",th:"Thai",sr:"Serbian",am:"Amharic",da:"Danish",fi:"Finnish",ie:"Interlingue",pt:"Portuguese",vi:"Vietnamese"},ContentRegxConfig:[{label:"Default parser",value:"Default parser",subtitle:"Suitable for most txt files",regex:""},{label:"Chinese novel parser",value:"Chinese novel parser",subtitle:"Suitable for most Chinese novels, eg. 第一章,第2回",regex:"^\\s*(第[0-9一二三四五六七八九十百千万零壹贰叁肆伍陆柒捌玖拾佰仟]+[章回])\\s*"},{label:"English novel parser",value:"English novel parser",subtitle:"Suitable for most English novels, eg. Chapter 1, Part II",regex:"^\\s*(Chapter|Part|Book|CHAPTER|PART|BOOK)\\s*"},{label:"Number parser",value:"Number parser",subtitle:"Suitable for novels with number chapter titles, eg. 1, 2, 3",regex:"^\\s*([0-9]+[\\s.、::·\\-—]+|[一二三四五六七八九十百千万零]+[\\s.、::·\\-—]+).+"}],StyleKeys:x,ThirdpartyConfig:C,LoginAuthRequest:T,LoginDiscovery:{microsoft:{authorizationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token"},google:{authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",tokenEndpoint:"https://oauth2.googleapis.com/token"},facebook:{authorizationEndpoint:"https://www.facebook.com/v12.0/dialog/oauth",tokenEndpoint:"https://graph.facebook.com/v12.0/oauth/access_token"},github:{authorizationEndpoint:"https://github.com/login/oauth/authorize",tokenEndpoint:"https://github.com/login/oauth/access_token"},apple:{authorizationEndpoint:"https://appleid.apple.com/auth/authorize",tokenEndpoint:"https://appleid.apple.com/auth/token"},email:{authorizationEndpoint:"",tokenEndpoint:""}},DriveAuthRequest:{dropbox:{clientId:C.dropboxClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{token_access_type:"offline"}},yandex:{clientId:C.yandexClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{response_type:"code",force_confirm:"true"}},boxnet:{clientId:C.boxClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{grant_type:"authorization_code",box_subject_type:"enterprise",scope:"root_readwrite"}},pcloud:{clientId:C.pcloudClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{grant_type:"authorization_code"}},dubox:{clientId:C.duboxClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{response_type:"code",scope:"basic,netdisk",device_id:"119827642",qrcode:"1"}},yiyiwu:{clientId:C.yiyiwuClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{response_type:"code"}},adrive:{clientId:C.adriveClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{grant_type:"authorization_code",scope:"user:base,file:all:write,file:all:read"}},microsoft:{clientId:C.microsoftClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"files.readwrite.appfolder offline_access"}},google:{clientId:C.googleClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{prompt:"consent",scope:"https://www.googleapis.com/auth/drive.file",access_type:"offline"}},microsoft_exp:{clientId:C.microsoftClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"files.readwrite.all offline_access"}},google_exp:{clientId:C.googleClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{prompt:"consent",scope:"https://www.googleapis.com/auth/drive",access_type:"offline"}}},DriveDiscovery:{dropbox:{authorizationEndpoint:"https://www.dropbox.com/oauth2/authorize",tokenEndpoint:"https://www.dropbox.com/oauth2/token"},yandex:{authorizationEndpoint:"https://oauth.yandex.com/authorize",tokenEndpoint:"https://oauth.yandex.com/token"},boxnet:{authorizationEndpoint:"https://account.box.com/api/oauth2/authorize",tokenEndpoint:"https://api.box.com/oauth2/token"},pcloud:{authorizationEndpoint:"https://my.pcloud.com/oauth2/authorize",tokenEndpoint:"https://api.pcloud.com/oauth2_token"},dubox:{authorizationEndpoint:"https://openapi.baidu.com/oauth/2.0/authorize",tokenEndpoint:"https://openapi.baidu.com/oauth/2.0/token"},yiyiwu:{authorizationEndpoint:"https://passportapi.115.com/open/authorize",tokenEndpoint:"https://passportapi.115.com/open/authorize"},adrive:{authorizationEndpoint:"https://openapi.alipan.com/oauth/authorize",tokenEndpoint:"https://openapi.alipan.com/oauth/token"},microsoft:{authorizationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token"},google:{authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",tokenEndpoint:"https://oauth2.googleapis.com/token"},microsoft_exp:{authorizationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token"},google_exp:{authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",tokenEndpoint:"https://oauth2.googleapis.com/token"}},AiProviderList:[{id:"custom",name:"Custom model",defaultEndpoint:"",modelsEndpoint:""},{id:"openai",name:"OpenAI",defaultEndpoint:"https://api.openai.com/v1",modelsEndpoint:"https://api.openai.com/v1/models"},{id:"anthropic",name:"Anthropic",defaultEndpoint:"https://api.anthropic.com/v1",modelsEndpoint:"https://api.anthropic.com/v1/models"},{id:"google",name:"Google Gemini",defaultEndpoint:"https://generativelanguage.googleapis.com/v1beta/openai",modelsEndpoint:"https://generativelanguage.googleapis.com/v1beta/openai/models"},{id:"deepseek",name:"DeepSeek",defaultEndpoint:"https://api.deepseek.com/v1",modelsEndpoint:"https://api.deepseek.com/v1/models"},{id:"mistral",name:"Mistral AI",defaultEndpoint:"https://api.mistral.ai/v1",modelsEndpoint:"https://api.mistral.ai/v1/models"},{id:"cohere",name:"Cohere",defaultEndpoint:"https://api.cohere.ai/compatibility/v1",modelsEndpoint:"https://api.cohere.ai/compatibility/v1/models"},{id:"groq",name:"Groq",defaultEndpoint:"https://api.groq.com/openai/v1",modelsEndpoint:"https://api.groq.com/openai/v1/models"},{id:"together",name:"Together AI",defaultEndpoint:"https://api.together.xyz/v1",modelsEndpoint:"https://api.together.xyz/v1/models"},{id:"fireworks",name:"Fireworks AI",defaultEndpoint:"https://api.fireworks.ai/inference/v1",modelsEndpoint:"https://api.fireworks.ai/inference/v1/models"},{id:"perplexity",name:"Perplexity",defaultEndpoint:"https://api.perplexity.ai",modelsEndpoint:"https://api.perplexity.ai/v1/models"},{id:"openrouter",name:"OpenRouter",defaultEndpoint:"https://openrouter.ai/api/v1",modelsEndpoint:"https://openrouter.ai/api/v1/models"},{id:"ai21",name:"AI21 Labs",defaultEndpoint:"https://api.ai21.com/studio/v1",modelsEndpoint:"https://api.ai21.com/studio/v1/models"},{id:"xai",name:"xAI (Grok)",defaultEndpoint:"https://api.x.ai/v1",modelsEndpoint:"https://api.x.ai/v1/models"},{id:"sambanova",name:"SambaNova",defaultEndpoint:"https://api.sambanova.ai/v1",modelsEndpoint:"https://api.sambanova.ai/v1/models"},{id:"cerebras",name:"Cerebras",defaultEndpoint:"https://api.cerebras.ai/v1",modelsEndpoint:"https://api.cerebras.ai/v1/models"},{id:"hyperbolic",name:"Hyperbolic",defaultEndpoint:"https://api.hyperbolic.xyz/v1",modelsEndpoint:"https://api.hyperbolic.xyz/v1/models"},{id:"novita",name:"Novita AI",defaultEndpoint:"https://api.novita.ai/openai",modelsEndpoint:"https://api.novita.ai/openai/models"},{id:"lepton",name:"Lepton AI",defaultEndpoint:"https://llm.lepton.run/api/v1",modelsEndpoint:"https://llm.lepton.run/api/v1/models"},{id:"deepinfra",name:"DeepInfra",defaultEndpoint:"https://api.deepinfra.com/v1/openai",modelsEndpoint:"https://api.deepinfra.com/v1/openai/models"},{id:"replicate",name:"Replicate",defaultEndpoint:"https://api.replicate.com/v1",modelsEndpoint:"https://api.replicate.com/v1/models"},{id:"zhipu",name:"Zhipu AI (智谱)",defaultEndpoint:"https://open.bigmodel.cn/api/paas/v4",modelsEndpoint:"https://open.bigmodel.cn/api/paas/v4/models"},{id:"qwen",name:"Alibaba Qwen (通义千问)",defaultEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1",modelsEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/models"},{id:"moonshot",name:"Moonshot (月之暗面)",defaultEndpoint:"https://api.moonshot.cn/v1",modelsEndpoint:"https://api.moonshot.cn/v1/models"},{id:"baidu",name:"Baidu ERNIE (文心一言)",defaultEndpoint:"https://qianfan.baidubce.com/v2",modelsEndpoint:"https://qianfan.baidubce.com/v2/models"},{id:"doubao",name:"Volcengine Doubao (豆包)",defaultEndpoint:"https://ark.cn-beijing.volces.com/api/v3",modelsEndpoint:"https://ark.cn-beijing.volces.com/api/v3/models"},{id:"spark",name:"iFlytek Spark (讯飞星火)",defaultEndpoint:"https://spark-api-open.xf-yun.com/v1",modelsEndpoint:"https://spark-api-open.xf-yun.com/v1/models"},{id:"hunyuan",name:"Tencent Hunyuan (腾讯混元)",defaultEndpoint:"https://api.hunyuan.cloud.tencent.com/v1",modelsEndpoint:"https://api.hunyuan.cloud.tencent.com/v1/models"},{id:"minimax",name:"MiniMax",defaultEndpoint:"https://api.minimax.chat/v1",modelsEndpoint:"https://api.minimax.chat/v1/models"},{id:"baichuan",name:"Baichuan (百川)",defaultEndpoint:"https://api.baichuan-ai.com/v1",modelsEndpoint:"https://api.baichuan-ai.com/v1/models"},{id:"stepfun",name:"StepFun (阶跃星辰)",defaultEndpoint:"https://api.stepfun.com/v1",modelsEndpoint:"https://api.stepfun.com/v1/models"},{id:"lingyi",name:"Lingyiwanwu (零一万物)",defaultEndpoint:"https://api.lingyiwanwu.com/v1",modelsEndpoint:"https://api.lingyiwanwu.com/v1/models"},{id:"siliconflow",name:"SiliconFlow (硅基流动)",defaultEndpoint:"https://api.siliconflow.cn/v1",modelsEndpoint:"https://api.siliconflow.cn/v1/models"},{id:"infini",name:"Infini AI (无问芯穹)",defaultEndpoint:"https://cloud.infini-ai.com/maas/v1",modelsEndpoint:"https://cloud.infini-ai.com/maas/v1/models"},{id:"ollama",name:"Ollama (Local)",defaultEndpoint:"http://localhost:11434/v1",modelsEndpoint:"http://localhost:11434/v1/models"},{id:"lmstudio",name:"LM Studio (Local)",defaultEndpoint:"http://localhost:1234/v1",modelsEndpoint:"http://localhost:1234/v1/models"},{id:"vllm",name:"vLLM (Local)",defaultEndpoint:"http://localhost:8000/v1",modelsEndpoint:"http://localhost:8000/v1/models"},{id:"azure",name:"Azure OpenAI",defaultEndpoint:"",modelsEndpoint:""},{id:"aws_bedrock",name:"AWS Bedrock",defaultEndpoint:"",modelsEndpoint:""}],DefaultPrompts:{aiTranslate:"You are a professional translator. Translate the following text from {from} to {to}. Only return the translated text, no explanations.\n\nText: {text}",aiDict:"You are a professional dictionary assistant. Analyze the word or phrase: {word}\nProvide a comprehensive explanation including pronunciation, definitions, example sentences, and usage notes using {to} as the target language. ",aiAssistance:"You are a helpful reading assistant. The user is reading a book. Here is the context:\n{text}\n\nAnswer the user's question concisely and helpfully, and reply with the same language."},SpeechList:[{label:"English",code:"en",example:"To be, or not to be, that is the question."},{label:"Simplified Chinese",code:"zh",example:"千里之行,始于足下。"},{label:"Japanese",code:"ja",example:"猿も木から落ちる。"},{label:"Korean",code:"ko",example:"가는 날이 장날이다."},{label:"French",code:"fr",example:"Liberté, égalité, fraternité."},{label:"German",code:"de",example:"Der Weg ist das Ziel."},{label:"Spanish",code:"es",example:"La vida es un sueño."},{label:"Italian",code:"it",example:"Dolce far niente."},{label:"Russian",code:"ru",example:"Век живи, век учись."},{label:"Portuguese",code:"pt",example:"Saudade é um sentimento profundo."},{label:"Hindi",code:"hi",example:"सपने वो नहीं जो हम सोते वक्त देखते हैं।"},{label:"Afrikaans",code:"af",example:"Die lewe is 'n geskenk."},{label:"Amharic",code:"am",example:"ዕውቀት ብርሃን ነው።"},{label:"Arabic",code:"ar",example:"العلم نور والجهل ظلام."},{label:"Azerbaijani",code:"az",example:"Elm işıqdır, cəhalət zülmət."},{label:"Bulgarian",code:"bg",example:"Знанието е сила."},{label:"Bengali",code:"bn",example:"জ্ঞানই শক্তি।"},{label:"Bosnian",code:"bs",example:"Znanje je moć."},{label:"Catalan",code:"ca",example:"El saber no ocupa lloc."},{label:"Czech",code:"cs",example:"Bez práce nejsou koláče."},{label:"Welsh",code:"cy",example:"Nid aur popeth melyn."},{label:"Danish",code:"da",example:"Lykken er ikke et sted, men en retning."},{label:"Greek",code:"el",example:"Η γνώση είναι δύναμη."},{label:"Estonian",code:"et",example:"Teadmine on jõud."},{label:"Basque",code:"eu",example:"Jakitea boterea da."},{label:"Persian",code:"fa",example:"دانش قدرت است."},{label:"Finnish",code:"fi",example:"Tieto on valtaa."},{label:"Filipino",code:"fil",example:"Ang kaalaman ay kapangyarihan."},{label:"Irish",code:"ga",example:"Is fearr Gaeilge briste ná Béarla cliste."},{label:"Galician",code:"gl",example:"O saber non ocupa lugar."},{label:"Gujarati",code:"gu",example:"જ્ઞાન શક્તિ છે."},{label:"Hebrew",code:"he",example:"ידע הוא כוח."},{label:"Croatian",code:"hr",example:"Znanje je moć."},{label:"Hungarian",code:"hu",example:"A tudás hatalom."},{label:"Armenian",code:"hy",example:"Գիտելիքը ուժ է."},{label:"Indonesian",code:"id",example:"Pengetahuan adalah kekuatan."},{label:"Icelandic",code:"is",example:"Þekking er máttur."},{label:"Inuktitut",code:"iu",example:"ᐃᓕᓐᓂᐊᕐᓂᖅ ᐱᒻᒪᕆᐅᕗᖅ."},{label:"Javanese",code:"jv",example:"Ilmu iku kelakone kanthi laku."},{label:"Georgian",code:"ka",example:"ცოდნა ძალაა."},{label:"Kazakh",code:"kk",example:"Білім — күш."},{label:"Khmer",code:"km",example:"ចំណេះដឹងគឺជាអំណាច។"},{label:"Kannada",code:"kn",example:"ಜ್ಞಾನವೇ ಶಕ್ತಿ."},{label:"Lao",code:"lo",example:"ຄວາມຮູ້ຄືພະລັງ."},{label:"Lithuanian",code:"lt",example:"Žinios yra jėga."},{label:"Latvian",code:"lv",example:"Zināšanas ir spēks."},{label:"Macedonian",code:"mk",example:"Знаењето е моќ."},{label:"Malayalam",code:"ml",example:"അറിവ് ശക്തിയാണ്."},{label:"Mongolian",code:"mn",example:"Мэдлэг бол хүч."},{label:"Marathi",code:"mr",example:"ज्ञान हीच शक्ती आहे."},{label:"Malay",code:"ms",example:"Ilmu itu cahaya."},{label:"Maltese",code:"mt",example:"L-għarfien huwa l-poter."},{label:"Burmese",code:"my",example:"ဗဟုသုတသည် အားဖြစ်သည်။"},{label:"Norwegian",code:"nb",example:"Kunnskap er makt."},{label:"Nepali",code:"ne",example:"ज्ञान नै शक्ति हो।"},{label:"Dutch",code:"nl",example:"Kennis is macht."},{label:"Odia",code:"or",example:"ଜ୍ଞାନ ହିଁ ଶକ୍ତି।"},{label:"Punjabi",code:"pa",example:"ਗਿਆਨ ਹੀ ਸ਼ਕਤੀ ਹੈ।"},{label:"Polish",code:"pl",example:"Wiedza to potęga."},{label:"Pashto",code:"ps",example:"د پوهې ډیوه روښانه ده."},{label:"Romanian",code:"ro",example:"Cartea este o comoară."},{label:"Sinhala",code:"si",example:"දැනුම බලයකි."},{label:"Slovak",code:"sk",example:"Vedomosti sú sila."},{label:"Slovenian",code:"sl",example:"Znanje je moč."},{label:"Somali",code:"so",example:"Aqoontu waa iftiin."},{label:"Albanian",code:"sq",example:"Dija është fuqi."},{label:"Serbian",code:"sr",example:"Знање је моћ."},{label:"Sundanese",code:"su",example:"Élmu éta cahaya."},{label:"Swedish",code:"sv",example:"Kunskap är makt."},{label:"Swahili",code:"sw",example:"Maarifa ni nguvu."},{label:"Tamil",code:"ta",example:"அறிவே ஆற்றல்."},{label:"Telugu",code:"te",example:"జ్ఞానమే శక్తి."},{label:"Thai",code:"th",example:"ความรู้คือพลัง."},{label:"Turkish",code:"tr",example:"Bilgi güçtür."},{label:"Ukrainian",code:"uk",example:"Знання — сила."},{label:"Urdu",code:"ur",example:"علم ہی طاقت ہے۔"},{label:"Uzbek",code:"uz",example:"Bilim – kuch."},{label:"Vietnamese",code:"vi",example:"Học vấn là sức mạnh."},{label:"Wu Chinese",code:"wuu",example:"学问是力量。"},{label:"Cantonese",code:"yue",example:"知識就係力量。"},{label:"Zulu",code:"zu",example:"Ulwazi lungamandla."}],HighlightStyleTypes:[{value:"background",label:"Highlight background"},{value:"underline",label:"Underline"},{value:"strikethrough",label:"Strikethrough"},{value:"wavy",label:"Wavy underline"}],HighlightPresetColors:{background:["#F3C9C9","#FEF3CD","#CEFACD","#CDE9FA"],underline:["#FF0000","#60A5FA","#FF9900","#2EFF2E"],strikethrough:["#FF0000","#60A5FA","#FF9900","#2EFF2E"],wavy:["#FF0000","#60A5FA","#FF9900","#2EFF2E"]},PresetThemeList:[{key:"yellow",textColor:"rgba(89, 68, 41,1)",backgroundColor:"rgba(233, 216, 188,1)",title:"羊皮"},{key:"green",textColor:"rgba(54, 80, 62,1)",backgroundColor:"rgba(197, 231, 207,1)",title:"护眼"},{key:"light",textColor:"rgba(0,0,0,1)",backgroundColor:"rgba(255,255,255,1)",title:"白天"},{key:"night",textColor:"rgba(255,255,255,1)",backgroundColor:"rgba(44,47,49,1)",title:"黑夜"},{key:"sepia",textColor:"rgba(93, 64, 55,1)",backgroundColor:"rgba(245, 235, 220,1)",title:"古卷"},{key:"blue",textColor:"rgba(28, 52, 84,1)",backgroundColor:"rgba(230, 240, 250,1)",title:"晨雾"},{key:"purple",textColor:"rgba(68, 42, 84,1)",backgroundColor:"rgba(240, 230, 250,1)",title:"紫萝"},{key:"pink",textColor:"rgba(84, 42, 68,1)",backgroundColor:"rgba(250, 235, 245,1)",title:"樱花"},{key:"brown",textColor:"rgba(74, 54, 42,1)",backgroundColor:"rgba(240, 230, 215,1)",title:"木纹"},{key:"gray",textColor:"rgba(64, 64, 64,1)",backgroundColor:"rgba(240, 240, 240,1)",title:"素雅"},{key:"darkgreen",textColor:"rgba(200, 220, 200,1)",backgroundColor:"rgba(25, 35, 30,1)",title:"深林"},{key:"darkblue",textColor:"rgba(200, 210, 230,1)",backgroundColor:"rgba(20, 30, 45,1)",title:"深海"},{key:"coral",textColor:"rgba(84, 50, 42,1)",backgroundColor:"rgba(255, 235, 230,1)",title:"珊瑚"},{key:"mint",textColor:"rgba(42, 74, 64,1)",backgroundColor:"rgba(230, 250, 245,1)",title:"薄荷"},{key:"lavender",textColor:"rgba(54, 42, 74,1)",backgroundColor:"rgba(245, 240, 255,1)",title:"薰衣"},{key:"cream",textColor:"rgba(74, 64, 42,1)",backgroundColor:"rgba(255, 250, 240,1)",title:"奶油"},{key:"darkbrown",textColor:"rgba(230, 215, 200,1)",backgroundColor:"rgba(35, 25, 20,1)",title:"深棕"},{key:"olive",textColor:"rgba(64, 74, 42,1)",backgroundColor:"rgba(240, 245, 230,1)",title:"橄榄"},{key:"rose",textColor:"rgba(84, 42, 54,1)",backgroundColor:"rgba(255, 240, 245,1)",title:"玫瑰"},{key:"slate",textColor:"rgba(54, 64, 74,1)",backgroundColor:"rgba(235, 240, 245,1)",title:"石板"}]};class ${constructor(e){this.config=e,this.driveId="",this.taskQueue=new S(1),void 0===this.config.baseFolder?this.baseFolder="/KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,t=3){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}getDriveId(){return p(this,void 0,void 0,(function*(){if(this.driveId)return this.driveId;const t=this.config.access_token,o=yield e.post("https://openapi.alipan.com/adrive/v1.0/user/getDriveInfo",{},{headers:{Authorization:`Bearer ${t}`}});return this.driveId=o.data.default_drive_id,this.driveId}))}getFolderIdByPath(t){return p(this,void 0,void 0,(function*(){const o=this.config.access_token,i=yield this.getDriveId();try{try{const r=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:i,file_path:t},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});if(r.data)return r.data.file_id}catch(r){const n=t.split("/").filter((e=>e));let s="",a="root";for(const t of n){s+="/"+t;try{a=(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:i,file_path:s},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}})).data.file_id}catch(r){a=(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/create",{drive_id:i,parent_file_id:a,name:t,type:"folder",check_name_mode:"refuse"},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}})).data.file_id}}return a}}catch(e){return console.error("Error getting/creating folder by path:",e),""}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,i=yield this.getDriveId(),r=yield this.getFolderIdByPath(this.baseFolder+"/"+t);let n=[],s="",a=!0;for(;a;){const t=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/list",{drive_id:i,parent_file_id:r,marker:s||void 0},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}),d=t.data.items.filter((e=>!e.punish_flag||2!==e.punish_flag))||[];n=n.concat(d),s=t.data.next_marker,a=!!s&&100===d.length}return[...new Set(n.map((e=>({name:e.name,size:e.size,type:e.type,modified:e.updated_at}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,i=yield this.getDriveId(),r=yield this.getFolderIdByPath(this.baseFolder+"/"+t);return!r||(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/delete",{drive_id:i,file_id:r},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}),!0)}catch(e){return console.error("Error deleting file:",e),!1}}))}checkExists(t){var o;return p(this,void 0,void 0,(function*(){try{const i=this.config.access_token,r=yield this.getDriveId(),n=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:r,file_path:t},{headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"}});(null===(o=n.data)||void 0===o?void 0:o.file_id)&&(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/recyclebin/trash",{drive_id:r,file_id:n.data.file_id},{headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"}}))}catch(e){}}))}getAuthUrl(e){return`https://openapi.alipan.com/oauth/authorize?${new URLSearchParams({response_type:"code",client_id:C.adriveClientId,redirect_uri:e,grant_type:"authorization_code",scope:"user:base,file:all:write,file:all:read"}).toString()}`}}class _ extends ${constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=this.config.access_token,r=yield this.getDriveId(),n=o.substring(0,o.lastIndexOf("/")),s=o.substring(o.lastIndexOf("/")+1);yield this.deleteFileWithoutQueue(o);const a=yield this.getFolderIdByPath(this.baseFolder+"/"+n),d=yield t.arrayBuffer(),l=d.byteLength,c=yield crypto.subtle.digest("SHA-1",d),u=Array.from(new Uint8Array(c)).map((e=>e.toString(16).padStart(2,"0"))).join(""),h=(e=>{function t(e,t){const o=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(o>>16)<<16|65535&o}function o(e,o,i,r,n,s){return t((a=t(t(o,e),t(r,s)))<<(d=n)|a>>>32-d,i);var a,d}function i(e,t,i,r,n,s,a){return o(t&i|~t&r,e,t,n,s,a)}function r(e,t,i,r,n,s,a){return o(t&r|i&~r,e,t,n,s,a)}function n(e,t,i,r,n,s,a){return o(t^i^r,e,t,n,s,a)}function s(e,t,i,r,n,s,a){return o(i^(t|~r),e,t,n,s,a)}const a=function(e){const t=e.length,o=1+(t+8>>6),i=new Array(16*o).fill(0);for(let o=0;o>2]|=e.charCodeAt(o)<>2]|=128<{let t="";for(let o=0;o<4;o++)t+=("0"+(e>>8*o&255).toString(16)).slice(-2);return t})).join("")})(i),p=Number(BigInt("0x"+h.slice(0,16))%BigInt(l||1)),f=new Uint8Array(d.slice(p,Math.min(p+8,l))),g=btoa(String.fromCharCode(...f)),y=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/create",{drive_id:r,parent_file_id:a,name:s,type:"file",check_name_mode:"ignore",size:l,content_hash:u,content_hash_name:"sha1",proof_code:g,proof_version:"v1",part_info_list:[{part_number:1}]},{headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"}}),{file_id:m,upload_id:v,rapid_upload:k,part_info_list:b}=y.data;return k?(console.info("阿里云盘秒传成功"),!0):(yield fetch(b[0].upload_url,{method:"PUT",body:d,headers:{"Content-Length":l.toString()}}),yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/complete",{drive_id:r,file_id:m,upload_id:v},{headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"}}),!0)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=this.config.access_token,i=yield this.getDriveId(),r=(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:i,file_path:this.baseFolder+"/"+t},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}})).data.file_id,n=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/getDownloadUrl",{drive_id:i,file_id:r},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});return(yield e.get(n.data.url,{responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}})).data}catch(e){return console.error("Error downloading file:",e),!1}}))))))}}class O{constructor(e){this.config=e,this.taskQueue=new S(3),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,t=3){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}getFolderIdByPath(t){return p(this,void 0,void 0,(function*(){if(""==t)return"0";const o=this.config.access_token,i=t.split("/");let r="0";for(const t of i){const i=`https://api.box.com/2.0/folders/${r}/items?fields=id,name&type=folder&limit=1000`;try{const n=(yield e.get(i,{headers:{Authorization:`Bearer ${o}`}})).data.entries.find((e=>e.name===t&&"folder"===e.type));if(n)r=n.id;else{const i={name:t,parent:{id:r},type:"folder"};r=(yield e.post("https://api.box.com/2.0/folders",i,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}})).data.id}}catch(e){return console.error("Error occurred during folder creation:",e),""}}return r}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let i=this.baseFolder+"/"+t;for(;i.startsWith("/");)i=i.substring(1);let r=yield this.getFolderIdByPath(i),n=[],s=0,a=!0;const d=1e3;for(;a;){const t=yield e.get(`https://api.box.com/2.0/folders/${r}/items`,{params:{limit:d,offset:s},headers:{Authorization:`Bearer ${o}`}}),i=t.data.entries||[];n=n.concat(i),s+=i.length,a=i.length===d&&t.data.total_count>s}return[...new Set(n.map((e=>({name:e.name,size:e.size||0,type:e.type,modified:e.content_modified_at}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,i=t.substring(0,t.lastIndexOf("/")),r=t.substring(t.lastIndexOf("/")+1);let n=this.baseFolder+"/"+i;for(;n.startsWith("/");)n=n.substring(1);const s=yield this.getFolderIdByPath(n);if(!s)return!0;const a=`https://api.box.com/2.0/folders/${s}/items?fields=id,name&type=file&limit=1000`,d=(yield e.get(a,{headers:{Authorization:`Bearer ${o}`}})).data.entries.find((e=>e.name===r&&"file"===e.type));return!d||(yield e.delete(`https://api.box.com/2.0/files/${d.id}`,{headers:{Authorization:`Bearer ${o}`}}),!0)}catch(e){return console.error("Error deleting file:",e),!1}}))}getAuthUrl(e){return`https://account.box.com/api/oauth2/authorize?${new URLSearchParams({response_type:"code",client_id:C.boxClientId,redirect_uri:e,grant_type:"authorization_code",box_subject_type:"enterprise",scope:"root_readwrite"}).toString()}`}}class A extends O{constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=this.config.access_token,r=o.substring(0,o.lastIndexOf("/")),n=o.substring(o.lastIndexOf("/")+1);let s=this.baseFolder+"/"+r;for(;s.startsWith("/");)s=s.substring(1);const a=yield this.getFolderIdByPath(s);if(!a)throw new Error("Folder not found");const d=(yield this.listFiles(r)).find((e=>e===n));d&&(yield this.deleteFileWithoutQueue(r+"/"+n));let l=new File([t],n,{lastModified:(new Date).getTime(),type:t.type});const c=new FormData;c.append("file",l),c.append("parent_id",a);const u=yield e.post("https://upload.box.com/api/2.0/files/content",c,{headers:{Authorization:`Bearer ${i}`,"Content-Type":"multipart/form-data"},params:{if_match:"false",fields:"name,id"},maxContentLength:1/0,maxBodyLength:1/0});return!(u.status>=300)||(console.error("Error occurred during file upload:",u),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=this.config.access_token,i=t.substring(0,t.lastIndexOf("/")),r=t.substring(t.lastIndexOf("/")+1);let n=this.baseFolder+"/"+i;for(;n.startsWith("/");)n=n.substring(1);const s=yield this.getFolderIdByPath(n);if(!s)return console.error("Folder not found"),!0;const a=`https://api.box.com/2.0/folders/${s}/items?fields=id,name&type=file&limit=1000`,d=(yield e.get(a,{headers:{Authorization:`Bearer ${o}`}})).data.entries.find((e=>e.name===r&&"file"===e.type));if(!d)return console.error("File not found:",r),!0;const l=yield e({url:`https://api.box.com/2.0/files/${d.id}/content`,method:"get",headers:{Authorization:`Bearer ${o}`},responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return l.status>=300?(console.error("Error occurred during file download:",l),!1):l.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class I{constructor(e){this.config=e,this.taskQueue=new S(3)}retryOperation(e,t=3){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let i=[],r=!0,n=null;for(;r;){let s;s=n?yield e.post("https://api.dropboxapi.com/2/files/list_folder/continue",{cursor:n},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}):yield e.post("https://api.dropboxapi.com/2/files/list_folder",{path:"/"+t,limit:2e3},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});const a=s.data.entries||[];i=i.concat(a),r=s.data.has_more,n=s.data.cursor}return[...new Set(i.map((e=>({name:e.name,size:e.size||0,type:e[".tag"],modified:e.client_modified}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;yield e.post("https://api.dropboxapi.com/2/files/delete_v2",{path:"/"+t},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});return!0}catch(e){return console.error("Error deleting file:",e),!1}}))}getAuthUrl(e){return`https://www.dropbox.com/oauth2/authorize?response_type=code&token_access_type=offline&client_id=${C.dropboxClientId}&redirect_uri=${e}`}}class R extends I{constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=this.config.access_token;let r=o.split("/").pop()||"",n=new File([t],r,{lastModified:(new Date).getTime(),type:t.type});const s=yield e.post("https://content.dropboxapi.com/2/files/upload",n,{headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/octet-stream","Dropbox-API-Arg":JSON.stringify({path:"/"+o,mode:"overwrite",autorename:!0,mute:!1})},maxContentLength:1/0,maxBodyLength:1/0});return!(s.status>=300)||(console.error("Error occurred during file upload:",s),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=this.config.access_token,i=yield e({url:"https://content.dropboxapi.com/2/files/download",method:"post",headers:{Authorization:`Bearer ${o}`,"Dropbox-API-Arg":JSON.stringify({path:"/"+t})},maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return i.status>=300?(console.error("Error occurred during file download:",i),!1):i.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class L{constructor(e){this.folderExistsCache=new Set,this.config=e,this.taskQueue=new S(3),void 0===this.config.baseFolder?this.baseFolder="/KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,t=3){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){var o,i;return p(this,void 0,void 0,(function*(){try{const r=this.config.access_token;for(t=this.baseFolder+"/"+t;t.startsWith("/");)t=t.substring(1);let n=[],s=0;const a=1e3;let d=!0;for(;d;){const l=yield e.get("https://cloud-api.yandex.net/v1/disk/resources",{headers:{Authorization:`OAuth ${r}`,"Content-Type":"application/json"},params:{path:t?`/${t}`:"/",limit:a,offset:s,fields:"_embedded.items.name,_embedded.items.size,_embedded.items.type,_embedded.items.modified,_embedded.total"}}),c=(null===(o=l.data._embedded)||void 0===o?void 0:o.items)||[];n=n.concat(c);const u=(null===(i=l.data._embedded)||void 0===i?void 0:i.total)||0;s+=c.length,d=s({name:e.name,size:e.size||0,type:"file"===e.type?"file":"folder",modified:e.modified}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;for(t=this.baseFolder+"/"+t;t.startsWith("/");)t=t.substring(1);const i=yield e.delete("https://cloud-api.yandex.net/v1/disk/resources",{headers:{Authorization:`OAuth ${o}`,"Content-Type":"application/json"},params:{path:t?`/${t}`:"/",permanently:!1}});return 202===i.status||204===i.status}catch(e){return console.error("Error deleting file:",e),!1}}))}ensureDirectoryExists(t){var o,i;return p(this,void 0,void 0,(function*(){try{const r=this.config.access_token,n=t.split("/").filter((e=>e.length>0));let s="";for(const t of n)if(s+="/"+t,!this.folderExistsCache.has(s))try{yield e.get("https://cloud-api.yandex.net/v1/disk/resources",{headers:{Authorization:`OAuth ${r}`,"Content-Type":"application/json"},params:{path:s}}),this.folderExistsCache.add(s)}catch(t){if(404!==(null===(o=t.response)||void 0===o?void 0:o.status))return console.error("Error checking directory:",t),!1;try{yield e.put(`https://cloud-api.yandex.net/v1/disk/resources?path=${encodeURIComponent(s)}`,null,{headers:{Authorization:`OAuth ${r}`}}),this.folderExistsCache.add(s)}catch(e){if(409!==(null===(i=e.response)||void 0===i?void 0:i.status))return console.error("Error creating directory:",e),!1;this.folderExistsCache.add(s)}}return!0}catch(e){return console.error("Error ensuring directory exists:",e),!1}}))}getAuthUrl(e){return`https://oauth.yandex.com/authorize?response_type=code&client_id=${C.yandexClientId}&redirect_uri=${e}&force_confirm=true`}}class D extends L{constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=this.config.access_token;let r=this.baseFolder+"/"+o;for(;r.startsWith("/");)r=r.substring(1);const n=r.substring(0,r.lastIndexOf("/"));if(n){if(!(yield this.ensureDirectoryExists(n)))return console.error("Failed to create directory:",n),!1}const s=yield e.get("https://cloud-api.yandex.net/v1/disk/resources/upload",{headers:{Authorization:`OAuth ${i}`,"Content-Type":"application/json"},params:{path:`/${r}`,overwrite:!0}});if(200!==s.status)return console.error("Error getting upload URL:",s),!1;const a=s.data.href;let d=o.split("/").pop()||"",l=new File([t],d,{lastModified:(new Date).getTime(),type:t.type});const c=yield e.put(a,l,{headers:{"Content-Type":t.type||"application/octet-stream"},maxContentLength:1/0,maxBodyLength:1/0});return!(c.status>=300)||(console.error("Error occurred during file upload:",c),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=this.config.access_token;let i=this.baseFolder+"/"+t;for(;i.startsWith("/");)i=i.substring(1);const r=yield e.get("https://cloud-api.yandex.net/v1/disk/resources/download",{headers:{Authorization:`OAuth ${o}`,"Content-Type":"application/json"},params:{path:`/${i}`}});if(200!==r.status)return console.error("Error getting download URL:",r),!1;const n=r.data.href,s=yield e({url:n,method:"get",maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return s.status>=300?(console.error("Error occurred during file download:",s),!1):s.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class U{constructor(e){this.isExp=!1,this.folderIdCache=new Map,this.config=e,this.taskQueue=new S(3),this.isExp=this.config.isExp||!1,this.baseFolder="KoodoReader"}retryOperation(e,t=3){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}getFileId(t,o){return p(this,void 0,void 0,(function*(){const i=this.config.access_token,r=`https://www.googleapis.com/drive/v3/files?q=name='${t}'+and+'${o}'+in+parents&fields=files(id,name)`;try{const t=yield e.get(r,{headers:{Authorization:"Bearer "+i}});if(0===t.data.files.length)return"";const o=t.data.files;return o.length>0?o[0].id:null}catch(e){return console.error("Error occurred during file list retrieval:",e),""}}))}checkFolder(t){return p(this,void 0,void 0,(function*(){t=this.baseFolder+"/"+t;const o=this.config.access_token;if(""===t)return"root";if(this.folderIdCache.has(t))return this.folderIdCache.get(t);const i=t.split("/").filter((e=>""!==e.trim()));let r="root",n="";for(const t of i){if(n=n?n+"/"+t:t,this.folderIdCache.has(n)){r=this.folderIdCache.get(n);continue}let i=yield this.getFolderId(t,r);if(!i){const n={name:t,mimeType:"application/vnd.google-apps.folder",parents:[r]};try{i=(yield e.post("https://www.googleapis.com/drive/v3/files",n,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}})).data.id}catch(e){throw console.error(`Error occurred during folder creation for ${t}:`,e),e}}this.folderIdCache.set(n,i),r=i}return r}))}getFolderId(t,o){return p(this,void 0,void 0,(function*(){const i=this.config.access_token,r=`https://www.googleapis.com/drive/v3/files?q=name='${t=encodeURIComponent(t)}'+and+mimeType='application/vnd.google-apps.folder'+and+'${o}'+in+parents&fields=files(id,name)`;try{const t=(yield e.get(r,{headers:{Authorization:`Bearer ${i}`}})).data.files;return t.length>0?t[0].id:null}catch(e){throw console.error("Error occurred during fetching folder ID:",e),e}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let i=yield this.checkFolder(t),r=[],n="",s=!0;for(;s;){let t=`https://www.googleapis.com/drive/v3/files?q='${i}'+in+parents&fields=nextPageToken,files(id,name,size,mimeType)&pageSize=1000`;n&&(t+=`&pageToken=${n}`);const a=yield e.get(t,{headers:{Authorization:`Bearer ${o}`}}),d=a.data.files||[];r=r.concat(d),n=a.data.nextPageToken,s=!!n}return[...new Set(r.map((e=>({name:e.name,size:e.size||0,type:"application/vnd.google-apps.folder"===e.mimeType?"folder":"file",modified:e.modifiedTime}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQue(e)}))))))}))}deleteFileWithoutQue(t){return p(this,void 0,void 0,(function*(){const o=t.split("/").pop()||"",i=t.split("/").slice(0,-1).join("/"),r=yield this.checkFolder(i),n=this.config.access_token,s=yield this.getFileId(o,r);if(""===s)return console.error("File not found:",o),!0;try{const t=yield e.delete(`https://www.googleapis.com/drive/v3/files/${s}`,{headers:{Authorization:`Bearer ${n}`}});return console.error("File deleted:",t),!0}catch(e){return console.error("Error deleting file:",e),!1}}))}getAuthUrl(e){return`https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=${e}&prompt=consent&response_type=code&client_id=${C.googleClientId}&scope=https://www.googleapis.com/auth/${this.isExp?"drive":"drive.file"}&access_type=offline`}}class j extends U{constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=this.config.access_token;let r=o.split("/").pop()||"",n=new File([t],r,{lastModified:(new Date).getTime(),type:t.type}),s=o.split(".").pop(),a=f(s||""),d=o.split("/")[0],l=yield this.checkFolder(d),c=yield this.getFileId(r||"",l);const u={mimeType:a,name:r,parents:[l]},h=c?`https://www.googleapis.com/upload/drive/v3/files/${c}?uploadType=resumable`:"https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable",p=(yield e({method:c?"PATCH":"POST",url:h,data:c?null:JSON.stringify(u),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json; charset=UTF-8"},maxContentLength:1/0,maxBodyLength:1/0})).headers.location,g=yield this.getData(n);if(0===Object.keys(g).length)return!1;const y=yield e.put(p,g.data,{headers:{Authorization:"Bearer "+i,"Content-Type":"application/zip","Content-Range":`bytes 0-${g.fileSize-1}/${g.fileSize}`},maxContentLength:1/0,maxBodyLength:1/0});return!(y.status>=300)||(console.error("Error occurred during file download:",y),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=this.config.access_token;let i=t.split("/").pop(),r=t.split("/")[0],n=yield this.checkFolder(r),s=yield this.getFileId(i||"",n);if(!s)return console.error("File not found:",i),!0;const a=`https://www.googleapis.com/drive/v3/files/${s}?alt=media`,d=yield e.get(a,{headers:{Authorization:"Bearer "+o},maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return d.status>=300?(console.error("Error occurred during file download:",d),!1):d.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}getData(e){return p(this,void 0,void 0,(function*(){return e?new Promise(((t,o)=>{const i=new FileReader;i.onload=o=>t({fileName:e.name,mimeType:e.type,fileSize:e.size,data:o.target.result}),i.onerror=e=>o(e),i.readAsArrayBuffer(e)})):{}}))}}class P{constructor(e){this.folderCreationLocks=new Map,this.config=e,this.taskQueue=new S(3),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,t=2){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}getStorage(){return p(this,void 0,void 0,(function*(){if(this.storage)return this.storage;let{email:e,password:o}=this.config;return this.storage=yield new t({email:e,password:o,userAgent:"KoodoReader/1.0"}).ready,this.storage}))}getRoot(){return p(this,void 0,void 0,(function*(){if(this.root)return this.root;const e=(yield this.getStorage()).root;if(""===this.baseFolder)return this.root=e,this.root;let t=e.children.find((e=>e.name===this.baseFolder&&e.directory));return t||(t=yield e.mkdir(this.baseFolder)),this.root=t,this.root}))}createFolder(e,t){return p(this,void 0,void 0,(function*(){const o=`${e.nodeId}_${t}`;if(this.folderCreationLocks.has(o))return yield this.folderCreationLocks.get(o);const i=(()=>p(this,void 0,void 0,(function*(){try{let o=e.children.find((e=>e.name===t&&e.directory));return o||(o=yield e.mkdir(t),o)}finally{this.folderCreationLocks.delete(o)}})))();return this.folderCreationLocks.set(o,i),yield i}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){try{let t=yield this.getRoot();if(e){const o=e.split("/").filter((e=>e));for(const e of o){const o=t.children.find((t=>t.name===e&&t.directory));if(!o)return[];t=o}}return t.children.map((e=>({name:e.name,size:e.size||0,type:e.directory?"folder":"file",modified:e.timestamp?new Date(1e3*e.timestamp).toISOString():""})))}catch(e){return console.error("Error listing MEGA files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(e){return p(this,void 0,void 0,(function*(){try{let t=yield this.getRoot();const o=e.split("/"),i=o.pop();for(const e of o){if(!e)continue;const o=t.children.find((t=>t.name===e&&t.directory));if(!o)return!0;t=o}const r=t.children.find((e=>e.name===i&&!e.directory));return!r||(yield r.delete(),!0)}catch(e){return console.error("Error deleting MEGA file:",e),!1}}))}}class z extends P{constructor(e){super(e)}uploadFile(e,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{let i=yield this.getRoot();const r=t.split("/"),n=r.pop()||"";for(const e of r){if(!e)continue;let t=i.children.find((t=>t.name===e&&t.directory));t||(t=yield this.createFolder(i,e)),i=t}const s=new File([e],n,{lastModified:(new Date).getTime(),type:e.type}),a=yield e.arrayBuffer(),d=new Uint8Array(a),l=o.from(d),c=i.children.find((e=>e.name===n&&!e.directory));return c&&(yield c.delete()),yield i.upload({name:n,size:s.size},l).complete,!0}catch(e){return console.error("Error occurred during MEGA file upload:",e),!1}}))))))}))}downloadFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{let t=yield this.getRoot();const o=e.split("/"),i=o.pop()||"";for(const e of o){if(!e)continue;const o=t.children.find((t=>t.name===e&&t.directory));if(!o)return!0;t=o}const r=t.children.find((e=>e.name===i&&!e.directory));if(!r)return!0;const n=yield r.downloadBuffer();return this.taskQueue.setDownloadedSize(n.size),n.buffer}catch(e){return console.error("Error occurred during MEGA file download:",e),!1}}))))))}))}}class N{constructor(e){this.isExp=!1,this.baseUrl="https://graph.microsoft.com/v1.0/me/drive/special/approot",this.config=e,this.taskQueue=new S(3),this.isExp=this.config.isExp||!1,this.baseUrl=this.isExp?"https://graph.microsoft.com/v1.0/me/drive/root":"https://graph.microsoft.com/v1.0/me/drive/special/approot",void 0===this.config.baseFolder?this.baseFolder=this.isExp?"KoodoReader":"":this.baseFolder=this.config.baseFolder}retryOperation(e,t=3){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;for(t=this.baseFolder+"/"+t;t.startsWith("/");)t=t.substring(1);let i,r=[];if(""===t)i=`${this.baseUrl}/children`;else{const e=encodeURIComponent(t);i=`${this.baseUrl}:/${e}:/children`}for(;i;){const t=yield e.get(i,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});if(t.status>=300)break;const n=t.data.value||[];r=r.concat(n),i=t.data["@odata.nextLink"]||""}return[...new Set(r.map((e=>({name:e.name,size:e.size||0,type:e.folder?"folder":"file",modified:e.lastModifiedDateTime}))))]}catch(e){return console.error("Error occurred during file list:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;for(t=this.baseFolder+"/"+t;t.startsWith("/");)t=t.substring(1);const i=yield e.delete(`${this.baseUrl}:/${t}`,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});return!(i.status>=300)||(console.error("Error deleting file:",i),!0)}catch(e){return console.error("Error occurred during file delete:",e),!1}}))}getAuthUrl(e){return`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${C.microsoftClientId}&scope=${this.isExp?"files.readwrite.all":"files.readwrite.appfolder"} offline_access&response_type=code&redirect_uri=${e}`}}class B extends N{constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=this.config.access_token;let r=o.split("/").pop()||"",n=new File([t],r,{lastModified:(new Date).getTime(),type:t.type}),s=this.baseFolder+"/"+o;for(;s.startsWith("/");)s=s.substring(1);const a=this.baseUrl+":/"+s+":/createUploadSession",d=yield e.post(a,null,{headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},maxContentLength:1/0,maxBodyLength:1/0});let l=n.size;const c=n.type,u=d.data.uploadUrl,h=yield e.put(u,n,{headers:{"Content-Type":c,"Content-Range":`bytes 0-${l-1}/${l}`},maxContentLength:1/0,maxBodyLength:1/0});return!(h.status>=300)||(console.error("Error occurred during file download:",h),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=this.config.access_token;let i=this.baseFolder+"/"+t;for(;i.startsWith("/");)i=i.substring(1);const r=`${this.baseUrl}:/${i}:/content`,n=yield e.get(r,{responseType:"arraybuffer",headers:{Authorization:"Bearer "+o},maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return n.status>=300?(console.error("Error occurred during file download:",n),!1):n.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class M{downloadFile(e,t){return p(this,void 0,void 0,(function*(){return new Promise((e=>{e(!0)}))}))}uploadFile(e,t){return p(this,void 0,void 0,(function*(){return new Promise((e=>{e(!0)}))}))}listFiles(e){return p(this,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}))}getAuthUrl(){return""}}class W{constructor(e){this.baseUrl="https://api.pcloud.com",this.config=e,this.taskQueue=new S(3),this.baseUrl="2"===e.region?"https://eapi.pcloud.com":"https://api.pcloud.com"}retryOperation(e,t=3){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}checkFolderExists(t,o){return p(this,void 0,void 0,(function*(){try{return 0===(yield e.get(`${this.baseUrl}/listfolder`,{params:{access_token:o,path:`/${t}`}})).data.result}catch(e){return console.error("Error checking folder:",e),!1}}))}createFolder(t,o){return p(this,void 0,void 0,(function*(){try{return 0===(yield e.get(`${this.baseUrl}/createfolderifnotexists`,{params:{access_token:o,path:`/${t}`}})).data.result}catch(e){return console.error("Error creating folder:",e),!1}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.refresh_token,i=yield e.get(`${this.baseUrl}/listfolder`,{params:{access_token:o,path:"/"+t,recursive:0}});return 0!==i.data.result?[]:i.data.metadata.contents.map((e=>({name:e.name,size:e.size||0,type:e.isfolder?"folder":"file",modified:e.modified})))}catch(e){return console.error("Error occurred during file list:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.refresh_token,i=yield e.get(`${this.baseUrl}/deletefile`,{params:{access_token:o,path:"/"+t}});return 0===i.data.result||(console.error("Error deleting file:",i.data),!0)}catch(e){return console.error("Error occurred during file delete:",e),!1}}))}getAuthUrl(e){return`https://my.pcloud.com/oauth2/authorize?client_id=${C.pcloudClientId}&response_type=code&redirect_uri=${e}`}}class Q extends W{constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=this.config.refresh_token,r=o.split("/").slice(0,-1).join("/");if(!(yield this.checkFolderExists(r,i))){if(!(yield this.createFolder(r,i)))return!1}let n=o.split("/").pop()||"",s=new File([t],n,{lastModified:(new Date).getTime(),type:t.type});const a=new FormData;a.append("file",s);const d=yield e.post(`${this.baseUrl}/uploadfile`,a,{params:{access_token:i,path:`/${r}`,renew:1},maxContentLength:1/0,maxBodyLength:1/0});return 0===d.data.result||(console.error("Error uploading file:",d.data),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=this.config.refresh_token,i=yield e.get(`${this.baseUrl}/getfilelink`,{params:{access_token:o,path:`/${t}`}});if(0!==i.data.result)return console.error("Error getting file link:",i.data),!0;const r=`https://${i.data.hosts[0]}${i.data.path}`,n=yield e.get(r,{responseType:"arraybuffer",maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return n.status>=300?(console.error("Error downloading file:",n),!1):n.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class K{constructor(e){this.config=e,this.taskQueue=new S(5),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,t=0){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}shouldUsePathStyle(){try{if(this.config.forcePathStyle&&"no"!==this.config.forcePathStyle)return!0;let e=this.config.endpoint;const t=new URL(e),o=t.hostname,i=/^(\d{1,3}\.){3}\d{1,3}$/.test(o),r=""!==t.port;return!i&&r}catch(e){return!0}}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){let{endpoint:t,region:o,bucketName:n,accessKeyId:s,secretAccessKey:a,dir:d}=this.config;d=d&&"KoodoReader"===this.baseFolder?d:this.baseFolder;let l=d+"/"+e;for(;l.startsWith("/");)l=l.substring(1);""===l||l.endsWith("/")||(l+="/");const c=new i({endpoint:t,region:o,credentials:{accessKeyId:s,secretAccessKey:a},forcePathStyle:this.shouldUsePathStyle()});try{let e,t=[],o=[],i=!0;for(;i;){const s=yield c.send(new r({Bucket:n,Prefix:l,Delimiter:"/",ContinuationToken:e}));s.Contents&&(t=t.concat(s.Contents)),s.CommonPrefixes&&(o=o.concat(s.CommonPrefixes)),e=s.NextContinuationToken,i=!!e}let s=[];return t.forEach((e=>{if(!e.Key.endsWith("/")){const t=e.Key.substring(l.length);t.includes("/")||s.push({name:t,size:e.Size||0,type:"file",modified:e.LastModified?e.LastModified.toISOString():""})}})),o.forEach((e=>{const t=e.Prefix.substring(l.length).replace(/\/$/,"");t&&s.push({name:t,size:0,type:"folder",modified:""})})),s}catch(e){return console.error(e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){let{endpoint:t,region:o,bucketName:r,accessKeyId:s,secretAccessKey:a,dir:d}=this.config;d=d&&"KoodoReader"===this.baseFolder?d:this.baseFolder;const l=new i({endpoint:t,region:o,credentials:{accessKeyId:s,secretAccessKey:a},forcePathStyle:this.shouldUsePathStyle()});let c=d+"/"+e;for(;c.startsWith("/");)c=c.substring(1);try{return yield l.send(new n({Bucket:r,Key:c})),!0}catch(e){return console.error(e),!1}}))}}class H extends K{constructor(e){super(e)}uploadFile(e,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){let{endpoint:o,region:r,bucketName:n,accessKeyId:a,secretAccessKey:d,dir:l}=this.config;const c=new i({endpoint:o,region:r,credentials:{accessKeyId:a,secretAccessKey:d},forcePathStyle:this.shouldUsePathStyle()});l=l&&"KoodoReader"===this.baseFolder?l:this.baseFolder;let u=l+"/"+t;for(;u.startsWith("/");)u=u.substring(1);try{let t=yield c.send(new s({Bucket:n,Key:u,Body:e}));return 200===t.$metadata.httpStatusCode||(console.error("Error uploading file:",t),!1)}catch(e){return console.error("Error: ",e),!1}}))))))}))}downloadFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);let{endpoint:t,region:o,bucketName:r,accessKeyId:n,secretAccessKey:s,dir:d}=this.config;d=d&&"KoodoReader"===this.baseFolder?d:this.baseFolder;const l=new i({endpoint:t,region:o,credentials:{accessKeyId:n,secretAccessKey:s},forcePathStyle:this.shouldUsePathStyle()});let c=d+"/"+e;for(;c.startsWith("/");)c=c.substring(1);try{const e=yield l.send(new a({Bucket:r,Key:c}));if(!e.Body)return console.error("No response body"),!1;const t=yield e.Body.transformToByteArray();return this.taskQueue.setDownloadedSize(t.length),t.buffer}catch(t){return console.error("Error downloading file:",t,e),!1}}))))))}))}}class q{constructor(e){this.config=e,this.taskQueue=new S(3),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,t=1){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let i=this.baseFolder;t&&""!==t.trim()&&(i=i+"/"+t),i=i.replace(/\/+/g,"/"),i.startsWith("/")&&(i=i.substring(1));let r=[],n=0;const s=1e3;for(;;){const t=yield e.get("https://pan.baidu.com/rest/2.0/xpan/file",{params:{method:"list",access_token:o,dir:"/"+i,start:n,limit:s,order:"name",desc:0,web:1,folder:0},headers:{"User-Agent":"pan.baidu.com"}});if(t.status>=300||0!==t.data.errno){console.error("百度网盘API错误:",t.data);break}const a=t.data.list||[];if(0===a.length)break;if(r=r.concat(a),a.length({name:e.server_filename,size:e.size||0,type:e.isdir?"folder":"file",modified:new Date(1e3*e.server_mtime).toISOString(),path:e.path,fs_id:e.fs_id})))}catch(e){return console.error("获取百度网盘文件列表时发生错误:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let i=this.baseFolder+"/"+t;i=i.replace(/\/+/g,"/"),i.startsWith("/")&&(i=i.substring(1));const r=new URLSearchParams({async:"0",filelist:JSON.stringify(["/"+i])}),n=yield e.post(`https://pan.baidu.com/rest/2.0/xpan/file?method=filemanager&access_token=${o}&opera=delete`,r.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"pan.baidu.com"}});if(0!==n.data.errno)return console.error("百度网盘删除文件API错误:",n.data),-9===n.data.errno?console.error("文件不存在"):111===n.data.errno?console.error("有其他异步任务正在执行"):-7===n.data.errno&&console.error("文件名非法"),!1;const s=n.data.info||[];for(const e of s)if(0!==e.errno)return console.error(`文件删除失败: ${e.path}, 错误码: ${e.errno}`),!1;return!0}catch(e){return console.error("删除文件时发生错误:",e),!1}}))}getAuthUrl(e){return`https://openapi.baidu.com/oauth/2.0/authorize?response_type=code&client_id=${C.duboxClientId}&redirect_uri=${e}&scope=basic,netdisk&device_id=119827642&display=page&qrcode=1`}}const J=4194304;class Y extends q{constructor(e){super(e)}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){var i;try{const i=this.config.access_token;let r=this.baseFolder+"/"+o;r=r.replace(/\/+/g,"/"),r.startsWith("/")&&(r=r.substring(1));const n=yield t.arrayBuffer(),s=n.byteLength,a=new Uint8Array(n),{contentMd5:d,sliceMd5:l,blockList:c}=this.calculateFileMd5(a,s),u=new URLSearchParams({path:"/"+r,size:s.toString(),isdir:"0",autoinit:"1",rtype:"3",block_list:JSON.stringify(c),"content-md5":d,"slice-md5":l,local_ctime:Math.floor(Date.now()/1e3).toString(),local_mtime:Math.floor(Date.now()/1e3).toString()}),h=yield e.post(`https://pan.baidu.com/rest/2.0/xpan/file?method=precreate&access_token=${i}`,u.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"pan.baidu.com"}});if(0!==h.data.errno)return console.error("预上传失败:",h.data),!1;const p=h.data.uploadid,f=h.data.block_list||[];if(0===f.length)return!0;const g=yield this.getUploadDomain(i,"/"+r,p);if(!g)return console.error("获取上传域名失败"),!1;for(const t of f){const o=t*J,n=Math.min(J,s-o),d=a.slice(o,o+n),l=new FormData;l.append("file",new Blob([d],{type:"application/octet-stream"}),`chunk_${t}`);const u=`${g}/rest/2.0/pcs/superfile2?method=upload&access_token=${i}&type=tmpfile&path=${encodeURIComponent("/"+r)}&uploadid=${p}&partseq=${t}`,h=yield e.post(u,l,{headers:{"User-Agent":"pan.baidu.com"},maxContentLength:1/0,maxBodyLength:1/0,timeout:0});if(h.status>=300)throw new Error(`分片上传失败: ${JSON.stringify(h.data)}`);const f=h.data.md5,y=c[t];f&&f!==y&&console.warn(`分片 ${t} MD5不匹配: 期望 ${y}, 实际 ${f}`)}const y=new URLSearchParams({path:"/"+r,size:s.toString(),isdir:"0",block_list:JSON.stringify(c),uploadid:p,rtype:"3",local_ctime:Math.floor(Date.now()/1e3).toString(),local_mtime:Math.floor(Date.now()/1e3).toString()}),m=yield e.post(`https://pan.baidu.com/rest/2.0/xpan/file?method=create&access_token=${i}`,y.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"pan.baidu.com"}});return 0===m.data.errno||(console.error("创建文件失败:",m.data),!1)}catch(e){return console.error("文件上传过程中发生错误:",(null===(i=e.response)||void 0===i?void 0:i.data)||e.message||e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){var o;this.taskQueue.setDownloadedSize(0);try{const i=this.config.access_token;let r=this.baseFolder+"/"+t;r=r.replace(/\/+/g,"/"),r.startsWith("/")&&(r=r.substring(1));const n=yield this.listFileInfos(t.substring(0,t.lastIndexOf("/"))),s=r.split("/").pop(),a=n.find((e=>e.name===s));if(!a)return console.error("文件不存在:",t),!1;const d=yield e.get("https://pan.baidu.com/rest/2.0/xpan/multimedia",{params:{method:"filemetas",access_token:i,fsids:JSON.stringify([a.fs_id]),dlink:1},headers:{"User-Agent":"pan.baidu.com"}});if(0!==d.data.errno||!(null===(o=d.data.list)||void 0===o?void 0:o[0]))return console.error("获取下载链接失败:",d.data),!1;const l=d.data.list[0].dlink;return(yield e.get(l,{responseType:"arraybuffer",params:{access_token:i},headers:{"User-Agent":"pan.baidu.com"},onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}})).data}catch(e){return console.error("下载文件时发生错误:",e),!1}}))))))}))}getUploadDomain(t,o,i){return p(this,void 0,void 0,(function*(){try{const r=yield e.get("https://d.pcs.baidu.com/rest/2.0/pcs/file",{params:{method:"locateupload",appid:"250528",access_token:t,path:o,uploadid:i,upload_version:"2.0"},headers:{"User-Agent":"pan.baidu.com"}});if(0!==r.data.error_code)return console.error("获取上传域名失败:",r.data),null;const n=r.data.servers||[],s=n.find((e=>e.server.startsWith("https://")));return s?s.server:n.length>0?n[0].server:(console.error("没有可用的上传服务器"),null)}catch(e){return console.error("获取上传域名时出错:",e),null}}))}calculateFileMd5(e,t){const o=[];let i="",r=0;for(;r=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}getUploadCredentials(t){return p(this,void 0,void 0,(function*(){try{const o=yield e.get(`${this.baseUrl}/open/upload/get_token`,{headers:{Authorization:`Bearer ${t}`}});return o.status>=300||!o.data.state?(console.error("Error getting upload credentials:",o.data),null):o.data.data}catch(e){return console.error("Error occurred during get upload credentials:",e),null}}))}generateOSSPolicy(e,t,o=new Date(Date.now()+36e5)){const i={expiration:o.toISOString(),conditions:[{bucket:e},{key:t},["starts-with","$success_action_status","2"],["content-length-range",0,1073741824]]};return JSON.stringify(i)}getAuthUrl(e){return`https://passportapi.115.com/open/authorize?client_id=${C.yiyiwuClientId}&response_type=code&redirect_uri=${e}`}}class G extends V{constructor(e){super(e)}sha1Hex(e){return p(this,void 0,void 0,(function*(){const t=yield crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((e=>e.toString(16).padStart(2,"0"))).join("")}))}calculateFileSha1(e){return p(this,void 0,void 0,(function*(){try{const t=yield e.arrayBuffer();return this.sha1Hex(t)}catch(e){return console.error("Error calculating file SHA1:",e),""}}))}calculatePreSha1(e){return p(this,void 0,void 0,(function*(){try{const t=e.slice(0,131072),o=yield t.arrayBuffer();return this.sha1Hex(o)}catch(e){return console.error("Error calculating pre SHA1:",e),""}}))}calculateOSSSignature(e,t){const o=d.enc.Base64.stringify(d.enc.Utf8.parse(t));return d.HmacSHA1(o,e).toString(d.enc.Base64)}handleSecondAuth(e,t,o,i,r,n,s,a){return p(this,void 0,void 0,(function*(){try{if(!t.sign_check)return console.error("No sign_check provided for second authentication"),null;const[d,l]=t.sign_check.split("-"),c=parseInt(d),u=parseInt(l),h=o.slice(c,u+1),p=yield h.arrayBuffer(),f=(yield this.sha1Hex(p)).toUpperCase();return yield this.initializeUpload(e,i,r,n,s,a,t.sign_key,f,t.pick_code)}catch(e){return console.error("Error during second authentication:",e),null}}))}uploadToObjectStorage(t,o,i,r){var n;return p(this,void 0,void 0,(function*(){try{const n=r.endpoint,s=i.bucket,a=i.object;let d;if(n.includes(s))d=n;else{d=`https://${s}.${n.replace(/^https?:\/\//,"")}`}const l=this.generateOSSPolicy(s,a),c=this.calculateOSSSignature(r.AccessKeySecret,l),u=btoa(l),h=new FormData;if(h.append("key",a),h.append("policy",u),h.append("OSSAccessKeyId",r.AccessKeyId),h.append("signature",c),h.append("x-oss-security-token",r.SecurityToken),h.append("success_action_status","200"),i.callback&&i.callback.callback){const e=btoa(i.callback.callback);if(h.append("callback",e),i.callback.callback_var){const e=JSON.parse(i.callback.callback_var);for(const[t,o]of Object.entries(e))h.append(t,String(o))}}const p=new File([t],o,{type:t.type});h.append("file",p);const f=yield e.post(d,h,{maxContentLength:1/0,maxBodyLength:1/0});return 200===f.status||204===f.status||(console.error("Upload failed with status:",f.status),!1)}catch(e){return console.error("Error uploading file via REST API:",(null===(n=e.response)||void 0===n?void 0:n.data)||e.message||e),!1}}))}uploadFile(e,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){var o;try{const o=this.config.access_token;let i=this.baseFolder+"/"+t;i.startsWith("/")||(i="/"+i);const r=e.size,n=yield this.calculateFileSha1(e),s=yield this.calculatePreSha1(e),a=t.split("/").pop()||t,d=i.substring(0,i.lastIndexOf("/"))||"/";let l=yield this.getFolderInfo(d,!0),c="0";if(l)c=l.file_id;else{let e=yield this.createFolder(d);if(!e)return console.error("Failed to create folder:",d),!1;c=e}yield this.deleteFileWithoutQueue(t);let u=yield this.initializeUpload(c,a,r,n,s,o);if(!u)return console.error("Failed to initialize upload"),!1;if((6===u.status||7===u.status||8===u.status)&&(u=yield this.handleSecondAuth(c,u,e,a,r,n,s,o),!u))return console.error("Second authentication failed"),!1;if(2===u.status)return console.info(`File ${t} uploaded successfully via instant upload.`),!0;const h=yield this.getUploadCredentials(o);if(!h)return console.error("Failed to get upload credentials"),!1;return(yield this.uploadToObjectStorage(e,a,u,h))?(console.info(`File ${t} uploaded successfully.`),!0):(console.error("Failed to upload to object storage"),!1)}catch(e){return console.error("Error occurred during file upload:",(null===(o=e.response)||void 0===o?void 0:o.data)||e.message||e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{let o=this.baseFolder+"/"+t;o=o.replace(/\/+/g,"/"),o.startsWith("/")||(o="/"+o);const i=yield this.getFolderInfo(o,!1);if(!i||!i.pick_code)return console.error("Failed to get file info or pick_code for:",t),!1;const r=yield this.getFileDownloadUrl(i.pick_code);if(!r)return console.error("Failed to get download URL for:",t),!1;const n=yield e.get(r.url,{responseType:"arraybuffer",maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return n.status>=300?(console.error("Error downloading file:",n),!1):n.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}initializeUpload(t,o,i,r,n,s,a,d,l){return p(this,void 0,void 0,(function*(){try{const c=new FormData;c.append("file_name",o),c.append("file_size",i.toString()),t?c.append("target","U_1_"+t):c.append("target","U_1_0"),c.append("fileid",r),c.append("preid",n),c.append("topupload","0"),l&&c.append("pick_code",l),a&&c.append("sign_key",a),d&&c.append("sign_val",d);const u=yield e.post(`${this.baseUrl}/open/upload/init`,c,{headers:{Authorization:`Bearer ${s}`,"Content-Type":"multipart/form-data"}});return u.status>=300||!u.data.state?(console.error("Error initializing upload:",u.data),null):u.data.data}catch(e){return console.error("Error occurred during upload initialization:",e),null}}))}createFolder(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,i=t.replace(/^\/+|\/+$/g,"");if(!i)return"";const r=i.split("/");let n="",s="0";for(const t of r){n=n?`${n}/${t}`:t;const i=yield this.getFolderInfo(n,!0);if(i&&i.file_id)s=i.file_id;else{const i=new FormData;i.append("pid",s),i.append("file_name",t);const r=yield e.post(`${this.baseUrl}/open/folder/add`,i,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"multipart/form-data"}});if(r.status>=300||!r.data.state)return console.error("Error creating folder:",r.data),"";s=r.data.data.file_id}}return s}catch(e){return console.error("Error occurred during folder creation:",e),""}}))}getFolderInfo(t,o){return p(this,void 0,void 0,(function*(){if(""===t||"/"===t)return{file_id:"0"};t.startsWith("/")||(t="/"+t);try{const o=this.config.access_token,i=new FormData;i.append("path",t);const r=yield e.post(`${this.baseUrl}/open/folder/get_info`,i,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"multipart/form-data"}});return r.status>=300||!r.data.state||0===r.data.data.length?(console.error("Error getting file info:",r.data),null):r.data.data}catch(e){return console.error("Error occurred during get file info:",e),null}}))}getFileDownloadUrl(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,i=new FormData;i.append("pick_code",t);const r=yield e.post(`${this.baseUrl}/open/ufile/downurl`,i,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"multipart/form-data"}});if(r.status>=300)return console.error("Error getting download URL:",r.data),null;const n=r.data.data,s=Object.keys(n)[0];return s&&n[s]?n[s].url:(console.error("No file data found in download URL response"),null)}catch(e){return console.error("Error occurred during get download URL:",e.message||e),null}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;(t=this.baseFolder+"/"+t).startsWith("/")||(t="/"+t);let i=[],r=0;const n=1150;let s=!0,a=yield this.getFolderInfo(t,!0),d="";if(a)d=a.file_id;else{let e=yield this.createFolder(t);if(!e)return console.error("Failed to create folder:",t),[];d=e}if(!d)return console.error("Failed to get or create folder ID:",t),[];let l=d;for(;s;){const t={offset:r,limit:n,cur:1,show_dir:1};l&&(t.cid=l);const a=yield e.get(`${this.baseUrl}/open/ufile/files`,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},params:t});if(a.status>=300)break;const d=a.data.data||[];i=i.concat(d),d.length({name:e.fn,size:e.fs||0,type:"0"===e.fc?"folder":"file",modified:new Date(1e3*e.upt).toISOString()})))}catch(e){return console.error("Error occurred during file list:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;t=this.baseFolder+"/"+t;const i=yield this.getFolderInfo(t,!1);if(!i)return!0;const r=new FormData;r.append("file_ids",i.file_id);const n=yield e.post(`${this.baseUrl}/open/ufile/delete`,r,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"multipart/form-data"}});return!(n.status>=300||!n.data.state)||(console.error("Error deleting file:",n),!1)}catch(e){return console.error("Error occurred during file delete:",e),!1}}))}}class X{constructor(e){let{username:t,password:o,url:i,dir:r,AuthType:n,createClient:s}=e;void 0===e.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=e.baseFolder,r=r&&"KoodoReader"===this.baseFolder?r:this.baseFolder,this.username=t,this.password=o,this.url=i,this.dir=r,this.taskQueue=new S(5),this.AuthType=n,this.createClient=s}getClient(){return p(this,void 0,void 0,(function*(){return this.webdavClient||(this.url=yield this.handleUrlRedirection(this.url),this.webdavClient=this.createClient(this.url,{authType:this.AuthType.Password,username:this.username,password:this.password})),this.webdavClient}))}handleUrlRedirection(t){return p(this,void 0,void 0,(function*(){try{const o=yield e.head(t,{maxRedirects:0,validateStatus:()=>!0});return o.request&&o.request.responseURL&&o.request.responseURL!==t?o.request.responseURL:o.status>=300&&o.status<400&&o.headers.location?o.headers.location:t}catch(e){return console.info("Error handling URL redirection:",e),t}}))}retryOperation(e,t=1){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){const t=yield this.getClient();try{return(yield t.getDirectoryContents(this.dir+"/"+e)).filter((t=>"."!==t.filename&&".."!==t.filename&&t.filename!==e)).map((e=>({name:e.basename,size:e.size||0,type:"directory"===e.type?"folder":"file",modified:e.lastmod})))}catch(o){return o.response&&404===o.response.status&&(yield t.createDirectory(this.dir+"/"+e)),console.error("Error listing files:",o),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){const t=yield this.getClient();try{return yield t.deleteFile(this.dir+"/"+e),!0}catch(e){return console.error("Error deleting file:",e),!1}}))}ensureDirectoryExists(e){return p(this,void 0,void 0,(function*(){let t=yield this.getClient();try{const o=e.replace(/^\/+|\/+$/g,"").split("/").filter((e=>e.length>0));let i="";for(const e of o)i=i?`${i}/${e}`:e,(yield t.exists(`/${i}`))||(yield t.createDirectory(`/${i}`));return!0}catch(e){return console.error("Error ensuring directory exists:",e),!1}}))}}class Z extends X{constructor(e){super(Object.assign(Object.assign({},e),{AuthType:l,createClient:c}))}retryOperation(e,t=1){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{let i=this.dir+"/"+o,r=yield this.getClient();const n=r.exists(i.substring(0,i.lastIndexOf("/"))),s=new Promise(((e,t)=>{setTimeout((()=>t(new Error("WebDAV exists check timeout"))),5e3)}));!1===(yield Promise.race([n,s]))&&(yield this.ensureDirectoryExists(i.substring(0,i.lastIndexOf("/"))));let a=o.split("/").pop()||"",d=new File([t],a,{lastModified:(new Date).getTime(),type:t.type}),l=r.getFileUploadLink(this.dir+"/"+o);const c=new URL(l);c.search="",l=c.toString();const u=btoa(this.username+":"+this.password),h=yield e.put(l,d,{headers:{Authorization:"Basic "+u},maxContentLength:1/0,maxBodyLength:1/0});return!(h.status>=300)||(console.error("Error occurred during file upload:",h),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){if(this.taskQueue.setDownloadedSize(0),-1===t.indexOf("."))return new ArrayBuffer(0);try{const o=btoa(this.username+":"+this.password);let i=this.url.endsWith("/")?this.url:this.url+"/",r=this.dir.startsWith("/")?this.dir.substring(1):this.dir;const n=yield e({url:i+r+"/"+t,method:"get",headers:{Authorization:"Basic "+o},responseType:"arraybuffer",maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return n.status>=300?(console.error("Error occurred during file download:",n),!1):n.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class ee{constructor(e){this.username=e.username,this.password=e.password,this.url=e.url,this.taskQueue=new S(3)}retryOperation(e,t=1){return p(this,void 0,void 0,(function*(){let o=0;for(;;){const i=yield e();if(i)return i;if(o>=t)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),i;o++;const r=1e3*Math.pow(2,o);console.info(`Retry attempt ${o} after ${r}ms`),yield new Promise((e=>setTimeout(e,r)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(t){return p(this,void 0,void 0,(function*(){try{return(yield e.get(`${this.url}/list`,{params:{dir:t},auth:{username:this.username,password:this.password}})).data.files.map((e=>({name:e.name,size:e.size||0,type:"file"===e.type?"file":"folder",modified:e.modifiedTime})))||[]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(t){return p(this,void 0,void 0,(function*(){try{return(yield e.delete(`${this.url}/delete`,{params:{dir:t.split("/").slice(0,-1).join("/")||"",filename:t.split("/").pop()},auth:{username:this.username,password:this.password}})).data.success}catch(e){return console.error("Error deleting file:",e),!1}}))}}class te extends ee{constructor(e){super(e)}getAuthHeader(){return`Basic ${btoa(`${this.username}:${this.password}`)}`}uploadFile(t,o){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const i=o.split("/").pop()||"",r=o.substring(0,o.lastIndexOf("/"))||"";let n=this.listFiles("");const s=new Promise(((e,t)=>{setTimeout((()=>t(new Error("Docker connection timeout"))),5e3)}));yield Promise.race([n,s]);let a=new File([t],i,{lastModified:(new Date).getTime(),type:t.type});const d=new FormData;d.append("file",a);const l=yield e.post(`${this.url}/upload?dir=${encodeURIComponent(r)}`,d,{headers:{Authorization:this.getAuthHeader(),"Content-Type":"multipart/form-data"},maxContentLength:1/0,maxBodyLength:1/0});return!(l.status>=300)||(console.error("Error occurred during file upload:",l),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const o=t.split("/").pop()||"",i=t.substring(0,t.lastIndexOf("/"))||"",r=yield e({url:`${this.url}/download`,method:"GET",params:{dir:i,filename:o},headers:{Authorization:this.getAuthHeader()},maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return r.status>=300?(console.error("Error occurred during file download:",r),!1):r.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}const oe=["book","config","cover","font"];class ie{constructor(e,t){this.type=e,this.remote="dropbox"===e?new R(t):"microsoft"===e?new B(t):"google"===e?new j(t):"microsoft_exp"===e?new B(Object.assign(Object.assign({},t),{isExp:!0})):"google_exp"===e?new j(Object.assign(Object.assign({},t),{isExp:!0})):"s3compatible"===e?new H(t):"webdav"===e?new Z(t):"docker"===e?new te(t):"boxnet"===e?new A(t):"mega"===e?new z(t):"adrive"===e?new _(t):"pcloud"===e?new Q(t):"dubox"===e?new Y(t):"yandex"===e?new D(t):"yiyiwu"===e?new G(t):new M}downloadFile(e,t){return p(this,void 0,void 0,(function*(){if("cover"!==t){if(!(yield this.listFiles(t)).find((t=>e.indexOf(t)>-1)))return!1}return yield this.remote.downloadFile(t+"/"+e)}))}uploadFile(e,t,o){return p(this,void 0,void 0,(function*(){return 0===o.size||(yield this.remote.uploadFile(o,t+"/"+e))}))}deleteFile(e,t){return p(this,void 0,void 0,(function*(){return!(yield this.listFiles(t)).find((t=>e.indexOf(t)>-1))||(yield this.remote.deleteFile(t+"/"+e))}))}listFiles(e){return p(this,void 0,void 0,(function*(){return yield this.remote.listFiles(e)}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){return yield this.remote.listFileInfos(e)}))}isExist(e,t){return p(this,void 0,void 0,(function*(){return(yield this.listFiles(t)).find((t=>-1!==t.indexOf(e)))}))}downloadAllFiles(){return p(this,void 0,void 0,(function*(){for(let e of oe){let t=yield this.listFiles(e);for(let o of t)yield this.downloadFile(o,e)}}))}getAuthUrl(e){return this.remote.getAuthUrl?this.remote.getAuthUrl(e):""}getStats(){return this.remote.taskQueue.getStats()}clearQueue(){return this.remote.taskQueue.clearQueue()}resetCounters(){this.remote.taskQueue.resetCounters()}getDownloadedSize(){return this.remote.taskQueue.getDownloadedSize()}}const re={words:['ALTER TABLE words ADD COLUMN "sentence" text']},ne={notes:"SELECT * FROM notes WHERE key = ?",bookmarks:"SELECT * FROM bookmarks WHERE key = ?",books:"SELECT * FROM books WHERE key = ?",plugins:"SELECT * FROM plugins WHERE key = ?",words:"SELECT * FROM words WHERE key = ?"},se={notes:"SELECT * FROM notes WHERE bookKey = ?",bookmarks:"SELECT * FROM bookmarks WHERE bookKey = ?",words:"SELECT * FROM words WHERE bookKey = ?",books:"SELECT * FROM books WHERE key = ?"},ae={notes:"DELETE FROM notes WHERE bookKey = ?",bookmarks:"DELETE FROM bookmarks WHERE bookKey = ?",words:"DELETE FROM words WHERE bookKey = ?"};function de(e){for(const t in e)e.hasOwnProperty(t)&&(e[`temp-${t}`]=e[t]);return e}const le={notes:e=>{let t=Object.assign({},e);return t.date=JSON.parse(e.date),t.tag=JSON.parse(e.tag),t},bookmarks:e=>e,books:e=>e,plugins:e=>{let t=Object.assign({},e);return e.autoValue||delete t.autoValue,e.langList?t.langList=JSON.parse(e.langList):delete t.langList,e.voiceList?t.voiceList=JSON.parse(e.voiceList):delete t.voiceList,t.config=JSON.parse(e.config),t},words:e=>{let t=Object.assign({},e);return t.date=JSON.parse(e.date),void 0===t.sentence&&(t.sentence=""),t}};var ce={sqlStatement:{createTableStatement:de({notes:'\n CREATE TABLE IF NOT EXISTS "notes" (\n "key" text PRIMARY KEY,\n "bookKey" text,\n "date" object,\n "chapter" text,\n "chapterIndex" integer,\n "text" text,\n "cfi" text,\n "range" text,\n "notes" text,\n "percentage" text,\n "color" integer,\n "tag" array\n )\n ',bookmarks:'\n CREATE TABLE IF NOT EXISTS "bookmarks" (\n "key" text PRIMARY KEY,\n "bookKey" text,\n "cfi" text,\n "label" text,\n "percentage" text,\n "chapter" text\n );\n ',books:'\n CREATE TABLE IF NOT EXISTS "books" (\n "key" text PRIMARY KEY,\n "name" text,\n "author" text,\n "description" text,\n "md5" text,\n "cover" text,\n "format" text,\n "publisher" text,\n "size" integer,\n "page" integer,\n "path" text,\n "charset" text\n );\n ',plugins:'\n CREATE TABLE IF NOT EXISTS "plugins" (\n "key" text PRIMARY KEY,\n "type" text,\n "displayName" text,\n "icon" text,\n "version" text,\n "config" object,\n "autoValue" string,\n "langList" text,\n "voiceList" text,\n "scriptSHA256" text,\n "script" text\n );\n ',words:'\n CREATE TABLE IF NOT EXISTS "words" (\n "key" text PRIMARY KEY,\n "bookKey" text,\n "date" object,\n "word" text,\n "sentence" text,\n "chapter" text\n );\n '}),migrateStatement:de(re),getAllStatement:de({notes:"SELECT * FROM notes",bookmarks:"SELECT * FROM bookmarks",books:"SELECT * FROM books",plugins:"SELECT * FROM plugins",words:"SELECT * FROM words"}),getPagedStatement:de({notes:"SELECT * FROM notes LIMIT ? OFFSET ?",bookmarks:"SELECT * FROM bookmarks LIMIT ? OFFSET ?",books:"SELECT * FROM books LIMIT ? OFFSET ?",plugins:"SELECT * FROM plugins LIMIT ? OFFSET ?",words:"SELECT * FROM words LIMIT ? OFFSET ?"}),getCountStatement:de({notes:"SELECT COUNT(*) as count FROM notes",bookmarks:"SELECT COUNT(*) as count FROM bookmarks",books:"SELECT COUNT(*) as count FROM books",plugins:"SELECT COUNT(*) as count FROM plugins",words:"SELECT COUNT(*) as count FROM words"}),saveStatement:de({notes:"INSERT OR REPLACE INTO notes (key, bookKey, chapter, chapterIndex, text, cfi, range, notes, date, percentage, color, tag) VALUES (@key, @bookKey, @chapter, @chapterIndex, @text, @cfi, @range, @notes, @date, @percentage, @color, @tag)",bookmarks:"INSERT OR REPLACE INTO bookmarks (key, bookKey, cfi, label, percentage, chapter) VALUES (@key, @bookKey, @cfi, @label, @percentage, @chapter)",books:"INSERT OR REPLACE INTO books (key, name, author, description, md5, cover, format, publisher, size, page, path, charset) VALUES (@key, @name, @author, @description, @md5, @cover, @format, @publisher, @size, @page, @path, @charset)",plugins:"INSERT OR REPLACE INTO plugins (key, type, displayName, icon, version, config, autoValue, langList, voiceList, scriptSHA256, script) VALUES (@key, @type, @displayName, @icon, @version, @config, @autoValue, @langList, @voiceList, @scriptSHA256, @script)",words:"INSERT OR REPLACE INTO words (key, bookKey, date, word, sentence, chapter) VALUES (@key, @bookKey, @date, @word, @sentence, @chapter)"}),deleteAllStatement:de({notes:"DELETE FROM notes",bookmarks:"DELETE FROM bookmarks",books:"DELETE FROM books",plugins:"DELETE FROM plugins",words:"DELETE FROM words"}),updateStatement:de({notes:"UPDATE notes SET bookKey = @bookKey, chapter = @chapter, chapterIndex = @chapterIndex, text = @text, cfi = @cfi, range = @range, notes = @notes, date = @date, percentage = @percentage, color = @color, tag = @tag WHERE key = @key",bookmarks:"UPDATE bookmarks SET bookKey = @bookKey, cfi = @cfi, label = @label, percentage = @percentage, chapter = @chapter WHERE key = @key",books:"UPDATE books SET name = @name, author = @author, description = @description, md5 = @md5, cover = @cover, format = @format, publisher = @publisher, size = @size, page = @page, path = @path, charset = @charset WHERE key = @key",plugins:"UPDATE plugins SET type = @type, displayName = @displayName, icon = @icon, version = @version, config = @config, autoValue = @autoValue, langList = @langList, voiceList = @voiceList, scriptSHA256 = @scriptSHA256, script = @script WHERE key = @key",words:"UPDATE words SET bookKey = @bookKey, date = @date, word = @word, sentence = @sentence, chapter = @chapter WHERE key = @key"}),deleteStatement:de({notes:"DELETE FROM notes WHERE key = ?",bookmarks:"DELETE FROM bookmarks WHERE key = ?",books:"DELETE FROM books WHERE key = ?",plugins:"DELETE FROM plugins WHERE key = ?",words:"DELETE FROM words WHERE key = ?"}),dropStatement:de({notes:"DROP TABLE IF EXISTS notes",bookmarks:"DROP TABLE IF EXISTS bookmarks",books:"DROP TABLE IF EXISTS books",plugins:"DROP TABLE IF EXISTS plugins",words:"DROP TABLE IF EXISTS words"}),getStatement:de(ne),getByBookKeyStatement:de(se),getByBookKeysStatement:de({notes:e=>`SELECT * FROM notes WHERE bookKey IN (${e.map((()=>"?")).join(",")})`,bookmarks:e=>`SELECT * FROM bookmarks WHERE bookKey IN (${e.map((()=>"?")).join(",")})`,words:e=>`SELECT * FROM words WHERE bookKey IN (${e.map((()=>"?")).join(",")})`,books:e=>`SELECT * FROM books WHERE key IN (${e.map((()=>"?")).join(",")})`}),getKeysStatement:de({notes:"SELECT key FROM notes",bookmarks:"SELECT key FROM bookmarks",books:"SELECT key FROM books",plugins:"SELECT key FROM plugins",words:"SELECT key FROM words"}),getWithSortAndPageStatement:de({notes:(e,t,o,i)=>`SELECT * FROM notes ORDER BY ${e} ${t} LIMIT ${o} OFFSET ${i}`,bookmarks:(e,t,o,i)=>`SELECT * FROM bookmarks ORDER BY ${e} ${t} LIMIT ${o} OFFSET ${i}`,books:(e,t,o,i)=>`SELECT * FROM books ORDER BY ${e} ${t} LIMIT ${o} OFFSET ${i}`,plugins:(e,t,o,i)=>`SELECT * FROM plugins ORDER BY ${e} ${t} LIMIT ${o} OFFSET ${i}`,words:(e,t,o,i)=>`SELECT * FROM words ORDER BY ${e} ${t} LIMIT ${o} OFFSET ${i}`}),getByKeysStatement:de({notes:e=>`SELECT * FROM notes WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,t)=>`WHEN ? THEN ${t}`)).join(" ")} END`,bookmarks:e=>`SELECT * FROM bookmarks WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,t)=>`WHEN ? THEN ${t}`)).join(" ")} END`,books:e=>`SELECT * FROM books WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,t)=>`WHEN ? THEN ${t}`)).join(" ")} END`,plugins:e=>`SELECT * FROM plugins WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,t)=>`WHEN ? THEN ${t}`)).join(" ")} END`,words:e=>`SELECT * FROM words WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,t)=>`WHEN ? THEN ${t}`)).join(" ")} END`}),deleteByBookKeyStatement:de(ae)},jsonToSqlite:de({notes:e=>{let t=Object.assign({},e);return t.date=JSON.stringify(e.date),t.tag=JSON.stringify(e.tag),t},bookmarks:e=>e,books:e=>{let t=Object.assign({},e);return t.page=e.page||0,t},plugins:e=>{let t=Object.assign({},e);return e.autoValue||(t.autoValue=null),e.langList?t.langList=JSON.stringify(e.langList):t.langList=null,e.voiceList?t.voiceList=JSON.stringify(e.voiceList):t.voiceList=null,t.config=JSON.stringify(e.config),t},words:e=>{let t=Object.assign({},e);return t.date=JSON.stringify(e.date),void 0===t.sentence&&(t.sentence=""),t}}),sqliteToJson:de(le)};const ue=E.testUrl,he=E.cloudCNUrl;class pe{constructor(e,t,o){this.TokenService=e,this.ConfigService=t,this.baseUrl="china"===o?he:ue,this.serverRegion=o,this.refreshToken="",this.accessToken="",this.streamPromise=null,this.expiresAt=0}refreshUserToken(){return p(this,void 0,void 0,(function*(){if(this.refreshToken=yield this.TokenService.getToken("refresh_token"),!this.refreshToken)return{code:401,message:"refresh token not found"};let t=(yield e.post(this.baseUrl+"/api/v1/public/user/refresh_token",{refresh_token:this.refreshToken})).data;return 200===t.code&&(yield this.TokenService.setToken("access_token",t.data.access_token),yield this.TokenService.setToken("refresh_token",t.data.refresh_token),yield this.TokenService.setToken("expires_at",(1e3*t.data.expires_at).toString()),this.accessToken=t.data.access_token,this.refreshToken=t.data.refresh_token,this.expiresAt=1e3*t.data.expires_at),t}))}requestWithRetry(e){return p(this,void 0,void 0,(function*(){return pe.requestQueue||(pe.requestQueue=[]),new Promise(((t,o)=>{pe.requestQueue.push({config:e,resolve:t,reject:o}),pe.processingQueue||this.processQueue()}))}))}isTokenValid(){return p(this,void 0,void 0,(function*(){if(this.accessToken||(this.accessToken=(yield this.TokenService.getToken("access_token"))||""),!this.expiresAt){const e=yield this.TokenService.getToken("expires_at");this.expiresAt=e?parseInt(e):(new Date).getTime()+31536e9}return""!==this.accessToken&&this.expiresAt>(new Date).getTime()+6e4}))}processQueue(){return p(this,void 0,void 0,(function*(){if(!pe.processingQueue){pe.processingQueue=!0;try{for(;pe.requestQueue.length>0;){const e=pe.requestQueue.shift();try{let t=yield this.executeRequest(e.config);e.resolve(t)}catch(t){e.reject(t)}}}finally{pe.processingQueue=!1}}}))}executeRequest(t){return p(this,void 0,void 0,(function*(){try{(yield this.isTokenValid())||(yield this.refreshUserToken());let o="req-"+Date.now().toString(36)+"-"+Math.random().toString(36).substring(2,11);if(t.baseURL=this.baseUrl,t.headers)t.headers.Authorization="Bearer "+this.accessToken,t.headers["X-Request-ID"]=o;else{let e=this.ConfigService.getItem("appVersion"),i=this.ConfigService.getItem("appPlatform");t.headers={Authorization:"Bearer "+this.accessToken,"X-Request-ID":o,"X-App-Version":e||"1.0.0","X-App-Platform":i||"web"}}let i=(yield e(t)).data;if(402===i.code){let o=yield this.refreshUserToken();if(200===o.code){return t.headers=t.headers||{},t.headers.Authorization="Bearer "+this.accessToken,(yield e(t)).data}return o}return 200!==i.code&&console.error("Request error:",i),i}catch(e){return console.error("Request execution error:",e),"Network Error"===e.message?{code:503,message:"network error",data:null,msg:"Network error, please try again later. 网络错误,请稍后再试。"}:{code:500,message:e.message||"Unknown error",msg:e.message||"Unknown error",data:null}}}))}requestWithStream(e,t,o){return p(this,void 0,void 0,(function*(){return this.streamPromise||(this.streamPromise=(()=>p(this,void 0,void 0,(function*(){try{(yield this.isTokenValid())||(yield this.refreshUserToken());let i=this.accessToken||"",r="req-"+Date.now().toString(36)+"-"+Math.random().toString(36).substring(2,11);return new Promise(((n,s)=>{let a=this.ConfigService.getItem("appVersion"),d=this.ConfigService.getItem("appPlatform");const l=new o(this.baseUrl+e.url,{headers:{"Content-Type":"application/json",Authorization:"Bearer "+i,"X-Request-ID":r,"X-App-Version":a||"1.0.0","X-App-Platform":d||"web"},method:e.method,body:JSON.stringify(e.data),pollingInterval:0});l.addEventListener("open",(()=>{console.info("Connection to OpenAI established.")})),l.addEventListener("message",(e=>p(this,void 0,void 0,(function*(){if(!e.data)return;const o=JSON.parse(e.data);o.done?(l.close(),n(o)):t(o.data)})))),l.addEventListener("error",(e=>{if(console.info("Error:",e),!e.data)return;const t=JSON.parse(e.data);n(t),l.close()}))}))}finally{this.streamPromise=null}})))()),this.streamPromise}))}requestWithFetch(e,t){return p(this,void 0,void 0,(function*(){return this.streamPromise||(this.streamPromise=(()=>p(this,void 0,void 0,(function*(){try{(yield this.isTokenValid())||(yield this.refreshUserToken());let o=this.accessToken||"",i="req-"+Date.now().toString(36)+"-"+Math.random().toString(36).substring(2,11);return new Promise(((r,n)=>p(this,void 0,void 0,(function*(){let n=this.ConfigService.getItem("appVersion"),s=this.ConfigService.getItem("appPlatform");var a=new u(this.baseUrl+e.url,{headers:{"Content-Type":"text/plain",Authorization:"Bearer "+o,"X-Request-ID":i,"X-App-Version":n||"1.0.0","X-App-Platform":s||"web"},payload:JSON.stringify(e.data),method:"POST"});a.addEventListener("message",(e=>p(this,void 0,void 0,(function*(){if(!e.data)return;const o=JSON.parse(e.data);o.done?(a.close(),r(o)):t(o.data)})))),a.addEventListener("open",(e=>{console.info(e,"Connection to OpenAI established.")})),a.addEventListener("error",(e=>{if(console.error(e,"Error occurred while connecting to OpenAI"),!e.data)return;const t=JSON.parse(e.data);r(t),a.close()}))}))))}finally{this.streamPromise=null}})))()),this.streamPromise}))}}pe.processingQueue=!1,pe.requestQueue=[];class fe extends pe{constructor(e,t,o){super(e,t,o)}getTransStream(e,t,o){return p(this,void 0,void 0,(function*(){const i={method:"post",url:"/api/v1/pro/reader/get_llm_trans_stream",data:e};return yield this.requestWithStream(i,t,o)}))}getTransFetch(e,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_trans_stream",data:e};return yield this.requestWithFetch(o,t)}))}getDictionary(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_llm_dict",data:e};return yield this.requestWithRetry(t)}))}getBatchTrans(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_llm_batch_trans",data:e};return yield this.requestWithRetry(t)}))}getSplitSentence(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_llm_split_sentence",data:e};return yield this.requestWithRetry(t)}))}getAnswerStream(e,t,o){return p(this,void 0,void 0,(function*(){const i={method:"post",url:"/api/v1/pro/reader/get_llm_answer_stream",data:e};return yield this.requestWithStream(i,t,o)}))}getAnswerFetch(e,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_answer_stream",data:e};return yield this.requestWithFetch(o,t)}))}getSummaryStream(e,t,o){return p(this,void 0,void 0,(function*(){const i={method:"post",url:"/api/v1/pro/reader/get_llm_sum_stream",data:e};return yield this.requestWithStream(i,t,o)}))}getSummaryFetch(e,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_sum_stream",data:e};return yield this.requestWithFetch(o,t)}))}getDictionaryStream(e,t,o){return p(this,void 0,void 0,(function*(){const i={method:"post",url:"/api/v1/pro/reader/get_llm_dict_stream",data:e};return yield this.requestWithStream(i,t,o)}))}getDictionaryFetch(e,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_dict_stream",data:e};return yield this.requestWithFetch(o,t)}))}getGoogleFont(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_google_font",data:e};return yield this.requestWithRetry(t)}))}sendToKindle(e,t){return p(this,void 0,void 0,(function*(){let o=new FormData;o.append("file",e.file),o.append("email",e.email),o.append("file_name",e.fileName);const i={method:"post",url:"/api/v1/pro/reader/send_to_kindle",headers:{"Content-Type":"multipart/form-data"},data:o,onUploadProgress:t?o=>{var i;const r=o.total||(null===(i=e.file)||void 0===i?void 0:i.size)||0;r>0&&t(Math.min(o.loaded/r,1))}:void 0};return yield this.requestWithRetry(i)}))}detectLanguage(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/detect_language",data:e};return yield this.requestWithRetry(t)}))}getTTSAudio(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_tts_audio",data:e};return yield this.executeRequest(t)}))}getOcrResult(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_ocr_result",data:e};return yield this.executeRequest(t)}))}getOcrResultV2(e){return p(this,void 0,void 0,(function*(){let t=new FormData;t.append("file",e.file);const o={method:"post",url:"/api/v1/pro/reader/get_ocr_result_v2",headers:{"Content-Type":"multipart/form-data"},data:t};return yield this.executeRequest(o)}))}analyzeText(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/analyze_text",data:e};return yield this.requestWithRetry(t)}))}getBookMetadata(e){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_book_metadata",data:e};return yield this.requestWithRetry(t)}))}}class ge extends pe{constructor(e,t,o){super(e,t,o),this.serverRegion=o}encryptToken(e){return p(this,void 0,void 0,(function*(){let t=e.token,o=k.encode(t),{extracted:i,remaining:r}=function(e){let t="",o="",i=[],r=1;for(;r<=e.length;)i.push(r-1),r*=2;for(let r=0;r-1){let o=t.split("#");e.encrypted_token=o[1]}const o={method:"post",url:"/api/v1/pro/thirdparty/decrypt_token",data:e};let i=yield this.requestWithRetry(o);if(t.indexOf("#")>-1&&i.data&&i.data.token){let e=t.split("#"),o=function(e,t){let o="",i=[],r=1,n=e.length+t.length;for(;r<=n;)i.push(r-1),r*=2;let s=0,a=0;for(let r=0;r{let i="";if("github"===e?i=`https://github.com/login/oauth/authorize?client_id=${C.githubClientId}&redirect_uri=${o}&scope=${T.github.scopes.join(" ")}&response_type=code`:"google"===e?i=`https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=${o}&prompt=consent&response_type=code&client_id=${C.googleClientId}&scope=${T.google.scopes.join(" ")}&access_type=offline`:"facebook"===e?i=`https://www.facebook.com/v12.0/dialog/oauth?client_id=${C.facebookClientId}&redirect_uri=${o}&scope=&response_type=code`:"microsoft"===e&&(i=`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${C.microsoftClientId}&scope=${T.microsoft.scopes.join(" ")}&response_type=code&redirect_uri=${o}`),"manual"===t)return i;let r=JSON.stringify({deeplink:"desktop"===t?"koodo-reader://callback":"browser"===t?`${C.callbackUrl}#/login`:"",service:e});return`${i}&state=${"state|"+encodeURIComponent(r)}`}};class ve{static CompareDatabase(e,t,o){return p(this,void 0,void 0,(function*(){let i=Object.keys(e).filter((e=>e.startsWith("database.sqlite.books"))),r=Object.keys(e).filter((e=>e.startsWith("database.sqlite.notes"))),n=Object.keys(e).filter((e=>e.startsWith("database.sqlite.bookmarks"))),s=Object.keys(e).filter((e=>e.startsWith("database.sqlite.plugins"))),a=Object.keys(e).filter((e=>e.startsWith("database.sqlite.words"))),d=Object.keys(t).filter((e=>e.startsWith("database.sqlite.books"))),l=Object.keys(t).filter((e=>e.startsWith("database.sqlite.notes"))),c=Object.keys(t).filter((e=>e.startsWith("database.sqlite.bookmarks"))),u=Object.keys(t).filter((e=>e.startsWith("database.sqlite.plugins"))),h=Object.keys(t).filter((e=>e.startsWith("database.sqlite.words"))),p={books:Array.from(new Set(i.concat(d))),notes:Array.from(new Set(r.concat(l))),bookmarks:Array.from(new Set(n.concat(c))),plugins:Array.from(new Set(s.concat(u))),words:Array.from(new Set(a.concat(h)))},f={books:{save:[],update:[],delete:[],conflict:[],upload:[]},notes:{save:[],update:[],delete:[],conflict:[],upload:[]},bookmarks:{save:[],update:[],delete:[],conflict:[],upload:[]},plugins:{save:[],update:[],delete:[],conflict:[],upload:[]},words:{save:[],update:[],delete:[],conflict:[],upload:[]}},g=["books","notes","bookmarks","plugins","words"];for(let i of g)for(let r of p[i]){let n=r.split(".")[3],s=e[r],a=t[r];s?a?("save"===a.operation&&("update"!==s.operation&&"delete"!==s.operation||f[i].upload.push(n)),"delete"===a.operation&&("save"===s.operation&&(f[i].delete.push(n),e[r]=a),"update"===s.operation&&(s.timea.time&&(f[i].conflict.push(n),"cloud"===o?(f[i].delete.push(n),e[r]=a):f[i].upload.push(n))),s.operation),"update"===a.operation&&("save"===s.operation&&(f[i].update.push(n),e[r]=a),"update"===s.operation&&(s.timea.time&&f[i].upload.push(n)),"delete"===s.operation&&(s.timea.time&&f[i].upload.push(n)))):f[i].upload.push(n):(f[i].save.push(n),e[r]=a)}return{compareResult:f,syncRecords:e}}))}static CompareConfig(e,t,o){return p(this,void 0,void 0,(function*(){let i=Object.keys(e).filter((e=>e.startsWith("config.readerConfig"))),r=Object.keys(e).filter((e=>e.startsWith("config.listConfig"))),n=Object.keys(e).filter((e=>e.startsWith("config.objectConfig"))),s=Object.keys(e).filter((e=>e.startsWith("config.mapConfig"))),a=Object.keys(t).filter((e=>e.startsWith("config.readerConfig"))),d=Object.keys(t).filter((e=>e.startsWith("config.listConfig"))),l=Object.keys(t).filter((e=>e.startsWith("config.objectConfig"))),c=Object.keys(t).filter((e=>e.startsWith("config.mapConfig"))),u={readerConfig:Array.from(new Set(i.concat(a))),listConfig:Array.from(new Set(r.concat(d))),objectConfig:Array.from(new Set(n.concat(l))),mapConfig:Array.from(new Set(s.concat(c)))},h={readerConfig:{update:[],upload:[]},listConfig:{update:[],upload:[]},objectConfig:{update:[],delete:[],conflict:[],save:[],upload:[]},mapConfig:{update:[],delete:[],conflict:[],save:[],upload:[]}},p=["readerConfig","listConfig"];for(let o of p)for(let i of u[o]){let r=i,n=e[i],s=t[i];n?s?n.times.time&&h[o].upload.push(r):h[o].upload.push(r):(h[o].update.push(r),e[i]=s)}let f=["objectConfig","mapConfig"];for(let i of f)for(let r of u[i]){let n=r,s=e[r],a=t[r];s?a?("delete"===a.operation&&("update"===s.operation&&(s.timea.time&&(h[i].conflict.push(n),"cloud"===o?(h[i].delete.push(n),e[r]=a):h[i].upload.push(n))),s.operation),"update"===a.operation&&("update"===s.operation&&(s.timea.time&&h[i].upload.push(n)),"delete"===s.operation&&(s.timea.time&&h[i].upload.push(n)))):h[i].upload.push(n):(h[i].update.push(n),e[r]=a)}return{compareResult:h,syncRecords:e}}))}static compareAll(e,t,o,i,r){return p(this,void 0,void 0,(function*(){let n="cloud";if("yes"===o.getReaderConfig("isKeepLocal")){n="local";let e=o.getObjectConfig(yield i.getFingerprint(),"cloudSyncTime",{time:0,conflictMode:"cloud"}),t=yield r.getCloudConfig("config"),s=JSON.parse(t.cloudSyncTime||"{}");delete s[yield i.getFingerprint()],Object.values(s).filter((t=>"local"===t.conflictMode&&t.time>e.time)).length>0&&(n="cloud")}let{compareResult:s,syncRecords:a}=yield this.CompareDatabase(e,t,n),{compareResult:d,syncRecords:l}=yield this.CompareConfig(a,t,n),c=Object.assign(Object.assign({},s),d);return o.setAllSyncRecord(l),"local"===n&&(c.books.conflict.length>0||c.notes.conflict.length>0||c.bookmarks.conflict.length>0||c.plugins.conflict.length>0||c.words.conflict.length>0||c.objectConfig.conflict.length>0||c.mapConfig.conflict.length>0)?o.setObjectConfig(yield i.getFingerprint(),{time:(new Date).getTime(),conflictMode:"local"},"cloudSyncTime"):o.setObjectConfig(yield i.getFingerprint(),{time:(new Date).getTime(),conflictMode:"cloud"},"cloudSyncTime"),c}))}static startSync(e,t,o,i,r,n){return p(this,void 0,void 0,(function*(){let s=yield this.syncConfig(e,t,o,r,n,i);if(e.books.save.length>0||e.books.upload.length>0){let e=yield this.syncCover(t,n,r),o=yield this.syncBook(t,r);return[...s,...e,...o]}return s}))}static syncConfig(e,t,o,i,r,n){return p(this,void 0,void 0,(function*(){let s=[];for(let t of g){if(e[t].save.length+e[t].update.length>0){let i=yield n.getCloudDatabase(t);for(let r of e[t].save){let e=i.find((e=>e.key===r));e&&(yield o.saveRecord(e,t))}for(let r of e[t].update){let e=i.find((e=>e.key===r));e&&(yield o.updateRecord(e,t,!1))}}if(e[t].delete.length>0)for(let n of e[t].delete)"books"===t&&(yield i.deleteOfflineBook(n),yield r.deleteOfflineCover(n)),yield o.deleteRecord(n,t);yield o.dumpDatabase(t,!0)}if(e.readerConfig.update.length>0||e.listConfig.update.length>0||e.objectConfig.update.length>0||e.mapConfig.update.length>0){let o=yield n.getCloudConfig("config");for(let i of e.readerConfig.update){let e=i.split(".")[3];o.readerConfig&&t.setReaderConfig(e,JSON.parse(o.readerConfig)[e],!1)}for(let i of e.listConfig.update){let e=i.split(".")[3];o[e]&&t.setAllListConfig(JSON.parse(o[e]),e,!1)}for(let i of e.objectConfig.update){let e=i.split(".")[3],r=i.split(".")[2];o[r]&&JSON.parse(o[r])&&JSON.parse(o[r])[e]&&t.setObjectConfig(e,JSON.parse(o[r])[e],r,!1)}for(let i of e.mapConfig.update){let e=i.split(".")[3],r=i.split(".")[2];if(o[r]&&JSON.parse(o[r])&&JSON.parse(o[r])[e]){let i=JSON.parse(o[r])[e];t.setOneMapConfig(e,i,r,!1)}}}if(e.objectConfig.delete.length>0||e.mapConfig.delete.length>0){for(let o of e.objectConfig.delete){let e=o.split(".")[3],i=o.split(".")[2];t.deleteObjectConfig(e,i)}for(let o of e.mapConfig.delete){let e=o.split(".")[3],i=o.split(".")[2];t.deleteMapConfig(e,i)}}for(let t of g)e[t].upload.length>0&&s.push((()=>n.uploadDatabase(t)));return s.push((()=>n.uploadConfig("config"))),s.push((()=>n.uploadConfig("sync"))),s}))}static syncCover(e,t,o){return p(this,void 0,void 0,(function*(){let o=yield t.getLocalCoverList(),i=yield t.getCloudCoverList(),r=Array.from(new Set([...o,...i])),n=[];for(let s of r)o.includes(s)&&!i.includes(s)&&n.push((()=>t.uploadCover(s))),!o.includes(s)&&i.includes(s)&&"adrive"!==e.getItem("defaultSyncOption")&&n.push((()=>t.downloadCover(s)));return n}))}static syncBook(e,t){return p(this,void 0,void 0,(function*(){let o=yield t.getLocalBookList(),i=yield t.getCloudBookList(),r=[],n=Array.from(new Set([...o,...i]));for(let s of n){if(o.includes(s)&&!i.includes(s)){let e=s.split(".")[0],o=s.split(".")[1];r.push((()=>t.uploadBook(e,o)))}let n="yes"===e.getReaderConfig("autoOffline");if(!o.includes(s)&&i.includes(s)&&n&&"adrive"!==e.getItem("defaultSyncOption")){let e=s.split(".")[0],o=s.split(".")[1]||"epub";r.push((()=>t.offlineBook(e,o.toUpperCase())))}}return r}))}static runTasksWithLimit(e,t,o){return p(this,void 0,void 0,(function*(){if("ftp"!==o&&"adrive"!==o){const o=[],i=[];for(const r of e){const e=r().then((t=>(i.splice(i.indexOf(e),1),t)));o.push(e),i.push(e),i.length>=t&&(yield Promise.race(i))}return Promise.all(o)}for(let t of e)yield t()}))}}class ke{constructor(e,t){this.bookKey="",this.sessionStart=0,this.unregisterUnload=null,this.configService=e,this.platform=t}getDailySeconds(e,t){const o=((this.configService.getAllMapConfig("readingStats")||{})[t]||[]).find((t=>t.startsWith(e+"-")));if(!o)return 0;const i=o.split("-");return parseInt(i[i.length-1],10)||0}setDailySeconds(e,t,o){const i=(this.configService.getAllMapConfig("readingStats")||{})[t]||[],r=`${e}-${o}`,n=i.filter((t=>!t.startsWith(e+"-")));this.configService.setOneMapConfig(t,[...n,r],"readingStats")}start(e){this.bookKey=e,this.sessionStart=Date.now(),this.unregisterUnload=this.platform.registerUnloadHandler((()=>{var e,t;this.commit(),null===(t=(e=this.platform).onBeforeClose)||void 0===t||t.call(e)}))}stop(){var e;this.commit(),null===(e=this.unregisterUnload)||void 0===e||e.call(this),this.unregisterUnload=null,this.bookKey="",this.sessionStart=0}commit(){if(!this.bookKey||!this.sessionStart)return;const e=Date.now()-this.sessionStart;if(e<1e3)return void(this.sessionStart=0);const t=Math.round(e/1e3);this.sessionStart=0;const o=this.configService.getObjectConfig(this.bookKey,"readingTime",0);this.configService.setObjectConfig(this.bookKey,o+t,"readingTime");const i=function(){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}(),r=this.getDailySeconds(this.bookKey,i);this.setDailySeconds(this.bookKey,i,r+t)}getTotalSeconds(e){return this.configService.getObjectConfig(e,"readingTime",0)}getDailySecondsForBook(e,t){return this.getDailySeconds(e,t)}getDayStats(e){return((this.configService.getAllMapConfig("readingStats")||{})[e]||[]).map((e=>{const t=e.lastIndexOf("-");return{bookKey:e.substring(0,t),seconds:parseInt(e.substring(t+1),10)||0}}))}getAllDates(){const e=this.configService.getAllMapConfig("readingStats");return Object.keys(e||{})}}const be="Koodo Reader",Se="application/vnd.koreader.v1+json";class we extends Error{constructor(e,t,o,i){super(e),this.name="KOReaderRequestError",this.status=t,this.code=o,this.body=i}}const Ee=e=>{const t=(e||"").trim();if(!t)return"";return(/^https?:\/\//i.test(t)?t:`https://${t}`).replace(/\/+$/,"")},Ce=e=>{const t="number"==typeof e?e:parseFloat((e||"0")+"");return!isFinite(t)||isNaN(t)?0:t>1&&t<=100?Math.min(Math.max(t/100,0),1):Math.min(Math.max(t,0),1)},Te=(e,t={})=>p(void 0,void 0,void 0,(function*(){const o=yield fetch(e,t);return o.ok||(yield(e=>p(void 0,void 0,void 0,(function*(){let t=null;try{t=yield e.json()}catch(o){try{t=yield e.text()}catch(e){t=null}}const o=(null==t?void 0:t.message)||(null==t?void 0:t.error)||(null==t?void 0:t.msg)||("string"==typeof t?t:"")||e.statusText||"Request failed";throw console.error(`[KOReader] HTTP ${e.status} error: ${o}`,null!=t?t:"(no body)"),new we(o,e.status,null==t?void 0:t.code,t)})))(o)),204===o.status?{}:yield o.json()})),xe=e=>({Accept:Se,"Content-Type":"application/json","x-auth-user":e.username,"x-auth-key":e.passwordHash});class Fe{constructor(e,t,o){this.getKOReaderSyncConfig=()=>{let e;try{e=this.ConfigService.getObjectConfig("koReaderSyncConfig","thirdpartyToken",{})}catch(e){return console.error("[KOReader] Failed to read koReaderSyncConfig:",e),null}if(!e||"object"!=typeof e)return console.error("[KOReader] koReaderSyncConfig is missing or invalid"),null;const t=Ee(e.serverUrl||""),o=(e.username||"").trim(),i=(e.passwordHash||"").trim();return t&&o&&i?{serverUrl:t,username:o,passwordHash:i}:(console.error("[KOReader] Incomplete config — missing fields"),null)},this.getLocalRecordLocation=e=>this.ConfigService.getObjectConfig(e,"recordLocation",{})||{},this.persistKOReaderMetadata=(e,t,o)=>{const i=Object.assign(Object.assign({},t),{percentage:o.percentage.toString(),xpath:o.progress,timestamp:o.timestamp||parseInt(Date.now()/1e3+"")});this.ConfigService.setObjectConfig(e,i,"recordLocation")},this.authUser=e=>p(this,void 0,void 0,(function*(){return yield Te(`${e.serverUrl}/users/auth`,{method:"GET",headers:xe(e)})})),this.createUser=e=>p(this,void 0,void 0,(function*(){return yield Te(`${e.serverUrl}/users/create`,{method:"POST",headers:{Accept:Se,"Content-Type":"application/json"},body:JSON.stringify({username:e.username,password:e.passwordHash})})})),this.getBookProgress=(e,t)=>p(this,void 0,void 0,(function*(){const o=yield Te(`${e.serverUrl}/syncs/progress/${encodeURIComponent(t)}`,{method:"GET",headers:xe(e)});return o&&0!==Object.keys(o).length?{document:t,percentage:Ce(o.percentage),progress:o.progress||"",device:o.device||"",device_id:o.device_id||"",timestamp:o.timestamp||0}:null})),this.updateBookProgress=(e,t)=>p(this,void 0,void 0,(function*(){yield Te(`${e.serverUrl}/syncs/progress`,{method:"PUT",headers:xe(e),body:JSON.stringify({document:t.document,percentage:t.percentage,progress:t.progress,device:t.device||be,device_id:t.device_id||"",timestamp:t.timestamp||parseInt(Date.now()/1e3+"")})})})),this.buildLocalUploadPayload=(e,t,o,i)=>p(this,void 0,void 0,(function*(){const r=Ce(t.percentage),n=t.xpath||"",s=this.ConfigService.getObjectConfig(e.key,"koreaderBooks",{});if(!s.document){let t=yield i(e);if(!t)return console.error(`[KOReader] Cannot build upload payload for "${e.name}": failed to compute partial MD5`),null;s.document=t,this.ConfigService.setObjectConfig(e.key,s,"koreaderBooks")}return n?{document:s.document,percentage:r,progress:n,device:be,device_id:o,timestamp:t.timestamp||parseInt(Date.now()/1e3+"")}:(console.error(`[KOReader] Cannot build upload payload for "${e.name}": no xpath/progress recorded (localRecord.xpath is empty)`),null)})),this.resolveDeviceId=()=>p(this,void 0,void 0,(function*(){try{return(yield this.TokenService.getFingerprint())||"koodo-reader"}catch(e){return console.error("[KOReader] Failed to get device fingerprint, using fallback ID:",e),"koodo-reader"}})),this.verifyAndBuildKOReaderSyncConfig=e=>p(this,void 0,void 0,(function*(){const t={serverUrl:Ee(e.serverUrl),username:(e.username||"").trim(),passwordHash:(e.password||"").trim()?d.MD5((e.password||"").trim()).toString():(e.passwordHash||"").trim()};if(!t.serverUrl||!t.username||!t.passwordHash)throw new Error("Please fill in all fields");try{return yield this.authUser(t),t}catch(e){console.error(`[KOReader] Auth failed for user "${t.username}" at ${t.serverUrl}, attempting to create user:`,e);try{return yield this.createUser(t),yield this.authUser(t),t}catch(i){if((o=i)instanceof we&&(2002===o.code||(o.message||"").toLowerCase().includes("already exists")))throw console.error(`[KOReader] User "${t.username}" already exists but auth failed. Original auth error:`,e),e;throw console.error(`[KOReader] Failed to create user "${t.username}":`,i),i}}var o})),this.syncKOReaderProgress=e=>p(this,void 0,void 0,(function*(){const t=this.getKOReaderSyncConfig();if(!t)throw new Error("Please configure the KOReader sync server first");yield this.authUser(t);const o=yield this.resolveDeviceId(),i=(yield this.DatabaseService.getAllRecords("books"))||[],r={checkedBooks:0,matchedBooks:0,pulledBooks:0,pushedBooks:0,skippedBooks:0};for(const n of i)try{r.checkedBooks++;const i=this.getLocalRecordLocation(n.key);if(!i||!i.xpath){console.error(`[KOReader] Skipping "${n.name}": no local reading progress (xpath) found`),r.skippedBooks++;continue}const s=this.ConfigService.getObjectConfig(n.key,"koreaderBooks",{});if(!s.document){let t=yield e(n);if(!t){console.error(`[KOReader] Skipping "${n.name}": failed to compute partial MD5 for document ID`),r.skippedBooks++;continue}s.document=t,this.ConfigService.setObjectConfig(n.key,s,"koreaderBooks")}let a=s.document;const d=yield this.getBookProgress(t,a),l=(null==d?void 0:d.timestamp)||0,c=i.timestamp||0;if(d){if(r.matchedBooks++,l>c)this.persistKOReaderMetadata(n.key,i,d),r.pulledBooks++;else{if(!(l{if("number"!=typeof e){const[t,o]=e.split("-");return{styleType:t,color:o}}if(e>=0&&e<$e.length){const t=$e[e].indexOf("color")>-1,o=parseInt($e[e].split("-")[1]);return{styleType:t?"background":"underline",color:t?_e[o]:Oe[o]}}return{styleType:"background",color:"#FEF3CD"}},this.formatHighlightValue=e=>`${e.styleType}-${e.color}`,this.getNoteHighlightString=()=>this.ConfigService.getReaderConfig(De)||"background-#FEF3CD",this.getNoteHighlightValue=()=>{const e=this.getNoteHighlightString();if(!e)return Ue;const[t,o]=e.split("-");return{styleType:t,color:o}},this.saveNoteHighlightValue=e=>{this.ConfigService.setReaderConfig(De,`${e.styleType}-${e.color}`)},this.getTtsHighlightString=()=>this.ConfigService.getReaderConfig(Re)||Ae,this.getTtsHighlightValue=()=>{const e=this.getTtsHighlightString();if(!e)return Ie;const[t,o]=e.split("-");return{styleType:t,color:o}},this.saveTtsHighlightValue=e=>{this.ConfigService.setReaderConfig(Re,`${e.styleType}-${e.color}`)},this.getSearchHighlightString=()=>this.ConfigService.getReaderConfig(Le)||Ae,this.getSearchHighlightValue=()=>{const e=this.ConfigService.getReaderConfig(Le);if(!e)return Ie;const[t,o]=e.split("-");return{styleType:t,color:o}},this.saveSearchHighlightValue=e=>{this.ConfigService.setReaderConfig(Le,`${e.styleType}-${e.color}`)},this.buildHighlightStyleForType=(e,t,o)=>{let i="background",r="#FEF3CD";if("number"==typeof e){if(e>=0&&e<$e.length){const t=$e[e].indexOf("color")>-1,o=parseInt($e[e].split("-")[1]);i=t?"background":"underline",r=t?_e[o]:Oe[o]}}else i=e.split("-")[0],r=e.split("-")[1];const n="background"===i?((e,t)=>{const o=e.replace("#",""),i=3===o.length?o.split("").map((e=>e+e)).join(""):o;return 6!==i.length?e:`rgba(${parseInt(i.slice(0,2),16)}, ${parseInt(i.slice(2,4),16)}, ${parseInt(i.slice(4,6),16)}, ${t})`})(r,.8):r;switch(i){case"background":return t?`background: ${n}; mix-blend-mode: multiply;`:`background: ${n};`;case"underline":return o?`border-right: 2px solid ${n};`:`border-bottom: 2px solid ${n};`;case"strikethrough":return t?o?`background: linear-gradient(to right, transparent calc(50% - 1px), ${n} calc(50% - 1px), ${n} calc(50% + 1px), transparent calc(50% + 1px));`:`background: linear-gradient(transparent calc(50% - 1px), ${n} calc(50% - 1px), ${n} calc(50% + 1px), transparent calc(50% + 1px));`:`text-decoration: line-through; text-decoration-color: ${n};`;case"wavy":if(t){const e=r.replace("#","%23");if(o){return`background-image: ${`url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='3' height='6'%3E%3Cpath d='M2 0 Q0 1.5 2 3 Q4 4.5 2 6' fill='none' stroke='${e}' stroke-width='1.5'%2F%3E%3C%2Fsvg%3E")`}; background-repeat: repeat-y; background-position: right; background-size: 3px 6px;`}return`background-image: ${`url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='6' height='3'%3E%3Cpath d='M0 2 Q1.5 0 3 2 Q4.5 4 6 2' fill='none' stroke='${e}' stroke-width='1.5'%2F%3E%3C%2Fsvg%3E")`}; background-repeat: repeat-x; background-position: bottom; background-size: 6px 3px;`}return`text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: ${n}; text-decoration-thickness: 2px; text-decoration-skip-ink: none;`;default:return`background: ${n};`}},this.buildHighlightPreviewStyle=(e,t)=>{switch(e){case"background":default:return{background:t};case"underline":return{borderBottom:`2px solid ${t}`};case"strikethrough":return{textDecoration:"line-through",textDecorationColor:t};case"wavy":return{textDecorationLine:"underline",textDecorationStyle:"wavy",textDecorationColor:t,textDecorationThickness:"2px",textDecorationSkipInk:"none"}}},this.convertNumberToHighlightValue=e=>this.getHighlightValue(e),this.buildTtsHighlightStyle=(e,t)=>this.buildHighlightStyleForType(this.getTtsHighlightString(),e,t),this.buildTtsHighlightPreviewStyle=(e,t)=>this.buildHighlightPreviewStyle(e,t),this.buildSearchHighlightStyle=(e,t)=>this.buildHighlightStyleForType(this.getSearchHighlightString(),e,t),this.buildSearchHighlightPreviewStyle=(e,t)=>this.buildHighlightPreviewStyle(e,t),this.ConfigService=e}}const Pe=(ze=class{static getItem(e){return localStorage.getItem(e)}static setItem(e,t){localStorage.setItem(e,t)}static removeItem(e){localStorage.removeItem(e)}},Ne="browser",class extends ze{static getReaderConfig(e){return x.includes(e)&&"undefined"!=typeof window&&window.currentBookKey&&this.getAllListConfig("seperateStyleBooks").includes(window.currentBookKey)?this.getObjectConfig(window.currentBookKey,"seperateStyleConfig",{})[e]:JSON.parse(this.getItem("readerConfig")||"{}")[e]}static setReaderConfig(e,t,o=!0){if(x.includes(e)&&"undefined"!=typeof window&&window.currentBookKey&&this.getAllListConfig("seperateStyleBooks").includes(window.currentBookKey)){let i=this.getObjectConfig(window.currentBookKey,"seperateStyleConfig",{});return i[e]=t,void this.setObjectConfig(window.currentBookKey,i,"seperateStyleConfig",o)}let i=JSON.parse(this.getItem("readerConfig")||"{}");i[e]=t,this.setItem("readerConfig",JSON.stringify(i)),o&&this.setSyncRecord({type:"config",catergory:"readerConfig",name:Ne,key:e},{operation:"update",time:Date.now()})}static getAllListConfig(e){return("{}"!==this.getItem(e)&&this.getItem(e)?JSON.parse(this.getItem(e)||""):[])||[]}static deleteListConfig(e,t){let o=this.getAllListConfig(t);const i=o.indexOf(e);i>-1&&o.splice(i,1),this.setAllListConfig(o,t)}static setListConfig(e,t){let o=this.getAllListConfig(t);const i=o.indexOf(e);i>-1?(o.splice(i,1),o.unshift(e)):o.unshift(e),this.setAllListConfig(o,t)}static setAllListConfig(e,t,o=!0){this.setItem(t,JSON.stringify(e)),o&&this.setSyncRecord({type:"config",catergory:"listConfig",name:"general",key:t},{operation:"update",time:Date.now()})}static setObjectConfig(e,t,o,i=!0){let r=this.getAllObjectConfig(o);r[e]=t,i&&this.setSyncRecord({type:"config",catergory:"objectConfig",name:o,key:e},{operation:"update",time:Date.now()}),this.setAllObjectConfig(r,o)}static getObjectConfig(e,t,o){return this.getAllObjectConfig(t)[e]||o}static getAllObjectConfig(e){let t=this.getItem(e);return JSON.parse(t)||{}}static setAllObjectConfig(e,t){this.setItem(t,JSON.stringify(e))}static deleteObjectConfig(e,t){let o=this.getAllObjectConfig(t);delete o[e],this.setSyncRecord({type:"config",catergory:"objectConfig",name:t,key:e},{operation:"delete",time:Date.now()}),this.setAllObjectConfig(o,t)}static getAllMapConfig(e){let t=this.getItem(e);return JSON.parse(t)||{}}static getMapConfig(e,t){return this.getAllMapConfig(t)[e]||[]}static setAllMapConfig(e,t){this.setItem(t,JSON.stringify(e))}static setMapConfig(e,t,o){let i=this.getAllMapConfig(o);void 0===i[e]&&(i[e]=[]),t&&-1===i[e].indexOf(t)&&i[e].unshift(t),this.setSyncRecord({type:"config",catergory:"mapConfig",name:o,key:e},{operation:"update",time:Date.now()}),this.setAllMapConfig(i,o)}static setOneMapConfig(e,t,o,i=!0){let r=this.getAllMapConfig(o);r[e]=t,i&&this.setSyncRecord({type:"config",catergory:"mapConfig",name:o,key:e},{operation:"update",time:Date.now()}),this.setAllMapConfig(r,o)}static deleteFromMapConfig(e,t,o){let i=this.getAllMapConfig(o),r=i[e].indexOf(t);i[e].splice(r,1),this.setSyncRecord({type:"config",catergory:"mapConfig",name:o,key:e},{operation:"update",time:Date.now()}),this.setAllMapConfig(i,o)}static deleteFromAllMapConfig(e,t){let o=this.getAllMapConfig(t);Object.keys(o).forEach((i=>{let r=o[i].indexOf(e);r>-1&&(o[i].splice(r,1),this.setSyncRecord({type:"config",catergory:"mapConfig",name:t,key:i},{operation:"update",time:Date.now()}))})),this.setAllMapConfig(o,t)}static deleteMapConfig(e,t){let o=this.getAllMapConfig(t);delete o[e],this.setSyncRecord({type:"config",catergory:"mapConfig",name:t,key:e},{operation:"delete",time:Date.now()}),this.setAllMapConfig(o,t)}static getFromAllMapConfig(e,t){let o=this.getAllMapConfig(t),i=[];for(let t in o)o[t]&&o[t].indexOf(e)>-1&&i.push(t);return i}static getSyncRecord(e){return JSON.parse(this.getItem("syncRecord")||"{}")[e.type+"."+e.catergory+"."+e.name+"."+e.key]||{operation:"",time:0}}static getAllSyncRecord(){return JSON.parse(this.getItem("syncRecord")||"{}")}static setSyncRecord(e,t){const o=e.type+"."+e.catergory+"."+e.name+"."+e.key;let i=JSON.parse(this.getItem("syncRecord")||"{}");i[o]=t,this.setItem("syncRecord",JSON.stringify(i))}static setAllSyncRecord(e){this.setItem("syncRecord",JSON.stringify(e))}});var ze,Ne;let Be;const Me=new Uint8Array(16);function We(){if(!Be&&(Be="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Be))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Be(Me)}const Qe=[];for(let e=0;e<256;++e)Qe.push((e+256).toString(16).slice(1));var Ke={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function He(e,t,o){if(Ke.randomUUID&&!t&&!e)return Ke.randomUUID();const i=(e=e||{}).random||(e.rng||We)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){o=o||0;for(let e=0;e<16;++e)t[o+e]=i[e];return t}return function(e,t=0){return Qe[e[t+0]]+Qe[e[t+1]]+Qe[e[t+2]]+Qe[e[t+3]]+"-"+Qe[e[t+4]]+Qe[e[t+5]]+"-"+Qe[e[t+6]]+Qe[e[t+7]]+"-"+Qe[e[t+8]]+Qe[e[t+9]]+"-"+Qe[e[t+10]]+Qe[e[t+11]]+Qe[e[t+12]]+Qe[e[t+13]]+Qe[e[t+14]]+Qe[e[t+15]]}(i)}class qe{static saveAllToken(e){return p(this,void 0,void 0,(function*(){if(e)if(h){const{ipcRenderer:t}=window.require("electron");t.invoke("encrypt-data",{token:e})}else{const t=yield this.encryptString(e);localStorage.setItem("encryptedToken",t)}}))}static getAllToken(){return p(this,void 0,void 0,(function*(){if(h){const{ipcRenderer:e}=window.require("electron");return yield e.invoke("decrypt-data")}{let e=localStorage.getItem("encryptedToken")||"";return e?yield this.decryptString(e):null}}))}static setToken(e,t){return p(this,void 0,void 0,(function*(){const o=JSON.parse((yield this.getAllToken())||"{}");o[e]=t,yield this.saveAllToken(JSON.stringify(o))}))}static getToken(e){return p(this,void 0,void 0,(function*(){return JSON.parse((yield this.getAllToken())||"{}")[e]||null}))}static deleteToken(e){return p(this,void 0,void 0,(function*(){const t=JSON.parse((yield this.getAllToken())||"{}");delete t[e],yield this.saveAllToken(JSON.stringify(t))}))}static encryptString(e){return p(this,void 0,void 0,(function*(){try{let t=yield this.getFingerprint();const o=yield Ve(t);return"undefined"!=typeof crypto&&crypto.subtle?yield function(e,t,o={alg:"HS256",typ:"JWT"}){return p(this,void 0,void 0,(function*(){const i=Je((new TextEncoder).encode(JSON.stringify(o))),r=Je((new TextEncoder).encode(JSON.stringify(e))),n=(new TextEncoder).encode(`${i}.${r}`),s=yield crypto.subtle.importKey("raw",(new TextEncoder).encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return`${i}.${r}.${Je(yield crypto.subtle.sign("HMAC",s,n))}`}))}(e,o):function(e,t){if(!e||!t)return"";const o=v((new TextEncoder).encode(t)),i=Array.from(new Uint8Array(o)),r=(new TextEncoder).encode(e),n=new Uint8Array(r.length);for(let e=0;enull));throw console.error(`[Notion] resolveDatabaseId failed for page ${t}: HTTP ${o.status} ${o.statusText}`,e),new Error(`Notion resolve database error: ${o.status} ${o.statusText}`)}const i=yield o.json(),r=(i.results||[]).find((e=>"child_database"===e.type));if(!r)throw console.error(`[Notion] No child_database block found under page ${t}. Available block types:`,(i.results||[]).map((e=>e.type))),new Error(`No child database found in page ${t}. Please provide a Database ID directly.`);return r.id}))}findOrCreatePage(e,t,o){return p(this,void 0,void 0,(function*(){const i=`${o}`,r=yield fetch(`https://api.notion.com/v1/databases/${t}/query`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Notion-Version":"2022-06-28"},body:JSON.stringify({filter:{property:"title",title:{equals:i}}})});if(!r.ok){const i=yield r.json().catch((()=>({})));if(400===r.status&&"validation_error"===(null==i?void 0:i.code)&&"string"==typeof(null==i?void 0:i.message)&&i.message.includes("is a page, not a database")){console.error(`[Notion] Provided databaseId "${t}" is a page, not a database. Resolving child database...`);const i=yield this.resolveDatabaseId(e,t);return this.findOrCreatePage(e,i,o)}throw console.error(`[Notion] Database query failed for databaseId "${t}" (book: "${o}"): HTTP ${r.status} ${r.statusText}`,i),new Error(`Notion API error: ${r.status} ${r.statusText}`)}const n=yield r.json();if(n.results&&n.results.length>0)return n.results[0].id;const s=yield fetch("https://api.notion.com/v1/pages",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Notion-Version":"2022-06-28"},body:JSON.stringify({parent:{database_id:t},properties:{title:{title:[{text:{content:i}}]}}})});if(!s.ok){const e=yield s.json().catch((()=>null));throw console.error(`[Notion] Failed to create page for book "${o}" in database "${t}": HTTP ${s.status} ${s.statusText}`,e),new Error(`Notion create page error: ${s.status} ${s.statusText}`)}return(yield s.json()).id}))}appendBlocks(e,t,o,i){return p(this,void 0,void 0,(function*(){const r=!o.notes||0===o.notes.length,n=[];n.push({object:"block",type:"divider",divider:{}}),i&&n.push({object:"block",type:"heading_3",heading_3:{rich_text:[{type:"text",text:{content:i}}]}}),n.push({object:"block",type:"quote",quote:{rich_text:[{type:"text",text:{content:o.text||""}}]}}),!r&&o.notes&&n.push({object:"block",type:"paragraph",paragraph:{rich_text:[{type:"text",text:{content:`📝 ${o.notes}`}}]}});const s=`${o.date.year}-${String(o.date.month).padStart(2,"0")}-${String(o.date.day).padStart(2,"0")}`;n.push({object:"block",type:"paragraph",paragraph:{rich_text:[{type:"text",text:{content:`Added on ${s}`},annotations:{italic:!0,color:"gray"}}]}});const a=yield fetch(`https://api.notion.com/v1/blocks/${t}/children`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Notion-Version":"2022-06-28"},body:JSON.stringify({children:n})});if(!a.ok){const e=yield a.json().catch((()=>null));throw console.error(`[Notion] Failed to append blocks to page ${t}: HTTP ${a.status} ${a.statusText}`,e),new Error(`Notion append blocks error: ${a.status} ${a.statusText}`)}}))}syncNote(e,t){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const o=this.getConfig();if(!o)return!1;try{const i=yield this.findOrCreatePage(o.token,o.databaseId,t);return yield this.appendBlocks(o.token,i,e,e.chapter||""),!0}catch(e){return console.error(`[Notion] Sync failed for book "${t}":`,e instanceof Error?e.message:e),!1}}))}}class Xe{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("yuqueSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[Yuque] yuqueSyncConfig is empty or not set"),null):e}catch(e){return console.error("[Yuque] Failed to read yuqueSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableYuqueSync")}findOrCreateDoc(e,t,o){return p(this,void 0,void 0,(function*(){const i=`${o}`,r=`koodo-reader-${o.replace(/[^a-zA-Z0-9\u4e00-\u9fa5]/g,"-").replace(/-+/g,"-").toLowerCase().substring(0,50)}`;try{const o=yield fetch(`${Xe.API_BASE}/repos/${t}/docs/${r}`,{method:"GET",headers:{"X-Auth-Token":e,"Content-Type":"application/json"}});if(o.ok){const e=yield o.json();return{id:e.data.id,slug:e.data.slug,body:e.data.body||""}}if(404!==o.status){const e=yield o.json().catch((()=>null));console.error(`[Yuque] Unexpected error fetching doc "${r}" in repo "${t}": HTTP ${o.status} ${o.statusText}`,e)}}catch(e){console.error(`[Yuque] Network error fetching doc "${r}" in repo "${t}":`,e)}const n=yield fetch(`${Xe.API_BASE}/repos/${t}/docs`,{method:"POST",headers:{"X-Auth-Token":e,"Content-Type":"application/json"},body:JSON.stringify({title:i,slug:r,body:`# ${i}\n\n`,format:"markdown"})});if(!n.ok){const e=yield n.json().catch((()=>null));throw console.error(`[Yuque] Failed to create doc "${i}" in repo "${t}": HTTP ${n.status} ${n.statusText}`,e),new Error(`Yuque create doc error: ${n.status} ${n.statusText}`)}const s=yield n.json();return{id:s.data.id,slug:s.data.slug,body:s.data.body||""}}))}formatNoteMarkdown(e){const t=!e.notes||0===e.notes.length,o=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let i="\n---\n\n";return e.chapter&&(i+=`### ${e.chapter}\n\n`),i+=`> ${e.text||""}\n\n`,!t&&e.notes&&(i+=`📝 ${e.notes}\n\n`),i+=`*Added on ${o}*\n\n`,i}updateDoc(e,t,o,i){return p(this,void 0,void 0,(function*(){const r=yield fetch(`${Xe.API_BASE}/repos/${t}/docs/${o}`,{method:"PUT",headers:{"X-Auth-Token":e,"Content-Type":"application/json"},body:JSON.stringify({body:i,format:"markdown"})});if(!r.ok){const e=yield r.json().catch((()=>null));throw console.error(`[Yuque] Failed to update doc ${o} in repo "${t}": HTTP ${r.status} ${r.statusText}`,e),new Error(`Yuque update doc error: ${r.status} ${r.statusText}`)}}))}syncNote(e,t){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const o=this.getConfig();if(!o)return!1;try{const i=yield this.findOrCreateDoc(o.token,o.namespace,t),r=this.formatNoteMarkdown(e),n=i.body+r;return yield this.updateDoc(o.token,o.namespace,i.id,n),!0}catch(e){return console.error(`[Yuque] Sync failed for book "${t}":`,e instanceof Error?e.message:e),!1}}))}}Xe.API_BASE="https://www.yuque.com/api/v2";class Ze{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("readwiseSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[Readwise] readwiseSyncConfig is empty or not set"),null):e}catch(e){return console.error("[Readwise] Failed to read readwiseSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableReadwiseSync")}syncNote(e,t,o){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const i=this.getConfig();if(!i)return!1;const r=`${t}`,n=!e.notes||0===e.notes.length,s={text:e.text||"",title:r,author:o||"Unknown",source_type:"koodo-reader",category:"books",highlighted_at:`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`};if(!n&&e.notes&&(s.note=e.notes),e.chapter){const t=parseInt(e.chapter,10);isNaN(t)||(s.location_type="order",s.location=t)}try{const e=yield fetch(`${Ze.API_BASE}/highlights/`,{method:"POST",headers:{Authorization:`Token ${i.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify({highlights:[s]})});if(!e.ok){const t=yield e.json().catch((()=>null));throw console.error(`[Readwise] Failed to sync highlight for book "${r}": HTTP ${e.status} ${e.statusText}`,t),new Error(`Readwise API error: ${e.status} ${e.statusText}`)}return!0}catch(t){return console.error(`[Readwise] Sync failed for book "${r}" (text: "${(e.text||"").substring(0,50)}..."):`,t instanceof Error?t.message:t),!1}}))}}Ze.API_BASE="https://readwise.io/api/v2";class et{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("imaSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[IMA] imaSyncConfig is empty or not set"),null):e}catch(e){return console.error("[IMA] Failed to read imaSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableImaSync")}getHeaders(e){return{"Content-Type":"application/json","ima-openapi-clientid":e.clientId,"ima-openapi-apikey":e.apiKey}}formatNoteMarkdown(e,t,o){const i=!e.notes||0===e.notes.length,r=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let n="\n---\n\n";return e.chapter&&(n+=`### ${e.chapter}\n\n`),n+=`> ${e.text||""}\n\n`,!i&&e.notes&&(n+=`**Note:** ${e.notes}\n\n`),n+=`*${r}*\n`,n}findNoteByTitle(e,t){var o,i,r,n;return p(this,void 0,void 0,(function*(){try{const s=JSON.stringify({search_type:0,query_info:{title:t},start:0,end:20}),a=yield fetch(`${et.API_BASE}/search_note`,{method:"POST",headers:this.getHeaders(e),body:s});if(!a.ok){const e=yield a.json().catch((()=>null));return console.error(`[IMA] search_note failed for title "${t}": HTTP ${a.status} ${a.statusText}`,e),null}const d=yield a.json();if(0!==d.code)return console.error(`[IMA] search_note returned error code ${d.code} for title "${t}":`,null!==(o=d.msg)&&void 0!==o?o:d),null;const l=((null===(i=d.data)||void 0===i?void 0:i.search_note_infos)||[]).find((e=>{var o;return t.includes(null===(o=e.note_book_info)||void 0===o?void 0:o.title.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu,""))}));return null!==(n=null===(r=null==l?void 0:l.note_book_info)||void 0===r?void 0:r.note_id)&&void 0!==n?n:null}catch(e){return console.error(`[IMA] Network error in search_note for title "${t}":`,e),null}}))}createNote(e,t,o){var i,r,n;return p(this,void 0,void 0,(function*(){try{const s={content_format:1,content:`# ${t}\n\n${o}`};e.folderId&&(s.folder_id=e.folderId);const a=yield fetch(`${et.API_BASE}/import_doc`,{method:"POST",headers:this.getHeaders(e),body:JSON.stringify(s)});if(!a.ok){const e=yield a.json().catch((()=>null));return console.error(`[IMA] import_doc failed for note "${t}": HTTP ${a.status} ${a.statusText}`,e),null}const d=yield a.json();return 0!==d.code?(console.error(`[IMA] import_doc returned error code ${d.code} for note "${t}":`,null!==(i=d.msg)&&void 0!==i?i:d),null):null!==(n=null===(r=d.data)||void 0===r?void 0:r.note_id)&&void 0!==n?n:null}catch(e){return console.error(`[IMA] Network error in import_doc for note "${t}":`,e),null}}))}appendNote(e,t,o){var i;return p(this,void 0,void 0,(function*(){try{const r=yield fetch(`${et.API_BASE}/append_doc`,{method:"POST",headers:this.getHeaders(e),body:JSON.stringify({note_id:t,content_format:1,content:o})});if(!r.ok){const e=yield r.json().catch((()=>null));return console.error(`[IMA] append_doc failed for noteId "${t}": HTTP ${r.status} ${r.statusText}`,e),!1}const n=yield r.json();return 0===n.code||(console.error(`[IMA] append_doc returned error code ${n.code} for noteId "${t}":`,null!==(i=n.msg)&&void 0!==i?i:n),!1)}catch(e){return console.error(`[IMA] Network error in append_doc for noteId "${t}":`,e),!1}}))}syncNote(e,t,o){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const i=this.getConfig();if(!i)return!1;const r=this.formatNoteMarkdown(e,t,o);let n=yield this.findNoteByTitle(i,t);if(n){const e=yield this.appendNote(i,n,r);return e||console.error(`[IMA] Failed to append to existing note "${t}" (noteId: ${n})`),e}return n=yield this.createNote(i,t,r),n||console.error(`[IMA] Failed to create note for book "${t}"`),null!==n}))}}et.API_BASE="https://ima.qq.com/openapi/note/v1";class tt{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("siyuanSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[SiYuan] siyuanSyncConfig is empty or not set"),null):e}catch(e){return console.error("[SiYuan] Failed to read siyuanSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableSiYuanSync")}getHeaders(e){return{"Content-Type":"application/json",Authorization:`Token ${e}`}}findOrCreateNotebook(e,t){var o,i;return p(this,void 0,void 0,(function*(){const r=yield fetch(`${e}/api/notebook/lsNotebooks`,{method:"POST",headers:this.getHeaders(t),body:JSON.stringify({})});if(!r.ok){const t=yield r.json().catch((()=>null));throw console.error(`[SiYuan] lsNotebooks failed at ${e}: HTTP ${r.status} ${r.statusText}`,t),new Error(`SiYuan list notebooks failed: ${r.status} ${r.statusText}`)}const n=yield r.json();if(0!==n.code)throw console.error(`[SiYuan] lsNotebooks returned error code ${n.code}:`,n.msg),new Error(`SiYuan list notebooks error: ${n.msg}`);const s=(null!==(i=null===(o=n.data)||void 0===o?void 0:o.notebooks)&&void 0!==i?i:[]).find((e=>"Koodo Reader"===e.name));if(s)return s.id;const a=yield fetch(`${e}/api/notebook/createNotebook`,{method:"POST",headers:this.getHeaders(t),body:JSON.stringify({name:"Koodo Reader"})});if(!a.ok){const t=yield a.json().catch((()=>null));throw console.error(`[SiYuan] createNotebook failed at ${e}: HTTP ${a.status} ${a.statusText}`,t),new Error(`SiYuan create notebook failed: ${a.status} ${a.statusText}`)}const d=yield a.json();if(0!==d.code)throw console.error(`[SiYuan] createNotebook returned error code ${d.code}:`,d.msg),new Error(`SiYuan create notebook error: ${d.msg}`);return d.data.notebook.id}))}findOrCreateDoc(e,t,o,i,r,n){return p(this,void 0,void 0,(function*(){const r=yield fetch(`${e}/api/query/sql`,{method:"POST",headers:this.getHeaders(t),body:JSON.stringify({stmt:`SELECT id FROM blocks WHERE type='d' AND hpath='${i.replace(/'/g,"''")}' LIMIT 1`})});if(r.ok){const e=yield r.json();if(0!==e.code)console.error(`[SiYuan] SQL query for doc "${i}" returned error code ${e.code}:`,e.msg);else if(e.data&&e.data.length>0)return e.data[0].id}else{const e=yield r.json().catch((()=>null));console.error(`[SiYuan] SQL query for doc "${i}" failed: HTTP ${r.status} ${r.statusText}`,e)}const s=n?`**Author:** ${n}\n`:"",a=yield fetch(`${e}/api/filetree/createDocWithMd`,{method:"POST",headers:this.getHeaders(t),body:JSON.stringify({notebook:o,path:i,markdown:s})});if(!a.ok){const e=yield a.json().catch((()=>null));throw console.error(`[SiYuan] createDocWithMd failed for "${i}" in notebook "${o}": HTTP ${a.status} ${a.statusText}`,e),new Error(`SiYuan create doc failed: ${a.status} ${a.statusText}`)}const d=yield a.json();if(0!==d.code)throw console.error(`[SiYuan] createDocWithMd returned error code ${d.code} for "${i}":`,d.msg),new Error(`SiYuan create doc error: ${d.msg}`);return d.data}))}appendMarkdownToDoc(e,t,o,i){return p(this,void 0,void 0,(function*(){const r=yield fetch(`${e}/api/block/appendBlock`,{method:"POST",headers:this.getHeaders(t),body:JSON.stringify({data:i,dataType:"markdown",parentID:o})});if(!r.ok){const e=yield r.json().catch((()=>null));throw console.error(`[SiYuan] appendBlock failed for docId "${o}": HTTP ${r.status} ${r.statusText}`,e),new Error(`SiYuan append block failed: ${r.status} ${r.statusText}`)}const n=yield r.json();if(0!==n.code)throw console.error(`[SiYuan] appendBlock returned error code ${n.code} for docId "${o}":`,n.msg),new Error(`SiYuan append block error: ${n.msg}`)}))}formatNoteMarkdown(e){const t=!e.notes||0===e.notes.length,o=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let i="---\n\n";return e.chapter&&(i+=`### ${e.chapter}\n\n`),i+=`> ${e.text||""}\n\n`,!t&&e.notes&&(i+=`📝 ${e.notes}\n\n`),i+=`*Added on ${o}*\n\n`,i}sanitizePathComponent(e){return e.replace(/[\\/:*?"<>|]/g,"_").trim()}syncNote(e,t,o){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const i=this.getConfig();if(!i)return!1;const{serverUrl:r,token:n}=i;if(!r||!n)return console.error("[SiYuan] Sync skipped: config is missing serverUrl or token",{hasServerUrl:!!r,hasToken:!!n}),!1;try{const i=yield this.findOrCreateNotebook(r,n),s=`/${this.sanitizePathComponent(t)}`,a=yield this.findOrCreateDoc(r,n,i,s,t,o),d=this.formatNoteMarkdown(e);return yield this.appendMarkdownToDoc(r,n,a,d),!0}catch(e){return console.error(`[SiYuan] Sync failed for book "${t}" at ${i.serverUrl}:`,e instanceof Error?e.message:e),!1}}))}}class ot{constructor(e,t){this.databaseService=e,this.notionSync=new Ge(t),this.yuqueSync=new Xe(t),this.readwiseSync=new Ze(t),this.imaSync=new et(t),this.siyuanSync=new tt(t)}getExtraServices(){return[]}getEnabledServices(){const e=[];return this.notionSync.isEnabled()&&e.push({name:"Notion",sync:this.notionSync.syncNote.bind(this.notionSync)}),this.yuqueSync.isEnabled()&&e.push({name:"Yuque",sync:this.yuqueSync.syncNote.bind(this.yuqueSync)}),this.readwiseSync.isEnabled()&&e.push({name:"Readwise",sync:this.readwiseSync.syncNote.bind(this.readwiseSync)}),this.imaSync.isEnabled()&&e.push({name:"IMA",sync:this.imaSync.syncNote.bind(this.imaSync)}),this.siyuanSync.isEnabled()&&e.push({name:"SiYuan",sync:this.siyuanSync.syncNote.bind(this.siyuanSync)}),[...e,...this.getExtraServices()]}syncNote(e,t){return p(this,void 0,void 0,(function*(){const o=this.getEnabledServices();if(0===o.length)return;let i="Unknown Book",r="";if(t||e.bookKey)try{const o=yield this.databaseService.getRecord(t||e.bookKey,"books");o&&o.name&&(i=o.name),o&&o.author&&(r=o.author)}catch(o){console.error(`[NoteSync] Failed to resolve book info for key: ${t||e.bookKey}`,o)}const n=(yield Promise.allSettled(o.map((t=>p(this,void 0,void 0,(function*(){var o,n,s,a;try{const s=yield t.sync(e,i,r);return s||console.error(`[NoteSync] ${t.name} sync returned false for book "${i}" (noteId: ${null!==(n=null!==(o=e.noteKey)&&void 0!==o?o:e.key)&&void 0!==n?n:"unknown"})`),{name:t.name,success:s}}catch(o){return console.error(`[NoteSync] ${t.name} sync threw an error for book "${i}" (noteId: ${null!==(a=null!==(s=e.noteKey)&&void 0!==s?s:e.key)&&void 0!==a?a:"unknown"}):`,o),{name:t.name,success:!1}}})))))).filter((e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.success)).map((e=>"fulfilled"===e.status?e.value.name:"Unknown"));n.length>0&&console.error(`[NoteSync] Sync failed for services: ${n.join(", ")} | book: "${i}"`)}))}}class it{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("markdownSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[Markdown] markdownSyncConfig is empty or not set"),null):e}catch(e){return console.error("[Markdown] Failed to read markdownSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableMarkdownSync")}formatNoteMarkdown(e){const t=!e.notes||0===e.notes.length,o=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let i="\n---\n\n";return e.chapter&&(i+=`### ${e.chapter}\n\n`),i+=`> ${e.text||""}\n\n`,!t&&e.notes&&(i+=`📝 ${e.notes}\n\n`),i+=`*Added on ${o}*\n\n`,i}sanitizeFileName(e){return e.replace(/[\\/:*?"<>|]/g,"_").trim()}syncNote(e,t,o){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const i=window.require("fs"),r=window.require("path"),n=this.getConfig();if(!n)return!1;const s=n.folder;if(!s)return console.error("[Markdown] Sync skipped: markdownSyncConfig.folder is not set"),!1;try{const n=this.sanitizeFileName(t),a=r.join(s,`${n}.md`);if(!i.existsSync(a)){const e=`# ${t}\n`,r=o?`**Author:** ${o}\n\n`:"\n";try{i.writeFileSync(a,e+r,"utf-8")}catch(e){return console.error(`[Markdown] Failed to create file "${a}" for book "${t}":`,e),!1}}const d=this.formatNoteMarkdown(e);try{i.appendFileSync(a,d,"utf-8")}catch(e){return console.error(`[Markdown] Failed to append to file "${a}" for book "${t}":`,e),!1}return!0}catch(e){return console.error(`[Markdown] Sync failed for book "${t}" in folder "${s}":`,e instanceof Error?e.message:e),!1}}))}}class rt extends ot{constructor(e,t){super(e,t),this.markdownSync=new it(t)}getExtraServices(){return this.markdownSync.isEnabled()?[{name:"Markdown",sync:this.markdownSync.syncNote.bind(this.markdownSync)}]:[]}}class nt{constructor(t){this.syncWordToEudic=(t,o)=>p(this,void 0,void 0,(function*(){var i,r,n,s,a,d,l,c,u,h;if("yes"===this.configService.getReaderConfig("isEnableEudicSync"))try{let c;try{c=this.configService.getObjectConfig("eudicSyncConfig","thirdpartyToken",{})}catch(e){return void console.error("[Eudic] Failed to read eudicSyncConfig:",e)}if(!c||!c.accessToken)return void console.error("[Eudic] Sync skipped: config is missing or accessToken is not set",{hasConfig:!!c});const u=c.language||"en",h={Authorization:`NIS ${c.accessToken}`,"Content-Type":"application/json","User-Agent":"Mozilla/5.0"};let p="0";const f=(c.categoryName||"").trim();if(f)if(void 0!==c.categoryId)p=c.categoryId;else try{const t=(null===(i=(yield e.get(`https://api.frdic.com/api/open/v1/studylist/category?language=${u}`,{headers:h})).data)||void 0===i?void 0:i.data)||[],o=t.find((e=>e.name===f));o?p=o.id:console.error(`[Eudic] Category "${f}" not found among available categories:`,t.map((e=>e.name)));const r=Object.assign(Object.assign({},c),{categoryId:p});this.configService.setObjectConfig("eudicSyncConfig",r,"thirdpartyToken")}catch(e){console.error("[Eudic] Failed to fetch category list:",null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.status,null!==(s=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)&&void 0!==s?s:e)}try{yield e.post("https://api.frdic.com/api/open/v1/studylist/word",{language:u,word:t,context_line:o||"",category_ids:[p]},{headers:h})}catch(e){throw console.error(`[Eudic] Failed to add word "${t}" to study list (category: ${p}):`,null===(a=null==e?void 0:e.response)||void 0===a?void 0:a.status,null!==(l=null===(d=null==e?void 0:e.response)||void 0===d?void 0:d.data)&&void 0!==l?l:e),e}}catch(e){console.error("[Eudic] Sync error for word:",t,null===(c=null==e?void 0:e.response)||void 0===c?void 0:c.status,null!==(h=null===(u=null==e?void 0:e.response)||void 0===u?void 0:u.data)&&void 0!==h?h:e)}})),this.syncWordToAnki=(t,o,i,r,n="")=>p(this,void 0,void 0,(function*(){var s,a,d,l,c,u,h,p,f,g;if("yes"===this.configService.getReaderConfig("isEnableAnkiSync"))try{let f;try{f=this.configService.getObjectConfig("ankiSyncConfig","thirdpartyToken",{})}catch(e){return void console.error("[Anki] Failed to read ankiSyncConfig:",e)}if(!f||!f.deckName)return void console.error("[Anki] Sync skipped: config is missing or deckName is not set",{hasConfig:!!f});const g=f.host||"127.0.0.1",y=`http://${g}:${f.port||"8765"}`,m=f.deckName,v="Koodo Reader Word",k=(t,o={})=>{const i={action:t,version:6,params:o};return f.apiKey&&(i.key=f.apiKey),e.post(y,i)};if(!f.modelName)try{const e=yield k("modelNames");if(!((null===(s=e.data)||void 0===s?void 0:s.result)||[]).includes(v))try{yield k("createModel",{modelName:v,inOrderFields:["Word","Sentence","Book","Chapter","Definition"],cardTemplates:[{Name:"Card 1",Front:"{{Word}}

{{Sentence}}

{{Book}}
{{Chapter}}",Back:"{{Definition}}"}]})}catch(e){throw console.error(`[Anki] Failed to create model "${v}":`,null!==(d=null===(a=null==e?void 0:e.response)||void 0===a?void 0:a.data)&&void 0!==d?d:e),e}this.configService.setObjectConfig("ankiSyncConfig",Object.assign(Object.assign({},f),{modelName:v}),"thirdpartyToken")}catch(e){throw console.error(`[Anki] Failed to fetch model names from ${y}:`,null!==(c=null===(l=null==e?void 0:e.response)||void 0===l?void 0:l.data)&&void 0!==c?c:e),e}try{const e=yield k("addNote",{note:{deckName:m,modelName:v,fields:{Word:t,Sentence:o||"",Book:i||"",Chapter:r||"",Definition:n||""},options:{allowDuplicate:!1},tags:[]}});(null===(u=e.data)||void 0===u?void 0:u.error)&&console.error(`[Anki] addNote returned an error for word "${t}" in deck "${m}":`,e.data.error)}catch(e){throw console.error(`[Anki] Failed to add note for word "${t}" to deck "${m}" at ${y}:`,null!==(p=null===(h=null==e?void 0:e.response)||void 0===h?void 0:h.data)&&void 0!==p?p:e),e}}catch(e){console.error("[Anki] Sync error for word:",t,null!==(g=null===(f=null==e?void 0:e.response)||void 0===f?void 0:f.data)&&void 0!==g?g:e)}})),this.configService=t}}class st extends nt{}export{w as CommonTool,Pe as ConfigService,je as HighlightUtil,Fe as KOReaderUtil,F as KookitConfig,me as LoginHelper,rt as NoteSyncManager,fe as ReaderRequest,ke as ReadingTimeUtil,ce as SqlStatement,ve as SyncHelper,ie as SyncUtil,ge as ThirdpartyRequest,qe as TokenService,ye as UserRequest,st as WordSyncManager}; +import e from"axios";import{Storage as a}from"megajs";import{Buffer as t}from"buffer";import{S3Client as o,ListObjectsV2Command as n,DeleteObjectCommand as r,PutObjectCommand as i,GetObjectCommand as l}from"@aws-sdk/client-s3";import s from"crypto-js";import{AuthType as d,createClient as c}from"webdav/dist/web/index.js";import{SSE as u}from"sse.js";import{isElectron as m}from"react-device-detect";function p(e,a,t,o){return new(t||(t=Promise))((function(n,r){function i(e){try{s(o.next(e))}catch(e){r(e)}}function l(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var a;e.done?n(e.value):(a=e.value,a instanceof t?a:new t((function(e){e(a)}))).then(i,l)}s((o=o.apply(e,a||[])).next())}))}const h=e=>"json"===e?"application/json":["jpg","jpeg","png","gif","bmp"].includes(e)?"image/"+e:"zip"===e?"application/zip":"epub"===e?"application/epub+zip":"txt"===e?"text/plain":"pdf"===e?"application/pdf":"mobi"===e?"application/x-mobipocket-ebook":"azw3"===e||"azw"===e?"application/vnd.amazon.ebook":"cbz"===e?"application/x-cbz":"cbr"===e?"application/x-cbr":"cbt"===e?"application/x-cbt":"cb7"===e?"application/x-cb7":"fb2"===e?"application/x-fictionbook+xml":"html"===e?"text/html":"css"===e?"text/css":"js"===e?"application/javascript":"xml"===e?"application/xml":"xhtml"===e?"application/xhtml+xml":"opf"===e?"application/oebps-package+xml":"ncx"===e?"application/x-dtbncx+xml":"mp3"===e?"audio/mpeg":"wav"===e?"audio/wav":"ogg"===e?"audio/ogg":"mp4"===e?"video/mp4":"webm"===e?"video/webm":"avi"===e?"video/x-msvideo":"wmv"===e?"video/x-ms-wmv":"flv"===e?"video/x-flv":"m3u8"===e?"application/x-mpegURL":"ts"===e?"video/MP2T":"3gp"===e?"video/3gpp":"3g2"===e?"video/3gpp2":"db"===e?"application/x-sqlite3":void 0,g=["books","notes","bookmarks","plugins","words"],f=e=>{const a=atob(e),t=a.length,o=new Uint8Array(t);for(let e=0;e{let a="";const t=new Uint8Array(e),o=t.byteLength;for(let e=0;ee>>>a|e<<32-a,o=(e,a,t)=>e&a^~e&t,n=(e,a,t)=>e&a^e&t^a&t,r=e=>t(e,2)^t(e,13)^t(e,22),i=e=>t(e,6)^t(e,11)^t(e,25),l=e=>t(e,7)^t(e,18)^e>>>3,s=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],d=8*e.length,c=(960-(8*e.length+1)%512)%512,u=e.length+Math.ceil((c+1)/8)+8,m=new Uint8Array(u);m.set(e),m[e.length]=128;new DataView(m.buffer,m.byteLength-8).setBigUint64(0,BigInt(d),!1);for(let e=0;e>>10)+c[e-7]+l(c[e-15])+c[e-16]>>>0);let[u,h,g,f,y,N,v,k]=s;for(let e=0;e<64;e++){const t=k+i(y)+o(y,N,v)+a[e]+c[e]>>>0,l=r(u)+n(u,h,g)>>>0;k=v,v=N,N=y,y=f+t>>>0,f=g,g=h,h=u,u=t+l>>>0}s[0]=s[0]+u>>>0,s[1]=s[1]+h>>>0,s[2]=s[2]+g>>>0,s[3]=s[3]+f>>>0,s[4]=s[4]+y>>>0,s[5]=s[5]+N>>>0,s[6]=s[6]+v>>>0,s[7]=s[7]+k>>>0}var p;const h=new ArrayBuffer(32),g=new DataView(h);return s.forEach(((e,a)=>{g.setUint32(4*a,e,!1)})),h}const v={_chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",encode(e){if("string"!=typeof e)throw new Error("Input must be a string");let a="",t=0;const o=this._stringToUtf8Bytes(e),n=o.length;for(;t>2,s=(3&e)<<4|r>>4,d=(15&r)<<2|i>>6,c=63&i;a+=this._chars.charAt(l),a+=this._chars.charAt(s),a+=t-2>=n?"=":this._chars.charAt(d),a+=t-1>=n?"=":this._chars.charAt(c)}return a},decode(e){if("string"!=typeof e)throw new Error("Input must be a string");for(e=e.replace(/[^A-Za-z0-9+/]/g,"");e.length%4!=0;)e+="=";const a=[];let t=0;const o=e.length;for(;t>4,s=(15&n)<<4|r>>2,d=(3&r)<<6|i;a.push(l),-1!==r&&a.push(s),-1!==i&&a.push(d)}return this._utf8BytesToString(a)},_stringToUtf8Bytes(e){const a=[];for(let t=0;t>6),a.push(128|63&o);else if(55296==(64512&o)&&t+1>18),a.push(128|e>>12&63),a.push(128|e>>6&63),a.push(128|63&e)}else a.push(239,191,189),t--}else a.push(224|o>>12),a.push(128|o>>6&63),a.push(128|63&o)}return a},_utf8BytesToString(e){let a="",t=0;for(;t65535){const t=e-65536;a+=String.fromCharCode(55296|t>>10),a+=String.fromCharCode(56320|1023&t)}else a+=String.fromCharCode(e)}else a+="�"}else a+="�"}return a},encodeURL(e){return this.encode(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},decodeURL(e){for(e=e.replace(/-/g,"+").replace(/_/g,"/");e.length%4;)e+="=";return this.decode(e)}},k=e=>{const a=(e,a)=>{const t=(65535&e)+(65535&a);return(e>>16)+(a>>16)+(t>>16)<<16|65535&t},t=(e,t,o,n,r,i)=>{return a((l=a(a(t,e),a(n,i)))<<(s=r)|l>>>32-s,o);var l,s},o=(e,a,o,n,r,i,l)=>t(a&o|~a&n,e,a,r,i,l),n=(e,a,o,n,r,i,l)=>t(a&n|o&~n,e,a,r,i,l),r=(e,a,o,n,r,i,l)=>t(a^o^n,e,a,r,i,l),i=(e,a,o,n,r,i,l)=>t(o^(a|~n),e,a,r,i,l),l=e.length,s=1+(l+8>>6),d=new Array(16*s).fill(0);for(let a=0;a>2]|=e[a]<>2]|=128<{let a="";for(let t=0;t<4;t++)a+=("0"+(e>>8*t&255).toString(16)).slice(-2);return a})).join("")};class b{constructor(e){this.queue=[],this.runningTasks=0,this.totalTasks=0,this.completedTasks=0,this.hasFailedTasks=!1,this.downloadedSize=0,this.maxConcurrency=e}addTask(e){return p(this,void 0,void 0,(function*(){return this.totalTasks++,new Promise(((a,t)=>{if(this.hasFailedTasks)return void a(void 0);const o=()=>p(this,void 0,void 0,(function*(){try{this.runningTasks++;const t=yield e();return this.completedTasks++,a(t),t}catch(e){throw this.completedTasks++,t(e),e}finally{this.runningTasks--,this.runNext()}}));this.runningTasks0&&this.runningTasks"application/json"===e?"json":e.startsWith("image/")?e.split("/")[1]:"application/zip"===e?"zip":"application/epub+zip"===e?"epub":"text/plain"===e?"txt":"application/pdf"===e?"pdf":"application/x-mobipocket-ebook"===e?"mobi":"application/vnd.amazon.ebook"===e?"azw3":"application/x-cbz"===e?"cbz":"application/x-cbr"===e?"cbr":"application/x-cbt"===e?"cbt":"application/x-cb7"===e?"cb7":"application/x-fictionbook+xml"===e?"fb2":"text/html"===e?"html":"text/css"===e?"css":"application/javascript"===e?"js":"application/xml"===e?"xml":"application/xhtml+xml"===e?"xhtml":"application/oebps-package+xml"===e?"opf":"application/x-dtbncx+xml"===e?"ncx":"audio/mpeg"===e?"mp3":"audio/wav"===e?"wav":"audio/ogg"===e?"ogg":"video/mp4"===e?"mp4":"video/webm"===e?"webm":"video/x-msvideo"===e?"avi":"video/x-ms-wmv"===e?"wmv":"video/x-flv"===e?"flv":"application/x-mpegURL"===e?"m3u8":"video/MP2T"===e?"ts":"video/3gpp"===e?"3gp":"video/3gpp2"===e?"3g2":"application/x-sqlite3"===e?"db":"",databaseList:g,configList:["themeColors","readingTime","appVersion","cloudSyncTime","lastSyncTime","recentBooks","koreaderBooks","recentAdd","deletedBooks","favoriteBooks","shelfList","txtParsers","aiModelConfig","readingStats","noteTags","recordLocation","thirdpartyToken","sortedShelfList","kindleDeviceList","thirdpartyToken","opdsCatalogs","opdsCatalogList"],copyArrayBuffer:e=>{var a=new ArrayBuffer(e.byteLength);return new Uint8Array(a).set(new Uint8Array(e)),a},base64ToArrayBuffer:f,arrayBufferToBase64:y,generateSHA256Hash:function(e){return p(this,void 0,void 0,(function*(){const a=(new TextEncoder).encode(e),t="undefined"!=typeof crypto&&crypto.subtle?yield crypto.subtle.digest("SHA-256",a):N(a);return Array.from(new Uint8Array(t)).map((e=>e.toString(16).padStart(2,"0"))).join("")}))},getDisableThinkingParams:e=>{const a=new Set(["anthropic","zhipu","doubao","moonshot","deepseek"]),t=new Set(["qwen","hunyuan","siliconflow","infini"]);return e&&"custom"!==e?a.has(e)?{thinking:{type:"disabled"}}:t.has(e)?{enable_thinking:!1}:{}:{}},EmailProviders:["gmail.com","qq.com","163.com","yahoo.com","sina.com","sina.cn","126.com","outlook.com","yeah.net","foxmail.com","hotmail.com","protonmail.com","proton.me","icloud.com","mail.com","live.com","aliyun.com","sohu.com","yandex.com","naver.com","mail.ru","yahoo.co.jp","139.com","189.com","yandex.ru","189.cn"],Base64:v};const E={cloudUrl:"https://cloud.koodoreader.com",cloudCNUrl:"https://cloud.koodoreader.cn",testUrl:"https://cloudtest.960960.xyz",devUrl:"http://192.168.28.159:8000"},C={callbackUrl:"https://web.koodoreader.com/",cnCallbackUrl:"https://web.koodoreader.cn/",dropboxClientId:"vnc67byrssocvy1",yandexClientId:"e5305b62f53844b1994f77a840fd0a37",pcloudClientId:"pg8ten0B3vH",boxClientId:"ltimecqanmpxoaicn9qw3es6l3sdl1ya",duboxClientId:"kc0Ls6xLZugGgLLVhZ8yhUU1cRkRoKNU",yiyiwuClientId:"100197197",microsoftClientId:"506df58a-29ab-4020-afc5-6f423dc80f35",googleClientId:"1051055003225-ph1f5fvh328dhv7bco5jitlnfhg6ks2t.apps.googleusercontent.com",appleClientId:"com.koodoreader.auth",facebookClientId:"2845583825559500",githubClientId:"Ov23liJVzfvJMMEEZ8v2",adriveClientId:"a128ae7b9c094545af623de61dc0a1ef"},T={google:{clientId:C.googleClientId,scopes:["openid email profile"],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{prompt:"consent",scope:"openid email profile"}},microsoft:{clientId:C.microsoftClientId,scopes:["openid","profile","User.Read","offline_access"],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"openid profile User.Read offline_access"}},facebook:{clientId:C.facebookClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:""}},github:{clientId:C.githubClientId,scopes:["user:email"],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"user:email"}},apple:{clientId:C.appleClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{}},email:{clientId:"",scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:""}}},w=["backgroundColor","textColor","fontSize","margin","letterSpacing","paraSpacing","scale","brightness","fontFamily","subFontFamily","lineHeight","textAlign","textOrientation","convertChinese","selectAction","fullTranslationMode","readerMode","pdfReaderMode","isBold","isIndent","isSliding","isUnderline","isShadow","isItalic","isInvert","isBionic","isHyphenation","isOrphanWidow","isKeepPDFBackground","isAllowScript","isStartFromEven"];var A={CloudMode:"test",CloudConfig:E,ConvertLangMap:{en:"English",zhCN:"Chinese",zhTW:"Chinese",zhMO:"Chinese",tr:"Turkish",ar:"Arabic",ro:"Romanian",pl:"Polish",cs:"Czech",ja:"Japanese",ta:"Tamil",uk:"Ukrainian",sl:"Slovenian",bo:"Tibetan",id:"Indonesian",hy:"Armenian",el:"Greek",hu:"Hungarian",hi:"Hindi",bg:"Bulgarian",nl:"Dutch",it:"Italian",bn:"Bengali",tl:"Tagalog",sv:"Swedish",ga:"Irish",ko:"Korean",de:"German",ru:"Russian",es:"Spanish",fr:"French",fa:"Persian",ptBR:"Portuguese",th:"Thai",sr:"Serbian",am:"Amharic",da:"Danish",fi:"Finnish",ie:"Interlingue",pt:"Portuguese",vi:"Vietnamese"},ContentRegxConfig:[{label:"Default parser",value:"Default parser",subtitle:"Suitable for most txt files",regex:""},{label:"Chinese novel parser",value:"Chinese novel parser",subtitle:"Suitable for most Chinese novels, eg. 第一章,第2回",regex:"^\\s*(第[0-9一二三四五六七八九十百千万零壹贰叁肆伍陆柒捌玖拾佰仟]+[章回])\\s*"},{label:"English novel parser",value:"English novel parser",subtitle:"Suitable for most English novels, eg. Chapter 1, Part II",regex:"^\\s*(Chapter|Part|Book|CHAPTER|PART|BOOK)\\s*"},{label:"Number parser",value:"Number parser",subtitle:"Suitable for novels with number chapter titles, eg. 1, 2, 3",regex:"^\\s*([0-9]+[\\s.、::·\\-—]+|[一二三四五六七八九十百千万零]+[\\s.、::·\\-—]+).+"}],StyleKeys:w,ThirdpartyConfig:C,LoginAuthRequest:T,LoginDiscovery:{microsoft:{authorizationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token"},google:{authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",tokenEndpoint:"https://oauth2.googleapis.com/token"},facebook:{authorizationEndpoint:"https://www.facebook.com/v12.0/dialog/oauth",tokenEndpoint:"https://graph.facebook.com/v12.0/oauth/access_token"},github:{authorizationEndpoint:"https://github.com/login/oauth/authorize",tokenEndpoint:"https://github.com/login/oauth/access_token"},apple:{authorizationEndpoint:"https://appleid.apple.com/auth/authorize",tokenEndpoint:"https://appleid.apple.com/auth/token"},email:{authorizationEndpoint:"",tokenEndpoint:""}},DriveAuthRequest:{dropbox:{clientId:C.dropboxClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{token_access_type:"offline"}},yandex:{clientId:C.yandexClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{response_type:"code",force_confirm:"true"}},boxnet:{clientId:C.boxClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{grant_type:"authorization_code",box_subject_type:"enterprise",scope:"root_readwrite"}},pcloud:{clientId:C.pcloudClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{grant_type:"authorization_code"}},dubox:{clientId:C.duboxClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{response_type:"code",scope:"basic,netdisk",device_id:"119827642",qrcode:"1"}},yiyiwu:{clientId:C.yiyiwuClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{response_type:"code"}},adrive:{clientId:C.adriveClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{grant_type:"authorization_code",scope:"user:base,file:all:write,file:all:read"}},microsoft:{clientId:C.microsoftClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"files.readwrite.appfolder offline_access"}},google:{clientId:C.googleClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{prompt:"consent",scope:"https://www.googleapis.com/auth/drive.file",access_type:"offline"}},microsoft_exp:{clientId:C.microsoftClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{scope:"files.readwrite.all offline_access"}},google_exp:{clientId:C.googleClientId,scopes:[],usePKCE:!1,responseType:"code",redirectUri:C.callbackUrl,extraParams:{prompt:"consent",scope:"https://www.googleapis.com/auth/drive",access_type:"offline"}}},DriveDiscovery:{dropbox:{authorizationEndpoint:"https://www.dropbox.com/oauth2/authorize",tokenEndpoint:"https://www.dropbox.com/oauth2/token"},yandex:{authorizationEndpoint:"https://oauth.yandex.com/authorize",tokenEndpoint:"https://oauth.yandex.com/token"},boxnet:{authorizationEndpoint:"https://account.box.com/api/oauth2/authorize",tokenEndpoint:"https://api.box.com/oauth2/token"},pcloud:{authorizationEndpoint:"https://my.pcloud.com/oauth2/authorize",tokenEndpoint:"https://api.pcloud.com/oauth2_token"},dubox:{authorizationEndpoint:"https://openapi.baidu.com/oauth/2.0/authorize",tokenEndpoint:"https://openapi.baidu.com/oauth/2.0/token"},yiyiwu:{authorizationEndpoint:"https://passportapi.115.com/open/authorize",tokenEndpoint:"https://passportapi.115.com/open/authorize"},adrive:{authorizationEndpoint:"https://openapi.alipan.com/oauth/authorize",tokenEndpoint:"https://openapi.alipan.com/oauth/token"},microsoft:{authorizationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token"},google:{authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",tokenEndpoint:"https://oauth2.googleapis.com/token"},microsoft_exp:{authorizationEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",tokenEndpoint:"https://login.microsoftonline.com/common/oauth2/v2.0/token"},google_exp:{authorizationEndpoint:"https://accounts.google.com/o/oauth2/v2/auth",tokenEndpoint:"https://oauth2.googleapis.com/token"}},AiProviderList:[{id:"custom",name:"Custom model",defaultEndpoint:"",modelsEndpoint:""},{id:"openai",name:"OpenAI",defaultEndpoint:"https://api.openai.com/v1",modelsEndpoint:"https://api.openai.com/v1/models"},{id:"anthropic",name:"Anthropic",defaultEndpoint:"https://api.anthropic.com/v1",modelsEndpoint:"https://api.anthropic.com/v1/models"},{id:"google",name:"Google Gemini",defaultEndpoint:"https://generativelanguage.googleapis.com/v1beta/openai",modelsEndpoint:"https://generativelanguage.googleapis.com/v1beta/openai/models"},{id:"deepseek",name:"DeepSeek",defaultEndpoint:"https://api.deepseek.com/v1",modelsEndpoint:"https://api.deepseek.com/v1/models"},{id:"mistral",name:"Mistral AI",defaultEndpoint:"https://api.mistral.ai/v1",modelsEndpoint:"https://api.mistral.ai/v1/models"},{id:"cohere",name:"Cohere",defaultEndpoint:"https://api.cohere.ai/compatibility/v1",modelsEndpoint:"https://api.cohere.ai/compatibility/v1/models"},{id:"groq",name:"Groq",defaultEndpoint:"https://api.groq.com/openai/v1",modelsEndpoint:"https://api.groq.com/openai/v1/models"},{id:"together",name:"Together AI",defaultEndpoint:"https://api.together.xyz/v1",modelsEndpoint:"https://api.together.xyz/v1/models"},{id:"fireworks",name:"Fireworks AI",defaultEndpoint:"https://api.fireworks.ai/inference/v1",modelsEndpoint:"https://api.fireworks.ai/inference/v1/models"},{id:"perplexity",name:"Perplexity",defaultEndpoint:"https://api.perplexity.ai",modelsEndpoint:"https://api.perplexity.ai/v1/models"},{id:"openrouter",name:"OpenRouter",defaultEndpoint:"https://openrouter.ai/api/v1",modelsEndpoint:"https://openrouter.ai/api/v1/models"},{id:"ai21",name:"AI21 Labs",defaultEndpoint:"https://api.ai21.com/studio/v1",modelsEndpoint:"https://api.ai21.com/studio/v1/models"},{id:"xai",name:"xAI (Grok)",defaultEndpoint:"https://api.x.ai/v1",modelsEndpoint:"https://api.x.ai/v1/models"},{id:"sambanova",name:"SambaNova",defaultEndpoint:"https://api.sambanova.ai/v1",modelsEndpoint:"https://api.sambanova.ai/v1/models"},{id:"cerebras",name:"Cerebras",defaultEndpoint:"https://api.cerebras.ai/v1",modelsEndpoint:"https://api.cerebras.ai/v1/models"},{id:"hyperbolic",name:"Hyperbolic",defaultEndpoint:"https://api.hyperbolic.xyz/v1",modelsEndpoint:"https://api.hyperbolic.xyz/v1/models"},{id:"novita",name:"Novita AI",defaultEndpoint:"https://api.novita.ai/openai",modelsEndpoint:"https://api.novita.ai/openai/models"},{id:"lepton",name:"Lepton AI",defaultEndpoint:"https://llm.lepton.run/api/v1",modelsEndpoint:"https://llm.lepton.run/api/v1/models"},{id:"deepinfra",name:"DeepInfra",defaultEndpoint:"https://api.deepinfra.com/v1/openai",modelsEndpoint:"https://api.deepinfra.com/v1/openai/models"},{id:"replicate",name:"Replicate",defaultEndpoint:"https://api.replicate.com/v1",modelsEndpoint:"https://api.replicate.com/v1/models"},{id:"zhipu",name:"Zhipu AI (智谱)",defaultEndpoint:"https://open.bigmodel.cn/api/paas/v4",modelsEndpoint:"https://open.bigmodel.cn/api/paas/v4/models"},{id:"qwen",name:"Alibaba Qwen (通义千问)",defaultEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1",modelsEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/models"},{id:"moonshot",name:"Moonshot (月之暗面)",defaultEndpoint:"https://api.moonshot.cn/v1",modelsEndpoint:"https://api.moonshot.cn/v1/models"},{id:"baidu",name:"Baidu ERNIE (文心一言)",defaultEndpoint:"https://qianfan.baidubce.com/v2",modelsEndpoint:"https://qianfan.baidubce.com/v2/models"},{id:"doubao",name:"Volcengine Doubao (豆包)",defaultEndpoint:"https://ark.cn-beijing.volces.com/api/v3",modelsEndpoint:"https://ark.cn-beijing.volces.com/api/v3/models"},{id:"spark",name:"iFlytek Spark (讯飞星火)",defaultEndpoint:"https://spark-api-open.xf-yun.com/v1",modelsEndpoint:"https://spark-api-open.xf-yun.com/v1/models"},{id:"hunyuan",name:"Tencent Hunyuan (腾讯混元)",defaultEndpoint:"https://api.hunyuan.cloud.tencent.com/v1",modelsEndpoint:"https://api.hunyuan.cloud.tencent.com/v1/models"},{id:"minimax",name:"MiniMax",defaultEndpoint:"https://api.minimax.chat/v1",modelsEndpoint:"https://api.minimax.chat/v1/models"},{id:"baichuan",name:"Baichuan (百川)",defaultEndpoint:"https://api.baichuan-ai.com/v1",modelsEndpoint:"https://api.baichuan-ai.com/v1/models"},{id:"stepfun",name:"StepFun (阶跃星辰)",defaultEndpoint:"https://api.stepfun.com/v1",modelsEndpoint:"https://api.stepfun.com/v1/models"},{id:"lingyi",name:"Lingyiwanwu (零一万物)",defaultEndpoint:"https://api.lingyiwanwu.com/v1",modelsEndpoint:"https://api.lingyiwanwu.com/v1/models"},{id:"siliconflow",name:"SiliconFlow (硅基流动)",defaultEndpoint:"https://api.siliconflow.cn/v1",modelsEndpoint:"https://api.siliconflow.cn/v1/models"},{id:"infini",name:"Infini AI (无问芯穹)",defaultEndpoint:"https://cloud.infini-ai.com/maas/v1",modelsEndpoint:"https://cloud.infini-ai.com/maas/v1/models"},{id:"ollama",name:"Ollama (Local)",defaultEndpoint:"http://localhost:11434/v1",modelsEndpoint:"http://localhost:11434/v1/models"},{id:"lmstudio",name:"LM Studio (Local)",defaultEndpoint:"http://localhost:1234/v1",modelsEndpoint:"http://localhost:1234/v1/models"},{id:"vllm",name:"vLLM (Local)",defaultEndpoint:"http://localhost:8000/v1",modelsEndpoint:"http://localhost:8000/v1/models"},{id:"azure",name:"Azure OpenAI",defaultEndpoint:"",modelsEndpoint:""},{id:"aws_bedrock",name:"AWS Bedrock",defaultEndpoint:"",modelsEndpoint:""}],DefaultPrompts:{aiTranslate:"You are a professional translator. Translate the following text from {from} to {to}. Only return the translated text, no explanations.\n\nText: {text}",aiDict:"You are a professional dictionary assistant. Analyze the word or phrase: {word}\nProvide a comprehensive explanation including pronunciation, definitions, example sentences, and usage notes using {to} as the target language. ",aiAssistance:"You are a helpful reading assistant. The user is reading a book. Here is the context:\n{text}\n\nAnswer the user's question concisely and helpfully, and reply with the same language."},SpeechList:[{label:"English",code:"en",example:"To be, or not to be, that is the question."},{label:"Simplified Chinese",code:"zh",example:"千里之行,始于足下。"},{label:"Japanese",code:"ja",example:"猿も木から落ちる。"},{label:"Korean",code:"ko",example:"가는 날이 장날이다."},{label:"French",code:"fr",example:"Liberté, égalité, fraternité."},{label:"German",code:"de",example:"Der Weg ist das Ziel."},{label:"Spanish",code:"es",example:"La vida es un sueño."},{label:"Italian",code:"it",example:"Dolce far niente."},{label:"Russian",code:"ru",example:"Век живи, век учись."},{label:"Portuguese",code:"pt",example:"Saudade é um sentimento profundo."},{label:"Hindi",code:"hi",example:"सपने वो नहीं जो हम सोते वक्त देखते हैं।"},{label:"Afrikaans",code:"af",example:"Die lewe is 'n geskenk."},{label:"Amharic",code:"am",example:"ዕውቀት ብርሃን ነው።"},{label:"Arabic",code:"ar",example:"العلم نور والجهل ظلام."},{label:"Azerbaijani",code:"az",example:"Elm işıqdır, cəhalət zülmət."},{label:"Bulgarian",code:"bg",example:"Знанието е сила."},{label:"Bengali",code:"bn",example:"জ্ঞানই শক্তি।"},{label:"Bosnian",code:"bs",example:"Znanje je moć."},{label:"Catalan",code:"ca",example:"El saber no ocupa lloc."},{label:"Czech",code:"cs",example:"Bez práce nejsou koláče."},{label:"Welsh",code:"cy",example:"Nid aur popeth melyn."},{label:"Danish",code:"da",example:"Lykken er ikke et sted, men en retning."},{label:"Greek",code:"el",example:"Η γνώση είναι δύναμη."},{label:"Estonian",code:"et",example:"Teadmine on jõud."},{label:"Basque",code:"eu",example:"Jakitea boterea da."},{label:"Persian",code:"fa",example:"دانش قدرت است."},{label:"Finnish",code:"fi",example:"Tieto on valtaa."},{label:"Filipino",code:"fil",example:"Ang kaalaman ay kapangyarihan."},{label:"Irish",code:"ga",example:"Is fearr Gaeilge briste ná Béarla cliste."},{label:"Galician",code:"gl",example:"O saber non ocupa lugar."},{label:"Gujarati",code:"gu",example:"જ્ઞાન શક્તિ છે."},{label:"Hebrew",code:"he",example:"ידע הוא כוח."},{label:"Croatian",code:"hr",example:"Znanje je moć."},{label:"Hungarian",code:"hu",example:"A tudás hatalom."},{label:"Armenian",code:"hy",example:"Գիտելիքը ուժ է."},{label:"Indonesian",code:"id",example:"Pengetahuan adalah kekuatan."},{label:"Icelandic",code:"is",example:"Þekking er máttur."},{label:"Inuktitut",code:"iu",example:"ᐃᓕᓐᓂᐊᕐᓂᖅ ᐱᒻᒪᕆᐅᕗᖅ."},{label:"Javanese",code:"jv",example:"Ilmu iku kelakone kanthi laku."},{label:"Georgian",code:"ka",example:"ცოდნა ძალაა."},{label:"Kazakh",code:"kk",example:"Білім — күш."},{label:"Khmer",code:"km",example:"ចំណេះដឹងគឺជាអំណាច។"},{label:"Kannada",code:"kn",example:"ಜ್ಞಾನವೇ ಶಕ್ತಿ."},{label:"Lao",code:"lo",example:"ຄວາມຮູ້ຄືພະລັງ."},{label:"Lithuanian",code:"lt",example:"Žinios yra jėga."},{label:"Latvian",code:"lv",example:"Zināšanas ir spēks."},{label:"Macedonian",code:"mk",example:"Знаењето е моќ."},{label:"Malayalam",code:"ml",example:"അറിവ് ശക്തിയാണ്."},{label:"Mongolian",code:"mn",example:"Мэдлэг бол хүч."},{label:"Marathi",code:"mr",example:"ज्ञान हीच शक्ती आहे."},{label:"Malay",code:"ms",example:"Ilmu itu cahaya."},{label:"Maltese",code:"mt",example:"L-għarfien huwa l-poter."},{label:"Burmese",code:"my",example:"ဗဟုသုတသည် အားဖြစ်သည်။"},{label:"Norwegian",code:"nb",example:"Kunnskap er makt."},{label:"Nepali",code:"ne",example:"ज्ञान नै शक्ति हो।"},{label:"Dutch",code:"nl",example:"Kennis is macht."},{label:"Odia",code:"or",example:"ଜ୍ଞାନ ହିଁ ଶକ୍ତି।"},{label:"Punjabi",code:"pa",example:"ਗਿਆਨ ਹੀ ਸ਼ਕਤੀ ਹੈ।"},{label:"Polish",code:"pl",example:"Wiedza to potęga."},{label:"Pashto",code:"ps",example:"د پوهې ډیوه روښانه ده."},{label:"Romanian",code:"ro",example:"Cartea este o comoară."},{label:"Sinhala",code:"si",example:"දැනුම බලයකි."},{label:"Slovak",code:"sk",example:"Vedomosti sú sila."},{label:"Slovenian",code:"sl",example:"Znanje je moč."},{label:"Somali",code:"so",example:"Aqoontu waa iftiin."},{label:"Albanian",code:"sq",example:"Dija është fuqi."},{label:"Serbian",code:"sr",example:"Знање је моћ."},{label:"Sundanese",code:"su",example:"Élmu éta cahaya."},{label:"Swedish",code:"sv",example:"Kunskap är makt."},{label:"Swahili",code:"sw",example:"Maarifa ni nguvu."},{label:"Tamil",code:"ta",example:"அறிவே ஆற்றல்."},{label:"Telugu",code:"te",example:"జ్ఞానమే శక్తి."},{label:"Thai",code:"th",example:"ความรู้คือพลัง."},{label:"Turkish",code:"tr",example:"Bilgi güçtür."},{label:"Ukrainian",code:"uk",example:"Знання — сила."},{label:"Urdu",code:"ur",example:"علم ہی طاقت ہے۔"},{label:"Uzbek",code:"uz",example:"Bilim – kuch."},{label:"Vietnamese",code:"vi",example:"Học vấn là sức mạnh."},{label:"Wu Chinese",code:"wuu",example:"学问是力量。"},{label:"Cantonese",code:"yue",example:"知識就係力量。"},{label:"Zulu",code:"zu",example:"Ulwazi lungamandla."}],HighlightStyleTypes:[{value:"background",label:"Highlight background"},{value:"underline",label:"Underline"},{value:"strikethrough",label:"Strikethrough"},{value:"wavy",label:"Wavy underline"}],HighlightPresetColors:{background:["#F3C9C9","#FEF3CD","#CEFACD","#CDE9FA"],underline:["#FF0000","#60A5FA","#FF9900","#2EFF2E"],strikethrough:["#FF0000","#60A5FA","#FF9900","#2EFF2E"],wavy:["#FF0000","#60A5FA","#FF9900","#2EFF2E"]},PresetThemeList:[{key:"yellow",textColor:"rgba(89, 68, 41,1)",backgroundColor:"rgba(233, 216, 188,1)",title:"羊皮"},{key:"green",textColor:"rgba(54, 80, 62,1)",backgroundColor:"rgba(197, 231, 207,1)",title:"护眼"},{key:"light",textColor:"rgba(0,0,0,1)",backgroundColor:"rgba(255,255,255,1)",title:"白天"},{key:"night",textColor:"rgba(255,255,255,1)",backgroundColor:"rgba(44,47,49,1)",title:"黑夜"},{key:"sepia",textColor:"rgba(93, 64, 55,1)",backgroundColor:"rgba(245, 235, 220,1)",title:"古卷"},{key:"blue",textColor:"rgba(28, 52, 84,1)",backgroundColor:"rgba(230, 240, 250,1)",title:"晨雾"},{key:"purple",textColor:"rgba(68, 42, 84,1)",backgroundColor:"rgba(240, 230, 250,1)",title:"紫萝"},{key:"pink",textColor:"rgba(84, 42, 68,1)",backgroundColor:"rgba(250, 235, 245,1)",title:"樱花"},{key:"brown",textColor:"rgba(74, 54, 42,1)",backgroundColor:"rgba(240, 230, 215,1)",title:"木纹"},{key:"gray",textColor:"rgba(64, 64, 64,1)",backgroundColor:"rgba(240, 240, 240,1)",title:"素雅"},{key:"darkgreen",textColor:"rgba(200, 220, 200,1)",backgroundColor:"rgba(25, 35, 30,1)",title:"深林"},{key:"darkblue",textColor:"rgba(200, 210, 230,1)",backgroundColor:"rgba(20, 30, 45,1)",title:"深海"},{key:"coral",textColor:"rgba(84, 50, 42,1)",backgroundColor:"rgba(255, 235, 230,1)",title:"珊瑚"},{key:"mint",textColor:"rgba(42, 74, 64,1)",backgroundColor:"rgba(230, 250, 245,1)",title:"薄荷"},{key:"lavender",textColor:"rgba(54, 42, 74,1)",backgroundColor:"rgba(245, 240, 255,1)",title:"薰衣"},{key:"cream",textColor:"rgba(74, 64, 42,1)",backgroundColor:"rgba(255, 250, 240,1)",title:"奶油"},{key:"darkbrown",textColor:"rgba(230, 215, 200,1)",backgroundColor:"rgba(35, 25, 20,1)",title:"深棕"},{key:"olive",textColor:"rgba(64, 74, 42,1)",backgroundColor:"rgba(240, 245, 230,1)",title:"橄榄"},{key:"rose",textColor:"rgba(84, 42, 54,1)",backgroundColor:"rgba(255, 240, 245,1)",title:"玫瑰"},{key:"slate",textColor:"rgba(54, 64, 74,1)",backgroundColor:"rgba(235, 240, 245,1)",title:"石板"}],OfficialVoiceList:[{name:"af_alloy",gender:"female",displayName:"Alloy",locale:"en-US",language:"English (US)"},{name:"af_aoede",gender:"female",displayName:"Aoede",locale:"en-US",language:"English (US)"},{name:"af_bella",gender:"female",displayName:"Bella",locale:"en-US",language:"English (US)"},{name:"af_heart",gender:"female",displayName:"Heart",locale:"en-US",language:"English (US)"},{name:"af_jessica",gender:"female",displayName:"Jessica",locale:"en-US",language:"English (US)"},{name:"af_kore",gender:"female",displayName:"Kore",locale:"en-US",language:"English (US)"},{name:"af_nicole",gender:"female",displayName:"Nicole",locale:"en-US",language:"English (US)"},{name:"af_nova",gender:"female",displayName:"Nova",locale:"en-US",language:"English (US)"},{name:"af_river",gender:"female",displayName:"River",locale:"en-US",language:"English (US)"},{name:"af_sarah",gender:"female",displayName:"Sarah",locale:"en-US",language:"English (US)"},{name:"af_sky",gender:"female",displayName:"Sky",locale:"en-US",language:"English (US)"},{name:"am_adam",gender:"male",displayName:"Adam",locale:"en-US",language:"English (US)"},{name:"am_echo",gender:"male",displayName:"Echo",locale:"en-US",language:"English (US)"},{name:"am_eric",gender:"male",displayName:"Eric",locale:"en-US",language:"English (US)"},{name:"am_fenrir",gender:"male",displayName:"Fenrir",locale:"en-US",language:"English (US)"},{name:"am_liam",gender:"male",displayName:"Liam",locale:"en-US",language:"English (US)"},{name:"am_michael",gender:"male",displayName:"Michael",locale:"en-US",language:"English (US)"},{name:"am_onyx",gender:"male",displayName:"Onyx",locale:"en-US",language:"English (US)"},{name:"am_puck",gender:"male",displayName:"Puck",locale:"en-US",language:"English (US)"},{name:"am_santa",gender:"male",displayName:"Santa",locale:"en-US",language:"English (US)"},{name:"bf_alice",gender:"female",displayName:"Alice",locale:"en-GB",language:"English (UK)"},{name:"bf_emma",gender:"female",displayName:"Emma",locale:"en-GB",language:"English (UK)"},{name:"bf_isabella",gender:"female",displayName:"Isabella",locale:"en-GB",language:"English (UK)"},{name:"bf_lily",gender:"female",displayName:"Lily",locale:"en-GB",language:"English (UK)"},{name:"bm_daniel",gender:"male",displayName:"Daniel",locale:"en-GB",language:"English (UK)"},{name:"bm_fable",gender:"male",displayName:"Fable",locale:"en-GB",language:"English (UK)"},{name:"bm_george",gender:"male",displayName:"George",locale:"en-GB",language:"English (UK)"},{name:"bm_lewis",gender:"male",displayName:"Lewis",locale:"en-GB",language:"English (UK)"},{name:"ef_dora",gender:"female",displayName:"Dora",locale:"es-ES",language:"Español"},{name:"em_alex",gender:"male",displayName:"Alex",locale:"es-ES",language:"Español"},{name:"em_santa",gender:"male",displayName:"Santa",locale:"es-ES",language:"Español"},{name:"ff_siwis",gender:"female",displayName:"Siwis",locale:"fr-FR",language:"Français"},{name:"hf_alpha",gender:"female",displayName:"Alpha",locale:"hi-IN",language:"हिन्दी"},{name:"hf_beta",gender:"female",displayName:"Beta",locale:"hi-IN",language:"हिन्दी"},{name:"hm_omega",gender:"male",displayName:"Omega",locale:"hi-IN",language:"हिन्दी"},{name:"hm_psi",gender:"male",displayName:"Psi",locale:"hi-IN",language:"हिन्दी"},{name:"if_sara",gender:"female",displayName:"Sara",locale:"it-IT",language:"Italiano"},{name:"im_nicola",gender:"male",displayName:"Nicola",locale:"it-IT",language:"Italiano"},{name:"jf_alpha",gender:"female",displayName:"Alpha",locale:"ja-JP",language:"日本語"},{name:"jf_gongitsune",gender:"female",displayName:"Gongitsune",locale:"ja-JP",language:"日本語"},{name:"jf_nezumi",gender:"female",displayName:"Nezumi",locale:"ja-JP",language:"日本語"},{name:"jf_tebukuro",gender:"female",displayName:"Tebukuro",locale:"ja-JP",language:"日本語"},{name:"jm_kumo",gender:"male",displayName:"Kumo",locale:"ja-JP",language:"日本語"},{name:"pf_dora",gender:"female",displayName:"Dora",locale:"pt-BR",language:"Português (Brasil)"},{name:"pm_alex",gender:"male",displayName:"Alex",locale:"pt-BR",language:"Português (Brasil)"},{name:"pm_santa",gender:"male",displayName:"Santa",locale:"pt-BR",language:"Português (Brasil)"},{name:"zf_xiaoxiao",gender:"female",displayName:"Xiaoxiao",locale:"zh-CN",language:"中文"},{name:"zf_xiaoyi",gender:"female",displayName:"Xiaoyi",locale:"zh-CN",language:"中文"},{name:"zm_yunyang",gender:"male",displayName:"Yunyang",locale:"zh-CN",language:"中文"},{name:"zm_yunxia",gender:"male",displayName:"Yunxia",locale:"zh-CN",language:"中文"},{name:"zm_yunxi",gender:"male",displayName:"Yunxi",locale:"zh-CN",language:"中文"},{name:"zm_yunjian",gender:"male",displayName:"Yunjian",locale:"zh-CN",language:"中文"},{name:"zf_xiaoni",gender:"female",displayName:"Xiaoni",locale:"zh-CN",language:"中文"},{name:"zf_xiaobei",gender:"female",displayName:"Xiaobei",locale:"zh-CN",language:"中文"}],AzureTTSVoiceList:[{name:"af-ZA-AdriNeural",gender:"female",displayName:"Adri",locale:"af-ZA"},{name:"af-ZA-WillemNeural",gender:"male",displayName:"Willem",locale:"af-ZA"},{name:"am-ET-MekdesNeural",gender:"female",displayName:"መቅደስ",locale:"am-ET"},{name:"am-ET-AmehaNeural",gender:"male",displayName:"አምሀ",locale:"am-ET"},{name:"ar-AE-FatimaNeural",gender:"female",displayName:"فاطمة",locale:"ar-AE"},{name:"ar-AE-HamdanNeural",gender:"male",displayName:"حمدان",locale:"ar-AE"},{name:"ar-BH-LailaNeural",gender:"female",displayName:"ليلى",locale:"ar-BH"},{name:"ar-BH-AliNeural",gender:"male",displayName:"علي",locale:"ar-BH"},{name:"ar-DZ-AminaNeural",gender:"female",displayName:"أمينة",locale:"ar-DZ"},{name:"ar-DZ-IsmaelNeural",gender:"male",displayName:"إسماعيل",locale:"ar-DZ"},{name:"ar-EG-SalmaNeural",gender:"female",displayName:"سلمى",locale:"ar-EG"},{name:"ar-EG-ShakirNeural",gender:"male",displayName:"شاكر",locale:"ar-EG"},{name:"ar-IQ-RanaNeural",gender:"female",displayName:"رنا",locale:"ar-IQ"},{name:"ar-IQ-BasselNeural",gender:"male",displayName:"باسل",locale:"ar-IQ"},{name:"ar-JO-SanaNeural",gender:"female",displayName:"سناء",locale:"ar-JO"},{name:"ar-JO-TaimNeural",gender:"male",displayName:"تيم",locale:"ar-JO"},{name:"ar-KW-NouraNeural",gender:"female",displayName:"نورا",locale:"ar-KW"},{name:"ar-KW-FahedNeural",gender:"male",displayName:"فهد",locale:"ar-KW"},{name:"ar-LB-LaylaNeural",gender:"female",displayName:"ليلى",locale:"ar-LB"},{name:"ar-LB-RamiNeural",gender:"male",displayName:"رامي",locale:"ar-LB"},{name:"ar-LY-ImanNeural",gender:"female",displayName:"إيمان",locale:"ar-LY"},{name:"ar-LY-OmarNeural",gender:"male",displayName:"أحمد",locale:"ar-LY"},{name:"ar-MA-MounaNeural",gender:"female",displayName:"منى",locale:"ar-MA"},{name:"ar-MA-JamalNeural",gender:"male",displayName:"جمال",locale:"ar-MA"},{name:"ar-OM-AyshaNeural",gender:"female",displayName:"عائشة",locale:"ar-OM"},{name:"ar-OM-AbdullahNeural",gender:"male",displayName:"عبدالله",locale:"ar-OM"},{name:"ar-QA-AmalNeural",gender:"female",displayName:"أمل",locale:"ar-QA"},{name:"ar-QA-MoazNeural",gender:"male",displayName:"معاذ",locale:"ar-QA"},{name:"ar-SA-ZariyahNeural",gender:"female",displayName:"زارية",locale:"ar-SA"},{name:"ar-SA-HamedNeural",gender:"male",displayName:"حامد",locale:"ar-SA"},{name:"ar-SY-AmanyNeural",gender:"female",displayName:"أماني",locale:"ar-SY"},{name:"ar-SY-LaithNeural",gender:"male",displayName:"ليث",locale:"ar-SY"},{name:"ar-TN-ReemNeural",gender:"female",displayName:"ريم",locale:"ar-TN"},{name:"ar-TN-HediNeural",gender:"male",displayName:"هادي",locale:"ar-TN"},{name:"ar-YE-MaryamNeural",gender:"female",displayName:"مريم",locale:"ar-YE"},{name:"ar-YE-SalehNeural",gender:"male",displayName:"صالح",locale:"ar-YE"},{name:"as-IN-YashicaNeural",gender:"female",displayName:"যাশিকা",locale:"as-IN"},{name:"as-IN-PriyomNeural",gender:"male",displayName:"প্ৰিয়ম",locale:"as-IN"},{name:"az-AZ-BanuNeural",gender:"female",displayName:"Banu",locale:"az-AZ"},{name:"az-AZ-BabekNeural",gender:"male",displayName:"Babək",locale:"az-AZ"},{name:"bg-BG-KalinaNeural",gender:"female",displayName:"Калина",locale:"bg-BG"},{name:"bg-BG-BorislavNeural",gender:"male",displayName:"Борислав",locale:"bg-BG"},{name:"bn-BD-NabanitaNeural",gender:"female",displayName:"নবনীতা",locale:"bn-BD"},{name:"bn-BD-PradeepNeural",gender:"male",displayName:"প্রদ্বীপ",locale:"bn-BD"},{name:"bn-IN-TanishaaNeural",gender:"female",displayName:"তানিশা",locale:"bn-IN"},{name:"bn-IN-BashkarNeural",gender:"male",displayName:"ভাস্কর",locale:"bn-IN"},{name:"bs-BA-VesnaNeural",gender:"female",displayName:"Vesna",locale:"bs-BA"},{name:"bs-BA-GoranNeural",gender:"male",displayName:"Goran",locale:"bs-BA"},{name:"ca-ES-JoanaNeural",gender:"female",displayName:"Joana",locale:"ca-ES"},{name:"ca-ES-EnricNeural",gender:"male",displayName:"Enric",locale:"ca-ES"},{name:"ca-ES-AlbaNeural",gender:"female",displayName:"Alba",locale:"ca-ES"},{name:"cs-CZ-VlastaNeural",gender:"female",displayName:"Vlasta",locale:"cs-CZ"},{name:"cs-CZ-AntoninNeural",gender:"male",displayName:"Antonín",locale:"cs-CZ"},{name:"cy-GB-NiaNeural",gender:"female",displayName:"Nia",locale:"cy-GB"},{name:"cy-GB-AledNeural",gender:"male",displayName:"Aled",locale:"cy-GB"},{name:"da-DK-ChristelNeural",gender:"female",displayName:"Christel",locale:"da-DK"},{name:"da-DK-JeppeNeural",gender:"male",displayName:"Jeppe",locale:"da-DK"},{name:"de-AT-IngridNeural",gender:"female",displayName:"Ingrid",locale:"de-AT"},{name:"de-AT-JonasNeural",gender:"male",displayName:"Jonas",locale:"de-AT"},{name:"de-CH-LeniNeural",gender:"female",displayName:"Leni",locale:"de-CH"},{name:"de-CH-JanNeural",gender:"male",displayName:"Jan",locale:"de-CH"},{name:"de-DE-KatjaNeural",gender:"female",displayName:"Katja",locale:"de-DE"},{name:"de-DE-ConradNeural",gender:"male",displayName:"Conrad",locale:"de-DE"},{name:"de-DE-SeraphinaMultilingualNeural",gender:"female",displayName:"Seraphine Mehrsprachig",locale:"de-DE"},{name:"de-DE-FlorianMultilingualNeural",gender:"male",displayName:"Florian Mehrsprachig",locale:"de-DE"},{name:"de-DE-AmalaNeural",gender:"female",displayName:"Amala",locale:"de-DE"},{name:"de-DE-BerndNeural",gender:"male",displayName:"Bernd",locale:"de-DE"},{name:"de-DE-ChristophNeural",gender:"male",displayName:"Christoph",locale:"de-DE"},{name:"de-DE-ElkeNeural",gender:"female",displayName:"Elke",locale:"de-DE"},{name:"de-DE-GiselaNeural",gender:"female",displayName:"Gisela",locale:"de-DE"},{name:"de-DE-KasperNeural",gender:"male",displayName:"Kasper",locale:"de-DE"},{name:"de-DE-KillianNeural",gender:"male",displayName:"Killian",locale:"de-DE"},{name:"de-DE-KlarissaNeural",gender:"female",displayName:"Klarissa",locale:"de-DE"},{name:"de-DE-KlausNeural",gender:"male",displayName:"Klaus",locale:"de-DE"},{name:"de-DE-LouisaNeural",gender:"female",displayName:"Louisa",locale:"de-DE"},{name:"de-DE-MajaNeural",gender:"female",displayName:"Maja",locale:"de-DE"},{name:"de-DE-RalfNeural",gender:"male",displayName:"Ralf",locale:"de-DE"},{name:"de-DE-TanjaNeural",gender:"female",displayName:"Tanja",locale:"de-DE"},{name:"el-GR-AthinaNeural",gender:"female",displayName:"Αθηνά",locale:"el-GR"},{name:"el-GR-NestorasNeural",gender:"male",displayName:"Νέστορας",locale:"el-GR"},{name:"en-AU-NatashaNeural",gender:"female",displayName:"Natasha",locale:"en-AU"},{name:"en-AU-WilliamNeural",gender:"male",displayName:"William",locale:"en-AU"},{name:"en-AU-WilliamMultilingualNeural",gender:"male",displayName:"William Multilingual",locale:"en-AU"},{name:"en-AU-AnnetteNeural",gender:"female",displayName:"Annette",locale:"en-AU"},{name:"en-AU-CarlyNeural",gender:"female",displayName:"Carly",locale:"en-AU"},{name:"en-AU-DarrenNeural",gender:"male",displayName:"Darren",locale:"en-AU"},{name:"en-AU-DuncanNeural",gender:"male",displayName:"Duncan",locale:"en-AU"},{name:"en-AU-ElsieNeural",gender:"female",displayName:"Elsie",locale:"en-AU"},{name:"en-AU-FreyaNeural",gender:"female",displayName:"Freya",locale:"en-AU"},{name:"en-AU-JoanneNeural",gender:"female",displayName:"Joanne",locale:"en-AU"},{name:"en-AU-KenNeural",gender:"male",displayName:"Ken",locale:"en-AU"},{name:"en-AU-KimNeural",gender:"female",displayName:"Kim",locale:"en-AU"},{name:"en-AU-NeilNeural",gender:"male",displayName:"Neil",locale:"en-AU"},{name:"en-AU-TimNeural",gender:"male",displayName:"Tim",locale:"en-AU"},{name:"en-AU-TinaNeural",gender:"female",displayName:"Tina",locale:"en-AU"},{name:"en-CA-ClaraNeural",gender:"female",displayName:"Clara",locale:"en-CA"},{name:"en-CA-LiamNeural",gender:"male",displayName:"Liam",locale:"en-CA"},{name:"en-GB-SoniaNeural",gender:"female",displayName:"Sonia",locale:"en-GB"},{name:"en-GB-RyanNeural",gender:"male",displayName:"Ryan",locale:"en-GB"},{name:"en-GB-LibbyNeural",gender:"female",displayName:"Libby",locale:"en-GB"},{name:"en-GB-AdaMultilingualNeural",gender:"female",displayName:"Ada Multilingual",locale:"en-GB"},{name:"en-GB-OllieMultilingualNeural",gender:"male",displayName:"Ollie Multilingual",locale:"en-GB"},{name:"en-GB-AbbiNeural",gender:"female",displayName:"Abbi",locale:"en-GB"},{name:"en-GB-AlfieNeural",gender:"male",displayName:"Alfie",locale:"en-GB"},{name:"en-GB-BellaNeural",gender:"female",displayName:"Bella",locale:"en-GB"},{name:"en-GB-ElliotNeural",gender:"male",displayName:"Elliot",locale:"en-GB"},{name:"en-GB-EthanNeural",gender:"male",displayName:"Ethan",locale:"en-GB"},{name:"en-GB-HollieNeural",gender:"female",displayName:"Hollie",locale:"en-GB"},{name:"en-GB-MaisieNeural",gender:"female",displayName:"Maisie",locale:"en-GB"},{name:"en-GB-NoahNeural",gender:"male",displayName:"Noah",locale:"en-GB"},{name:"en-GB-OliverNeural",gender:"male",displayName:"Oliver",locale:"en-GB"},{name:"en-GB-OliviaNeural",gender:"female",displayName:"Olivia",locale:"en-GB"},{name:"en-GB-ThomasNeural",gender:"male",displayName:"Thomas",locale:"en-GB"},{name:"en-GB-MiaNeural",gender:"female",displayName:"Mia",locale:"en-GB"},{name:"en-HK-YanNeural",gender:"female",displayName:"Yan",locale:"en-HK"},{name:"en-HK-SamNeural",gender:"male",displayName:"Sam",locale:"en-HK"},{name:"en-IE-EmilyNeural",gender:"female",displayName:"Emily",locale:"en-IE"},{name:"en-IE-ConnorNeural",gender:"male",displayName:"Connor",locale:"en-IE"},{name:"en-IN-AartiIndicNeural",gender:"female",displayName:"Aarti Indic",locale:"en-IN"},{name:"en-IN-ArjunIndicNeural",gender:"male",displayName:"Arjun Indic",locale:"en-IN"},{name:"en-IN-NeerjaIndicNeural",gender:"female",displayName:"Neerja Indic",locale:"en-IN"},{name:"en-IN-PrabhatIndicNeural",gender:"male",displayName:"Prabhat Indic",locale:"en-IN"},{name:"en-IN-AaravNeural",gender:"male",displayName:"Aarav",locale:"en-IN"},{name:"en-IN-AashiNeural",gender:"female",displayName:"Aashi",locale:"en-IN"},{name:"en-IN-AartiNeural",gender:"female",displayName:"Aarti",locale:"en-IN"},{name:"en-IN-ArjunNeural",gender:"male",displayName:"Arjun",locale:"en-IN"},{name:"en-IN-AnanyaNeural",gender:"female",displayName:"Ananya",locale:"en-IN"},{name:"en-IN-KavyaNeural",gender:"female",displayName:"Kavya",locale:"en-IN"},{name:"en-IN-KunalNeural",gender:"male",displayName:"Kunal",locale:"en-IN"},{name:"en-IN-NeerjaNeural",gender:"female",displayName:"Neerja",locale:"en-IN"},{name:"en-IN-PrabhatNeural",gender:"male",displayName:"Prabhat",locale:"en-IN"},{name:"en-IN-RehaanNeural",gender:"male",displayName:"Rehaan",locale:"en-IN"},{name:"en-KE-AsiliaNeural",gender:"female",displayName:"Asilia",locale:"en-KE"},{name:"en-KE-ChilembaNeural",gender:"male",displayName:"Chilemba",locale:"en-KE"},{name:"en-NG-EzinneNeural",gender:"female",displayName:"Ezinne",locale:"en-NG"},{name:"en-NG-AbeoNeural",gender:"male",displayName:"Abeo",locale:"en-NG"},{name:"en-NZ-MollyNeural",gender:"female",displayName:"Molly",locale:"en-NZ"},{name:"en-NZ-MitchellNeural",gender:"male",displayName:"Mitchell",locale:"en-NZ"},{name:"en-PH-RosaNeural",gender:"female",displayName:"Rosa",locale:"en-PH"},{name:"en-PH-JamesNeural",gender:"male",displayName:"James",locale:"en-PH"},{name:"en-SG-LunaNeural",gender:"female",displayName:"Luna",locale:"en-SG"},{name:"en-SG-WayneNeural",gender:"male",displayName:"Wayne",locale:"en-SG"},{name:"en-TZ-ImaniNeural",gender:"female",displayName:"Imani",locale:"en-TZ"},{name:"en-TZ-ElimuNeural",gender:"male",displayName:"Elimu",locale:"en-TZ"},{name:"en-US-AvaMultilingualNeural",gender:"female",displayName:"Ava Multilingual",locale:"en-US"},{name:"en-US-AndrewMultilingualNeural",gender:"male",displayName:"Andrew Multilingual",locale:"en-US"},{name:"en-US-AmandaMultilingualNeural",gender:"female",displayName:"Amanda Multilingual",locale:"en-US"},{name:"en-US-AdamMultilingualNeural",gender:"male",displayName:"Adam Multilingual",locale:"en-US"},{name:"en-US-EmmaMultilingualNeural",gender:"female",displayName:"Emma Multilingual",locale:"en-US"},{name:"en-US-PhoebeMultilingualNeural",gender:"female",displayName:"Phoebe Multilingual",locale:"en-US"},{name:"en-US-AlloyTurboMultilingualNeural",gender:"male",displayName:"Alloy Turbo Multilingual",locale:"en-US"},{name:"en-US-EchoTurboMultilingualNeural",gender:"male",displayName:"Echo Turbo Multilingual",locale:"en-US"},{name:"en-US-FableTurboMultilingualNeural",gender:"female",displayName:"Fable Turbo Multilingual",locale:"en-US"},{name:"en-US-OnyxTurboMultilingualNeural",gender:"male",displayName:"Onyx Turbo Multilingual",locale:"en-US"},{name:"en-US-NovaTurboMultilingualNeural",gender:"female",displayName:"Nova Turbo Multilingual",locale:"en-US"},{name:"en-US-ShimmerTurboMultilingualNeural",gender:"female",displayName:"Shimmer Turbo Multilingual",locale:"en-US"},{name:"en-US-BrianMultilingualNeural",gender:"male",displayName:"Brian Multilingual",locale:"en-US"},{name:"en-US-AvaNeural",gender:"female",displayName:"Ava",locale:"en-US"},{name:"en-US-AndrewNeural",gender:"male",displayName:"Andrew",locale:"en-US"},{name:"en-US-EmmaNeural",gender:"female",displayName:"Emma",locale:"en-US"},{name:"en-US-BrianNeural",gender:"male",displayName:"Brian",locale:"en-US"},{name:"en-US-JennyNeural",gender:"female",displayName:"Jenny",locale:"en-US"},{name:"en-US-GuyNeural",gender:"male",displayName:"Guy",locale:"en-US"},{name:"en-US-AriaNeural",gender:"female",displayName:"Aria",locale:"en-US"},{name:"en-US-DavisNeural",gender:"male",displayName:"Davis",locale:"en-US"},{name:"en-US-JaneNeural",gender:"female",displayName:"Jane",locale:"en-US"},{name:"en-US-JasonNeural",gender:"male",displayName:"Jason",locale:"en-US"},{name:"en-US-KaiNeural",gender:"male",displayName:"Kai",locale:"en-US"},{name:"en-US-LunaNeural",gender:"female",displayName:"Luna",locale:"en-US"},{name:"en-US-SaraNeural",gender:"female",displayName:"Sara",locale:"en-US"},{name:"en-US-TonyNeural",gender:"male",displayName:"Tony",locale:"en-US"},{name:"en-US-NancyNeural",gender:"female",displayName:"Nancy",locale:"en-US"},{name:"en-US-CoraMultilingualNeural",gender:"female",displayName:"Cora Multilingual",locale:"en-US"},{name:"en-US-ChristopherMultilingualNeural",gender:"male",displayName:"Christopher Multilingual",locale:"en-US"},{name:"en-US-BrandonMultilingualNeural",gender:"male",displayName:"Brandon Multilingual",locale:"en-US"},{name:"en-US-AmberNeural",gender:"female",displayName:"Amber",locale:"en-US"},{name:"en-US-AnaNeural",gender:"female",displayName:"Ana",locale:"en-US"},{name:"en-US-AshleyNeural",gender:"female",displayName:"Ashley",locale:"en-US"},{name:"en-US-BrandonNeural",gender:"male",displayName:"Brandon",locale:"en-US"},{name:"en-US-ChristopherNeural",gender:"male",displayName:"Christopher",locale:"en-US"},{name:"en-US-CoraNeural",gender:"female",displayName:"Cora",locale:"en-US"},{name:"en-US-DavisMultilingualNeural",gender:"male",displayName:"Davis Multilingual",locale:"en-US"},{name:"en-US-DerekMultilingualNeural",gender:"male",displayName:"Derek Multilingual",locale:"en-US"},{name:"en-US-DustinMultilingualNeural",gender:"male",displayName:"Dustin Multilingual",locale:"en-US"},{name:"en-US-ElizabethNeural",gender:"female",displayName:"Elizabeth",locale:"en-US"},{name:"en-US-EricNeural",gender:"male",displayName:"Eric",locale:"en-US"},{name:"en-US-JacobNeural",gender:"male",displayName:"Jacob",locale:"en-US"},{name:"en-US-JennyMultilingualNeural",gender:"female",displayName:"Jenny Multilingual",locale:"en-US"},{name:"en-US-LewisMultilingualNeural",gender:"male",displayName:"Lewis Multilingual",locale:"en-US"},{name:"en-US-LolaMultilingualNeural",gender:"female",displayName:"Lola Multilingual",locale:"en-US"},{name:"en-US-MichelleNeural",gender:"female",displayName:"Michelle",locale:"en-US"},{name:"en-US-MonicaNeural",gender:"female",displayName:"Monica",locale:"en-US"},{name:"en-US-NancyMultilingualNeural",gender:"female",displayName:"Nancy Multilingual",locale:"en-US"},{name:"en-US-RogerNeural",gender:"male",displayName:"Roger",locale:"en-US"},{name:"en-US-RyanMultilingualNeural",gender:"male",displayName:"Ryan Multilingual",locale:"en-US"},{name:"en-US-SamuelMultilingualNeural",gender:"male",displayName:"Samuel Multilingual",locale:"en-US"},{name:"en-US-SerenaMultilingualNeural",gender:"female",displayName:"Serena Multilingual",locale:"en-US"},{name:"en-US-SteffanMultilingualNeural",gender:"male",displayName:"Steffan Multilingual",locale:"en-US"},{name:"en-US-SteffanNeural",gender:"male",displayName:"Steffan",locale:"en-US"},{name:"en-US-AIGenerate1Neural",gender:"male",displayName:"AIGenerate1",locale:"en-US"},{name:"en-US-AIGenerate2Neural",gender:"female",displayName:"AIGenerate2",locale:"en-US"},{name:"en-US-AshTurboMultilingualNeural",gender:"male",displayName:"Ash Turbo Multilingual",locale:"en-US"},{name:"en-US-BlueNeural",gender:"female",displayName:"Blue",locale:"en-US"},{name:"en-US-EvelynMultilingualNeural",gender:"female",displayName:"Evelyn Multilingual",locale:"en-US"},{name:"en-ZA-LeahNeural",gender:"female",displayName:"Leah",locale:"en-ZA"},{name:"en-ZA-LukeNeural",gender:"male",displayName:"Luke",locale:"en-ZA"},{name:"es-AR-ElenaNeural",gender:"female",displayName:"Elena",locale:"es-AR"},{name:"es-AR-TomasNeural",gender:"male",displayName:"Tomas",locale:"es-AR"},{name:"es-BO-SofiaNeural",gender:"female",displayName:"Sofia",locale:"es-BO"},{name:"es-BO-MarceloNeural",gender:"male",displayName:"Marcelo",locale:"es-BO"},{name:"es-CL-CatalinaNeural",gender:"female",displayName:"Catalina",locale:"es-CL"},{name:"es-CL-LorenzoNeural",gender:"male",displayName:"Lorenzo",locale:"es-CL"},{name:"es-CO-SalomeNeural",gender:"female",displayName:"Salome",locale:"es-CO"},{name:"es-CO-GonzaloNeural",gender:"male",displayName:"Gonzalo",locale:"es-CO"},{name:"es-CR-MariaNeural",gender:"female",displayName:"María",locale:"es-CR"},{name:"es-CR-JuanNeural",gender:"male",displayName:"Juan",locale:"es-CR"},{name:"es-CU-BelkysNeural",gender:"female",displayName:"Belkys",locale:"es-CU"},{name:"es-CU-ManuelNeural",gender:"male",displayName:"Manuel",locale:"es-CU"},{name:"es-DO-RamonaNeural",gender:"female",displayName:"Ramona",locale:"es-DO"},{name:"es-DO-EmilioNeural",gender:"male",displayName:"Emilio",locale:"es-DO"},{name:"es-EC-AndreaNeural",gender:"female",displayName:"Andrea",locale:"es-EC"},{name:"es-EC-LuisNeural",gender:"male",displayName:"Luis",locale:"es-EC"},{name:"es-ES-ElviraNeural",gender:"female",displayName:"Elvira",locale:"es-ES"},{name:"es-ES-AlvaroNeural",gender:"male",displayName:"Álvaro",locale:"es-ES"},{name:"es-ES-ArabellaMultilingualNeural",gender:"female",displayName:"Arabella Multilingual",locale:"es-ES"},{name:"es-ES-IsidoraMultilingualNeural",gender:"female",displayName:"Isidora Multilingual",locale:"es-ES"},{name:"es-ES-TristanMultilingualNeural",gender:"male",displayName:"Tristan Multilingual",locale:"es-ES"},{name:"es-ES-XimenaMultilingualNeural",gender:"female",displayName:"Ximena Multilingual",locale:"es-ES"},{name:"es-ES-AbrilNeural",gender:"female",displayName:"Abril",locale:"es-ES"},{name:"es-ES-ArnauNeural",gender:"male",displayName:"Arnau",locale:"es-ES"},{name:"es-ES-DarioNeural",gender:"male",displayName:"Dario",locale:"es-ES"},{name:"es-ES-EliasNeural",gender:"male",displayName:"Elias",locale:"es-ES"},{name:"es-ES-EstrellaNeural",gender:"female",displayName:"Estrella",locale:"es-ES"},{name:"es-ES-IreneNeural",gender:"female",displayName:"Irene",locale:"es-ES"},{name:"es-ES-LaiaNeural",gender:"female",displayName:"Laia",locale:"es-ES"},{name:"es-ES-LiaNeural",gender:"female",displayName:"Lia",locale:"es-ES"},{name:"es-ES-NilNeural",gender:"male",displayName:"Nil",locale:"es-ES"},{name:"es-ES-SaulNeural",gender:"male",displayName:"Saul",locale:"es-ES"},{name:"es-ES-TeoNeural",gender:"male",displayName:"Teo",locale:"es-ES"},{name:"es-ES-TrianaNeural",gender:"female",displayName:"Triana",locale:"es-ES"},{name:"es-ES-VeraNeural",gender:"female",displayName:"Vera",locale:"es-ES"},{name:"es-ES-XimenaNeural",gender:"female",displayName:"Ximena",locale:"es-ES"},{name:"es-GQ-TeresaNeural",gender:"female",displayName:"Teresa",locale:"es-GQ"},{name:"es-GQ-JavierNeural",gender:"male",displayName:"Javier",locale:"es-GQ"},{name:"es-GT-MartaNeural",gender:"female",displayName:"Marta",locale:"es-GT"},{name:"es-GT-AndresNeural",gender:"male",displayName:"Andrés",locale:"es-GT"},{name:"es-HN-KarlaNeural",gender:"female",displayName:"Karla",locale:"es-HN"},{name:"es-HN-CarlosNeural",gender:"male",displayName:"Carlos",locale:"es-HN"},{name:"es-MX-DaliaNeural",gender:"female",displayName:"Dalia",locale:"es-MX"},{name:"es-MX-JorgeNeural",gender:"male",displayName:"Jorge",locale:"es-MX"},{name:"es-MX-DaliaMultilingualNeural",gender:"female",displayName:"Dalia Multilingual",locale:"es-MX"},{name:"es-MX-JorgeMultilingualNeural",gender:"male",displayName:"Jorge Multilingual",locale:"es-MX"},{name:"es-MX-BeatrizNeural",gender:"female",displayName:"Beatriz",locale:"es-MX"},{name:"es-MX-CandelaNeural",gender:"female",displayName:"Candela",locale:"es-MX"},{name:"es-MX-CarlotaNeural",gender:"female",displayName:"Carlota",locale:"es-MX"},{name:"es-MX-CecilioNeural",gender:"male",displayName:"Cecilio",locale:"es-MX"},{name:"es-MX-GerardoNeural",gender:"male",displayName:"Gerardo",locale:"es-MX"},{name:"es-MX-LarissaNeural",gender:"female",displayName:"Larissa",locale:"es-MX"},{name:"es-MX-LibertoNeural",gender:"male",displayName:"Liberto",locale:"es-MX"},{name:"es-MX-LucianoNeural",gender:"male",displayName:"Luciano",locale:"es-MX"},{name:"es-MX-MarinaNeural",gender:"female",displayName:"Marina",locale:"es-MX"},{name:"es-MX-NuriaNeural",gender:"female",displayName:"Nuria",locale:"es-MX"},{name:"es-MX-PelayoNeural",gender:"male",displayName:"Pelayo",locale:"es-MX"},{name:"es-MX-RenataNeural",gender:"female",displayName:"Renata",locale:"es-MX"},{name:"es-MX-YagoNeural",gender:"male",displayName:"Yago",locale:"es-MX"},{name:"es-NI-YolandaNeural",gender:"female",displayName:"Yolanda",locale:"es-NI"},{name:"es-NI-FedericoNeural",gender:"male",displayName:"Federico",locale:"es-NI"},{name:"es-PA-MargaritaNeural",gender:"female",displayName:"Margarita",locale:"es-PA"},{name:"es-PA-RobertoNeural",gender:"male",displayName:"Roberto",locale:"es-PA"},{name:"es-PE-CamilaNeural",gender:"female",displayName:"Camila",locale:"es-PE"},{name:"es-PE-AlexNeural",gender:"male",displayName:"Alex",locale:"es-PE"},{name:"es-PR-KarinaNeural",gender:"female",displayName:"Karina",locale:"es-PR"},{name:"es-PR-VictorNeural",gender:"male",displayName:"Víctor",locale:"es-PR"},{name:"es-PY-TaniaNeural",gender:"female",displayName:"Tania",locale:"es-PY"},{name:"es-PY-MarioNeural",gender:"male",displayName:"Mario",locale:"es-PY"},{name:"es-SV-LorenaNeural",gender:"female",displayName:"Lorena",locale:"es-SV"},{name:"es-SV-RodrigoNeural",gender:"male",displayName:"Rodrigo",locale:"es-SV"},{name:"es-US-PalomaNeural",gender:"female",displayName:"Paloma",locale:"es-US"},{name:"es-US-AlonsoNeural",gender:"male",displayName:"Alonso",locale:"es-US"},{name:"es-UY-ValentinaNeural",gender:"female",displayName:"Valentina",locale:"es-UY"},{name:"es-UY-MateoNeural",gender:"male",displayName:"Mateo",locale:"es-UY"},{name:"es-VE-PaolaNeural",gender:"female",displayName:"Paola",locale:"es-VE"},{name:"es-VE-SebastianNeural",gender:"male",displayName:"Sebastián",locale:"es-VE"},{name:"et-EE-AnuNeural",gender:"female",displayName:"Anu",locale:"et-EE"},{name:"et-EE-KertNeural",gender:"male",displayName:"Kert",locale:"et-EE"},{name:"eu-ES-AinhoaNeural",gender:"female",displayName:"Ainhoa",locale:"eu-ES"},{name:"eu-ES-AnderNeural",gender:"male",displayName:"Ander",locale:"eu-ES"},{name:"fa-IR-DilaraNeural",gender:"female",displayName:"دلارا",locale:"fa-IR"},{name:"fa-IR-FaridNeural",gender:"male",displayName:"فرید",locale:"fa-IR"},{name:"fi-FI-SelmaNeural",gender:"female",displayName:"Selma",locale:"fi-FI"},{name:"fi-FI-HarriNeural",gender:"male",displayName:"Harri",locale:"fi-FI"},{name:"fi-FI-NooraNeural",gender:"female",displayName:"Noora",locale:"fi-FI"},{name:"fil-PH-BlessicaNeural",gender:"female",displayName:"Blessica",locale:"fil-PH"},{name:"fil-PH-AngeloNeural",gender:"male",displayName:"Angelo",locale:"fil-PH"},{name:"fr-BE-CharlineNeural",gender:"female",displayName:"Charline",locale:"fr-BE"},{name:"fr-BE-GerardNeural",gender:"male",displayName:"Gerard",locale:"fr-BE"},{name:"fr-CA-SylvieNeural",gender:"female",displayName:"Sylvie",locale:"fr-CA"},{name:"fr-CA-JeanNeural",gender:"male",displayName:"Jean",locale:"fr-CA"},{name:"fr-CA-AntoineNeural",gender:"male",displayName:"Antoine",locale:"fr-CA"},{name:"fr-CA-ThierryNeural",gender:"male",displayName:"Thierry",locale:"fr-CA"},{name:"fr-CH-ArianeNeural",gender:"female",displayName:"Ariane",locale:"fr-CH"},{name:"fr-CH-FabriceNeural",gender:"male",displayName:"Fabrice",locale:"fr-CH"},{name:"fr-FR-DeniseNeural",gender:"female",displayName:"Denise",locale:"fr-FR"},{name:"fr-FR-HenriNeural",gender:"male",displayName:"Henri",locale:"fr-FR"},{name:"fr-FR-VivienneMultilingualNeural",gender:"female",displayName:"Vivienne Multilingue",locale:"fr-FR"},{name:"fr-FR-RemyMultilingualNeural",gender:"male",displayName:"Rémy Multilingue",locale:"fr-FR"},{name:"fr-FR-LucienMultilingualNeural",gender:"male",displayName:"Lucien Multilingual",locale:"fr-FR"},{name:"fr-FR-AlainNeural",gender:"male",displayName:"Alain",locale:"fr-FR"},{name:"fr-FR-BrigitteNeural",gender:"female",displayName:"Brigitte",locale:"fr-FR"},{name:"fr-FR-CelesteNeural",gender:"female",displayName:"Celeste",locale:"fr-FR"},{name:"fr-FR-ClaudeNeural",gender:"male",displayName:"Claude",locale:"fr-FR"},{name:"fr-FR-CoralieNeural",gender:"female",displayName:"Coralie",locale:"fr-FR"},{name:"fr-FR-EloiseNeural",gender:"female",displayName:"Eloise",locale:"fr-FR"},{name:"fr-FR-JacquelineNeural",gender:"female",displayName:"Jacqueline",locale:"fr-FR"},{name:"fr-FR-JeromeNeural",gender:"male",displayName:"Jerome",locale:"fr-FR"},{name:"fr-FR-JosephineNeural",gender:"female",displayName:"Josephine",locale:"fr-FR"},{name:"fr-FR-MauriceNeural",gender:"male",displayName:"Maurice",locale:"fr-FR"},{name:"fr-FR-YvesNeural",gender:"male",displayName:"Yves",locale:"fr-FR"},{name:"fr-FR-YvetteNeural",gender:"female",displayName:"Yvette",locale:"fr-FR"},{name:"ga-IE-OrlaNeural",gender:"female",displayName:"Orla",locale:"ga-IE"},{name:"ga-IE-ColmNeural",gender:"male",displayName:"Colm",locale:"ga-IE"},{name:"gl-ES-SabelaNeural",gender:"female",displayName:"Sabela",locale:"gl-ES"},{name:"gl-ES-RoiNeural",gender:"male",displayName:"Roi",locale:"gl-ES"},{name:"gu-IN-DhwaniNeural",gender:"female",displayName:"ધ્વની",locale:"gu-IN"},{name:"gu-IN-NiranjanNeural",gender:"male",displayName:"નિરંજન",locale:"gu-IN"},{name:"he-IL-HilaNeural",gender:"female",displayName:"הילה",locale:"he-IL"},{name:"he-IL-AvriNeural",gender:"male",displayName:"אברי",locale:"he-IL"},{name:"hi-IN-AaravNeural",gender:"male",displayName:"आरव ",locale:"hi-IN"},{name:"hi-IN-AnanyaNeural",gender:"female",displayName:"अनन्या",locale:"hi-IN"},{name:"hi-IN-AartiNeural",gender:"female",displayName:"आरती",locale:"hi-IN"},{name:"hi-IN-ArjunNeural",gender:"male",displayName:"अर्जुन",locale:"hi-IN"},{name:"hi-IN-KavyaNeural",gender:"female",displayName:"काव्या",locale:"hi-IN"},{name:"hi-IN-KunalNeural",gender:"male",displayName:"कुनाल ",locale:"hi-IN"},{name:"hi-IN-RehaanNeural",gender:"male",displayName:"रेहान",locale:"hi-IN"},{name:"hi-IN-SwaraNeural",gender:"female",displayName:"स्वरा",locale:"hi-IN"},{name:"hi-IN-MadhurNeural",gender:"male",displayName:"मधुर",locale:"hi-IN"},{name:"hr-HR-GabrijelaNeural",gender:"female",displayName:"Gabrijela",locale:"hr-HR"},{name:"hr-HR-SreckoNeural",gender:"male",displayName:"Srećko",locale:"hr-HR"},{name:"hu-HU-NoemiNeural",gender:"female",displayName:"Noémi",locale:"hu-HU"},{name:"hu-HU-TamasNeural",gender:"male",displayName:"Tamás",locale:"hu-HU"},{name:"hy-AM-AnahitNeural",gender:"female",displayName:"Անահիտ",locale:"hy-AM"},{name:"hy-AM-HaykNeural",gender:"male",displayName:"Հայկ",locale:"hy-AM"},{name:"id-ID-GadisNeural",gender:"female",displayName:"Gadis",locale:"id-ID"},{name:"id-ID-ArdiNeural",gender:"male",displayName:"Ardi",locale:"id-ID"},{name:"is-IS-GudrunNeural",gender:"female",displayName:"Guðrún",locale:"is-IS"},{name:"is-IS-GunnarNeural",gender:"male",displayName:"Gunnar",locale:"is-IS"},{name:"it-IT-ElsaNeural",gender:"female",displayName:"Elsa",locale:"it-IT"},{name:"it-IT-IsabellaNeural",gender:"female",displayName:"Isabella",locale:"it-IT"},{name:"it-IT-DiegoNeural",gender:"male",displayName:"Diego",locale:"it-IT"},{name:"it-IT-AlessioMultilingualNeural",gender:"male",displayName:"Alessio Multilingual",locale:"it-IT"},{name:"it-IT-IsabellaMultilingualNeural",gender:"female",displayName:"Isabella Multilingual",locale:"it-IT"},{name:"it-IT-GiuseppeMultilingualNeural",gender:"male",displayName:"Giuseppe Multilingual",locale:"it-IT"},{name:"it-IT-MarcelloMultilingualNeural",gender:"male",displayName:"Marcello Multilingual",locale:"it-IT"},{name:"it-IT-BenignoNeural",gender:"male",displayName:"Benigno",locale:"it-IT"},{name:"it-IT-CalimeroNeural",gender:"male",displayName:"Calimero",locale:"it-IT"},{name:"it-IT-CataldoNeural",gender:"male",displayName:"Cataldo",locale:"it-IT"},{name:"it-IT-FabiolaNeural",gender:"female",displayName:"Fabiola",locale:"it-IT"},{name:"it-IT-FiammaNeural",gender:"female",displayName:"Fiamma",locale:"it-IT"},{name:"it-IT-GianniNeural",gender:"male",displayName:"Gianni",locale:"it-IT"},{name:"it-IT-GiuseppeNeural",gender:"male",displayName:"Giuseppe",locale:"it-IT"},{name:"it-IT-ImeldaNeural",gender:"female",displayName:"Imelda",locale:"it-IT"},{name:"it-IT-IrmaNeural",gender:"female",displayName:"Irma",locale:"it-IT"},{name:"it-IT-LisandroNeural",gender:"male",displayName:"Lisandro",locale:"it-IT"},{name:"it-IT-PalmiraNeural",gender:"female",displayName:"Palmira",locale:"it-IT"},{name:"it-IT-PierinaNeural",gender:"female",displayName:"Pierina",locale:"it-IT"},{name:"it-IT-RinaldoNeural",gender:"male",displayName:"Rinaldo",locale:"it-IT"},{name:"iu-Cans-CA-SiqiniqNeural",gender:"female",displayName:"ᓯᕿᓂᖅ",locale:"iu-Cans-CA"},{name:"iu-Cans-CA-TaqqiqNeural",gender:"male",displayName:"ᑕᖅᑭᖅ",locale:"iu-Cans-CA"},{name:"iu-Latn-CA-SiqiniqNeural",gender:"female",displayName:"ᓯᕿᓂᖅ",locale:"iu-Latn-CA"},{name:"iu-Latn-CA-TaqqiqNeural",gender:"male",displayName:"ᑕᖅᑭᖅ",locale:"iu-Latn-CA"},{name:"ja-JP-NanamiNeural",gender:"female",displayName:"七海",locale:"ja-JP"},{name:"ja-JP-KeitaNeural",gender:"male",displayName:"圭太",locale:"ja-JP"},{name:"ja-JP-AoiNeural",gender:"female",displayName:"碧衣",locale:"ja-JP"},{name:"ja-JP-DaichiNeural",gender:"male",displayName:"大智",locale:"ja-JP"},{name:"ja-JP-MayuNeural",gender:"female",displayName:"真夕",locale:"ja-JP"},{name:"ja-JP-NaokiNeural",gender:"male",displayName:"直紀",locale:"ja-JP"},{name:"ja-JP-ShioriNeural",gender:"female",displayName:"志織",locale:"ja-JP"},{name:"ja-JP-MasaruMultilingualNeural",gender:"male",displayName:"勝 多言語",locale:"ja-JP"},{name:"jv-ID-SitiNeural",gender:"female",displayName:"Siti",locale:"jv-ID"},{name:"jv-ID-DimasNeural",gender:"male",displayName:"Dimas",locale:"jv-ID"},{name:"ka-GE-EkaNeural",gender:"female",displayName:"ეკა",locale:"ka-GE"},{name:"ka-GE-GiorgiNeural",gender:"male",displayName:"გიორგი",locale:"ka-GE"},{name:"kk-KZ-AigulNeural",gender:"female",displayName:"Айгүл",locale:"kk-KZ"},{name:"kk-KZ-DauletNeural",gender:"male",displayName:"Дәулет",locale:"kk-KZ"},{name:"km-KH-SreymomNeural",gender:"female",displayName:"ស្រីមុំ",locale:"km-KH"},{name:"km-KH-PisethNeural",gender:"male",displayName:"ពិសិដ្ឋ",locale:"km-KH"},{name:"kn-IN-SapnaNeural",gender:"female",displayName:"ಸಪ್ನಾ",locale:"kn-IN"},{name:"kn-IN-GaganNeural",gender:"male",displayName:"ಗಗನ್",locale:"kn-IN"},{name:"ko-KR-SunHiNeural",gender:"female",displayName:"선히",locale:"ko-KR"},{name:"ko-KR-InJoonNeural",gender:"male",displayName:"인준",locale:"ko-KR"},{name:"ko-KR-HyunsuMultilingualNeural",gender:"male",displayName:"Hyunsu Multilingual",locale:"ko-KR"},{name:"ko-KR-BongJinNeural",gender:"male",displayName:"봉진",locale:"ko-KR"},{name:"ko-KR-GookMinNeural",gender:"male",displayName:"국민",locale:"ko-KR"},{name:"ko-KR-HyunsuNeural",gender:"male",displayName:"현수",locale:"ko-KR"},{name:"ko-KR-JiMinNeural",gender:"female",displayName:"지민",locale:"ko-KR"},{name:"ko-KR-SeoHyeonNeural",gender:"female",displayName:"서현",locale:"ko-KR"},{name:"ko-KR-SoonBokNeural",gender:"female",displayName:"순복",locale:"ko-KR"},{name:"ko-KR-YuJinNeural",gender:"female",displayName:"유진",locale:"ko-KR"},{name:"lo-LA-KeomanyNeural",gender:"female",displayName:"ແກ້ວມະນີ",locale:"lo-LA"},{name:"lo-LA-ChanthavongNeural",gender:"male",displayName:"ຈັນທະວົງ",locale:"lo-LA"},{name:"lt-LT-OnaNeural",gender:"female",displayName:"Ona",locale:"lt-LT"},{name:"lt-LT-LeonasNeural",gender:"male",displayName:"Leonas",locale:"lt-LT"},{name:"lv-LV-EveritaNeural",gender:"female",displayName:"Everita",locale:"lv-LV"},{name:"lv-LV-NilsNeural",gender:"male",displayName:"Nils",locale:"lv-LV"},{name:"mk-MK-MarijaNeural",gender:"female",displayName:"Марија",locale:"mk-MK"},{name:"mk-MK-AleksandarNeural",gender:"male",displayName:"Александар",locale:"mk-MK"},{name:"ml-IN-SobhanaNeural",gender:"female",displayName:"ശോഭന",locale:"ml-IN"},{name:"ml-IN-MidhunNeural",gender:"male",displayName:"മിഥുൻ",locale:"ml-IN"},{name:"mn-MN-YesuiNeural",gender:"female",displayName:"Есүй",locale:"mn-MN"},{name:"mn-MN-BataaNeural",gender:"male",displayName:"Батаа",locale:"mn-MN"},{name:"mr-IN-AarohiNeural",gender:"female",displayName:"आरोही",locale:"mr-IN"},{name:"mr-IN-ManoharNeural",gender:"male",displayName:"मनोहर",locale:"mr-IN"},{name:"ms-MY-YasminNeural",gender:"female",displayName:"Yasmin",locale:"ms-MY"},{name:"ms-MY-OsmanNeural",gender:"male",displayName:"Osman",locale:"ms-MY"},{name:"mt-MT-GraceNeural",gender:"female",displayName:"Grace",locale:"mt-MT"},{name:"mt-MT-JosephNeural",gender:"male",displayName:"Joseph",locale:"mt-MT"},{name:"my-MM-NilarNeural",gender:"female",displayName:"နီလာ",locale:"my-MM"},{name:"my-MM-ThihaNeural",gender:"male",displayName:"သီဟ",locale:"my-MM"},{name:"nb-NO-PernilleNeural",gender:"female",displayName:"Pernille",locale:"nb-NO"},{name:"nb-NO-FinnNeural",gender:"male",displayName:"Finn",locale:"nb-NO"},{name:"nb-NO-IselinNeural",gender:"female",displayName:"Iselin",locale:"nb-NO"},{name:"ne-NP-HemkalaNeural",gender:"female",displayName:"हेमकला",locale:"ne-NP"},{name:"ne-NP-SagarNeural",gender:"male",displayName:"सागर",locale:"ne-NP"},{name:"nl-BE-DenaNeural",gender:"female",displayName:"Dena",locale:"nl-BE"},{name:"nl-BE-ArnaudNeural",gender:"male",displayName:"Arnaud",locale:"nl-BE"},{name:"nl-NL-FennaNeural",gender:"female",displayName:"Fenna",locale:"nl-NL"},{name:"nl-NL-MaartenNeural",gender:"male",displayName:"Maarten",locale:"nl-NL"},{name:"nl-NL-ColetteNeural",gender:"female",displayName:"Colette",locale:"nl-NL"},{name:"or-IN-SubhasiniNeural",gender:"female",displayName:"ସୁଭାସିନୀ",locale:"or-IN"},{name:"or-IN-SukantNeural",gender:"male",displayName:"ସୁକାନ୍ତ",locale:"or-IN"},{name:"pa-IN-OjasNeural",gender:"male",displayName:"ਓਜਸ",locale:"pa-IN"},{name:"pa-IN-VaaniNeural",gender:"female",displayName:"ਵਾਨੀ",locale:"pa-IN"},{name:"pl-PL-AgnieszkaNeural",gender:"female",displayName:"Agnieszka",locale:"pl-PL"},{name:"pl-PL-MarekNeural",gender:"male",displayName:"Marek",locale:"pl-PL"},{name:"pl-PL-ZofiaNeural",gender:"female",displayName:"Zofia",locale:"pl-PL"},{name:"ps-AF-LatifaNeural",gender:"female",displayName:"لطيفه",locale:"ps-AF"},{name:"ps-AF-GulNawazNeural",gender:"male",displayName:" ګل نواز",locale:"ps-AF"},{name:"pt-BR-FranciscaNeural",gender:"female",displayName:"Francisca",locale:"pt-BR"},{name:"pt-BR-AntonioNeural",gender:"male",displayName:"Antônio",locale:"pt-BR"},{name:"pt-BR-MacerioMultilingualNeural",gender:"male",displayName:"Macerio Multilingual",locale:"pt-BR"},{name:"pt-BR-ThalitaMultilingualNeural",gender:"female",displayName:"Thalita multilíngue",locale:"pt-BR"},{name:"pt-BR-BrendaNeural",gender:"female",displayName:"Brenda",locale:"pt-BR"},{name:"pt-BR-DonatoNeural",gender:"male",displayName:"Donato",locale:"pt-BR"},{name:"pt-BR-ElzaNeural",gender:"female",displayName:"Elza",locale:"pt-BR"},{name:"pt-BR-FabioNeural",gender:"male",displayName:"Fabio",locale:"pt-BR"},{name:"pt-BR-GiovannaNeural",gender:"female",displayName:"Giovanna",locale:"pt-BR"},{name:"pt-BR-HumbertoNeural",gender:"male",displayName:"Humberto",locale:"pt-BR"},{name:"pt-BR-JulioNeural",gender:"male",displayName:"Julio",locale:"pt-BR"},{name:"pt-BR-LeilaNeural",gender:"female",displayName:"Leila",locale:"pt-BR"},{name:"pt-BR-LeticiaNeural",gender:"female",displayName:"Leticia",locale:"pt-BR"},{name:"pt-BR-ManuelaNeural",gender:"female",displayName:"Manuela",locale:"pt-BR"},{name:"pt-BR-NicolauNeural",gender:"male",displayName:"Nicolau",locale:"pt-BR"},{name:"pt-BR-ThalitaNeural",gender:"female",displayName:"Thalita",locale:"pt-BR"},{name:"pt-BR-ValerioNeural",gender:"male",displayName:"Valerio",locale:"pt-BR"},{name:"pt-BR-YaraNeural",gender:"female",displayName:"Yara",locale:"pt-BR"},{name:"pt-PT-RaquelNeural",gender:"female",displayName:"Raquel",locale:"pt-PT"},{name:"pt-PT-DuarteNeural",gender:"male",displayName:"Duarte",locale:"pt-PT"},{name:"pt-PT-FernandaNeural",gender:"female",displayName:"Fernanda",locale:"pt-PT"},{name:"ro-RO-AlinaNeural",gender:"female",displayName:"Alina",locale:"ro-RO"},{name:"ro-RO-EmilNeural",gender:"male",displayName:"Emil",locale:"ro-RO"},{name:"ru-RU-SvetlanaNeural",gender:"female",displayName:"Светлана",locale:"ru-RU"},{name:"ru-RU-DmitryNeural",gender:"male",displayName:"Дмитрий",locale:"ru-RU"},{name:"ru-RU-DariyaNeural",gender:"female",displayName:"Дария",locale:"ru-RU"},{name:"si-LK-ThiliniNeural",gender:"female",displayName:"තිළිණි",locale:"si-LK"},{name:"si-LK-SameeraNeural",gender:"male",displayName:"සමීර",locale:"si-LK"},{name:"sk-SK-ViktoriaNeural",gender:"female",displayName:"Viktória",locale:"sk-SK"},{name:"sk-SK-LukasNeural",gender:"male",displayName:"Lukáš",locale:"sk-SK"},{name:"sl-SI-PetraNeural",gender:"female",displayName:"Petra",locale:"sl-SI"},{name:"sl-SI-RokNeural",gender:"male",displayName:"Rok",locale:"sl-SI"},{name:"so-SO-UbaxNeural",gender:"female",displayName:"Ubax",locale:"so-SO"},{name:"so-SO-MuuseNeural",gender:"male",displayName:"Muuse",locale:"so-SO"},{name:"sq-AL-AnilaNeural",gender:"female",displayName:"Anila",locale:"sq-AL"},{name:"sq-AL-IlirNeural",gender:"male",displayName:"Ilir",locale:"sq-AL"},{name:"sr-Latn-RS-NicholasNeural",gender:"male",displayName:"Nicholas",locale:"sr-Latn-RS"},{name:"sr-Latn-RS-SophieNeural",gender:"female",displayName:"Sophie",locale:"sr-Latn-RS"},{name:"sr-RS-SophieNeural",gender:"female",displayName:"Софија",locale:"sr-RS"},{name:"sr-RS-NicholasNeural",gender:"male",displayName:"Никола",locale:"sr-RS"},{name:"su-ID-TutiNeural",gender:"female",displayName:"Tuti",locale:"su-ID"},{name:"su-ID-JajangNeural",gender:"male",displayName:"Jajang",locale:"su-ID"},{name:"sv-SE-SofieNeural",gender:"female",displayName:"Sofie",locale:"sv-SE"},{name:"sv-SE-MattiasNeural",gender:"male",displayName:"Mattias",locale:"sv-SE"},{name:"sv-SE-HilleviNeural",gender:"female",displayName:"Hillevi",locale:"sv-SE"},{name:"sw-KE-ZuriNeural",gender:"female",displayName:"Zuri",locale:"sw-KE"},{name:"sw-KE-RafikiNeural",gender:"male",displayName:"Rafiki",locale:"sw-KE"},{name:"sw-TZ-RehemaNeural",gender:"female",displayName:"Rehema",locale:"sw-TZ"},{name:"sw-TZ-DaudiNeural",gender:"male",displayName:"Daudi",locale:"sw-TZ"},{name:"ta-IN-PallaviNeural",gender:"female",displayName:"பல்லவி",locale:"ta-IN"},{name:"ta-IN-ValluvarNeural",gender:"male",displayName:"வள்ளுவர்",locale:"ta-IN"},{name:"ta-LK-SaranyaNeural",gender:"female",displayName:"சரண்யா",locale:"ta-LK"},{name:"ta-LK-KumarNeural",gender:"male",displayName:"குமார்",locale:"ta-LK"},{name:"ta-MY-KaniNeural",gender:"female",displayName:"கனி",locale:"ta-MY"},{name:"ta-MY-SuryaNeural",gender:"male",displayName:"சூர்யா",locale:"ta-MY"},{name:"ta-SG-VenbaNeural",gender:"female",displayName:"வெண்பா",locale:"ta-SG"},{name:"ta-SG-AnbuNeural",gender:"male",displayName:"அன்பு",locale:"ta-SG"},{name:"te-IN-ShrutiNeural",gender:"female",displayName:"శ్రుతి",locale:"te-IN"},{name:"te-IN-MohanNeural",gender:"male",displayName:"మోహన్",locale:"te-IN"},{name:"th-TH-PremwadeeNeural",gender:"female",displayName:"เปรมวดี",locale:"th-TH"},{name:"th-TH-NiwatNeural",gender:"male",displayName:"นิวัฒน์",locale:"th-TH"},{name:"th-TH-AcharaNeural",gender:"female",displayName:"อัจฉรา",locale:"th-TH"},{name:"tr-TR-EmelNeural",gender:"female",displayName:"Emel",locale:"tr-TR"},{name:"tr-TR-AhmetNeural",gender:"male",displayName:"Ahmet",locale:"tr-TR"},{name:"uk-UA-PolinaNeural",gender:"female",displayName:"Поліна",locale:"uk-UA"},{name:"uk-UA-OstapNeural",gender:"male",displayName:"Остап",locale:"uk-UA"},{name:"ur-IN-GulNeural",gender:"female",displayName:"گل",locale:"ur-IN"},{name:"ur-IN-SalmanNeural",gender:"male",displayName:"سلمان",locale:"ur-IN"},{name:"ur-PK-UzmaNeural",gender:"female",displayName:"عظمیٰ",locale:"ur-PK"},{name:"ur-PK-AsadNeural",gender:"male",displayName:"اسد",locale:"ur-PK"},{name:"uz-UZ-MadinaNeural",gender:"female",displayName:"Madina",locale:"uz-UZ"},{name:"uz-UZ-SardorNeural",gender:"male",displayName:"Sardor",locale:"uz-UZ"},{name:"vi-VN-HoaiMyNeural",gender:"female",displayName:"Hoài My",locale:"vi-VN"},{name:"vi-VN-NamMinhNeural",gender:"male",displayName:"Nam Minh",locale:"vi-VN"},{name:"wuu-CN-XiaotongNeural",gender:"female",displayName:"晓彤",locale:"wuu-CN"},{name:"wuu-CN-YunzheNeural",gender:"male",displayName:"云哲",locale:"wuu-CN"},{name:"yue-CN-XiaoMinNeural",gender:"female",displayName:"晓敏",locale:"yue-CN"},{name:"yue-CN-YunSongNeural",gender:"male",displayName:"云松",locale:"yue-CN"},{name:"zh-CN-XiaoxiaoNeural",gender:"female",displayName:"晓晓",locale:"zh-CN"},{name:"zh-CN-YunxiNeural",gender:"male",displayName:"云希",locale:"zh-CN"},{name:"zh-CN-YunjianNeural",gender:"male",displayName:"云健",locale:"zh-CN"},{name:"zh-CN-XiaoyiNeural",gender:"female",displayName:"晓伊",locale:"zh-CN"},{name:"zh-CN-YunyangNeural",gender:"male",displayName:"云扬",locale:"zh-CN"},{name:"zh-CN-XiaochenNeural",gender:"female",displayName:"晓辰",locale:"zh-CN"},{name:"zh-CN-XiaochenMultilingualNeural",gender:"female",displayName:"晓辰 多语言",locale:"zh-CN"},{name:"zh-CN-XiaohanNeural",gender:"female",displayName:"晓涵",locale:"zh-CN"},{name:"zh-CN-XiaomengNeural",gender:"female",displayName:"晓梦",locale:"zh-CN"},{name:"zh-CN-XiaomoNeural",gender:"female",displayName:"晓墨",locale:"zh-CN"},{name:"zh-CN-XiaoqiuNeural",gender:"female",displayName:"晓秋",locale:"zh-CN"},{name:"zh-CN-XiaorouNeural",gender:"female",displayName:"晓柔",locale:"zh-CN"},{name:"zh-CN-XiaoruiNeural",gender:"female",displayName:"晓睿",locale:"zh-CN"},{name:"zh-CN-XiaoshuangNeural",gender:"female",displayName:"晓双",locale:"zh-CN"},{name:"zh-CN-XiaoxiaoDialectsNeural",gender:"female",displayName:"晓晓 方言",locale:"zh-CN"},{name:"zh-CN-XiaoxiaoMultilingualNeural",gender:"female",displayName:"晓晓 多语言",locale:"zh-CN"},{name:"zh-CN-XiaoyanNeural",gender:"female",displayName:"晓颜",locale:"zh-CN"},{name:"zh-CN-XiaoyouNeural",gender:"female",displayName:"晓悠",locale:"zh-CN"},{name:"zh-CN-XiaoyuMultilingualNeural",gender:"female",displayName:"晓宇 多语言",locale:"zh-CN"},{name:"zh-CN-XiaozhenNeural",gender:"female",displayName:"晓甄",locale:"zh-CN"},{name:"zh-CN-YunfengNeural",gender:"male",displayName:"云枫",locale:"zh-CN"},{name:"zh-CN-YunhaoNeural",gender:"male",displayName:"云皓",locale:"zh-CN"},{name:"zh-CN-YunjieNeural",gender:"male",displayName:"云杰",locale:"zh-CN"},{name:"zh-CN-YunxiaNeural",gender:"male",displayName:"云夏",locale:"zh-CN"},{name:"zh-CN-YunxiaoMultilingualNeural",gender:"male",displayName:"云霄 多语言",locale:"zh-CN"},{name:"zh-CN-YunyeNeural",gender:"male",displayName:"云野",locale:"zh-CN"},{name:"zh-CN-YunyiMultilingualNeural",gender:"male",displayName:"云逸 多语言",locale:"zh-CN"},{name:"zh-CN-YunzeNeural",gender:"male",displayName:"云泽",locale:"zh-CN"},{name:"zh-CN-YunfanMultilingualNeural",gender:"male",displayName:"云帆 多语言",locale:"zh-CN"},{name:"zh-CN-guangxi-YunqiNeural",gender:"male",displayName:"云奇 广西",locale:"zh-CN"},{name:"zh-CN-henan-YundengNeural",gender:"male",displayName:"云登",locale:"zh-CN"},{name:"zh-CN-liaoning-XiaobeiNeural",gender:"female",displayName:"晓北 辽宁",locale:"zh-CN"},{name:"zh-CN-liaoning-YunbiaoNeural",gender:"male",displayName:"云彪 辽宁",locale:"zh-CN"},{name:"zh-CN-shaanxi-XiaoniNeural",gender:"female",displayName:"晓妮",locale:"zh-CN"},{name:"zh-CN-shandong-YunxiangNeural",gender:"male",displayName:"云翔",locale:"zh-CN"},{name:"zh-CN-sichuan-YunxiNeural",gender:"male",displayName:"云希 四川",locale:"zh-CN"},{name:"zh-HK-HiuMaanNeural",gender:"female",displayName:"曉曼",locale:"zh-HK"},{name:"zh-HK-WanLungNeural",gender:"male",displayName:"雲龍",locale:"zh-HK"},{name:"zh-HK-HiuGaaiNeural",gender:"female",displayName:"曉佳",locale:"zh-HK"},{name:"zh-TW-HsiaoChenNeural",gender:"female",displayName:"曉臻",locale:"zh-TW"},{name:"zh-TW-YunJheNeural",gender:"male",displayName:"雲哲",locale:"zh-TW"},{name:"zh-TW-HsiaoYuNeural",gender:"female",displayName:"曉雨",locale:"zh-TW"},{name:"zu-ZA-ThandoNeural",gender:"female",displayName:"Thando",locale:"zu-ZA"},{name:"zu-ZA-ThembaNeural",gender:"male",displayName:"Themba",locale:"zu-ZA"}],EdgeVoiceList:EdgeVoiceList};class x{constructor(e){this.config=e,this.driveId="",this.taskQueue=new b(1),void 0===this.config.baseFolder?this.baseFolder="/KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,a=3){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}getDriveId(){return p(this,void 0,void 0,(function*(){if(this.driveId)return this.driveId;const a=this.config.access_token,t=yield e.post("https://openapi.alipan.com/adrive/v1.0/user/getDriveInfo",{},{headers:{Authorization:`Bearer ${a}`}});return this.driveId=t.data.default_drive_id,this.driveId}))}getFolderIdByPath(a){return p(this,void 0,void 0,(function*(){const t=this.config.access_token,o=yield this.getDriveId();try{try{const n=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:o,file_path:a},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(n.data)return n.data.file_id}catch(n){const r=a.split("/").filter((e=>e));let i="",l="root";for(const a of r){i+="/"+a;try{l=(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:o,file_path:i},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}})).data.file_id}catch(n){l=(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/create",{drive_id:o,parent_file_id:l,name:a,type:"folder",check_name_mode:"refuse"},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}})).data.file_id}}return l}}catch(e){return console.error("Error getting/creating folder by path:",e),""}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token,o=yield this.getDriveId(),n=yield this.getFolderIdByPath(this.baseFolder+"/"+a);let r=[],i="",l=!0;for(;l;){const a=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/list",{drive_id:o,parent_file_id:n,marker:i||void 0},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}}),s=a.data.items.filter((e=>!e.punish_flag||2!==e.punish_flag))||[];r=r.concat(s),i=a.data.next_marker,l=!!i&&100===s.length}return[...new Set(r.map((e=>({name:e.name,size:e.size,type:e.type,modified:e.updated_at}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token,o=yield this.getDriveId(),n=yield this.getFolderIdByPath(this.baseFolder+"/"+a);return!n||(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/delete",{drive_id:o,file_id:n},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}}),!0)}catch(e){return console.error("Error deleting file:",e),!1}}))}checkExists(a){var t;return p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,n=yield this.getDriveId(),r=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:n,file_path:a},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});(null===(t=r.data)||void 0===t?void 0:t.file_id)&&(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/recyclebin/trash",{drive_id:n,file_id:r.data.file_id},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}))}catch(e){}}))}getAuthUrl(e){return`https://openapi.alipan.com/oauth/authorize?${new URLSearchParams({response_type:"code",client_id:C.adriveClientId,redirect_uri:e,grant_type:"authorization_code",scope:"user:base,file:all:write,file:all:read"}).toString()}`}}class I extends x{constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,n=yield this.getDriveId(),r=t.substring(0,t.lastIndexOf("/")),i=t.substring(t.lastIndexOf("/")+1);yield this.deleteFileWithoutQueue(t);const l=yield this.getFolderIdByPath(this.baseFolder+"/"+r),s=yield a.arrayBuffer(),d=s.byteLength,c=yield crypto.subtle.digest("SHA-1",s),u=Array.from(new Uint8Array(c)).map((e=>e.toString(16).padStart(2,"0"))).join(""),m=(e=>{function a(e,a){const t=(65535&e)+(65535&a);return(e>>16)+(a>>16)+(t>>16)<<16|65535&t}function t(e,t,o,n,r,i){return a((l=a(a(t,e),a(n,i)))<<(s=r)|l>>>32-s,o);var l,s}function o(e,a,o,n,r,i,l){return t(a&o|~a&n,e,a,r,i,l)}function n(e,a,o,n,r,i,l){return t(a&n|o&~n,e,a,r,i,l)}function r(e,a,o,n,r,i,l){return t(a^o^n,e,a,r,i,l)}function i(e,a,o,n,r,i,l){return t(o^(a|~n),e,a,r,i,l)}const l=function(e){const a=e.length,t=1+(a+8>>6),o=new Array(16*t).fill(0);for(let t=0;t>2]|=e.charCodeAt(t)<>2]|=128<{let a="";for(let t=0;t<4;t++)a+=("0"+(e>>8*t&255).toString(16)).slice(-2);return a})).join("")})(o),p=Number(BigInt("0x"+m.slice(0,16))%BigInt(d||1)),h=new Uint8Array(s.slice(p,Math.min(p+8,d))),g=btoa(String.fromCharCode(...h)),f=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/create",{drive_id:n,parent_file_id:l,name:i,type:"file",check_name_mode:"ignore",size:d,content_hash:u,content_hash_name:"sha1",proof_code:g,proof_version:"v1",part_info_list:[{part_number:1}]},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}),{file_id:y,upload_id:N,rapid_upload:v,part_info_list:k}=f.data;return v?(console.info("阿里云盘秒传成功"),!0):(yield fetch(k[0].upload_url,{method:"PUT",body:s,headers:{"Content-Length":d.toString()}}),yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/complete",{drive_id:n,file_id:y,upload_id:N},{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}}),!0)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=this.config.access_token,o=yield this.getDriveId(),n=(yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/get_by_path",{drive_id:o,file_path:this.baseFolder+"/"+a},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}})).data.file_id,r=yield e.post("https://openapi.alipan.com/adrive/v1.0/openFile/getDownloadUrl",{drive_id:o,file_id:n},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});return(yield e.get(r.data.url,{responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}})).data}catch(e){return console.error("Error downloading file:",e),!1}}))))))}}class F{constructor(e){this.config=e,this.taskQueue=new b(3),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,a=3){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}getFolderIdByPath(a){return p(this,void 0,void 0,(function*(){if(""==a)return"0";const t=this.config.access_token,o=a.split("/");let n="0";for(const a of o){const o=`https://api.box.com/2.0/folders/${n}/items?fields=id,name&type=folder&limit=1000`;try{const r=(yield e.get(o,{headers:{Authorization:`Bearer ${t}`}})).data.entries.find((e=>e.name===a&&"folder"===e.type));if(r)n=r.id;else{const o={name:a,parent:{id:n},type:"folder"};n=(yield e.post("https://api.box.com/2.0/folders",o,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}})).data.id}}catch(e){return console.error("Error occurred during folder creation:",e),""}}return n}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;let o=this.baseFolder+"/"+a;for(;o.startsWith("/");)o=o.substring(1);let n=yield this.getFolderIdByPath(o),r=[],i=0,l=!0;const s=1e3;for(;l;){const a=yield e.get(`https://api.box.com/2.0/folders/${n}/items`,{params:{limit:s,offset:i},headers:{Authorization:`Bearer ${t}`}}),o=a.data.entries||[];r=r.concat(o),i+=o.length,l=o.length===s&&a.data.total_count>i}return[...new Set(r.map((e=>({name:e.name,size:e.size||0,type:e.type,modified:e.content_modified_at}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token,o=a.substring(0,a.lastIndexOf("/")),n=a.substring(a.lastIndexOf("/")+1);let r=this.baseFolder+"/"+o;for(;r.startsWith("/");)r=r.substring(1);const i=yield this.getFolderIdByPath(r);if(!i)return!0;const l=`https://api.box.com/2.0/folders/${i}/items?fields=id,name&type=file&limit=1000`,s=(yield e.get(l,{headers:{Authorization:`Bearer ${t}`}})).data.entries.find((e=>e.name===n&&"file"===e.type));return!s||(yield e.delete(`https://api.box.com/2.0/files/${s.id}`,{headers:{Authorization:`Bearer ${t}`}}),!0)}catch(e){return console.error("Error deleting file:",e),!1}}))}getAuthUrl(e){return`https://account.box.com/api/oauth2/authorize?${new URLSearchParams({response_type:"code",client_id:C.boxClientId,redirect_uri:e,grant_type:"authorization_code",box_subject_type:"enterprise",scope:"root_readwrite"}).toString()}`}}class R extends F{constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=this.config.access_token,n=t.substring(0,t.lastIndexOf("/")),r=t.substring(t.lastIndexOf("/")+1);let i=this.baseFolder+"/"+n;for(;i.startsWith("/");)i=i.substring(1);const l=yield this.getFolderIdByPath(i);if(!l)throw new Error("Folder not found");const s=(yield this.listFiles(n)).find((e=>e===r));s&&(yield this.deleteFileWithoutQueue(n+"/"+r));let d=new File([a],r,{lastModified:(new Date).getTime(),type:a.type});const c=new FormData;c.append("file",d),c.append("parent_id",l);const u=yield e.post("https://upload.box.com/api/2.0/files/content",c,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"multipart/form-data"},params:{if_match:"false",fields:"name,id"},maxContentLength:1/0,maxBodyLength:1/0});return!(u.status>=300)||(console.error("Error occurred during file upload:",u),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=this.config.access_token,o=a.substring(0,a.lastIndexOf("/")),n=a.substring(a.lastIndexOf("/")+1);let r=this.baseFolder+"/"+o;for(;r.startsWith("/");)r=r.substring(1);const i=yield this.getFolderIdByPath(r);if(!i)return console.error("Folder not found"),!0;const l=`https://api.box.com/2.0/folders/${i}/items?fields=id,name&type=file&limit=1000`,s=(yield e.get(l,{headers:{Authorization:`Bearer ${t}`}})).data.entries.find((e=>e.name===n&&"file"===e.type));if(!s)return console.error("File not found:",n),!0;const d=yield e({url:`https://api.box.com/2.0/files/${s.id}/content`,method:"get",headers:{Authorization:`Bearer ${t}`},responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return d.status>=300?(console.error("Error occurred during file download:",d),!1):d.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class ${constructor(e){this.config=e,this.taskQueue=new b(3)}retryOperation(e,a=3){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;let o=[],n=!0,r=null;for(;n;){let i;i=r?yield e.post("https://api.dropboxapi.com/2/files/list_folder/continue",{cursor:r},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}}):yield e.post("https://api.dropboxapi.com/2/files/list_folder",{path:"/"+a,limit:2e3},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});const l=i.data.entries||[];o=o.concat(l),n=i.data.has_more,r=i.data.cursor}return[...new Set(o.map((e=>({name:e.name,size:e.size||0,type:e[".tag"],modified:e.client_modified}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;yield e.post("https://api.dropboxapi.com/2/files/delete_v2",{path:"/"+a},{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});return!0}catch(e){return console.error("Error deleting file:",e),!1}}))}getAuthUrl(e){return`https://www.dropbox.com/oauth2/authorize?response_type=code&token_access_type=offline&client_id=${C.dropboxClientId}&redirect_uri=${e}`}}class _ extends ${constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let n=t.split("/").pop()||"",r=new File([a],n,{lastModified:(new Date).getTime(),type:a.type});const i=yield e.post("https://content.dropboxapi.com/2/files/upload",r,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/octet-stream","Dropbox-API-Arg":JSON.stringify({path:"/"+t,mode:"overwrite",autorename:!0,mute:!1})},maxContentLength:1/0,maxBodyLength:1/0});return!(i.status>=300)||(console.error("Error occurred during file upload:",i),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=this.config.access_token,o=yield e({url:"https://content.dropboxapi.com/2/files/download",method:"post",headers:{Authorization:`Bearer ${t}`,"Dropbox-API-Arg":JSON.stringify({path:"/"+a})},maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return o.status>=300?(console.error("Error occurred during file download:",o),!1):o.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class O{constructor(e){this.folderExistsCache=new Set,this.config=e,this.taskQueue=new b(3),void 0===this.config.baseFolder?this.baseFolder="/KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,a=3){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){var t,o;return p(this,void 0,void 0,(function*(){try{const n=this.config.access_token;for(a=this.baseFolder+"/"+a;a.startsWith("/");)a=a.substring(1);let r=[],i=0;const l=1e3;let s=!0;for(;s;){const d=yield e.get("https://cloud-api.yandex.net/v1/disk/resources",{headers:{Authorization:`OAuth ${n}`,"Content-Type":"application/json"},params:{path:a?`/${a}`:"/",limit:l,offset:i,fields:"_embedded.items.name,_embedded.items.size,_embedded.items.type,_embedded.items.modified,_embedded.total"}}),c=(null===(t=d.data._embedded)||void 0===t?void 0:t.items)||[];r=r.concat(c);const u=(null===(o=d.data._embedded)||void 0===o?void 0:o.total)||0;i+=c.length,s=i({name:e.name,size:e.size||0,type:"file"===e.type?"file":"folder",modified:e.modified}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;for(a=this.baseFolder+"/"+a;a.startsWith("/");)a=a.substring(1);const o=yield e.delete("https://cloud-api.yandex.net/v1/disk/resources",{headers:{Authorization:`OAuth ${t}`,"Content-Type":"application/json"},params:{path:a?`/${a}`:"/",permanently:!1}});return 202===o.status||204===o.status}catch(e){return console.error("Error deleting file:",e),!1}}))}ensureDirectoryExists(a){var t,o;return p(this,void 0,void 0,(function*(){try{const n=this.config.access_token,r=a.split("/").filter((e=>e.length>0));let i="";for(const a of r)if(i+="/"+a,!this.folderExistsCache.has(i))try{yield e.get("https://cloud-api.yandex.net/v1/disk/resources",{headers:{Authorization:`OAuth ${n}`,"Content-Type":"application/json"},params:{path:i}}),this.folderExistsCache.add(i)}catch(a){if(404!==(null===(t=a.response)||void 0===t?void 0:t.status))return console.error("Error checking directory:",a),!1;try{yield e.put(`https://cloud-api.yandex.net/v1/disk/resources?path=${encodeURIComponent(i)}`,null,{headers:{Authorization:`OAuth ${n}`}}),this.folderExistsCache.add(i)}catch(e){if(409!==(null===(o=e.response)||void 0===o?void 0:o.status))return console.error("Error creating directory:",e),!1;this.folderExistsCache.add(i)}}return!0}catch(e){return console.error("Error ensuring directory exists:",e),!1}}))}getAuthUrl(e){return`https://oauth.yandex.com/authorize?response_type=code&client_id=${C.yandexClientId}&redirect_uri=${e}&force_confirm=true`}}class U extends O{constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let n=this.baseFolder+"/"+t;for(;n.startsWith("/");)n=n.substring(1);const r=n.substring(0,n.lastIndexOf("/"));if(r){if(!(yield this.ensureDirectoryExists(r)))return console.error("Failed to create directory:",r),!1}const i=yield e.get("https://cloud-api.yandex.net/v1/disk/resources/upload",{headers:{Authorization:`OAuth ${o}`,"Content-Type":"application/json"},params:{path:`/${n}`,overwrite:!0}});if(200!==i.status)return console.error("Error getting upload URL:",i),!1;const l=i.data.href;let s=t.split("/").pop()||"",d=new File([a],s,{lastModified:(new Date).getTime(),type:a.type});const c=yield e.put(l,d,{headers:{"Content-Type":a.type||"application/octet-stream"},maxContentLength:1/0,maxBodyLength:1/0});return!(c.status>=300)||(console.error("Error occurred during file upload:",c),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=this.config.access_token;let o=this.baseFolder+"/"+a;for(;o.startsWith("/");)o=o.substring(1);const n=yield e.get("https://cloud-api.yandex.net/v1/disk/resources/download",{headers:{Authorization:`OAuth ${t}`,"Content-Type":"application/json"},params:{path:`/${o}`}});if(200!==n.status)return console.error("Error getting download URL:",n),!1;const r=n.data.href,i=yield e({url:r,method:"get",maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return i.status>=300?(console.error("Error occurred during file download:",i),!1):i.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class M{constructor(e){this.isExp=!1,this.folderIdCache=new Map,this.config=e,this.taskQueue=new b(3),this.isExp=this.config.isExp||!1,this.baseFolder="KoodoReader"}retryOperation(e,a=3){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}getFileId(a,t){return p(this,void 0,void 0,(function*(){const o=this.config.access_token,n=`https://www.googleapis.com/drive/v3/files?q=name='${a}'+and+'${t}'+in+parents&fields=files(id,name)`;try{const a=yield e.get(n,{headers:{Authorization:"Bearer "+o}});if(0===a.data.files.length)return"";const t=a.data.files;return t.length>0?t[0].id:null}catch(e){return console.error("Error occurred during file list retrieval:",e),""}}))}checkFolder(a){return p(this,void 0,void 0,(function*(){a=this.baseFolder+"/"+a;const t=this.config.access_token;if(""===a)return"root";if(this.folderIdCache.has(a))return this.folderIdCache.get(a);const o=a.split("/").filter((e=>""!==e.trim()));let n="root",r="";for(const a of o){if(r=r?r+"/"+a:a,this.folderIdCache.has(r)){n=this.folderIdCache.get(r);continue}let o=yield this.getFolderId(a,n);if(!o){const r={name:a,mimeType:"application/vnd.google-apps.folder",parents:[n]};try{o=(yield e.post("https://www.googleapis.com/drive/v3/files",r,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}})).data.id}catch(e){throw console.error(`Error occurred during folder creation for ${a}:`,e),e}}this.folderIdCache.set(r,o),n=o}return n}))}getFolderId(a,t){return p(this,void 0,void 0,(function*(){const o=this.config.access_token,n=`https://www.googleapis.com/drive/v3/files?q=name='${a=encodeURIComponent(a)}'+and+mimeType='application/vnd.google-apps.folder'+and+'${t}'+in+parents&fields=files(id,name)`;try{const a=(yield e.get(n,{headers:{Authorization:`Bearer ${o}`}})).data.files;return a.length>0?a[0].id:null}catch(e){throw console.error("Error occurred during fetching folder ID:",e),e}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;let o=yield this.checkFolder(a),n=[],r="",i=!0;for(;i;){let a=`https://www.googleapis.com/drive/v3/files?q='${o}'+in+parents&fields=nextPageToken,files(id,name,size,mimeType)&pageSize=1000`;r&&(a+=`&pageToken=${r}`);const l=yield e.get(a,{headers:{Authorization:`Bearer ${t}`}}),s=l.data.files||[];n=n.concat(s),r=l.data.nextPageToken,i=!!r}return[...new Set(n.map((e=>({name:e.name,size:e.size||0,type:"application/vnd.google-apps.folder"===e.mimeType?"folder":"file",modified:e.modifiedTime}))))]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQue(e)}))))))}))}deleteFileWithoutQue(a){return p(this,void 0,void 0,(function*(){const t=a.split("/").pop()||"",o=a.split("/").slice(0,-1).join("/"),n=yield this.checkFolder(o),r=this.config.access_token,i=yield this.getFileId(t,n);if(""===i)return console.error("File not found:",t),!0;try{const a=yield e.delete(`https://www.googleapis.com/drive/v3/files/${i}`,{headers:{Authorization:`Bearer ${r}`}});return console.error("File deleted:",a),!0}catch(e){return console.error("Error deleting file:",e),!1}}))}getAuthUrl(e){return`https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=${e}&prompt=consent&response_type=code&client_id=${C.googleClientId}&scope=https://www.googleapis.com/auth/${this.isExp?"drive":"drive.file"}&access_type=offline`}}class B extends M{constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let n=t.split("/").pop()||"",r=new File([a],n,{lastModified:(new Date).getTime(),type:a.type}),i=t.split(".").pop(),l=h(i||""),s=t.split("/")[0],d=yield this.checkFolder(s),c=yield this.getFileId(n||"",d);const u={mimeType:l,name:n,parents:[d]},m=c?`https://www.googleapis.com/upload/drive/v3/files/${c}?uploadType=resumable`:"https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable",p=(yield e({method:c?"PATCH":"POST",url:m,data:c?null:JSON.stringify(u),headers:{Authorization:"Bearer "+o,"Content-Type":"application/json; charset=UTF-8"},maxContentLength:1/0,maxBodyLength:1/0})).headers.location,g=yield this.getData(r);if(0===Object.keys(g).length)return!1;const f=yield e.put(p,g.data,{headers:{Authorization:"Bearer "+o,"Content-Type":"application/zip","Content-Range":`bytes 0-${g.fileSize-1}/${g.fileSize}`},maxContentLength:1/0,maxBodyLength:1/0});return!(f.status>=300)||(console.error("Error occurred during file download:",f),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=this.config.access_token;let o=a.split("/").pop(),n=a.split("/")[0],r=yield this.checkFolder(n),i=yield this.getFileId(o||"",r);if(!i)return console.error("File not found:",o),!0;const l=`https://www.googleapis.com/drive/v3/files/${i}?alt=media`,s=yield e.get(l,{headers:{Authorization:"Bearer "+t},maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return s.status>=300?(console.error("Error occurred during file download:",s),!1):s.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}getData(e){return p(this,void 0,void 0,(function*(){return e?new Promise(((a,t)=>{const o=new FileReader;o.onload=t=>a({fileName:e.name,mimeType:e.type,fileSize:e.size,data:t.target.result}),o.onerror=e=>t(e),o.readAsArrayBuffer(e)})):{}}))}}class L{constructor(e){this.folderCreationLocks=new Map,this.config=e,this.taskQueue=new b(3),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,a=2){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}getStorage(){return p(this,void 0,void 0,(function*(){if(this.storage)return this.storage;let{email:e,password:t}=this.config;return this.storage=yield new a({email:e,password:t,userAgent:"KoodoReader/1.0"}).ready,this.storage}))}getRoot(){return p(this,void 0,void 0,(function*(){if(this.root)return this.root;const e=(yield this.getStorage()).root;if(""===this.baseFolder)return this.root=e,this.root;let a=e.children.find((e=>e.name===this.baseFolder&&e.directory));return a||(a=yield e.mkdir(this.baseFolder)),this.root=a,this.root}))}createFolder(e,a){return p(this,void 0,void 0,(function*(){const t=`${e.nodeId}_${a}`;if(this.folderCreationLocks.has(t))return yield this.folderCreationLocks.get(t);const o=(()=>p(this,void 0,void 0,(function*(){try{let t=e.children.find((e=>e.name===a&&e.directory));return t||(t=yield e.mkdir(a),t)}finally{this.folderCreationLocks.delete(t)}})))();return this.folderCreationLocks.set(t,o),yield o}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){try{let a=yield this.getRoot();if(e){const t=e.split("/").filter((e=>e));for(const e of t){const t=a.children.find((a=>a.name===e&&a.directory));if(!t)return[];a=t}}return a.children.map((e=>({name:e.name,size:e.size||0,type:e.directory?"folder":"file",modified:e.timestamp?new Date(1e3*e.timestamp).toISOString():""})))}catch(e){return console.error("Error listing MEGA files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(e){return p(this,void 0,void 0,(function*(){try{let a=yield this.getRoot();const t=e.split("/"),o=t.pop();for(const e of t){if(!e)continue;const t=a.children.find((a=>a.name===e&&a.directory));if(!t)return!0;a=t}const n=a.children.find((e=>e.name===o&&!e.directory));return!n||(yield n.delete(),!0)}catch(e){return console.error("Error deleting MEGA file:",e),!1}}))}}class z extends L{constructor(e){super(e)}uploadFile(e,a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{let o=yield this.getRoot();const n=a.split("/"),r=n.pop()||"";for(const e of n){if(!e)continue;let a=o.children.find((a=>a.name===e&&a.directory));a||(a=yield this.createFolder(o,e)),o=a}const i=new File([e],r,{lastModified:(new Date).getTime(),type:e.type}),l=yield e.arrayBuffer(),s=new Uint8Array(l),d=t.from(s),c=o.children.find((e=>e.name===r&&!e.directory));return c&&(yield c.delete()),yield o.upload({name:r,size:i.size},d).complete,!0}catch(e){return console.error("Error occurred during MEGA file upload:",e),!1}}))))))}))}downloadFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{let a=yield this.getRoot();const t=e.split("/"),o=t.pop()||"";for(const e of t){if(!e)continue;const t=a.children.find((a=>a.name===e&&a.directory));if(!t)return!0;a=t}const n=a.children.find((e=>e.name===o&&!e.directory));if(!n)return!0;const r=yield n.downloadBuffer();return this.taskQueue.setDownloadedSize(r.size),r.buffer}catch(e){return console.error("Error occurred during MEGA file download:",e),!1}}))))))}))}}class D{constructor(e){this.isExp=!1,this.baseUrl="https://graph.microsoft.com/v1.0/me/drive/special/approot",this.config=e,this.taskQueue=new b(3),this.isExp=this.config.isExp||!1,this.baseUrl=this.isExp?"https://graph.microsoft.com/v1.0/me/drive/root":"https://graph.microsoft.com/v1.0/me/drive/special/approot",void 0===this.config.baseFolder?this.baseFolder=this.isExp?"KoodoReader":"":this.baseFolder=this.config.baseFolder}retryOperation(e,a=3){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;for(a=this.baseFolder+"/"+a;a.startsWith("/");)a=a.substring(1);let o,n=[];if(""===a)o=`${this.baseUrl}/children`;else{const e=encodeURIComponent(a);o=`${this.baseUrl}:/${e}:/children`}for(;o;){const a=yield e.get(o,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(a.status>=300)break;const r=a.data.value||[];n=n.concat(r),o=a.data["@odata.nextLink"]||""}return[...new Set(n.map((e=>({name:e.name,size:e.size||0,type:e.folder?"folder":"file",modified:e.lastModifiedDateTime}))))]}catch(e){return console.error("Error occurred during file list:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;for(a=this.baseFolder+"/"+a;a.startsWith("/");)a=a.substring(1);const o=yield e.delete(`${this.baseUrl}:/${a}`,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});return!(o.status>=300)||(console.error("Error deleting file:",o),!0)}catch(e){return console.error("Error occurred during file delete:",e),!1}}))}getAuthUrl(e){return`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${C.microsoftClientId}&scope=${this.isExp?"files.readwrite.all":"files.readwrite.appfolder"} offline_access&response_type=code&redirect_uri=${e}`}}class P extends D{constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=this.config.access_token;let n=t.split("/").pop()||"",r=new File([a],n,{lastModified:(new Date).getTime(),type:a.type}),i=this.baseFolder+"/"+t;for(;i.startsWith("/");)i=i.substring(1);const l=this.baseUrl+":/"+i+":/createUploadSession",s=yield e.post(l,null,{headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"},maxContentLength:1/0,maxBodyLength:1/0});let d=r.size;const c=r.type,u=s.data.uploadUrl,m=yield e.put(u,r,{headers:{"Content-Type":c,"Content-Range":`bytes 0-${d-1}/${d}`},maxContentLength:1/0,maxBodyLength:1/0});return!(m.status>=300)||(console.error("Error occurred during file download:",m),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=this.config.access_token;let o=this.baseFolder+"/"+a;for(;o.startsWith("/");)o=o.substring(1);const n=`${this.baseUrl}:/${o}:/content`,r=yield e.get(n,{responseType:"arraybuffer",headers:{Authorization:"Bearer "+t},maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return r.status>=300?(console.error("Error occurred during file download:",r),!1):r.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class j{downloadFile(e,a){return p(this,void 0,void 0,(function*(){return new Promise((e=>{e(!0)}))}))}uploadFile(e,a){return p(this,void 0,void 0,(function*(){return new Promise((e=>{e(!0)}))}))}listFiles(e){return p(this,void 0,void 0,(function*(){return new Promise((e=>{e([])}))}))}getAuthUrl(){return""}}class K{constructor(e){this.baseUrl="https://api.pcloud.com",this.config=e,this.taskQueue=new b(3),this.baseUrl="2"===e.region?"https://eapi.pcloud.com":"https://api.pcloud.com"}retryOperation(e,a=3){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}checkFolderExists(a,t){return p(this,void 0,void 0,(function*(){try{return 0===(yield e.get(`${this.baseUrl}/listfolder`,{params:{access_token:t,path:`/${a}`}})).data.result}catch(e){return console.error("Error checking folder:",e),!1}}))}createFolder(a,t){return p(this,void 0,void 0,(function*(){try{return 0===(yield e.get(`${this.baseUrl}/createfolderifnotexists`,{params:{access_token:t,path:`/${a}`}})).data.result}catch(e){return console.error("Error creating folder:",e),!1}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.refresh_token,o=yield e.get(`${this.baseUrl}/listfolder`,{params:{access_token:t,path:"/"+a,recursive:0}});return 0!==o.data.result?[]:o.data.metadata.contents.map((e=>({name:e.name,size:e.size||0,type:e.isfolder?"folder":"file",modified:e.modified})))}catch(e){return console.error("Error occurred during file list:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.refresh_token,o=yield e.get(`${this.baseUrl}/deletefile`,{params:{access_token:t,path:"/"+a}});return 0===o.data.result||(console.error("Error deleting file:",o.data),!0)}catch(e){return console.error("Error occurred during file delete:",e),!1}}))}getAuthUrl(e){return`https://my.pcloud.com/oauth2/authorize?client_id=${C.pcloudClientId}&response_type=code&redirect_uri=${e}`}}class H extends K{constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=this.config.refresh_token,n=t.split("/").slice(0,-1).join("/");if(!(yield this.checkFolderExists(n,o))){if(!(yield this.createFolder(n,o)))return!1}let r=t.split("/").pop()||"",i=new File([a],r,{lastModified:(new Date).getTime(),type:a.type});const l=new FormData;l.append("file",i);const s=yield e.post(`${this.baseUrl}/uploadfile`,l,{params:{access_token:o,path:`/${n}`,renew:1},maxContentLength:1/0,maxBodyLength:1/0});return 0===s.data.result||(console.error("Error uploading file:",s.data),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=this.config.refresh_token,o=yield e.get(`${this.baseUrl}/getfilelink`,{params:{access_token:t,path:`/${a}`}});if(0!==o.data.result)return console.error("Error getting file link:",o.data),!0;const n=`https://${o.data.hosts[0]}${o.data.path}`,r=yield e.get(n,{responseType:"arraybuffer",maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return r.status>=300?(console.error("Error downloading file:",r),!1):r.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class W{constructor(e){this.config=e,this.taskQueue=new b(5),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,a=0){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}shouldUsePathStyle(){try{if(this.config.forcePathStyle&&"no"!==this.config.forcePathStyle)return!0;let e=this.config.endpoint;const a=new URL(e),t=a.hostname,o=/^(\d{1,3}\.){3}\d{1,3}$/.test(t),n=""!==a.port;return!o&&n}catch(e){return!0}}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){let{endpoint:a,region:t,bucketName:r,accessKeyId:i,secretAccessKey:l,dir:s}=this.config;s=s&&"KoodoReader"===this.baseFolder?s:this.baseFolder;let d=s+"/"+e;for(;d.startsWith("/");)d=d.substring(1);""===d||d.endsWith("/")||(d+="/");const c=new o({endpoint:a,region:t,credentials:{accessKeyId:i,secretAccessKey:l},forcePathStyle:this.shouldUsePathStyle()});try{let e,a=[],t=[],o=!0;for(;o;){const i=yield c.send(new n({Bucket:r,Prefix:d,Delimiter:"/",ContinuationToken:e}));i.Contents&&(a=a.concat(i.Contents)),i.CommonPrefixes&&(t=t.concat(i.CommonPrefixes)),e=i.NextContinuationToken,o=!!e}let i=[];return a.forEach((e=>{if(!e.Key.endsWith("/")){const a=e.Key.substring(d.length);a.includes("/")||i.push({name:a,size:e.Size||0,type:"file",modified:e.LastModified?e.LastModified.toISOString():""})}})),t.forEach((e=>{const a=e.Prefix.substring(d.length).replace(/\/$/,"");a&&i.push({name:a,size:0,type:"folder",modified:""})})),i}catch(e){return console.error(e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){let{endpoint:a,region:t,bucketName:n,accessKeyId:i,secretAccessKey:l,dir:s}=this.config;s=s&&"KoodoReader"===this.baseFolder?s:this.baseFolder;const d=new o({endpoint:a,region:t,credentials:{accessKeyId:i,secretAccessKey:l},forcePathStyle:this.shouldUsePathStyle()});let c=s+"/"+e;for(;c.startsWith("/");)c=c.substring(1);try{return yield d.send(new r({Bucket:n,Key:c})),!0}catch(e){return console.error(e),!1}}))}}class Q extends W{constructor(e){super(e)}uploadFile(e,a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){let{endpoint:t,region:n,bucketName:r,accessKeyId:l,secretAccessKey:s,dir:d}=this.config;const c=new o({endpoint:t,region:n,credentials:{accessKeyId:l,secretAccessKey:s},forcePathStyle:this.shouldUsePathStyle()});d=d&&"KoodoReader"===this.baseFolder?d:this.baseFolder;let u=d+"/"+a;for(;u.startsWith("/");)u=u.substring(1);try{let a=yield c.send(new i({Bucket:r,Key:u,Body:e}));return 200===a.$metadata.httpStatusCode||(console.error("Error uploading file:",a),!1)}catch(e){return console.error("Error: ",e),!1}}))))))}))}downloadFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);let{endpoint:a,region:t,bucketName:n,accessKeyId:r,secretAccessKey:i,dir:s}=this.config;s=s&&"KoodoReader"===this.baseFolder?s:this.baseFolder;const d=new o({endpoint:a,region:t,credentials:{accessKeyId:r,secretAccessKey:i},forcePathStyle:this.shouldUsePathStyle()});let c=s+"/"+e;for(;c.startsWith("/");)c=c.substring(1);try{const e=yield d.send(new l({Bucket:n,Key:c}));if(!e.Body)return console.error("No response body"),!1;const a=yield e.Body.transformToByteArray();return this.taskQueue.setDownloadedSize(a.length),a.buffer}catch(a){return console.error("Error downloading file:",a,e),!1}}))))))}))}}class q{constructor(e){this.config=e,this.taskQueue=new b(3),void 0===this.config.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=this.config.baseFolder}retryOperation(e,a=1){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;let o=this.baseFolder;a&&""!==a.trim()&&(o=o+"/"+a),o=o.replace(/\/+/g,"/"),o.startsWith("/")&&(o=o.substring(1));let n=[],r=0;const i=1e3;for(;;){const a=yield e.get("https://pan.baidu.com/rest/2.0/xpan/file",{params:{method:"list",access_token:t,dir:"/"+o,start:r,limit:i,order:"name",desc:0,web:1,folder:0},headers:{"User-Agent":"pan.baidu.com"}});if(a.status>=300||0!==a.data.errno){console.error("百度网盘API错误:",a.data);break}const l=a.data.list||[];if(0===l.length)break;if(n=n.concat(l),l.length({name:e.server_filename,size:e.size||0,type:e.isdir?"folder":"file",modified:new Date(1e3*e.server_mtime).toISOString(),path:e.path,fs_id:e.fs_id})))}catch(e){return console.error("获取百度网盘文件列表时发生错误:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;let o=this.baseFolder+"/"+a;o=o.replace(/\/+/g,"/"),o.startsWith("/")&&(o=o.substring(1));const n=new URLSearchParams({async:"0",filelist:JSON.stringify(["/"+o])}),r=yield e.post(`https://pan.baidu.com/rest/2.0/xpan/file?method=filemanager&access_token=${t}&opera=delete`,n.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"pan.baidu.com"}});if(0!==r.data.errno)return console.error("百度网盘删除文件API错误:",r.data),-9===r.data.errno?console.error("文件不存在"):111===r.data.errno?console.error("有其他异步任务正在执行"):-7===r.data.errno&&console.error("文件名非法"),!1;const i=r.data.info||[];for(const e of i)if(0!==e.errno)return console.error(`文件删除失败: ${e.path}, 错误码: ${e.errno}`),!1;return!0}catch(e){return console.error("删除文件时发生错误:",e),!1}}))}getAuthUrl(e){return`https://openapi.baidu.com/oauth/2.0/authorize?response_type=code&client_id=${C.duboxClientId}&redirect_uri=${e}&scope=basic,netdisk&device_id=119827642&display=page&qrcode=1`}}const J=4194304;class G extends q{constructor(e){super(e)}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){var o;try{const o=this.config.access_token;let n=this.baseFolder+"/"+t;n=n.replace(/\/+/g,"/"),n.startsWith("/")&&(n=n.substring(1));const r=yield a.arrayBuffer(),i=r.byteLength,l=new Uint8Array(r),{contentMd5:s,sliceMd5:d,blockList:c}=this.calculateFileMd5(l,i),u=new URLSearchParams({path:"/"+n,size:i.toString(),isdir:"0",autoinit:"1",rtype:"3",block_list:JSON.stringify(c),"content-md5":s,"slice-md5":d,local_ctime:Math.floor(Date.now()/1e3).toString(),local_mtime:Math.floor(Date.now()/1e3).toString()}),m=yield e.post(`https://pan.baidu.com/rest/2.0/xpan/file?method=precreate&access_token=${o}`,u.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"pan.baidu.com"}});if(0!==m.data.errno)return console.error("预上传失败:",m.data),!1;const p=m.data.uploadid,h=m.data.block_list||[];if(0===h.length)return!0;const g=yield this.getUploadDomain(o,"/"+n,p);if(!g)return console.error("获取上传域名失败"),!1;for(const a of h){const t=a*J,r=Math.min(J,i-t),s=l.slice(t,t+r),d=new FormData;d.append("file",new Blob([s],{type:"application/octet-stream"}),`chunk_${a}`);const u=`${g}/rest/2.0/pcs/superfile2?method=upload&access_token=${o}&type=tmpfile&path=${encodeURIComponent("/"+n)}&uploadid=${p}&partseq=${a}`,m=yield e.post(u,d,{headers:{"User-Agent":"pan.baidu.com"},maxContentLength:1/0,maxBodyLength:1/0,timeout:0});if(m.status>=300)throw new Error(`分片上传失败: ${JSON.stringify(m.data)}`);const h=m.data.md5,f=c[a];h&&h!==f&&console.warn(`分片 ${a} MD5不匹配: 期望 ${f}, 实际 ${h}`)}const f=new URLSearchParams({path:"/"+n,size:i.toString(),isdir:"0",block_list:JSON.stringify(c),uploadid:p,rtype:"3",local_ctime:Math.floor(Date.now()/1e3).toString(),local_mtime:Math.floor(Date.now()/1e3).toString()}),y=yield e.post(`https://pan.baidu.com/rest/2.0/xpan/file?method=create&access_token=${o}`,f.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"pan.baidu.com"}});return 0===y.data.errno||(console.error("创建文件失败:",y.data),!1)}catch(e){return console.error("文件上传过程中发生错误:",(null===(o=e.response)||void 0===o?void 0:o.data)||e.message||e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){var t;this.taskQueue.setDownloadedSize(0);try{const o=this.config.access_token;let n=this.baseFolder+"/"+a;n=n.replace(/\/+/g,"/"),n.startsWith("/")&&(n=n.substring(1));const r=yield this.listFileInfos(a.substring(0,a.lastIndexOf("/"))),i=n.split("/").pop(),l=r.find((e=>e.name===i));if(!l)return console.error("文件不存在:",a),!1;const s=yield e.get("https://pan.baidu.com/rest/2.0/xpan/multimedia",{params:{method:"filemetas",access_token:o,fsids:JSON.stringify([l.fs_id]),dlink:1},headers:{"User-Agent":"pan.baidu.com"}});if(0!==s.data.errno||!(null===(t=s.data.list)||void 0===t?void 0:t[0]))return console.error("获取下载链接失败:",s.data),!1;const d=s.data.list[0].dlink;return(yield e.get(d,{responseType:"arraybuffer",params:{access_token:o},headers:{"User-Agent":"pan.baidu.com"},onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}})).data}catch(e){return console.error("下载文件时发生错误:",e),!1}}))))))}))}getUploadDomain(a,t,o){return p(this,void 0,void 0,(function*(){try{const n=yield e.get("https://d.pcs.baidu.com/rest/2.0/pcs/file",{params:{method:"locateupload",appid:"250528",access_token:a,path:t,uploadid:o,upload_version:"2.0"},headers:{"User-Agent":"pan.baidu.com"}});if(0!==n.data.error_code)return console.error("获取上传域名失败:",n.data),null;const r=n.data.servers||[],i=r.find((e=>e.server.startsWith("https://")));return i?i.server:r.length>0?r[0].server:(console.error("没有可用的上传服务器"),null)}catch(e){return console.error("获取上传域名时出错:",e),null}}))}calculateFileMd5(e,a){const t=[];let o="",n=0;for(;n=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}getUploadCredentials(a){return p(this,void 0,void 0,(function*(){try{const t=yield e.get(`${this.baseUrl}/open/upload/get_token`,{headers:{Authorization:`Bearer ${a}`}});return t.status>=300||!t.data.state?(console.error("Error getting upload credentials:",t.data),null):t.data.data}catch(e){return console.error("Error occurred during get upload credentials:",e),null}}))}generateOSSPolicy(e,a,t=new Date(Date.now()+36e5)){const o={expiration:t.toISOString(),conditions:[{bucket:e},{key:a},["starts-with","$success_action_status","2"],["content-length-range",0,1073741824]]};return JSON.stringify(o)}getAuthUrl(e){return`https://passportapi.115.com/open/authorize?client_id=${C.yiyiwuClientId}&response_type=code&redirect_uri=${e}`}}class V extends Y{constructor(e){super(e)}sha1Hex(e){return p(this,void 0,void 0,(function*(){const a=yield crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(a)).map((e=>e.toString(16).padStart(2,"0"))).join("")}))}calculateFileSha1(e){return p(this,void 0,void 0,(function*(){try{const a=yield e.arrayBuffer();return this.sha1Hex(a)}catch(e){return console.error("Error calculating file SHA1:",e),""}}))}calculatePreSha1(e){return p(this,void 0,void 0,(function*(){try{const a=e.slice(0,131072),t=yield a.arrayBuffer();return this.sha1Hex(t)}catch(e){return console.error("Error calculating pre SHA1:",e),""}}))}calculateOSSSignature(e,a){const t=s.enc.Base64.stringify(s.enc.Utf8.parse(a));return s.HmacSHA1(t,e).toString(s.enc.Base64)}handleSecondAuth(e,a,t,o,n,r,i,l){return p(this,void 0,void 0,(function*(){try{if(!a.sign_check)return console.error("No sign_check provided for second authentication"),null;const[s,d]=a.sign_check.split("-"),c=parseInt(s),u=parseInt(d),m=t.slice(c,u+1),p=yield m.arrayBuffer(),h=(yield this.sha1Hex(p)).toUpperCase();return yield this.initializeUpload(e,o,n,r,i,l,a.sign_key,h,a.pick_code)}catch(e){return console.error("Error during second authentication:",e),null}}))}uploadToObjectStorage(a,t,o,n){var r;return p(this,void 0,void 0,(function*(){try{const r=n.endpoint,i=o.bucket,l=o.object;let s;if(r.includes(i))s=r;else{s=`https://${i}.${r.replace(/^https?:\/\//,"")}`}const d=this.generateOSSPolicy(i,l),c=this.calculateOSSSignature(n.AccessKeySecret,d),u=btoa(d),m=new FormData;if(m.append("key",l),m.append("policy",u),m.append("OSSAccessKeyId",n.AccessKeyId),m.append("signature",c),m.append("x-oss-security-token",n.SecurityToken),m.append("success_action_status","200"),o.callback&&o.callback.callback){const e=btoa(o.callback.callback);if(m.append("callback",e),o.callback.callback_var){const e=JSON.parse(o.callback.callback_var);for(const[a,t]of Object.entries(e))m.append(a,String(t))}}const p=new File([a],t,{type:a.type});m.append("file",p);const h=yield e.post(s,m,{maxContentLength:1/0,maxBodyLength:1/0});return 200===h.status||204===h.status||(console.error("Upload failed with status:",h.status),!1)}catch(e){return console.error("Error uploading file via REST API:",(null===(r=e.response)||void 0===r?void 0:r.data)||e.message||e),!1}}))}uploadFile(e,a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){var t;try{const t=this.config.access_token;let o=this.baseFolder+"/"+a;o.startsWith("/")||(o="/"+o);const n=e.size,r=yield this.calculateFileSha1(e),i=yield this.calculatePreSha1(e),l=a.split("/").pop()||a,s=o.substring(0,o.lastIndexOf("/"))||"/";let d=yield this.getFolderInfo(s,!0),c="0";if(d)c=d.file_id;else{let e=yield this.createFolder(s);if(!e)return console.error("Failed to create folder:",s),!1;c=e}yield this.deleteFileWithoutQueue(a);let u=yield this.initializeUpload(c,l,n,r,i,t);if(!u)return console.error("Failed to initialize upload"),!1;if((6===u.status||7===u.status||8===u.status)&&(u=yield this.handleSecondAuth(c,u,e,l,n,r,i,t),!u))return console.error("Second authentication failed"),!1;if(2===u.status)return console.info(`File ${a} uploaded successfully via instant upload.`),!0;const m=yield this.getUploadCredentials(t);if(!m)return console.error("Failed to get upload credentials"),!1;return(yield this.uploadToObjectStorage(e,l,u,m))?(console.info(`File ${a} uploaded successfully.`),!0):(console.error("Failed to upload to object storage"),!1)}catch(e){return console.error("Error occurred during file upload:",(null===(t=e.response)||void 0===t?void 0:t.data)||e.message||e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{let t=this.baseFolder+"/"+a;t=t.replace(/\/+/g,"/"),t.startsWith("/")||(t="/"+t);const o=yield this.getFolderInfo(t,!1);if(!o||!o.pick_code)return console.error("Failed to get file info or pick_code for:",a),!1;const n=yield this.getFileDownloadUrl(o.pick_code);if(!n)return console.error("Failed to get download URL for:",a),!1;const r=yield e.get(n.url,{responseType:"arraybuffer",maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return r.status>=300?(console.error("Error downloading file:",r),!1):r.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}initializeUpload(a,t,o,n,r,i,l,s,d){return p(this,void 0,void 0,(function*(){try{const c=new FormData;c.append("file_name",t),c.append("file_size",o.toString()),a?c.append("target","U_1_"+a):c.append("target","U_1_0"),c.append("fileid",n),c.append("preid",r),c.append("topupload","0"),d&&c.append("pick_code",d),l&&c.append("sign_key",l),s&&c.append("sign_val",s);const u=yield e.post(`${this.baseUrl}/open/upload/init`,c,{headers:{Authorization:`Bearer ${i}`,"Content-Type":"multipart/form-data"}});return u.status>=300||!u.data.state?(console.error("Error initializing upload:",u.data),null):u.data.data}catch(e){return console.error("Error occurred during upload initialization:",e),null}}))}createFolder(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token,o=a.replace(/^\/+|\/+$/g,"");if(!o)return"";const n=o.split("/");let r="",i="0";for(const a of n){r=r?`${r}/${a}`:a;const o=yield this.getFolderInfo(r,!0);if(o&&o.file_id)i=o.file_id;else{const o=new FormData;o.append("pid",i),o.append("file_name",a);const n=yield e.post(`${this.baseUrl}/open/folder/add`,o,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"multipart/form-data"}});if(n.status>=300||!n.data.state)return console.error("Error creating folder:",n.data),"";i=n.data.data.file_id}}return i}catch(e){return console.error("Error occurred during folder creation:",e),""}}))}getFolderInfo(a,t){return p(this,void 0,void 0,(function*(){if(""===a||"/"===a)return{file_id:"0"};a.startsWith("/")||(a="/"+a);try{const t=this.config.access_token,o=new FormData;o.append("path",a);const n=yield e.post(`${this.baseUrl}/open/folder/get_info`,o,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"multipart/form-data"}});return n.status>=300||!n.data.state||0===n.data.data.length?(console.error("Error getting file info:",n.data),null):n.data.data}catch(e){return console.error("Error occurred during get file info:",e),null}}))}getFileDownloadUrl(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token,o=new FormData;o.append("pick_code",a);const n=yield e.post(`${this.baseUrl}/open/ufile/downurl`,o,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"multipart/form-data"}});if(n.status>=300)return console.error("Error getting download URL:",n.data),null;const r=n.data.data,i=Object.keys(r)[0];return i&&r[i]?r[i].url:(console.error("No file data found in download URL response"),null)}catch(e){return console.error("Error occurred during get download URL:",e.message||e),null}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;(a=this.baseFolder+"/"+a).startsWith("/")||(a="/"+a);let o=[],n=0;const r=1150;let i=!0,l=yield this.getFolderInfo(a,!0),s="";if(l)s=l.file_id;else{let e=yield this.createFolder(a);if(!e)return console.error("Failed to create folder:",a),[];s=e}if(!s)return console.error("Failed to get or create folder ID:",a),[];let d=s;for(;i;){const a={offset:n,limit:r,cur:1,show_dir:1};d&&(a.cid=d);const l=yield e.get(`${this.baseUrl}/open/ufile/files`,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},params:a});if(l.status>=300)break;const s=l.data.data||[];o=o.concat(s),s.length({name:e.fn,size:e.fs||0,type:"0"===e.fc?"folder":"file",modified:new Date(1e3*e.upt).toISOString()})))}catch(e){return console.error("Error occurred during file list:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{const t=this.config.access_token;a=this.baseFolder+"/"+a;const o=yield this.getFolderInfo(a,!1);if(!o)return!0;const n=new FormData;n.append("file_ids",o.file_id);const r=yield e.post(`${this.baseUrl}/open/ufile/delete`,n,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"multipart/form-data"}});return!(r.status>=300||!r.data.state)||(console.error("Error deleting file:",r),!1)}catch(e){return console.error("Error occurred during file delete:",e),!1}}))}}class X{constructor(e){let{username:a,password:t,url:o,dir:n,AuthType:r,createClient:i}=e;void 0===e.baseFolder?this.baseFolder="KoodoReader":this.baseFolder=e.baseFolder,n=n&&"KoodoReader"===this.baseFolder?n:this.baseFolder,this.username=a,this.password=t,this.url=o,this.dir=n,this.taskQueue=new b(5),this.AuthType=r,this.createClient=i}getClient(){return p(this,void 0,void 0,(function*(){return this.webdavClient||(this.url=yield this.handleUrlRedirection(this.url),this.webdavClient=this.createClient(this.url,{authType:this.AuthType.Password,username:this.username,password:this.password})),this.webdavClient}))}handleUrlRedirection(a){return p(this,void 0,void 0,(function*(){try{const t=yield e.head(a,{maxRedirects:0,validateStatus:()=>!0});return t.request&&t.request.responseURL&&t.request.responseURL!==a?t.request.responseURL:t.status>=300&&t.status<400&&t.headers.location?t.headers.location:a}catch(e){return console.info("Error handling URL redirection:",e),a}}))}retryOperation(e,a=1){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){const a=yield this.getClient();try{return(yield a.getDirectoryContents(this.dir+"/"+e)).filter((a=>"."!==a.filename&&".."!==a.filename&&a.filename!==e)).map((e=>({name:e.basename,size:e.size||0,type:"directory"===e.type?"folder":"file",modified:e.lastmod})))}catch(t){return t.response&&404===t.response.status&&(yield a.createDirectory(this.dir+"/"+e)),console.error("Error listing files:",t),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){const a=yield this.getClient();try{return yield a.deleteFile(this.dir+"/"+e),!0}catch(e){return console.error("Error deleting file:",e),!1}}))}ensureDirectoryExists(e){return p(this,void 0,void 0,(function*(){let a=yield this.getClient();try{const t=e.replace(/^\/+|\/+$/g,"").split("/").filter((e=>e.length>0));let o="";for(const e of t)o=o?`${o}/${e}`:e,(yield a.exists(`/${o}`))||(yield a.createDirectory(`/${o}`));return!0}catch(e){return console.error("Error ensuring directory exists:",e),!1}}))}}class Z extends X{constructor(e){super(Object.assign(Object.assign({},e),{AuthType:d,createClient:c}))}retryOperation(e,a=1){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{let o=this.dir+"/"+t,n=yield this.getClient();const r=n.exists(o.substring(0,o.lastIndexOf("/"))),i=new Promise(((e,a)=>{setTimeout((()=>a(new Error("WebDAV exists check timeout"))),5e3)}));!1===(yield Promise.race([r,i]))&&(yield this.ensureDirectoryExists(o.substring(0,o.lastIndexOf("/"))));let l=t.split("/").pop()||"",s=new File([a],l,{lastModified:(new Date).getTime(),type:a.type}),d=n.getFileUploadLink(this.dir+"/"+t);const c=new URL(d);c.search="",d=c.toString();const u=btoa(this.username+":"+this.password),m=yield e.put(d,s,{headers:{Authorization:"Basic "+u},maxContentLength:1/0,maxBodyLength:1/0});return!(m.status>=300)||(console.error("Error occurred during file upload:",m),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){if(this.taskQueue.setDownloadedSize(0),-1===a.indexOf("."))return new ArrayBuffer(0);try{const t=btoa(this.username+":"+this.password);let o=this.url.endsWith("/")?this.url:this.url+"/",n=this.dir.startsWith("/")?this.dir.substring(1):this.dir;const r=yield e({url:o+n+"/"+a,method:"get",headers:{Authorization:"Basic "+t},responseType:"arraybuffer",maxContentLength:1/0,maxBodyLength:1/0,onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return r.status>=300?(console.error("Error occurred during file download:",r),!1):r.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}class ee{constructor(e){this.username=e.username,this.password=e.password,this.url=e.url,this.taskQueue=new b(3)}retryOperation(e,a=1){return p(this,void 0,void 0,(function*(){let t=0;for(;;){const o=yield e();if(o)return o;if(t>=a)return this.taskQueue.hasFailedTasks=!0,this.taskQueue.clearQueue(),o;t++;const n=1e3*Math.pow(2,t);console.info(`Retry attempt ${t} after ${n}ms`),yield new Promise((e=>setTimeout(e,n)))}}))}listFiles(e){return p(this,void 0,void 0,(function*(){return(yield this.listFileInfos(e)).map((e=>e.name))}))}listFileInfos(a){return p(this,void 0,void 0,(function*(){try{return(yield e.get(`${this.url}/list`,{params:{dir:a},auth:{username:this.username,password:this.password}})).data.files.map((e=>({name:e.name,size:e.size||0,type:"file"===e.type?"file":"folder",modified:e.modifiedTime})))||[]}catch(e){return console.error("Error listing files:",e),[]}}))}deleteFile(e){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){return yield this.deleteFileWithoutQueue(e)}))))))}))}deleteFileWithoutQueue(a){return p(this,void 0,void 0,(function*(){try{return(yield e.delete(`${this.url}/delete`,{params:{dir:a.split("/").slice(0,-1).join("/")||"",filename:a.split("/").pop()},auth:{username:this.username,password:this.password}})).data.success}catch(e){return console.error("Error deleting file:",e),!1}}))}}class ae extends ee{constructor(e){super(e)}getAuthHeader(){return`Basic ${btoa(`${this.username}:${this.password}`)}`}uploadFile(a,t){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){try{const o=t.split("/").pop()||"",n=t.substring(0,t.lastIndexOf("/"))||"";let r=this.listFiles("");const i=new Promise(((e,a)=>{setTimeout((()=>a(new Error("Docker connection timeout"))),5e3)}));yield Promise.race([r,i]);let l=new File([a],o,{lastModified:(new Date).getTime(),type:a.type});const s=new FormData;s.append("file",l);const d=yield e.post(`${this.url}/upload?dir=${encodeURIComponent(n)}`,s,{headers:{Authorization:this.getAuthHeader(),"Content-Type":"multipart/form-data"},maxContentLength:1/0,maxBodyLength:1/0});return!(d.status>=300)||(console.error("Error occurred during file upload:",d),!1)}catch(e){return console.error("Error uploading file:",e),!1}}))))))}))}downloadFile(a){return p(this,void 0,void 0,(function*(){return this.taskQueue.addTask((()=>this.retryOperation((()=>p(this,void 0,void 0,(function*(){this.taskQueue.setDownloadedSize(0);try{const t=a.split("/").pop()||"",o=a.substring(0,a.lastIndexOf("/"))||"",n=yield e({url:`${this.url}/download`,method:"GET",params:{dir:o,filename:t},headers:{Authorization:this.getAuthHeader()},maxContentLength:1/0,maxBodyLength:1/0,responseType:"arraybuffer",onDownloadProgress:e=>{this.taskQueue.setDownloadedSize(e.loaded)}});return n.status>=300?(console.error("Error occurred during file download:",n),!1):n.data}catch(e){return console.error("Error occurred during file download:",e),!1}}))))))}))}}const te=["book","config","cover","font"];class oe{constructor(e,a){this.type=e,this.remote="dropbox"===e?new _(a):"microsoft"===e?new P(a):"google"===e?new B(a):"microsoft_exp"===e?new P(Object.assign(Object.assign({},a),{isExp:!0})):"google_exp"===e?new B(Object.assign(Object.assign({},a),{isExp:!0})):"s3compatible"===e?new Q(a):"webdav"===e?new Z(a):"docker"===e?new ae(a):"boxnet"===e?new R(a):"mega"===e?new z(a):"adrive"===e?new I(a):"pcloud"===e?new H(a):"dubox"===e?new G(a):"yandex"===e?new U(a):"yiyiwu"===e?new V(a):new j}downloadFile(e,a){return p(this,void 0,void 0,(function*(){if("cover"!==a){if(!(yield this.listFiles(a)).find((a=>e.indexOf(a)>-1)))return!1}return yield this.remote.downloadFile(a+"/"+e)}))}uploadFile(e,a,t){return p(this,void 0,void 0,(function*(){return 0===t.size||(yield this.remote.uploadFile(t,a+"/"+e))}))}deleteFile(e,a){return p(this,void 0,void 0,(function*(){return!(yield this.listFiles(a)).find((a=>e.indexOf(a)>-1))||(yield this.remote.deleteFile(a+"/"+e))}))}listFiles(e){return p(this,void 0,void 0,(function*(){return yield this.remote.listFiles(e)}))}listFileInfos(e){return p(this,void 0,void 0,(function*(){return yield this.remote.listFileInfos(e)}))}isExist(e,a){return p(this,void 0,void 0,(function*(){return(yield this.listFiles(a)).find((a=>-1!==a.indexOf(e)))}))}downloadAllFiles(){return p(this,void 0,void 0,(function*(){for(let e of te){let a=yield this.listFiles(e);for(let t of a)yield this.downloadFile(t,e)}}))}getAuthUrl(e){return this.remote.getAuthUrl?this.remote.getAuthUrl(e):""}getStats(){return this.remote.taskQueue.getStats()}clearQueue(){return this.remote.taskQueue.clearQueue()}resetCounters(){this.remote.taskQueue.resetCounters()}getDownloadedSize(){return this.remote.taskQueue.getDownloadedSize()}}const ne={words:['ALTER TABLE words ADD COLUMN "sentence" text']},re={notes:"SELECT * FROM notes WHERE key = ?",bookmarks:"SELECT * FROM bookmarks WHERE key = ?",books:"SELECT * FROM books WHERE key = ?",plugins:"SELECT * FROM plugins WHERE key = ?",words:"SELECT * FROM words WHERE key = ?"},ie={notes:"SELECT * FROM notes WHERE bookKey = ?",bookmarks:"SELECT * FROM bookmarks WHERE bookKey = ?",words:"SELECT * FROM words WHERE bookKey = ?",books:"SELECT * FROM books WHERE key = ?"},le={notes:"DELETE FROM notes WHERE bookKey = ?",bookmarks:"DELETE FROM bookmarks WHERE bookKey = ?",words:"DELETE FROM words WHERE bookKey = ?"};function se(e){for(const a in e)e.hasOwnProperty(a)&&(e[`temp-${a}`]=e[a]);return e}const de={notes:e=>{let a=Object.assign({},e);return a.date=JSON.parse(e.date),a.tag=JSON.parse(e.tag),a},bookmarks:e=>e,books:e=>e,plugins:e=>{let a=Object.assign({},e);return e.autoValue||delete a.autoValue,e.langList?a.langList=JSON.parse(e.langList):delete a.langList,e.voiceList?a.voiceList=JSON.parse(e.voiceList):delete a.voiceList,a.config=JSON.parse(e.config),a},words:e=>{let a=Object.assign({},e);return a.date=JSON.parse(e.date),void 0===a.sentence&&(a.sentence=""),a}};var ce={sqlStatement:{createTableStatement:se({notes:'\n CREATE TABLE IF NOT EXISTS "notes" (\n "key" text PRIMARY KEY,\n "bookKey" text,\n "date" object,\n "chapter" text,\n "chapterIndex" integer,\n "text" text,\n "cfi" text,\n "range" text,\n "notes" text,\n "percentage" text,\n "color" integer,\n "tag" array\n )\n ',bookmarks:'\n CREATE TABLE IF NOT EXISTS "bookmarks" (\n "key" text PRIMARY KEY,\n "bookKey" text,\n "cfi" text,\n "label" text,\n "percentage" text,\n "chapter" text\n );\n ',books:'\n CREATE TABLE IF NOT EXISTS "books" (\n "key" text PRIMARY KEY,\n "name" text,\n "author" text,\n "description" text,\n "md5" text,\n "cover" text,\n "format" text,\n "publisher" text,\n "size" integer,\n "page" integer,\n "path" text,\n "charset" text\n );\n ',plugins:'\n CREATE TABLE IF NOT EXISTS "plugins" (\n "key" text PRIMARY KEY,\n "type" text,\n "displayName" text,\n "icon" text,\n "version" text,\n "config" object,\n "autoValue" string,\n "langList" text,\n "voiceList" text,\n "scriptSHA256" text,\n "script" text\n );\n ',words:'\n CREATE TABLE IF NOT EXISTS "words" (\n "key" text PRIMARY KEY,\n "bookKey" text,\n "date" object,\n "word" text,\n "sentence" text,\n "chapter" text\n );\n '}),migrateStatement:se(ne),getAllStatement:se({notes:"SELECT * FROM notes",bookmarks:"SELECT * FROM bookmarks",books:"SELECT * FROM books",plugins:"SELECT * FROM plugins",words:"SELECT * FROM words"}),getPagedStatement:se({notes:"SELECT * FROM notes LIMIT ? OFFSET ?",bookmarks:"SELECT * FROM bookmarks LIMIT ? OFFSET ?",books:"SELECT * FROM books LIMIT ? OFFSET ?",plugins:"SELECT * FROM plugins LIMIT ? OFFSET ?",words:"SELECT * FROM words LIMIT ? OFFSET ?"}),getCountStatement:se({notes:"SELECT COUNT(*) as count FROM notes",bookmarks:"SELECT COUNT(*) as count FROM bookmarks",books:"SELECT COUNT(*) as count FROM books",plugins:"SELECT COUNT(*) as count FROM plugins",words:"SELECT COUNT(*) as count FROM words"}),saveStatement:se({notes:"INSERT OR REPLACE INTO notes (key, bookKey, chapter, chapterIndex, text, cfi, range, notes, date, percentage, color, tag) VALUES (@key, @bookKey, @chapter, @chapterIndex, @text, @cfi, @range, @notes, @date, @percentage, @color, @tag)",bookmarks:"INSERT OR REPLACE INTO bookmarks (key, bookKey, cfi, label, percentage, chapter) VALUES (@key, @bookKey, @cfi, @label, @percentage, @chapter)",books:"INSERT OR REPLACE INTO books (key, name, author, description, md5, cover, format, publisher, size, page, path, charset) VALUES (@key, @name, @author, @description, @md5, @cover, @format, @publisher, @size, @page, @path, @charset)",plugins:"INSERT OR REPLACE INTO plugins (key, type, displayName, icon, version, config, autoValue, langList, voiceList, scriptSHA256, script) VALUES (@key, @type, @displayName, @icon, @version, @config, @autoValue, @langList, @voiceList, @scriptSHA256, @script)",words:"INSERT OR REPLACE INTO words (key, bookKey, date, word, sentence, chapter) VALUES (@key, @bookKey, @date, @word, @sentence, @chapter)"}),deleteAllStatement:se({notes:"DELETE FROM notes",bookmarks:"DELETE FROM bookmarks",books:"DELETE FROM books",plugins:"DELETE FROM plugins",words:"DELETE FROM words"}),updateStatement:se({notes:"UPDATE notes SET bookKey = @bookKey, chapter = @chapter, chapterIndex = @chapterIndex, text = @text, cfi = @cfi, range = @range, notes = @notes, date = @date, percentage = @percentage, color = @color, tag = @tag WHERE key = @key",bookmarks:"UPDATE bookmarks SET bookKey = @bookKey, cfi = @cfi, label = @label, percentage = @percentage, chapter = @chapter WHERE key = @key",books:"UPDATE books SET name = @name, author = @author, description = @description, md5 = @md5, cover = @cover, format = @format, publisher = @publisher, size = @size, page = @page, path = @path, charset = @charset WHERE key = @key",plugins:"UPDATE plugins SET type = @type, displayName = @displayName, icon = @icon, version = @version, config = @config, autoValue = @autoValue, langList = @langList, voiceList = @voiceList, scriptSHA256 = @scriptSHA256, script = @script WHERE key = @key",words:"UPDATE words SET bookKey = @bookKey, date = @date, word = @word, sentence = @sentence, chapter = @chapter WHERE key = @key"}),deleteStatement:se({notes:"DELETE FROM notes WHERE key = ?",bookmarks:"DELETE FROM bookmarks WHERE key = ?",books:"DELETE FROM books WHERE key = ?",plugins:"DELETE FROM plugins WHERE key = ?",words:"DELETE FROM words WHERE key = ?"}),dropStatement:se({notes:"DROP TABLE IF EXISTS notes",bookmarks:"DROP TABLE IF EXISTS bookmarks",books:"DROP TABLE IF EXISTS books",plugins:"DROP TABLE IF EXISTS plugins",words:"DROP TABLE IF EXISTS words"}),getStatement:se(re),getByBookKeyStatement:se(ie),getByBookKeysStatement:se({notes:e=>`SELECT * FROM notes WHERE bookKey IN (${e.map((()=>"?")).join(",")})`,bookmarks:e=>`SELECT * FROM bookmarks WHERE bookKey IN (${e.map((()=>"?")).join(",")})`,words:e=>`SELECT * FROM words WHERE bookKey IN (${e.map((()=>"?")).join(",")})`,books:e=>`SELECT * FROM books WHERE key IN (${e.map((()=>"?")).join(",")})`}),getKeysStatement:se({notes:"SELECT key FROM notes",bookmarks:"SELECT key FROM bookmarks",books:"SELECT key FROM books",plugins:"SELECT key FROM plugins",words:"SELECT key FROM words"}),getWithSortAndPageStatement:se({notes:(e,a,t,o)=>`SELECT * FROM notes ORDER BY ${e} ${a} LIMIT ${t} OFFSET ${o}`,bookmarks:(e,a,t,o)=>`SELECT * FROM bookmarks ORDER BY ${e} ${a} LIMIT ${t} OFFSET ${o}`,books:(e,a,t,o)=>`SELECT * FROM books ORDER BY ${e} ${a} LIMIT ${t} OFFSET ${o}`,plugins:(e,a,t,o)=>`SELECT * FROM plugins ORDER BY ${e} ${a} LIMIT ${t} OFFSET ${o}`,words:(e,a,t,o)=>`SELECT * FROM words ORDER BY ${e} ${a} LIMIT ${t} OFFSET ${o}`}),getByKeysStatement:se({notes:e=>`SELECT * FROM notes WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,a)=>`WHEN ? THEN ${a}`)).join(" ")} END`,bookmarks:e=>`SELECT * FROM bookmarks WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,a)=>`WHEN ? THEN ${a}`)).join(" ")} END`,books:e=>`SELECT * FROM books WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,a)=>`WHEN ? THEN ${a}`)).join(" ")} END`,plugins:e=>`SELECT * FROM plugins WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,a)=>`WHEN ? THEN ${a}`)).join(" ")} END`,words:e=>`SELECT * FROM words WHERE key IN (${e.map((()=>"?")).join(",")}) ORDER BY CASE key ${e.map(((e,a)=>`WHEN ? THEN ${a}`)).join(" ")} END`}),deleteByBookKeyStatement:se(le)},jsonToSqlite:se({notes:e=>{let a=Object.assign({},e);return a.date=JSON.stringify(e.date),a.tag=JSON.stringify(e.tag),a},bookmarks:e=>e,books:e=>{let a=Object.assign({},e);return a.page=e.page||0,a},plugins:e=>{let a=Object.assign({},e);return e.autoValue||(a.autoValue=null),e.langList?a.langList=JSON.stringify(e.langList):a.langList=null,e.voiceList?a.voiceList=JSON.stringify(e.voiceList):a.voiceList=null,a.config=JSON.stringify(e.config),a},words:e=>{let a=Object.assign({},e);return a.date=JSON.stringify(e.date),void 0===a.sentence&&(a.sentence=""),a}}),sqliteToJson:se(de)};const ue=E.testUrl,me=E.cloudCNUrl;class pe{constructor(e,a,t){this.TokenService=e,this.ConfigService=a,this.baseUrl="china"===t?me:ue,this.serverRegion=t,this.refreshToken="",this.accessToken="",this.streamPromise=null,this.expiresAt=0}refreshUserToken(){return p(this,void 0,void 0,(function*(){if(this.refreshToken=yield this.TokenService.getToken("refresh_token"),!this.refreshToken)return{code:401,message:"refresh token not found"};let a=(yield e.post(this.baseUrl+"/api/v1/public/user/refresh_token",{refresh_token:this.refreshToken})).data;return 200===a.code&&(yield this.TokenService.setToken("access_token",a.data.access_token),yield this.TokenService.setToken("refresh_token",a.data.refresh_token),yield this.TokenService.setToken("expires_at",(1e3*a.data.expires_at).toString()),this.accessToken=a.data.access_token,this.refreshToken=a.data.refresh_token,this.expiresAt=1e3*a.data.expires_at),a}))}requestWithRetry(e){return p(this,void 0,void 0,(function*(){return pe.requestQueue||(pe.requestQueue=[]),new Promise(((a,t)=>{pe.requestQueue.push({config:e,resolve:a,reject:t}),pe.processingQueue||this.processQueue()}))}))}isTokenValid(){return p(this,void 0,void 0,(function*(){if(this.accessToken||(this.accessToken=(yield this.TokenService.getToken("access_token"))||""),!this.expiresAt){const e=yield this.TokenService.getToken("expires_at");this.expiresAt=e?parseInt(e):(new Date).getTime()+31536e9}return""!==this.accessToken&&this.expiresAt>(new Date).getTime()+6e4}))}processQueue(){return p(this,void 0,void 0,(function*(){if(!pe.processingQueue){pe.processingQueue=!0;try{for(;pe.requestQueue.length>0;){const e=pe.requestQueue.shift();try{let a=yield this.executeRequest(e.config);e.resolve(a)}catch(a){e.reject(a)}}}finally{pe.processingQueue=!1}}}))}executeRequest(a){return p(this,void 0,void 0,(function*(){try{(yield this.isTokenValid())||(yield this.refreshUserToken());let t="req-"+Date.now().toString(36)+"-"+Math.random().toString(36).substring(2,11);if(a.baseURL=this.baseUrl,a.headers)a.headers.Authorization="Bearer "+this.accessToken,a.headers["X-Request-ID"]=t;else{let e=this.ConfigService.getItem("appVersion"),o=this.ConfigService.getItem("appPlatform");a.headers={Authorization:"Bearer "+this.accessToken,"X-Request-ID":t,"X-App-Version":e||"1.0.0","X-App-Platform":o||"web"}}let o=(yield e(a)).data;if(402===o.code){let t=yield this.refreshUserToken();if(200===t.code){return a.headers=a.headers||{},a.headers.Authorization="Bearer "+this.accessToken,(yield e(a)).data}return t}return 200!==o.code&&console.error("Request error:",o),o}catch(e){return console.error("Request execution error:",e),"Network Error"===e.message?{code:503,message:"network error",data:null,msg:"Network error, please try again later. 网络错误,请稍后再试。"}:{code:500,message:e.message||"Unknown error",msg:e.message||"Unknown error",data:null}}}))}requestWithStream(e,a,t){return p(this,void 0,void 0,(function*(){return this.streamPromise||(this.streamPromise=(()=>p(this,void 0,void 0,(function*(){try{(yield this.isTokenValid())||(yield this.refreshUserToken());let o=this.accessToken||"",n="req-"+Date.now().toString(36)+"-"+Math.random().toString(36).substring(2,11);return new Promise(((r,i)=>{let l=this.ConfigService.getItem("appVersion"),s=this.ConfigService.getItem("appPlatform");const d=new t(this.baseUrl+e.url,{headers:{"Content-Type":"application/json",Authorization:"Bearer "+o,"X-Request-ID":n,"X-App-Version":l||"1.0.0","X-App-Platform":s||"web"},method:e.method,body:JSON.stringify(e.data),pollingInterval:0});d.addEventListener("open",(()=>{console.info("Connection to OpenAI established.")})),d.addEventListener("message",(e=>p(this,void 0,void 0,(function*(){if(!e.data)return;const t=JSON.parse(e.data);t.done?(d.close(),r(t)):a(t.data)})))),d.addEventListener("error",(e=>{if(console.info("Error:",e),!e.data)return;const a=JSON.parse(e.data);r(a),d.close()}))}))}finally{this.streamPromise=null}})))()),this.streamPromise}))}requestWithFetch(e,a){return p(this,void 0,void 0,(function*(){return this.streamPromise||(this.streamPromise=(()=>p(this,void 0,void 0,(function*(){try{(yield this.isTokenValid())||(yield this.refreshUserToken());let t=this.accessToken||"",o="req-"+Date.now().toString(36)+"-"+Math.random().toString(36).substring(2,11);return new Promise(((n,r)=>p(this,void 0,void 0,(function*(){let r=this.ConfigService.getItem("appVersion"),i=this.ConfigService.getItem("appPlatform");var l=new u(this.baseUrl+e.url,{headers:{"Content-Type":"text/plain",Authorization:"Bearer "+t,"X-Request-ID":o,"X-App-Version":r||"1.0.0","X-App-Platform":i||"web"},payload:JSON.stringify(e.data),method:"POST"});l.addEventListener("message",(e=>p(this,void 0,void 0,(function*(){if(!e.data)return;const t=JSON.parse(e.data);t.done?(l.close(),n(t)):a(t.data)})))),l.addEventListener("open",(e=>{console.info(e,"Connection to OpenAI established.")})),l.addEventListener("error",(e=>{if(console.error(e,"Error occurred while connecting to OpenAI"),!e.data)return;const a=JSON.parse(e.data);n(a),l.close()}))}))))}finally{this.streamPromise=null}})))()),this.streamPromise}))}}pe.processingQueue=!1,pe.requestQueue=[];class he extends pe{constructor(e,a,t){super(e,a,t)}getTransStream(e,a,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_trans_stream",data:e};return yield this.requestWithStream(o,a,t)}))}getTransFetch(e,a){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_llm_trans_stream",data:e};return yield this.requestWithFetch(t,a)}))}getDictionary(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/get_llm_dict",data:e};return yield this.requestWithRetry(a)}))}getBatchTrans(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/get_llm_batch_trans",data:e};return yield this.requestWithRetry(a)}))}getSplitSentence(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/get_llm_split_sentence",data:e};return yield this.requestWithRetry(a)}))}getAnswerStream(e,a,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_answer_stream",data:e};return yield this.requestWithStream(o,a,t)}))}getAnswerFetch(e,a){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_llm_answer_stream",data:e};return yield this.requestWithFetch(t,a)}))}getSummaryStream(e,a,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_sum_stream",data:e};return yield this.requestWithStream(o,a,t)}))}getSummaryFetch(e,a){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_llm_sum_stream",data:e};return yield this.requestWithFetch(t,a)}))}getDictionaryStream(e,a,t){return p(this,void 0,void 0,(function*(){const o={method:"post",url:"/api/v1/pro/reader/get_llm_dict_stream",data:e};return yield this.requestWithStream(o,a,t)}))}getDictionaryFetch(e,a){return p(this,void 0,void 0,(function*(){const t={method:"post",url:"/api/v1/pro/reader/get_llm_dict_stream",data:e};return yield this.requestWithFetch(t,a)}))}getGoogleFont(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/get_google_font",data:e};return yield this.requestWithRetry(a)}))}sendToKindle(e,a){return p(this,void 0,void 0,(function*(){let t=new FormData;t.append("file",e.file),t.append("email",e.email),t.append("file_name",e.fileName);const o={method:"post",url:"/api/v1/pro/reader/send_to_kindle",headers:{"Content-Type":"multipart/form-data"},data:t,onUploadProgress:a?t=>{var o;const n=t.total||(null===(o=e.file)||void 0===o?void 0:o.size)||0;n>0&&a(Math.min(t.loaded/n,1))}:void 0};return yield this.requestWithRetry(o)}))}detectLanguage(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/detect_language",data:e};return yield this.requestWithRetry(a)}))}getTTSAudio(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/get_tts_audio",data:e};return yield this.executeRequest(a)}))}getOcrResult(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/get_ocr_result",data:e};return yield this.executeRequest(a)}))}getOcrResultV2(e){return p(this,void 0,void 0,(function*(){let a=new FormData;a.append("file",e.file);const t={method:"post",url:"/api/v1/pro/reader/get_ocr_result_v2",headers:{"Content-Type":"multipart/form-data"},data:a};return yield this.executeRequest(t)}))}analyzeText(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/analyze_text",data:e};return yield this.requestWithRetry(a)}))}getBookMetadata(e){return p(this,void 0,void 0,(function*(){const a={method:"post",url:"/api/v1/pro/reader/get_book_metadata",data:e};return yield this.requestWithRetry(a)}))}}class ge extends pe{constructor(e,a,t){super(e,a,t),this.serverRegion=t}encryptToken(e){return p(this,void 0,void 0,(function*(){let a=e.token,t=v.encode(a),{extracted:o,remaining:n}=function(e){let a="",t="",o=[],n=1;for(;n<=e.length;)o.push(n-1),n*=2;for(let n=0;n-1){let t=a.split("#");e.encrypted_token=t[1]}const t={method:"post",url:"/api/v1/pro/thirdparty/decrypt_token",data:e};let o=yield this.requestWithRetry(t);if(a.indexOf("#")>-1&&o.data&&o.data.token){let e=a.split("#"),t=function(e,a){let t="",o=[],n=1,r=e.length+a.length;for(;n<=r;)o.push(n-1),n*=2;let i=0,l=0;for(let n=0;n{let o="";if("github"===e?o=`https://github.com/login/oauth/authorize?client_id=${C.githubClientId}&redirect_uri=${t}&scope=${T.github.scopes.join(" ")}&response_type=code`:"google"===e?o=`https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=${t}&prompt=consent&response_type=code&client_id=${C.googleClientId}&scope=${T.google.scopes.join(" ")}&access_type=offline`:"facebook"===e?o=`https://www.facebook.com/v12.0/dialog/oauth?client_id=${C.facebookClientId}&redirect_uri=${t}&scope=&response_type=code`:"microsoft"===e&&(o=`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${C.microsoftClientId}&scope=${T.microsoft.scopes.join(" ")}&response_type=code&redirect_uri=${t}`),"manual"===a)return o;let n=JSON.stringify({deeplink:"desktop"===a?"koodo-reader://callback":"browser"===a?`${C.callbackUrl}#/login`:"",service:e});return`${o}&state=${"state|"+encodeURIComponent(n)}`}};class Ne{static CompareDatabase(e,a,t){return p(this,void 0,void 0,(function*(){let o=Object.keys(e).filter((e=>e.startsWith("database.sqlite.books"))),n=Object.keys(e).filter((e=>e.startsWith("database.sqlite.notes"))),r=Object.keys(e).filter((e=>e.startsWith("database.sqlite.bookmarks"))),i=Object.keys(e).filter((e=>e.startsWith("database.sqlite.plugins"))),l=Object.keys(e).filter((e=>e.startsWith("database.sqlite.words"))),s=Object.keys(a).filter((e=>e.startsWith("database.sqlite.books"))),d=Object.keys(a).filter((e=>e.startsWith("database.sqlite.notes"))),c=Object.keys(a).filter((e=>e.startsWith("database.sqlite.bookmarks"))),u=Object.keys(a).filter((e=>e.startsWith("database.sqlite.plugins"))),m=Object.keys(a).filter((e=>e.startsWith("database.sqlite.words"))),p={books:Array.from(new Set(o.concat(s))),notes:Array.from(new Set(n.concat(d))),bookmarks:Array.from(new Set(r.concat(c))),plugins:Array.from(new Set(i.concat(u))),words:Array.from(new Set(l.concat(m)))},h={books:{save:[],update:[],delete:[],conflict:[],upload:[]},notes:{save:[],update:[],delete:[],conflict:[],upload:[]},bookmarks:{save:[],update:[],delete:[],conflict:[],upload:[]},plugins:{save:[],update:[],delete:[],conflict:[],upload:[]},words:{save:[],update:[],delete:[],conflict:[],upload:[]}},g=["books","notes","bookmarks","plugins","words"];for(let o of g)for(let n of p[o]){let r=n.split(".")[3],i=e[n],l=a[n];i?l?("save"===l.operation&&("update"!==i.operation&&"delete"!==i.operation||h[o].upload.push(r)),"delete"===l.operation&&("save"===i.operation&&(h[o].delete.push(r),e[n]=l),"update"===i.operation&&(i.timel.time&&(h[o].conflict.push(r),"cloud"===t?(h[o].delete.push(r),e[n]=l):h[o].upload.push(r))),i.operation),"update"===l.operation&&("save"===i.operation&&(h[o].update.push(r),e[n]=l),"update"===i.operation&&(i.timel.time&&h[o].upload.push(r)),"delete"===i.operation&&(i.timel.time&&h[o].upload.push(r)))):h[o].upload.push(r):(h[o].save.push(r),e[n]=l)}return{compareResult:h,syncRecords:e}}))}static CompareConfig(e,a,t){return p(this,void 0,void 0,(function*(){let o=Object.keys(e).filter((e=>e.startsWith("config.readerConfig"))),n=Object.keys(e).filter((e=>e.startsWith("config.listConfig"))),r=Object.keys(e).filter((e=>e.startsWith("config.objectConfig"))),i=Object.keys(e).filter((e=>e.startsWith("config.mapConfig"))),l=Object.keys(a).filter((e=>e.startsWith("config.readerConfig"))),s=Object.keys(a).filter((e=>e.startsWith("config.listConfig"))),d=Object.keys(a).filter((e=>e.startsWith("config.objectConfig"))),c=Object.keys(a).filter((e=>e.startsWith("config.mapConfig"))),u={readerConfig:Array.from(new Set(o.concat(l))),listConfig:Array.from(new Set(n.concat(s))),objectConfig:Array.from(new Set(r.concat(d))),mapConfig:Array.from(new Set(i.concat(c)))},m={readerConfig:{update:[],upload:[]},listConfig:{update:[],upload:[]},objectConfig:{update:[],delete:[],conflict:[],save:[],upload:[]},mapConfig:{update:[],delete:[],conflict:[],save:[],upload:[]}},p=["readerConfig","listConfig"];for(let t of p)for(let o of u[t]){let n=o,r=e[o],i=a[o];r?i?r.timei.time&&m[t].upload.push(n):m[t].upload.push(n):(m[t].update.push(n),e[o]=i)}let h=["objectConfig","mapConfig"];for(let o of h)for(let n of u[o]){let r=n,i=e[n],l=a[n];i?l?("delete"===l.operation&&("update"===i.operation&&(i.timel.time&&(m[o].conflict.push(r),"cloud"===t?(m[o].delete.push(r),e[n]=l):m[o].upload.push(r))),i.operation),"update"===l.operation&&("update"===i.operation&&(i.timel.time&&m[o].upload.push(r)),"delete"===i.operation&&(i.timel.time&&m[o].upload.push(r)))):m[o].upload.push(r):(m[o].update.push(r),e[n]=l)}return{compareResult:m,syncRecords:e}}))}static compareAll(e,a,t,o,n){return p(this,void 0,void 0,(function*(){let r="cloud";if("yes"===t.getReaderConfig("isKeepLocal")){r="local";let e=t.getObjectConfig(yield o.getFingerprint(),"cloudSyncTime",{time:0,conflictMode:"cloud"}),a=yield n.getCloudConfig("config"),i=JSON.parse(a.cloudSyncTime||"{}");delete i[yield o.getFingerprint()],Object.values(i).filter((a=>"local"===a.conflictMode&&a.time>e.time)).length>0&&(r="cloud")}let{compareResult:i,syncRecords:l}=yield this.CompareDatabase(e,a,r),{compareResult:s,syncRecords:d}=yield this.CompareConfig(l,a,r),c=Object.assign(Object.assign({},i),s);return t.setAllSyncRecord(d),"local"===r&&(c.books.conflict.length>0||c.notes.conflict.length>0||c.bookmarks.conflict.length>0||c.plugins.conflict.length>0||c.words.conflict.length>0||c.objectConfig.conflict.length>0||c.mapConfig.conflict.length>0)?t.setObjectConfig(yield o.getFingerprint(),{time:(new Date).getTime(),conflictMode:"local"},"cloudSyncTime"):t.setObjectConfig(yield o.getFingerprint(),{time:(new Date).getTime(),conflictMode:"cloud"},"cloudSyncTime"),c}))}static startSync(e,a,t,o,n,r){return p(this,void 0,void 0,(function*(){let i=yield this.syncConfig(e,a,t,n,r,o);if(e.books.save.length>0||e.books.upload.length>0){let e=yield this.syncCover(a,r,n),t=yield this.syncBook(a,n);return[...i,...e,...t]}return i}))}static syncConfig(e,a,t,o,n,r){return p(this,void 0,void 0,(function*(){let i=[];for(let a of g){if(e[a].save.length+e[a].update.length>0){let o=yield r.getCloudDatabase(a);for(let n of e[a].save){let e=o.find((e=>e.key===n));e&&(yield t.saveRecord(e,a))}for(let n of e[a].update){let e=o.find((e=>e.key===n));e&&(yield t.updateRecord(e,a,!1))}}if(e[a].delete.length>0)for(let r of e[a].delete)"books"===a&&(yield o.deleteOfflineBook(r),yield n.deleteOfflineCover(r)),yield t.deleteRecord(r,a);yield t.dumpDatabase(a,!0)}if(e.readerConfig.update.length>0||e.listConfig.update.length>0||e.objectConfig.update.length>0||e.mapConfig.update.length>0){let t=yield r.getCloudConfig("config");for(let o of e.readerConfig.update){let e=o.split(".")[3];t.readerConfig&&a.setReaderConfig(e,JSON.parse(t.readerConfig)[e],!1)}for(let o of e.listConfig.update){let e=o.split(".")[3];t[e]&&a.setAllListConfig(JSON.parse(t[e]),e,!1)}for(let o of e.objectConfig.update){let e=o.split(".")[3],n=o.split(".")[2];t[n]&&JSON.parse(t[n])&&JSON.parse(t[n])[e]&&a.setObjectConfig(e,JSON.parse(t[n])[e],n,!1)}for(let o of e.mapConfig.update){let e=o.split(".")[3],n=o.split(".")[2];if(t[n]&&JSON.parse(t[n])&&JSON.parse(t[n])[e]){let o=JSON.parse(t[n])[e];a.setOneMapConfig(e,o,n,!1)}}}if(e.objectConfig.delete.length>0||e.mapConfig.delete.length>0){for(let t of e.objectConfig.delete){let e=t.split(".")[3],o=t.split(".")[2];a.deleteObjectConfig(e,o)}for(let t of e.mapConfig.delete){let e=t.split(".")[3],o=t.split(".")[2];a.deleteMapConfig(e,o)}}for(let a of g)e[a].upload.length>0&&i.push((()=>r.uploadDatabase(a)));return i.push((()=>r.uploadConfig("config"))),i.push((()=>r.uploadConfig("sync"))),i}))}static syncCover(e,a,t){return p(this,void 0,void 0,(function*(){let t=yield a.getLocalCoverList(),o=yield a.getCloudCoverList(),n=Array.from(new Set([...t,...o])),r=[];for(let i of n)t.includes(i)&&!o.includes(i)&&r.push((()=>a.uploadCover(i))),!t.includes(i)&&o.includes(i)&&"adrive"!==e.getItem("defaultSyncOption")&&r.push((()=>a.downloadCover(i)));return r}))}static syncBook(e,a){return p(this,void 0,void 0,(function*(){let t=yield a.getLocalBookList(),o=yield a.getCloudBookList(),n=[],r=Array.from(new Set([...t,...o]));for(let i of r){if(t.includes(i)&&!o.includes(i)){let e=i.split(".")[0],t=i.split(".")[1];n.push((()=>a.uploadBook(e,t)))}let r="yes"===e.getReaderConfig("autoOffline");if(!t.includes(i)&&o.includes(i)&&r&&"adrive"!==e.getItem("defaultSyncOption")){let e=i.split(".")[0],t=i.split(".")[1]||"epub";n.push((()=>a.offlineBook(e,t.toUpperCase())))}}return n}))}static runTasksWithLimit(e,a,t){return p(this,void 0,void 0,(function*(){if("ftp"!==t&&"adrive"!==t){const t=[],o=[];for(const n of e){const e=n().then((a=>(o.splice(o.indexOf(e),1),a)));t.push(e),o.push(e),o.length>=a&&(yield Promise.race(o))}return Promise.all(t)}for(let a of e)yield a()}))}}class ve{constructor(e,a){this.bookKey="",this.sessionStart=0,this.unregisterUnload=null,this.configService=e,this.platform=a}getDailySeconds(e,a){const t=((this.configService.getAllMapConfig("readingStats")||{})[a]||[]).find((a=>a.startsWith(e+"-")));if(!t)return 0;const o=t.split("-");return parseInt(o[o.length-1],10)||0}setDailySeconds(e,a,t){const o=(this.configService.getAllMapConfig("readingStats")||{})[a]||[],n=`${e}-${t}`,r=o.filter((a=>!a.startsWith(e+"-")));this.configService.setOneMapConfig(a,[...r,n],"readingStats")}start(e){this.bookKey=e,this.sessionStart=Date.now(),this.unregisterUnload=this.platform.registerUnloadHandler((()=>{var e,a;this.commit(),null===(a=(e=this.platform).onBeforeClose)||void 0===a||a.call(e)}))}stop(){var e;this.commit(),null===(e=this.unregisterUnload)||void 0===e||e.call(this),this.unregisterUnload=null,this.bookKey="",this.sessionStart=0}commit(){if(!this.bookKey||!this.sessionStart)return;const e=Date.now()-this.sessionStart;if(e<1e3)return void(this.sessionStart=0);const a=Math.round(e/1e3);this.sessionStart=0;const t=this.configService.getObjectConfig(this.bookKey,"readingTime",0);this.configService.setObjectConfig(this.bookKey,t+a,"readingTime");const o=function(){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}(),n=this.getDailySeconds(this.bookKey,o);this.setDailySeconds(this.bookKey,o,n+a)}getTotalSeconds(e){return this.configService.getObjectConfig(e,"readingTime",0)}getDailySecondsForBook(e,a){return this.getDailySeconds(e,a)}getDayStats(e){return((this.configService.getAllMapConfig("readingStats")||{})[e]||[]).map((e=>{const a=e.lastIndexOf("-");return{bookKey:e.substring(0,a),seconds:parseInt(e.substring(a+1),10)||0}}))}getAllDates(){const e=this.configService.getAllMapConfig("readingStats");return Object.keys(e||{})}}const ke="Koodo Reader",be="application/vnd.koreader.v1+json";class Se extends Error{constructor(e,a,t,o){super(e),this.name="KOReaderRequestError",this.status=a,this.code=t,this.body=o}}const Ee=e=>{const a=(e||"").trim();if(!a)return"";return(/^https?:\/\//i.test(a)?a:`https://${a}`).replace(/\/+$/,"")},Ce=e=>{const a="number"==typeof e?e:parseFloat((e||"0")+"");return!isFinite(a)||isNaN(a)?0:a>1&&a<=100?Math.min(Math.max(a/100,0),1):Math.min(Math.max(a,0),1)},Te=(e,a={})=>p(void 0,void 0,void 0,(function*(){const t=yield fetch(e,a);return t.ok||(yield(e=>p(void 0,void 0,void 0,(function*(){let a=null;try{a=yield e.json()}catch(t){try{a=yield e.text()}catch(e){a=null}}const t=(null==a?void 0:a.message)||(null==a?void 0:a.error)||(null==a?void 0:a.msg)||("string"==typeof a?a:"")||e.statusText||"Request failed";throw console.error(`[KOReader] HTTP ${e.status} error: ${t}`,null!=a?a:"(no body)"),new Se(t,e.status,null==a?void 0:a.code,a)})))(t)),204===t.status?{}:yield t.json()})),we=e=>({Accept:be,"Content-Type":"application/json","x-auth-user":e.username,"x-auth-key":e.passwordHash});class Ae{constructor(e,a,t){this.getKOReaderSyncConfig=()=>{let e;try{e=this.ConfigService.getObjectConfig("koReaderSyncConfig","thirdpartyToken",{})}catch(e){return console.error("[KOReader] Failed to read koReaderSyncConfig:",e),null}if(!e||"object"!=typeof e)return console.error("[KOReader] koReaderSyncConfig is missing or invalid"),null;const a=Ee(e.serverUrl||""),t=(e.username||"").trim(),o=(e.passwordHash||"").trim();return a&&t&&o?{serverUrl:a,username:t,passwordHash:o}:(console.error("[KOReader] Incomplete config — missing fields"),null)},this.getLocalRecordLocation=e=>this.ConfigService.getObjectConfig(e,"recordLocation",{})||{},this.persistKOReaderMetadata=(e,a,t)=>{const o=Object.assign(Object.assign({},a),{percentage:t.percentage.toString(),xpath:t.progress,timestamp:t.timestamp||parseInt(Date.now()/1e3+"")});this.ConfigService.setObjectConfig(e,o,"recordLocation")},this.authUser=e=>p(this,void 0,void 0,(function*(){return yield Te(`${e.serverUrl}/users/auth`,{method:"GET",headers:we(e)})})),this.createUser=e=>p(this,void 0,void 0,(function*(){return yield Te(`${e.serverUrl}/users/create`,{method:"POST",headers:{Accept:be,"Content-Type":"application/json"},body:JSON.stringify({username:e.username,password:e.passwordHash})})})),this.getBookProgress=(e,a)=>p(this,void 0,void 0,(function*(){const t=yield Te(`${e.serverUrl}/syncs/progress/${encodeURIComponent(a)}`,{method:"GET",headers:we(e)});return t&&0!==Object.keys(t).length?{document:a,percentage:Ce(t.percentage),progress:t.progress||"",device:t.device||"",device_id:t.device_id||"",timestamp:t.timestamp||0}:null})),this.updateBookProgress=(e,a)=>p(this,void 0,void 0,(function*(){yield Te(`${e.serverUrl}/syncs/progress`,{method:"PUT",headers:we(e),body:JSON.stringify({document:a.document,percentage:a.percentage,progress:a.progress,device:a.device||ke,device_id:a.device_id||"",timestamp:a.timestamp||parseInt(Date.now()/1e3+"")})})})),this.buildLocalUploadPayload=(e,a,t,o)=>p(this,void 0,void 0,(function*(){const n=Ce(a.percentage),r=a.xpath||"",i=this.ConfigService.getObjectConfig(e.key,"koreaderBooks",{});if(!i.document){let a=yield o(e);if(!a)return console.error(`[KOReader] Cannot build upload payload for "${e.name}": failed to compute partial MD5`),null;i.document=a,this.ConfigService.setObjectConfig(e.key,i,"koreaderBooks")}return r?{document:i.document,percentage:n,progress:r,device:ke,device_id:t,timestamp:a.timestamp||parseInt(Date.now()/1e3+"")}:(console.error(`[KOReader] Cannot build upload payload for "${e.name}": no xpath/progress recorded (localRecord.xpath is empty)`),null)})),this.resolveDeviceId=()=>p(this,void 0,void 0,(function*(){try{return(yield this.TokenService.getFingerprint())||"koodo-reader"}catch(e){return console.error("[KOReader] Failed to get device fingerprint, using fallback ID:",e),"koodo-reader"}})),this.verifyAndBuildKOReaderSyncConfig=e=>p(this,void 0,void 0,(function*(){const a={serverUrl:Ee(e.serverUrl),username:(e.username||"").trim(),passwordHash:(e.password||"").trim()?s.MD5((e.password||"").trim()).toString():(e.passwordHash||"").trim()};if(!a.serverUrl||!a.username||!a.passwordHash)throw new Error("Please fill in all fields");try{return yield this.authUser(a),a}catch(e){console.error(`[KOReader] Auth failed for user "${a.username}" at ${a.serverUrl}, attempting to create user:`,e);try{return yield this.createUser(a),yield this.authUser(a),a}catch(o){if((t=o)instanceof Se&&(2002===t.code||(t.message||"").toLowerCase().includes("already exists")))throw console.error(`[KOReader] User "${a.username}" already exists but auth failed. Original auth error:`,e),e;throw console.error(`[KOReader] Failed to create user "${a.username}":`,o),o}}var t})),this.syncKOReaderProgress=e=>p(this,void 0,void 0,(function*(){const a=this.getKOReaderSyncConfig();if(!a)throw new Error("Please configure the KOReader sync server first");yield this.authUser(a);const t=yield this.resolveDeviceId(),o=(yield this.DatabaseService.getAllRecords("books"))||[],n={checkedBooks:0,matchedBooks:0,pulledBooks:0,pushedBooks:0,skippedBooks:0};for(const r of o)try{n.checkedBooks++;const o=this.getLocalRecordLocation(r.key);if(!o||!o.xpath){console.error(`[KOReader] Skipping "${r.name}": no local reading progress (xpath) found`),n.skippedBooks++;continue}const i=this.ConfigService.getObjectConfig(r.key,"koreaderBooks",{});if(!i.document){let a=yield e(r);if(!a){console.error(`[KOReader] Skipping "${r.name}": failed to compute partial MD5 for document ID`),n.skippedBooks++;continue}i.document=a,this.ConfigService.setObjectConfig(r.key,i,"koreaderBooks")}let l=i.document;const s=yield this.getBookProgress(a,l),d=(null==s?void 0:s.timestamp)||0,c=o.timestamp||0;if(s){if(n.matchedBooks++,d>c)this.persistKOReaderMetadata(r.key,o,s),n.pulledBooks++;else{if(!(d{if("number"!=typeof e){const[a,t]=e.split("-");return{styleType:a,color:t}}if(e>=0&&e-1,t=parseInt(xe[e].split("-")[1]);return{styleType:a?"background":"underline",color:a?Ie[t]:Fe[t]}}return{styleType:"background",color:"#FEF3CD"}},this.formatHighlightValue=e=>`${e.styleType}-${e.color}`,this.getNoteHighlightString=()=>this.ConfigService.getReaderConfig(Ue)||"background-#FEF3CD",this.getNoteHighlightValue=()=>{const e=this.getNoteHighlightString();if(!e)return Me;const[a,t]=e.split("-");return{styleType:a,color:t}},this.saveNoteHighlightValue=e=>{this.ConfigService.setReaderConfig(Ue,`${e.styleType}-${e.color}`)},this.getTtsHighlightString=()=>this.ConfigService.getReaderConfig(_e)||Re,this.getTtsHighlightValue=()=>{const e=this.getTtsHighlightString();if(!e)return $e;const[a,t]=e.split("-");return{styleType:a,color:t}},this.saveTtsHighlightValue=e=>{this.ConfigService.setReaderConfig(_e,`${e.styleType}-${e.color}`)},this.getSearchHighlightString=()=>this.ConfigService.getReaderConfig(Oe)||Re,this.getSearchHighlightValue=()=>{const e=this.ConfigService.getReaderConfig(Oe);if(!e)return $e;const[a,t]=e.split("-");return{styleType:a,color:t}},this.saveSearchHighlightValue=e=>{this.ConfigService.setReaderConfig(Oe,`${e.styleType}-${e.color}`)},this.buildHighlightStyleForType=(e,a,t)=>{let o="background",n="#FEF3CD";if("number"==typeof e){if(e>=0&&e-1,t=parseInt(xe[e].split("-")[1]);o=a?"background":"underline",n=a?Ie[t]:Fe[t]}}else o=e.split("-")[0],n=e.split("-")[1];const r="background"===o?((e,a)=>{const t=e.replace("#",""),o=3===t.length?t.split("").map((e=>e+e)).join(""):t;return 6!==o.length?e:`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${a})`})(n,.8):n;switch(o){case"background":return a?`background: ${r}; mix-blend-mode: multiply;`:`background: ${r};`;case"underline":return t?`border-right: 2px solid ${r};`:`border-bottom: 2px solid ${r};`;case"strikethrough":return a?t?`background: linear-gradient(to right, transparent calc(50% - 1px), ${r} calc(50% - 1px), ${r} calc(50% + 1px), transparent calc(50% + 1px));`:`background: linear-gradient(transparent calc(50% - 1px), ${r} calc(50% - 1px), ${r} calc(50% + 1px), transparent calc(50% + 1px));`:`text-decoration: line-through; text-decoration-color: ${r};`;case"wavy":if(a){const e=n.replace("#","%23");if(t){return`background-image: ${`url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='3' height='6'%3E%3Cpath d='M2 0 Q0 1.5 2 3 Q4 4.5 2 6' fill='none' stroke='${e}' stroke-width='1.5'%2F%3E%3C%2Fsvg%3E")`}; background-repeat: repeat-y; background-position: right; background-size: 3px 6px;`}return`background-image: ${`url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='6' height='3'%3E%3Cpath d='M0 2 Q1.5 0 3 2 Q4.5 4 6 2' fill='none' stroke='${e}' stroke-width='1.5'%2F%3E%3C%2Fsvg%3E")`}; background-repeat: repeat-x; background-position: bottom; background-size: 6px 3px;`}return`text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: ${r}; text-decoration-thickness: 2px; text-decoration-skip-ink: none;`;default:return`background: ${r};`}},this.buildHighlightPreviewStyle=(e,a)=>{switch(e){case"background":default:return{background:a};case"underline":return{borderBottom:`2px solid ${a}`};case"strikethrough":return{textDecoration:"line-through",textDecorationColor:a};case"wavy":return{textDecorationLine:"underline",textDecorationStyle:"wavy",textDecorationColor:a,textDecorationThickness:"2px",textDecorationSkipInk:"none"}}},this.convertNumberToHighlightValue=e=>this.getHighlightValue(e),this.buildTtsHighlightStyle=(e,a)=>this.buildHighlightStyleForType(this.getTtsHighlightString(),e,a),this.buildTtsHighlightPreviewStyle=(e,a)=>this.buildHighlightPreviewStyle(e,a),this.buildSearchHighlightStyle=(e,a)=>this.buildHighlightStyleForType(this.getSearchHighlightString(),e,a),this.buildSearchHighlightPreviewStyle=(e,a)=>this.buildHighlightPreviewStyle(e,a),this.ConfigService=e}}const Le=(ze=class{static getItem(e){return localStorage.getItem(e)}static setItem(e,a){localStorage.setItem(e,a)}static removeItem(e){localStorage.removeItem(e)}},De="browser",class extends ze{static getReaderConfig(e){return w.includes(e)&&"undefined"!=typeof window&&window.currentBookKey&&this.getAllListConfig("seperateStyleBooks").includes(window.currentBookKey)?this.getObjectConfig(window.currentBookKey,"seperateStyleConfig",{})[e]:JSON.parse(this.getItem("readerConfig")||"{}")[e]}static setReaderConfig(e,a,t=!0){if(w.includes(e)&&"undefined"!=typeof window&&window.currentBookKey&&this.getAllListConfig("seperateStyleBooks").includes(window.currentBookKey)){let o=this.getObjectConfig(window.currentBookKey,"seperateStyleConfig",{});return o[e]=a,void this.setObjectConfig(window.currentBookKey,o,"seperateStyleConfig",t)}let o=JSON.parse(this.getItem("readerConfig")||"{}");o[e]=a,this.setItem("readerConfig",JSON.stringify(o)),t&&this.setSyncRecord({type:"config",catergory:"readerConfig",name:De,key:e},{operation:"update",time:Date.now()})}static getAllListConfig(e){return("{}"!==this.getItem(e)&&this.getItem(e)?JSON.parse(this.getItem(e)||""):[])||[]}static deleteListConfig(e,a){let t=this.getAllListConfig(a);const o=t.indexOf(e);o>-1&&t.splice(o,1),this.setAllListConfig(t,a)}static setListConfig(e,a){let t=this.getAllListConfig(a);const o=t.indexOf(e);o>-1?(t.splice(o,1),t.unshift(e)):t.unshift(e),this.setAllListConfig(t,a)}static setAllListConfig(e,a,t=!0){this.setItem(a,JSON.stringify(e)),t&&this.setSyncRecord({type:"config",catergory:"listConfig",name:"general",key:a},{operation:"update",time:Date.now()})}static setObjectConfig(e,a,t,o=!0){let n=this.getAllObjectConfig(t);n[e]=a,o&&this.setSyncRecord({type:"config",catergory:"objectConfig",name:t,key:e},{operation:"update",time:Date.now()}),this.setAllObjectConfig(n,t)}static getObjectConfig(e,a,t){return this.getAllObjectConfig(a)[e]||t}static getAllObjectConfig(e){let a=this.getItem(e);return JSON.parse(a)||{}}static setAllObjectConfig(e,a){this.setItem(a,JSON.stringify(e))}static deleteObjectConfig(e,a){let t=this.getAllObjectConfig(a);delete t[e],this.setSyncRecord({type:"config",catergory:"objectConfig",name:a,key:e},{operation:"delete",time:Date.now()}),this.setAllObjectConfig(t,a)}static getAllMapConfig(e){let a=this.getItem(e);return JSON.parse(a)||{}}static getMapConfig(e,a){return this.getAllMapConfig(a)[e]||[]}static setAllMapConfig(e,a){this.setItem(a,JSON.stringify(e))}static setMapConfig(e,a,t){let o=this.getAllMapConfig(t);void 0===o[e]&&(o[e]=[]),a&&-1===o[e].indexOf(a)&&o[e].unshift(a),this.setSyncRecord({type:"config",catergory:"mapConfig",name:t,key:e},{operation:"update",time:Date.now()}),this.setAllMapConfig(o,t)}static setOneMapConfig(e,a,t,o=!0){let n=this.getAllMapConfig(t);n[e]=a,o&&this.setSyncRecord({type:"config",catergory:"mapConfig",name:t,key:e},{operation:"update",time:Date.now()}),this.setAllMapConfig(n,t)}static deleteFromMapConfig(e,a,t){let o=this.getAllMapConfig(t),n=o[e].indexOf(a);o[e].splice(n,1),this.setSyncRecord({type:"config",catergory:"mapConfig",name:t,key:e},{operation:"update",time:Date.now()}),this.setAllMapConfig(o,t)}static deleteFromAllMapConfig(e,a){let t=this.getAllMapConfig(a);Object.keys(t).forEach((o=>{let n=t[o].indexOf(e);n>-1&&(t[o].splice(n,1),this.setSyncRecord({type:"config",catergory:"mapConfig",name:a,key:o},{operation:"update",time:Date.now()}))})),this.setAllMapConfig(t,a)}static deleteMapConfig(e,a){let t=this.getAllMapConfig(a);delete t[e],this.setSyncRecord({type:"config",catergory:"mapConfig",name:a,key:e},{operation:"delete",time:Date.now()}),this.setAllMapConfig(t,a)}static getFromAllMapConfig(e,a){let t=this.getAllMapConfig(a),o=[];for(let a in t)t[a]&&t[a].indexOf(e)>-1&&o.push(a);return o}static getSyncRecord(e){return JSON.parse(this.getItem("syncRecord")||"{}")[e.type+"."+e.catergory+"."+e.name+"."+e.key]||{operation:"",time:0}}static getAllSyncRecord(){return JSON.parse(this.getItem("syncRecord")||"{}")}static setSyncRecord(e,a){const t=e.type+"."+e.catergory+"."+e.name+"."+e.key;let o=JSON.parse(this.getItem("syncRecord")||"{}");o[t]=a,this.setItem("syncRecord",JSON.stringify(o))}static setAllSyncRecord(e){this.setItem("syncRecord",JSON.stringify(e))}});var ze,De;let Pe;const je=new Uint8Array(16);function Ke(){if(!Pe&&(Pe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pe(je)}const He=[];for(let e=0;e<256;++e)He.push((e+256).toString(16).slice(1));var We={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Qe(e,a,t){if(We.randomUUID&&!a&&!e)return We.randomUUID();const o=(e=e||{}).random||(e.rng||Ke)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,a){t=t||0;for(let e=0;e<16;++e)a[t+e]=o[e];return a}return function(e,a=0){return He[e[a+0]]+He[e[a+1]]+He[e[a+2]]+He[e[a+3]]+"-"+He[e[a+4]]+He[e[a+5]]+"-"+He[e[a+6]]+He[e[a+7]]+"-"+He[e[a+8]]+He[e[a+9]]+"-"+He[e[a+10]]+He[e[a+11]]+He[e[a+12]]+He[e[a+13]]+He[e[a+14]]+He[e[a+15]]}(o)}class qe{static saveAllToken(e){return p(this,void 0,void 0,(function*(){if(e)if(m){const{ipcRenderer:a}=window.require("electron");a.invoke("encrypt-data",{token:e})}else{const a=yield this.encryptString(e);localStorage.setItem("encryptedToken",a)}}))}static getAllToken(){return p(this,void 0,void 0,(function*(){if(m){const{ipcRenderer:e}=window.require("electron");return yield e.invoke("decrypt-data")}{let e=localStorage.getItem("encryptedToken")||"";return e?yield this.decryptString(e):null}}))}static setToken(e,a){return p(this,void 0,void 0,(function*(){const t=JSON.parse((yield this.getAllToken())||"{}");t[e]=a,yield this.saveAllToken(JSON.stringify(t))}))}static getToken(e){return p(this,void 0,void 0,(function*(){return JSON.parse((yield this.getAllToken())||"{}")[e]||null}))}static deleteToken(e){return p(this,void 0,void 0,(function*(){const a=JSON.parse((yield this.getAllToken())||"{}");delete a[e],yield this.saveAllToken(JSON.stringify(a))}))}static encryptString(e){return p(this,void 0,void 0,(function*(){try{let a=yield this.getFingerprint();const t=yield Ye(a);return"undefined"!=typeof crypto&&crypto.subtle?yield function(e,a,t={alg:"HS256",typ:"JWT"}){return p(this,void 0,void 0,(function*(){const o=Je((new TextEncoder).encode(JSON.stringify(t))),n=Je((new TextEncoder).encode(JSON.stringify(e))),r=(new TextEncoder).encode(`${o}.${n}`),i=yield crypto.subtle.importKey("raw",(new TextEncoder).encode(a),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return`${o}.${n}.${Je(yield crypto.subtle.sign("HMAC",i,r))}`}))}(e,t):function(e,a){if(!e||!a)return"";const t=N((new TextEncoder).encode(a)),o=Array.from(new Uint8Array(t)),n=(new TextEncoder).encode(e),r=new Uint8Array(n.length);for(let e=0;enull));throw console.error(`[Notion] resolveDatabaseId failed for page ${a}: HTTP ${t.status} ${t.statusText}`,e),new Error(`Notion resolve database error: ${t.status} ${t.statusText}`)}const o=yield t.json(),n=(o.results||[]).find((e=>"child_database"===e.type));if(!n)throw console.error(`[Notion] No child_database block found under page ${a}. Available block types:`,(o.results||[]).map((e=>e.type))),new Error(`No child database found in page ${a}. Please provide a Database ID directly.`);return n.id}))}findOrCreatePage(e,a,t){return p(this,void 0,void 0,(function*(){const o=`${t}`,n=yield fetch(`https://api.notion.com/v1/databases/${a}/query`,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Notion-Version":"2022-06-28"},body:JSON.stringify({filter:{property:"title",title:{equals:o}}})});if(!n.ok){const o=yield n.json().catch((()=>({})));if(400===n.status&&"validation_error"===(null==o?void 0:o.code)&&"string"==typeof(null==o?void 0:o.message)&&o.message.includes("is a page, not a database")){console.error(`[Notion] Provided databaseId "${a}" is a page, not a database. Resolving child database...`);const o=yield this.resolveDatabaseId(e,a);return this.findOrCreatePage(e,o,t)}throw console.error(`[Notion] Database query failed for databaseId "${a}" (book: "${t}"): HTTP ${n.status} ${n.statusText}`,o),new Error(`Notion API error: ${n.status} ${n.statusText}`)}const r=yield n.json();if(r.results&&r.results.length>0)return r.results[0].id;const i=yield fetch("https://api.notion.com/v1/pages",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Notion-Version":"2022-06-28"},body:JSON.stringify({parent:{database_id:a},properties:{title:{title:[{text:{content:o}}]}}})});if(!i.ok){const e=yield i.json().catch((()=>null));throw console.error(`[Notion] Failed to create page for book "${t}" in database "${a}": HTTP ${i.status} ${i.statusText}`,e),new Error(`Notion create page error: ${i.status} ${i.statusText}`)}return(yield i.json()).id}))}appendBlocks(e,a,t,o){return p(this,void 0,void 0,(function*(){const n=!t.notes||0===t.notes.length,r=[];r.push({object:"block",type:"divider",divider:{}}),o&&r.push({object:"block",type:"heading_3",heading_3:{rich_text:[{type:"text",text:{content:o}}]}}),r.push({object:"block",type:"quote",quote:{rich_text:[{type:"text",text:{content:t.text||""}}]}}),!n&&t.notes&&r.push({object:"block",type:"paragraph",paragraph:{rich_text:[{type:"text",text:{content:`📝 ${t.notes}`}}]}});const i=`${t.date.year}-${String(t.date.month).padStart(2,"0")}-${String(t.date.day).padStart(2,"0")}`;r.push({object:"block",type:"paragraph",paragraph:{rich_text:[{type:"text",text:{content:`Added on ${i}`},annotations:{italic:!0,color:"gray"}}]}});const l=yield fetch(`https://api.notion.com/v1/blocks/${a}/children`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json","Notion-Version":"2022-06-28"},body:JSON.stringify({children:r})});if(!l.ok){const e=yield l.json().catch((()=>null));throw console.error(`[Notion] Failed to append blocks to page ${a}: HTTP ${l.status} ${l.statusText}`,e),new Error(`Notion append blocks error: ${l.status} ${l.statusText}`)}}))}syncNote(e,a){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const t=this.getConfig();if(!t)return!1;try{const o=yield this.findOrCreatePage(t.token,t.databaseId,a);return yield this.appendBlocks(t.token,o,e,e.chapter||""),!0}catch(e){return console.error(`[Notion] Sync failed for book "${a}":`,e instanceof Error?e.message:e),!1}}))}}class Xe{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("yuqueSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[Yuque] yuqueSyncConfig is empty or not set"),null):e}catch(e){return console.error("[Yuque] Failed to read yuqueSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableYuqueSync")}findOrCreateDoc(e,a,t){return p(this,void 0,void 0,(function*(){const o=`${t}`,n=`koodo-reader-${t.replace(/[^a-zA-Z0-9\u4e00-\u9fa5]/g,"-").replace(/-+/g,"-").toLowerCase().substring(0,50)}`;try{const t=yield fetch(`${Xe.API_BASE}/repos/${a}/docs/${n}`,{method:"GET",headers:{"X-Auth-Token":e,"Content-Type":"application/json"}});if(t.ok){const e=yield t.json();return{id:e.data.id,slug:e.data.slug,body:e.data.body||""}}if(404!==t.status){const e=yield t.json().catch((()=>null));console.error(`[Yuque] Unexpected error fetching doc "${n}" in repo "${a}": HTTP ${t.status} ${t.statusText}`,e)}}catch(e){console.error(`[Yuque] Network error fetching doc "${n}" in repo "${a}":`,e)}const r=yield fetch(`${Xe.API_BASE}/repos/${a}/docs`,{method:"POST",headers:{"X-Auth-Token":e,"Content-Type":"application/json"},body:JSON.stringify({title:o,slug:n,body:`# ${o}\n\n`,format:"markdown"})});if(!r.ok){const e=yield r.json().catch((()=>null));throw console.error(`[Yuque] Failed to create doc "${o}" in repo "${a}": HTTP ${r.status} ${r.statusText}`,e),new Error(`Yuque create doc error: ${r.status} ${r.statusText}`)}const i=yield r.json();return{id:i.data.id,slug:i.data.slug,body:i.data.body||""}}))}formatNoteMarkdown(e){const a=!e.notes||0===e.notes.length,t=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let o="\n---\n\n";return e.chapter&&(o+=`### ${e.chapter}\n\n`),o+=`> ${e.text||""}\n\n`,!a&&e.notes&&(o+=`📝 ${e.notes}\n\n`),o+=`*Added on ${t}*\n\n`,o}updateDoc(e,a,t,o){return p(this,void 0,void 0,(function*(){const n=yield fetch(`${Xe.API_BASE}/repos/${a}/docs/${t}`,{method:"PUT",headers:{"X-Auth-Token":e,"Content-Type":"application/json"},body:JSON.stringify({body:o,format:"markdown"})});if(!n.ok){const e=yield n.json().catch((()=>null));throw console.error(`[Yuque] Failed to update doc ${t} in repo "${a}": HTTP ${n.status} ${n.statusText}`,e),new Error(`Yuque update doc error: ${n.status} ${n.statusText}`)}}))}syncNote(e,a){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const t=this.getConfig();if(!t)return!1;try{const o=yield this.findOrCreateDoc(t.token,t.namespace,a),n=this.formatNoteMarkdown(e),r=o.body+n;return yield this.updateDoc(t.token,t.namespace,o.id,r),!0}catch(e){return console.error(`[Yuque] Sync failed for book "${a}":`,e instanceof Error?e.message:e),!1}}))}}Xe.API_BASE="https://www.yuque.com/api/v2";class Ze{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("readwiseSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[Readwise] readwiseSyncConfig is empty or not set"),null):e}catch(e){return console.error("[Readwise] Failed to read readwiseSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableReadwiseSync")}syncNote(e,a,t){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const o=this.getConfig();if(!o)return!1;const n=`${a}`,r=!e.notes||0===e.notes.length,i={text:e.text||"",title:n,author:t||"Unknown",source_type:"koodo-reader",category:"books",highlighted_at:`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`};if(!r&&e.notes&&(i.note=e.notes),e.chapter){const a=parseInt(e.chapter,10);isNaN(a)||(i.location_type="order",i.location=a)}try{const e=yield fetch(`${Ze.API_BASE}/highlights/`,{method:"POST",headers:{Authorization:`Token ${o.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify({highlights:[i]})});if(!e.ok){const a=yield e.json().catch((()=>null));throw console.error(`[Readwise] Failed to sync highlight for book "${n}": HTTP ${e.status} ${e.statusText}`,a),new Error(`Readwise API error: ${e.status} ${e.statusText}`)}return!0}catch(a){return console.error(`[Readwise] Sync failed for book "${n}" (text: "${(e.text||"").substring(0,50)}..."):`,a instanceof Error?a.message:a),!1}}))}}Ze.API_BASE="https://readwise.io/api/v2";class ea{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("imaSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[IMA] imaSyncConfig is empty or not set"),null):e}catch(e){return console.error("[IMA] Failed to read imaSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableImaSync")}getHeaders(e){return{"Content-Type":"application/json","ima-openapi-clientid":e.clientId,"ima-openapi-apikey":e.apiKey}}formatNoteMarkdown(e,a,t){const o=!e.notes||0===e.notes.length,n=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let r="\n---\n\n";return e.chapter&&(r+=`### ${e.chapter}\n\n`),r+=`> ${e.text||""}\n\n`,!o&&e.notes&&(r+=`**Note:** ${e.notes}\n\n`),r+=`*${n}*\n`,r}findNoteByTitle(e,a){var t,o,n,r;return p(this,void 0,void 0,(function*(){try{const i=JSON.stringify({search_type:0,query_info:{title:a},start:0,end:20}),l=yield fetch(`${ea.API_BASE}/search_note`,{method:"POST",headers:this.getHeaders(e),body:i});if(!l.ok){const e=yield l.json().catch((()=>null));return console.error(`[IMA] search_note failed for title "${a}": HTTP ${l.status} ${l.statusText}`,e),null}const s=yield l.json();if(0!==s.code)return console.error(`[IMA] search_note returned error code ${s.code} for title "${a}":`,null!==(t=s.msg)&&void 0!==t?t:s),null;const d=((null===(o=s.data)||void 0===o?void 0:o.search_note_infos)||[]).find((e=>{var t;return a.includes(null===(t=e.note_book_info)||void 0===t?void 0:t.title.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu,""))}));return null!==(r=null===(n=null==d?void 0:d.note_book_info)||void 0===n?void 0:n.note_id)&&void 0!==r?r:null}catch(e){return console.error(`[IMA] Network error in search_note for title "${a}":`,e),null}}))}createNote(e,a,t){var o,n,r;return p(this,void 0,void 0,(function*(){try{const i={content_format:1,content:`# ${a}\n\n${t}`};e.folderId&&(i.folder_id=e.folderId);const l=yield fetch(`${ea.API_BASE}/import_doc`,{method:"POST",headers:this.getHeaders(e),body:JSON.stringify(i)});if(!l.ok){const e=yield l.json().catch((()=>null));return console.error(`[IMA] import_doc failed for note "${a}": HTTP ${l.status} ${l.statusText}`,e),null}const s=yield l.json();return 0!==s.code?(console.error(`[IMA] import_doc returned error code ${s.code} for note "${a}":`,null!==(o=s.msg)&&void 0!==o?o:s),null):null!==(r=null===(n=s.data)||void 0===n?void 0:n.note_id)&&void 0!==r?r:null}catch(e){return console.error(`[IMA] Network error in import_doc for note "${a}":`,e),null}}))}appendNote(e,a,t){var o;return p(this,void 0,void 0,(function*(){try{const n=yield fetch(`${ea.API_BASE}/append_doc`,{method:"POST",headers:this.getHeaders(e),body:JSON.stringify({note_id:a,content_format:1,content:t})});if(!n.ok){const e=yield n.json().catch((()=>null));return console.error(`[IMA] append_doc failed for noteId "${a}": HTTP ${n.status} ${n.statusText}`,e),!1}const r=yield n.json();return 0===r.code||(console.error(`[IMA] append_doc returned error code ${r.code} for noteId "${a}":`,null!==(o=r.msg)&&void 0!==o?o:r),!1)}catch(e){return console.error(`[IMA] Network error in append_doc for noteId "${a}":`,e),!1}}))}syncNote(e,a,t){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const o=this.getConfig();if(!o)return!1;const n=this.formatNoteMarkdown(e,a,t);let r=yield this.findNoteByTitle(o,a);if(r){const e=yield this.appendNote(o,r,n);return e||console.error(`[IMA] Failed to append to existing note "${a}" (noteId: ${r})`),e}return r=yield this.createNote(o,a,n),r||console.error(`[IMA] Failed to create note for book "${a}"`),null!==r}))}}ea.API_BASE="https://ima.qq.com/openapi/note/v1";class aa{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("siyuanSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[SiYuan] siyuanSyncConfig is empty or not set"),null):e}catch(e){return console.error("[SiYuan] Failed to read siyuanSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableSiYuanSync")}getHeaders(e){return{"Content-Type":"application/json",Authorization:`Token ${e}`}}findOrCreateNotebook(e,a){var t,o;return p(this,void 0,void 0,(function*(){const n=yield fetch(`${e}/api/notebook/lsNotebooks`,{method:"POST",headers:this.getHeaders(a),body:JSON.stringify({})});if(!n.ok){const a=yield n.json().catch((()=>null));throw console.error(`[SiYuan] lsNotebooks failed at ${e}: HTTP ${n.status} ${n.statusText}`,a),new Error(`SiYuan list notebooks failed: ${n.status} ${n.statusText}`)}const r=yield n.json();if(0!==r.code)throw console.error(`[SiYuan] lsNotebooks returned error code ${r.code}:`,r.msg),new Error(`SiYuan list notebooks error: ${r.msg}`);const i=(null!==(o=null===(t=r.data)||void 0===t?void 0:t.notebooks)&&void 0!==o?o:[]).find((e=>"Koodo Reader"===e.name));if(i)return i.id;const l=yield fetch(`${e}/api/notebook/createNotebook`,{method:"POST",headers:this.getHeaders(a),body:JSON.stringify({name:"Koodo Reader"})});if(!l.ok){const a=yield l.json().catch((()=>null));throw console.error(`[SiYuan] createNotebook failed at ${e}: HTTP ${l.status} ${l.statusText}`,a),new Error(`SiYuan create notebook failed: ${l.status} ${l.statusText}`)}const s=yield l.json();if(0!==s.code)throw console.error(`[SiYuan] createNotebook returned error code ${s.code}:`,s.msg),new Error(`SiYuan create notebook error: ${s.msg}`);return s.data.notebook.id}))}findOrCreateDoc(e,a,t,o,n,r){return p(this,void 0,void 0,(function*(){const n=yield fetch(`${e}/api/query/sql`,{method:"POST",headers:this.getHeaders(a),body:JSON.stringify({stmt:`SELECT id FROM blocks WHERE type='d' AND hpath='${o.replace(/'/g,"''")}' LIMIT 1`})});if(n.ok){const e=yield n.json();if(0!==e.code)console.error(`[SiYuan] SQL query for doc "${o}" returned error code ${e.code}:`,e.msg);else if(e.data&&e.data.length>0)return e.data[0].id}else{const e=yield n.json().catch((()=>null));console.error(`[SiYuan] SQL query for doc "${o}" failed: HTTP ${n.status} ${n.statusText}`,e)}const i=r?`**Author:** ${r}\n`:"",l=yield fetch(`${e}/api/filetree/createDocWithMd`,{method:"POST",headers:this.getHeaders(a),body:JSON.stringify({notebook:t,path:o,markdown:i})});if(!l.ok){const e=yield l.json().catch((()=>null));throw console.error(`[SiYuan] createDocWithMd failed for "${o}" in notebook "${t}": HTTP ${l.status} ${l.statusText}`,e),new Error(`SiYuan create doc failed: ${l.status} ${l.statusText}`)}const s=yield l.json();if(0!==s.code)throw console.error(`[SiYuan] createDocWithMd returned error code ${s.code} for "${o}":`,s.msg),new Error(`SiYuan create doc error: ${s.msg}`);return s.data}))}appendMarkdownToDoc(e,a,t,o){return p(this,void 0,void 0,(function*(){const n=yield fetch(`${e}/api/block/appendBlock`,{method:"POST",headers:this.getHeaders(a),body:JSON.stringify({data:o,dataType:"markdown",parentID:t})});if(!n.ok){const e=yield n.json().catch((()=>null));throw console.error(`[SiYuan] appendBlock failed for docId "${t}": HTTP ${n.status} ${n.statusText}`,e),new Error(`SiYuan append block failed: ${n.status} ${n.statusText}`)}const r=yield n.json();if(0!==r.code)throw console.error(`[SiYuan] appendBlock returned error code ${r.code} for docId "${t}":`,r.msg),new Error(`SiYuan append block error: ${r.msg}`)}))}formatNoteMarkdown(e){const a=!e.notes||0===e.notes.length,t=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let o="---\n\n";return e.chapter&&(o+=`### ${e.chapter}\n\n`),o+=`> ${e.text||""}\n\n`,!a&&e.notes&&(o+=`📝 ${e.notes}\n\n`),o+=`*Added on ${t}*\n\n`,o}sanitizePathComponent(e){return e.replace(/[\\/:*?"<>|]/g,"_").trim()}syncNote(e,a,t){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const o=this.getConfig();if(!o)return!1;const{serverUrl:n,token:r}=o;if(!n||!r)return console.error("[SiYuan] Sync skipped: config is missing serverUrl or token",{hasServerUrl:!!n,hasToken:!!r}),!1;try{const o=yield this.findOrCreateNotebook(n,r),i=`/${this.sanitizePathComponent(a)}`,l=yield this.findOrCreateDoc(n,r,o,i,a,t),s=this.formatNoteMarkdown(e);return yield this.appendMarkdownToDoc(n,r,l,s),!0}catch(e){return console.error(`[SiYuan] Sync failed for book "${a}" at ${o.serverUrl}:`,e instanceof Error?e.message:e),!1}}))}}class ta{constructor(e,a){this.databaseService=e,this.notionSync=new Ve(a),this.yuqueSync=new Xe(a),this.readwiseSync=new Ze(a),this.imaSync=new ea(a),this.siyuanSync=new aa(a)}getExtraServices(){return[]}getEnabledServices(){const e=[];return this.notionSync.isEnabled()&&e.push({name:"Notion",sync:this.notionSync.syncNote.bind(this.notionSync)}),this.yuqueSync.isEnabled()&&e.push({name:"Yuque",sync:this.yuqueSync.syncNote.bind(this.yuqueSync)}),this.readwiseSync.isEnabled()&&e.push({name:"Readwise",sync:this.readwiseSync.syncNote.bind(this.readwiseSync)}),this.imaSync.isEnabled()&&e.push({name:"IMA",sync:this.imaSync.syncNote.bind(this.imaSync)}),this.siyuanSync.isEnabled()&&e.push({name:"SiYuan",sync:this.siyuanSync.syncNote.bind(this.siyuanSync)}),[...e,...this.getExtraServices()]}syncNote(e,a){return p(this,void 0,void 0,(function*(){const t=this.getEnabledServices();if(0===t.length)return;let o="Unknown Book",n="";if(a||e.bookKey)try{const t=yield this.databaseService.getRecord(a||e.bookKey,"books");t&&t.name&&(o=t.name),t&&t.author&&(n=t.author)}catch(t){console.error(`[NoteSync] Failed to resolve book info for key: ${a||e.bookKey}`,t)}const r=(yield Promise.allSettled(t.map((a=>p(this,void 0,void 0,(function*(){var t,r,i,l;try{const i=yield a.sync(e,o,n);return i||console.error(`[NoteSync] ${a.name} sync returned false for book "${o}" (noteId: ${null!==(r=null!==(t=e.noteKey)&&void 0!==t?t:e.key)&&void 0!==r?r:"unknown"})`),{name:a.name,success:i}}catch(t){return console.error(`[NoteSync] ${a.name} sync threw an error for book "${o}" (noteId: ${null!==(l=null!==(i=e.noteKey)&&void 0!==i?i:e.key)&&void 0!==l?l:"unknown"}):`,t),{name:a.name,success:!1}}})))))).filter((e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.success)).map((e=>"fulfilled"===e.status?e.value.name:"Unknown"));r.length>0&&console.error(`[NoteSync] Sync failed for services: ${r.join(", ")} | book: "${o}"`)}))}}class oa{constructor(e){this.configService=e}getConfig(){try{const e=this.configService.getObjectConfig("markdownSyncConfig","thirdpartyToken",{});return 0===Object.keys(e).length?(console.error("[Markdown] markdownSyncConfig is empty or not set"),null):e}catch(e){return console.error("[Markdown] Failed to read markdownSyncConfig:",e),null}}isEnabled(){return"yes"===this.configService.getReaderConfig("isEnableMarkdownSync")}formatNoteMarkdown(e){const a=!e.notes||0===e.notes.length,t=`${e.date.year}-${String(e.date.month).padStart(2,"0")}-${String(e.date.day).padStart(2,"0")}`;let o="\n---\n\n";return e.chapter&&(o+=`### ${e.chapter}\n\n`),o+=`> ${e.text||""}\n\n`,!a&&e.notes&&(o+=`📝 ${e.notes}\n\n`),o+=`*Added on ${t}*\n\n`,o}sanitizeFileName(e){return e.replace(/[\\/:*?"<>|]/g,"_").trim()}syncNote(e,a,t){return p(this,void 0,void 0,(function*(){if(!this.isEnabled())return!1;const o=window.require("fs"),n=window.require("path"),r=this.getConfig();if(!r)return!1;const i=r.folder;if(!i)return console.error("[Markdown] Sync skipped: markdownSyncConfig.folder is not set"),!1;try{const r=this.sanitizeFileName(a),l=n.join(i,`${r}.md`);if(!o.existsSync(l)){const e=`# ${a}\n`,n=t?`**Author:** ${t}\n\n`:"\n";try{o.writeFileSync(l,e+n,"utf-8")}catch(e){return console.error(`[Markdown] Failed to create file "${l}" for book "${a}":`,e),!1}}const s=this.formatNoteMarkdown(e);try{o.appendFileSync(l,s,"utf-8")}catch(e){return console.error(`[Markdown] Failed to append to file "${l}" for book "${a}":`,e),!1}return!0}catch(e){return console.error(`[Markdown] Sync failed for book "${a}" in folder "${i}":`,e instanceof Error?e.message:e),!1}}))}}class na extends ta{constructor(e,a){super(e,a),this.markdownSync=new oa(a)}getExtraServices(){return this.markdownSync.isEnabled()?[{name:"Markdown",sync:this.markdownSync.syncNote.bind(this.markdownSync)}]:[]}}class ra{constructor(a){this.syncWordToEudic=(a,t)=>p(this,void 0,void 0,(function*(){var o,n,r,i,l,s,d,c,u,m;if("yes"===this.configService.getReaderConfig("isEnableEudicSync"))try{let c;try{c=this.configService.getObjectConfig("eudicSyncConfig","thirdpartyToken",{})}catch(e){return void console.error("[Eudic] Failed to read eudicSyncConfig:",e)}if(!c||!c.accessToken)return void console.error("[Eudic] Sync skipped: config is missing or accessToken is not set",{hasConfig:!!c});const u=c.language||"en",m={Authorization:`NIS ${c.accessToken}`,"Content-Type":"application/json","User-Agent":"Mozilla/5.0"};let p="0";const h=(c.categoryName||"").trim();if(h)if(void 0!==c.categoryId)p=c.categoryId;else try{const a=(null===(o=(yield e.get(`https://api.frdic.com/api/open/v1/studylist/category?language=${u}`,{headers:m})).data)||void 0===o?void 0:o.data)||[],t=a.find((e=>e.name===h));t?p=t.id:console.error(`[Eudic] Category "${h}" not found among available categories:`,a.map((e=>e.name)));const n=Object.assign(Object.assign({},c),{categoryId:p});this.configService.setObjectConfig("eudicSyncConfig",n,"thirdpartyToken")}catch(e){console.error("[Eudic] Failed to fetch category list:",null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status,null!==(i=null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.data)&&void 0!==i?i:e)}try{yield e.post("https://api.frdic.com/api/open/v1/studylist/word",{language:u,word:a,context_line:t||"",category_ids:[p]},{headers:m})}catch(e){throw console.error(`[Eudic] Failed to add word "${a}" to study list (category: ${p}):`,null===(l=null==e?void 0:e.response)||void 0===l?void 0:l.status,null!==(d=null===(s=null==e?void 0:e.response)||void 0===s?void 0:s.data)&&void 0!==d?d:e),e}}catch(e){console.error("[Eudic] Sync error for word:",a,null===(c=null==e?void 0:e.response)||void 0===c?void 0:c.status,null!==(m=null===(u=null==e?void 0:e.response)||void 0===u?void 0:u.data)&&void 0!==m?m:e)}})),this.syncWordToAnki=(a,t,o,n,r="")=>p(this,void 0,void 0,(function*(){var i,l,s,d,c,u,m,p,h,g;if("yes"===this.configService.getReaderConfig("isEnableAnkiSync"))try{let h;try{h=this.configService.getObjectConfig("ankiSyncConfig","thirdpartyToken",{})}catch(e){return void console.error("[Anki] Failed to read ankiSyncConfig:",e)}if(!h||!h.deckName)return void console.error("[Anki] Sync skipped: config is missing or deckName is not set",{hasConfig:!!h});const g=h.host||"127.0.0.1",f=`http://${g}:${h.port||"8765"}`,y=h.deckName,N="Koodo Reader Word",v=(a,t={})=>{const o={action:a,version:6,params:t};return h.apiKey&&(o.key=h.apiKey),e.post(f,o)};if(!h.modelName)try{const e=yield v("modelNames");if(!((null===(i=e.data)||void 0===i?void 0:i.result)||[]).includes(N))try{yield v("createModel",{modelName:N,inOrderFields:["Word","Sentence","Book","Chapter","Definition"],cardTemplates:[{Name:"Card 1",Front:"{{Word}}

{{Sentence}}

{{Book}}
{{Chapter}}",Back:"{{Definition}}"}]})}catch(e){throw console.error(`[Anki] Failed to create model "${N}":`,null!==(s=null===(l=null==e?void 0:e.response)||void 0===l?void 0:l.data)&&void 0!==s?s:e),e}this.configService.setObjectConfig("ankiSyncConfig",Object.assign(Object.assign({},h),{modelName:N}),"thirdpartyToken")}catch(e){throw console.error(`[Anki] Failed to fetch model names from ${f}:`,null!==(c=null===(d=null==e?void 0:e.response)||void 0===d?void 0:d.data)&&void 0!==c?c:e),e}try{const e=yield v("addNote",{note:{deckName:y,modelName:N,fields:{Word:a,Sentence:t||"",Book:o||"",Chapter:n||"",Definition:r||""},options:{allowDuplicate:!1},tags:[]}});(null===(u=e.data)||void 0===u?void 0:u.error)&&console.error(`[Anki] addNote returned an error for word "${a}" in deck "${y}":`,e.data.error)}catch(e){throw console.error(`[Anki] Failed to add note for word "${a}" to deck "${y}" at ${f}:`,null!==(p=null===(m=null==e?void 0:e.response)||void 0===m?void 0:m.data)&&void 0!==p?p:e),e}}catch(e){console.error("[Anki] Sync error for word:",a,null!==(g=null===(h=null==e?void 0:e.response)||void 0===h?void 0:h.data)&&void 0!==g?g:e)}})),this.configService=a}}class ia extends ra{}export{S as CommonTool,Le as ConfigService,Be as HighlightUtil,Ae as KOReaderUtil,A as KookitConfig,ye as LoginHelper,na as NoteSyncManager,he as ReaderRequest,ve as ReadingTimeUtil,ce as SqlStatement,Ne as SyncHelper,oe as SyncUtil,ge as ThirdpartyRequest,qe as TokenService,fe as UserRequest,ia as WordSyncManager}; diff --git a/src/constants/ttsList.tsx b/src/constants/ttsList.tsx index d02951f4..ad1df897 100644 --- a/src/constants/ttsList.tsx +++ b/src/constants/ttsList.tsx @@ -1903,3739 +1903,3 @@ export const languageENMap = { ZZ: "Unknown Region", }, }; -export const officialVoiceList = [ - { - name: "af_alloy", - gender: "female", - displayName: "Alloy", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_aoede", - gender: "female", - displayName: "Aoede", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_bella", - gender: "female", - displayName: "Bella", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_heart", - gender: "female", - displayName: "Heart", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_jessica", - gender: "female", - displayName: "Jessica", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_kore", - gender: "female", - displayName: "Kore", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_nicole", - gender: "female", - displayName: "Nicole", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_nova", - gender: "female", - displayName: "Nova", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_river", - gender: "female", - displayName: "River", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_sarah", - gender: "female", - displayName: "Sarah", - locale: "en-US", - language: "English (US)", - }, - { - name: "af_sky", - gender: "female", - displayName: "Sky", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_adam", - gender: "male", - displayName: "Adam", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_echo", - gender: "male", - displayName: "Echo", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_eric", - gender: "male", - displayName: "Eric", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_fenrir", - gender: "male", - displayName: "Fenrir", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_liam", - gender: "male", - displayName: "Liam", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_michael", - gender: "male", - displayName: "Michael", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_onyx", - gender: "male", - displayName: "Onyx", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_puck", - gender: "male", - displayName: "Puck", - locale: "en-US", - language: "English (US)", - }, - { - name: "am_santa", - gender: "male", - displayName: "Santa", - locale: "en-US", - language: "English (US)", - }, - { - name: "bf_alice", - gender: "female", - displayName: "Alice", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "bf_emma", - gender: "female", - displayName: "Emma", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "bf_isabella", - gender: "female", - displayName: "Isabella", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "bf_lily", - gender: "female", - displayName: "Lily", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "bm_daniel", - gender: "male", - displayName: "Daniel", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "bm_fable", - gender: "male", - displayName: "Fable", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "bm_george", - gender: "male", - displayName: "George", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "bm_lewis", - gender: "male", - displayName: "Lewis", - locale: "en-GB", - language: "English (UK)", - }, - { - name: "ef_dora", - gender: "female", - displayName: "Dora", - locale: "es-ES", - language: "Español", - }, - { - name: "em_alex", - gender: "male", - displayName: "Alex", - locale: "es-ES", - language: "Español", - }, - { - name: "em_santa", - gender: "male", - displayName: "Santa", - locale: "es-ES", - language: "Español", - }, - { - name: "ff_siwis", - gender: "female", - displayName: "Siwis", - locale: "fr-FR", - language: "Français", - }, - { - name: "hf_alpha", - gender: "female", - displayName: "Alpha", - locale: "hi-IN", - language: "हिन्दी", - }, - { - name: "hf_beta", - gender: "female", - displayName: "Beta", - locale: "hi-IN", - language: "हिन्दी", - }, - { - name: "hm_omega", - gender: "male", - displayName: "Omega", - locale: "hi-IN", - language: "हिन्दी", - }, - { - name: "hm_psi", - gender: "male", - displayName: "Psi", - locale: "hi-IN", - language: "हिन्दी", - }, - { - name: "if_sara", - gender: "female", - displayName: "Sara", - locale: "it-IT", - language: "Italiano", - }, - { - name: "im_nicola", - gender: "male", - displayName: "Nicola", - locale: "it-IT", - language: "Italiano", - }, - { - name: "jf_alpha", - gender: "female", - displayName: "Alpha", - locale: "ja-JP", - language: "日本語", - }, - { - name: "jf_gongitsune", - gender: "female", - displayName: "Gongitsune", - locale: "ja-JP", - language: "日本語", - }, - { - name: "jf_nezumi", - gender: "female", - displayName: "Nezumi", - locale: "ja-JP", - language: "日本語", - }, - { - name: "jf_tebukuro", - gender: "female", - displayName: "Tebukuro", - locale: "ja-JP", - language: "日本語", - }, - { - name: "jm_kumo", - gender: "male", - displayName: "Kumo", - locale: "ja-JP", - language: "日本語", - }, - { - name: "pf_dora", - gender: "female", - displayName: "Dora", - locale: "pt-BR", - language: "Português (Brasil)", - }, - { - name: "pm_alex", - gender: "male", - displayName: "Alex", - locale: "pt-BR", - language: "Português (Brasil)", - }, - { - name: "pm_santa", - gender: "male", - displayName: "Santa", - locale: "pt-BR", - language: "Português (Brasil)", - }, - { - name: "zf_xiaoxiao", - gender: "female", - displayName: "Xiaoxiao", - locale: "zh-CN", - language: "中文", - }, - { - name: "zf_xiaoyi", - gender: "female", - displayName: "Xiaoyi", - locale: "zh-CN", - language: "中文", - }, - { - name: "zm_yunyang", - gender: "male", - displayName: "Yunyang", - locale: "zh-CN", - language: "中文", - }, - { - name: "zm_yunxia", - gender: "male", - displayName: "Yunxia", - locale: "zh-CN", - language: "中文", - }, - { - name: "zm_yunxi", - gender: "male", - displayName: "Yunxi", - locale: "zh-CN", - language: "中文", - }, - { - name: "zm_yunjian", - gender: "male", - displayName: "Yunjian", - locale: "zh-CN", - language: "中文", - }, - { - name: "zf_xiaoni", - gender: "female", - displayName: "Xiaoni", - locale: "zh-CN", - language: "中文", - }, - { - name: "zf_xiaobei", - gender: "female", - displayName: "Xiaobei", - locale: "zh-CN", - language: "中文", - }, -]; -export const azureTTSVoiceList = [ - { - name: "af-ZA-AdriNeural", - gender: "female", - displayName: "Adri", - locale: "af-ZA", - }, - { - name: "af-ZA-WillemNeural", - gender: "male", - displayName: "Willem", - locale: "af-ZA", - }, - { - name: "am-ET-MekdesNeural", - gender: "female", - displayName: "መቅደስ", - locale: "am-ET", - }, - { - name: "am-ET-AmehaNeural", - gender: "male", - displayName: "አምሀ", - locale: "am-ET", - }, - { - name: "ar-AE-FatimaNeural", - gender: "female", - displayName: "فاطمة", - locale: "ar-AE", - }, - { - name: "ar-AE-HamdanNeural", - gender: "male", - displayName: "حمدان", - locale: "ar-AE", - }, - { - name: "ar-BH-LailaNeural", - gender: "female", - displayName: "ليلى", - locale: "ar-BH", - }, - { - name: "ar-BH-AliNeural", - gender: "male", - displayName: "علي", - locale: "ar-BH", - }, - { - name: "ar-DZ-AminaNeural", - gender: "female", - displayName: "أمينة", - locale: "ar-DZ", - }, - { - name: "ar-DZ-IsmaelNeural", - gender: "male", - displayName: "إسماعيل", - locale: "ar-DZ", - }, - { - name: "ar-EG-SalmaNeural", - gender: "female", - displayName: "سلمى", - locale: "ar-EG", - }, - { - name: "ar-EG-ShakirNeural", - gender: "male", - displayName: "شاكر", - locale: "ar-EG", - }, - { - name: "ar-IQ-RanaNeural", - gender: "female", - displayName: "رنا", - locale: "ar-IQ", - }, - { - name: "ar-IQ-BasselNeural", - gender: "male", - displayName: "باسل", - locale: "ar-IQ", - }, - { - name: "ar-JO-SanaNeural", - gender: "female", - displayName: "سناء", - locale: "ar-JO", - }, - { - name: "ar-JO-TaimNeural", - gender: "male", - displayName: "تيم", - locale: "ar-JO", - }, - { - name: "ar-KW-NouraNeural", - gender: "female", - displayName: "نورا", - locale: "ar-KW", - }, - { - name: "ar-KW-FahedNeural", - gender: "male", - displayName: "فهد", - locale: "ar-KW", - }, - { - name: "ar-LB-LaylaNeural", - gender: "female", - displayName: "ليلى", - locale: "ar-LB", - }, - { - name: "ar-LB-RamiNeural", - gender: "male", - displayName: "رامي", - locale: "ar-LB", - }, - { - name: "ar-LY-ImanNeural", - gender: "female", - displayName: "إيمان", - locale: "ar-LY", - }, - { - name: "ar-LY-OmarNeural", - gender: "male", - displayName: "أحمد", - locale: "ar-LY", - }, - { - name: "ar-MA-MounaNeural", - gender: "female", - displayName: "منى", - locale: "ar-MA", - }, - { - name: "ar-MA-JamalNeural", - gender: "male", - displayName: "جمال", - locale: "ar-MA", - }, - { - name: "ar-OM-AyshaNeural", - gender: "female", - displayName: "عائشة", - locale: "ar-OM", - }, - { - name: "ar-OM-AbdullahNeural", - gender: "male", - displayName: "عبدالله", - locale: "ar-OM", - }, - { - name: "ar-QA-AmalNeural", - gender: "female", - displayName: "أمل", - locale: "ar-QA", - }, - { - name: "ar-QA-MoazNeural", - gender: "male", - displayName: "معاذ", - locale: "ar-QA", - }, - { - name: "ar-SA-ZariyahNeural", - gender: "female", - displayName: "زارية", - locale: "ar-SA", - }, - { - name: "ar-SA-HamedNeural", - gender: "male", - displayName: "حامد", - locale: "ar-SA", - }, - { - name: "ar-SY-AmanyNeural", - gender: "female", - displayName: "أماني", - locale: "ar-SY", - }, - { - name: "ar-SY-LaithNeural", - gender: "male", - displayName: "ليث", - locale: "ar-SY", - }, - { - name: "ar-TN-ReemNeural", - gender: "female", - displayName: "ريم", - locale: "ar-TN", - }, - { - name: "ar-TN-HediNeural", - gender: "male", - displayName: "هادي", - locale: "ar-TN", - }, - { - name: "ar-YE-MaryamNeural", - gender: "female", - displayName: "مريم", - locale: "ar-YE", - }, - { - name: "ar-YE-SalehNeural", - gender: "male", - displayName: "صالح", - locale: "ar-YE", - }, - { - name: "as-IN-YashicaNeural", - gender: "female", - displayName: "যাশিকা", - locale: "as-IN", - }, - { - name: "as-IN-PriyomNeural", - gender: "male", - displayName: "প্ৰিয়ম", - locale: "as-IN", - }, - { - name: "az-AZ-BanuNeural", - gender: "female", - displayName: "Banu", - locale: "az-AZ", - }, - { - name: "az-AZ-BabekNeural", - gender: "male", - displayName: "Babək", - locale: "az-AZ", - }, - { - name: "bg-BG-KalinaNeural", - gender: "female", - displayName: "Калина", - locale: "bg-BG", - }, - { - name: "bg-BG-BorislavNeural", - gender: "male", - displayName: "Борислав", - locale: "bg-BG", - }, - { - name: "bn-BD-NabanitaNeural", - gender: "female", - displayName: "নবনীতা", - locale: "bn-BD", - }, - { - name: "bn-BD-PradeepNeural", - gender: "male", - displayName: "প্রদ্বীপ", - locale: "bn-BD", - }, - { - name: "bn-IN-TanishaaNeural", - gender: "female", - displayName: "তানিশা", - locale: "bn-IN", - }, - { - name: "bn-IN-BashkarNeural", - gender: "male", - displayName: "ভাস্কর", - locale: "bn-IN", - }, - { - name: "bs-BA-VesnaNeural", - gender: "female", - displayName: "Vesna", - locale: "bs-BA", - }, - { - name: "bs-BA-GoranNeural", - gender: "male", - displayName: "Goran", - locale: "bs-BA", - }, - { - name: "ca-ES-JoanaNeural", - gender: "female", - displayName: "Joana", - locale: "ca-ES", - }, - { - name: "ca-ES-EnricNeural", - gender: "male", - displayName: "Enric", - locale: "ca-ES", - }, - { - name: "ca-ES-AlbaNeural", - gender: "female", - displayName: "Alba", - locale: "ca-ES", - }, - { - name: "cs-CZ-VlastaNeural", - gender: "female", - displayName: "Vlasta", - locale: "cs-CZ", - }, - { - name: "cs-CZ-AntoninNeural", - gender: "male", - displayName: "Antonín", - locale: "cs-CZ", - }, - { - name: "cy-GB-NiaNeural", - gender: "female", - displayName: "Nia", - locale: "cy-GB", - }, - { - name: "cy-GB-AledNeural", - gender: "male", - displayName: "Aled", - locale: "cy-GB", - }, - { - name: "da-DK-ChristelNeural", - gender: "female", - displayName: "Christel", - locale: "da-DK", - }, - { - name: "da-DK-JeppeNeural", - gender: "male", - displayName: "Jeppe", - locale: "da-DK", - }, - { - name: "de-AT-IngridNeural", - gender: "female", - displayName: "Ingrid", - locale: "de-AT", - }, - { - name: "de-AT-JonasNeural", - gender: "male", - displayName: "Jonas", - locale: "de-AT", - }, - { - name: "de-CH-LeniNeural", - gender: "female", - displayName: "Leni", - locale: "de-CH", - }, - { - name: "de-CH-JanNeural", - gender: "male", - displayName: "Jan", - locale: "de-CH", - }, - { - name: "de-DE-KatjaNeural", - gender: "female", - displayName: "Katja", - locale: "de-DE", - }, - { - name: "de-DE-ConradNeural", - gender: "male", - displayName: "Conrad", - locale: "de-DE", - }, - { - name: "de-DE-SeraphinaMultilingualNeural", - gender: "female", - displayName: "Seraphine Mehrsprachig", - locale: "de-DE", - }, - { - name: "de-DE-FlorianMultilingualNeural", - gender: "male", - displayName: "Florian Mehrsprachig", - locale: "de-DE", - }, - { - name: "de-DE-AmalaNeural", - gender: "female", - displayName: "Amala", - locale: "de-DE", - }, - { - name: "de-DE-BerndNeural", - gender: "male", - displayName: "Bernd", - locale: "de-DE", - }, - { - name: "de-DE-ChristophNeural", - gender: "male", - displayName: "Christoph", - locale: "de-DE", - }, - { - name: "de-DE-ElkeNeural", - gender: "female", - displayName: "Elke", - locale: "de-DE", - }, - { - name: "de-DE-GiselaNeural", - gender: "female", - displayName: "Gisela", - locale: "de-DE", - }, - { - name: "de-DE-KasperNeural", - gender: "male", - displayName: "Kasper", - locale: "de-DE", - }, - { - name: "de-DE-KillianNeural", - gender: "male", - displayName: "Killian", - locale: "de-DE", - }, - { - name: "de-DE-KlarissaNeural", - gender: "female", - displayName: "Klarissa", - locale: "de-DE", - }, - { - name: "de-DE-KlausNeural", - gender: "male", - displayName: "Klaus", - locale: "de-DE", - }, - { - name: "de-DE-LouisaNeural", - gender: "female", - displayName: "Louisa", - locale: "de-DE", - }, - { - name: "de-DE-MajaNeural", - gender: "female", - displayName: "Maja", - locale: "de-DE", - }, - { - name: "de-DE-RalfNeural", - gender: "male", - displayName: "Ralf", - locale: "de-DE", - }, - { - name: "de-DE-TanjaNeural", - gender: "female", - displayName: "Tanja", - locale: "de-DE", - }, - { - name: "el-GR-AthinaNeural", - gender: "female", - displayName: "Αθηνά", - locale: "el-GR", - }, - { - name: "el-GR-NestorasNeural", - gender: "male", - displayName: "Νέστορας", - locale: "el-GR", - }, - { - name: "en-AU-NatashaNeural", - gender: "female", - displayName: "Natasha", - locale: "en-AU", - }, - { - name: "en-AU-WilliamNeural", - gender: "male", - displayName: "William", - locale: "en-AU", - }, - { - name: "en-AU-WilliamMultilingualNeural", - gender: "male", - displayName: "William Multilingual", - locale: "en-AU", - }, - { - name: "en-AU-AnnetteNeural", - gender: "female", - displayName: "Annette", - locale: "en-AU", - }, - { - name: "en-AU-CarlyNeural", - gender: "female", - displayName: "Carly", - locale: "en-AU", - }, - { - name: "en-AU-DarrenNeural", - gender: "male", - displayName: "Darren", - locale: "en-AU", - }, - { - name: "en-AU-DuncanNeural", - gender: "male", - displayName: "Duncan", - locale: "en-AU", - }, - { - name: "en-AU-ElsieNeural", - gender: "female", - displayName: "Elsie", - locale: "en-AU", - }, - { - name: "en-AU-FreyaNeural", - gender: "female", - displayName: "Freya", - locale: "en-AU", - }, - { - name: "en-AU-JoanneNeural", - gender: "female", - displayName: "Joanne", - locale: "en-AU", - }, - { - name: "en-AU-KenNeural", - gender: "male", - displayName: "Ken", - locale: "en-AU", - }, - { - name: "en-AU-KimNeural", - gender: "female", - displayName: "Kim", - locale: "en-AU", - }, - { - name: "en-AU-NeilNeural", - gender: "male", - displayName: "Neil", - locale: "en-AU", - }, - { - name: "en-AU-TimNeural", - gender: "male", - displayName: "Tim", - locale: "en-AU", - }, - { - name: "en-AU-TinaNeural", - gender: "female", - displayName: "Tina", - locale: "en-AU", - }, - { - name: "en-CA-ClaraNeural", - gender: "female", - displayName: "Clara", - locale: "en-CA", - }, - { - name: "en-CA-LiamNeural", - gender: "male", - displayName: "Liam", - locale: "en-CA", - }, - { - name: "en-GB-SoniaNeural", - gender: "female", - displayName: "Sonia", - locale: "en-GB", - }, - { - name: "en-GB-RyanNeural", - gender: "male", - displayName: "Ryan", - locale: "en-GB", - }, - { - name: "en-GB-LibbyNeural", - gender: "female", - displayName: "Libby", - locale: "en-GB", - }, - { - name: "en-GB-AdaMultilingualNeural", - gender: "female", - displayName: "Ada Multilingual", - locale: "en-GB", - }, - { - name: "en-GB-OllieMultilingualNeural", - gender: "male", - displayName: "Ollie Multilingual", - locale: "en-GB", - }, - { - name: "en-GB-AbbiNeural", - gender: "female", - displayName: "Abbi", - locale: "en-GB", - }, - { - name: "en-GB-AlfieNeural", - gender: "male", - displayName: "Alfie", - locale: "en-GB", - }, - { - name: "en-GB-BellaNeural", - gender: "female", - displayName: "Bella", - locale: "en-GB", - }, - { - name: "en-GB-ElliotNeural", - gender: "male", - displayName: "Elliot", - locale: "en-GB", - }, - { - name: "en-GB-EthanNeural", - gender: "male", - displayName: "Ethan", - locale: "en-GB", - }, - { - name: "en-GB-HollieNeural", - gender: "female", - displayName: "Hollie", - locale: "en-GB", - }, - { - name: "en-GB-MaisieNeural", - gender: "female", - displayName: "Maisie", - locale: "en-GB", - }, - { - name: "en-GB-NoahNeural", - gender: "male", - displayName: "Noah", - locale: "en-GB", - }, - { - name: "en-GB-OliverNeural", - gender: "male", - displayName: "Oliver", - locale: "en-GB", - }, - { - name: "en-GB-OliviaNeural", - gender: "female", - displayName: "Olivia", - locale: "en-GB", - }, - { - name: "en-GB-ThomasNeural", - gender: "male", - displayName: "Thomas", - locale: "en-GB", - }, - { - name: "en-GB-MiaNeural", - gender: "female", - displayName: "Mia", - locale: "en-GB", - }, - { - name: "en-HK-YanNeural", - gender: "female", - displayName: "Yan", - locale: "en-HK", - }, - { - name: "en-HK-SamNeural", - gender: "male", - displayName: "Sam", - locale: "en-HK", - }, - { - name: "en-IE-EmilyNeural", - gender: "female", - displayName: "Emily", - locale: "en-IE", - }, - { - name: "en-IE-ConnorNeural", - gender: "male", - displayName: "Connor", - locale: "en-IE", - }, - { - name: "en-IN-AartiIndicNeural", - gender: "female", - displayName: "Aarti Indic", - locale: "en-IN", - }, - { - name: "en-IN-ArjunIndicNeural", - gender: "male", - displayName: "Arjun Indic", - locale: "en-IN", - }, - { - name: "en-IN-NeerjaIndicNeural", - gender: "female", - displayName: "Neerja Indic", - locale: "en-IN", - }, - { - name: "en-IN-PrabhatIndicNeural", - gender: "male", - displayName: "Prabhat Indic", - locale: "en-IN", - }, - { - name: "en-IN-AaravNeural", - gender: "male", - displayName: "Aarav", - locale: "en-IN", - }, - { - name: "en-IN-AashiNeural", - gender: "female", - displayName: "Aashi", - locale: "en-IN", - }, - { - name: "en-IN-AartiNeural", - gender: "female", - displayName: "Aarti", - locale: "en-IN", - }, - { - name: "en-IN-ArjunNeural", - gender: "male", - displayName: "Arjun", - locale: "en-IN", - }, - { - name: "en-IN-AnanyaNeural", - gender: "female", - displayName: "Ananya", - locale: "en-IN", - }, - { - name: "en-IN-KavyaNeural", - gender: "female", - displayName: "Kavya", - locale: "en-IN", - }, - { - name: "en-IN-KunalNeural", - gender: "male", - displayName: "Kunal", - locale: "en-IN", - }, - { - name: "en-IN-NeerjaNeural", - gender: "female", - displayName: "Neerja", - locale: "en-IN", - }, - { - name: "en-IN-PrabhatNeural", - gender: "male", - displayName: "Prabhat", - locale: "en-IN", - }, - { - name: "en-IN-RehaanNeural", - gender: "male", - displayName: "Rehaan", - locale: "en-IN", - }, - { - name: "en-KE-AsiliaNeural", - gender: "female", - displayName: "Asilia", - locale: "en-KE", - }, - { - name: "en-KE-ChilembaNeural", - gender: "male", - displayName: "Chilemba", - locale: "en-KE", - }, - { - name: "en-NG-EzinneNeural", - gender: "female", - displayName: "Ezinne", - locale: "en-NG", - }, - { - name: "en-NG-AbeoNeural", - gender: "male", - displayName: "Abeo", - locale: "en-NG", - }, - { - name: "en-NZ-MollyNeural", - gender: "female", - displayName: "Molly", - locale: "en-NZ", - }, - { - name: "en-NZ-MitchellNeural", - gender: "male", - displayName: "Mitchell", - locale: "en-NZ", - }, - { - name: "en-PH-RosaNeural", - gender: "female", - displayName: "Rosa", - locale: "en-PH", - }, - { - name: "en-PH-JamesNeural", - gender: "male", - displayName: "James", - locale: "en-PH", - }, - { - name: "en-SG-LunaNeural", - gender: "female", - displayName: "Luna", - locale: "en-SG", - }, - { - name: "en-SG-WayneNeural", - gender: "male", - displayName: "Wayne", - locale: "en-SG", - }, - { - name: "en-TZ-ImaniNeural", - gender: "female", - displayName: "Imani", - locale: "en-TZ", - }, - { - name: "en-TZ-ElimuNeural", - gender: "male", - displayName: "Elimu", - locale: "en-TZ", - }, - { - name: "en-US-AvaMultilingualNeural", - gender: "female", - displayName: "Ava Multilingual", - locale: "en-US", - }, - { - name: "en-US-AndrewMultilingualNeural", - gender: "male", - displayName: "Andrew Multilingual", - locale: "en-US", - }, - { - name: "en-US-AmandaMultilingualNeural", - gender: "female", - displayName: "Amanda Multilingual", - locale: "en-US", - }, - { - name: "en-US-AdamMultilingualNeural", - gender: "male", - displayName: "Adam Multilingual", - locale: "en-US", - }, - { - name: "en-US-EmmaMultilingualNeural", - gender: "female", - displayName: "Emma Multilingual", - locale: "en-US", - }, - { - name: "en-US-PhoebeMultilingualNeural", - gender: "female", - displayName: "Phoebe Multilingual", - locale: "en-US", - }, - { - name: "en-US-AlloyTurboMultilingualNeural", - gender: "male", - displayName: "Alloy Turbo Multilingual", - locale: "en-US", - }, - { - name: "en-US-EchoTurboMultilingualNeural", - gender: "male", - displayName: "Echo Turbo Multilingual", - locale: "en-US", - }, - { - name: "en-US-FableTurboMultilingualNeural", - gender: "female", - displayName: "Fable Turbo Multilingual", - locale: "en-US", - }, - { - name: "en-US-OnyxTurboMultilingualNeural", - gender: "male", - displayName: "Onyx Turbo Multilingual", - locale: "en-US", - }, - { - name: "en-US-NovaTurboMultilingualNeural", - gender: "female", - displayName: "Nova Turbo Multilingual", - locale: "en-US", - }, - { - name: "en-US-ShimmerTurboMultilingualNeural", - gender: "female", - displayName: "Shimmer Turbo Multilingual", - locale: "en-US", - }, - { - name: "en-US-BrianMultilingualNeural", - gender: "male", - displayName: "Brian Multilingual", - locale: "en-US", - }, - { - name: "en-US-AvaNeural", - gender: "female", - displayName: "Ava", - locale: "en-US", - }, - { - name: "en-US-AndrewNeural", - gender: "male", - displayName: "Andrew", - locale: "en-US", - }, - { - name: "en-US-EmmaNeural", - gender: "female", - displayName: "Emma", - locale: "en-US", - }, - { - name: "en-US-BrianNeural", - gender: "male", - displayName: "Brian", - locale: "en-US", - }, - { - name: "en-US-JennyNeural", - gender: "female", - displayName: "Jenny", - locale: "en-US", - }, - { - name: "en-US-GuyNeural", - gender: "male", - displayName: "Guy", - locale: "en-US", - }, - { - name: "en-US-AriaNeural", - gender: "female", - displayName: "Aria", - locale: "en-US", - }, - { - name: "en-US-DavisNeural", - gender: "male", - displayName: "Davis", - locale: "en-US", - }, - { - name: "en-US-JaneNeural", - gender: "female", - displayName: "Jane", - locale: "en-US", - }, - { - name: "en-US-JasonNeural", - gender: "male", - displayName: "Jason", - locale: "en-US", - }, - { - name: "en-US-KaiNeural", - gender: "male", - displayName: "Kai", - locale: "en-US", - }, - { - name: "en-US-LunaNeural", - gender: "female", - displayName: "Luna", - locale: "en-US", - }, - { - name: "en-US-SaraNeural", - gender: "female", - displayName: "Sara", - locale: "en-US", - }, - { - name: "en-US-TonyNeural", - gender: "male", - displayName: "Tony", - locale: "en-US", - }, - { - name: "en-US-NancyNeural", - gender: "female", - displayName: "Nancy", - locale: "en-US", - }, - { - name: "en-US-CoraMultilingualNeural", - gender: "female", - displayName: "Cora Multilingual", - locale: "en-US", - }, - { - name: "en-US-ChristopherMultilingualNeural", - gender: "male", - displayName: "Christopher Multilingual", - locale: "en-US", - }, - { - name: "en-US-BrandonMultilingualNeural", - gender: "male", - displayName: "Brandon Multilingual", - locale: "en-US", - }, - { - name: "en-US-AmberNeural", - gender: "female", - displayName: "Amber", - locale: "en-US", - }, - { - name: "en-US-AnaNeural", - gender: "female", - displayName: "Ana", - locale: "en-US", - }, - { - name: "en-US-AshleyNeural", - gender: "female", - displayName: "Ashley", - locale: "en-US", - }, - { - name: "en-US-BrandonNeural", - gender: "male", - displayName: "Brandon", - locale: "en-US", - }, - { - name: "en-US-ChristopherNeural", - gender: "male", - displayName: "Christopher", - locale: "en-US", - }, - { - name: "en-US-CoraNeural", - gender: "female", - displayName: "Cora", - locale: "en-US", - }, - { - name: "en-US-DavisMultilingualNeural", - gender: "male", - displayName: "Davis Multilingual", - locale: "en-US", - }, - { - name: "en-US-DerekMultilingualNeural", - gender: "male", - displayName: "Derek Multilingual", - locale: "en-US", - }, - { - name: "en-US-DustinMultilingualNeural", - gender: "male", - displayName: "Dustin Multilingual", - locale: "en-US", - }, - { - name: "en-US-ElizabethNeural", - gender: "female", - displayName: "Elizabeth", - locale: "en-US", - }, - { - name: "en-US-EricNeural", - gender: "male", - displayName: "Eric", - locale: "en-US", - }, - { - name: "en-US-JacobNeural", - gender: "male", - displayName: "Jacob", - locale: "en-US", - }, - { - name: "en-US-JennyMultilingualNeural", - gender: "female", - displayName: "Jenny Multilingual", - locale: "en-US", - }, - { - name: "en-US-LewisMultilingualNeural", - gender: "male", - displayName: "Lewis Multilingual", - locale: "en-US", - }, - { - name: "en-US-LolaMultilingualNeural", - gender: "female", - displayName: "Lola Multilingual", - locale: "en-US", - }, - { - name: "en-US-MichelleNeural", - gender: "female", - displayName: "Michelle", - locale: "en-US", - }, - { - name: "en-US-MonicaNeural", - gender: "female", - displayName: "Monica", - locale: "en-US", - }, - { - name: "en-US-NancyMultilingualNeural", - gender: "female", - displayName: "Nancy Multilingual", - locale: "en-US", - }, - { - name: "en-US-RogerNeural", - gender: "male", - displayName: "Roger", - locale: "en-US", - }, - { - name: "en-US-RyanMultilingualNeural", - gender: "male", - displayName: "Ryan Multilingual", - locale: "en-US", - }, - { - name: "en-US-SamuelMultilingualNeural", - gender: "male", - displayName: "Samuel Multilingual", - locale: "en-US", - }, - { - name: "en-US-SerenaMultilingualNeural", - gender: "female", - displayName: "Serena Multilingual", - locale: "en-US", - }, - { - name: "en-US-SteffanMultilingualNeural", - gender: "male", - displayName: "Steffan Multilingual", - locale: "en-US", - }, - { - name: "en-US-SteffanNeural", - gender: "male", - displayName: "Steffan", - locale: "en-US", - }, - { - name: "en-US-AIGenerate1Neural", - gender: "male", - displayName: "AIGenerate1", - locale: "en-US", - }, - { - name: "en-US-AIGenerate2Neural", - gender: "female", - displayName: "AIGenerate2", - locale: "en-US", - }, - { - name: "en-US-AshTurboMultilingualNeural", - gender: "male", - displayName: "Ash Turbo Multilingual", - locale: "en-US", - }, - { - name: "en-US-BlueNeural", - gender: "female", - displayName: "Blue", - locale: "en-US", - }, - { - name: "en-US-EvelynMultilingualNeural", - gender: "female", - displayName: "Evelyn Multilingual", - locale: "en-US", - }, - { - name: "en-ZA-LeahNeural", - gender: "female", - displayName: "Leah", - locale: "en-ZA", - }, - { - name: "en-ZA-LukeNeural", - gender: "male", - displayName: "Luke", - locale: "en-ZA", - }, - { - name: "es-AR-ElenaNeural", - gender: "female", - displayName: "Elena", - locale: "es-AR", - }, - { - name: "es-AR-TomasNeural", - gender: "male", - displayName: "Tomas", - locale: "es-AR", - }, - { - name: "es-BO-SofiaNeural", - gender: "female", - displayName: "Sofia", - locale: "es-BO", - }, - { - name: "es-BO-MarceloNeural", - gender: "male", - displayName: "Marcelo", - locale: "es-BO", - }, - { - name: "es-CL-CatalinaNeural", - gender: "female", - displayName: "Catalina", - locale: "es-CL", - }, - { - name: "es-CL-LorenzoNeural", - gender: "male", - displayName: "Lorenzo", - locale: "es-CL", - }, - { - name: "es-CO-SalomeNeural", - gender: "female", - displayName: "Salome", - locale: "es-CO", - }, - { - name: "es-CO-GonzaloNeural", - gender: "male", - displayName: "Gonzalo", - locale: "es-CO", - }, - { - name: "es-CR-MariaNeural", - gender: "female", - displayName: "María", - locale: "es-CR", - }, - { - name: "es-CR-JuanNeural", - gender: "male", - displayName: "Juan", - locale: "es-CR", - }, - { - name: "es-CU-BelkysNeural", - gender: "female", - displayName: "Belkys", - locale: "es-CU", - }, - { - name: "es-CU-ManuelNeural", - gender: "male", - displayName: "Manuel", - locale: "es-CU", - }, - { - name: "es-DO-RamonaNeural", - gender: "female", - displayName: "Ramona", - locale: "es-DO", - }, - { - name: "es-DO-EmilioNeural", - gender: "male", - displayName: "Emilio", - locale: "es-DO", - }, - { - name: "es-EC-AndreaNeural", - gender: "female", - displayName: "Andrea", - locale: "es-EC", - }, - { - name: "es-EC-LuisNeural", - gender: "male", - displayName: "Luis", - locale: "es-EC", - }, - { - name: "es-ES-ElviraNeural", - gender: "female", - displayName: "Elvira", - locale: "es-ES", - }, - { - name: "es-ES-AlvaroNeural", - gender: "male", - displayName: "Álvaro", - locale: "es-ES", - }, - { - name: "es-ES-ArabellaMultilingualNeural", - gender: "female", - displayName: "Arabella Multilingual", - locale: "es-ES", - }, - { - name: "es-ES-IsidoraMultilingualNeural", - gender: "female", - displayName: "Isidora Multilingual", - locale: "es-ES", - }, - { - name: "es-ES-TristanMultilingualNeural", - gender: "male", - displayName: "Tristan Multilingual", - locale: "es-ES", - }, - { - name: "es-ES-XimenaMultilingualNeural", - gender: "female", - displayName: "Ximena Multilingual", - locale: "es-ES", - }, - { - name: "es-ES-AbrilNeural", - gender: "female", - displayName: "Abril", - locale: "es-ES", - }, - { - name: "es-ES-ArnauNeural", - gender: "male", - displayName: "Arnau", - locale: "es-ES", - }, - { - name: "es-ES-DarioNeural", - gender: "male", - displayName: "Dario", - locale: "es-ES", - }, - { - name: "es-ES-EliasNeural", - gender: "male", - displayName: "Elias", - locale: "es-ES", - }, - { - name: "es-ES-EstrellaNeural", - gender: "female", - displayName: "Estrella", - locale: "es-ES", - }, - { - name: "es-ES-IreneNeural", - gender: "female", - displayName: "Irene", - locale: "es-ES", - }, - { - name: "es-ES-LaiaNeural", - gender: "female", - displayName: "Laia", - locale: "es-ES", - }, - { - name: "es-ES-LiaNeural", - gender: "female", - displayName: "Lia", - locale: "es-ES", - }, - { - name: "es-ES-NilNeural", - gender: "male", - displayName: "Nil", - locale: "es-ES", - }, - { - name: "es-ES-SaulNeural", - gender: "male", - displayName: "Saul", - locale: "es-ES", - }, - { - name: "es-ES-TeoNeural", - gender: "male", - displayName: "Teo", - locale: "es-ES", - }, - { - name: "es-ES-TrianaNeural", - gender: "female", - displayName: "Triana", - locale: "es-ES", - }, - { - name: "es-ES-VeraNeural", - gender: "female", - displayName: "Vera", - locale: "es-ES", - }, - { - name: "es-ES-XimenaNeural", - gender: "female", - displayName: "Ximena", - locale: "es-ES", - }, - { - name: "es-GQ-TeresaNeural", - gender: "female", - displayName: "Teresa", - locale: "es-GQ", - }, - { - name: "es-GQ-JavierNeural", - gender: "male", - displayName: "Javier", - locale: "es-GQ", - }, - { - name: "es-GT-MartaNeural", - gender: "female", - displayName: "Marta", - locale: "es-GT", - }, - { - name: "es-GT-AndresNeural", - gender: "male", - displayName: "Andrés", - locale: "es-GT", - }, - { - name: "es-HN-KarlaNeural", - gender: "female", - displayName: "Karla", - locale: "es-HN", - }, - { - name: "es-HN-CarlosNeural", - gender: "male", - displayName: "Carlos", - locale: "es-HN", - }, - { - name: "es-MX-DaliaNeural", - gender: "female", - displayName: "Dalia", - locale: "es-MX", - }, - { - name: "es-MX-JorgeNeural", - gender: "male", - displayName: "Jorge", - locale: "es-MX", - }, - { - name: "es-MX-DaliaMultilingualNeural", - gender: "female", - displayName: "Dalia Multilingual", - locale: "es-MX", - }, - { - name: "es-MX-JorgeMultilingualNeural", - gender: "male", - displayName: "Jorge Multilingual", - locale: "es-MX", - }, - { - name: "es-MX-BeatrizNeural", - gender: "female", - displayName: "Beatriz", - locale: "es-MX", - }, - { - name: "es-MX-CandelaNeural", - gender: "female", - displayName: "Candela", - locale: "es-MX", - }, - { - name: "es-MX-CarlotaNeural", - gender: "female", - displayName: "Carlota", - locale: "es-MX", - }, - { - name: "es-MX-CecilioNeural", - gender: "male", - displayName: "Cecilio", - locale: "es-MX", - }, - { - name: "es-MX-GerardoNeural", - gender: "male", - displayName: "Gerardo", - locale: "es-MX", - }, - { - name: "es-MX-LarissaNeural", - gender: "female", - displayName: "Larissa", - locale: "es-MX", - }, - { - name: "es-MX-LibertoNeural", - gender: "male", - displayName: "Liberto", - locale: "es-MX", - }, - { - name: "es-MX-LucianoNeural", - gender: "male", - displayName: "Luciano", - locale: "es-MX", - }, - { - name: "es-MX-MarinaNeural", - gender: "female", - displayName: "Marina", - locale: "es-MX", - }, - { - name: "es-MX-NuriaNeural", - gender: "female", - displayName: "Nuria", - locale: "es-MX", - }, - { - name: "es-MX-PelayoNeural", - gender: "male", - displayName: "Pelayo", - locale: "es-MX", - }, - { - name: "es-MX-RenataNeural", - gender: "female", - displayName: "Renata", - locale: "es-MX", - }, - { - name: "es-MX-YagoNeural", - gender: "male", - displayName: "Yago", - locale: "es-MX", - }, - { - name: "es-NI-YolandaNeural", - gender: "female", - displayName: "Yolanda", - locale: "es-NI", - }, - { - name: "es-NI-FedericoNeural", - gender: "male", - displayName: "Federico", - locale: "es-NI", - }, - { - name: "es-PA-MargaritaNeural", - gender: "female", - displayName: "Margarita", - locale: "es-PA", - }, - { - name: "es-PA-RobertoNeural", - gender: "male", - displayName: "Roberto", - locale: "es-PA", - }, - { - name: "es-PE-CamilaNeural", - gender: "female", - displayName: "Camila", - locale: "es-PE", - }, - { - name: "es-PE-AlexNeural", - gender: "male", - displayName: "Alex", - locale: "es-PE", - }, - { - name: "es-PR-KarinaNeural", - gender: "female", - displayName: "Karina", - locale: "es-PR", - }, - { - name: "es-PR-VictorNeural", - gender: "male", - displayName: "Víctor", - locale: "es-PR", - }, - { - name: "es-PY-TaniaNeural", - gender: "female", - displayName: "Tania", - locale: "es-PY", - }, - { - name: "es-PY-MarioNeural", - gender: "male", - displayName: "Mario", - locale: "es-PY", - }, - { - name: "es-SV-LorenaNeural", - gender: "female", - displayName: "Lorena", - locale: "es-SV", - }, - { - name: "es-SV-RodrigoNeural", - gender: "male", - displayName: "Rodrigo", - locale: "es-SV", - }, - { - name: "es-US-PalomaNeural", - gender: "female", - displayName: "Paloma", - locale: "es-US", - }, - { - name: "es-US-AlonsoNeural", - gender: "male", - displayName: "Alonso", - locale: "es-US", - }, - { - name: "es-UY-ValentinaNeural", - gender: "female", - displayName: "Valentina", - locale: "es-UY", - }, - { - name: "es-UY-MateoNeural", - gender: "male", - displayName: "Mateo", - locale: "es-UY", - }, - { - name: "es-VE-PaolaNeural", - gender: "female", - displayName: "Paola", - locale: "es-VE", - }, - { - name: "es-VE-SebastianNeural", - gender: "male", - displayName: "Sebastián", - locale: "es-VE", - }, - { - name: "et-EE-AnuNeural", - gender: "female", - displayName: "Anu", - locale: "et-EE", - }, - { - name: "et-EE-KertNeural", - gender: "male", - displayName: "Kert", - locale: "et-EE", - }, - { - name: "eu-ES-AinhoaNeural", - gender: "female", - displayName: "Ainhoa", - locale: "eu-ES", - }, - { - name: "eu-ES-AnderNeural", - gender: "male", - displayName: "Ander", - locale: "eu-ES", - }, - { - name: "fa-IR-DilaraNeural", - gender: "female", - displayName: "دلارا", - locale: "fa-IR", - }, - { - name: "fa-IR-FaridNeural", - gender: "male", - displayName: "فرید", - locale: "fa-IR", - }, - { - name: "fi-FI-SelmaNeural", - gender: "female", - displayName: "Selma", - locale: "fi-FI", - }, - { - name: "fi-FI-HarriNeural", - gender: "male", - displayName: "Harri", - locale: "fi-FI", - }, - { - name: "fi-FI-NooraNeural", - gender: "female", - displayName: "Noora", - locale: "fi-FI", - }, - { - name: "fil-PH-BlessicaNeural", - gender: "female", - displayName: "Blessica", - locale: "fil-PH", - }, - { - name: "fil-PH-AngeloNeural", - gender: "male", - displayName: "Angelo", - locale: "fil-PH", - }, - { - name: "fr-BE-CharlineNeural", - gender: "female", - displayName: "Charline", - locale: "fr-BE", - }, - { - name: "fr-BE-GerardNeural", - gender: "male", - displayName: "Gerard", - locale: "fr-BE", - }, - { - name: "fr-CA-SylvieNeural", - gender: "female", - displayName: "Sylvie", - locale: "fr-CA", - }, - { - name: "fr-CA-JeanNeural", - gender: "male", - displayName: "Jean", - locale: "fr-CA", - }, - { - name: "fr-CA-AntoineNeural", - gender: "male", - displayName: "Antoine", - locale: "fr-CA", - }, - { - name: "fr-CA-ThierryNeural", - gender: "male", - displayName: "Thierry", - locale: "fr-CA", - }, - { - name: "fr-CH-ArianeNeural", - gender: "female", - displayName: "Ariane", - locale: "fr-CH", - }, - { - name: "fr-CH-FabriceNeural", - gender: "male", - displayName: "Fabrice", - locale: "fr-CH", - }, - { - name: "fr-FR-DeniseNeural", - gender: "female", - displayName: "Denise", - locale: "fr-FR", - }, - { - name: "fr-FR-HenriNeural", - gender: "male", - displayName: "Henri", - locale: "fr-FR", - }, - { - name: "fr-FR-VivienneMultilingualNeural", - gender: "female", - displayName: "Vivienne Multilingue", - locale: "fr-FR", - }, - { - name: "fr-FR-RemyMultilingualNeural", - gender: "male", - displayName: "Rémy Multilingue", - locale: "fr-FR", - }, - { - name: "fr-FR-LucienMultilingualNeural", - gender: "male", - displayName: "Lucien Multilingual", - locale: "fr-FR", - }, - { - name: "fr-FR-AlainNeural", - gender: "male", - displayName: "Alain", - locale: "fr-FR", - }, - { - name: "fr-FR-BrigitteNeural", - gender: "female", - displayName: "Brigitte", - locale: "fr-FR", - }, - { - name: "fr-FR-CelesteNeural", - gender: "female", - displayName: "Celeste", - locale: "fr-FR", - }, - { - name: "fr-FR-ClaudeNeural", - gender: "male", - displayName: "Claude", - locale: "fr-FR", - }, - { - name: "fr-FR-CoralieNeural", - gender: "female", - displayName: "Coralie", - locale: "fr-FR", - }, - { - name: "fr-FR-EloiseNeural", - gender: "female", - displayName: "Eloise", - locale: "fr-FR", - }, - { - name: "fr-FR-JacquelineNeural", - gender: "female", - displayName: "Jacqueline", - locale: "fr-FR", - }, - { - name: "fr-FR-JeromeNeural", - gender: "male", - displayName: "Jerome", - locale: "fr-FR", - }, - { - name: "fr-FR-JosephineNeural", - gender: "female", - displayName: "Josephine", - locale: "fr-FR", - }, - { - name: "fr-FR-MauriceNeural", - gender: "male", - displayName: "Maurice", - locale: "fr-FR", - }, - { - name: "fr-FR-YvesNeural", - gender: "male", - displayName: "Yves", - locale: "fr-FR", - }, - { - name: "fr-FR-YvetteNeural", - gender: "female", - displayName: "Yvette", - locale: "fr-FR", - }, - { - name: "ga-IE-OrlaNeural", - gender: "female", - displayName: "Orla", - locale: "ga-IE", - }, - { - name: "ga-IE-ColmNeural", - gender: "male", - displayName: "Colm", - locale: "ga-IE", - }, - { - name: "gl-ES-SabelaNeural", - gender: "female", - displayName: "Sabela", - locale: "gl-ES", - }, - { - name: "gl-ES-RoiNeural", - gender: "male", - displayName: "Roi", - locale: "gl-ES", - }, - { - name: "gu-IN-DhwaniNeural", - gender: "female", - displayName: "ધ્વની", - locale: "gu-IN", - }, - { - name: "gu-IN-NiranjanNeural", - gender: "male", - displayName: "નિરંજન", - locale: "gu-IN", - }, - { - name: "he-IL-HilaNeural", - gender: "female", - displayName: "הילה", - locale: "he-IL", - }, - { - name: "he-IL-AvriNeural", - gender: "male", - displayName: "אברי", - locale: "he-IL", - }, - { - name: "hi-IN-AaravNeural", - gender: "male", - displayName: "आरव ", - locale: "hi-IN", - }, - { - name: "hi-IN-AnanyaNeural", - gender: "female", - displayName: "अनन्या", - locale: "hi-IN", - }, - { - name: "hi-IN-AartiNeural", - gender: "female", - displayName: "आरती", - locale: "hi-IN", - }, - { - name: "hi-IN-ArjunNeural", - gender: "male", - displayName: "अर्जुन", - locale: "hi-IN", - }, - { - name: "hi-IN-KavyaNeural", - gender: "female", - displayName: "काव्या", - locale: "hi-IN", - }, - { - name: "hi-IN-KunalNeural", - gender: "male", - displayName: "कुनाल ", - locale: "hi-IN", - }, - { - name: "hi-IN-RehaanNeural", - gender: "male", - displayName: "रेहान", - locale: "hi-IN", - }, - { - name: "hi-IN-SwaraNeural", - gender: "female", - displayName: "स्वरा", - locale: "hi-IN", - }, - { - name: "hi-IN-MadhurNeural", - gender: "male", - displayName: "मधुर", - locale: "hi-IN", - }, - { - name: "hr-HR-GabrijelaNeural", - gender: "female", - displayName: "Gabrijela", - locale: "hr-HR", - }, - { - name: "hr-HR-SreckoNeural", - gender: "male", - displayName: "Srećko", - locale: "hr-HR", - }, - { - name: "hu-HU-NoemiNeural", - gender: "female", - displayName: "Noémi", - locale: "hu-HU", - }, - { - name: "hu-HU-TamasNeural", - gender: "male", - displayName: "Tamás", - locale: "hu-HU", - }, - { - name: "hy-AM-AnahitNeural", - gender: "female", - displayName: "Անահիտ", - locale: "hy-AM", - }, - { - name: "hy-AM-HaykNeural", - gender: "male", - displayName: "Հայկ", - locale: "hy-AM", - }, - { - name: "id-ID-GadisNeural", - gender: "female", - displayName: "Gadis", - locale: "id-ID", - }, - { - name: "id-ID-ArdiNeural", - gender: "male", - displayName: "Ardi", - locale: "id-ID", - }, - { - name: "is-IS-GudrunNeural", - gender: "female", - displayName: "Guðrún", - locale: "is-IS", - }, - { - name: "is-IS-GunnarNeural", - gender: "male", - displayName: "Gunnar", - locale: "is-IS", - }, - { - name: "it-IT-ElsaNeural", - gender: "female", - displayName: "Elsa", - locale: "it-IT", - }, - { - name: "it-IT-IsabellaNeural", - gender: "female", - displayName: "Isabella", - locale: "it-IT", - }, - { - name: "it-IT-DiegoNeural", - gender: "male", - displayName: "Diego", - locale: "it-IT", - }, - { - name: "it-IT-AlessioMultilingualNeural", - gender: "male", - displayName: "Alessio Multilingual", - locale: "it-IT", - }, - { - name: "it-IT-IsabellaMultilingualNeural", - gender: "female", - displayName: "Isabella Multilingual", - locale: "it-IT", - }, - { - name: "it-IT-GiuseppeMultilingualNeural", - gender: "male", - displayName: "Giuseppe Multilingual", - locale: "it-IT", - }, - { - name: "it-IT-MarcelloMultilingualNeural", - gender: "male", - displayName: "Marcello Multilingual", - locale: "it-IT", - }, - { - name: "it-IT-BenignoNeural", - gender: "male", - displayName: "Benigno", - locale: "it-IT", - }, - { - name: "it-IT-CalimeroNeural", - gender: "male", - displayName: "Calimero", - locale: "it-IT", - }, - { - name: "it-IT-CataldoNeural", - gender: "male", - displayName: "Cataldo", - locale: "it-IT", - }, - { - name: "it-IT-FabiolaNeural", - gender: "female", - displayName: "Fabiola", - locale: "it-IT", - }, - { - name: "it-IT-FiammaNeural", - gender: "female", - displayName: "Fiamma", - locale: "it-IT", - }, - { - name: "it-IT-GianniNeural", - gender: "male", - displayName: "Gianni", - locale: "it-IT", - }, - { - name: "it-IT-GiuseppeNeural", - gender: "male", - displayName: "Giuseppe", - locale: "it-IT", - }, - { - name: "it-IT-ImeldaNeural", - gender: "female", - displayName: "Imelda", - locale: "it-IT", - }, - { - name: "it-IT-IrmaNeural", - gender: "female", - displayName: "Irma", - locale: "it-IT", - }, - { - name: "it-IT-LisandroNeural", - gender: "male", - displayName: "Lisandro", - locale: "it-IT", - }, - { - name: "it-IT-PalmiraNeural", - gender: "female", - displayName: "Palmira", - locale: "it-IT", - }, - { - name: "it-IT-PierinaNeural", - gender: "female", - displayName: "Pierina", - locale: "it-IT", - }, - { - name: "it-IT-RinaldoNeural", - gender: "male", - displayName: "Rinaldo", - locale: "it-IT", - }, - { - name: "iu-Cans-CA-SiqiniqNeural", - gender: "female", - displayName: "ᓯᕿᓂᖅ", - locale: "iu-Cans-CA", - }, - { - name: "iu-Cans-CA-TaqqiqNeural", - gender: "male", - displayName: "ᑕᖅᑭᖅ", - locale: "iu-Cans-CA", - }, - { - name: "iu-Latn-CA-SiqiniqNeural", - gender: "female", - displayName: "ᓯᕿᓂᖅ", - locale: "iu-Latn-CA", - }, - { - name: "iu-Latn-CA-TaqqiqNeural", - gender: "male", - displayName: "ᑕᖅᑭᖅ", - locale: "iu-Latn-CA", - }, - { - name: "ja-JP-NanamiNeural", - gender: "female", - displayName: "七海", - locale: "ja-JP", - }, - { - name: "ja-JP-KeitaNeural", - gender: "male", - displayName: "圭太", - locale: "ja-JP", - }, - { - name: "ja-JP-AoiNeural", - gender: "female", - displayName: "碧衣", - locale: "ja-JP", - }, - { - name: "ja-JP-DaichiNeural", - gender: "male", - displayName: "大智", - locale: "ja-JP", - }, - { - name: "ja-JP-MayuNeural", - gender: "female", - displayName: "真夕", - locale: "ja-JP", - }, - { - name: "ja-JP-NaokiNeural", - gender: "male", - displayName: "直紀", - locale: "ja-JP", - }, - { - name: "ja-JP-ShioriNeural", - gender: "female", - displayName: "志織", - locale: "ja-JP", - }, - { - name: "ja-JP-MasaruMultilingualNeural", - gender: "male", - displayName: "勝 多言語", - locale: "ja-JP", - }, - { - name: "jv-ID-SitiNeural", - gender: "female", - displayName: "Siti", - locale: "jv-ID", - }, - { - name: "jv-ID-DimasNeural", - gender: "male", - displayName: "Dimas", - locale: "jv-ID", - }, - { - name: "ka-GE-EkaNeural", - gender: "female", - displayName: "ეკა", - locale: "ka-GE", - }, - { - name: "ka-GE-GiorgiNeural", - gender: "male", - displayName: "გიორგი", - locale: "ka-GE", - }, - { - name: "kk-KZ-AigulNeural", - gender: "female", - displayName: "Айгүл", - locale: "kk-KZ", - }, - { - name: "kk-KZ-DauletNeural", - gender: "male", - displayName: "Дәулет", - locale: "kk-KZ", - }, - { - name: "km-KH-SreymomNeural", - gender: "female", - displayName: "ស្រីមុំ", - locale: "km-KH", - }, - { - name: "km-KH-PisethNeural", - gender: "male", - displayName: "ពិសិដ្ឋ", - locale: "km-KH", - }, - { - name: "kn-IN-SapnaNeural", - gender: "female", - displayName: "ಸಪ್ನಾ", - locale: "kn-IN", - }, - { - name: "kn-IN-GaganNeural", - gender: "male", - displayName: "ಗಗನ್", - locale: "kn-IN", - }, - { - name: "ko-KR-SunHiNeural", - gender: "female", - displayName: "선히", - locale: "ko-KR", - }, - { - name: "ko-KR-InJoonNeural", - gender: "male", - displayName: "인준", - locale: "ko-KR", - }, - { - name: "ko-KR-HyunsuMultilingualNeural", - gender: "male", - displayName: "Hyunsu Multilingual", - locale: "ko-KR", - }, - { - name: "ko-KR-BongJinNeural", - gender: "male", - displayName: "봉진", - locale: "ko-KR", - }, - { - name: "ko-KR-GookMinNeural", - gender: "male", - displayName: "국민", - locale: "ko-KR", - }, - { - name: "ko-KR-HyunsuNeural", - gender: "male", - displayName: "현수", - locale: "ko-KR", - }, - { - name: "ko-KR-JiMinNeural", - gender: "female", - displayName: "지민", - locale: "ko-KR", - }, - { - name: "ko-KR-SeoHyeonNeural", - gender: "female", - displayName: "서현", - locale: "ko-KR", - }, - { - name: "ko-KR-SoonBokNeural", - gender: "female", - displayName: "순복", - locale: "ko-KR", - }, - { - name: "ko-KR-YuJinNeural", - gender: "female", - displayName: "유진", - locale: "ko-KR", - }, - { - name: "lo-LA-KeomanyNeural", - gender: "female", - displayName: "ແກ້ວມະນີ", - locale: "lo-LA", - }, - { - name: "lo-LA-ChanthavongNeural", - gender: "male", - displayName: "ຈັນທະວົງ", - locale: "lo-LA", - }, - { - name: "lt-LT-OnaNeural", - gender: "female", - displayName: "Ona", - locale: "lt-LT", - }, - { - name: "lt-LT-LeonasNeural", - gender: "male", - displayName: "Leonas", - locale: "lt-LT", - }, - { - name: "lv-LV-EveritaNeural", - gender: "female", - displayName: "Everita", - locale: "lv-LV", - }, - { - name: "lv-LV-NilsNeural", - gender: "male", - displayName: "Nils", - locale: "lv-LV", - }, - { - name: "mk-MK-MarijaNeural", - gender: "female", - displayName: "Марија", - locale: "mk-MK", - }, - { - name: "mk-MK-AleksandarNeural", - gender: "male", - displayName: "Александар", - locale: "mk-MK", - }, - { - name: "ml-IN-SobhanaNeural", - gender: "female", - displayName: "ശോഭന", - locale: "ml-IN", - }, - { - name: "ml-IN-MidhunNeural", - gender: "male", - displayName: "മിഥുൻ", - locale: "ml-IN", - }, - { - name: "mn-MN-YesuiNeural", - gender: "female", - displayName: "Есүй", - locale: "mn-MN", - }, - { - name: "mn-MN-BataaNeural", - gender: "male", - displayName: "Батаа", - locale: "mn-MN", - }, - { - name: "mr-IN-AarohiNeural", - gender: "female", - displayName: "आरोही", - locale: "mr-IN", - }, - { - name: "mr-IN-ManoharNeural", - gender: "male", - displayName: "मनोहर", - locale: "mr-IN", - }, - { - name: "ms-MY-YasminNeural", - gender: "female", - displayName: "Yasmin", - locale: "ms-MY", - }, - { - name: "ms-MY-OsmanNeural", - gender: "male", - displayName: "Osman", - locale: "ms-MY", - }, - { - name: "mt-MT-GraceNeural", - gender: "female", - displayName: "Grace", - locale: "mt-MT", - }, - { - name: "mt-MT-JosephNeural", - gender: "male", - displayName: "Joseph", - locale: "mt-MT", - }, - { - name: "my-MM-NilarNeural", - gender: "female", - displayName: "နီလာ", - locale: "my-MM", - }, - { - name: "my-MM-ThihaNeural", - gender: "male", - displayName: "သီဟ", - locale: "my-MM", - }, - { - name: "nb-NO-PernilleNeural", - gender: "female", - displayName: "Pernille", - locale: "nb-NO", - }, - { - name: "nb-NO-FinnNeural", - gender: "male", - displayName: "Finn", - locale: "nb-NO", - }, - { - name: "nb-NO-IselinNeural", - gender: "female", - displayName: "Iselin", - locale: "nb-NO", - }, - { - name: "ne-NP-HemkalaNeural", - gender: "female", - displayName: "हेमकला", - locale: "ne-NP", - }, - { - name: "ne-NP-SagarNeural", - gender: "male", - displayName: "सागर", - locale: "ne-NP", - }, - { - name: "nl-BE-DenaNeural", - gender: "female", - displayName: "Dena", - locale: "nl-BE", - }, - { - name: "nl-BE-ArnaudNeural", - gender: "male", - displayName: "Arnaud", - locale: "nl-BE", - }, - { - name: "nl-NL-FennaNeural", - gender: "female", - displayName: "Fenna", - locale: "nl-NL", - }, - { - name: "nl-NL-MaartenNeural", - gender: "male", - displayName: "Maarten", - locale: "nl-NL", - }, - { - name: "nl-NL-ColetteNeural", - gender: "female", - displayName: "Colette", - locale: "nl-NL", - }, - { - name: "or-IN-SubhasiniNeural", - gender: "female", - displayName: "ସୁଭାସିନୀ", - locale: "or-IN", - }, - { - name: "or-IN-SukantNeural", - gender: "male", - displayName: "ସୁକାନ୍ତ", - locale: "or-IN", - }, - { - name: "pa-IN-OjasNeural", - gender: "male", - displayName: "ਓਜਸ", - locale: "pa-IN", - }, - { - name: "pa-IN-VaaniNeural", - gender: "female", - displayName: "ਵਾਨੀ", - locale: "pa-IN", - }, - { - name: "pl-PL-AgnieszkaNeural", - gender: "female", - displayName: "Agnieszka", - locale: "pl-PL", - }, - { - name: "pl-PL-MarekNeural", - gender: "male", - displayName: "Marek", - locale: "pl-PL", - }, - { - name: "pl-PL-ZofiaNeural", - gender: "female", - displayName: "Zofia", - locale: "pl-PL", - }, - { - name: "ps-AF-LatifaNeural", - gender: "female", - displayName: "لطيفه", - locale: "ps-AF", - }, - { - name: "ps-AF-GulNawazNeural", - gender: "male", - displayName: " ګل نواز", - locale: "ps-AF", - }, - { - name: "pt-BR-FranciscaNeural", - gender: "female", - displayName: "Francisca", - locale: "pt-BR", - }, - { - name: "pt-BR-AntonioNeural", - gender: "male", - displayName: "Antônio", - locale: "pt-BR", - }, - { - name: "pt-BR-MacerioMultilingualNeural", - gender: "male", - displayName: "Macerio Multilingual", - locale: "pt-BR", - }, - { - name: "pt-BR-ThalitaMultilingualNeural", - gender: "female", - displayName: "Thalita multilíngue", - locale: "pt-BR", - }, - { - name: "pt-BR-BrendaNeural", - gender: "female", - displayName: "Brenda", - locale: "pt-BR", - }, - { - name: "pt-BR-DonatoNeural", - gender: "male", - displayName: "Donato", - locale: "pt-BR", - }, - { - name: "pt-BR-ElzaNeural", - gender: "female", - displayName: "Elza", - locale: "pt-BR", - }, - { - name: "pt-BR-FabioNeural", - gender: "male", - displayName: "Fabio", - locale: "pt-BR", - }, - { - name: "pt-BR-GiovannaNeural", - gender: "female", - displayName: "Giovanna", - locale: "pt-BR", - }, - { - name: "pt-BR-HumbertoNeural", - gender: "male", - displayName: "Humberto", - locale: "pt-BR", - }, - { - name: "pt-BR-JulioNeural", - gender: "male", - displayName: "Julio", - locale: "pt-BR", - }, - { - name: "pt-BR-LeilaNeural", - gender: "female", - displayName: "Leila", - locale: "pt-BR", - }, - { - name: "pt-BR-LeticiaNeural", - gender: "female", - displayName: "Leticia", - locale: "pt-BR", - }, - { - name: "pt-BR-ManuelaNeural", - gender: "female", - displayName: "Manuela", - locale: "pt-BR", - }, - { - name: "pt-BR-NicolauNeural", - gender: "male", - displayName: "Nicolau", - locale: "pt-BR", - }, - { - name: "pt-BR-ThalitaNeural", - gender: "female", - displayName: "Thalita", - locale: "pt-BR", - }, - { - name: "pt-BR-ValerioNeural", - gender: "male", - displayName: "Valerio", - locale: "pt-BR", - }, - { - name: "pt-BR-YaraNeural", - gender: "female", - displayName: "Yara", - locale: "pt-BR", - }, - { - name: "pt-PT-RaquelNeural", - gender: "female", - displayName: "Raquel", - locale: "pt-PT", - }, - { - name: "pt-PT-DuarteNeural", - gender: "male", - displayName: "Duarte", - locale: "pt-PT", - }, - { - name: "pt-PT-FernandaNeural", - gender: "female", - displayName: "Fernanda", - locale: "pt-PT", - }, - { - name: "ro-RO-AlinaNeural", - gender: "female", - displayName: "Alina", - locale: "ro-RO", - }, - { - name: "ro-RO-EmilNeural", - gender: "male", - displayName: "Emil", - locale: "ro-RO", - }, - { - name: "ru-RU-SvetlanaNeural", - gender: "female", - displayName: "Светлана", - locale: "ru-RU", - }, - { - name: "ru-RU-DmitryNeural", - gender: "male", - displayName: "Дмитрий", - locale: "ru-RU", - }, - { - name: "ru-RU-DariyaNeural", - gender: "female", - displayName: "Дария", - locale: "ru-RU", - }, - { - name: "si-LK-ThiliniNeural", - gender: "female", - displayName: "තිළිණි", - locale: "si-LK", - }, - { - name: "si-LK-SameeraNeural", - gender: "male", - displayName: "සමීර", - locale: "si-LK", - }, - { - name: "sk-SK-ViktoriaNeural", - gender: "female", - displayName: "Viktória", - locale: "sk-SK", - }, - { - name: "sk-SK-LukasNeural", - gender: "male", - displayName: "Lukáš", - locale: "sk-SK", - }, - { - name: "sl-SI-PetraNeural", - gender: "female", - displayName: "Petra", - locale: "sl-SI", - }, - { - name: "sl-SI-RokNeural", - gender: "male", - displayName: "Rok", - locale: "sl-SI", - }, - { - name: "so-SO-UbaxNeural", - gender: "female", - displayName: "Ubax", - locale: "so-SO", - }, - { - name: "so-SO-MuuseNeural", - gender: "male", - displayName: "Muuse", - locale: "so-SO", - }, - { - name: "sq-AL-AnilaNeural", - gender: "female", - displayName: "Anila", - locale: "sq-AL", - }, - { - name: "sq-AL-IlirNeural", - gender: "male", - displayName: "Ilir", - locale: "sq-AL", - }, - { - name: "sr-Latn-RS-NicholasNeural", - gender: "male", - displayName: "Nicholas", - locale: "sr-Latn-RS", - }, - { - name: "sr-Latn-RS-SophieNeural", - gender: "female", - displayName: "Sophie", - locale: "sr-Latn-RS", - }, - { - name: "sr-RS-SophieNeural", - gender: "female", - displayName: "Софија", - locale: "sr-RS", - }, - { - name: "sr-RS-NicholasNeural", - gender: "male", - displayName: "Никола", - locale: "sr-RS", - }, - { - name: "su-ID-TutiNeural", - gender: "female", - displayName: "Tuti", - locale: "su-ID", - }, - { - name: "su-ID-JajangNeural", - gender: "male", - displayName: "Jajang", - locale: "su-ID", - }, - { - name: "sv-SE-SofieNeural", - gender: "female", - displayName: "Sofie", - locale: "sv-SE", - }, - { - name: "sv-SE-MattiasNeural", - gender: "male", - displayName: "Mattias", - locale: "sv-SE", - }, - { - name: "sv-SE-HilleviNeural", - gender: "female", - displayName: "Hillevi", - locale: "sv-SE", - }, - { - name: "sw-KE-ZuriNeural", - gender: "female", - displayName: "Zuri", - locale: "sw-KE", - }, - { - name: "sw-KE-RafikiNeural", - gender: "male", - displayName: "Rafiki", - locale: "sw-KE", - }, - { - name: "sw-TZ-RehemaNeural", - gender: "female", - displayName: "Rehema", - locale: "sw-TZ", - }, - { - name: "sw-TZ-DaudiNeural", - gender: "male", - displayName: "Daudi", - locale: "sw-TZ", - }, - { - name: "ta-IN-PallaviNeural", - gender: "female", - displayName: "பல்லவி", - locale: "ta-IN", - }, - { - name: "ta-IN-ValluvarNeural", - gender: "male", - displayName: "வள்ளுவர்", - locale: "ta-IN", - }, - { - name: "ta-LK-SaranyaNeural", - gender: "female", - displayName: "சரண்யா", - locale: "ta-LK", - }, - { - name: "ta-LK-KumarNeural", - gender: "male", - displayName: "குமார்", - locale: "ta-LK", - }, - { - name: "ta-MY-KaniNeural", - gender: "female", - displayName: "கனி", - locale: "ta-MY", - }, - { - name: "ta-MY-SuryaNeural", - gender: "male", - displayName: "சூர்யா", - locale: "ta-MY", - }, - { - name: "ta-SG-VenbaNeural", - gender: "female", - displayName: "வெண்பா", - locale: "ta-SG", - }, - { - name: "ta-SG-AnbuNeural", - gender: "male", - displayName: "அன்பு", - locale: "ta-SG", - }, - { - name: "te-IN-ShrutiNeural", - gender: "female", - displayName: "శ్రుతి", - locale: "te-IN", - }, - { - name: "te-IN-MohanNeural", - gender: "male", - displayName: "మోహన్", - locale: "te-IN", - }, - { - name: "th-TH-PremwadeeNeural", - gender: "female", - displayName: "เปรมวดี", - locale: "th-TH", - }, - { - name: "th-TH-NiwatNeural", - gender: "male", - displayName: "นิวัฒน์", - locale: "th-TH", - }, - { - name: "th-TH-AcharaNeural", - gender: "female", - displayName: "อัจฉรา", - locale: "th-TH", - }, - { - name: "tr-TR-EmelNeural", - gender: "female", - displayName: "Emel", - locale: "tr-TR", - }, - { - name: "tr-TR-AhmetNeural", - gender: "male", - displayName: "Ahmet", - locale: "tr-TR", - }, - { - name: "uk-UA-PolinaNeural", - gender: "female", - displayName: "Поліна", - locale: "uk-UA", - }, - { - name: "uk-UA-OstapNeural", - gender: "male", - displayName: "Остап", - locale: "uk-UA", - }, - { - name: "ur-IN-GulNeural", - gender: "female", - displayName: "گل", - locale: "ur-IN", - }, - { - name: "ur-IN-SalmanNeural", - gender: "male", - displayName: "سلمان", - locale: "ur-IN", - }, - { - name: "ur-PK-UzmaNeural", - gender: "female", - displayName: "عظمیٰ", - locale: "ur-PK", - }, - { - name: "ur-PK-AsadNeural", - gender: "male", - displayName: "اسد", - locale: "ur-PK", - }, - { - name: "uz-UZ-MadinaNeural", - gender: "female", - displayName: "Madina", - locale: "uz-UZ", - }, - { - name: "uz-UZ-SardorNeural", - gender: "male", - displayName: "Sardor", - locale: "uz-UZ", - }, - { - name: "vi-VN-HoaiMyNeural", - gender: "female", - displayName: "Hoài My", - locale: "vi-VN", - }, - { - name: "vi-VN-NamMinhNeural", - gender: "male", - displayName: "Nam Minh", - locale: "vi-VN", - }, - { - name: "wuu-CN-XiaotongNeural", - gender: "female", - displayName: "晓彤", - locale: "wuu-CN", - }, - { - name: "wuu-CN-YunzheNeural", - gender: "male", - displayName: "云哲", - locale: "wuu-CN", - }, - { - name: "yue-CN-XiaoMinNeural", - gender: "female", - displayName: "晓敏", - locale: "yue-CN", - }, - { - name: "yue-CN-YunSongNeural", - gender: "male", - displayName: "云松", - locale: "yue-CN", - }, - { - name: "zh-CN-XiaoxiaoNeural", - gender: "female", - displayName: "晓晓", - locale: "zh-CN", - }, - { - name: "zh-CN-YunxiNeural", - gender: "male", - displayName: "云希", - locale: "zh-CN", - }, - { - name: "zh-CN-YunjianNeural", - gender: "male", - displayName: "云健", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoyiNeural", - gender: "female", - displayName: "晓伊", - locale: "zh-CN", - }, - { - name: "zh-CN-YunyangNeural", - gender: "male", - displayName: "云扬", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaochenNeural", - gender: "female", - displayName: "晓辰", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaochenMultilingualNeural", - gender: "female", - displayName: "晓辰 多语言", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaohanNeural", - gender: "female", - displayName: "晓涵", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaomengNeural", - gender: "female", - displayName: "晓梦", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaomoNeural", - gender: "female", - displayName: "晓墨", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoqiuNeural", - gender: "female", - displayName: "晓秋", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaorouNeural", - gender: "female", - displayName: "晓柔", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoruiNeural", - gender: "female", - displayName: "晓睿", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoshuangNeural", - gender: "female", - displayName: "晓双", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoxiaoDialectsNeural", - gender: "female", - displayName: "晓晓 方言", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoxiaoMultilingualNeural", - gender: "female", - displayName: "晓晓 多语言", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoyanNeural", - gender: "female", - displayName: "晓颜", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoyouNeural", - gender: "female", - displayName: "晓悠", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaoyuMultilingualNeural", - gender: "female", - displayName: "晓宇 多语言", - locale: "zh-CN", - }, - { - name: "zh-CN-XiaozhenNeural", - gender: "female", - displayName: "晓甄", - locale: "zh-CN", - }, - { - name: "zh-CN-YunfengNeural", - gender: "male", - displayName: "云枫", - locale: "zh-CN", - }, - { - name: "zh-CN-YunhaoNeural", - gender: "male", - displayName: "云皓", - locale: "zh-CN", - }, - { - name: "zh-CN-YunjieNeural", - gender: "male", - displayName: "云杰", - locale: "zh-CN", - }, - { - name: "zh-CN-YunxiaNeural", - gender: "male", - displayName: "云夏", - locale: "zh-CN", - }, - { - name: "zh-CN-YunxiaoMultilingualNeural", - gender: "male", - displayName: "云霄 多语言", - locale: "zh-CN", - }, - { - name: "zh-CN-YunyeNeural", - gender: "male", - displayName: "云野", - locale: "zh-CN", - }, - { - name: "zh-CN-YunyiMultilingualNeural", - gender: "male", - displayName: "云逸 多语言", - locale: "zh-CN", - }, - { - name: "zh-CN-YunzeNeural", - gender: "male", - displayName: "云泽", - locale: "zh-CN", - }, - { - name: "zh-CN-YunfanMultilingualNeural", - gender: "male", - displayName: "云帆 多语言", - locale: "zh-CN", - }, - { - name: "zh-CN-guangxi-YunqiNeural", - gender: "male", - displayName: "云奇 广西", - locale: "zh-CN", - }, - { - name: "zh-CN-henan-YundengNeural", - gender: "male", - displayName: "云登", - locale: "zh-CN", - }, - { - name: "zh-CN-liaoning-XiaobeiNeural", - gender: "female", - displayName: "晓北 辽宁", - locale: "zh-CN", - }, - { - name: "zh-CN-liaoning-YunbiaoNeural", - gender: "male", - displayName: "云彪 辽宁", - locale: "zh-CN", - }, - { - name: "zh-CN-shaanxi-XiaoniNeural", - gender: "female", - displayName: "晓妮", - locale: "zh-CN", - }, - { - name: "zh-CN-shandong-YunxiangNeural", - gender: "male", - displayName: "云翔", - locale: "zh-CN", - }, - { - name: "zh-CN-sichuan-YunxiNeural", - gender: "male", - displayName: "云希 四川", - locale: "zh-CN", - }, - { - name: "zh-HK-HiuMaanNeural", - gender: "female", - displayName: "曉曼", - locale: "zh-HK", - }, - { - name: "zh-HK-WanLungNeural", - gender: "male", - displayName: "雲龍", - locale: "zh-HK", - }, - { - name: "zh-HK-HiuGaaiNeural", - gender: "female", - displayName: "曉佳", - locale: "zh-HK", - }, - { - name: "zh-TW-HsiaoChenNeural", - gender: "female", - displayName: "曉臻", - locale: "zh-TW", - }, - { - name: "zh-TW-YunJheNeural", - gender: "male", - displayName: "雲哲", - locale: "zh-TW", - }, - { - name: "zh-TW-HsiaoYuNeural", - gender: "female", - displayName: "曉雨", - locale: "zh-TW", - }, - { - name: "zu-ZA-ThandoNeural", - gender: "female", - displayName: "Thando", - locale: "zu-ZA", - }, - { - name: "zu-ZA-ThembaNeural", - gender: "male", - displayName: "Themba", - locale: "zu-ZA", - }, -]; diff --git a/src/store/actions/manager.tsx b/src/store/actions/manager.tsx index 56ae1fa8..e23da851 100644 --- a/src/store/actions/manager.tsx +++ b/src/store/actions/manager.tsx @@ -1,5 +1,6 @@ import { ConfigService, + KookitConfig, TokenService, } from "../../assets/lib/kookit-extra-browser.min"; import BookModel from "../../models/Book"; @@ -18,7 +19,6 @@ import { import toast from "react-hot-toast"; import BookUtil from "../../utils/file/bookUtil"; import i18n from "../../i18n"; -import { azureTTSVoiceList, officialVoiceList } from "../../constants/ttsList"; import { langToName } from "../../utils/common"; import { resetReaderRequest } from "../../utils/request/reader"; import { resetThirdpartyRequest } from "../../utils/request/thirdparty"; @@ -443,7 +443,7 @@ export function handleFetchPlugins() { ); pluginList.push(sumPlugin); let sortedVoiceList = [ - ...officialVoiceList.map((item) => { + ...KookitConfig.OfficialVoiceList.map((item) => { return { ...item, label: @@ -458,7 +458,7 @@ export function handleFetchPlugins() { : i18n.t("Male voice")), }; }), - ...azureTTSVoiceList.map((item) => { + ...KookitConfig.AzureTTSVoiceList.map((item) => { return { ...item, label: @@ -498,7 +498,7 @@ export function handleFetchPlugins() { dispatch(handlePlugins(pluginList)); } else if (isAuthed) { let sortedVoiceList = [ - ...azureTTSVoiceList.map((item) => { + ...KookitConfig.AzureTTSVoiceList.map((item) => { return { ...item, label: