trackkun-dom 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/adBlocker.json CHANGED
@@ -1 +1 @@
1
- {"hosts":["pubfuture-ad.com","bidgear.com","googlesyndication.com","rtmark.net","e7z9t4x6a0v5mk3zo1a0xj2z7c6g8sa6js5z7s2c3h9x0s5fh3a6sjwb8q7m.xyz","phumsise.com","chumsaf.com","ad.baovip79.biz","uk88.top","kismetrosland.life","d3n7ct9nohphbs.cloudfront.net","rlcdn.com","rfihub.com","stoolsocman.top","doubleclick.net","acscdn.com","viglink.com","vntsm.io","ad-delivery.net","radioonlinehd.net","a-ads.com","adskeeper.com","goomaphy.com","t7cp4fldl.com","vlitag.com","adschill.com","pubfuture.com","infolinks.com","prospectprefer.com","benchsuited.com","busyexit.com","realsrvcdn.com","godpvqnszo.com","prplad.com","33across.com","creativecdn.com","openx.net","cebidsbessel.com","vdo.ai","imasdk.googleapis.com","earthenicings.com","trotolhonor.com","zqvee2re50mr.com","waisheph.com","groapeeque.com","umbretalen.com","guigebichir.website","dummieseardrum.com","hbcdn.net","falcatayamalka.com","admatic.com.tr","ppcnt.pro","gdpr.web0.eu","sowfootsolent.com","%20sowfootsolent.com%20","flarby.com","y8z5nv0slz06vj2k5vh6akv7dj2c8aj62zhj2v7zj8vp0zq7fj2gf4mv6zsb.me","pemsrv.com","magsrv.com","tsyndicate.com","xlviirdr.com","funnelgloveaffable.com","wordsnought.com","fictionfittinglad.com","wrestcut.com","obediencechainednoun.com","scratchconsonant.com","bihussfoob.net","prplads.com","crockerydestructivespoken.com","lwonclbench.com","purpleads.io","abrhydona.com","taxismaned.top","viewyentreat.guru","foramscoypou.com","188.42.84.12","taiiwin.vin","licensekey2018.com","caribedkurukh.com","tzegilo.com","casibom.io","jubusvaleur.top","intimalsejoin.top","squeaksgridded.top","cussingversate.top","newcrystalcommunications.com","gypperywyling.com","flinttovaria.com","bitonclick.com","mbidadm.com","23.109.170.2","pubmatic.com","invstatic101.creativecdn.com","endowmentoverhangutmost.com","lavangataled.com","betteradsystem.com","d2kk0o3fr7ed01.cloudfront.net","abtfliping.top","jatosbathkol.com","links.services.disqus.com","tempest.services.disqus.com","mxhnkn.pro","blurbreimbursetrombone.com","awwagqorqpty.com","clobberprocurertightwad.com","coosync.com","bncloudfl.com","bullionglidingscuttle.com","btoomlalk.com","x8.games","profitsfly.com","c.disquscdn.com"],"css":".ad-topMobile,.ad,.ads-container,.ads,.adsbygalaksion,.adsbygoogle,.code-block,.display-banner,.radio-ad,#radio_content,#content *[class*=\"bg-ssp-\"],#adplus-anchor,#fixedban,#noktaplayercontainer,#p_6314647,#psdn-slot,#stickyplayervideoclose,#teaser3,*[class^=\"ad-\"],*[class^=\"ad_\"],*[class$=\"-ad\"],*[class$=\"_ad\"],*[class*=\"-ad-\"],*[class*=\"_ad_\"],*[class^=\"ads-\"],*[class^=\"ads_\"],*[class$=\"-ads\"],*[class$=\"_ads\"],*[class*=\"-ads-\"],*[class*=\"_ads_\"],*[data-adunit],*[data-google-query-id],*[id*=\"_ad_\"],*[id*=\"-ad-\"],*[id^=\"ad_\"],*[id^=\"ad-\"],*[id$=\"_ad\"],*[id$=\"-ad\"],*[id*=\"_ads_\"],*[id*=\"-ads-\"],*[id^=\"ads_\"],*[id^=\"ads-\"],*[id$=\"_ads\"],*[id$=\"-ads\"],*[id^=\"dsq-app\"],*[id^=\"pf-\"],*[id^=\"publift-\"],iframe[src*=\"adata\"],iframe[src*=\"ad.\"],iframe[src*=\"ads.\"],iframe[src*=\"/ad\"],iframe[src*=\"/A=\"],iframe[src*=\"/click\"],iframe[src*=\"?click\"],iframe[src*=\"?banner\"],iframe[src*=\"=click\"],iframe[src*=\"clickurl=\"],iframe[src*=\".atwola.\"],iframe[src*=\"spinbox.\"],iframe[src*=\"transfer.go\"],iframe[src*=\"adfarm\"],iframe[src*=\"adfarmadSpace\"],iframe[src*=\"adserver\"],iframe[src*=\"adjuggler\"],iframe[src*=\".banner\"],iframe[src*=\"bluestreak\"],iframe[src*=\"doubleclick\"],iframe[src*=\"/rd.\"],iframe[src*=\"/0AD\"],iframe[src*=\".falkaq.\"],iframe[src*=\"connextra.\"],iframe[src*=\"tracksponsor.\"],iframe[data-aa],script[src*=\"doubleclick\"] + div,script[src*=\"romanticwait\"] + div,.empower-ad,*[data-empower-id],#empowerplayercontainer,*[id^=\"bg-ssp-\"],a[href*=\"ajker-sangbad.com\"],a[href*=\"story.alandal.com/psycho-asura\"],.google-auto-placed,*[data-ad-format],*[data-adtrack-id],.rev-src,iframe[src=\"about:blank\"] + div[style]:last-child,a[href*=\"deflink\"],#Arpian-ads,iframe[id^=\"bg_\"],.adv,#vi-smartbanner,*[data-ad-slot],html > iframe,div:has(> [prclck]),[prclck],a[href*=\"gotrackier\"],body > nav:not([id]):not([class]):not([style]) > a[style]:first-child:last-child,body > section:not([id]):not([class]):not([style]) > span:first-child:last-child > a[style],.adblock_title,.adblock_subtitle,div[id]:has(div[id] h4.adblock_title),script[src*=\"trotolhonor.com\"] + iframe,.custom-html-widget:has(script[src*=\"separatelysmackfibber\"]),#content a[href*=\"kit-food.com\"],*[pa-slot-container],*[id^=\"exo_slider\"],.exo-native-widget-outer-container,iframe[src*=\"a.magsrv.com\"],#theradios_content,script[src*=\"dummieseardrum\"] + iframe,.ts-im-container,.adxp-sticky,div[id*=\"ScriptRoot\"],#catfishAd,div:has(> script[src*=\"tingisincused.com\"]){position: fixed!important;display: none!important;opacity: 0!important;top: -99999px!important;left: -99999px!important;right: unset!important;bottom: unset!important;visibility: hidden!important;z-index: -1000!important;pointer-events: none!important;height: 0!important;width: 0!important;max-height: 0!important;min-height: 0!important;max-width: 0!important;min-width: 0!important;overflow: hidden!important;transform: translate(-99999px, -99999px) scale(0)!important;} body:has(div[id] h4.adblock_title) {overflow: unset !important;}"}
1
+ {"hosts":["pubfuture-ad.com","bidgear.com","googlesyndication.com","flytechb.com","roledale.com","rtmark.net","e7z9t4x6a0v5mk3zo1a0xj2z7c6g8sa6js5z7s2c3h9x0s5fh3a6sjwb8q7m.xyz","phumsise.com","chumsaf.com","ad.baovip79.biz","uk88.top","kismetrosland.life","d3n7ct9nohphbs.cloudfront.net","rlcdn.com","rfihub.com","stoolsocman.top","doubleclick.net","acscdn.com","viglink.com","vntsm.io","ad-delivery.net","radioonlinehd.net","a-ads.com","adskeeper.com","goomaphy.com","t7cp4fldl.com","vlitag.com","adschill.com","pubfuture.com","infolinks.com","prospectprefer.com","benchsuited.com","busyexit.com","realsrvcdn.com","godpvqnszo.com","prplad.com","33across.com","creativecdn.com","openx.net","cebidsbessel.com","vdo.ai","imasdk.googleapis.com","earthenicings.com","trotolhonor.com","zqvee2re50mr.com","waisheph.com","groapeeque.com","umbretalen.com","guigebichir.website","dummieseardrum.com","hbcdn.net","falcatayamalka.com","admatic.com.tr","ppcnt.pro","gdpr.web0.eu","sowfootsolent.com","%20sowfootsolent.com%20","flarby.com","y8z5nv0slz06vj2k5vh6akv7dj2c8aj62zhj2v7zj8vp0zq7fj2gf4mv6zsb.me","pemsrv.com","magsrv.com","tsyndicate.com","xlviirdr.com","funnelgloveaffable.com","wordsnought.com","fictionfittinglad.com","wrestcut.com","obediencechainednoun.com","scratchconsonant.com","pubadx.one","pestholy.com","bihussfoob.net","prplads.com","crockerydestructivespoken.com","lwonclbench.com","purpleads.io","abrhydona.com","taxismaned.top","viewyentreat.guru","foramscoypou.com","188.42.84.12","taiiwin.vin","licensekey2018.com","caribedkurukh.com","tzegilo.com","casibom.io","jubusvaleur.top","intimalsejoin.top","squeaksgridded.top","cussingversate.top","newcrystalcommunications.com","gypperywyling.com","flinttovaria.com","bitonclick.com","mbidadm.com","23.109.170.2","pubmatic.com","invstatic101.creativecdn.com","endowmentoverhangutmost.com","lavangataled.com","betteradsystem.com","d2kk0o3fr7ed01.cloudfront.net","abtfliping.top","jatosbathkol.com","links.services.disqus.com","tempest.services.disqus.com","mxhnkn.pro","blurbreimbursetrombone.com","awwagqorqpty.com","clobberprocurertightwad.com","coosync.com","bncloudfl.com","bullionglidingscuttle.com","btoomlalk.com","x8.games","profitsfly.com","c.disquscdn.com"],"css":".ad-topMobile,.ad,.ads-container,.ads,.adsbygalaksion,.adsbygoogle,.code-block,.display-banner,.radio-ad,#radio_content,#content *[class*=\"bg-ssp-\"],#adplus-anchor,#fixedban,#noktaplayercontainer,#p_6314647,#psdn-slot,#stickyplayervideoclose,#teaser3,*[class^=\"ad-\"],*[class^=\"ad_\"],*[class$=\"-ad\"],*[class$=\"_ad\"],*[class*=\"-ad-\"],*[class*=\"_ad_\"],*[class^=\"ads-\"],*[class^=\"ads_\"],*[class$=\"-ads\"],*[class$=\"_ads\"],*[class*=\"-ads-\"],*[class*=\"_ads_\"],*[data-adunit],*[data-google-query-id],*[id*=\"_ad_\"],*[id*=\"-ad-\"],*[id^=\"ad_\"],*[id^=\"ad-\"],*[id$=\"_ad\"],*[id$=\"-ad\"],*[id*=\"_ads_\"],*[id*=\"-ads-\"],*[id^=\"ads_\"],*[id^=\"ads-\"],*[id$=\"_ads\"],*[id$=\"-ads\"],*[id^=\"dsq-app\"],*[id^=\"pf-\"],*[id^=\"publift-\"],iframe[src*=\"adata\"],iframe[src*=\"ad.\"],iframe[src*=\"ads.\"],iframe[src*=\"/ad\"],iframe[src*=\"/A=\"],iframe[src*=\"/click\"],iframe[src*=\"?click\"],iframe[src*=\"?banner\"],iframe[src*=\"=click\"],iframe[src*=\"clickurl=\"],iframe[src*=\".atwola.\"],iframe[src*=\"spinbox.\"],iframe[src*=\"transfer.go\"],iframe[src*=\"adfarm\"],iframe[src*=\"adfarmadSpace\"],iframe[src*=\"adserver\"],iframe[src*=\"adjuggler\"],iframe[src*=\".banner\"],iframe[src*=\"bluestreak\"],iframe[src*=\"doubleclick\"],iframe[src*=\"/rd.\"],iframe[src*=\"/0AD\"],iframe[src*=\".falkaq.\"],iframe[src*=\"connextra.\"],iframe[src*=\"tracksponsor.\"],iframe[data-aa],script[src*=\"doubleclick\"] + div,script[src*=\"romanticwait\"] + div,.empower-ad,*[data-empower-id],#empowerplayercontainer,*[id^=\"bg-ssp-\"],a[href*=\"ajker-sangbad.com\"],a[href*=\"story.alandal.com/psycho-asura\"],.google-auto-placed,*[data-ad-format],*[data-adtrack-id],.rev-src,iframe[src=\"about:blank\"] + div[style]:last-child,a[href*=\"deflink\"],#Arpian-ads,iframe[id^=\"bg_\"],.adv,#vi-smartbanner,*[data-ad-slot],html > iframe,div:has(> [prclck]),[prclck],a[href*=\"gotrackier\"],body > nav:not([id]):not([class]):not([style]) > a[style]:first-child:last-child,body > section:not([id]):not([class]):not([style]) > span:first-child:last-child > a[style],.adblock_title,.adblock_subtitle,div[id]:has(div[id] h4.adblock_title),script[src*=\"trotolhonor.com\"] + iframe,.custom-html-widget:has(script[src*=\"separatelysmackfibber\"]),#content a[href*=\"kit-food.com\"],*[pa-slot-container],*[id^=\"exo_slider\"],.exo-native-widget-outer-container,iframe[src*=\"a.magsrv.com\"],#theradios_content,script[src*=\"dummieseardrum\"] + iframe,.ts-im-container,.adxp-sticky,div[id*=\"ScriptRoot\"],#catfishAd,div:has(> script[src*=\"tingisincused.com\"]){position: fixed!important;display: none!important;opacity: 0!important;top: -99999px!important;left: -99999px!important;right: unset!important;bottom: unset!important;visibility: hidden!important;z-index: -1000!important;pointer-events: none!important;height: 0!important;width: 0!important;max-height: 0!important;min-height: 0!important;max-width: 0!important;min-width: 0!important;overflow: hidden!important;transform: translate(-99999px, -99999px) scale(0)!important;} body:has(div[id] h4.adblock_title) {overflow: unset !important;}"}
package/index.js CHANGED
@@ -1 +1 @@
1
- (function(T,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(T=typeof globalThis<"u"?globalThis:T||self,N(T._trackkun_={}))})(this,function(T){"use strict";function N(a){let e=!1;return new Promise((t,r)=>{Promise.all(a.map(async s=>{const n=await s;!e&&n&&(e=!0,t(n))})).then(()=>{e||t(void 0)})})}function W(a,{removeTrailingSlash:e=!0}={}){if(!a)return;const t=e&&a.endsWith("/")?a.slice(0,-1):a;try{return new URL(t)}catch{return}}function x(a){if(!(!a||typeof a!="string"))return a.startsWith("http://")||a.startsWith("https://")?W(a)?.pathname:a.startsWith("//")?W(`https:${a}`)?.pathname:a}async function P(a,e,t){const r=await t(()=>{a=0});if(r!==void 0)return r;if(!(a<=0))return await new Promise(s=>{setTimeout(async()=>{const n=await P(a-1,e,t);s(n)},e)})}async function C(a,e,t=0){const r=e.root??document.documentElement,s=e.timeoutMs??1e4;return P(e.lazy===!0?s/50:0,50,()=>{const n=e.all===!0?Array.from(r.querySelectorAll(a)):r.querySelector(a)??void 0;return(e.all?!n?.length:!n)?void 0:n})}const G={text:Be,attr:Oe,"attr-contain":je,value:Le,row:Ae};function g(a,e){if(a)return Y(a,e,Te)}function L(a,e){if(a)return Y(a,e,Ne)}function Y(a,e,t){if(!a)return;const r=a.split("||").map(s=>s.trim()).filter(s=>!!s&&s.includes("|"));for(const s of r){const n=Pe(s);if(!n)continue;const i=t(e??document.documentElement,n.selector,n.instructions);if(i)return i}}function Pe(a){const[e,t]=a.split("|");if(!t)return;const r=(t?.startsWith("[")&&t.endsWith("]")?t.substring(1,t.length-1).split(","):[t]).map(s=>{const n=s.indexOf(":"),i=n!==-1;return{extractor:i?s.substring(0,n):s,param:i?s.substring(n+1):""}});return{selector:e||void 0,instructions:r}}function Te(a,e,t){if(!e)return Q(a,t);const r=e.split(",");for(const s of r){const n=Array.from(a.querySelectorAll(s));for(const i of n){const l=Q(i,t);if(l)return l}}}function Ne(a,e,t){const r=e?Array.from(a.querySelectorAll(e)):[a],s=[];for(const n of r)for(const i of t){const l=G[i.extractor],o=l(n,i.param);if(o){s.push(o);break}}return s}function Q(a,e){for(const t of e){const r=G[t.extractor],s=r(a,t.param);if(s)return s}}function Be(a){return Array.from(a.childNodes).filter(e=>e.nodeType===3).map(e=>B(e.textContent)).filter(Boolean).join(" ").trim()||B(a.textContent)}function Oe(a,e){return B(a.getAttribute(e))}function je(a,e){let t=a.getAttribute(e);if(!t){const r=a.getAttributeNames().find(s=>s.includes(e));r&&(t=a.getAttribute(r))}return B(t)}function Le(a){return a.value}function Ae(a,e){if(!e)return;const t=B(a.textContent)?.toLowerCase(),r=e.toLowerCase();if(!(t!==r&&t!==`${r}:`))return B(a.nextElementSibling?.textContent??a.nextSibling?.textContent)}function B(a){if(a)return a?.replace(/(\n|\t)/g," ").trim()||void 0}var ke=(a=>(a[a.reading=1]="reading",a[a.paused=2]="paused",a[a.plan=3]="plan",a[a.completed=4]="completed",a[a.dropped=5]="dropped",a[a.deleted=6]="deleted",a))(ke||{}),ze=(a=>(a[a.ok=1]="ok",a[a.hidden=2]="hidden",a[a.deleted=3]="deleted",a))(ze||{}),_e=(a=>(a[a.aggregator=0]="aggregator",a[a.scanlator=1]="scanlator",a))(_e||{}),Ee=(a=>(a[a.pending=0]="pending",a[a.completed=1]="completed",a[a.offline=2]="offline",a[a.incompat=3]="incompat",a))(Ee||{}),U=(a=>(a.id="id",a.name="name",a.slug="slug",a))(U||{}),q=(a=>(a.blank="about:blank",a.title="meta.title",a.reader="meta.reader",a))(q||{});const We=/(vol(ume)?|season)(\s*|-|\.)(\d+)/i,Ue=/(ch(ap(t(er)?|\.)?|\.)?|^#|episode\.?|capitolo\.?|capitulo\.?|bölüm\.?)(\s*|-)(\d+([_-~,.]\d+)?)/i,qe=/\d+([_-~,.]\d+)?/,Fe=/[_-~,]/;function A(a){if(!a||!a)return;if(!isNaN(+a))return{chap:+a};const e=a.match(We),t=e?.[0]?a.replace(e[0],"").trim():a,r=t.match(Ue),s=t.match(qe),n=r?.[6],i=n??s?.[0];if(!i)return;const l=+i.replace(Fe,".");if(isNaN(l))return;const o=e?.[4];return{vol:o&&!isNaN(+o)&&a.indexOf(e[0])<a.indexOf(n?r[0]:s[0])?+o:void 0,chap:l}}function k(a){return a.sort((e,t)=>e.vol===void 0||t.vol===void 0?t.chap-e.chap:t.vol-e.vol||t.chap-e.chap),Ve(a)}function Ve(a){const e={};for(let t=a.length-1;t>=0;t--){const r=a[t],s=r.lang??"";r.vol!==void 0?e[s]=r.vol:e[s]!==void 0&&(r.inferVol=e[s])}return a}const He=[{seconds:1,locales:{en:"sec",vi:"gi\xE2y",tr:"ikinci",es:"segunda"}},{seconds:60,locales:{en:"min",vi:"ph\xFAt",tr:"dakika"}},{seconds:3600,locales:{en:"hour",vi:"gi\u1EDD",tr:"saat",fr:"heure",it:"ora",es:"hora"}},{seconds:86400,locales:{en:"day",vi:"ng\xE0y",tr:"g\xFCn",fr:"jour",it:"giorno",es:"d\xEDa"}},{seconds:604800,locales:{en:"week",vi:"tu\u1EA7n",tr:"hafta",fr:"semaine",it:"settimana",es:"semana"}},{seconds:2592e3,locales:{en:"month",vi:"th\xE1ng",tr:"ay",fr:"mois",it:"mese",es:"mes"}},{seconds:31536e3,locales:{en:"year",vi:"n\u0103m",tr:"yil",fr:"ann",it:"anno",es:"a\xF1o"}}];function Z(a,e){const t=a?.toLowerCase();if(!t)return;const r=Date.now();if(t.includes("now"))return r;if(t.includes("yesterday"))return r-864e5;const s=new Date(t);if(s instanceof Date){const c=s.valueOf();if(!isNaN(c))return s.getHours()===0&&s.getMinutes()===0?Math.min(r,c+432e5):c}const n=He.find(c=>e&&c.locales[e]&&t.indexOf(c.locales[e])!==-1?!0:t.indexOf(c.locales.en)!==-1);if(!n)return;const i=t.split(" ").filter(Boolean),l=K(i)??K(i,["a","an"]);if(!l)return;const o=r-l*n.seconds*1e3;return o>0?o:void 0}function K(a,e){for(let t=0;t<a.length;t++){const r=a[t];if(e?.includes(r))return 1;const s=+r;if(s)return s<0?void 0:s}}function X(a,e=location.origin){if(!a)return;const t=new URL(a.startsWith("//")?`${location.protocol}${a}`:a,location.origin+location.pathname).toString();return t.startsWith(e)?t.replace(e,""):t}function ee(a,{titleSlug:e,titleId:t}){if(!a)return"/";let r=a.replace("{titleSlug}",e);t&&(r=r.replace("{titleId}",t));const s=r.endsWith("/")?r:r+"/";return s.startsWith("/")?s:"/"+s}function Je(a,e){const t=[...e],r=[];let s=!1,n=0;const i=Math.min(a.length,100);for(let o=0;o<i;o++){if(n>=10/2){const d=10-r.length;if(d>0){const w=o+d<=a.length?a.slice(o,o+d):t.slice(0,d);r.push(...w)}break}const c=a[o],u=c.id!==void 0,h=t.findIndex(d=>u&&d.id===c.id||d.slug===c.slug||d.name==c.name),p=h===-1?void 0:t.splice(h,1)[0];!p||p.chapters[0]?.chap!==c.chapters[0]?.chap?(s=!0,r.push({...c,changed:!0})):(n++,r.push(c))}if(!s)return{hasMore:!1,rawReleases:[]};if(r.length<=10)return{hasMore:!!a[a.length-1]?.changed,rawReleases:r};const l=[];for(let o=0;o<r.length;o++){const c=r[o];(c.changed||o<10)&&l.push(c)}return{hasMore:e.length<2||e.length-t.length<2,rawReleases:l}}function Ge(a,e){const t={};return a.forEach(r=>{const s=r.chapters.reduce((n,i)=>{const l=i.lang||e||"";return n[l]||(n[l]=[]),n[l].push(i),n},{});Object.entries(s).forEach(([n,i])=>{const l=`${r.slug}:${n}`;t[l]?(t[l].chapters.push(...i),k(t[l].chapters)):t[l]={...r,lang:n===""?void 0:n,chapters:i}})}),Object.values(t)}var S=(a=>(a.title="title",a.reader="reader",a.releases="releases",a.chapters="chapters",a.search="search",a))(S||{}),Ye=Object.defineProperty,Qe=(a,e,t)=>e in a?Ye(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,M=(a,e,t)=>(Qe(a,typeof e!="symbol"?e+"":e,t),t);class E{constructor(e){M(this,"spec"),M(this,"siteMeta"),M(this,"tags"),M(this,"context"),M(this,"methodsMap",{[S.title]:()=>this.getRawTitleData(),[S.reader]:()=>this.getRawReaderData(),[S.releases]:()=>this.getRawReleasesData(),[S.search]:()=>this.getRawSearchData(),[S.chapters]:()=>this.getRawChaptersData()}),M(this,"normalizedTagsMap"),this.spec=e.spec,this.siteMeta=e.siteMeta,this.tags=e.tags,this.context=e.context}async getRawSearchData(){throw new Error("Unimplemented")}async getRawPageByType(e,t=!1){const r=await this.methodsMap[e](),s=!r&&Ke(this.spec);if(t&&!r&&!s)return;const n=location.origin+location.pathname;return{type:e,is404:s,specId:this.spec.id,siteName:g(this.spec.name),url:n,data:r,spec:this.spec,context:this.context}}parseReaderSlug(e,t,r){let s=t;if(s[0]!=="/"&&s.includes("/"))try{s=new URL(t,location.href).pathname}catch{}const n=s.endsWith("/")?s.slice(0,-1):s;if(e.includes("{")){const i=e.split("/").filter(Boolean),l=n.split("/").filter(Boolean);if(i.length<l.length){const o=l[i.indexOf("{lang}")],c=l[i.indexOf("{titleId}")],u=l[i.indexOf("{titleSlug}")],h=e.replace("{lang}",o).replace("{titleId}",c).replace("{titleSlug}",u);if(n.startsWith(h))return{basePath:h,lang:o.toLowerCase(),titleId:c,titleSlug:u,slug:n.replace(h,"")}}}else if(n.startsWith(e))return{basePath:e,slug:n.replace(e,"")};return{basePath:"",slug:n[0]==="/"?n.substring(1):n}}parseTitleSlug(e){if(typeof e!="string")return{};const t=x(e),r=t?.split("/").filter(Boolean);if(!r?.length)return{};const s=this.siteMeta.titleBase.split("/").filter(Boolean),n=s.indexOf("{slug}");return(n===-1?r.length-s.length>=1:r.length===s.length)?{id:r[s.indexOf("{id}")],slug:n===-1?r.slice(s.length).join("/"):r[n]}:{slug:t}}finalizeRawReleasesData(e){const t=this.spec.releases?.title?.lang?this.siteMeta.defaultLang:void 0,r=Ge(e.rawReleases,t);if(r.length)return this.context?.oldRawReleases?Je(r,this.context.oldRawReleases):{rawReleases:r,hasMore:!0}}getTagIdsFromNames(e){if(!e?.length)return;const t=this.normalizedTagsMap??(this.normalizedTagsMap=Ze(this.tags)),r=e.map(s=>t[F(s)]).filter(Boolean);return r.length===0?void 0:Array.from(new Set(r)).sort((s,n)=>s-n)}}M(E,"specId"),M(E,"siteId");function Ze(a){const e={};return a.forEach(({id:t,name:r,altNames:s})=>{e[F(r)]=t,s&&s.forEach(n=>{e[F(n)]=t})}),e}function F(a){const e=a.toLowerCase().replaceAll(" ","").replaceAll("-","");return e[e.length-1]==="s"?e.substring(0,e.length-1):e}function Ke(a){return a[404]&&document.querySelector(a[404])?!0:document.title.toLowerCase().includes("not found")}class b extends E{async getRawReleasesData(){if(!this.spec?.releases?.title)return;const{chapter:e,...t}=this.spec.releases.title,r=await C(t.sel,{lazy:!0,all:!0});if(!r?.length)return;const s=r.slice(0,100).map(i=>{const l=g(t.url,i),o=x(l),c=g(t.name,i),u=g(t.at,i);if(!(!o||!c))return{titleEl:i,id:g(t.id,i),path:o,name:c,lang:g(t.lang,i)?.toLowerCase(),at:Z(u,this.siteMeta.defaultLang)}}).filter(Boolean);if(!s.length)return;const n=[];return await Promise.all(s.map(async i=>{const{path:l,titleEl:o,lang:c,at:u,...h}=i,{id:p,slug:d}=this.parseTitleSlug(l);if(!d)return;const w=h.id||p,y=await this.getChapters(e,{root:o,titleId:w,titleSlug:d})??[];y.length&&n.push({slug:d,chapters:c||u?y.map(f=>({...f,elIndex:void 0,lang:f.lang??c,ts:f.ts??u})):y,...h,id:w})})),this.finalizeRawReleasesData({rawReleases:n})}async getRawTitleData(){const e=this.spec.title;if(!e||(e.sel||e.lazy)&&!await C(e.sel??e.name,{lazy:!!e.lazy}))return;const t=g(e.name);if(!t)return;const{id:r,slug:s}=this.parseTitleSlug(location.pathname);if(!s)return;let n=L(e.tags)??[];n.length===1&&(n=n[0].split(",").map(u=>u.trim()).filter(Boolean));const i=g(e.type),l=L(e.langs)?.map(u=>u.toLowerCase()),o=r||g(e.id),c=await this.getChapters(e.chapter,{lazy:!0,titleId:o,titleSlug:s})??[];return{id:o||g(e.id),url:location.origin+location.pathname,slug:s,name:t,langs:l?.length?l:e.langs&&this.siteMeta.defaultLang?[this.siteMeta.defaultLang]:void 0,tags:this.getTagIdsFromNames([...n??[],...i?[i]:[]]),chapters:c,img:e.img?await this.getValidImgSrc(e.img):void 0,firstUrl:this.getFirstChapterUrl()}}getFirstChapterUrl(){const e=g(this.spec.title?.first);if(e){if(e.startsWith("http"))return e;try{return new URL(e,location.href).href}catch{return}}}getValidImgSrc(e){return P(33,30,()=>{const t=g(e);return t&&!t.startsWith("data:")?t.split(" ")[0]:void 0})}async getRawReaderData(){const{spec:e,siteMeta:t}=this;if(!e?.reader||e.generic&&!await b.isReaderPage(e.reader))return;const r=e.reader.content;if(!(!r||await b.verifyImgsCotainer(r)))return;const s=e.reader.title,n=document.querySelector(s.sel);if(!n)return;const i=g(s.name,n),l=g(s.url,n),{slug:o,id:c}=this.parseTitleSlug(l),u=g(s.img,n);if(!i||!l||!o)return;const h=c||g(s.id),p=!!this.context?.disableLazyChapters,d=!!this.context?.includeHiddenChapters,w=await this.getChapters(e.reader?.chapter,{titleId:h,titleSlug:o,lazy:d||!p,includeHiddenChapters:d,timeoutMs:d?3e3:12e4})??[],y=g(e.reader.label)?.toLowerCase().replace(i.toLowerCase(),"");if(!y)return;const{vol:f,chap:v=0}=A(y)||{},{slug:m,basePath:$,lang:I,titleId:z}=this.parseReaderSlug(ee(t.readerBase,{titleId:h,titleSlug:o}),location.pathname,location.href);return this.finalizeRawReaderData({vol:f,chap:v,lang:I??g(e.reader.lang)?.toLowerCase()??(e.reader.lang?this.siteMeta.defaultLang:void 0),slug:m,basePath:$,imgs:r?void 0:L(e.reader.imgs),title:{id:h||z||g(s.id),url:l,slug:o,name:i,langs:I?[I]:void 0,img:X(u),chapters:w,hasMoreChapters:p&&!w.length&&!!e.reader?.chapter&&!e.reader?.chapter.trigger}},{prevSlug:this.findNeighborChapter({sel:e.reader.prev,basePath:$}),nextSlug:this.findNeighborChapter({sel:e.reader.next,basePath:$})})}async getRawChaptersData(){const e=this.siteMeta.chapters;if(e===q.blank)return;const t=e===q.reader?(await this.getRawReaderData())?.title:await this.getRawTitleData();if(!t)return;const r=this.context?.lang,{chapters:s}=t,n=r?s.filter(i=>!i.lang||i.lang===r):s;return{chapters:n,title:{...t,chapters:[]},hasMore:!1,asc:!1,total:n.length}}async getRawSearchData(){const e=this.spec.search?.title;if(!e)return;const{chapter:t}=e,r=[];return await Promise.all(Array.from(document.querySelectorAll(e.sel)).map(async s=>{const n=g(e.url,s),i=x(n),l=g(e.name,s),{slug:o,id:c}=this.parseTitleSlug(i);!i||!l||!o||r.push({id:c,slug:o,name:l,chapters:await this.getChapters(t,{root:s,titleId:c,titleSlug:o})??[]})})),r.length?{rawReleases:r}:void 0}async getChapters(e,{root:t=document.documentElement,titleId:r="",titleSlug:s="",includeHiddenChapters:n=!1,lazy:i=!0,timeoutMs:l}){if(!e)return;let o=null;if(e.trigger){if(!n||(o=document.querySelector(e.trigger),!o))return;o.click()}const c=[],u=await C(e.sel,{root:t,all:!0,lazy:i,timeoutMs:l});if(!u?.length)return o?.click(),[];const h=(u??[]).map((f,v)=>({id:g(e.id,f),label:g(e.label,f),url:g(e.url,f),at:g(e.at,f),elIndex:v}));o?.click();const p=h.map(({label:f})=>A(f)),d=p[1]?.chap;!p[0]&&(d===void 0||d<=1)&&(p[0]={chap:0});const{readerBase:w}=this.siteMeta,y=ee(w,{titleId:r,titleSlug:s});return p.forEach((f,v)=>{if(!f)return;const{id:m,url:$,at:I,elIndex:z}=h[v],_={...f,id:m,elIndex:z,ts:Z(I,this.siteMeta.defaultLang)},R=$?.startsWith("http")&&!$.includes(`//${location.hostname}/`),J=R?$:x($);if(!J){c.push(_);return}if(R){c.push({..._,slug:J});return}const{slug:ra,lang:sa}=this.parseReaderSlug(y,J,$);c.push({..._,slug:ra,lang:sa})}),k(c)}static async isReaderPage(e){return!!e.sel&&!!await C(e.sel,{lazy:!!e.lazy})}static async verifyImgsCotainer(e){const t=e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>`${r} img, ${r} canvas`).join(",");return!!await C(t,{lazy:!0,all:!1})}findNeighborChapter({sel:e,basePath:t}){const r=g(e);if(!r||r.startsWith("#")||r.startsWith("/#"))return;const s=x(r);if(s)return this.parseReaderSlug(t,s,r).slug}finalizeRawReaderData(e,{prevSlug:t,nextSlug:r}={}){const s=e.title?.chapters;if(!s?.length){const c=A(t),u=A(r);return!c&&!u?e:{...e,prev:c?{...c,slug:t}:void 0,next:u?{...u,slug:r}:void 0}}let n,i,l,o;for(let c=0;c<s.length&&!(n&&(!t||l)&&!r&&o);c++){const u=s[c];!n&&(e.slug==u.slug||e.chap===u.chap&&(e.vol===u.vol||e.vol===void 0))?(n=u,i=c):!l&&t===u.slug?l=u:!o&&r===u.slug&&(o=u)}return i!==void 0&&(l??(l=s[i+1]),o??(o=s[i-1])),{...e,inferVol:n?.inferVol,prev:l,next:o}}}var Xe=Object.defineProperty,et=(a,e,t)=>e in a?Xe(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,tt=(a,e,t)=>(et(a,typeof e!="symbol"?e+"":e,t),t);class te extends b{parseTitleSlug(e){return{slug:x(e)?.split("/").filter(Boolean)[1]}}}tt(te,"specId","bato");function at(){return Math.random().toString(16).slice(2)}async function rt({addListener:a,removeListener:e,transform:t,filter:r,handler:s,onTimeout:n,timeout:i,once:l}){return new Promise(o=>{a(h);const c=()=>l===!0&&e(h),u=i?setTimeout(()=>{c(),o(void 0),n?.()},i):void 0;async function h(p,...d){p=t?t(p):p,p!==void 0&&(!r||r(p,...d))&&(c(),o(p),s?.(p,...d),u&&clearTimeout(u))}})}async function st(a){return(await rt({addListener:e=>window.addEventListener("message",e),removeListener:e=>window.removeEventListener("message",e),...a}))?.data}async function nt(a){const{receiverWindow:e,timeout:t,targetOrigin:r,event:s,args:n}=a,i={reqId:at(),event:s,args:n};return(e||window)?.postMessage(i,r??"*"),(await st({filter:l=>l?.data?.resId===i.reqId,timeout:t??3e4,once:!0}))?.result}const O={isAny:!0};function j(a,...e){return nt({event:"tk:fetchResult",args:{baseUrl:a,segments:e}})}var it=Object.defineProperty,lt=(a,e,t)=>e in a?it(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ot=(a,e,t)=>(lt(a,typeof e!="symbol"?e+"":e,t),t);const ae=class Ie extends b{async getRawReleasesData(){let e;try{const r=Array.from({length:2},async(s,n)=>{const i=`https://api.${location.host}/chapter?accept_erotic_content=true&page=${n+1}&order=new`;return(await fetch(i)).json()});e=(await Promise.all(r)).flat()}catch{return}const t=[];return e.forEach(r=>{const{vol:s,chap:n,hid:i,lang:l,updated_at:o,md_comics:c}=r,u=typeof n=="string"&&!isNaN(+n)?+n:void 0;typeof u=="number"&&t.push({id:c.hid,slug:c.slug,name:c.title,chapters:[{slug:i,vol:typeof s=="string"&&!isNaN(+s)?+s:void 0,chap:u,lang:l,ts:new Date(o).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){const e=await super.getRawTitleData();if(!e)return e;const t=await j(`https://api.${location.host}`,"comic",O,"chapters");if(!t)return e;const r=t.url.split("/").filter(Boolean).slice(-2)[0],s=re(t.value),n=g("h1 ~ div.text-sm span:first-child|row:demographic"),i=n?this.getTagIdsFromNames([n])?.[0]:void 0;return i&&!e.tags?.includes(i)&&(e.tags?.push(i),e.tags?.sort((l,o)=>l-o)),{...e,img:e.img??X(g(this.spec.title?.img)),id:r,hasMoreChapters:s?.hasMore??!1,chapters:s?.chapters??[]}}async getRawReaderData(){const e=await super.getRawReaderData();return e&&{...e,lang:e.lang&&e.lang?.length<=6?e.lang:Ie.getLangFromReaderSlug(e.slug)||e.lang}}static getLangFromReaderSlug(e){const t=e.split("-");let r;for(let s=t.length-1;s>0;s--){const n=t[s];if(!isNaN(+n))break;r=r?`${n}-${r}`:n}return r&&r.length<=6?r:void 0}async getRawChaptersData(){if(!this.context?.rawId)return;const{rawId:e,lang:t="en",skip:r}=this.context,s=r?Math.floor(r/1e3)+1:void 0;try{const n=await fetch(`https://api.${location.host}/comic/${e}/chapters?lang=${t}&limit=1000${s&&s>1?`&page=${s}`:""}`),i=re(await n.json());return i?{...i,lang:t,asc:!1}:void 0}catch{return}}};ot(ae,"specId","comick");let ct=ae;function re(a){if(!Array.isArray(a?.chapters))return;const e=[];return a.chapters.forEach(t=>{const{vol:r,chap:s,hid:n,lang:i,updated_at:l}=t,o=typeof s=="string"&&!isNaN(+s)?+s:void 0;typeof o!="number"||e.some(c=>c.vol==r&&c.chap===o&&c.lang===i)||e.push({slug:n,vol:typeof r=="string"&&!isNaN(+r)?+r:void 0,chap:o,lang:i,ts:new Date(l).valueOf()})}),{chapters:k(e),total:a.total??e.length,hasMore:a.total>a.limit}}function se(a,e){const t=a[0]===e?a.substring(1):a;return t[t.length-1]===e?t.substring(0,t.length-1):t}var ut=Object.defineProperty,gt=(a,e,t)=>e in a?ut(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,pt=(a,e,t)=>(gt(a,typeof e!="symbol"?e+"":e,t),t);class V extends b{async getRawReleasesData(){const e=this.detectNewSiteMeta(this.spec.releases,this.siteMeta);this.siteMeta=e??this.siteMeta;const t=await super.getRawReleasesData();if(t)return{...t,siteMeta:e}}async getRawTitleData(){const e=this.finalizeNewSiteMeta(this.siteMeta,{titleBase:this.extractBasePath(location.pathname)});this.siteMeta=e??this.siteMeta;const t=await super.getRawTitleData();if(t)return{...t,siteMeta:e}}async getRawReaderData(){const e=ne(this.spec.reader?.title);if(!e)return;const t=this.finalizeNewSiteMeta(this.siteMeta,{titleBase:this.extractBasePath(x(e))});this.siteMeta=t??this.siteMeta;const r=await super.getRawReaderData();if(r)return{...r,siteMeta:t}}async getRawSearchData(){const e=ne(this.spec.search?.title);if(!e)return;const t=this.finalizeNewSiteMeta(this.siteMeta,{titleBase:this.extractBasePath(x(e))});this.siteMeta=t??this.siteMeta;const r=await super.getRawSearchData();if(r)return{...r,siteMeta:t}}detectNewSiteMeta(e,t){if(!e)return;const r=e.title,s=document.querySelector(r.sel)??void 0;if(!s)return;const n=x(g(r.url,s));if(n!==void 0)return this.finalizeNewSiteMeta(t,{titleBase:this.extractBasePath(n)})}finalizeNewSiteMeta(e,{titleBase:t}){if(e.titleBase!==t)return{...e,titleBase:t,readerBase:e.readerBase.replace(e.titleBase,t)}}extractBasePath(e){return se(e,"/").split("/").slice(0,-1).join("/")}}pt(V,"specId","madara");function ne(a){if(!a)return;const e=document.querySelector(a.sel);return g(a.url,e)}var ht=Object.defineProperty,dt=(a,e,t)=>e in a?ht(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ft=(a,e,t)=>(dt(a,typeof e!="symbol"?e+"":e,t),t);class ie extends b{async getRawReleasesData(){const e=await this.getVM();if(!e)return super.getRawReleasesData();const t=e.LatestJSON.slice(0,100).map(r=>{const s=+r.Chapter.substring(1)/10;return{slug:r.IndexName,name:r.SeriesName,chapters:[{chap:s,slug:`${r.IndexName}-chapter-${s}.html`,ts:ce(r.Date)}]}});return this.finalizeRawReleasesData({rawReleases:t})}parseTitleSlug(e){const{slug:t}=super.parseTitleSlug(e);return!t||t.includes("{")?{}:{slug:t}}async getRawTitleData(){const e=await super.getRawTitleData();return e&&{...e,chapters:le(await this.getVM(),e.slug),hasMoreChapters:!1}}parseReaderSlug(e,t){const{slug:r,basePath:s}=super.parseReaderSlug(e,t);return{slug:r.replace(/-page-\d{1,3}\.html\/?$/,".html"),basePath:s}}async getRawReaderData(){const e=await this.getVM();if(!e)return;const t=document.querySelector(".ImageGallery img.img-fluid")?.getAttribute("ng-src"),r=e.IndexName,s=oe(e.CurChapter,r);return this.finalizeRawReaderData({chap:s.chap,slug:s.slug,imgs:mt(e,t??void 0),basePath:"/"+this.siteMeta.readerBase.replace("{titleSlug}",r)+"/",title:{name:e.SeriesName,slug:r,url:`/${this.siteMeta.titleBase}/${r}`,chapters:le(e,r),hasMoreChapters:!1}})}getVM(){return P(50,100,()=>window.angular?.element?.(document.documentElement)?.scope()?.vm)}}ft(ie,"specId","manga4life");function le(a,e){return(a?.Chapters??a?.CHAPTERS??[]).sort((t,r)=>r.Chapter-t.Chapter).map(t=>oe(t,e))}function oe(a,e){const t=+a.Chapter[0],r=+a.Chapter.substring(1)/10;return{slug:`${e}-chapter-${r}${t&&t>1?`-index-${t}`:""}.html`,chap:r,ts:ce(a.Date)}}function ce(a){const e=new Date(a).valueOf();return e===e?e:void 0}function mt(a,e){let t=e?.split(".").slice(-1)[0]??"png";t=t.length>=3&&t.length<=4?t:"png";try{const r=a.CurChapter.Chapter.slice(1,-1),s=a.CurChapter.Chapter[a.CurChapter.Chapter.length-1],n=s!=="0"?`${r}.${s}`:r,i=`https://${a.CurPathName}/manga/${a.IndexName}/${a.CurChapter.Directory?`${a.CurChapter.Directory}/`:""}${n}-`;return a.Pages.map(l=>{const o=(l+"").padStart(3,"0");return`${i}${o}.${t}`})}catch{return}}var wt=Object.defineProperty,yt=(a,e,t)=>e in a?wt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,vt=(a,e,t)=>(yt(a,typeof e!="symbol"?e+"":e,t),t);const bt={a:.1,b:.2,c:.3,d:.4};class ue extends E{parseTitleSlug(e){return{slug:x(e)?.split("/").filter(Boolean)[1]}}async getRawReleasesData(){let e=[];try{e=(await(await fetch("https://api.mangadex.org/chapter?limit=96&offset=0&includes[]=manga&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&order[readableAt]=desc")).json()).data}catch{return}const t=[];return e.forEach(({relationships:r,attributes:s,id:n})=>{const i=r.find(({type:c})=>c==="manga"),l=D(s.volume),o=D(s.chapter);o!==void 0&&t.push({slug:i.id,name:Object.values(i.attributes.title)[0],chapters:[{slug:s.externalUrl||n,vol:l,chap:o,lang:s.translatedLanguage,ts:new Date(s.readableAt).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){const e="https://api.mangadex.org/manga/",[t,r]=await Promise.all([j(e,O),j(e,O,"feed")]);if(!t||!r)return;const s=r.value.data?.map?.(l=>{const{attributes:o,id:c}=l;if(typeof o!="object"||typeof c!="string"||!c)return;const{externalUrl:u,title:h,volume:p,chapter:d,translatedLanguage:w}=o;return{slug:u||c,label:h||void 0,vol:D(p),chap:D(d),lang:w||"en",ts:new Date(o.readableAt).valueOf()}}).filter(l=>l?.chap!=null)??[],{data:n}=t.value;if(!n)return;const i=pe({data:n,getTagIdsFromNames:l=>this.getTagIdsFromNames(l)});if(i)return{...i,chapters:k(s),hasMoreChapters:(r.value.total||0)>(r.value.limit||0)}}async getRawReaderData(){const e="https://api.mangadex.org/",[t,r,s]=await Promise.all([j(e,"chapter",O),j(e,"at-home","server",O),j(e,"manga",O,"aggregate")]);if(!t||!r||!s)return;const n=t.value.data,{volume:i,chapter:l,externalUrl:o,translatedLanguage:c}=n.attributes||{},{baseUrl:u,chapter:{data:h,dataSaver:p,hash:d}}=r.value,w=n.relationships?.find?.(R=>R.type==="manga");if(!w)return;const y=pe({data:w,getTagIdsFromNames:R=>this.getTagIdsFromNames(R)});if(!y||typeof s.value.volumes!="object")return;const f=ge(s.value)??[];(typeof l!="string"||l==="none")&&!f.length&&f.push({chap:0,slug:n.id});const v=f.findIndex(R=>R.slug===n.id),m=n.relationships?.find?.(R=>R.type==="scanlation_group"),$=u.endsWith("/")?u:u+"/",I=!!localStorage.getItem("md")?.includes?.('"dataSaver":true'),z=`${$}${I?"data-saver":"data"}/`,_=((I?p:h)??[]).map?.(R=>`${z}${d}/${R}`)??[];return{externalUrl:o,vol:D(i),inferVol:f[v]?.inferVol,chap:D(l)||0,imgs:_,lang:c,slug:n.id,prev:f[v+1],next:f[v-1],basePath:"/chapter/",groupName:m?.attributes?.name,groupUrl:m?.attributes?.website,isWebtoon:w?.attributes?.tags?.some(R=>R.attributes.name.en==="Long Strip"),title:{...y,chapters:f}}}async getRawChaptersData(){if(!this.context)return;const{titleSlug:e,lang:t="en"}=this.context;let r;try{const s=await fetch(`https://api.mangadex.org/manga/${e}/aggregate?translatedLanguage[]=${t}`);r=ge(await s.json())}catch{return}if(r)return{chapters:r,lang:t,asc:!1,hasMore:!1,total:r.length}}}vt(ue,"specId","mangadex");function D(a){if(typeof a!="string"||a==="none")return;const e=parseFloat(a);if(e!==e)return;const t=a[a.length-1];return e+(bt[t]??0)}function ge(a){if(typeof a.volumes!="object")return;const e=Object.values(a.volumes).map(({volume:t,chapters:r})=>{const s=D(t);return Object.values(r).map(({id:n,chapter:i})=>{const l=D(i);if(l!==void 0)return{vol:s,chap:l,slug:n}})}).flat().filter(Boolean).reverse();return k(e)}function pe({data:a,getTagIdsFromNames:e}){const{id:t,attributes:r,relationships:s}=a;if(!t||typeof t!="string"||typeof r!="object")return;const{title:n,availableTranslatedLanguages:i,altTitles:l,tags:o,contentRating:c}=r;if(typeof n!="object"||i&&!Array.isArray(i))return;const u=Object.values(n)[0];if(!u||typeof u!="string")return;const h=Rt(),p=(i??[])?.map?.(m=>typeof m=="string"?m:void 0).filter(Boolean)??[],d=p.filter(m=>m&&(!h||h.includes(m))),w=l?.map?.(m=>{const[[,$]=[]]=Object.entries(m);return $}),y=s?.find?.(m=>m.type==="cover_art")?.attributes?.fileName,f=y?`https://uploads.mangadex.org/covers/${t}/${y}.256.jpg`:void 0,v=(o||[]).map(m=>m?.attributes?.name?.en).concat(c).filter(Boolean);return{url:`${location.origin}/title/${t}`,slug:t,name:u,altNames:w,langs:d.length>0?d:p.length>0?p:["en"],img:f,tags:e(v)}}function Rt(){const a=localStorage.getItem("md");if(a)try{const e=JSON.parse(a)?.userPreferences?.filteredLanguages;return e?.length?e:void 0}catch{return}}var St=Object.defineProperty,$t=(a,e,t)=>e in a?St(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,xt=(a,e,t)=>($t(a,typeof e!="symbol"?e+"":e,t),t);class he extends b{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return{...e,rawReleases:e.rawReleases.map(t=>({...t,id:t.id?.split("?")[0]}))}}async getRawReaderData(){if((await C(".current-viewtype",{lazy:!0,all:!1}))?.textContent?.trim().toLowerCase()!=="volume")return await super.getRawReaderData()}async getRawChaptersData(){const e=this.context?.lang;if(!e)return;const t=await C(`.tab-content[data-name="chapter"] a.dropdown-item[data-code="${e.toUpperCase()}"]`,{lazy:!0,all:!1});if(t)return t.click(),await C(`.tab-content[data-name="chapter"] li.item[data-number] a[href*="/${e}/"]`,{lazy:!0,all:!1}),await super.getRawChaptersData()}}xt(he,"specId","mangafire");var Ct=Object.defineProperty,Mt=(a,e,t)=>e in a?Ct(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Dt=(a,e,t)=>(Mt(a,typeof e!="symbol"?e+"":e,t),t);class de extends b{async getRawReaderData(){const e=await super.getRawReaderData();return e&&{...e,imgs:await this.getImgs()}}parseReaderSlug(e,t){const{slug:r,basePath:s}=super.parseReaderSlug(e,t),n=r.split("/").filter(Boolean),i=n[n.length-1];return{basePath:s,slug:i.startsWith("pg-")?n.slice(0,-1).join("/"):r}}async getImgs(){const e=await P(100,20,()=>window.imgsrcs),t=window.CryptoJS,r=t.enc.Hex.parse("e11adc3949ba59abbe56e057f20f883e"),s={iv:t.enc.Hex.parse("1234567890abcdef1234567890abcdef"),padding:t.pad.ZeroPadding};return t.AES.decrypt(e,r,s).toString(t.enc.Utf8).split(",")}}Dt(de,"specId","mangago");var It=Object.defineProperty,Pt=(a,e,t)=>e in a?It(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Tt=(a,e,t)=>(Pt(a,typeof e!="symbol"?e+"":e,t),t);class fe extends b{async getRawTitleData(){const e=await super.getRawTitleData();return e&&{...e,chapters:e.chapters.map(t=>({...t,slug:t.slug?.split("/").filter(Boolean).slice(-1)[0]}))}}}Tt(fe,"specId","mangaplus");var Nt=Object.defineProperty,Bt=(a,e,t)=>e in a?Nt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ot=(a,e,t)=>(Bt(a,typeof e!="symbol"?e+"":e,t),t);class me extends b{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return{...e,rawReleases:e.rawReleases.map(t=>({...t,id:t.slug.substring(t.slug.lastIndexOf("-")+1)||void 0}))}}}Ot(me,"specId","mangareader");var jt=Object.defineProperty,Lt=(a,e,t)=>e in a?jt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,At=(a,e,t)=>(Lt(a,typeof e!="symbol"?e+"":e,t),t);class we extends V{async getRawReaderData(){const e=await super.getRawReaderData();if(e)return{...e,title:{...e.title,id:await this.getReaderTitleId()}}}async getReaderTitleId(){const e=await window.HISTORY?.getStored?.();if(!e||typeof e!="object")return;const t=Object.values(e).filter(Boolean);if(!t.length)return;t.sort((s,n)=>n.time-s.time);const r=t[0].manga_ID;return typeof r=="string"?r:typeof r=="number"?r+"":void 0}detectNewSiteMeta(e,t){if(!e)return;const r={...t,releases:se(location.pathname,"/")},s=e.title,n=document.querySelector(s.sel)??void 0;if(!n)return;const i=x(g(s.url,n));if(i===void 0)return;const l=n.querySelector(s.chapter.sel)??void 0;if(!(!l||x(g(s.chapter.url,l))===void 0))return r.titleBase=this.extractBasePath(i),t.titleIdType===U.id&&(g(s.id,n)||(t.titleIdType=U.name)),this.finalizeNewSiteMeta(t,r)}finalizeNewSiteMeta(e,t){const r=Object.keys(t),s={...e};let n=!1;return r.forEach(i=>{const l=t[i];l!==e[i]&&(s[i]=l,n=!0)}),n?s:void 0}}At(we,"specId","mangastream");var kt=Object.defineProperty,zt=(a,e,t)=>e in a?kt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,_t=(a,e,t)=>(zt(a,typeof e!="symbol"?e+"":e,t),t);class ye extends b{async getRawReaderData(){const e=await super.getRawReaderData();if(e)return{...e,title:{...e.title,name:e.title.name.replace("Ritorna a","").trim()}}}}_t(ye,"specId","mangaworld");var Et=Object.defineProperty,Wt=(a,e,t)=>e in a?Et(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ut=(a,e,t)=>(Wt(a,typeof e!="symbol"?e+"":e,t),t);class ve extends b{async getRawTitleData(){const e=await super.getRawTitleData();if(e)return{...e,hasMoreChapters:e.chapters.length===50}}}Ut(ve,"specId","mgeko");var qt=Object.defineProperty,Ft=(a,e,t)=>e in a?qt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Vt=(a,e,t)=>(Ft(a,typeof e!="symbol"?e+"":e,t),t);class be extends b{async getRawTitleData(){const e=await super.getRawTitleData();return e&&{...e,hasMoreChapters:!!H()}}async getRawChaptersData(){const e=await this.getRawTitleData();if(!e)return;const{chapters:t}=e,r={...e,chapters:[]};if(!e.hasMoreChapters)return{chapters:t,title:r,hasMore:e.hasMoreChapters};const s=this.context?.findContinue;if(s){const o=await this.findContinueChapters({rawTitleData:e,chapter:s});return o?{chapters:e.chapters[0]?[e.chapters[0],...o]:o,title:r}:void 0}const n=this.context?.skip,i=t.length,l=n&&n>=i?Math.floor(n/i)+1:void 0;return l?{chapters:await this.getChaptersByPage({page:l,titleSlug:e.slug})??[],title:{...r,chapters:[]},hasMore:!!H(l),asc:!1,skip:n}:{chapters:t,title:r,hasMore:!!H(l)}}async findContinueChapters({rawTitleData:e,chapter:{chap:t},curPage:r=1,cacheChaptersByPage:s={},...n}){const i=s[r]??e.chapters,l=i[i.length-1].chap<=t,o=n.maxPage??Ht();if(l){if(i[0].chap>t){const v=[...i].reverse().find(m=>m.chap>t);return v?[v]:i.slice(0,1)}if(r<=1)return i.slice(0,1)}else if(r===o)return i.slice(-1);const c=e.chapters.length,u=Object.keys(s).map(v=>+v).sort((v,m)=>v-m),h=l?-1:1,p=u[u.indexOf(r)+h];if(p===r+h)return l?s[p].slice(-1).concat(i.slice(0,1)):i.slice(-1).concat(s[p].slice(0,1));const d=l?t-i[0].chap:i[0].chap-t,w=Math.floor(d/c)+1,y=l?Math.max(w,(p??1)+1):Math.min(w,(p??o+1)-1,o),f=await this.getChaptersByPage({page:y,titleSlug:e.slug});if(f)return await this.findContinueChapters({rawTitleData:e,chapter:{chap:t},curPage:y,maxPage:o,cacheChaptersByPage:{...s,1:e.chapters,[y]:f}})}async getChaptersByPage({page:e,titleSlug:t}){const r=Re(e);if(!r)return;const s=this.spec.title.chapter,n=s.sel,i=document.querySelector(n),l=P(100,30,()=>{const o=document.querySelector(n);if(o&&i!==o)return!0;r.click()});return r.click(),await l,await this.getChapters(s,{lazy:!1,titleSlug:t})}}Vt(be,"specId","reaper");function H(a=1){return Re(a+1)}function Re(a){const e=`span[wire\\:key="paginator-page-1-page${a}"] button,button[aria-label="Go to page ${a}"]`;return document.querySelector(e)}function Ht(){const a=Array.from(document.querySelectorAll('span[wire\\:key^="paginator-page-"]'));return a.length?+a[a.length-1].getAttribute("wire:key").split("-").slice(-1)[0].replace("page",""):1}var Jt=Object.defineProperty,Gt=(a,e,t)=>e in a?Jt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Yt=(a,e,t)=>(Gt(a,typeof e!="symbol"?e+"":e,t),t);class Se extends b{async getRawTitleData(){const e=await super.getRawTitleData();if(!e)return;const t=L(".info-detail__row > .genre-btn,.info__right .stats__row:first-child|text")?.map(r=>[r,...r.split(" ")]).flat();return $e({...e,tags:this.getTagIdsFromNames(t)??[]},".episode-header .episode-cnt")}async getRawReaderData(){const e=await super.getRawReaderData();if(!e)return;const t=`${location.origin}/series/${e.title.slug}/info`;return{...e,title:{...$e({...e.title,url:t,tags:[]},".episode-list .js-ep-cnt"),hasMoreChapters:!1}}}async getRawChaptersData(){if(!this.context)return;const{rawId:e,skip:t}=this.context,r=1e3,s=t?Math.floor(t/1e3)+1:1;try{const n=await fetch(`/series/${e}/episodes?page=${s}&sort=NEWEST&max_limit=${r}`);return Qt(await n.json())}catch{return}}parseTitleSlug(e){if(!e)return{};const t=e.split("/").filter(Boolean);return{slug:t[1]??t[0]}}}Yt(Se,"specId","tapas");function $e(a,e){const t=Zt(e)>20;return{...a,chapters:t?[]:a.chapters,hasMoreChapters:t}}function Qt(a){const e=a?.data?.episodes;if(!Array.isArray(e))return;const t=e.map(s=>({chap:s.pending_scene??s.scene,slug:s.id+"",ts:new Date(s.publish_date)?.valueOf?.()||void 0})),r=a?.data?.pagination;return{chapters:t,total:r?.total??t.length,hasMore:!!r?.has_next}}function Zt(a){return+(document.querySelector(a)?.textContent?.trim().split(" ")[0]||0)}var Kt=Object.defineProperty,Xt=(a,e,t)=>e in a?Kt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ea=(a,e,t)=>(Xt(a,typeof e!="symbol"?e+"":e,t),t);class xe extends b{async getRawTitleData(){const e=new URLSearchParams(location.search),t=e.get("episode_no"),r=e.get("title_no");if(t||!r)return;const s=await super.getRawTitleData();if(!s)return;const n=location.pathname.split("/")[1];return{...s,slug:`${s.slug}?title_no=${r}`,id:r,langs:[n].filter(Boolean),chapters:s.chapters.map(i=>({...i,lang:n})),hasMoreChapters:(document.querySelector(".paginate")?.childElementCount??1)>1}}async getRawReaderData(){const e=new URLSearchParams(location.search),t=e.get("episode_no"),r=e.get("title_no");if(!t||!r)return;const s=A(g(".paginate > span:not(:first-child)|text"));if(s===void 0)return;const{chap:n}=s,i=document.title.split("|")[1]?.trim();if(!i)return;const l=location.pathname.split("/"),o=`${l.slice(0,4).join("/")}/list?title_no=${r}`,c=await this.getChapters({sel:"#sequence_scroll li.eg-flick-panel,#toolbar .episode_lst li[data-episode-no]",url:"a|attr:href",label:"|attr:data-episode-no || .num|text"},{lazy:!1,titleId:r,titleSlug:o}),u=l[1];return{chap:n,lang:u,slug:`${location.pathname}?title_no=${r}&episode_no=${t}`,basePath:"",imgs:await this.getReaderImgs(),isWebtoon:!0,title:{id:r,url:o,slug:o,name:i,langs:[u],chapters:(c??[]).map(h=>({...h,lang:u})),hasMoreChapters:!1}}}async getReaderImgs(){const e=L("#_imageList img|[attr:data-url,attr:src]");return e?.length?e:await P(100,50,()=>window.__viewerState__?.scrollViewerParam?.imageList?.map(({url:t})=>t).filter(Boolean))}parseReaderSlug(e,t,r){if(!r)return{basePath:"",slug:t};if(r.startsWith("http://")||r.startsWith("https://")){const s=W(r);return{basePath:"",slug:s.pathname+s.search}}return{basePath:"",slug:r}}}ea(xe,"specId","webtoon");const ta=[te,ct,V,ie,ue,he,de,fe,me,we,ye,ve,be,Se,xe];function Ce(a){const e=ta.find(t=>t.specId===a.spec.id)??b;return new e(a)}async function aa(a){const{spec:e}=a;if(e){const t=a.siteMeta??e.meta,r=a.type?[a.type]:Me(t,e.generic);if(!r.length)return;const s=Ce({...a,spec:e,siteMeta:t});return await N(r.map(n=>s.getRawPageByType(n,r.length>1)))}return await N((a.genericSpecs??[]).map(t=>{const r=Me(t.meta,t.generic);if(!r.length)return[];const s=Ce({...a,spec:t,siteMeta:t.meta});return r.map(n=>s.getRawPageByType(n,!0))}).flat())}function Me(a,e){if(location.pathname==="/")return[];const{titleBase:t,readerBase:r}=a,s=location.pathname.split("/").filter(Boolean),n=De(s,r),i=De(s,t);if(n&&i)return[S.reader,S.title];const l=[];return n!==!1&&!i&&l.push(S.reader),i!==!1&&!n&&l.push(S.title),!l.length&&e?[S.reader,S.title]:l}function De(a,e){if(!e)return;const t=e.split("/").filter(Boolean),r=t.indexOf("{slug}"),s=r===t.length-1,n=!s&&r!==-1;if(s&&(t.pop(),!t.length))return;const i=a.length-t.length;if(n?i<0:i<=0)return!1;let l=!1;for(let o=0;o<t.length;o++){const c=t[o];if(c[0]!=="{"){if(c!==a[o])return!1;l=!0}}if(l&&i===(n?0:1))return!0}T.PageType=S,T.scrape=aa});
1
+ (function(T,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(T=typeof globalThis<"u"?globalThis:T||self,N(T._trackkun_={}))})(this,function(T){"use strict";function N(a){let e=!1;return new Promise((t,r)=>{Promise.all(a.map(async s=>{const n=await s;!e&&n&&(e=!0,t(n))})).then(()=>{e||t(void 0)})})}function E(a,{removeTrailingSlash:e=!0}={}){if(!a)return;const t=e&&a.endsWith("/")?a.slice(0,-1):a;try{return new URL(t)}catch{return}}function x(a){if(!(!a||typeof a!="string"))return a.startsWith("http://")||a.startsWith("https://")?E(a)?.pathname:a.startsWith("//")?E(`https:${a}`)?.pathname:a}async function P(a,e,t){const r=await t(()=>{a=0});if(r!==void 0)return r;if(!(a<=0))return await new Promise(s=>{setTimeout(async()=>{const n=await P(a-1,e,t);s(n)},e)})}async function C(a,e,t=0){const r=e.root??document.documentElement,s=e.timeoutMs??1e4;return P(e.lazy===!0?s/50:0,50,()=>{const n=e.all===!0?Array.from(r.querySelectorAll(a)):r.querySelector(a)??void 0;return(e.all?!n?.length:!n)?void 0:n})}const G={text:Be,attr:Oe,"attr-contain":je,value:Le,row:Ae,"bg-image":ke};function g(a,e){if(a)return Y(a,e,Te)}function L(a,e){if(a)return Y(a,e,Ne)}function Y(a,e,t){if(!a)return;const r=a.split("||").map(s=>s.trim()).filter(s=>!!s&&s.includes("|"));for(const s of r){const n=Pe(s);if(!n)continue;const i=t(e??document.documentElement,n.selector,n.instructions);if(i)return i}}function Pe(a){const[e,t]=a.split("|");if(!t)return;const r=(t?.startsWith("[")&&t.endsWith("]")?t.substring(1,t.length-1).split(","):[t]).map(s=>{const n=s.indexOf(":"),i=n!==-1;return{extractor:i?s.substring(0,n):s,param:i?s.substring(n+1):""}});return{selector:e||void 0,instructions:r}}function Te(a,e,t){if(!e)return Q(a,t);const r=e.split(",");for(const s of r){const n=Array.from(a.querySelectorAll(s));for(const i of n){const l=Q(i,t);if(l)return l}}}function Ne(a,e,t){const r=e?Array.from(a.querySelectorAll(e)):[a],s=[];for(const n of r)for(const i of t){const l=G[i.extractor],o=l(n,i.param);if(o){s.push(o);break}}if(s.length)return s}function Q(a,e){for(const t of e){const r=G[t.extractor],s=r(a,t.param);if(s)return s}}function Be(a){return Array.from(a.childNodes).filter(e=>e.nodeType===3).map(e=>B(e.textContent)).filter(Boolean).join(" ").trim()||B(a.textContent)}function Oe(a,e){return B(a.getAttribute(e))}function je(a,e){let t=a.getAttribute(e);if(!t){const r=a.getAttributeNames().find(s=>s.includes(e));r&&(t=a.getAttribute(r))}return B(t)}function Le(a){return a.value}function Ae(a,e){if(!e)return;const t=B(a.textContent)?.toLowerCase(),r=e.toLowerCase();if(!(t!==r&&t!==`${r}:`))return B(a.nextElementSibling?.textContent??a.nextSibling?.textContent)}function ke(a){const e=getComputedStyle(a).backgroundImage;if(!(!e||!e.startsWith("url(")))return e.slice(5,-2)||void 0}function B(a){if(a)return a?.replace(/(\n|\t)/g," ").trim()||void 0}var ze=(a=>(a[a.reading=1]="reading",a[a.paused=2]="paused",a[a.plan=3]="plan",a[a.completed=4]="completed",a[a.dropped=5]="dropped",a[a.deleted=6]="deleted",a))(ze||{}),_e=(a=>(a[a.ok=1]="ok",a[a.hidden=2]="hidden",a[a.deleted=3]="deleted",a))(_e||{}),We=(a=>(a[a.aggregator=0]="aggregator",a[a.scanlator=1]="scanlator",a))(We||{}),Ee=(a=>(a[a.pending=0]="pending",a[a.completed=1]="completed",a[a.offline=2]="offline",a[a.incompat=3]="incompat",a))(Ee||{}),U=(a=>(a.id="id",a.name="name",a.slug="slug",a))(U||{}),q=(a=>(a.blank="about:blank",a.title="meta.title",a.reader="meta.reader",a))(q||{});const Ue=/(vol(ume)?|season)(\s*|-|\.)(\d+)/i,qe=/(ch(ap(t(er)?|\.)?|\.)?|^#|episode\.?|capitolo\.?|capitulo\.?|bölüm\.?)(\s*|-)(\d+([_-~,.]\d+)?)/i,Fe=/\d+([_-~,.]\d+)?/,Ve=/[_-~,]/;function A(a){if(!a||!a)return;if(!isNaN(+a))return{chap:+a};const e=a.match(Ue),t=e?.[0]?a.replace(e[0],"").trim():a,r=t.match(qe),s=t.match(Fe),n=r?.[6],i=n??s?.[0];if(!i)return;const l=+i.replace(Ve,".");if(isNaN(l))return;const o=e?.[4];return{vol:o&&!isNaN(+o)&&a.indexOf(e[0])<a.indexOf(n?r[0]:s[0])?+o:void 0,chap:l}}function k(a){return a.sort((e,t)=>e.vol===void 0||t.vol===void 0?t.chap-e.chap:t.vol-e.vol||t.chap-e.chap),He(a)}function He(a){const e={};for(let t=a.length-1;t>=0;t--){const r=a[t],s=r.lang??"";r.vol!==void 0?e[s]=r.vol:e[s]!==void 0&&(r.inferVol=e[s])}return a}const Je=[{seconds:1,locales:{en:"sec",vi:"gi\xE2y",tr:"ikinci",es:"segunda"}},{seconds:60,locales:{en:"min",vi:"ph\xFAt",tr:"dakika"}},{seconds:3600,locales:{en:"hour",vi:"gi\u1EDD",tr:"saat",fr:"heure",it:"ora",es:"hora"}},{seconds:86400,locales:{en:"day",vi:"ng\xE0y",tr:"g\xFCn",fr:"jour",it:"giorno",es:"d\xEDa"}},{seconds:604800,locales:{en:"week",vi:"tu\u1EA7n",tr:"hafta",fr:"semaine",it:"settimana",es:"semana"}},{seconds:2592e3,locales:{en:"month",vi:"th\xE1ng",tr:"ay",fr:"mois",it:"mese",es:"mes"}},{seconds:31536e3,locales:{en:"year",vi:"n\u0103m",tr:"yil",fr:"ann",it:"anno",es:"a\xF1o"}}];function Z(a,e){const t=a?.toLowerCase();if(!t)return;const r=Date.now();if(t.includes("now"))return r;if(t.includes("yesterday"))return r-864e5;const s=new Date(t);if(s instanceof Date){const c=s.valueOf();if(!isNaN(c))return s.getHours()===0&&s.getMinutes()===0?Math.min(r,c+432e5):c}const n=Je.find(c=>e&&c.locales[e]&&t.indexOf(c.locales[e])!==-1?!0:t.indexOf(c.locales.en)!==-1);if(!n)return;const i=t.split(" ").filter(Boolean),l=K(i)??K(i,["a","an"]);if(!l)return;const o=r-l*n.seconds*1e3;return o>0?o:void 0}function K(a,e){for(let t=0;t<a.length;t++){const r=a[t];if(e?.includes(r))return 1;const s=+r;if(s)return s<0?void 0:s}}function X(a,e=location.origin){if(!a)return;const t=new URL(a.startsWith("//")?`${location.protocol}${a}`:a,location.origin+location.pathname).toString();return t.startsWith(e)?t.replace(e,""):t}function ee(a,{titleSlug:e,titleId:t}){if(!a)return"/";let r=a.replace("{titleSlug}",e);t&&(r=r.replace("{titleId}",t));const s=r.endsWith("/")?r:r+"/";return s.startsWith("/")?s:"/"+s}function Ge(a,e){const t=[...e],r=[];let s=!1,n=0;const i=Math.min(a.length,100);for(let o=0;o<i;o++){if(n>=10/2){const d=10-r.length;if(d>0){const w=o+d<=a.length?a.slice(o,o+d):t.slice(0,d);r.push(...w)}break}const c=a[o],u=c.id!==void 0,h=t.findIndex(d=>u&&d.id===c.id||d.slug===c.slug||d.name==c.name),p=h===-1?void 0:t.splice(h,1)[0];!p||p.chapters[0]?.chap!==c.chapters[0]?.chap?(s=!0,r.push({...c,changed:!0})):(n++,r.push(c))}if(!s)return{hasMore:!1,rawReleases:[]};if(r.length<=10)return{hasMore:!!a[a.length-1]?.changed,rawReleases:r};const l=[];for(let o=0;o<r.length;o++){const c=r[o];(c.changed||o<10)&&l.push(c)}return{hasMore:e.length<2||e.length-t.length<2,rawReleases:l}}function Ye(a,e){const t={};return a.forEach(r=>{const s=r.chapters.reduce((n,i)=>{const l=i.lang||e||"";return n[l]||(n[l]=[]),n[l].push(i),n},{});Object.entries(s).forEach(([n,i])=>{const l=`${r.slug}:${n}`;t[l]?(t[l].chapters.push(...i),k(t[l].chapters)):t[l]={...r,lang:n===""?void 0:n,chapters:i}})}),Object.values(t)}var S=(a=>(a.title="title",a.reader="reader",a.releases="releases",a.chapters="chapters",a.search="search",a))(S||{}),Qe=Object.defineProperty,Ze=(a,e,t)=>e in a?Qe(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,M=(a,e,t)=>(Ze(a,typeof e!="symbol"?e+"":e,t),t);class W{constructor(e){M(this,"spec"),M(this,"siteMeta"),M(this,"tags"),M(this,"context"),M(this,"methodsMap",{[S.title]:()=>this.getRawTitleData(),[S.reader]:()=>this.getRawReaderData(),[S.releases]:()=>this.getRawReleasesData(),[S.search]:()=>this.getRawSearchData(),[S.chapters]:()=>this.getRawChaptersData()}),M(this,"normalizedTagsMap"),this.spec=e.spec,this.siteMeta=e.siteMeta,this.tags=e.tags,this.context=e.context}async getRawSearchData(){throw new Error("Unimplemented")}async getRawPageByType(e,t=!1){const r=await this.methodsMap[e](),s=!r&&Xe(this.spec);if(t&&!r&&!s)return;const n=location.origin+location.pathname;return{type:e,is404:s,specId:this.spec.id,siteName:g(this.spec.name),url:n,data:r,spec:this.spec,context:this.context}}parseReaderSlug(e,t,r){let s=t;if(s[0]!=="/"&&s.includes("/"))try{s=new URL(t,location.href).pathname}catch{}const n=s.endsWith("/")?s.slice(0,-1):s;if(e.includes("{")){const i=e.split("/").filter(Boolean),l=n.split("/").filter(Boolean);if(i.length<l.length){const o=l[i.indexOf("{lang}")],c=l[i.indexOf("{titleId}")],u=l[i.indexOf("{titleSlug}")],h=e.replace("{lang}",o).replace("{titleId}",c).replace("{titleSlug}",u);if(n.startsWith(h))return{basePath:h,lang:o.toLowerCase(),titleId:c,titleSlug:u,slug:n.replace(h,"")}}}else if(n.startsWith(e))return{basePath:e,slug:n.replace(e,"")};return{basePath:"",slug:n[0]==="/"?n.substring(1):n}}parseTitleSlug(e){if(typeof e!="string")return{};const t=x(e),r=t?.split("/").filter(Boolean);if(!r?.length)return{};const s=this.siteMeta.titleBase.split("/").filter(Boolean),n=s.indexOf("{slug}");return(n===-1?r.length-s.length>=1:r.length===s.length)?{id:r[s.indexOf("{id}")],slug:n===-1?r.slice(s.length).join("/"):r[n]}:{slug:t}}finalizeRawReleasesData(e){const t=this.spec.releases?.title?.lang?this.siteMeta.defaultLang:void 0,r=Ye(e.rawReleases,t);if(r.length)return this.context?.oldRawReleases?Ge(r,this.context.oldRawReleases):{rawReleases:r,hasMore:!0}}getTagIdsFromNames(e){if(!e?.length)return;const t=this.normalizedTagsMap??(this.normalizedTagsMap=Ke(this.tags)),r=e.map(s=>t[F(s)]).filter(Boolean);return r.length===0?void 0:Array.from(new Set(r)).sort((s,n)=>s-n)}}M(W,"specId"),M(W,"siteId");function Ke(a){const e={};return a.forEach(({id:t,name:r,altNames:s})=>{e[F(r)]=t,s&&s.forEach(n=>{e[F(n)]=t})}),e}function F(a){const e=a.toLowerCase().replaceAll(" ","").replaceAll("-","");return e[e.length-1]==="s"?e.substring(0,e.length-1):e}function Xe(a){return a[404]&&document.querySelector(a[404])?!0:document.title.toLowerCase().includes("not found")}class b extends W{async getRawReleasesData(){if(!this.spec?.releases?.title)return;const{chapter:e,...t}=this.spec.releases.title,r=await C(t.sel,{lazy:!0,all:!0});if(!r?.length)return;const s=r.slice(0,100).map(i=>{const l=g(t.url,i),o=x(l),c=g(t.name,i),u=g(t.at,i);if(!(!o||!c))return{titleEl:i,id:g(t.id,i),path:o,name:c,lang:g(t.lang,i)?.toLowerCase(),at:Z(u,this.siteMeta.defaultLang)}}).filter(Boolean);if(!s.length)return;const n=[];return await Promise.all(s.map(async i=>{const{path:l,titleEl:o,lang:c,at:u,...h}=i,{id:p,slug:d}=this.parseTitleSlug(l);if(!d)return;const w=h.id||p,y=await this.getChapters(e,{root:o,titleId:w,titleSlug:d})??[];y.length&&n.push({slug:d,chapters:c||u?y.map(f=>({...f,elIndex:void 0,lang:f.lang??c,ts:f.ts??u})):y,...h,id:w})})),this.finalizeRawReleasesData({rawReleases:n})}async getRawTitleData(){const e=this.spec.title;if(!e||(e.sel||e.lazy)&&!await C(e.sel??e.name,{lazy:!!e.lazy}))return;const t=g(e.name);if(!t)return;const{id:r,slug:s}=this.parseTitleSlug(location.pathname);if(!s)return;let n=L(e.tags)??[];n.length===1&&(n=n[0].split(",").map(u=>u.trim()).filter(Boolean));const i=g(e.type),l=L(e.langs)?.map(u=>u.toLowerCase()),o=r||g(e.id),c=await this.getChapters(e.chapter,{lazy:!0,titleId:o,titleSlug:s})??[];return{id:o||g(e.id),url:location.origin+location.pathname,slug:s,name:t,langs:l?.length?l:e.langs&&this.siteMeta.defaultLang?[this.siteMeta.defaultLang]:void 0,tags:this.getTagIdsFromNames([...n??[],...i?[i]:[]]),chapters:c,img:e.img?await this.getValidImgSrc(e.img):void 0,firstUrl:this.getFirstChapterUrl()}}getFirstChapterUrl(){const e=g(this.spec.title?.first);if(e){if(e.startsWith("http"))return e;try{return new URL(e,location.href).href}catch{return}}}getValidImgSrc(e){return P(33,30,()=>{const t=g(e);return t&&!t.startsWith("data:")?t.split(" ")[0]:void 0})}async getRawReaderData(){const{spec:e,siteMeta:t}=this;if(!e?.reader||e.generic&&!await b.isReaderPage(e.reader))return;const r=e.reader.content;if(!(!r||await b.verifyImgsCotainer(r)))return;const s=e.reader.title,n=document.querySelector(s.sel);if(!n)return;const i=g(s.name,n),l=g(s.url,n),{slug:o,id:c}=this.parseTitleSlug(l),u=g(s.img,n);if(!i||!l||!o)return;const h=c||g(s.id),p=!!this.context?.disableLazyChapters,d=!!this.context?.includeHiddenChapters,w=await this.getChapters(e.reader?.chapter,{titleId:h,titleSlug:o,lazy:d||!p,includeHiddenChapters:d,timeoutMs:d?3e3:12e4})??[],y=g(e.reader.label)?.toLowerCase().replace(i.toLowerCase(),"");if(!y)return;const{vol:f,chap:v=0}=A(y)||{},{slug:m,basePath:$,lang:I,titleId:z}=this.parseReaderSlug(ee(t.readerBase,{titleId:h,titleSlug:o}),location.pathname,location.href);return this.finalizeRawReaderData({vol:f,chap:v,lang:I??g(e.reader.lang)?.toLowerCase()??(e.reader.lang?this.siteMeta.defaultLang:void 0),slug:m,basePath:$,imgs:r?void 0:L(e.reader.imgs),title:{id:h||z||g(s.id),url:l,slug:o,name:i,langs:I?[I]:void 0,img:X(u),chapters:w,hasMoreChapters:p&&!w.length&&!!e.reader?.chapter&&!e.reader?.chapter.trigger}},{prevSlug:this.findNeighborChapter({sel:e.reader.prev,basePath:$}),nextSlug:this.findNeighborChapter({sel:e.reader.next,basePath:$})})}async getRawChaptersData(){const e=this.siteMeta.chapters;if(e===q.blank)return;const t=e===q.reader?(await this.getRawReaderData())?.title:await this.getRawTitleData();if(!t)return;const r=this.context?.lang,{chapters:s}=t,n=r?s.filter(i=>!i.lang||i.lang===r):s;return{chapters:n,title:{...t,chapters:[]},hasMore:!1,asc:!1,total:n.length}}async getRawSearchData(){const e=this.spec.search?.title;if(!e)return;const{chapter:t}=e,r=[];return await Promise.all(Array.from(document.querySelectorAll(e.sel)).map(async s=>{const n=g(e.url,s),i=x(n),l=g(e.name,s),{slug:o,id:c}=this.parseTitleSlug(i);!i||!l||!o||r.push({id:c,slug:o,name:l,chapters:await this.getChapters(t,{root:s,titleId:c,titleSlug:o})??[]})})),r.length?{rawReleases:r}:void 0}async getChapters(e,{root:t=document.documentElement,titleId:r="",titleSlug:s="",includeHiddenChapters:n=!1,lazy:i=!0,timeoutMs:l}){if(!e)return;let o=null;if(e.trigger){if(!n||(o=document.querySelector(e.trigger),!o))return;o.click()}const c=[],u=await C(e.sel,{root:t,all:!0,lazy:i,timeoutMs:l});if(!u?.length)return o?.click(),[];const h=(u??[]).map((f,v)=>({id:g(e.id,f),label:g(e.label,f),url:g(e.url,f),at:g(e.at,f),elIndex:v}));o?.click();const p=h.map(({label:f})=>A(f)),d=p[1]?.chap;!p[0]&&(d===void 0||d<=1)&&(p[0]={chap:0});const{readerBase:w}=this.siteMeta,y=ee(w,{titleId:r,titleSlug:s});return p.forEach((f,v)=>{if(!f)return;const{id:m,url:$,at:I,elIndex:z}=h[v],_={...f,id:m,elIndex:z,ts:Z(I,this.siteMeta.defaultLang)},R=$?.startsWith("http")&&!$.includes(`//${location.hostname}/`),J=R?$:x($);if(!J){c.push(_);return}if(R){c.push({..._,slug:J});return}const{slug:sa,lang:na}=this.parseReaderSlug(y,J,$);c.push({..._,slug:sa,lang:na})}),k(c)}static async isReaderPage(e){return!!e.sel&&!!await C(e.sel,{lazy:!!e.lazy})}static async verifyImgsCotainer(e){const t=e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>`${r} img, ${r} canvas`).join(",");return!!await C(t,{lazy:!0,all:!1})}findNeighborChapter({sel:e,basePath:t}){const r=g(e);if(!r||r.startsWith("#")||r.startsWith("/#"))return;const s=x(r);if(s)return this.parseReaderSlug(t,s,r).slug}finalizeRawReaderData(e,{prevSlug:t,nextSlug:r}={}){const s=e.title?.chapters;if(!s?.length){const c=A(t),u=A(r);return!c&&!u?e:{...e,prev:c?{...c,slug:t}:void 0,next:u?{...u,slug:r}:void 0}}let n,i,l,o;for(let c=0;c<s.length&&!(n&&(!t||l)&&!r&&o);c++){const u=s[c];!n&&(e.slug==u.slug||e.chap===u.chap&&(e.vol===u.vol||e.vol===void 0))?(n=u,i=c):!l&&t===u.slug?l=u:!o&&r===u.slug&&(o=u)}return i!==void 0&&(l??(l=s[i+1]),o??(o=s[i-1])),{...e,inferVol:n?.inferVol,prev:l,next:o}}}var et=Object.defineProperty,tt=(a,e,t)=>e in a?et(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,at=(a,e,t)=>(tt(a,typeof e!="symbol"?e+"":e,t),t);class te extends b{parseTitleSlug(e){return{slug:x(e)?.split("/").filter(Boolean)[1]}}}at(te,"specId","bato");function rt(){return Math.random().toString(16).slice(2)}async function st({addListener:a,removeListener:e,transform:t,filter:r,handler:s,onTimeout:n,timeout:i,once:l}){return new Promise(o=>{a(h);const c=()=>l===!0&&e(h),u=i?setTimeout(()=>{c(),o(void 0),n?.()},i):void 0;async function h(p,...d){p=t?t(p):p,p!==void 0&&(!r||r(p,...d))&&(c(),o(p),s?.(p,...d),u&&clearTimeout(u))}})}async function nt(a){return(await st({addListener:e=>window.addEventListener("message",e),removeListener:e=>window.removeEventListener("message",e),...a}))?.data}async function it(a){const{receiverWindow:e,timeout:t,targetOrigin:r,event:s,args:n}=a,i={reqId:rt(),event:s,args:n};return(e||window)?.postMessage(i,r??"*"),(await nt({filter:l=>l?.data?.resId===i.reqId,timeout:t??3e4,once:!0}))?.result}const O={isAny:!0};function j(a,...e){return it({event:"tk:fetchResult",args:{baseUrl:a,segments:e}})}var lt=Object.defineProperty,ot=(a,e,t)=>e in a?lt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ct=(a,e,t)=>(ot(a,typeof e!="symbol"?e+"":e,t),t);const ae=class Ie extends b{async getRawReleasesData(){let e;try{const r=Array.from({length:2},async(s,n)=>{const i=`https://api.${location.host}/chapter?accept_erotic_content=true&page=${n+1}&order=new`;return(await fetch(i)).json()});e=(await Promise.all(r)).flat()}catch{return}const t=[];return e.forEach(r=>{const{vol:s,chap:n,hid:i,lang:l,updated_at:o,md_comics:c}=r,u=typeof n=="string"&&!isNaN(+n)?+n:void 0;typeof u=="number"&&t.push({id:c.hid,slug:c.slug,name:c.title,chapters:[{slug:i,vol:typeof s=="string"&&!isNaN(+s)?+s:void 0,chap:u,lang:l,ts:new Date(o).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){const e=await super.getRawTitleData();if(!e)return e;const t=await j(`https://api.${location.host}`,"comic",O,"chapters");if(!t)return e;const r=t.url.split("/").filter(Boolean).slice(-2)[0],s=re(t.value),n=g("h1 ~ div.text-sm span:first-child|row:demographic"),i=n?this.getTagIdsFromNames([n])?.[0]:void 0;return i&&!e.tags?.includes(i)&&(e.tags?.push(i),e.tags?.sort((l,o)=>l-o)),{...e,img:e.img??X(g(this.spec.title?.img)),id:r,hasMoreChapters:s?.hasMore??!1,chapters:s?.chapters??[]}}async getRawReaderData(){const e=await super.getRawReaderData();return e&&{...e,lang:e.lang&&e.lang?.length<=6?e.lang:Ie.getLangFromReaderSlug(e.slug)||e.lang}}static getLangFromReaderSlug(e){const t=e.split("-");let r;for(let s=t.length-1;s>0;s--){const n=t[s];if(!isNaN(+n))break;r=r?`${n}-${r}`:n}return r&&r.length<=6?r:void 0}async getRawChaptersData(){if(!this.context?.rawId)return;const{rawId:e,lang:t="en",skip:r}=this.context,s=r?Math.floor(r/1e3)+1:void 0;try{const n=await fetch(`https://api.${location.host}/comic/${e}/chapters?lang=${t}&limit=1000${s&&s>1?`&page=${s}`:""}`),i=re(await n.json());return i?{...i,lang:t,asc:!1}:void 0}catch{return}}};ct(ae,"specId","comick");let ut=ae;function re(a){if(!Array.isArray(a?.chapters))return;const e=[];return a.chapters.forEach(t=>{const{vol:r,chap:s,hid:n,lang:i,updated_at:l}=t,o=typeof s=="string"&&!isNaN(+s)?+s:void 0;typeof o!="number"||e.some(c=>c.vol==r&&c.chap===o&&c.lang===i)||e.push({slug:n,vol:typeof r=="string"&&!isNaN(+r)?+r:void 0,chap:o,lang:i,ts:new Date(l).valueOf()})}),{chapters:k(e),total:a.total??e.length,hasMore:a.total>a.limit}}function se(a,e){const t=a[0]===e?a.substring(1):a;return t[t.length-1]===e?t.substring(0,t.length-1):t}var gt=Object.defineProperty,pt=(a,e,t)=>e in a?gt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ht=(a,e,t)=>(pt(a,typeof e!="symbol"?e+"":e,t),t);class V extends b{async getRawReleasesData(){const e=this.detectNewSiteMeta(this.spec.releases,this.siteMeta);this.siteMeta=e??this.siteMeta;const t=await super.getRawReleasesData();if(t)return{...t,siteMeta:e}}async getRawTitleData(){const e=this.finalizeNewSiteMeta(this.siteMeta,{titleBase:this.extractBasePath(location.pathname)});this.siteMeta=e??this.siteMeta;const t=await super.getRawTitleData();if(t)return{...t,siteMeta:e}}async getRawReaderData(){const e=ne(this.spec.reader?.title);if(!e)return;const t=this.finalizeNewSiteMeta(this.siteMeta,{titleBase:this.extractBasePath(x(e))});this.siteMeta=t??this.siteMeta;const r=await super.getRawReaderData();if(r)return{...r,siteMeta:t}}async getRawSearchData(){const e=ne(this.spec.search?.title);if(!e)return;const t=this.finalizeNewSiteMeta(this.siteMeta,{titleBase:this.extractBasePath(x(e))});this.siteMeta=t??this.siteMeta;const r=await super.getRawSearchData();if(r)return{...r,siteMeta:t}}detectNewSiteMeta(e,t){if(!e)return;const r=e.title,s=document.querySelector(r.sel)??void 0;if(!s)return;const n=x(g(r.url,s));if(n!==void 0)return this.finalizeNewSiteMeta(t,{titleBase:this.extractBasePath(n)})}finalizeNewSiteMeta(e,{titleBase:t}){if(e.titleBase!==t)return{...e,titleBase:t,readerBase:e.readerBase.replace(e.titleBase,t)}}extractBasePath(e){return se(e,"/").split("/").slice(0,-1).join("/")}}ht(V,"specId","madara");function ne(a){if(!a)return;const e=document.querySelector(a.sel);return g(a.url,e)}var dt=Object.defineProperty,ft=(a,e,t)=>e in a?dt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,mt=(a,e,t)=>(ft(a,typeof e!="symbol"?e+"":e,t),t);class ie extends b{async getRawReleasesData(){const e=await this.getVM();if(!e)return super.getRawReleasesData();const t=e.LatestJSON.slice(0,100).map(r=>{const s=+r.Chapter.substring(1)/10;return{slug:r.IndexName,name:r.SeriesName,chapters:[{chap:s,slug:`${r.IndexName}-chapter-${s}.html`,ts:ce(r.Date)}]}});return this.finalizeRawReleasesData({rawReleases:t})}parseTitleSlug(e){const{slug:t}=super.parseTitleSlug(e);return!t||t.includes("{")?{}:{slug:t}}async getRawTitleData(){const e=await super.getRawTitleData();return e&&{...e,chapters:le(await this.getVM(),e.slug),hasMoreChapters:!1}}parseReaderSlug(e,t){const{slug:r,basePath:s}=super.parseReaderSlug(e,t);return{slug:r.replace(/-page-\d{1,3}\.html\/?$/,".html"),basePath:s}}async getRawReaderData(){const e=await this.getVM();if(!e)return;const t=document.querySelector(".ImageGallery img.img-fluid")?.getAttribute("ng-src"),r=e.IndexName,s=oe(e.CurChapter,r);return this.finalizeRawReaderData({chap:s.chap,slug:s.slug,imgs:wt(e,t??void 0),basePath:"/"+this.siteMeta.readerBase.replace("{titleSlug}",r)+"/",title:{name:e.SeriesName,slug:r,url:`/${this.siteMeta.titleBase}/${r}`,chapters:le(e,r),hasMoreChapters:!1}})}getVM(){return P(50,100,()=>window.angular?.element?.(document.documentElement)?.scope()?.vm)}}mt(ie,"specId","manga4life");function le(a,e){return(a?.Chapters??a?.CHAPTERS??[]).sort((t,r)=>r.Chapter-t.Chapter).map(t=>oe(t,e))}function oe(a,e){const t=+a.Chapter[0],r=+a.Chapter.substring(1)/10;return{slug:`${e}-chapter-${r}${t&&t>1?`-index-${t}`:""}.html`,chap:r,ts:ce(a.Date)}}function ce(a){const e=new Date(a).valueOf();return e===e?e:void 0}function wt(a,e){let t=e?.split(".").slice(-1)[0]??"png";t=t.length>=3&&t.length<=4?t:"png";try{const r=a.CurChapter.Chapter.slice(1,-1),s=a.CurChapter.Chapter[a.CurChapter.Chapter.length-1],n=s!=="0"?`${r}.${s}`:r,i=`https://${a.CurPathName}/manga/${a.IndexName}/${a.CurChapter.Directory?`${a.CurChapter.Directory}/`:""}${n}-`;return a.Pages.map(l=>{const o=(l+"").padStart(3,"0");return`${i}${o}.${t}`})}catch{return}}var yt=Object.defineProperty,vt=(a,e,t)=>e in a?yt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,bt=(a,e,t)=>(vt(a,typeof e!="symbol"?e+"":e,t),t);const Rt={a:.1,b:.2,c:.3,d:.4};class ue extends W{parseTitleSlug(e){return{slug:x(e)?.split("/").filter(Boolean)[1]}}async getRawReleasesData(){let e=[];try{e=(await(await fetch("https://api.mangadex.org/chapter?limit=96&offset=0&includes[]=manga&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&order[readableAt]=desc")).json()).data}catch{return}const t=[];return e.forEach(({relationships:r,attributes:s,id:n})=>{const i=r.find(({type:c})=>c==="manga"),l=D(s.volume),o=D(s.chapter);o!==void 0&&t.push({slug:i.id,name:Object.values(i.attributes.title)[0],chapters:[{slug:s.externalUrl||n,vol:l,chap:o,lang:s.translatedLanguage,ts:new Date(s.readableAt).valueOf()}]})}),super.finalizeRawReleasesData({rawReleases:t})}async getRawTitleData(){const e="https://api.mangadex.org/manga/",[t,r]=await Promise.all([j(e,O),j(e,O,"feed")]);if(!t||!r)return;const s=r.value.data?.map?.(l=>{const{attributes:o,id:c}=l;if(typeof o!="object"||typeof c!="string"||!c)return;const{externalUrl:u,title:h,volume:p,chapter:d,translatedLanguage:w}=o;return{slug:u||c,label:h||void 0,vol:D(p),chap:D(d),lang:w||"en",ts:new Date(o.readableAt).valueOf()}}).filter(l=>l?.chap!=null)??[],{data:n}=t.value;if(!n)return;const i=pe({data:n,getTagIdsFromNames:l=>this.getTagIdsFromNames(l)});if(i)return{...i,chapters:k(s),hasMoreChapters:(r.value.total||0)>(r.value.limit||0)}}async getRawReaderData(){const e="https://api.mangadex.org/",[t,r,s]=await Promise.all([j(e,"chapter",O),j(e,"at-home","server",O),j(e,"manga",O,"aggregate")]);if(!t||!r||!s)return;const n=t.value.data,{volume:i,chapter:l,externalUrl:o,translatedLanguage:c}=n.attributes||{},{baseUrl:u,chapter:{data:h,dataSaver:p,hash:d}}=r.value,w=n.relationships?.find?.(R=>R.type==="manga");if(!w)return;const y=pe({data:w,getTagIdsFromNames:R=>this.getTagIdsFromNames(R)});if(!y||typeof s.value.volumes!="object")return;const f=ge(s.value)??[];(typeof l!="string"||l==="none")&&!f.length&&f.push({chap:0,slug:n.id});const v=f.findIndex(R=>R.slug===n.id),m=n.relationships?.find?.(R=>R.type==="scanlation_group"),$=u.endsWith("/")?u:u+"/",I=!!localStorage.getItem("md")?.includes?.('"dataSaver":true'),z=`${$}${I?"data-saver":"data"}/`,_=((I?p:h)??[]).map?.(R=>`${z}${d}/${R}`)??[];return{externalUrl:o,vol:D(i),inferVol:f[v]?.inferVol,chap:D(l)||0,imgs:_,lang:c,slug:n.id,prev:f[v+1],next:f[v-1],basePath:"/chapter/",groupName:m?.attributes?.name,groupUrl:m?.attributes?.website,isWebtoon:w?.attributes?.tags?.some(R=>R.attributes.name.en==="Long Strip"),title:{...y,chapters:f}}}async getRawChaptersData(){if(!this.context)return;const{titleSlug:e,lang:t="en"}=this.context;let r;try{const s=await fetch(`https://api.mangadex.org/manga/${e}/aggregate?translatedLanguage[]=${t}`);r=ge(await s.json())}catch{return}if(r)return{chapters:r,lang:t,asc:!1,hasMore:!1,total:r.length}}}bt(ue,"specId","mangadex");function D(a){if(typeof a!="string"||a==="none")return;const e=parseFloat(a);if(e!==e)return;const t=a[a.length-1];return e+(Rt[t]??0)}function ge(a){if(typeof a.volumes!="object")return;const e=Object.values(a.volumes).map(({volume:t,chapters:r})=>{const s=D(t);return Object.values(r).map(({id:n,chapter:i})=>{const l=D(i);if(l!==void 0)return{vol:s,chap:l,slug:n}})}).flat().filter(Boolean).reverse();return k(e)}function pe({data:a,getTagIdsFromNames:e}){const{id:t,attributes:r,relationships:s}=a;if(!t||typeof t!="string"||typeof r!="object")return;const{title:n,availableTranslatedLanguages:i,altTitles:l,tags:o,contentRating:c}=r;if(typeof n!="object"||i&&!Array.isArray(i))return;const u=Object.values(n)[0];if(!u||typeof u!="string")return;const h=St(),p=(i??[])?.map?.(m=>typeof m=="string"?m:void 0).filter(Boolean)??[],d=p.filter(m=>m&&(!h||h.includes(m))),w=l?.map?.(m=>{const[[,$]=[]]=Object.entries(m);return $}),y=s?.find?.(m=>m.type==="cover_art")?.attributes?.fileName,f=y?`https://uploads.mangadex.org/covers/${t}/${y}.256.jpg`:void 0,v=(o||[]).map(m=>m?.attributes?.name?.en).concat(c).filter(Boolean);return{url:`${location.origin}/title/${t}`,slug:t,name:u,altNames:w,langs:d.length>0?d:p.length>0?p:["en"],img:f,tags:e(v)}}function St(){const a=localStorage.getItem("md");if(a)try{const e=JSON.parse(a)?.userPreferences?.filteredLanguages;return e?.length?e:void 0}catch{return}}var $t=Object.defineProperty,xt=(a,e,t)=>e in a?$t(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ct=(a,e,t)=>(xt(a,typeof e!="symbol"?e+"":e,t),t);class he extends b{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return{...e,rawReleases:e.rawReleases.map(t=>({...t,id:t.id?.split("?")[0]}))}}async getRawReaderData(){if((await C(".current-viewtype",{lazy:!0,all:!1}))?.textContent?.trim().toLowerCase()!=="volume")return await super.getRawReaderData()}async getRawChaptersData(){const e=this.context?.lang;if(!e)return;const t=await C(`.tab-content[data-name="chapter"] a.dropdown-item[data-code="${e.toUpperCase()}"]`,{lazy:!0,all:!1});if(t)return t.click(),await C(`.tab-content[data-name="chapter"] li.item[data-number] a[href*="/${e}/"]`,{lazy:!0,all:!1}),await super.getRawChaptersData()}}Ct(he,"specId","mangafire");var Mt=Object.defineProperty,Dt=(a,e,t)=>e in a?Mt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,It=(a,e,t)=>(Dt(a,typeof e!="symbol"?e+"":e,t),t);class de extends b{async getRawReaderData(){const e=await super.getRawReaderData();return e&&{...e,imgs:await this.getImgs()}}parseReaderSlug(e,t){const{slug:r,basePath:s}=super.parseReaderSlug(e,t),n=r.split("/").filter(Boolean),i=n[n.length-1];return{basePath:s,slug:i.startsWith("pg-")?n.slice(0,-1).join("/"):r}}async getImgs(){const e=await P(100,20,()=>window.imgsrcs),t=window.CryptoJS,r=t.enc.Hex.parse("e11adc3949ba59abbe56e057f20f883e"),s={iv:t.enc.Hex.parse("1234567890abcdef1234567890abcdef"),padding:t.pad.ZeroPadding};return t.AES.decrypt(e,r,s).toString(t.enc.Utf8).split(",")}}It(de,"specId","mangago");var Pt=Object.defineProperty,Tt=(a,e,t)=>e in a?Pt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Nt=(a,e,t)=>(Tt(a,typeof e!="symbol"?e+"":e,t),t);class fe extends b{async getRawTitleData(){const e=await super.getRawTitleData();return e&&{...e,chapters:e.chapters.map(t=>({...t,slug:t.slug?.split("/").filter(Boolean).slice(-1)[0]}))}}}Nt(fe,"specId","mangaplus");var Bt=Object.defineProperty,Ot=(a,e,t)=>e in a?Bt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,jt=(a,e,t)=>(Ot(a,typeof e!="symbol"?e+"":e,t),t);class me extends b{async getRawReleasesData(){const e=await super.getRawReleasesData();if(e)return{...e,rawReleases:e.rawReleases.map(t=>({...t,id:t.slug.substring(t.slug.lastIndexOf("-")+1)||void 0}))}}}jt(me,"specId","mangareader");var Lt=Object.defineProperty,At=(a,e,t)=>e in a?Lt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,kt=(a,e,t)=>(At(a,typeof e!="symbol"?e+"":e,t),t);class we extends V{async getRawReaderData(){const e=await super.getRawReaderData();if(e)return{...e,title:{...e.title,id:await this.getReaderTitleId()}}}async getReaderTitleId(){const e=await window.HISTORY?.getStored?.();if(!e||typeof e!="object")return;const t=Object.values(e).filter(Boolean);if(!t.length)return;t.sort((s,n)=>n.time-s.time);const r=t[0].manga_ID;return typeof r=="string"?r:typeof r=="number"?r+"":void 0}detectNewSiteMeta(e,t){if(!e)return;const r={...t,releases:se(location.pathname,"/")},s=e.title,n=document.querySelector(s.sel)??void 0;if(!n)return;const i=x(g(s.url,n));if(i===void 0)return;const l=n.querySelector(s.chapter.sel)??void 0;if(!(!l||x(g(s.chapter.url,l))===void 0))return r.titleBase=this.extractBasePath(i),t.titleIdType===U.id&&(g(s.id,n)||(t.titleIdType=U.name)),this.finalizeNewSiteMeta(t,r)}finalizeNewSiteMeta(e,t){const r=Object.keys(t),s={...e};let n=!1;return r.forEach(i=>{const l=t[i];l!==e[i]&&(s[i]=l,n=!0)}),n?s:void 0}}kt(we,"specId","mangastream");var zt=Object.defineProperty,_t=(a,e,t)=>e in a?zt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Wt=(a,e,t)=>(_t(a,typeof e!="symbol"?e+"":e,t),t);class ye extends b{async getRawReaderData(){const e=await super.getRawReaderData();if(e)return{...e,title:{...e.title,name:e.title.name.replace("Ritorna a","").trim()}}}}Wt(ye,"specId","mangaworld");var Et=Object.defineProperty,Ut=(a,e,t)=>e in a?Et(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,qt=(a,e,t)=>(Ut(a,typeof e!="symbol"?e+"":e,t),t);class ve extends b{async getRawTitleData(){const e=await super.getRawTitleData();if(e)return{...e,hasMoreChapters:e.chapters.length===50}}}qt(ve,"specId","mgeko");var Ft=Object.defineProperty,Vt=(a,e,t)=>e in a?Ft(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ht=(a,e,t)=>(Vt(a,typeof e!="symbol"?e+"":e,t),t);class be extends b{async getRawTitleData(){const e=await super.getRawTitleData();return e&&{...e,hasMoreChapters:!!H()}}async getRawChaptersData(){const e=await this.getRawTitleData();if(!e)return;const{chapters:t}=e,r={...e,chapters:[]};if(!e.hasMoreChapters)return{chapters:t,title:r,hasMore:e.hasMoreChapters};const s=this.context?.findContinue;if(s){const o=await this.findContinueChapters({rawTitleData:e,chapter:s});return o?{chapters:e.chapters[0]?[e.chapters[0],...o]:o,title:r}:void 0}const n=this.context?.skip,i=t.length,l=n&&n>=i?Math.floor(n/i)+1:void 0;return l?{chapters:await this.getChaptersByPage({page:l,titleSlug:e.slug})??[],title:{...r,chapters:[]},hasMore:!!H(l),asc:!1,skip:n}:{chapters:t,title:r,hasMore:!!H(l)}}async findContinueChapters({rawTitleData:e,chapter:{chap:t},curPage:r=1,cacheChaptersByPage:s={},...n}){const i=s[r]??e.chapters,l=i[i.length-1].chap<=t,o=n.maxPage??Jt();if(l){if(i[0].chap>t){const v=[...i].reverse().find(m=>m.chap>t);return v?[v]:i.slice(0,1)}if(r<=1)return i.slice(0,1)}else if(r===o)return i.slice(-1);const c=e.chapters.length,u=Object.keys(s).map(v=>+v).sort((v,m)=>v-m),h=l?-1:1,p=u[u.indexOf(r)+h];if(p===r+h)return l?s[p].slice(-1).concat(i.slice(0,1)):i.slice(-1).concat(s[p].slice(0,1));const d=l?t-i[0].chap:i[0].chap-t,w=Math.floor(d/c)+1,y=l?Math.max(w,(p??1)+1):Math.min(w,(p??o+1)-1,o),f=await this.getChaptersByPage({page:y,titleSlug:e.slug});if(f)return await this.findContinueChapters({rawTitleData:e,chapter:{chap:t},curPage:y,maxPage:o,cacheChaptersByPage:{...s,1:e.chapters,[y]:f}})}async getChaptersByPage({page:e,titleSlug:t}){const r=Re(e);if(!r)return;const s=this.spec.title.chapter,n=s.sel,i=document.querySelector(n),l=P(100,30,()=>{const o=document.querySelector(n);if(o&&i!==o)return!0;r.click()});return r.click(),await l,await this.getChapters(s,{lazy:!1,titleSlug:t})}}Ht(be,"specId","reaper");function H(a=1){return Re(a+1)}function Re(a){const e=`span[wire\\:key="paginator-page-1-page${a}"] button,button[aria-label="Go to page ${a}"]`;return document.querySelector(e)}function Jt(){const a=Array.from(document.querySelectorAll('span[wire\\:key^="paginator-page-"]'));return a.length?+a[a.length-1].getAttribute("wire:key").split("-").slice(-1)[0].replace("page",""):1}var Gt=Object.defineProperty,Yt=(a,e,t)=>e in a?Gt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Qt=(a,e,t)=>(Yt(a,typeof e!="symbol"?e+"":e,t),t);class Se extends b{async getRawTitleData(){const e=await super.getRawTitleData();if(!e)return;const t=L(".info-detail__row > .genre-btn,.info__right .stats__row:first-child|text")?.map(r=>[r,...r.split(" ")]).flat();return $e({...e,tags:this.getTagIdsFromNames(t)??[]},".episode-header .episode-cnt")}async getRawReaderData(){const e=await super.getRawReaderData();if(!e)return;const t=`${location.origin}/series/${e.title.slug}/info`;return{...e,title:{...$e({...e.title,url:t,tags:[]},".episode-list .js-ep-cnt"),hasMoreChapters:!1}}}async getRawChaptersData(){if(!this.context)return;const{rawId:e,skip:t}=this.context,r=1e3,s=t?Math.floor(t/1e3)+1:1;try{const n=await fetch(`/series/${e}/episodes?page=${s}&sort=NEWEST&max_limit=${r}`);return Zt(await n.json())}catch{return}}parseTitleSlug(e){if(!e)return{};const t=e.split("/").filter(Boolean);return{slug:t[1]??t[0]}}}Qt(Se,"specId","tapas");function $e(a,e){const t=Kt(e)>20;return{...a,chapters:t?[]:a.chapters,hasMoreChapters:t}}function Zt(a){const e=a?.data?.episodes;if(!Array.isArray(e))return;const t=e.map(s=>({chap:s.pending_scene??s.scene,slug:s.id+"",ts:new Date(s.publish_date)?.valueOf?.()||void 0})),r=a?.data?.pagination;return{chapters:t,total:r?.total??t.length,hasMore:!!r?.has_next}}function Kt(a){return+(document.querySelector(a)?.textContent?.trim().split(" ")[0]||0)}var Xt=Object.defineProperty,ea=(a,e,t)=>e in a?Xt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ta=(a,e,t)=>(ea(a,typeof e!="symbol"?e+"":e,t),t);class xe extends b{async getRawTitleData(){const e=new URLSearchParams(location.search),t=e.get("episode_no"),r=e.get("title_no");if(t||!r)return;const s=await super.getRawTitleData();if(!s)return;const n=location.pathname.split("/")[1];return{...s,slug:`${s.slug}?title_no=${r}`,id:r,langs:[n].filter(Boolean),chapters:s.chapters.map(i=>({...i,lang:n})),hasMoreChapters:(document.querySelector(".paginate")?.childElementCount??1)>1}}async getRawReaderData(){const e=new URLSearchParams(location.search),t=e.get("episode_no"),r=e.get("title_no");if(!t||!r)return;const s=A(g(".paginate > span:not(:first-child)|text"));if(s===void 0)return;const{chap:n}=s,i=document.title.split("|")[1]?.trim();if(!i)return;const l=location.pathname.split("/"),o=`${l.slice(0,4).join("/")}/list?title_no=${r}`,c=await this.getChapters({sel:"#sequence_scroll li.eg-flick-panel,#toolbar .episode_lst li[data-episode-no]",url:"a|attr:href",label:"|attr:data-episode-no || .num|text"},{lazy:!1,titleId:r,titleSlug:o}),u=l[1];return{chap:n,lang:u,slug:`${location.pathname}?title_no=${r}&episode_no=${t}`,basePath:"",imgs:await this.getReaderImgs(),isWebtoon:!0,title:{id:r,url:o,slug:o,name:i,langs:[u],chapters:(c??[]).map(h=>({...h,lang:u})),hasMoreChapters:!1}}}async getReaderImgs(){const e=L("#_imageList img|[attr:data-url,attr:src]");return e?.length?e:await P(100,50,()=>window.__viewerState__?.scrollViewerParam?.imageList?.map(({url:t})=>t).filter(Boolean))}parseReaderSlug(e,t,r){if(!r)return{basePath:"",slug:t};if(r.startsWith("http://")||r.startsWith("https://")){const s=E(r);return{basePath:"",slug:s.pathname+s.search}}return{basePath:"",slug:r}}}ta(xe,"specId","webtoon");const aa=[te,ut,V,ie,ue,he,de,fe,me,we,ye,ve,be,Se,xe];function Ce(a){const e=aa.find(t=>t.specId===a.spec.id)??b;return new e(a)}async function ra(a){const{spec:e}=a;if(e){const t=a.siteMeta??e.meta,r=a.type?[a.type]:Me(t,e.generic);if(!r.length)return;const s=Ce({...a,spec:e,siteMeta:t});return await N(r.map(n=>s.getRawPageByType(n,r.length>1)))}return await N((a.genericSpecs??[]).map(t=>{const r=Me(t.meta,t.generic);if(!r.length)return[];const s=Ce({...a,spec:t,siteMeta:t.meta});return r.map(n=>s.getRawPageByType(n,!0))}).flat())}function Me(a,e){if(location.pathname==="/")return[];const{titleBase:t,readerBase:r}=a,s=location.pathname.split("/").filter(Boolean),n=De(s,r),i=De(s,t);if(n&&i)return[S.reader,S.title];const l=[];return n!==!1&&!i&&l.push(S.reader),i!==!1&&!n&&l.push(S.title),!l.length&&e?[S.reader,S.title]:l}function De(a,e){if(!e)return;const t=e.split("/").filter(Boolean),r=t.indexOf("{slug}"),s=r===t.length-1,n=!s&&r!==-1;if(s&&(t.pop(),!t.length))return;const i=a.length-t.length;if(n?i<0:i<=0)return!1;let l=!1;for(let o=0;o<t.length;o++){const c=t[o];if(c[0]!=="{"){if(c!==a[o])return!1;l=!0}}if(l&&i===(n?0:1))return!0}T.PageType=S,T.scrape=ra});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trackkun-dom",
3
3
  "author": "endyquang",
4
- "version": "1.5.2",
4
+ "version": "1.5.3",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Trkun DOM parser",
7
7
  "main": "index.js",