"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(target,value)=>__defProp(target,"name",{value:value,configurable:!0}),__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),__async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())}),stream_exports={};__export(stream_exports,{getStream:()=>getStream});var getStream=__name(function(_0){return __async(this,arguments,function*({link:id,providerContext:providerContext}){try{const{getBaseUrl:getBaseUrl,axios:axios}=providerContext,baseUrl=yield getBaseUrl("consumet"),servers=["vidcloud","vidstreaming"],url=`${baseUrl}/anime/zoro/watch?episodeId=${id}&server=`,streamLinks=[];return yield Promise.all(servers.map(server=>__async(null,null,function*(){var _a,_b;try{const res=yield axios.get(url+server);if(res.data){const subtitles=[];null==(_a=res.data)||_a.subtitles.forEach(sub=>{var _a2,_b2;"Thumbnails"!==(null==sub?void 0:sub.lang)&&subtitles.push({language:(null==(_a2=null==sub?void 0:sub.lang)?void 0:_a2.slice(0,2))||"Und",uri:null==sub?void 0:sub.url,title:(null==sub?void 0:sub.lang)||"Undefined",type:(null==(_b2=null==sub?void 0:sub.url)?void 0:_b2.endsWith(".vtt"))?"text/vtt":"application/x-subrip"})}),null==(_b=res.data)||_b.sources.forEach(source=>{streamLinks.push({server:server,link:null==source?void 0:source.url,type:(null==source?void 0:source.isM3U8)?"m3u8":"mp4",headers:{Referer:"https://megacloud.club/",Origin:"https://megacloud.club"},subtitles:subtitles})})}}catch(e){console.log(e)}}))),streamLinks}catch(err){return console.error(err),[]}})},"getStream");exports.getStream=getStream;