PageSourceSearch

https://tubechef.ai/_next/static/chunks/8624-b210e2c52d1a622d.js

js tubechef.ai collected 2026-10-05 15:55:40 UTC 9,828 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8624],{63405:function(e,t,r){r.d(t,{x1:function(){return o},zG:function(){return c}});var i=r(80974),s=r(25057),n=r(18395);class a{async getAuthToken(){try{return await i.O.getToken()}catch(e){return console.warn("Failed to get auth token:",e),null}}async refreshAuthToken(){try{return i.O.clearTokenCache(),await i.O.getToken()}catch(e){return console.error("[ApiClient] Token refresh failed:",e),null}}async makeRequest(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6?arguments[6]:void 0,u=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,l=e.startsWith("/")?e:"/".concat(e),h="".concat(u).concat(l),d=r?await this.getAuthToken():null,p={...t,headers:{...(0,s.NU)(d),...t.headers}},E=null!=c?c:this.defaultTimeout,v=new AbortController,f=setTimeout(()=>v.abort("Request timed out after ".concat(E,"ms")),E);p.signal=v.signal;try{let s=await fetch(h,p);if(clearTimeout(f),!s.ok){let n=await this.handleErrorResponse(s);if(401===s.status&&r&&!o){if(await this.refreshAuthToken())return this.makeRequest(e,t,r,i,a,!0,c);{let e=encodeURIComponent(window.location.pathname+window.location.search);window.location.href="/login?redirect=".concat(e)}}throw n}if(204===s.status)return{success:!0,data:null};let n=null,u=await s.text();if(u)try{n=JSON.parse(u)}catch(e){n=u}return{success:!0,data:n}}catch(l){var T;if(clearTimeout(f),l instanceof n.M&&void 0!==l.status&&l.status>=400&&l.status<500&&429!==l.status)throw l;let s=l instanceof Error?l.message.toLowerCase():"";if((s.includes("failed to fetch")||s.includes("cors")||s.includes("network"))&&i>=1)throw new n.M("CORS error: Unable to connect to API. Please check if the API server is running.",void 0,0);let u=(null===(T=t.method)||void 0===T?void 0:T.toUpperCase())||"GET";if(("GET"===u||a)&&i<this.retryAttempts){let s=Math.min(2e3*Math.pow(2,i)+1e3*Math.random(),3e4);return console.warn("".concat(u," request failed, retrying in ").concat(Math.round(s),"ms (attempt ").concat(i+1,"/").concat(this.retryAttempts,")").concat(a&&"GET"!==u?" (retry explicitly allowed)":"")),await new Promise(e=>setTimeout(e,s)),this.makeRequest(e,t,r,i+1,a,o,c)}if(l instanceof n.M)throw l;throw new n.M(l instanceof Error?l.message:"Network error occurred",void 0,0)}}async handleErrorResponse(e){let t,r;try{t=await e.json()}catch(t){return new n.M("Request failed with status ".concat(e.status),void 0,e.status)}let i="An error occurred";return"string"==typeof t?i=t:t.message?(i=t.message,r=t.errors):t.error?i=t.error:t.errors&&Array.isArray(t.errors)&&(i=(r=t.errors)[0]||i),new n.M(i,r,e.status)}async get(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return this.makeRequest(e,{method:"GET"},t,0,!1)}async post(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0;return this.makeRequest(e,{method:"POST",body:t?JSON.stringify(t):void 0},r,0,i,!1,s)}async put(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.makeRequest(e,{method:"PUT",body:t?JSON.stringify(t):void 0},r,0,i)}async delete(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.makeRequest(e,{method:"DELETE",body:t?JSON.stringify(t):void 0},r,0,i)}async patch(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.makeRequest(e,{method:"PATCH",body:t?JSON.stringify(t):void 0},r,0,i)}async uploadFile(e,t,r){let i=await this.getAuthToken(),a=new FormData;a.append("audioFile",t),r&&Object.entries(r).forEach(e=>{let[t,r]=e;a.append(t,r)}
1);let o=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,c=e.startsWith("/")?e:"/".concat(e),u="".concat(o).concat(c),l={method:"POST",headers:(0,s.Ax)(i),body:a},h=new AbortController,d=setTimeout(()=>h.abort(),3*this.defaultTimeout);l.signal=h.signal;try{let e=await fetch(u,l);if(clearTimeout(d),!e.ok)throw await this.handleErrorResponse(e);if(204===e.status)return{success:!0,data:null};let t=null,r=await e.text();if(r)try{t=JSON.parse(r)}catch(e){t=r}return{success:!0,data:t}}catch(e){if(clearTimeout(d),e instanceof n.M)throw e;throw new n.M(e instanceof Error?e.message:"Upload failed",void 0,0)}}constructor(){this.baseUrl=s.Hz.BASE_URL,this.defaultTimeout=s.Hz.TIMEOUT,this.retryAttempts=s.Hz.RETRY_ATTEMPTS}}let o=new a;function c(e){return e instanceof n.M?{message:e.message,errors:e.errors}:e instanceof Error?{message:e.message}:{message:"An unexpected error occurred"}}},25057:function(e,t,r){r.d(t,{Ax:function(){return n},Hz:function(){return i},NU:function(){return s}});let i={BASE_URL:"https://webapi.tubechef.ai/",API_VERSION:"v1",ENDPOINTS:{AUDIO:{VOICES:"/api/v1/audio/voices",CHANNEL_VIDEOS:"/api/v1/audio/channels",GENERATE:"/api/v1/audio/generate",GENERATE_BATCH:"/api/v1/audio/generate-batch",GENERATED:"/api/v1/audio/generated"},CHANNEL:{BASE:"/api/v1/channel",UPDATE_NAME:"/update-name",UPDATE_CONFIG:"/update-configuration",UPLOAD_AUDIO:"/upload-audio",REMOVE_AUDIO:"/remove-audio"},PROFILE_GENERATOR:{BASE:"/api/v1/profilegenerator",GENERATE:"/api/v1/profilegenerator/generate"},TUBECHEF:{HOME:"/api/v1/tubechef",CONTACT:"/api/v1/tubechef/contact",TERMS:"/api/v1/tubechef/terms",PRIVACY:"/api/v1/tubechef/privacy"},USER:{PROFILE:"/api/v1/user/profile",CREDITS:"/api/v1/user/credits",TRANSACTIONS:"/api/v1/user/transactions"},PAYMENTS:{PRICING:"/api/v1/payments/pricing",REFILL:"/api/v1/payments/refill",SUCCESS:"/api/v1/payments/success",CANCEL:"/api/v1/payments/cancel"},DISCORD:{AUTH_URL:"/api/v1/Discord/auth-url",CALLBACK:"/api/v1/Discord/callback",LINK:"/api/v1/Discord/link"},PRICING:{GET_COSTS:"/api/v1/pricing/get-costs"},IMAGES:"/api/v1/images",SCRIPT:"/api/v1/script",LIBRARY:"/api/v1/library",RIPPER:"/api/v1/ripper",SUGGESTION:"/api/v1/suggestion",VIDEO:"/api/v1/video",VIDEO_V2:"/api/v2/video",ACCOUNT:"/api/v1/account",ASSETS:"/api/v1/assets",UPLOAD:{INITIATE:"/api/v1/upload/initiate",COMPLETE:e=>"/api/v1/upload/complete/".concat(e),COMPLETE_BATCH:"/api/v1/upload/complete/batch",FAILED:e=>"/api/v1/upload/failed/".concat(e),STATUS:e=>"/api/v1/upload/status/".concat(e)}},TIMEOUT:1e4,UPLOAD_TIMEOUT:6e4,RETRY_ATTEMPTS:3},s=e=>{let t={"Content-Type":"application/json",Accept:"application/json"};return e&&(t.Authorization="Bearer ".concat(e)),t},n=e=>{let t={Accept:"application/json"};return e&&(t.Authorization="Bearer ".concat(e)),t}},18395:function(e,t,r){r.d(t,{M:function(){return i}});
1class i extends Error{constructor(e,t,r,i){super(e),this.name="ApiError",this.errors=t,this.status=r,this.code=i}}},80974:function(e,t,r){r.d(t,{O:function(){return n}});var i=r(10970);class s{static getInstance(){return s.instance||(s.instance=new s),s.instance}setupAuthListener(){this.supabase.auth.onAuthStateChange((e,t)=>{var r;let i=null!==(r=null==t?void 0:t.user)&&void 0!==r?r:null;this.currentUser=i,t?(this.cachedToken=t.access_token,this.tokenExpiresAt=t.expires_at?1e3*t.expires_at:0):(this.cachedToken=null,this.tokenExpiresAt=0),this.listeners.forEach(e=>e(i))})}async getUser(){if(this.currentUser)return this.currentUser;if(this.loadingPromise)return this.loadingPromise;this.loadingPromise=this.doGetUser();try{let e=await this.loadingPromise;return this.currentUser=e,this.initialized=!0,e}finally{this.loadingPromise=null}}async doGetUser(){try{let{data:{user:e},error:t}=await this.supabase.auth.getUser();if(t)return console.error("[AuthService] Error fetching user:",t),null;return e}catch(e){return console.error("[AuthService] Error in doGetUser:",e),null}}async getSession(){try{let{data:{session:e},error:t}=await this.supabase.auth.getSession();if(t)throw t;return e}catch(e){return console.error("[AuthService] Error getting session:",e),null}}async getToken(){let e=Date.now();if(this.cachedToken&&this.tokenExpiresAt>e+6e4)return this.cachedToken;
1let t=await this.getSession();return t?(this.cachedToken=t.access_token,this.tokenExpiresAt=t.expires_at?1e3*t.expires_at:0):(this.cachedToken=null,this.tokenExpiresAt=0),this.cachedToken}clearTokenCache(){this.cachedToken=null,this.tokenExpiresAt=0}async signOut(){try{let{error:e}=await this.supabase.auth.signOut();if(e)throw e;return this.currentUser=null,{success:!0}}catch(e){return console.error("[AuthService] Error signing out:",e),{success:!1,error:e}}}subscribe(e){return this.listeners.add(e),this.initialized&&void 0!==this.currentUser&&e(this.currentUser),()=>{this.listeners.delete(e)}}getCurrentUser(){return this.currentUser}isInitialized(){return this.initialized}constructor(){this.supabase=(0,i.e)(),this.currentUser=null,this.loadingPromise=null,this.listeners=new Set,this.initialized=!1,this.cachedToken=null,this.tokenExpiresAt=0,this.setupAuthListener()}}window.__authService||(window.__authService=s.getInstance());let n=window.__authService||s.getInstance()},10970:function(e,t,r){r.d(t,{e:function(){return n}});var i=r(80733);let s=null;function n(){return s||(s=(0,i.createBrowserClient)("https://falewcidghbhhqymldku.supabase.co","sb_publishable_A1yREJZJR5smMSfrQvIb1Q_w2HhxqQQ",{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}))}},94508:function(e,t,r){r.d(t,{cn:function(){return n}});var i=r(61994),s=r(53335);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.m6)((0,i.W)(t))}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.