// ==UserScript== // @name ranobe-ebook-loader // @namespace mailto:taraflex.red@gmail.com // @version 0.2.6 // @author Taraflex // @description Юзерскрипт для скачивания книг (fb2, epub) c https://ранобэ.рф/ , https://ranobes.com/ , https://tl.rulate.ru/ , https://jaomix.ru/ // @license MIT // @homepageURL https://github.com/Taraflex/ranobe-ebook-loader // @icon https://raw.githubusercontent.com/Taraflex/ranobe-ebook-loader/master/icons/32.png // @icon64 https://raw.githubusercontent.com/Taraflex/ranobe-ebook-loader/master/icons/64.png // @downloadURL https://raw.githubusercontent.com/Taraflex/ranobe-ebook-loader/master/build/ranobe-ebook-loader.user.js // @updateURL https://raw.githubusercontent.com/Taraflex/ranobe-ebook-loader/master/build/ranobe-ebook-loader.meta.js // @supportURL https://github.com/Taraflex/ranobe-ebook-loader/issues // @match https://ранобэ.рф/* // @match https://xn--80ac9aeh6f.xn--p1ai/* // @match https://ranobes.com/ranobe/* // @match https://tl.rulate.ru/book/* // @match https://jaomix.ru/* // @connect * // @run-at document-idle // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest // @noframes // ==/UserScript== const e=()=>{document.removeEventListener("DOMContentLoaded",e);const t=document.createElement("div");t.id="ranobe-ebook-loader",document.body.appendChild(t),Promise.resolve().then((()=>$n)).then((e=>new e.default({target:t})))};function t(){}"complete"===document.readyState||"interactive"===document.readyState?e():document.addEventListener("DOMContentLoaded",e);const n=e=>e;function r(e){return e()}function o(){return Object.create(null)}function i(e){e.forEach(r)}function a(e){return"function"==typeof e}function s(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function l(e,n,r){e.$$.on_destroy.push(((e,...n)=>{if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r})(n,r))}function c(e,t,n,r){return e[1]&&r?((e,t)=>{for(const n in t)e[n]=t[n];return e})(n.ctx.slice(),e[1](r(t))):n.ctx}function u(e){return e&&a(e.destroy)?e.destroy:t}const d="undefined"!=typeof window;let f=d?()=>window.performance.now():()=>Date.now(),p=d?e=>requestAnimationFrame(e):t;const h=new Set;function m(e){h.forEach((t=>{t.c(e)||(h.delete(t),t.f())})),0!==h.size&&p(m)}function g(e,t){e.appendChild(t)}function y(e,t,n){e.insertBefore(t,n||null)}function b(e){e.parentNode.removeChild(e)}function v(e){return document.createElement(e)}function w(e){return document.createTextNode(e)}function x(){return w(" ")}function $(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function k(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function _(e,t,n,r){e.style.setProperty(t,n,r?"important":"")}function S(e,t){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}class A{constructor(e=null){this.a=e,this.e=this.n=null}m(e,t,n=null){this.e||(this.e=v(t.nodeName),this.t=t,this.h(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t{let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0})(u)}_${s}`,f=e.ownerDocument;E.add(f);const p=f.__svelte_stylesheet||(f.__svelte_stylesheet=f.head.appendChild(v("style")).sheet),h=f.__svelte_rules||(f.__svelte_rules={});h[d]||(h[d]=!0,p.insertRule(`@keyframes ${d} ${u}`,p.cssRules.length));const m=e.style.animation||"";return e.style.animation=`${m?m+", ":""}${d} ${r}ms linear ${o}ms 1 both`,O+=1,d}function T(e){M=e}function D(){if(!M)throw new Error("Function called outside component initialization");return M}function j(e){D().$$.on_mount.push(e)}function L(e){D().$$.on_destroy.push(e)}function P(){const e=D();return(t,n)=>{const r=e.$$.callbacks[t];if(r){const o=S(t,n);r.slice().forEach((t=>{t.call(e,o)}))}}}const q=[],B=[],N=[],U=[],I=Promise.resolve();let H=!1;function R(){H||(H=!0,I.then(Y))}function F(e){N.push(e)}let K=!1;const z=new Set;function Y(){if(!K){K=!0;do{for(let e=0;e{X.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}}const ne={duration:0};function re(e,r,o,s){let l=r(e,o),c=s?0:1,u=null,d=null,g=null;function y(){g&&function(e,t){const n=(e.style.animation||"").split(", "),r=n.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),o=n.length-r.length;o&&(e.style.animation=r.join(", "),O-=o,O||p((()=>{O||(E.forEach((e=>{const t=e.__svelte_stylesheet;let n=t.cssRules.length;for(;n--;)t.deleteRule(n);e.__svelte_rules={}})),E.clear())})))}(e,g)}function b(e,t){const n=e.b-c;return t*=Math.abs(n),{a:c,b:e.b,d:n,duration:t,start:e.start,end:e.start+t,group:e.group}}function v(r){const{delay:o=0,duration:a=300,easing:s=n,tick:v=t,css:w}=l||ne,x={start:f()+o,b:r};r||(x.group=Z,Z.r+=1),u||d?d=x:(w&&(y(),g=C(e,c,r,a,o,s,w)),r&&v(0,1),u=b(x,a),F((()=>J(e,r,"start"))),(e=>{let t;0===h.size&&p(m),new Promise((n=>{h.add(t={c:e,f:n})}))})((t=>{if(d&&t>d.start&&(u=b(d,a),d=null,J(e,u.b,"start"),w&&(y(),g=C(e,c,u.b,u.duration,0,s,l.css))),u)if(t>=u.end)v(c=u.b,1-c),J(e,u.b,"end"),d||(u.b?y():--u.group.r||i(u.group.c)),u=null;else if(t>=u.start){const e=t-u.start;c=u.a+u.d*s(e/u.duration),v(c,1-c)}return!(!u&&!d)})))}return{run(e){a(l)?(G||(G=Promise.resolve(),G.then((()=>{G=null}))),G).then((()=>{l=l(),v(e)})):v(e)},end(){y(),u=d=null}}}function oe(e,t){te(e,1,1,(()=>{t.delete(e.key)}))}function ie(e){e&&e.c()}function ae(e,t,n){const{fragment:o,on_mount:s,on_destroy:l,after_update:c}=e.$$;o&&o.m(t,n),F((()=>{const t=s.map(r).filter(a);l?l.push(...t):i(t),e.$$.on_mount=[]})),c.forEach(F)}function se(e,t){const n=e.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function le(e,n,r,a,s,l,c=[-1]){const u=M;T(e);const d=n.props||{},f=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:s,bound:o(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(u?u.$$.context:[]),callbacks:o(),dirty:c,skip_bound:!1};let p=!1;if(f.ctx=r?r(e,d,((t,n,...r)=>{const o=r.length?r[0]:n;return f.ctx&&s(f.ctx[t],f.ctx[t]=o)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](o),p&&((e,t)=>{-1===e.$$.dirty[0]&&(q.push(e),R(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<Array.from(e.childNodes))(n.target);f.fragment&&f.fragment.l(e),e.forEach(b)}else f.fragment&&f.fragment.c();n.intro&&ee(e.$$.fragment),ae(e,n.target,n.anchor),Y()}T(u)}class ce{$destroy(){se(this,1),this.$destroy=t}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}var ue="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function de(e){var t={exports:{}};return e(t,t.exports),t.exports}var fe=de((function(e,t){e.exports=function(){var e="millisecond",t="second",n="minute",r="hour",o="day",i="week",a="month",s="quarter",l="year",c="date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},p=(e,t,n)=>{var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},h={s:p,z:e=>{var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+p(r,2,"0")+":"+p(o,2,"0")},m:function e(t,n){if(t.date()e<0?Math.ceil(e)||0:Math.floor(e),p:u=>({M:a,y:l,w:i,d:o,D:c,h:r,m:n,s:t,ms:e,Q:s}[u]||String(u||"").toLowerCase().replace(/s$/,"")),u:e=>void 0===e},m="en",g={};g[m]=f;var y=e=>e instanceof x,b=(e,t,n)=>{var r;if(!e)return m;if("string"==typeof e)g[e]&&(r=e),t&&(g[e]=t,r=e);else{var o=e.name;g[o]=e,r=o}return!n&&r&&(m=r),r||!n&&m},v=function(e,t){if(y(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new x(n)},w=h;w.l=b,w.i=y,w.w=(e,t)=>v(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset});var x=function(){function f(e){this.$L=b(e.locale,null,!0),this.parse(e)}var p=f.prototype;return p.parse=function(e){this.$d=(e=>{var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(u);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)})(e),this.$x=e.x||{},this.init()},p.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},p.$utils=()=>w,p.isValid=function(){return!("Invalid Date"===this.$d.toString())},p.isSame=function(e,t){var n=v(e);return this.startOf(t)<=n&&n<=this.endOf(t)},p.isAfter=function(e,t){return v(e){var n=w.w(u.$u?Date.UTC(u.$y,t,e):new Date(u.$y,t,e),u);return d?n:n.endOf(o)},h=(e,t)=>w.w(u.toDate()[e].apply(u.toDate("s"),(d?[0,0,0,0]:[23,59,59,999]).slice(t)),u),m=this.$W,g=this.$M,y=this.$D,b="set"+(this.$u?"UTC":"");switch(f){case l:return d?p(1,0):p(31,11);case a:return d?p(1,g):p(0,g+1);case i:var v=this.$locale().weekStart||0,x=(m{var n=v(u);return w.w(n.date(n.date()+Math.round(t*e)),u)};if(d===a)return this.set(a,this.$M+e);if(d===l)return this.set(l,this.$y+e);if(d===o)return f(1);if(d===i)return f(7);var p=(c={},c[n]=6e4,c[r]=36e5,c[t]=1e3,c)[d]||1,h=this.$d.getTime()+e*p;return w.w(h,this)},p.subtract=function(e,t){return this.add(-1*e,t)},p.format=function(e){var t=this;if(!this.isValid())return"Invalid Date";var n=e||"YYYY-MM-DDTHH:mm:ssZ",r=w.z(this),o=this.$locale(),i=this.$H,a=this.$m,s=this.$M,l=o.weekdays,c=o.months,u=(e,r,o,i)=>e&&(e[r]||e(t,n))||o[r].substr(0,i),f=e=>w.s(i%12||12,e,"0"),p=o.meridiem||((e,t,n)=>{var r=e<12?"AM":"PM";return n?r.toLowerCase():r}),h={YY:String(this.$y).slice(-2),YYYY:this.$y,M:s+1,MM:w.s(s+1,2,"0"),MMM:u(o.monthsShort,s,c,3),MMMM:u(c,s),D:this.$D,DD:w.s(this.$D,2,"0"),d:String(this.$W),dd:u(o.weekdaysMin,this.$W,l,2),ddd:u(o.weekdaysShort,this.$W,l,3),dddd:l[this.$W],H:String(i),HH:w.s(i,2,"0"),h:f(1),hh:f(2),a:p(i,a,!0),A:p(i,a,!1),m:String(a),mm:w.s(a,2,"0"),s:String(this.$s),ss:w.s(this.$s,2,"0"),SSS:w.s(this.$ms,3,"0"),Z:r};return n.replace(d,((e,t)=>t||h[e]||r.replace(":","")))},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(e,c,u){var d,f=w.p(c),p=v(e),h=6e4*(p.utcOffset()-this.utcOffset()),m=this-p,g=w.m(this,p);return g=(d={},d[l]=g/12,d[a]=g,d[s]=g/3,d[i]=(m-h)/6048e5,d[o]=(m-h)/864e5,d[r]=m/36e5,d[n]=m/6e4,d[t]=m/1e3,d)[f]||m,u?g:w.a(g)},p.daysInMonth=function(){return this.endOf(a).$D},p.$locale=function(){return g[this.$L]},p.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=b(e,t,!0);return r&&(n.$L=r),n},p.clone=function(){return w.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},f}(),$=x.prototype;return v.prototype=$,[["$ms",e],["$s",t],["$m",n],["$H",r],["$W",o],["$M",a],["$y",l],["$D",c]].forEach((function(e){$[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),v.extend=(e,t)=>(e.$i||(e(t,x,v),e.$i=!0),v),v.locale=b,v.isDayjs=y,v.unix=e=>v(1e3*e),v.en=g[m],v.Ls=g,v.p={},v}()}));const pe=(e,t,n)=>new Promise(((r,o)=>{if(n=Object.assign({concurrency:1/0},n),"function"!=typeof t)throw new TypeError("Mapper function is required");const{concurrency:i}=n;if(!("number"==typeof i&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const a=[],s=e[Symbol.iterator]();let l=!1,c=!1,u=0,d=0;const f=()=>{if(l)return;const e=s.next(),n=d;if(d++,e.done)return c=!0,void(0===u&&r(a));u++,Promise.resolve(e.value).then((e=>t(e,n))).then((e=>{a[n]=e,u--,f()}),(e=>{l=!0,o(e)}))};for(let e=0;e\\:\*\|"]/g,we=/[\x00-\x1f\x80-\x9f]/g,xe=/^\.+$/,$e=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,ke=/[\. ]+$/;function _e(e){return e.replace(ve,"-").replace(we,"-").replace(xe,"-").replace($e,"-").replace(ke,"-")}const Se=new TextEncoder;async function Ae(e){const t=new Uint8Array(await crypto.subtle.digest("SHA-256",e.constructor===String?Se.encode(e):e));return"_"+btoa(String.fromCharCode.apply(null,t)).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}function Ee(e,n){return n(((e,n=t)=>{let r;const o=[];function i(t){if(s(e,t)&&(e=t,r)){const t=!ge.length;for(let t=0;t{i(t(e))},subscribe:(a,s=t)=>{const l=[a,s];return o.push(l),1===o.length&&(r=n(i)||t),a(e),()=>{const e=o.indexOf(l);-1!==e&&o.splice(e,1),0===o.length&&(r(),r=null)}}}})(e))}const Me=Ee(new Set,(({subscribe:e,update:t})=>({subscribe:e,remove:e=>t((t=>(t.delete(e),t))),add:e=>t((t=>t.add(be(e)))),clear:()=>t((e=>(e.clear(),e)))}))),Oe=Ee(0,(({subscribe:e,set:t})=>{let n=0,r=0;return{subscribe:e,set total(e){n=e},inc:()=>t(100*++r/n|0),clear:()=>r&&t(n=r=0)}})),Ce=[{mime:"image/webp",ext:".webp",pattern:[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80,86,80]},{mime:"image/png",ext:".png",pattern:[137,80,78,71]},{mime:"image/gif",ext:".gif",pattern:[71,73,70,56]},{mime:"image/jpeg",ext:".jpg",pattern:[255,216,255]},{mime:"image/bmp",ext:".bmp",pattern:[66,77]}];function Te(e,t){const n=atob(t?e.substr(t):e),r=n.length,o=new Uint8Array(r);for(let e=0;et.pattern.every(((t,n)=>!t||e[n]===t))));if(!t)throw"Unsupported image type";return t}function je(e,t){const n=e.getElementsByTagName(t);return n[Symbol.iterator]?n:Array.from(n)}function Le(e){const t=history[e];return Object.assign((function(){try{return t.apply(this,arguments)}finally{window.dispatchEvent(new Event(e))}}),{destroy(){history[e]=t}})}async function Pe(e,t,n="GET",r){const o=await fetch(e,{method:n,credentials:"include",signal:t,body:r,headers:{"x-requested-with":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded"}});return 200===o.status?Re(await o.text()):null}function qe(e){return{name:e.statusText,message:e.status}}function Be(e){return async(t,n)=>{const r=await fetch(e+t,{credentials:"include",signal:n,headers:{"x-requested-with":"XMLHttpRequest"}});if(r.status>=400)throw qe(r);return r.json()}}async function Ne(e,t){const n=new Uint8Array(await t.arrayBuffer());let r;return{...De(n),url:e,id:await Ae(n),b64:()=>r||(r=new Promise(((e,n)=>{const r=new FileReader;r.onloadend=()=>{try{if(2==r.readyState){const t=r.result;e(t.slice(t.indexOf(",")+1))}else n(r.error)}catch(e){n(e)}},r.readAsDataURL(t)}))),data:()=>n}}const Ue="undefined"!=typeof GM_xmlhttpRequest?GM_xmlhttpRequest:GM.xmlHttpRequest,Ie=/^\s*data:([image\/jpnfwbpsv]+);base64/;async function He(e,t,n,r){try{if(n.has(t))return n.get(t);e=(e||"").trim();let o=await(Ie.test(t)?(async e=>{const t=e.slice(e.indexOf(",")+1);return{...De(t),url:e,id:await Ae(e),b64:()=>t,data:()=>Te(t)}})(t):(async(e,t,n)=>{let r=new AbortController;const o=()=>{n.removeEventListener("abort",o),r.abort()};n.addEventListener("abort",o,{once:!0});try{if(location.host!==new URL(e).host&&Ue){const{finalUrl:n,response:o}=await new Promise(((n,o)=>{function i(e){o(e),r.signal.removeEventListener("abort",a),a()}const{abort:a}=Ue({url:e,method:"GET",responseType:"blob",headers:{Referer:location.href},onprogress:n=>t.has(e)?i({name:"Exist",url:e}):t.has(n.finalUrl)?i({name:"Exist",url:n.finalUrl}):void 0,onabort(){i({name:"AbortError"})},onerror(e){i(e.error)},onload(e){e.status>=400?i(qe(e)):(r.signal.removeEventListener("abort",a),n(e))}});r.signal.addEventListener("abort",a,{once:!0})}));return await Ne(n,o)}{const n=await fetch(e,{credentials:"include",cache:"force-cache",referrer:location.href,signal:r.signal});if(t.has(e))return t.get(e);if(n.status>=400)throw qe(n);return t.has(n.url)?t.get(n.url):await Ne(n.url,await n.blob())}}catch(e){if("Exist"===(null==e?void 0:e.name))return t.get(e.url);throw e}finally{o()}})(t,n,r.signal));if(o)return o=n.get(o.id)||o,n.set(t,o),n.set(o.id,o),n.set(o.url,o),o;if(n.has(t))return n.get(t)}catch(n){"AbortError"!=(null==n?void 0:n.name)&&(console.error(n),Me.add(`Ошибка загрузки изображения\n${t}\n${e?`в главе\n"${e}"\n`:""}${be(n)}`))}}function Re(e,t){const n=(new DOMParser).parseFromString(e,t||"text/html"),r=n.querySelector("parsererror");if(r)throw r.textContent;return n}function Fe(e,t,n){const r=e.createElementNS(t.namespaceURI,n);for(;t.firstChild;)r.appendChild(t.firstChild);t.parentNode.replaceChild(r,t)}function Ke(e){for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.remove()}function ze(e,t,...n){const r=n.filter((e=>e!=t)).join(",");r&&e.querySelectorAll(r).forEach((n=>Fe(e,n,t)))}const Ye={image:"image",emphasis:"emphasis",strong:"strong",strikethrough:"strikethrough",underline:"strong",blockquote:"cite"},We={image:"img",emphasis:"i",strong:"b",strikethrough:"s",underline:"u",blockquote:"blockquote"};function Ge(e){return e?e.replace(/"/g,"'"):null}async function Je(e,t,n,r,o){let i=Re(e=e.replace(/(\s*]+)?\/?>\s*)+/g,"

"));try{const{blockquote:a}=We;if(i.querySelectorAll(".message-delete,.splitnewsnavigation,script,.adblock-service"+(o?"":",img")).forEach((e=>e.remove())),ze(i,n.emphasis,"i","em","dfn","var","q","dd","address"),ze(i,n.strong,"b","strong","mark","h2","h3","h4","h5","h6"),ze(i,n.strikethrough,"s","strike","del"),ze(i,n.underline,"u","ins","abbr","a"),i.querySelectorAll(".game-message,.quote").forEach((e=>Fe(i,e,a))),i.querySelectorAll("section section").forEach(Ke),i.querySelectorAll(`body :not(header):not(section):not(${n.emphasis}):not(${n.strong}):not(${n.strikethrough}):not(${n.underline}):not(${a}):not(sub):not(sup):not(img):not(h1)`).forEach((e=>{"SECTION"!==e.parentElement.tagName&&getComputedStyle(e).display.includes("inline")?Ke(e):Fe(i,e,"div")})),e=i.documentElement.outerHTML,i.open(),i=Re(e.replace(/<\/?div>/g,"

").replace(/<(\/)?blockquote>/g,`

<$1${a}>

`)),o){const e=n===We&&i.querySelector("header").textContent;await he(Array.from(i.querySelectorAll("img")),(async r=>{let a=await He(e||r.closest("section").querySelector("header").textContent,r.src,o,t);if(a){const e=Ge(r.alt),t=Ge(r.title),o=i.createElement(n.image);e&&o.setAttribute("alt",e),n===Ye?(await a.b64(),o.setAttribute("l:href","#"+a.id),r.parentNode.replaceChild(o,r),"SECTION"===o.parentElement.tagName&&(t&&(o.title=t),o.id=a.id)):n===We&&(o.src="images/"+a.id+a.ext,t&&(o.title=t),o.id=a.id,r.parentNode.replaceChild(o,r))}else r.remove()}),{concurrency:r})}if(i.querySelectorAll(`body :not(${n.image})`).forEach(Xe),ze(i,n.blockquote,a),e=i.body.innerHTML,i.open(),e=(e=((e,t)=>{let n;return t.replace(/&#?[\w\d]+;/g,(t=>{if(t in ye)return ye[t];if("#"===t[1]){const e=parseInt(t.slice(2),"x"===t[2]?16:10);switch(e){case 38:return"&";case 60:return"<";case 62:return">";case 160:return" ";default:if(e<=1114111)return String.fromCodePoint(e)}}return n||(e.title="",n=e.head.querySelector("title")),n.innerHTML=t,n.innerText}))})(i,e)).replace(/(\s*

\s*<\/p>\s*)+/g," "),n===Ye)return e=e.replace(/<(\/)?header>/g,"<$1title>"),o?e.replace(/><\/image>/g,"/>"):e;if(n===We)return o?e.replace(/(]+)>/gi,"$1/>"):e}finally{i.open()}}function Xe(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes.item(0).name)}function Ze(e,t){return t.appendChild(e),{update(n){n!=t&&(t=n).appendChild(e)},destroy(){e.remove()}}}function*Ve(e){for(const[t,n]of e)t===n.id&&(yield n)}const Qe={янв:"jan",фев:"feb",мар:"mar",апр:"apr",мая:"may",июн:"jun",июл:"jul",авг:"aug",сен:"sep",окт:"oct",ноя:"nov",дек:"dec"};function et(e){return fe(e.replace(/(янв|фев|мар|апр|мая|июн|июл|авг|сен|окт|ноя|дек)[а-я]*/i,((e,t)=>Qe[t])).replace(/[^\w:\+\s]+/g,"").replace(/\s+/g," "))}class tt{constructor(){this.programName="ranobe-ebook-loader 0.2.6",this.homePage=location.href}date(e){return this.d.format(e)}get isoDate(){return this.d.toISOString().replace(".000","")}extractTitle(e){return e.querySelector("h1").firstChild.textContent}}const nt=Be("https://xn--80ac9aeh6f.xn--p1ai/api/v2/books/");class rt extends tt{constructor(){super(...arguments),this.bookAlias=location.pathname.split("/",2).find(Boolean),this.homePage=`https://xn--80ac9aeh6f.xn--p1ai/${this.bookAlias}/`}static get injectTarget(){return document.getElementsByClassName("BookPageActions__actions")[0]}async parts(e,t,n){const{fullTitle:r,titleEn:o,genres:i,author:a,description:s,createTime:l,title:c,images:u,country:d}=await nt(this.bookAlias,e.signal);this.covers=[u.vertical.find((e=>"bookMain"===e.processor)).url],this.d=fe(l),this.genres=i.map((e=>e.title)),this.title=c,this.subtitle=[r,o].filter(Boolean).join(" • "),this.description=s||"",this.lang=null==d?void 0:d.code,this.authors=[a].filter(Boolean);const{bookAlias:f}=this,p=(await nt(f+"/chapters",e.signal)).items.filter((e=>e.hasUserPaid||"free"===e.availabilityStatus)).reverse();return Oe.total=p.length,he(p,(async({slug:r})=>{try{const{title:o,text:{text:i}}=await nt(f+"/chapters/"+r,e.signal);if(i.includes("`rgba(48,55,69,${e})`;class ot extends tt{static get injectTarget(){return document.getElementById("mc-fs-rate")}async parts(e,t,n){const r=this.bookAlias=document.querySelector(".r-fullstory-chapters-foot > a:nth-child(3n)").href.split("/",5).slice(-1)[0];this.covers=[document.querySelector('[itemprop="image"]').href],this.d=fe(document.querySelector('[itemprop="datePublished"]').getAttribute("content")),this.genres=Array.from(document.querySelectorAll('[itemprop="genre"] a'),(e=>e.textContent)),this.keywords=Array.from(document.querySelectorAll('[itemprop="keywords"] a'),(e=>e.textContent)).join(", "),this.title=this.extractTitle(document),this.subtitle=document.querySelector('[itemprop="alternateName"]').textContent,this.description=document.querySelector('[itemprop="description"]').innerHTML,this.authors=Array.from(document.querySelectorAll('[itemprop="creator"] a'),(e=>({name:e.textContent,homePage:e.href})));const o=[];for(let t=1;;++t){const n=await Pe(`https://ranobes.com/chapters/${r}/page/${t}/`,e.signal);if(!n)break;n.querySelectorAll(`.cat_block a[href^="https://ranobes.com/chapters/${r}/"]`).forEach((e=>o.push(e.href)))}return Oe.total=o.length,he(o.reverse(),(async o=>{try{let i="",a="";const s=[o];for(const n of s){const o=await Pe(n,e.signal);if(!o)break;const l=o.getElementById("arrticle");if(i+=l.outerHTML,!a){a=this.extractTitle(o);const e=o.querySelector(".splitnewsnavigation");e&&e.querySelectorAll(`a[href^="https://ranobes.com/chapters/${r}/"]`).forEach((e=>s.push(e.href)))}for(const n of je(l,"img"))await He(a,n.src,t,e);o.open()}return Oe.inc(),n?await n({title:a,text:i}):{title:a,text:i}}catch(t){throw e.abort(),t}}),{concurrency:5})}}ot.component="btn btn-block",ot.color=e=>`rgba(149,172,124,${e})`;const it=Be("");class at extends tt{constructor(){super(...arguments),this.chapterElements=Array.from(document.querySelectorAll("#Chapters .btn-info"))}static get injectTarget(){return document.querySelector("#Info > .btn-toolbar")}async parts(e,t,n){const r=document.getElementById("Info");this.covers=Array.from(r.querySelectorAll(".slick img"),(e=>e.src));const o=this.covers.find((e=>/\.jpe?g($|\?)/i.test(e)));return o&&this.covers.unshift(o),this.covers=Array.from(new Set(this.covers)),this.d=et(this.chapterElements[this.chapterElements.length-1].parentElement.previousElementSibling.previousElementSibling.firstElementChild.getAttribute("title")),this.genres=Array.from(document.querySelectorAll('.info a[href^="/search?genres"]'),(e=>e.textContent)),this.keywords=Array.from(document.querySelectorAll('.info a[href^="/search?tags"]'),(e=>e.textContent)).join(", "),this.subtitle=this.extractTitle(document),this.title=this.subtitle.substring(this.subtitle.lastIndexOf(" / ")+3),this.description=r.querySelector(".btn-toolbar + .clear + div").innerHTML,this.authors=Array.from(document.getElementById("Info").querySelectorAll('a[href^="/search?from=book&t="]')).filter((e=>"Автор:"===e.parentElement.previousElementSibling.textContent)).map((e=>({name:e.textContent,homePage:e.href}))),this.bookAlias=_e(this.title),Oe.total=this.chapterElements.length,he(this.chapterElements.map((e=>e.href)),(async r=>{try{let{title:o,content:i}=await it(r.replace(/_new$/,"")+"ajax?is_new=true",e.signal);if(i=i.split(/

|

https?:\/\/tl\.rulate\.ru\/book\//,3)[1],i.includes("`rgba(0,85,128,${e})`;class st extends tt{static get injectTarget(){return document.getElementsByClassName("link-last-first-chapter")[0]}async parts(e,t,n){var r,o,i;const a=document.getElementsByClassName("box-book")[0];this.covers=Array.from(a.querySelectorAll(".img-book img"),(e=>e.src)),this.d=et(a.querySelector(".date-home").textContent);const s=Array.from(document.querySelectorAll("#info-book > p"),(e=>e.textContent));this.genres=(null===(o=null===(r=s.find((e=>e.startsWith("Жанры: "))))||void 0===r?void 0:r.substr(7))||void 0===o?void 0:o.split(", "))||[],this.keywords="",this.title=this.extractTitle(document),this.subtitle=[this.title,null===(i=s.find((e=>e.startsWith("Название: "))))||void 0===i?void 0:i.substr(10)].filter(Boolean).join(" • "),this.description=a.querySelector("#desc-tab").innerHTML,this.authors=s.filter((e=>e.startsWith("Автор: "))).map((e=>({name:e.substr(7)}))),this.bookAlias=_e(this.title);const l=a.querySelector(".like-but").id,c=await Pe("https://jaomix.ru/wp-admin/admin-ajax.php",e.signal,"POST",new URLSearchParams({action:"toc",selectall:l}).toString()),u=(await he(je(c,"option"),(async({value:t})=>{if("0"===t)return Array.from(document.getElementById("open-0").getElementsByTagName("a"),(e=>e.href));{const n=await Pe("https://jaomix.ru/wp-admin/admin-ajax.php",e.signal,"POST",new URLSearchParams({action:"toc",page:t,termid:l}).toString());try{return Array.from(n.getElementsByTagName("a"),(e=>e.href))}finally{n.open()}}}),{concurrency:5})).flat().reverse();return c.open(),Oe.total=u.length,he(u,(async r=>{try{const o=await Pe(r,e.signal),i=this.extractTitle(o),a=o.getElementsByClassName("entry")[0];for(const n of je(a,"img"))await He(i,n.src,t,e);const s=a.outerHTML;return o.open(),Oe.inc(),n?await n({title:i,text:s}):{title:i,text:s}}catch(t){throw e.abort(),t}}),{concurrency:5})}}st.component="lie-but",st.color=e=>`rgba(51,51,51,${e})`;const lt=(e=>{var t=Object.prototype.hasOwnProperty;function n(e,r){return Array.isArray(e)?((e,t)=>{for(var r,o="",i="",s=Array.isArray(t),l=0;l{var n="",r="";for(var o in e)o&&e[o]&&t.call(e,o)&&(n=n+r+o,r=" ");return n})(e):e||""}function r(e){if(!e)return"";if("object"==typeof e){var n="";for(var r in e)t.call(e,r)&&(n=n+r+":"+e[r]+";");return n}return e+""}function o(e,t,n,r){if(!1===t||null==t||!t&&("class"===e||"style"===e))return"";if(!0===t)return" "+(r?e:e+'="'+e+'"');var o=typeof t;return"object"!==o&&"function"!==o||"function"!=typeof t.toJSON||(t=t.toJSON()),"string"==typeof t||(t=JSON.stringify(t),n||-1===t.indexOf('"'))?(n&&(t=a(t))," "+e+'="'+t+'"'):" "+e+"='"+t.replace(/'/g,"'")+"'"}e.merge=function e(t,n){if(1===arguments.length){for(var o=t[0],i=1;i{var a="";for(var s in e)if(t.call(e,s)){var l=e[s];if("class"===s){a=o(s,l=n(l),!1,i)+a;continue}"style"===s&&(l=r(l)),a+=o(s,l,!1,i)}return a};var i=/["&<>]/;function a(e){var t=""+e,n=i.exec(t);if(!n)return e;var r,o,a,s="";for(r=n.index,o=0;r{var n=t+s+1;return(n==r?" > ":" ")+n+"| "+e})).join("\n"),t.path=n,t.message=(n||"Pug")+":"+r+"\n"+i+"\n\n"+t.message,t},e})({});function ct(e){var t,n="",r=e||{};return function(e,r,o,i,a,s,l,c,u,d,f,p){n+="",(()=>{var e=s;if("number"==typeof e.length)for(var r=0,o=e.length;r"+lt.escape(null==(t=i)?"":t)+""}else for(var r in o=0,e)o++,i=e[r],n=n+""+lt.escape(null==(t=i)?"":t)+""}).call(this),(()=>{var e=r;if("number"==typeof e.length)for(var o=0,i=e.length;o"+lt.escape(null==(t=a.name)?"":t)+"",a.homePage&&(n=n+""+lt.escape(null==(t=a.homePage)?"":t)+""),n+=""}else for(var o in i=0,e)i++,a=e[o],n=n+""+lt.escape(null==(t=a.name)?"":t)+"",a.homePage&&(n=n+""+lt.escape(null==(t=a.homePage)?"":t)+""),n+=""}).call(this),n=n+""+lt.escape(null==(t=p)?"":t)+"",e&&(n=n+""+(null==(t=e)?"":t)+""),c&&(n=n+""+lt.escape(null==(t=c)?"":t)+""),i&&(n+=''),n+="ru",u&&(n=n+""+lt.escape(null==(t=u)?"":t)+""),n+="",(()=>{var e=r;if("number"==typeof e.length)for(var o=0,i=e.length;o"+lt.escape(null==(t=a.name)?"":t)+"",a.homePage&&(n=n+""+lt.escape(null==(t=a.homePage)?"":t)+""),n+=""}else for(var o in i=0,e)i++,a=e[o],n=n+""+lt.escape(null==(t=a.name)?"":t)+"",a.homePage&&(n=n+""+lt.escape(null==(t=a.homePage)?"":t)+""),n+=""}).call(this),n=n+""+(null==(t=d)?"":t)+""+(null==(t=a)?"":t)+""+lt.escape(null==(t=l)?"":t)+""+lt.escape(null==(t=o)?"":t)+"1"}.call(this,"annotation"in r?r.annotation:"undefined"!=typeof annotation?annotation:void 0,"authors"in r?r.authors:"undefined"!=typeof authors?authors:void 0,"bookAlias"in r?r.bookAlias:"undefined"!=typeof bookAlias?bookAlias:void 0,"cover"in r?r.cover:"undefined"!=typeof cover?cover:void 0,"fullDate"in r?r.fullDate:"undefined"!=typeof fullDate?fullDate:void 0,"genres"in r?r.genres:"undefined"!=typeof genres?genres:void 0,"homePage"in r?r.homePage:"undefined"!=typeof homePage?homePage:void 0,"keywords"in r?r.keywords:"undefined"!=typeof keywords?keywords:void 0,"lang"in r?r.lang:"undefined"!=typeof lang?lang:void 0,"programName"in r?r.programName:"undefined"!=typeof programName?programName:void 0,"shortDate"in r?r.shortDate:"undefined"!=typeof shortDate?shortDate:void 0,"title"in r?r.title:"undefined"!=typeof title?title:void 0),n}function ut(e){var t,n="",r=e||{};return function(e,r){n=n+"

"+lt.escape(null==(t=r)?"":t)+"

",(()=>{var r=e;if("number"==typeof r.length)for(var o=0,i=r.length;o

"+lt.escape(null==(t=a.title)?"":t)+"

"+(null==(t=a.text)?"":t)+""}else for(var o in i=0,r)i++,a=r[o],n=n+"

"+lt.escape(null==(t=a.title)?"":t)+"

"+(null==(t=a.text)?"":t)+"
"}).call(this),n+=""}.call(this,"chapters"in r?r.chapters:"undefined"!=typeof chapters?chapters:void 0,"title"in r?r.title:"undefined"!=typeof title?title:void 0),n}function dt(e){var t,n="",r=e||{};return function(e,r,o,i,a){n=n+''+lt.escape(null==(t=i)?"":t)+"",(()=>{var r=e;if("number"==typeof r.length)for(var o=0,i=r.length;o"+lt.escape(null==(t=a.name)?"":t)+""}else for(var o in i=0,r)i++,a=r[o],n=n+""+lt.escape(null==(t=a.name)?"":t)+""}).call(this),n+="",(()=>{var e=r;if("number"==typeof e.length)for(var o=0,i=e.length;o"+lt.escape(null==(t=a.title)?"":t)+""}else for(var o in i=0,e)i++,a=e[o],n=n+'"+lt.escape(null==(t=a.title)?"":t)+""}).call(this),n+=""}.call(this,"authors"in r?r.authors:"undefined"!=typeof authors?authors:void 0,"chapters"in r?r.chapters:"undefined"!=typeof chapters?chapters:void 0,"programName"in r?r.programName:"undefined"!=typeof programName?programName:void 0,"title"in r?r.title:"undefined"!=typeof title?title:void 0,"uuid"in r?r.uuid:"undefined"!=typeof uuid?uuid:void 0),n}function ft(e){var t,n="",r=e||{};return function(e,r){n=n+''+lt.escape(null==(t=r)?"":t)+'

Содержание

"}.call(this,"chapters"in r?r.chapters:"undefined"!=typeof chapters?chapters:void 0,"title"in r?r.title:"undefined"!=typeof title?title:void 0),n}function pt(e){var t,n="",r=e||{};return function(e,r,o,i,a,s,l,c,u){n=n+''+(null==(t=u)?"":t)+''+lt.escape(null==(t=c)?"":t)+'main',l&&(n=n+''+lt.escape(null==(t=l)?"":t)+'subtitle'),n+="ru",e&&(n=n+""+lt.escape(null==(t=e)?"":t)+""),(()=>{var e=r;if("number"==typeof e.length)for(var o=0,i=e.length;o'+lt.escape(null==(t=a.name)?"":t)+'aut':n+""+lt.escape(null==(t=a.name)?"":t)+""}else for(var o in i=0,e)i++,a=e[o],n=0===o?n+''+lt.escape(null==(t=a.name)?"":t)+'aut':n+""+lt.escape(null==(t=a.name)?"":t)+""}).call(this),i&&(n+=''),n=n+""+(null==(t=s)?"":t)+''+(null==(t=s)?"":t)+"",i&&(n=n+''),(()=>{var e=a;if("number"==typeof e.length)for(var t=0,r=e.length;t")}else for(var t in r=0,e)r++,o=e[t],i!=o&&(n=n+"")}).call(this),n+='',(()=>{var e=o;if("number"==typeof e.length)for(var t=0,r=e.length;t'}else for(var t in r=0,e)r++,i=e[t],n=n+"'}).call(this),n+='',(()=>{var e=o;if("number"==typeof e.length)for(var t=0,r=e.length;t"}else for(var t in r=0,e)r++,i=e[t],n=n+""}).call(this),n+=""}.call(this,"annotation"in r?r.annotation:"undefined"!=typeof annotation?annotation:void 0,"authors"in r?r.authors:"undefined"!=typeof authors?authors:void 0,"chapters"in r?r.chapters:"undefined"!=typeof chapters?chapters:void 0,"cover"in r?r.cover:"undefined"!=typeof cover?cover:void 0,"images"in r?r.images:"undefined"!=typeof images?images:void 0,"isoDate"in r?r.isoDate:"undefined"!=typeof isoDate?isoDate:void 0,"subtitle"in r?r.subtitle:"undefined"!=typeof subtitle?subtitle:void 0,"title"in r?r.title:"undefined"!=typeof title?title:void 0,"uuid"in r?r.uuid:"undefined"!=typeof uuid?uuid:void 0),n}var ht="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function mt(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),(()=>{n(window.event)}))}function gt(e,t){for(var n=t.slice(0,t.length-1),r=0;r=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var bt={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,"⇪":20,",":188,".":190,"/":191,"`":192,"-":ht?173:189,"=":ht?61:187,";":ht?59:186,"'":222,"[":219,"]":221,"\\":220},vt={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},wt={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},xt={16:!1,18:!1,17:!1,91:!1},$t={},kt=1;kt<20;kt++)bt["f".concat(kt)]=111+kt;var _t=[],St="all",At=[],Et=e=>bt[e.toLowerCase()]||vt[e.toLowerCase()]||e.toUpperCase().charCodeAt(0);function Mt(e){St=e||"all"}function Ot(){return St||"all"}var Ct=e=>{var t=e.key,n=e.scope,r=e.method,o=e.splitKey,i=void 0===o?"+":o;yt(t).forEach((e=>{var t=e.split(i),o=t.length,a=t[o-1],s="*"===a?"*":Et(a);if($t[s]){n||(n=Ot());var l=o>1?gt(vt,t):[];$t[s]=$t[s].map((e=>r&&e.method!==r||e.scope!==n||!((e,t)=>{for(var n=e.length>=t.length?e:t,r=e.length>=t.length?t:e,o=!0,i=0;i0,xt)Object.prototype.hasOwnProperty.call(xt,o)&&(!xt[o]&&t.mods.indexOf(+o)>-1||xt[o]&&-1===t.mods.indexOf(+o))&&(r=!1);(0!==t.mods.length||xt[16]||xt[18]||xt[17]||xt[91])&&!r&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function Dt(e){var t=$t["*"],n=e.keyCode||e.which||e.charCode;if(jt.filter.call(this,e)){if(93!==n&&224!==n||(n=91),-1===_t.indexOf(n)&&229!==n&&_t.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach((t=>{var n=wt[t];e[t]&&-1===_t.indexOf(n)?_t.push(n):!e[t]&&_t.indexOf(n)>-1?_t.splice(_t.indexOf(n),1):"metaKey"===t&&e[t]&&3===_t.length&&(e.ctrlKey||e.shiftKey||e.altKey||(_t=_t.slice(_t.indexOf(n))))})),n in xt){for(var r in xt[n]=!0,vt)vt[r]===n&&(jt[r]=!0);if(!t)return}for(var o in xt)Object.prototype.hasOwnProperty.call(xt,o)&&(xt[o]=e[wt[o]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===_t.indexOf(17)&&_t.push(17),-1===_t.indexOf(18)&&_t.push(18),xt[17]=!0,xt[18]=!0);var i=Ot();if(t)for(var a=0;a1&&(o=gt(vt,e)),(e="*"===(e=e[e.length-1])?"*":Et(e))in $t||($t[e]=[]),$t[e].push({keyup:l,keydown:c,scope:i,mods:o,shortcut:r[s],method:n,key:r[s],splitKey:u});void 0!==a&&!(e=>At.indexOf(e)>-1)(a)&&window&&(At.push(a),mt(a,"keydown",(e=>{Dt(e)})),mt(window,"focus",(()=>{_t=[]})),mt(a,"keyup",(e=>{Dt(e),(e=>{var t=e.keyCode||e.which||e.charCode,n=_t.indexOf(t);if(n>=0&&_t.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&_t.splice(0,_t.length),93!==t&&224!==t||(t=91),t in xt)for(var r in xt[t]=!1,vt)vt[r]===t&&(jt[r]=!1)})(e)})))}var Lt={setScope:Mt,getScope:Ot,deleteScope:(e,t)=>{var n,r;for(var o in e||(e=Ot()),$t)if(Object.prototype.hasOwnProperty.call($t,o))for(n=$t[o],r=0;r_t.slice(0),isPressed:e=>("string"==typeof e&&(e=Et(e)),-1!==_t.indexOf(e)),filter:e=>{var t=e.target||e.srcElement,n=t.tagName,r=!0;return!t.isContentEditable&&("INPUT"!==n&&"TEXTAREA"!==n&&"SELECT"!==n||t.readOnly)||(r=!1),r},unbind:function(e){if(e){if(Array.isArray(e))e.forEach((e=>{e.key&&Ct(e)}));else if("object"==typeof e)e.key&&Ct(e);else if("string"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rdelete $t[e]))}};for(var Pt in Lt)Object.prototype.hasOwnProperty.call(Lt,Pt)&&(jt[Pt]=Lt[Pt]);if("undefined"!=typeof window){var qt=window.hotkeys;jt.noConflict=e=>(e&&window.hotkeys===jt&&(window.hotkeys=qt),jt),window.hotkeys=jt}function Bt(e){let n,r;return{c:t,m(t,o){n||(r=u(Nt.call(null,window,e[0])),n=!0)},p:t,i:t,o:t,d(e){n=!1,r()}}}function Nt(e,t){return jt("ctrl+s",(e=>{e.stopImmediatePropagation(),e.preventDefault(),t()})),{destroy(){jt.unbind("ctrl+s")}}}function Ut(e){const t=P();return[()=>{t("save")}]}class It extends ce{constructor(e){super(),le(this,e,Ut,Bt,s,{})}}function Ht(e){let n,r,o,i,a,s,l,c,u,d,f,p,h,m,w,S,E,M,O,C,T,D,j,L,P,q,B,N,U,I,H,R=e[1]+"%";return{c(){n=v("div"),r=v("div"),o=v("div"),i=x(),a=v("div"),s=x(),l=v("div"),c=x(),u=v("div"),d=x(),f=v("div"),p=x(),h=v("div"),m=x(),w=v("div"),S=x(),E=v("div"),M=x(),O=v("div"),C=x(),T=v("div"),D=x(),j=v("div"),L=x(),P=v("div"),q=x(),N=x(),U=v("button"),U.textContent="Cancel",k(o,"class","u_c1"),k(a,"class","u_c2"),k(l,"class","u_c3"),k(u,"class","u_c4"),k(f,"class","u_c5"),k(h,"class","u_c6"),k(w,"class","u_c7"),k(E,"class","u_c8"),k(O,"class","u_c9"),k(T,"class","u_c10"),k(j,"class","u_c11"),k(P,"class","u_c12"),B=new A(null),k(r,"class","u_c"),k(U,"class","u_cancel"),k(n,"class","u_b"),_(n,"--uc",e[0](1)),_(n,"--uch",e[0](.5)),_(n,"--uct",e[0](0))},m(t,b){y(t,n,b),g(n,r),g(r,o),g(r,i),g(r,a),g(r,s),g(r,l),g(r,c),g(r,u),g(r,d),g(r,f),g(r,p),g(r,h),g(r,m),g(r,w),g(r,S),g(r,E),g(r,M),g(r,O),g(r,C),g(r,T),g(r,D),g(r,j),g(r,L),g(r,P),g(r,q),B.m(R,r),g(n,N),g(n,U),I||(H=$(U,"click",e[2]),I=!0)},p(e,[t]){2&t&&R!==(R=e[1]+"%")&&B.p(R),1&t&&_(n,"--uc",e[0](1)),1&t&&_(n,"--uch",e[0](.5)),1&t&&_(n,"--uct",e[0](0))},i:t,o:t,d(e){e&&b(n),I=!1,H()}}}function Rt(e,t,n){let r;l(e,Oe,(e=>n(1,r=e)));let{color:o=(()=>"red")}=t;const i=P();return e.$$set=e=>{"color"in e&&n(0,o=e.color)},[o,r,()=>{i("cancel")}]}class Ft extends ce{constructor(e){var t;super(),document.getElementById("svelte-14hxf0y-style")||((t=v("style")).id="svelte-14hxf0y-style",t.textContent='.u_b{position:fixed;z-index:16777270;right:0;bottom:0;background:hsla(0,0%,100%,.8);width:100vw;height:100vh;-webkit-user-select:none;user-select:none;display:flex;flex-direction:column;align-items:center;justify-content:center}.u_cancel{margin-top:5%;border:0;background-color:var(--uc);color:#fff;padding:0 2em;line-height:2.7em;border-radius:3px;cursor:pointer;box-shadow:0 0 0 6px var(--uct);transition:box-shadow .1s;font-family:Ubuntu,Segoe UI,Optima,Trebuchet MS,-apple-system,BlinkMacSystemFont,sans-serif!important;font-size:16px}@media screen and (min-width:240px){.u_cancel{font-size:calc(16px + 8*(100vw - 240px)/720)}}@media screen and (min-width:960px){.u_cancel{font-size:24px}}.u_cancel:active,.u_cancel:focus,.u_cancel:hover{outline:0;box-shadow:0 0 0 6px var(--uch)}.u_c{position:relative;pointer-events:none;width:100px;height:100px;line-height:100px;text-align:center;color:var(--uc);font-family:Ubuntu,Segoe UI,Optima,Trebuchet MS,-apple-system,BlinkMacSystemFont,sans-serif!important;font-size:14px}@media screen and (min-width:240px){.u_c{font-size:calc(14px + 7*(100vw - 240px)/720)}}@media screen and (min-width:960px){.u_c{font-size:21px}}.u_c>*{width:100%;height:100%;position:absolute}.u_c>:before{content:"";display:block;margin:0 auto;width:15%;height:15%;background-color:var(--uc);border-radius:100%;animation:u_a 1.2s ease-in-out infinite both}.u_c2{transform:rotate(30deg)}.u_c2:before{animation-delay:-1.1s}.u_c3{transform:rotate(60deg)}.u_c3:before{animation-delay:-1s}.u_c4{transform:rotate(90deg)}.u_c4:before{animation-delay:-.9s}.u_c5{transform:rotate(120deg)}.u_c5:before{animation-delay:-.8s}.u_c6{transform:rotate(150deg)}.u_c6:before{animation-delay:-.7s}.u_c7{transform:rotate(180deg)}.u_c7:before{animation-delay:-.6s}.u_c8{transform:rotate(210deg)}.u_c8:before{animation-delay:-.5s}.u_c9{transform:rotate(240deg)}.u_c9:before{animation-delay:-.4s}.u_c10{transform:rotate(270deg)}.u_c10:before{animation-delay:-.3s}.u_c11{transform:rotate(300deg)}.u_c11:before{animation-delay:-.2s}.u_c12{transform:rotate(330deg)}.u_c12:before{animation-delay:-.1s}@keyframes u_a{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}',g(document.head,t)),le(this,e,Rt,Ht,s,{color:0})}}function Kt(e){let t,n;const r=e[2].default,o=((e,t,n,r)=>{if(e){const r=c(e,t,n,null);return e[0](r)}})(r,e,e[1]);return{c(){t=v("menu"),o&&o.c(),k(t,"type","context"),k(t,"id",e[0])},m(e,r){y(e,t,r),o&&o.m(t,null),n=!0},p(e,[t]){o&&o.p&&2&t&&function(e,t,n,r,o,i,a){const s=((e,t,n,r)=>{if(e[2]&&r){const o=e[2](r(n));if(void 0===t.dirty)return o;if("object"==typeof o){const e=[],n=Math.max(t.dirty.length,o.length);for(let r=0;rdocument.body.setAttribute("contextmenu",i))),L((()=>document.body.removeAttribute("contextmenu"))),e.$$set=e=>{"$$scope"in e&&n(1,o=e.$$scope)},[i,o,r]}class Yt extends ce{constructor(e){super(),le(this,e,zt,Kt,s,{})}}function Wt(e){let n,r,o,s;return{c(){n=v("menuitem"),k(n,"label",e[0]),k(n,"icon",e[1])},m(t,i){y(t,n,i),o||(s=[$(n,"click",e[2]),u(r=e[3].call(null,n,e[0]))],o=!0)},p(e,[t]){1&t&&k(n,"label",e[0]),2&t&&k(n,"icon",e[1]),r&&a(r.update)&&1&t&&r.update.call(null,e[0])},i:t,o:t,d(e){e&&b(n),o=!1,i(s)}}}function Gt(e,t,n){let{label:r="ranobe-ebook-loader"}=t,{icon:o="https://raw.githubusercontent.com/Taraflex/ranobe-ebook-loader/master/icons/32.png"}=t;const i=P();function a(){i("trigger")}return e.$$set=e=>{"label"in e&&n(0,r=e.label),"icon"in e&&n(1,o=e.icon)},[r,o,a,(e,t)=>{let n="undefined"!=typeof GM_registerMenuCommand&&GM_registerMenuCommand(t,a);function r(){n&&GM_unregisterMenuCommand(n)}return{destroy:r,update(e){r(),n="undefined"!=typeof GM_registerMenuCommand&&GM_registerMenuCommand(e,a)}}}]}class Jt extends ce{constructor(e){super(),le(this,e,Gt,Wt,s,{label:0,icon:1})}}function Xt(e){const t=e-1;return t*t*t+1}function Zt(e,{delay:t=0,duration:n=400,easing:r=Xt}){const o=getComputedStyle(e),i=+o.opacity,a=parseFloat(o.height),s=parseFloat(o.paddingTop),l=parseFloat(o.paddingBottom),c=parseFloat(o.marginTop),u=parseFloat(o.marginBottom),d=parseFloat(o.borderTopWidth),f=parseFloat(o.borderBottomWidth);return{delay:t,duration:n,easing:r,css:e=>`overflow: hidden;opacity: ${Math.min(20*e,1)*i};height: ${e*a}px;padding-top: ${e*s}px;padding-bottom: ${e*l}px;margin-top: ${e*c}px;margin-bottom: ${e*u}px;border-top-width: ${e*d}px;border-bottom-width: ${e*f}px;`}}function Vt(e,t,n){const r=e.slice();return r[3]=t[n],r}function Qt(e,t){let n,r,o,a,s,l,c,u,d,f,p,h,m=t[3]+"";function _(){return t[1](t[3])}function S(...e){return t[2](t[3],...e)}return{key:e,first:null,c(){n=v("div"),r=v("div"),o=w(m),a=x(),s=v("div"),l=v("button"),l.textContent="🞩",c=x(),u=v("button"),u.textContent="⎀",k(r,"class","u_m"),k(l,"class","u_bf"),k(u,"class","u_bl"),k(u,"title","Click to copy"),k(s,"class","u_r"),k(n,"class","u_n"),this.first=n},m(e,t){y(e,n,t),g(n,r),g(r,o),g(n,a),g(n,s),g(s,l),g(s,c),g(s,u),f=!0,p||(h=[$(l,"click",_),$(u,"click",S)],p=!0)},p(e,n){t=e,(!f||1&n)&&m!==(m=t[3]+"")&&((e,t)=>{t=""+t,e.wholeText!==t&&(e.data=t)})(o,m)},i(e){f||(e&&F((()=>{d||(d=re(n,Zt,{},!0)),d.run(1)})),f=!0)},o(e){e&&(d||(d=re(n,Zt,{},!1)),d.run(0)),f=!1},d(e){e&&b(n),e&&d&&d.end(),p=!1,i(h)}}}function en(e){let n,r,o,i,a;return{c(){n=v("button"),n.textContent="Close all",k(n,"class","u_bb")},m(e,t){y(e,n,t),o=!0,i||(a=$(n,"click",Me.clear),i=!0)},p:t,i(e){o||(e&&F((()=>{r||(r=re(n,Zt,{},!0)),r.run(1)})),o=!0)},o(e){e&&(r||(r=re(n,Zt,{},!1)),r.run(0)),o=!1},d(e){e&&b(n),e&&r&&r.end(),i=!1,a()}}}function tn(e){let t,n,r,o=[],i=new Map,a=Array.from(e[0]);const s=e=>e[3];for(let t=0;t2&&en();return{c(){t=v("div");for(let e=0;e{let f=e.length,p=i.length,h=f;const m={};for(;h--;)m[e[h].key]=h;const g=[],y=new Map,b=new Map;for(h=p;h--;){const e=d(o,i,h),r=n(e);let s=a.get(r);s?s.p(e,t):(s=c(r,e),s.c()),y.set(r,g[h]=s),r in m&&b.set(r,Math.abs(h-m[r]))}const v=new Set,w=new Set;function x(e){ee(e,1),e.m(s,u),a.set(e.key,e),u=e.first,p--}for(;f&&p;){const t=g[p-1],n=e[f-1],r=t.key,o=n.key;t===n?(u=t.first,f--,p--):y.has(o)?!a.has(r)||v.has(r)?x(t):w.has(o)?f--:b.get(r)>b.get(o)?(w.add(r),x(t)):(v.add(o),f--):(l(n,a),f--)}for(;f--;){const t=e[f];y.has(t.key)||l(t,a)}for(;p;)x(g[p-1]);return g})(o,r,s,0,e,a,i,t,oe,Qt,n,Vt),Q()),e[0].size>2?l?(l.p(e,r),1&r&&ee(l,1)):(l=en(),l.c(),ee(l,1),l.m(t,null)):l&&(V(),te(l,1,1,(()=>{l=null})),Q())},i(e){if(!r){for(let e=0;en(0,r=e))),[r,e=>Me.remove(e),(e,t)=>((e,t)=>{navigator.clipboard.writeText(e).then((()=>{const e=t.target.closest(".u_n");e.style.animation=null,e.getBoundingClientRect(),e.style.animation="u_shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97)"})).catch(Me.add)})(e,t)]}class rn extends ce{constructor(e){var t;super(),document.getElementById("svelte-v02y3s-style")||((t=v("style")).id="svelte-v02y3s-style",t.textContent=".u_d{position:fixed;z-index:16777270;right:0;bottom:0;bottom:3px;right:3px;display:flex;flex-direction:column;align-items:flex-end;color:#fff;pointer-events:none}.u_bb,.u_n{margin:3px;display:flex;pointer-events:auto;transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.u_m{flex-grow:1;padding:6px 9px;border-top-left-radius:3px;border-bottom-left-radius:3px;white-space:pre-wrap;word-wrap:break-word;max-width:calc(100vw - 70px);font-family:Ubuntu,Segoe UI,Optima,Trebuchet MS,-apple-system,BlinkMacSystemFont,sans-serif!important;font-size:14px}.u_m,.u_r{background-color:rgba(213,0,0,.85)}.u_r{display:flex;flex-direction:column;border-top-right-radius:3px;border-bottom-right-radius:3px;margin-left:1px}.u_b,.u_bb,.u_bf,.u_bl{background-color:transparent;padding:6px;border:0;-webkit-user-select:none;user-select:none;color:#fff;text-align:center;cursor:pointer;font-family:Ubuntu,Segoe UI,Optima,Trebuchet MS,-apple-system,BlinkMacSystemFont,sans-serif!important;font-size:14px}.u_bf{padding-bottom:0}.u_bl{padding-top:0}.u_bb{background-color:rgba(213,0,0,.85);border-radius:3px}@keyframes u_shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(2px,0,0)}30%,50%,70%{transform:translate3d(-4px,0,0)}40%,60%{transform:translate3d(4px,0,0)}}",g(document.head,t)),le(this,e,nn,tn,s,{})}}var on=de(((e,t)=>{(()=>{function t(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=()=>{a(r.response,t,n)},r.onerror=()=>{console.error("could not download file")},r.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof ue&&ue.global===ue?ue:void 0,i=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=o.saveAs||("object"!=typeof window||window!==o?()=>{}:"download"in HTMLAnchorElement.prototype&&!i?(e,i,a)=>{var s=o.URL||o.webkitURL,l=document.createElement("a");i=i||e.name||"download",l.download=i,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?r(l):n(l.href)?t(e,i,a):r(l,l.target="_blank")):(l.href=s.createObjectURL(e),setTimeout((()=>{s.revokeObjectURL(l.href)}),4e4),setTimeout((()=>{r(l)}),0))}:"msSaveOrOpenBlob"in navigator?(e,o,i)=>{if(o=o||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}(e,i),o);else if(n(e))t(e,o,i);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout((()=>{r(a)}))}}:(e,n,r,a)=>{if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,r);var s="application/octet-stream"===e.type,l=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||s&&l||i)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=()=>{var e=u.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},u.readAsDataURL(e)}else{var d=o.URL||o.webkitURL,f=d.createObjectURL(e);a?a.location=f:location.href=f,a=null,setTimeout((()=>{d.revokeObjectURL(f)}),4e4)}});o.saveAs=a.saveAs=a,e.exports=a})()}));const an={once:!0};function sn(...e){const t=(()=>{let e,t;return{promise:new Promise(((n,r)=>{t=n,e=r})),resolve:t,reject:e}})();function n(){for(const[t,...r]of e)for(const e of r)t.removeEventListener(e,n);t.resolve(void 0)}for(const[t,...r]of e)for(const e of r)t.addEventListener(e,n,an);return t}const ln=new Uint8Array(16);async function cn(e,t){const n=new Uint8Array(t.byteLength+e.length);n.set(t,0),n.set(e,t.byteLength);const r=new Uint8Array(await crypto.subtle.digest("SHA-1",n)),o=new Uint8Array(16);return o.set(r.subarray(0,4),0),o.set(r.subarray(4,10),4),o.set(r.subarray(6,14),6),o[6]=15&o[6]|80,o[8]=63&r[8]|128,o[9]=r[9],o.set(r.subarray(10,16),10),o}let un=null;async function dn(e){return un||(un=await cn(Se.encode("ranobe-ebook-loader"),ln)),(e=>{let t="";for(let n=0;n<16;++n)t+=e[n].toString(16).padStart(2,"0");return[(n=t).slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20)].join("-");var n})(await cn(Se.encode(e),un))}const fn=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?3988292384^t>>>1:t>>>1;fn[e]=t}function pn(e){let t=-1;for(const n of e)t=t>>>8^fn[255&(t^n)];return-1^t}function hn(e,t){const n=[];for(;t--;)n.push(255&e),e>>>=8;return n}function mn(e){let t,n,r,o,s,l,c,d,f,p,h,m,_,S;return t=new It({}),t.$on("save",e[5]),r=new Yt({props:{$$slots:{default:[yn]},$$scope:{ctx:e}}}),{c(){ie(t.$$.fragment),n=x(),ie(r.$$.fragment),o=x(),s=v("button"),l=w(vn),d=x(),f=v("button"),p=w(wn),k(s,"class",e[2].component),k(f,"class",e[2].component)},m(i,a){ae(t,i,a),y(i,n,a),ae(r,i,a),y(i,o,a),y(i,s,a),g(s,l),y(i,d,a),y(i,f,a),g(f,p),m=!0,_||(S=[$(s,"click",e[4]),u(c=Ze.call(null,s,e[1])),$(f,"click",e[5]),u(h=Ze.call(null,f,e[1]))],_=!0)},p(e,t){const n={};512&t&&(n.$$scope={dirty:t,ctx:e}),r.$set(n),c&&a(c.update)&&2&t&&c.update.call(null,e[1]),h&&a(h.update)&&2&t&&h.update.call(null,e[1])},i(e){m||(ee(t.$$.fragment,e),ee(r.$$.fragment,e),m=!0)},o(e){te(t.$$.fragment,e),te(r.$$.fragment,e),m=!1},d(e){se(t,e),e&&b(n),se(r,e),e&&b(o),e&&b(s),e&&b(d),e&&b(f),_=!1,i(S)}}}function gn(e){let n,r;return n=new Ft({props:{color:e[2].color}}),n.$on("cancel",e[3]),{c(){ie(n.$$.fragment)},m(e,t){ae(n,e,t),r=!0},p:t,i(e){r||(ee(n.$$.fragment,e),r=!0)},o(e){te(n.$$.fragment,e),r=!1},d(e){se(n,e)}}}function yn(e){let n,r,o,i;return n=new Jt({props:{label:vn}}),n.$on("trigger",e[4]),o=new Jt({props:{label:wn}}),o.$on("trigger",e[5]),{c(){ie(n.$$.fragment),r=x(),ie(o.$$.fragment)},m(e,t){ae(n,e,t),y(e,r,t),ae(o,e,t),i=!0},p:t,i(e){i||(ee(n.$$.fragment,e),ee(o.$$.fragment,e),i=!0)},o(e){te(n.$$.fragment,e),te(o.$$.fragment,e),i=!1},d(e){se(n,e),e&&b(r),se(o,e)}}}function bn(e){let t,n,r,o,i;const a=[gn,mn],s=[];function l(e,t){return e[0]?0:e[1]?1:-1}return~(t=l(e))&&(n=s[t]=a[t](e)),o=new rn({}),{c(){n&&n.c(),r=x(),ie(o.$$.fragment)},m(e,n){~t&&s[t].m(e,n),y(e,r,n),ae(o,e,n),i=!0},p(e,[o]){let i=t;t=l(e),t===i?~t&&s[t].p(e,o):(n&&(V(),te(s[i],1,1,(()=>{s[i]=null})),Q()),~t?(n=s[t],n?n.p(e,o):(n=s[t]=a[t](e),n.c()),ee(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||(ee(n),ee(o.$$.fragment,e),i=!0)},o(e){te(n),te(o.$$.fragment,e),i=!1},d(e){~t&&s[t].d(e),e&&b(r),se(o,e)}}}const vn="Скачать *.fb2",wn="Скачать *.epub";function xn(e,t,n){const r={"ранобэ.рф":rt,"xn--80ac9aeh6f.xn--p1ai":rt,"ranobes.com":ot,"tl.rulate.ru":at,"jaomix.ru":st}[location.hostname];let o,i=!1,a=null;function s(){o&&(o.abort(),o=null),i&&n(0,i=!1),Oe.clear()}const l=new AbortController;j((async()=>{if(r.spa){history.pushState=Le("pushState"),history.replaceState=Le("replaceState");const e=e=>setTimeout(e,2e3);for(;!l.signal.aborted;){for(;!n(1,a=r.injectTarget);)if(await new Promise(e),l.signal.aborted)return;await sn([l.signal,"abort"],[window,"pushState","replaceState","popstate"]).promise,s(),await new Promise(e)}}else n(1,a=await r.injectTarget)})),L((()=>{var e,t,n,o;l.abort(),s(),r.spa&&(null===(t=(e=history.pushState).destroy)||void 0===t||t.call(e),null===(o=(n=history.replaceState).destroy)||void 0===o||o.call(n))}));const c=d.bind(null,Ye),u=d.bind(null,We);async function d(e){if(!i&&a)try{s(),n(0,i=!0),o=new AbortController,Me.clear(),await(R(),I);const t=new Map,a=async e=>(e.id=await Ae(e.title),e.text=await Je(function(e){var t,n="",r=e||{};return((e,r)=>{n=n+"

"+lt.escape(null==(t=r)?"":t)+"

"+(null==(t=e)?"":t)+"
"}).call(this,"text"in r?r.text:"undefined"!=typeof text?text:void 0,"title"in r?r.title:"undefined"!=typeof title?title:void 0),n}(e),o,We,1,t),e.text=function(e){var t,n="",r=e||{};return((e,r)=>{n=n+''+lt.escape(null==(t=r)?"":t)+''+(null==(t=e)?"":t)+""}).call(this,"text"in r?r.text:"undefined"!=typeof text?text:void 0,"title"in r?r.title:"undefined"!=typeof title?title:void 0),n}(e),e),l=new r,c=await l.parts(o,t,e===We?a:null);switch(e){case We:c.unshift(await a({title:"Аннотация",text:"
"+l.description+l.covers.map((e=>`

`)).join("")+"
"}));const n=Array.from(Ve(t)),r=Re(c[0].text).querySelector("section");r.firstElementChild.remove();const i={...l,cover:t.get(l.covers[0]),isoDate:l.isoDate,uuid:"urn:uuid:"+await dn(l.title+l.subtitle+c.map((e=>e.title)).join("")),annotation:r.innerText.trim(),chapters:c,images:n};r.ownerDocument.open(),t.clear();const s="application/epub+zip";return on.saveAs(new Blob(Array.from(function*(e){let t=0;const n=[];let r=0;for(const{path:o,data:i}of e){const e=i instanceof Uint8Array?i:Se.encode(i),a=Se.encode(o),s=[10,0,0,0,0,0,0,0,0,0,...hn(pn(e),4),...hn(e.length,4),...hn(e.length,4),...hn(a.length,2),0,0];n.push(80,75,1,2,20,0,...s,0,0,0,0,0,0,0,0,0,0,...hn(t,4),...a);const l=new Uint8Array([80,75,3,4,...s]);t+=l.byteLength+e.byteLength+a.byteLength,++r,yield l,yield a,yield e}n.push(80,75,5,6,0,0,0,0,...hn(r,2),...hn(r,2),...hn(n.length,4),...hn(t,4),0,0),yield new Uint8Array(n)}([{path:"mimetype",data:s},{path:"META-INF/container.xml",data:''},{path:"META-INF/com.apple.ibooks.display-options.xml",data:''},{path:"OEBPS/toc.ncx",data:dt(i)},{path:"OEBPS/nav.xhtml",data:ft(i)},{path:"OEBPS/content.opf",data:pt(i)},...n.map((e=>({path:"OEBPS/images/"+e.id+e.ext,data:e.data()}))),...c.map((e=>({path:`OEBPS/${e.id}.xhtml`,data:e.text})))])),{type:s}),l.bookAlias+".epub");case Ye:l.genres.length<1&&l.genres.push("unrecognised");const u=await(l.covers[0]&&He("Обложка",l.covers[0],t,o));await(null==u?void 0:u.b64());const d=['',ct({...l,cover:u,annotation:await Je("
"+l.description+"
",o,e,5),shortDate:l.date("YYYY-MM-DD"),fullDate:l.date("DD.MM.YYYY")}),"",await Je(ut({title:l.title,chapters:c}),o,e,5,t),""];for(const e of Ve(t))d.push(``,await e.b64(),"");return t.clear(),d.push("
"),on.saveAs(new Blob(d,{type:"application/x-fictionbook+xml;charset=utf-8"}),l.bookAlias+".fb2")}}catch(e){"AbortError"!=(null==e?void 0:e.name)&&(console.error(e),Me.add(e))}finally{s()}}return console.log("ranobe-ebook-loader 0.2.6"),[i,a,r,s,c,u]}const $n={__proto__:null,default:class extends ce{constructor(e){var t;super(),document.getElementById("svelte-jnedj2-style")||((t=v("style")).id="svelte-jnedj2-style",t.textContent="#ranobe-ebook-loader{position:fixed;z-index:16777270;right:0;bottom:0}",g(document.head,t)),le(this,e,xn,bn,s,{})}}};