"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[217],{93491:function(e,t,a){a.d(t,{Z:function(){return f},V:function(){return u}});var n=a(57437),o=a(2265),r={src:"/_next/static/media/logo.04509a64.png"};let i=!1,l="",c=null,s=e=>e?/^https?:\/\//i.test(e)?e:"".concat("https://admin.4thdimensionpartners.com/storage/").concat(e.replace(/^\/+/,"")):"",d=async()=>i?l:(c||(c=fetch("/api/domain",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{var t;return s(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.image)}).catch(()=>"").then(e=>(l=e,i=!0,e))),c),u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.src,[t,a]=(0,o.useState)(e);return(0,o.useEffect)(()=>{let e=!0;return d().then(t=>{e&&t&&a(t)}),()=>{e=!1}},[]),{src:t,fallbackSrc:e,setSrc:a}};var f=e=>{let{fallbackSrc:t=r.src,alt:a="logo",onError:o,...i}=e,{src:l,setSrc:c}=u(t);return(0,n.jsx)("img",{...i,src:l,alt:a,onError:e=>{c(t),null==o||o(e)}})}},45015:function(e,t,a){a.d(t,{J:function(){return i}});var n=a(57437);a(2265);var o=a(84447),r=a(10875);let i=e=>{let{variant:t="default",sizeType:a="defaultSize",className:i,children:l,onClick:c,disabled:s,type:d="button",...u}=e,f=(0,r.Z)("inline-flex items-center justify-center text-center transition",t,a,i,{"rounded bg-[#313231] text-white text-base font-medium":"default"===t,"rounded bg-transparent border-[1px] border-black/[0.4] hover:bg-black/[0.04] text-black/[0.4] text-base font-medium":"border"===t,"rounded bg-transparent border-[1px] border-black/[0.4] hover:bg-black/[0.04] text-black/[0.4] text-base font-medium dark:border-white dark:text-white dark:hover:border-white/[0.4]":"border-theme"===t,"rounded bg-gradient-to-r from-yellow-400 to-yellow-500 text-white text-base font-medium":"secondary"===t,"rounded bg-[#679f38] text-white text-base font-medium":"green"===t,"rounded bg-[#e6e6e6] text-base font-medium":"gray"===t,"rounded bg-[#b0b0b0] text-base font-medium":"disable"===t,"h-9 px-4":"defaultSize"===a,"h-8 px-3 text-sm":"sm"===a,"h-10 px-8":"lg"===a,"h-12 w-11 text-lg":"icon"===a,"h-8 px-2 text-xs font-normal":"xs"===a,"opacity-60 pointer-events-none":s});return(0,n.jsx)(o.A,{"data-hover":"false",className:f,onClick:c,disabled:s,type:d,...u,children:l})};i.displayName="CommonButton"},39239:function(e,t,a){a.d(t,{YoutubeProvider:function(){return c},h:function(){return l}});var n=a(57437),o=a(2265),r=a(16463),i=a(38472);let l=(0,o.createContext)({loading:!1,setLoading:()=>{},searchResult:[],selectedType:"",setSelectedType:()=>{},selectedCategory:{id:0,name:"New"},setSelectedCategory:()=>{},mobileMenu:!0,setMobileMenu:()=>{},subcategories:{},setSubcategories:()=>{},addPlaylist:!1,setAddPlaylist:()=>{},playlist:null,setPlaylist:()=>{},token:"",setToken:()=>{},userData:{},setUserData:()=>{}}),c=e=>{let{children:t}=e,[a,c]=(0,o.useState)(!1),[s,d]=(0,o.useState)([]),[u,f]=(0,o.useState)({name:"New"}),[p,g]=(0,o.useState)(""),[m,y]=(0,o.useState)(!1),[b,h]=(0,o.useState)({}),[v,S]=(0,o.useState)(!1),[x,w]=(0,o.useState)(null),k=(0,r.usePathname)(),[I,_]=(0,o.useState)(""),[j,A]=(0,o.useState)({});return(0,o.useEffect)(()=>{(async()=>{try{let e="/api/categories";x&&(e="/api/playlists/".concat(x.id,"/categories"));let t=await fetch(e),a=await t.json();h(a.categories);let n=k.replace(/^\/|\/$/g,"").split("/"),o=a.categories[n[0]];if(n.length&&o){g(n[0]);let e=o.findIndex(e=>e.category_id===parseInt(n[1]));f({id:o[e].category_id,name:o[e].category})}}catch(e){console.error("Error fetching subcategories:",e)}})()},[x]),(0,o.useEffect)(()=>{j.id||(async()=>{let e=localStorage.getItem("userData"),t=localStorage.getItem("userToken");if(e&&t===I){A(JSON.parse(e));return}if(I)try{let e=await fetch("/api/verifytoken",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(I)}});if(e.ok){let t=await e.json();A(t),localStorage.setItem("userData",JSON.stringify(t)),localStorage.setItem("userToken",I)}else console.error("Failed to fetch user data"),localStorage.removeItem("userData"),localStorage.removeItem("userToken")}catch(e){console.error("Error fetching user data:",e),localStorage.removeItem("userData"),localStorage.removeItem("userToken")}})()},[I,j.id]),(0,o.useEffect)(()=>{let e=localStorage.getItem("userToken")||function(e){if("undefined"==typeof document)return"";let t=document.cookie.split("; ").find(t=>t.startsWith("".concat(encodeURIComponent(e),"=")));return t?decodeURIComponent(t.split("=").slice(1).join("=")):""}("token");e&&_(e)},[]),(0,o.useEffect)(()=>{let e=async()=>{let e=window.location.href.match(/playlists\/(\d+)/);if(e&&e[1]){let a=e[1];try{var t;let e=I?await i.Z.get("/api/playlists/".concat(a,"/info"),{headers:{Authorization:"Bearer ".concat(I)}}):await i.Z.get("/api/public-playlists?id=".concat(a));if(w(e.data.playlist),localStorage.setItem("selectedPlaylistId","".concat(e.data.playlist.id)),(null===(t=e.data.playlist)||void 0===t?void 0:t.source)==="web"&&e.data.playlist.editKey){let t=JSON.parse(localStorage.getItem("publicPlaylistIds")||"[]");localStorage.setItem("publicPlaylistIds",JSON.stringify(Array.from(new Set([...t,e.data.playlist.id]))));let a=JSON.parse(localStorage.getItem("publicPlaylistKeys")||"{}");localStorage.setItem("publicPlaylistKeys",JSON.stringify({...a,[e.data.playlist.id]:e.data.playlist.editKey}))}}catch(e){console.error("Error fetching playlist:",e)}}};x||e()},[I]),(0,n.jsx)(l.Provider,{value:{loading:a,setLoading:c,searchResult:s,selectedType:p,setSelectedType:g,selectedCategory:u,setSelectedCategory:f,mobileMenu:m,setMobileMenu:y,subcategories:b,setSubcategories:h,addPlaylist:v,setAddPlaylist:S,playlist:x,setPlaylist:w,token:I,setToken:_,userData:j,setUserData:A},children:t})}},99391:function(e,t,a){a.d(t,{_5:function(){return o},d8:function(){return r}}),a(74590);var n=a(58064),o=(0,n.$)("05e7335f660005ad40b9ee04b9b9bcc5786841a2"),r=(0,n.$)("54e3ab55c5954ace9bccbefe6191fd1e609b93e0");(0,n.$)("cc6c51b64d1100f014bc4c28bf6f71530433e0ff")},39303:function(e,t,a){a.d(t,{Jh:function(){return l},Te:function(){return s},jv:function(){return r},lV:function(){return o},mn:function(){return i},p6:function(){return n}});let n=e=>{let t=new Date(e);return t?t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):""},o=e=>e.toString().toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w-]+/g,""),r=e=>!!RegExp("^(https?:\\/\\/)?((([a-zA-Z0-9-]+)\\.)+[a-zA-Z]{2,})(\\:\\d+)?(\\/[-a-zA-Z0-9@:%._\\+~#=]*)*(\\?[;&a-zA-Z0-9%_.~+=-]*)?(\\#[-a-zA-Z0-9_]*)?$","i").test(e);function i(e){return e?s(e):"/"}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2?arguments[2]:void 0,n="";if("series"!==e.type||t)n=a&&t?"series/".concat(a.id,"_").concat(e.id,"/").concat(o(e.name)):"".concat(e.type?e.type:"series","/").concat(e.id,"/").concat(o(e.name));else{var r;let t=e.seasons,a=t&&"object"==typeof t?Object.values(t).find(e=>Array.isArray(null==e?void 0:e.episodes)&&e.episodes.length>0):void 0,i=null==a?void 0:null===(r=a.episodes)||void 0===r?void 0:r[0];n=i?"series/".concat(i.id,"/").concat(o(e.name)):"series/".concat(e.id,"/").concat(o(e.name))}return(null==t?void 0:t.id)?c(t)+"/playlists/".concat(t.id,"/").concat(n):"/videos/".concat(n)}function c(e){return e.serverInfo.server_protocol+"://"+window.location.host}function s(e){return"".concat(c(e),"/playlists/").concat(e.id,"/").concat(o(e.name))}}}]);