"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,{mpGetStream:()=>mpGetStream});var mpGetStream=__name(function(_0){return __async(this,arguments,function*({link:id,type:type,providerContext:providerContext}){var _a,_b;try{const{getBaseUrl:getBaseUrl,cheerio:cheerio}=providerContext,streams=[],{season:season,episode:episode,tmdbId:tmdbId}=JSON.parse(id),baseUrl=yield getBaseUrl("moviesapi"),link="movie"===type?`${baseUrl}/movie/${tmdbId}`:`${baseUrl}/tv/${tmdbId}-${season}-${episode}`,res=yield fetch(link,{headers:{referer:baseUrl}}),baseData=yield res.text(),embededUrl=cheerio.load(baseData)("iframe").attr("src")||"",response=yield fetch(embededUrl,{credentials:"omit",headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8","Accept-Language":"en-US,en;q=0.5","Alt-Used":"w1.moviesapi.club","Upgrade-Insecure-Requests":"1","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1",Pragma:"no-cache","Cache-Control":"no-cache",referer:baseUrl},referrer:baseUrl,method:"GET",mode:"cors"}),contents=(null==(_a=(yield response.text()).match(/const\s+Encrypted\s*=\s*['"]({.*})['"]/))?void 0:_a[1])||"";if(embededUrl){const res2=yield fetch("https://ext.8man.me/api/decrypt?passphrase==JV[t}{trEV=Ilh5",{method:"POST",body:contents}),finalData=yield res2.json(),subtitle=null==(_b=null==finalData?void 0:finalData.subtitles)?void 0:_b.map(sub=>{var _a2;return{title:(null==sub?void 0:sub.label)||"Unknown",language:null==sub?void 0:sub.label,type:(null==(_a2=null==sub?void 0:sub.file)?void 0:_a2.includes(".vtt"))?"text/vtt":"application/x-subrip",uri:null==sub?void 0:sub.file}});streams.push({server:"vidstreaming ",type:"m3u8",subtitles:subtitle,link:null==finalData?void 0:finalData.videoUrl,headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",Referer:baseUrl,Origin:baseUrl,Accept:"*/*","Accept-Language":"en-US,en;q=0.5","Sec-Fetch-Dest":"empty","Sec-Fetch-Mode":"cors","Sec-Fetch-Site":"cross-site",Pragma:"no-cache","Cache-Control":"no-cache"}})}return streams}catch(err){return console.error(err),[]}})},"mpGetStream");exports.mpGetStream=mpGetStream;