"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__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={};function superVideoExtractor(data){return __async(this,null,function*(){var _a,_b;try{var match=/eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/.exec(data);let p="";if(match){var encodedString=match[2];p=null==(_a=encodedString.split("',36,"))?void 0:_a[0].trim();let a=36,c=encodedString.split("',36,")[1].slice(2).split("|").length,k=encodedString.split("',36,")[1].slice(2).split("|");for(;c--;)if(k[c]){var regex=new RegExp("\\b"+c.toString(a)+"\\b","g");p=p.replace(regex,k[c])}}else console.log("No match found");const streamUrl=null==(_b=null==p?void 0:p.match(/file:\s*"([^"]+\.m3u8[^"]*)"/))?void 0:_b[1];return console.log("streamUrl:",streamUrl),streamUrl||""}catch(err){return console.error("SuperVideoExtractor Error:",err),""}})}__export(stream_exports,{getStream:()=>getStream}),__name(superVideoExtractor,"superVideoExtractor");var getStream=__name(function(_0){return __async(this,arguments,function*({link:id,type:type,providerContext:providerContext}){try{const{axios:axios,cheerio:cheerio,commonHeaders:commonHeaders}=providerContext;function ExtractGuardahd(_02){return __async(this,arguments,function*({imdb:imdb}){try{const url="https://guardahd.stream/set-movie-a/"+imdb;console.log("url:",url);const html=(yield axios.get(url,{timeout:4e3})).data,superVideoUrl=cheerio.load(html)('li:contains("supervideo")').attr("data-link");if(console.log("superVideoUrl:",superVideoUrl),!superVideoUrl)return null;const controller2=new AbortController,signal2=controller2.signal;setTimeout(()=>controller2.abort(),4e3);const res2=yield fetch("https:"+superVideoUrl,{signal:signal2,headers:__spreadValues({},commonHeaders)}),data=yield res2.text();console.log("mostraguarda data:",data);const streamUrl=yield superVideoExtractor(data);return console.log("superStreamUrl:",streamUrl),streamUrl}catch(err){console.error("Error in GetMostraguardaStram:",err)}})}function GetMostraguardaStream(_02){return __async(this,arguments,function*({imdb:imdb,type:type2,season:season2,episode:episode2}){try{const url="https://mostraguarda.stream"+("tv"===type2?`/serie/${imdb}/${season2}/${episode2}`:`/movie/${imdb}`);console.log("url:",url);const html=(yield axios(url,{timeout:4e3})).data,superVideoUrl=cheerio.load(html)('li:contains("supervideo")').attr("data-link");if(!superVideoUrl)return null;const controller2=new AbortController,signal2=controller2.signal;setTimeout(()=>controller2.abort(),4e3);const res2=yield fetch("https:"+superVideoUrl,{signal:signal2,headers:__spreadValues({},commonHeaders)}),data=yield res2.text();return yield superVideoExtractor(data)}catch(err){console.error("Error in GetMostraguardaStram:",err)}})}__name(ExtractGuardahd,"ExtractGuardahd"),__name(GetMostraguardaStream,"GetMostraguardaStream"),console.log(id);const streams=[],[imdbId,season,episode]=id.split("-");console.log("Parsed ID:",{imdbId:imdbId,season:season,episode:episode}),console.log("imdbId:",imdbId);const mostraguardaStream=yield GetMostraguardaStream({imdb:imdbId,type:type,season:season,episode:episode});mostraguardaStream&&streams.push({server:"Supervideo 1",link:mostraguardaStream,type:"m3u8"});const guardahdStream=yield ExtractGuardahd({imdb:imdbId,type:type,season:season,episode:episode});return guardahdStream&&streams.push({server:"Supervideo 2",link:guardahdStream,type:"m3u8"}),streams}catch(err){return console.error(err),[]}})},"getStream");exports.getStream=getStream;