const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FeaturedPlaylists-CSpE8ynS.js","assets/ui-vendor-BiK-nlin.js","assets/react-vendor-B-2u-D-a.js","assets/FAQSection-DcHK2fun.js","assets/AdditionalInfoSection-dqJvne_B.js"])))=>i.map(i=>d[i]); var Dn=Object.defineProperty;var Ln=(t,e,a)=>e in t?Dn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var te=(t,e,a)=>Ln(t,typeof e!="symbol"?e+"":e,a);import{j as s}from"./ui-vendor-BiK-nlin.js";import{a as Er,g as Ut,r as b,R as be,b as Nr,c as ee,L as I,u as Mt,d as Re,e as Ar,f as Bt,h as Un,i as Y,N as Mn,B as Bn}from"./react-vendor-B-2u-D-a.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(n){if(n.ep)return;n.ep=!0;const o=a(n);fetch(n.href,o)}})();var Pr,Ja=Er;Pr=Ja.createRoot,Ja.hydrateRoot;var Fn=typeof Element<"u",Wn=typeof Map=="function",Hn=typeof Set=="function",qn=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function St(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var a,r,n;if(Array.isArray(t)){if(a=t.length,a!=e.length)return!1;for(r=a;r--!==0;)if(!St(t[r],e[r]))return!1;return!0}var o;if(Wn&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(o=t.entries();!(r=o.next()).done;)if(!e.has(r.value[0]))return!1;for(o=t.entries();!(r=o.next()).done;)if(!St(r.value[1],e.get(r.value[0])))return!1;return!0}if(Hn&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(o=t.entries();!(r=o.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(qn&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(a=t.length,a!=e.length)return!1;for(r=a;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(n=Object.keys(t),a=n.length,a!==Object.keys(e).length)return!1;for(r=a;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[r]))return!1;if(Fn&&t instanceof Element)return!1;for(r=a;r--!==0;)if(!((n[r]==="_owner"||n[r]==="__v"||n[r]==="__o")&&t.$$typeof)&&!St(t[n[r]],e[n[r]]))return!1;return!0}return t!==t&&e!==e}var Gn=function(e,a){try{return St(e,a)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const zn=Ut(Gn);var Kn=function(t,e,a,r,n,o,i,l){if(!t){var c;if(e===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[a,r,n,o,i,l],u=0;c=new Error(e.replace(/%s/g,function(){return d[u++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},Jn=Kn;const Ya=Ut(Jn);var Yn=function(e,a,r,n){var o=r?r.call(n,e,a):void 0;if(o!==void 0)return!!o;if(e===a)return!0;if(typeof e!="object"||!e||typeof a!="object"||!a)return!1;var i=Object.keys(e),l=Object.keys(a);if(i.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(a),d=0;d<i.length;d++){var u=i[d];if(!c(u))return!1;var h=e[u],p=a[u];if(o=r?r.call(n,h,p,u):void 0,o===!1||o===void 0&&h!==p)return!1}return!0};const Vn=Ut(Yn);var Or=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(Or||{}),Vt={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},Va=Object.values(Or),Da={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Zn=Object.entries(Da).reduce((t,[e,a])=>(t[a]=e,t),{}),ne="data-rh",ze={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Ke=(t,e)=>{for(let a=t.length-1;a>=0;a-=1){const r=t[a];if(Object.prototype.hasOwnProperty.call(r,e))return r[e]}return null},Qn=t=>{let e=Ke(t,"title");const a=Ke(t,ze.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),a&&e)return a.replace(/%s/g,()=>e);const r=Ke(t,ze.DEFAULT_TITLE);return e||r||void 0},Xn=t=>Ke(t,ze.ON_CHANGE_CLIENT_STATE)||(()=>{}),Zt=(t,e)=>e.filter(a=>typeof a[t]<"u").map(a=>a[t]).reduce((a,r)=>({...a,...r}),{}),es=(t,e)=>e.filter(a=>typeof a.base<"u").map(a=>a.base).reverse().reduce((a,r)=>{if(!a.length){const n=Object.keys(r);for(let o=0;o<n.length;o+=1){const l=n[o].toLowerCase();if(t.indexOf(l)!==-1&&r[l])return a.concat(r)}}return a},[]),ts=t=>console&&typeof console.warn=="function"&&console.warn(t),at=(t,e,a)=>{const r={};return a.filter(n=>Array.isArray(n[t])?!0:(typeof n[t]<"u"&&ts(`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`),!1)).map(n=>n[t]).reverse().reduce((n,o)=>{const i={};o.filter(c=>{let d;const u=Object.keys(c);for(let p=0;p<u.length;p+=1){const f=u[p],v=f.toLowerCase();e.indexOf(v)!==-1&&!(d==="rel"&&c[d].toLowerCase()==="canonical")&&!(v==="rel"&&c[v].toLowerCase()==="stylesheet")&&(d=v),e.indexOf(f)!==-1&&(f==="innerHTML"||f==="cssText"||f==="itemprop")&&(d=f)}if(!d||!c[d])return!1;const h=c[d].toLowerCase();return r[d]||(r[d]={}),i[d]||(i[d]={}),r[d][h]?!1:(i[d][h]=!0,!0)}).reverse().forEach(c=>n.push(c));const l=Object.keys(i);for(let c=0;c<l.length;c+=1){const d=l[c],u={...r[d],...i[d]};r[d]=u}return n},[]).reverse()},as=(t,e)=>{if(Array.isArray(t)&&t.length){for(let a=0;a<t.length;a+=1)if(t[a][e])return!0}return!1},rs=t=>({baseTag:es(["href"],t),bodyAttributes:Zt("bodyAttributes",t),defer:Ke(t,ze.DEFER),encode:Ke(t,ze.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Zt("htmlAttributes",t),linkTags:at("link",["rel","href"],t),metaTags:at("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:at("noscript",["innerHTML"],t),onChangeClientState:Xn(t),scriptTags:at("script",["src","innerHTML"],t),styleTags:at("style",["cssText"],t),title:Qn(t),titleAttributes:Zt("titleAttributes",t),prioritizeSeoTags:as(t,ze.PRIORITIZE_SEO_TAGS)}),Ir=t=>Array.isArray(t)?t.join(""):t,ns=(t,e)=>{const a=Object.keys(t);for(let r=0;r<a.length;r+=1)if(e[a[r]]&&e[a[r]].includes(t[a[r]]))return!0;return!1},Qt=(t,e)=>Array.isArray(t)?t.reduce((a,r)=>(ns(r,e)?a.priority.push(r):a.default.push(r),a),{priority:[],default:[]}):{default:t,priority:[]},Za=(t,e)=>({...t,[e]:void 0}),ss=["noscript","script","style"],ua=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Rr=t=>Object.keys(t).reduce((e,a)=>{const r=typeof t[a]<"u"?`${a}="${t[a]}"`:`${a}`;return e?`${e} ${r}`:r},""),os=(t,e,a,r)=>{const n=Rr(a),o=Ir(e);return n?`<${t} ${ne}="true" ${n}>${ua(o,r)}</${t}>`:`<${t} ${ne}="true">${ua(o,r)}</${t}>`},is=(t,e,a=!0)=>e.reduce((r,n)=>{const o=n,i=Object.keys(o).filter(d=>!(d==="innerHTML"||d==="cssText")).reduce((d,u)=>{const h=typeof o[u]>"u"?u:`${u}="${ua(o[u],a)}"`;return d?`${d} ${h}`:h},""),l=o.innerHTML||o.cssText||"",c=ss.indexOf(t)===-1;return`${r}<${t} ${ne}="true" ${i}${c?"/>":`>${l}</${t}>`}`},""),Cr=(t,e={})=>Object.keys(t).reduce((a,r)=>{const n=Da[r];return a[n||r]=t[r],a},e),ls=(t,e,a)=>{const r={key:e,[ne]:!0},n=Cr(a,r);return[be.createElement("title",n,e)]},Et=(t,e)=>e.map((a,r)=>{const n={key:r,[ne]:!0};return Object.keys(a).forEach(o=>{const l=Da[o]||o;if(l==="innerHTML"||l==="cssText"){const c=a.innerHTML||a.cssText;n.dangerouslySetInnerHTML={__html:c}}else n[l]=a[o]}),be.createElement(t,n)}),X=(t,e,a=!0)=>{switch(t){case"title":return{toComponent:()=>ls(t,e.title,e.titleAttributes),toString:()=>os(t,e.title,e.titleAttributes,a)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Cr(e),toString:()=>Rr(e)};default:return{toComponent:()=>Et(t,e),toString:()=>is(t,e,a)}}},ds=({metaTags:t,linkTags:e,scriptTags:a,encode:r})=>{const n=Qt(t,Vt.meta),o=Qt(e,Vt.link),i=Qt(a,Vt.script);return{priorityMethods:{toComponent:()=>[...Et("meta",n.priority),...Et("link",o.priority),...Et("script",i.priority)],toString:()=>`${X("meta",n.priority,r)} ${X("link",o.priority,r)} ${X("script",i.priority,r)}`},metaTags:n.default,linkTags:o.default,scriptTags:i.default}},cs=t=>{const{baseTag:e,bodyAttributes:a,encode:r=!0,htmlAttributes:n,noscriptTags:o,styleTags:i,title:l="",titleAttributes:c,prioritizeSeoTags:d}=t;let{linkTags:u,metaTags:h,scriptTags:p}=t,f={toComponent:()=>{},toString:()=>""};return d&&({priorityMethods:f,linkTags:u,metaTags:h,scriptTags:p}=ds(t)),{priority:f,base:X("base",e,r),bodyAttributes:X("bodyAttributes",a,r),htmlAttributes:X("htmlAttributes",n,r),link:X("link",u,r),meta:X("meta",h,r),noscript:X("noscript",o,r),script:X("script",p,r),style:X("style",i,r),title:X("title",{title:l,titleAttributes:c},r)}},ha=cs,wt=[],$r=!!(typeof window<"u"&&window.document&&window.document.createElement),pa=class{constructor(t,e){te(this,"instances",[]);te(this,"canUseDOM",$r);te(this,"context");te(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?wt:this.instances,add:t=>{(this.canUseDOM?wt:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?wt:this.instances).indexOf(t);(this.canUseDOM?wt:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=ha({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},us={},Dr=be.createContext(us),Oe,Lr=(Oe=class extends b.Component{constructor(a){super(a);te(this,"helmetData");this.helmetData=new pa(this.props.context||{},Oe.canUseDOM)}render(){return be.createElement(Dr.Provider,{value:this.helmetData.value},this.props.children)}},te(Oe,"canUseDOM",$r),Oe),De=(t,e)=>{const a=document.head||document.querySelector("head"),r=a.querySelectorAll(`${t}[${ne}]`),n=[].slice.call(r),o=[];let i;return e&&e.length&&e.forEach(l=>{const c=document.createElement(t);for(const d in l)if(Object.prototype.hasOwnProperty.call(l,d))if(d==="innerHTML")c.innerHTML=l.innerHTML;else if(d==="cssText")c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText));else{const u=d,h=typeof l[u]>"u"?"":l[u];c.setAttribute(d,h)}c.setAttribute(ne,"true"),n.some((d,u)=>(i=u,c.isEqualNode(d)))?n.splice(i,1):o.push(c)}),n.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),o.forEach(l=>a.appendChild(l)),{oldTags:n,newTags:o}},fa=(t,e)=>{const a=document.getElementsByTagName(t)[0];if(!a)return;const r=a.getAttribute(ne),n=r?r.split(","):[],o=[...n],i=Object.keys(e);for(const l of i){const c=e[l]||"";a.getAttribute(l)!==c&&a.setAttribute(l,c),n.indexOf(l)===-1&&n.push(l);const d=o.indexOf(l);d!==-1&&o.splice(d,1)}for(let l=o.length-1;l>=0;l-=1)a.removeAttribute(o[l]);n.length===o.length?a.removeAttribute(ne):a.getAttribute(ne)!==i.join(",")&&a.setAttribute(ne,i.join(","))},hs=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=Ir(t)),fa("title",e)},Qa=(t,e)=>{const{baseTag:a,bodyAttributes:r,htmlAttributes:n,linkTags:o,metaTags:i,noscriptTags:l,onChangeClientState:c,scriptTags:d,styleTags:u,title:h,titleAttributes:p}=t;fa("body",r),fa("html",n),hs(h,p);const f={baseTag:De("base",a),linkTags:De("link",o),metaTags:De("meta",i),noscriptTags:De("noscript",l),scriptTags:De("script",d),styleTags:De("style",u)},v={},w={};Object.keys(f).forEach(m=>{const{newTags:y,oldTags:x}=f[m];y.length&&(v[m]=y),x.length&&(w[m]=f[m].oldTags)}),e&&e(),c(t,v,w)},rt=null,ps=t=>{rt&&cancelAnimationFrame(rt),t.defer?rt=requestAnimationFrame(()=>{Qa(t,()=>{rt=null})}):(Qa(t),rt=null)},fs=ps,Xa=class extends b.Component{constructor(){super(...arguments);te(this,"rendered",!1)}shouldComponentUpdate(e){return!Vn(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:a}=this.props.context;let r=null;const n=rs(e.get().map(o=>{const i={...o.props};return delete i.context,i}));Lr.canUseDOM?fs(n):ha&&(r=ha(n)),a(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},ca,ys=(ca=class extends b.Component{shouldComponentUpdate(t){return!zn(Za(this.props,"helmetData"),Za(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,a,r){return{...e,[t.type]:[...e[t.type]||[],{...a,...this.mapNestedChildrenToProps(t,r)}]}}mapObjectTypeChildren(t,e,a,r){switch(t.type){case"title":return{...e,[t.type]:r,titleAttributes:{...a}};case"body":return{...e,bodyAttributes:{...a}};case"html":return{...e,htmlAttributes:{...a}};default:return{...e,[t.type]:{...a}}}}mapArrayTypeChildrenToProps(t,e){let a={...e};return Object.keys(t).forEach(r=>{a={...a,[r]:t[r]}}),a}warnOnInvalidChildren(t,e){return Ya(Va.some(a=>t.type===a),typeof t.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${Va.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),Ya(!e||typeof e=="string"||Array.isArray(e)&&!e.some(a=>typeof a!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`}</${t.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let a={};return be.Children.forEach(t,r=>{if(!r||!r.props)return;const{children:n,...o}=r.props,i=Object.keys(o).reduce((c,d)=>(c[Zn[d]||d]=o[d],c),{});let{type:l}=r;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(r,n),l){case"Symbol(react.fragment)":e=this.mapChildrenToProps(n,e);break;case"link":case"meta":case"noscript":case"script":case"style":a=this.flattenArrayTypeChildren(r,a,i,n);break;default:e=this.mapObjectTypeChildren(r,e,i,n);break}}),this.mapArrayTypeChildrenToProps(a,e)}render(){const{children:t,...e}=this.props;let a={...e},{helmetData:r}=e;if(t&&(a=this.mapChildrenToProps(t,a)),r&&!(r instanceof pa)){const n=r;r=new pa(n.context,!0),delete a.helmetData}return r?be.createElement(Xa,{...a,context:r.value}):be.createElement(Dr.Consumer,null,n=>be.createElement(Xa,{...a,context:n}))}},te(ca,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),ca);const ms="modulepreload",gs=function(t){return"/"+t},er={},pe=function(e,a,r){let n=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));n=Promise.allSettled(a.map(c=>{if(c=gs(c),c in er)return;er[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":ms,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((p,f)=>{h.addEventListener("load",p),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return e().catch(o)})},vs=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...a)=>pe(async()=>{const{default:r}=await Promise.resolve().then(()=>Qe);return{default:r}},void 0).then(({default:r})=>r(...a)):e=fetch,(...a)=>e(...a)};class La extends Error{constructor(e,a="FunctionsError",r){super(e),this.name=a,this.context=r}}class tr extends La{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class ar extends La{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class rr extends La{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var ya;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(ya||(ya={}));var bs=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};class xs{constructor(e,{headers:a={},customFetch:r,region:n=ya.Any}={}){this.url=e,this.headers=a,this.region=n,this.fetch=vs(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return bs(this,arguments,void 0,function*(a,r={}){var n;try{const{headers:o,method:i,body:l,signal:c}=r;let d={},{region:u}=r;u||(u=this.region);const h=new URL(`${this.url}/${a}`);u&&u!=="any"&&(d["x-region"]=u,h.searchParams.set("forceFunctionRegion",u));let p;l&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)&&(typeof Blob<"u"&&l instanceof Blob||l instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",p=l):typeof l=="string"?(d["Content-Type"]="text/plain",p=l):typeof FormData<"u"&&l instanceof FormData?p=l:(d["Content-Type"]="application/json",p=JSON.stringify(l)));const f=yield this.fetch(h.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),o),body:p,signal:c}).catch(y=>{throw y.name==="AbortError"?y:new tr(y)}),v=f.headers.get("x-relay-error");if(v&&v==="true")throw new ar(f);if(!f.ok)throw new rr(f);let w=((n=f.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),m;return w==="application/json"?m=yield f.json():w==="application/octet-stream"?m=yield f.blob():w==="text/event-stream"?m=f:w==="multipart/form-data"?m=yield f.formData():m=yield f.text(),{data:m,error:null,response:f}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new tr(o)}:{data:null,error:o,response:o instanceof rr||o instanceof ar?o.context:void 0}}})}}var K={},Ua={},Ft={},vt={},Wt={},Ht={},ws=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},Ve=ws();const Ts=Ve.fetch,Ur=Ve.fetch.bind(Ve),Mr=Ve.Headers,_s=Ve.Request,ks=Ve.Response,Qe=Object.freeze(Object.defineProperty({__proto__:null,Headers:Mr,Request:_s,Response:ks,default:Ur,fetch:Ts},Symbol.toStringTag,{value:"Module"})),js=Nr(Qe);var qt={};Object.defineProperty(qt,"__esModule",{value:!0});let Ss=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};qt.default=Ss;var Br=ee&&ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ht,"__esModule",{value:!0});const Es=Br(js),Ns=Br(qt);let As=class{constructor(e){var a,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(a=e.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=Es.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,a){return this.headers=new Headers(this.headers),this.headers.set(e,a),this}then(e,a){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const r=this.fetch;let n=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var i,l,c,d;let u=null,h=null,p=null,f=o.status,v=o.statusText;if(o.ok){if(this.method!=="HEAD"){const x=await o.text();x===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text"))?h=x:h=JSON.parse(x))}const m=(l=this.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),y=(c=o.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");m&&y&&y.length>1&&(p=parseInt(y[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(h)&&(h.length>1?(u={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,p=null,f=406,v="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{const m=await o.text();try{u=JSON.parse(m),Array.isArray(u)&&o.status===404&&(h=[],u=null,f=200,v="OK")}catch{o.status===404&&m===""?(f=204,v="No Content"):u={message:m}}if(u&&this.isMaybeSingle&&(!((d=u==null?void 0:u.details)===null||d===void 0)&&d.includes("0 rows"))&&(u=null,f=200,v="OK"),u&&this.shouldThrowOnError)throw new Ns.default(u)}return{error:u,data:h,count:p,status:f,statusText:v}});return this.shouldThrowOnError||(n=n.catch(o=>{var i,l,c;return{error:{message:`${(i=o==null?void 0:o.name)!==null&&i!==void 0?i:"FetchError"}: ${o==null?void 0:o.message}`,details:`${(l=o==null?void 0:o.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=o==null?void 0:o.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),n.then(e,a)}returns(){return this}overrideTypes(){return this}};Ht.default=As;var Ps=ee&&ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wt,"__esModule",{value:!0});const Os=Ps(Ht);let Is=class extends Os.default{select(e){let a=!1;const r=(e??"*").split("").map(n=>/\s/.test(n)&&!a?"":(n==='"'&&(a=!a),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:a=!0,nullsFirst:r,foreignTable:n,referencedTable:o=n}={}){const i=o?`${o}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:a,referencedTable:r=a}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,a,{foreignTable:r,referencedTable:n=r}={}){const o=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(i,`${a-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:a=!1,settings:r=!1,buffers:n=!1,wal:o=!1,format:i="text"}={}){var l;const c=[e?"analyze":null,a?"verbose":null,r?"settings":null,n?"buffers":null,o?"wal":null].filter(Boolean).join("|"),d=(l=this.headers.get("Accept"))!==null&&l!==void 0?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${d}"; options=${c};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Wt.default=Is;var Rs=ee&&ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vt,"__esModule",{value:!0});const Cs=Rs(Wt);let $s=class extends Cs.default{eq(e,a){return this.url.searchParams.append(e,`eq.${a}`),this}neq(e,a){return this.url.searchParams.append(e,`neq.${a}`),this}gt(e,a){return this.url.searchParams.append(e,`gt.${a}`),this}gte(e,a){return this.url.searchParams.append(e,`gte.${a}`),this}lt(e,a){return this.url.searchParams.append(e,`lt.${a}`),this}lte(e,a){return this.url.searchParams.append(e,`lte.${a}`),this}like(e,a){return this.url.searchParams.append(e,`like.${a}`),this}likeAllOf(e,a){return this.url.searchParams.append(e,`like(all).{${a.join(",")}}`),this}likeAnyOf(e,a){return this.url.searchParams.append(e,`like(any).{${a.join(",")}}`),this}ilike(e,a){return this.url.searchParams.append(e,`ilike.${a}`),this}ilikeAllOf(e,a){return this.url.searchParams.append(e,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(e,a){return this.url.searchParams.append(e,`ilike(any).{${a.join(",")}}`),this}is(e,a){return this.url.searchParams.append(e,`is.${a}`),this}in(e,a){const r=Array.from(new Set(a)).map(n=>typeof n=="string"&&new RegExp("[,()]").test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,a){return typeof a=="string"?this.url.searchParams.append(e,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(e,`cs.{${a.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(a)}`),this}containedBy(e,a){return typeof a=="string"?this.url.searchParams.append(e,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(e,`cd.{${a.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(a)}`),this}rangeGt(e,a){return this.url.searchParams.append(e,`sr.${a}`),this}rangeGte(e,a){return this.url.searchParams.append(e,`nxl.${a}`),this}rangeLt(e,a){return this.url.searchParams.append(e,`sl.${a}`),this}rangeLte(e,a){return this.url.searchParams.append(e,`nxr.${a}`),this}rangeAdjacent(e,a){return this.url.searchParams.append(e,`adj.${a}`),this}overlaps(e,a){return typeof a=="string"?this.url.searchParams.append(e,`ov.${a}`):this.url.searchParams.append(e,`ov.{${a.join(",")}}`),this}textSearch(e,a,{config:r,type:n}={}){let o="";n==="plain"?o="pl":n==="phrase"?o="ph":n==="websearch"&&(o="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${o}fts${i}.${a}`),this}match(e){return Object.entries(e).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(e,a,r){return this.url.searchParams.append(e,`not.${a}.${r}`),this}or(e,{foreignTable:a,referencedTable:r=a}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,a,r){return this.url.searchParams.append(e,`${a}.${r}`),this}};vt.default=$s;var Ds=ee&&ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ft,"__esModule",{value:!0});const nt=Ds(vt);let Ls=class{constructor(e,{headers:a={},schema:r,fetch:n}){this.url=e,this.headers=new Headers(a),this.schema=r,this.fetch=n}select(e,a){const{head:r=!1,count:n}=a??{},o=r?"HEAD":"GET";let i=!1;const l=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join("");return this.url.searchParams.set("select",l),n&&this.headers.append("Prefer",`count=${n}`),new nt.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:a,defaultToNull:r=!0}={}){var n;const o="POST";if(a&&this.headers.append("Prefer",`count=${a}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const i=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(i.length>0){const l=[...new Set(i)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new nt.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(e,{onConflict:a,ignoreDuplicates:r=!1,count:n,defaultToNull:o=!0}={}){var i;const l="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&this.url.searchParams.set("on_conflict",a),n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((d,u)=>d.concat(Object.keys(u)),[]);if(c.length>0){const d=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",d.join(","))}}return new nt.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(e,{count:a}={}){var r;const n="PATCH";return a&&this.headers.append("Prefer",`count=${a}`),new nt.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:e}={}){var a;const r="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new nt.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};Ft.default=Ls;var Fr=ee&&ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ua,"__esModule",{value:!0});const Us=Fr(Ft),Ms=Fr(vt);let Bs=class Wr{constructor(e,{headers:a={},schema:r,fetch:n}={}){this.url=e,this.headers=new Headers(a),this.schemaName=r,this.fetch=n}from(e){const a=new URL(`${this.url}/${e}`);return new Us.default(a,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new Wr(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,a={},{head:r=!1,get:n=!1,count:o}={}){var i;let l;const c=new URL(`${this.url}/rpc/${e}`);let d;r||n?(l=r?"HEAD":"GET",Object.entries(a).filter(([h,p])=>p!==void 0).map(([h,p])=>[h,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([h,p])=>{c.searchParams.append(h,p)})):(l="POST",d=a);const u=new Headers(this.headers);return o&&u.set("Prefer",`count=${o}`),new Ms.default({method:l,url:c,headers:u,schema:this.schemaName,body:d,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}};Ua.default=Bs;var Xe=ee&&ee.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(K,"__esModule",{value:!0});K.PostgrestError=K.PostgrestBuilder=K.PostgrestTransformBuilder=K.PostgrestFilterBuilder=K.PostgrestQueryBuilder=K.PostgrestClient=void 0;const Hr=Xe(Ua);K.PostgrestClient=Hr.default;const qr=Xe(Ft);K.PostgrestQueryBuilder=qr.default;const Gr=Xe(vt);K.PostgrestFilterBuilder=Gr.default;const zr=Xe(Wt);K.PostgrestTransformBuilder=zr.default;const Kr=Xe(Ht);K.PostgrestBuilder=Kr.default;const Jr=Xe(qt);K.PostgrestError=Jr.default;var Fs=K.default={PostgrestClient:Hr.default,PostgrestQueryBuilder:qr.default,PostgrestFilterBuilder:Gr.default,PostgrestTransformBuilder:zr.default,PostgrestBuilder:Kr.default,PostgrestError:Jr.default};const{PostgrestClient:Ws,PostgrestQueryBuilder:Oc,PostgrestFilterBuilder:Ic,PostgrestTransformBuilder:Rc,PostgrestBuilder:Cc,PostgrestError:$c}=Fs;class Hs{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const a=process.versions;if(a&&a.node){const r=a.node,n=parseInt(r.replace(/^v/,"").split(".")[0]);return n>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${n} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${n} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: import ws from "ws" new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let a=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(a+=` Suggested solution: ${e.workaround}`),new Error(a)}static createWebSocket(e,a){const r=this.getWebSocketConstructor();return new r(e,a)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const qs="2.74.0",Gs=`realtime-js/${qs}`,zs="1.0.0",ma=1e4,Ks=1e3,Js=100;var ut;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(ut||(ut={}));var W;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(W||(W={}));var re;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(re||(re={}));var ga;(function(t){t.websocket="websocket"})(ga||(ga={}));var Ne;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Ne||(Ne={}));class Ys{constructor(){this.HEADER_LENGTH=1}decode(e,a){return e.constructor===ArrayBuffer?a(this._binaryDecode(e)):a(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const a=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,a,r)}_decodeBroadcast(e,a,r){const n=a.getUint8(1),o=a.getUint8(2);let i=this.HEADER_LENGTH+2;const l=r.decode(e.slice(i,i+n));i=i+n;const c=r.decode(e.slice(i,i+o));i=i+o;const d=JSON.parse(r.decode(e.slice(i,e.byteLength)));return{ref:null,topic:l,event:c,payload:d}}}class Yr{constructor(e,a){this.callback=e,this.timerCalc=a,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=a}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var M;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(M||(M={}));const nr=(t,e,a={})=>{var r;const n=(r=a.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((o,i)=>(o[i]=Vs(i,t,e,n),o),{}):{}},Vs=(t,e,a,r)=>{const n=e.find(l=>l.name===t),o=n==null?void 0:n.type,i=a[t];return o&&!r.includes(o)?Vr(o,i):va(i)},Vr=(t,e)=>{if(t.charAt(0)==="_"){const a=t.slice(1,t.length);return eo(e,a)}switch(t){case M.bool:return Zs(e);case M.float4:case M.float8:case M.int2:case M.int4:case M.int8:case M.numeric:case M.oid:return Qs(e);case M.json:case M.jsonb:return Xs(e);case M.timestamp:return to(e);case M.abstime:case M.date:case M.daterange:case M.int4range:case M.int8range:case M.money:case M.reltime:case M.text:case M.time:case M.timestamptz:case M.timetz:case M.tsrange:case M.tstzrange:return va(e);default:return va(e)}},va=t=>t,Zs=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Qs=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Xs=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},eo=(t,e)=>{if(typeof t!="string")return t;const a=t.length-1,r=t[a];if(t[0]==="{"&&r==="}"){let o;const i=t.slice(1,a);try{o=JSON.parse("["+i+"]")}catch{o=i?i.split(","):[]}return o.map(l=>Vr(e,l))}return t},to=t=>typeof t=="string"?t.replace(" ","T"):t,Zr=t=>{let e=t;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class Xt{constructor(e,a,r={},n=ma){this.channel=e,this.event=a,this.payload=r,this.timeout=n,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,a){var r;return this._hasReceived(e)&&a((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:a}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=a=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=a,this._matchReceive(a)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,a){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:a})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:a}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(a))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var sr;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(sr||(sr={}));class ht{constructor(e,a){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(a==null?void 0:a.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},n=>{const{onJoin:o,onLeave:i,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=ht.syncState(this.state,n,o,i),this.pendingDiffs.forEach(c=>{this.state=ht.syncDiff(this.state,c,o,i)}),this.pendingDiffs=[],l()}),this.channel._on(r.diff,{},n=>{const{onJoin:o,onLeave:i,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=ht.syncDiff(this.state,n,o,i),l())}),this.onJoin((n,o,i)=>{this.channel._trigger("presence",{event:"join",key:n,currentPresences:o,newPresences:i})}),this.onLeave((n,o,i)=>{this.channel._trigger("presence",{event:"leave",key:n,currentPresences:o,leftPresences:i})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,a,r,n){const o=this.cloneDeep(e),i=this.transformState(a),l={},c={};return this.map(o,(d,u)=>{i[d]||(c[d]=u)}),this.map(i,(d,u)=>{const h=o[d];if(h){const p=u.map(m=>m.presence_ref),f=h.map(m=>m.presence_ref),v=u.filter(m=>f.indexOf(m.presence_ref)<0),w=h.filter(m=>p.indexOf(m.presence_ref)<0);v.length>0&&(l[d]=v),w.length>0&&(c[d]=w)}else l[d]=u}),this.syncDiff(o,{joins:l,leaves:c},r,n)}static syncDiff(e,a,r,n){const{joins:o,leaves:i}={joins:this.transformState(a.joins),leaves:this.transformState(a.leaves)};return r||(r=()=>{}),n||(n=()=>{}),this.map(o,(l,c)=>{var d;const u=(d=e[l])!==null&&d!==void 0?d:[];if(e[l]=this.cloneDeep(c),u.length>0){const h=e[l].map(f=>f.presence_ref),p=u.filter(f=>h.indexOf(f.presence_ref)<0);e[l].unshift(...p)}r(l,u,c)}),this.map(i,(l,c)=>{let d=e[l];if(!d)return;const u=c.map(h=>h.presence_ref);d=d.filter(h=>u.indexOf(h.presence_ref)<0),e[l]=d,n(l,d,c),d.length===0&&delete e[l]}),e}static map(e,a){return Object.getOwnPropertyNames(e).map(r=>a(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((a,r)=>{const n=e[r];return"metas"in n?a[r]=n.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):a[r]=n,a},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var or;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(or||(or={}));var pt;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(pt||(pt={}));var de;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(de||(de={}));class Ma{constructor(e,a={config:{}},r){var n,o;if(this.topic=e,this.params=a,this.socket=r,this.bindings={},this.state=W.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},a.config),this.timeout=this.socket.timeout,this.joinPush=new Xt(this,re.join,this.params,this.timeout),this.rejoinTimer=new Yr(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=W.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=W.closed,this.socket._remove(this)}),this._onError(i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=W.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=W.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",i=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,i),this.state=W.errored,this.rejoinTimer.scheduleTimeout())}),this._on(re.reply,{},(i,l)=>{this._trigger(this._replyEventName(l),i)}),this.presence=new ht(this),this.broadcastEndpointURL=Zr(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(n=this.params.config)===null||n===void 0?void 0:n.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,a=this.timeout){var r,n,o;if(this.socket.isConnected()||this.socket.connect(),this.state==W.closed){const{config:{broadcast:i,presence:l,private:c}}=this.params,d=(n=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[pt.PRESENCE]&&this.bindings[pt.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,h={},p={broadcast:i,presence:Object.assign(Object.assign({},l),{enabled:u}),postgres_changes:d,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e==null?void 0:e(de.CHANNEL_ERROR,f)),this._onClose(()=>e==null?void 0:e(de.CLOSED)),this.updateJoinPayload(Object.assign({config:p},h)),this.joinedOnce=!0,this._rejoin(a),this.joinPush.receive("ok",async({postgres_changes:f})=>{var v;if(this.socket.setAuth(),f===void 0){e==null||e(de.SUBSCRIBED);return}else{const w=this.bindings.postgres_changes,m=(v=w==null?void 0:w.length)!==null&&v!==void 0?v:0,y=[];for(let x=0;x<m;x++){const T=w[x],{filter:{event:j,schema:N,table:S,filter:E}}=T,k=f&&f[x];if(k&&k.event===j&&k.schema===N&&k.table===S&&k.filter===E)y.push(Object.assign(Object.assign({},T),{id:k.id}));else{this.unsubscribe(),this.state=W.errored,e==null||e(de.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=y,e&&e(de.SUBSCRIBED);return}}).receive("error",f=>{this.state=W.errored,e==null||e(de.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(de.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,a={}){return await this.send({type:"presence",event:"track",payload:e},a.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,a,r){return this.state===W.joined&&e===pt.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,a,r)}async send(e,a={}){var r,n;if(!this._canPush()&&e.type==="broadcast"){const{event:o,payload:i}=e,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:i,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(r=a.timeout)!==null&&r!==void 0?r:this.timeout);return await((n=d.body)===null||n===void 0?void 0:n.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var i,l,c;const d=this._push(e.type,e,a.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(i=this.params)===null||i===void 0?void 0:i.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&o("ok"),d.receive("ok",()=>o("ok")),d.receive("error",()=>o("error")),d.receive("timeout",()=>o("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=W.leaving;const a=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(re.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(n=>{r=new Xt(this,re.leave,{},e),r.receive("ok",()=>{a(),n("ok")}).receive("timeout",()=>{a(),n("timed out")}).receive("error",()=>{n("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=W.closed,this.bindings={}}async _fetchWithTimeout(e,a,r){const n=new AbortController,o=setTimeout(()=>n.abort(),r),i=await this.socket.fetch(e,Object.assign(Object.assign({},a),{signal:n.signal}));return clearTimeout(o),i}_push(e,a,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let n=new Xt(this,e,a,r);return this._canPush()?n.send():this._addToPushBuffer(n),n}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Js){const a=this.pushBuffer.shift();a&&(a.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${a.event}`,a.payload))}}_onMessage(e,a,r){return a}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,a,r){var n,o;const i=e.toLocaleLowerCase(),{close:l,error:c,leave:d,join:u}=re;if(r&&[l,c,d,u].indexOf(i)>=0&&r!==this._joinRef())return;let p=this._onMessage(i,a,r);if(a&&!p)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(i)?(n=this.bindings.postgres_changes)===null||n===void 0||n.filter(f=>{var v,w,m;return((v=f.filter)===null||v===void 0?void 0:v.event)==="*"||((m=(w=f.filter)===null||w===void 0?void 0:w.event)===null||m===void 0?void 0:m.toLocaleLowerCase())===i}).map(f=>f.callback(p,r)):(o=this.bindings[i])===null||o===void 0||o.filter(f=>{var v,w,m,y,x,T;if(["broadcast","presence","postgres_changes"].includes(i))if("id"in f){const j=f.id,N=(v=f.filter)===null||v===void 0?void 0:v.event;return j&&((w=a.ids)===null||w===void 0?void 0:w.includes(j))&&(N==="*"||(N==null?void 0:N.toLocaleLowerCase())===((m=a.data)===null||m===void 0?void 0:m.type.toLocaleLowerCase()))}else{const j=(x=(y=f==null?void 0:f.filter)===null||y===void 0?void 0:y.event)===null||x===void 0?void 0:x.toLocaleLowerCase();return j==="*"||j===((T=a==null?void 0:a.event)===null||T===void 0?void 0:T.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===i}).map(f=>{if(typeof p=="object"&&"ids"in p){const v=p.data,{schema:w,table:m,commit_timestamp:y,type:x,errors:T}=v;p=Object.assign(Object.assign({},{schema:w,table:m,commit_timestamp:y,eventType:x,new:{},old:{},errors:T}),this._getPayloadRecords(v))}f.callback(p,r)})}_isClosed(){return this.state===W.closed}_isJoined(){return this.state===W.joined}_isJoining(){return this.state===W.joining}_isLeaving(){return this.state===W.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,a,r){const n=e.toLocaleLowerCase(),o={type:n,filter:a,callback:r};return this.bindings[n]?this.bindings[n].push(o):this.bindings[n]=[o],this}_off(e,a){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(n=>{var o;return!(((o=n.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===r&&Ma.isEqual(n.filter,a))})),this}static isEqual(e,a){if(Object.keys(e).length!==Object.keys(a).length)return!1;for(const r in e)if(e[r]!==a[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(re.close,{},e)}_onError(e){this._on(re.error,{},a=>e(a))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=W.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const a={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(a.new=nr(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(a.old=nr(e.columns,e.old_record)),a}}const ea=()=>{},Tt={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},ao=[1e3,2e3,5e3,1e4],ro=1e4,no=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class so{constructor(e,a){var r;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=ma,this.transport=null,this.heartbeatIntervalMs=Tt.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=ea,this.ref=0,this.reconnectTimer=null,this.logger=ea,this.conn=null,this.sendBuffer=[],this.serializer=new Ys,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=n=>{let o;return n?o=n:typeof fetch>"u"?o=(...i)=>pe(async()=>{const{default:l}=await Promise.resolve().then(()=>Qe);return{default:l}},void 0).then(({default:l})=>l(...i)).catch(l=>{throw new Error(`Failed to load @supabase/node-fetch: ${l.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...i)=>o(...i)},!(!((r=a==null?void 0:a.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=a.params.apikey,this.endPoint=`${e}/${ga.websocket}`,this.httpEndpoint=Zr(e),this._initializeOptions(a),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(a==null?void 0:a.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Hs.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const a=e.message;throw a.includes("Node.js")?new Error(`${a} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${a}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:zs}))}disconnect(e,a){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,a??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const a=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),a}async removeAllChannels(){const e=await Promise.all(this.channels.map(a=>a.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,a,r){this.logger(e,a,r)}connectionState(){switch(this.conn&&this.conn.readyState){case ut.connecting:return Ne.Connecting;case ut.open:return Ne.Open;case ut.closing:return Ne.Closing;default:return Ne.Closed}}isConnected(){return this.connectionState()===Ne.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,a={config:{}}){const r=`realtime:${e}`,n=this.getChannels().find(o=>o.topic===r);if(n)return n;{const o=new Ma(`realtime:${e}`,a,this);return this.channels.push(o),o}}push(e){const{topic:a,event:r,payload:n,ref:o}=e,i=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${a} ${r} (${o})`,n),this.isConnected()?i():this.sendBuffer.push(i)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(a){this.log("error","error in heartbeat callback",a)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(a){this.log("error","error in heartbeat callback",a)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(Ks,"heartbeat timeout"),setTimeout(()=>{var a;this.isConnected()||(a=this.reconnectTimer)===null||a===void 0||a.scheduleTimeout()},Tt.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(a){this.log("error","error in heartbeat callback",a)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let a=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));a&&(this.log("transport",`leaving duplicate topic "${e}"`),a.unsubscribe())}_remove(e){this.channels=this.channels.filter(a=>a.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,a=>{if(a.topic==="phoenix"&&a.event==="phx_reply")try{this.heartbeatCallback(a.payload.status==="ok"?"ok":"error")}catch(d){this.log("error","error in heartbeat callback",d)}a.ref&&a.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:n,payload:o,ref:i}=a,l=i?`(${i})`:"",c=o.status||"";this.log("receive",`${c} ${r} ${n} ${l}`.trim(),o),this.channels.filter(d=>d._isMember(r)).forEach(d=>d._trigger(n,o,i)),this._triggerStateCallbacks("message",a)})}_clearTimer(e){var a;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((a=this.reconnectTimer)===null||a===void 0||a.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=a=>{this.log("worker","worker error",a.message),this.workerRef.terminate()},this.workerRef.onmessage=a=>{a.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var a;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(a=this.reconnectTimer)===null||a===void 0||a.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(re.error))}_appendParams(e,a){if(Object.keys(a).length===0)return e;const r=e.match(/\?/)?"&":"?",n=new URLSearchParams(a);return`${e}${r}${n}`}_workerObjectUrl(e){let a;if(e)a=e;else{const r=new Blob([no],{type:"application/javascript"});a=URL.createObjectURL(r)}return a}_setConnectionState(e,a=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=a)}async _performAuth(e=null){let a;e?a=e:this.accessToken?a=await this.accessToken():a=this.accessTokenValue,this.accessTokenValue!=a&&(this.accessTokenValue=a,this.channels.forEach(r=>{const n={access_token:a,version:Gs};a&&r.updateJoinPayload(n),r.joinedOnce&&r._isJoined()&&r._push(re.access_token,{access_token:a})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(a=>{this.log("error",`error setting auth in ${e}`,a)})}_triggerStateCallbacks(e,a){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(a)}catch(n){this.log("error",`error in ${e} callback`,n)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new Yr(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Tt.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var a,r,n,o,i,l,c,d,u;if(this.transport=(a=e==null?void 0:e.transport)!==null&&a!==void 0?a:null,this.timeout=(r=e==null?void 0:e.timeout)!==null&&r!==void 0?r:ma,this.heartbeatIntervalMs=(n=e==null?void 0:e.heartbeatIntervalMs)!==null&&n!==void 0?n:Tt.HEARTBEAT_INTERVAL,this.worker=(o=e==null?void 0:e.worker)!==null&&o!==void 0?o:!1,this.accessToken=(i=e==null?void 0:e.accessToken)!==null&&i!==void 0?i:null,this.heartbeatCallback=(l=e==null?void 0:e.heartbeatCallback)!==null&&l!==void 0?l:ea,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:h=>ao[h-1]||ro,this.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:(h,p)=>p(JSON.stringify(h)),this.decode=(u=e==null?void 0:e.decode)!==null&&u!==void 0?u:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class Ba extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function F(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class oo extends Ba{constructor(e,a,r){super(e),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class ba extends Ba{constructor(e,a){super(e),this.name="StorageUnknownError",this.originalError=a}}var io=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};const Qr=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...a)=>pe(async()=>{const{default:r}=await Promise.resolve().then(()=>Qe);return{default:r}},void 0).then(({default:r})=>r(...a)):e=fetch,(...a)=>e(...a)},lo=()=>io(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield pe(()=>Promise.resolve().then(()=>Qe),void 0)).Response:Response}),xa=t=>{if(Array.isArray(t))return t.map(a=>xa(a));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([a,r])=>{const n=a.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));e[n]=xa(r)}),e},co=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};var Ce=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};const ta=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),uo=(t,e,a)=>Ce(void 0,void 0,void 0,function*(){const r=yield lo();t instanceof r&&!(a!=null&&a.noResolveJson)?t.json().then(n=>{const o=t.status||500,i=(n==null?void 0:n.statusCode)||o+"";e(new oo(ta(n),o,i))}).catch(n=>{e(new ba(ta(n),n))}):e(new ba(ta(t),t))}),ho=(t,e,a,r)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!r?n:(co(r)?(n.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),n.body=JSON.stringify(r)):n.body=r,e!=null&&e.duplex&&(n.duplex=e.duplex),Object.assign(Object.assign({},n),a))};function bt(t,e,a,r,n,o){return Ce(this,void 0,void 0,function*(){return new Promise((i,l)=>{t(a,ho(e,r,n,o)).then(c=>{if(!c.ok)throw c;return r!=null&&r.noResolveJson?c:c.json()}).then(c=>i(c)).catch(c=>uo(c,l,r))})})}function At(t,e,a,r){return Ce(this,void 0,void 0,function*(){return bt(t,"GET",e,a,r)})}function oe(t,e,a,r,n){return Ce(this,void 0,void 0,function*(){return bt(t,"POST",e,r,n,a)})}function wa(t,e,a,r,n){return Ce(this,void 0,void 0,function*(){return bt(t,"PUT",e,r,n,a)})}function po(t,e,a,r){return Ce(this,void 0,void 0,function*(){return bt(t,"HEAD",e,Object.assign(Object.assign({},a),{noResolveJson:!0}),r)})}function Xr(t,e,a,r,n){return Ce(this,void 0,void 0,function*(){return bt(t,"DELETE",e,r,n,a)})}var fo=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};class yo{constructor(e,a){this.downloadFn=e,this.shouldThrowOnError=a}then(e,a){return this.execute().then(e,a)}execute(){return fo(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(F(e))return{data:null,error:e};throw e}})}}var mo=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};class go{constructor(e,a){this.downloadFn=e,this.shouldThrowOnError=a}asStream(){return new yo(this.downloadFn,this.shouldThrowOnError)}then(e,a){return this.execute().then(e,a)}execute(){return mo(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(F(e))return{data:null,error:e};throw e}})}}var q=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};const vo={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ir={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class bo{constructor(e,a={},r,n){this.shouldThrowOnError=!1,this.url=e,this.headers=a,this.bucketId=r,this.fetch=Qr(n)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,a,r,n){return q(this,void 0,void 0,function*(){try{let o;const i=Object.assign(Object.assign({},ir),n);let l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(i.upsert)});const c=i.metadata;typeof Blob<"u"&&r instanceof Blob?(o=new FormData,o.append("cacheControl",i.cacheControl),c&&o.append("metadata",this.encodeMetadata(c)),o.append("",r)):typeof FormData<"u"&&r instanceof FormData?(o=r,o.append("cacheControl",i.cacheControl),c&&o.append("metadata",this.encodeMetadata(c))):(o=r,l["cache-control"]=`max-age=${i.cacheControl}`,l["content-type"]=i.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),n!=null&&n.headers&&(l=Object.assign(Object.assign({},l),n.headers));const d=this._removeEmptyFolders(a),u=this._getFinalPath(d),h=yield(e=="PUT"?wa:oe)(this.fetch,`${this.url}/object/${u}`,o,Object.assign({headers:l},i!=null&&i.duplex?{duplex:i.duplex}:{}));return{data:{path:d,id:h.Id,fullPath:h.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(F(o))return{data:null,error:o};throw o}})}upload(e,a,r){return q(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,a,r)})}uploadToSignedUrl(e,a,r,n){return q(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(e),i=this._getFinalPath(o),l=new URL(this.url+`/object/upload/sign/${i}`);l.searchParams.set("token",a);try{let c;const d=Object.assign({upsert:ir.upsert},n),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(d.upsert)});typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.append("cacheControl",d.cacheControl)):(c=r,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType);const h=yield wa(this.fetch,l.toString(),c,{headers:u});return{data:{path:o,fullPath:h.Key},error:null}}catch(c){if(this.shouldThrowOnError)throw c;if(F(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e,a){return q(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e);const n=Object.assign({},this.headers);a!=null&&a.upsert&&(n["x-upsert"]="true");const o=yield oe(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:n}),i=new URL(this.url+o.url),l=i.searchParams.get("token");if(!l)throw new Ba("No token returned by API");return{data:{signedUrl:i.toString(),path:e,token:l},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(F(r))return{data:null,error:r};throw r}})}update(e,a,r){return q(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,a,r)})}move(e,a,r){return q(this,void 0,void 0,function*(){try{return{data:yield oe(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:a,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}copy(e,a,r){return q(this,void 0,void 0,function*(){try{return{data:{path:(yield oe(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:a,destinationBucket:r==null?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}createSignedUrl(e,a,r){return q(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),o=yield oe(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:a},r!=null&&r.transform?{transform:r.transform}:{}),{headers:this.headers});const i=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${i}`)},{data:o,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}createSignedUrls(e,a,r){return q(this,void 0,void 0,function*(){try{const n=yield oe(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:a,paths:e},{headers:this.headers}),o=r!=null&&r.download?`&download=${r.download===!0?"":r.download}`:"";return{data:n.map(i=>Object.assign(Object.assign({},i),{signedUrl:i.signedURL?encodeURI(`${this.url}${i.signedURL}${o}`):null})),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}download(e,a){const n=typeof(a==null?void 0:a.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((a==null?void 0:a.transform)||{}),i=o?`?${o}`:"",l=this._getFinalPath(e),c=()=>At(this.fetch,`${this.url}/${n}/${l}${i}`,{headers:this.headers,noResolveJson:!0});return new go(c,this.shouldThrowOnError)}info(e){return q(this,void 0,void 0,function*(){const a=this._getFinalPath(e);try{const r=yield At(this.fetch,`${this.url}/object/info/${a}`,{headers:this.headers});return{data:xa(r),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(F(r))return{data:null,error:r};throw r}})}exists(e){return q(this,void 0,void 0,function*(){const a=this._getFinalPath(e);try{return yield po(this.fetch,`${this.url}/object/${a}`,{headers:this.headers}),{data:!0,error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(F(r)&&r instanceof ba){const n=r.originalError;if([400,404].includes(n==null?void 0:n.status))return{data:!1,error:r}}throw r}})}getPublicUrl(e,a){const r=this._getFinalPath(e),n=[],o=a!=null&&a.download?`download=${a.download===!0?"":a.download}`:"";o!==""&&n.push(o);const l=typeof(a==null?void 0:a.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((a==null?void 0:a.transform)||{});c!==""&&n.push(c);let d=n.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${r}${d}`)}}}remove(e){return q(this,void 0,void 0,function*(){try{return{data:yield Xr(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(F(a))return{data:null,error:a};throw a}})}list(e,a,r){return q(this,void 0,void 0,function*(){try{const n=Object.assign(Object.assign(Object.assign({},vo),a),{prefix:e||""});return{data:yield oe(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}listV2(e,a){return q(this,void 0,void 0,function*(){try{const r=Object.assign({},e);return{data:yield oe(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},a),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(F(r))return{data:null,error:r};throw r}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const a=[];return e.width&&a.push(`width=${e.width}`),e.height&&a.push(`height=${e.height}`),e.resize&&a.push(`resize=${e.resize}`),e.format&&a.push(`format=${e.format}`),e.quality&&a.push(`quality=${e.quality}`),a.join("&")}}const xo="2.74.0",wo={"X-Client-Info":`storage-js/${xo}`};var Le=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};class To{constructor(e,a={},r,n){this.shouldThrowOnError=!1;const o=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},wo),a),this.fetch=Qr(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return Le(this,void 0,void 0,function*(){try{return{data:yield At(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(F(e))return{data:null,error:e};throw e}})}getBucket(e){return Le(this,void 0,void 0,function*(){try{return{data:yield At(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(F(a))return{data:null,error:a};throw a}})}createBucket(e){return Le(this,arguments,void 0,function*(a,r={public:!1}){try{return{data:yield oe(this.fetch,`${this.url}/bucket`,{id:a,name:a,type:r.type,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}updateBucket(e,a){return Le(this,void 0,void 0,function*(){try{return{data:yield wa(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(F(r))return{data:null,error:r};throw r}})}emptyBucket(e){return Le(this,void 0,void 0,function*(){try{return{data:yield oe(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(F(a))return{data:null,error:a};throw a}})}deleteBucket(e){return Le(this,void 0,void 0,function*(){try{return{data:yield Xr(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(F(a))return{data:null,error:a};throw a}})}}class _o extends To{constructor(e,a={},r,n){super(e,a,r,n)}from(e){return new bo(this.url,this.headers,e,this.fetch)}}const ko="2.74.0";let lt="";typeof Deno<"u"?lt="deno":typeof document<"u"?lt="web":typeof navigator<"u"&&navigator.product==="ReactNative"?lt="react-native":lt="node";const jo={"X-Client-Info":`supabase-js-${lt}/${ko}`},So={headers:jo},Eo={schema:"public"},No={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Ao={};var Po=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};const Oo=t=>{let e;return t?e=t:typeof fetch>"u"?e=Ur:e=fetch,(...a)=>e(...a)},Io=()=>typeof Headers>"u"?Mr:Headers,Ro=(t,e,a)=>{const r=Oo(a),n=Io();return(o,i)=>Po(void 0,void 0,void 0,function*(){var l;const c=(l=yield e())!==null&&l!==void 0?l:t;let d=new n(i==null?void 0:i.headers);return d.has("apikey")||d.set("apikey",t),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),r(o,Object.assign(Object.assign({},i),{headers:d}))})};var Co=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};function $o(t){return t.endsWith("/")?t:t+"/"}function Do(t,e){var a,r;const{db:n,auth:o,realtime:i,global:l}=t,{db:c,auth:d,realtime:u,global:h}=e,p={db:Object.assign(Object.assign({},c),n),auth:Object.assign(Object.assign({},d),o),realtime:Object.assign(Object.assign({},u),i),storage:{},global:Object.assign(Object.assign(Object.assign({},h),l),{headers:Object.assign(Object.assign({},(a=h==null?void 0:h.headers)!==null&&a!==void 0?a:{}),(r=l==null?void 0:l.headers)!==null&&r!==void 0?r:{})}),accessToken:()=>Co(this,void 0,void 0,function*(){return""})};return t.accessToken?p.accessToken=t.accessToken:delete p.accessToken,p}function Lo(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL($o(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const en="2.74.0",He=30*1e3,Ta=3,aa=Ta*He,Uo="http://localhost:9999",Mo="supabase.auth.token",Bo={"X-Client-Info":`gotrue-js/${en}`},_a="X-Supabase-Api-Version",tn={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Fo=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Wo=10*60*1e3;class yt extends Error{constructor(e,a,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=a,this.code=r}}function A(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Ho extends yt{constructor(e,a,r){super(e,a,r),this.name="AuthApiError",this.status=a,this.code=r}}function qo(t){return A(t)&&t.name==="AuthApiError"}class Ae extends yt{constructor(e,a){super(e),this.name="AuthUnknownError",this.originalError=a}}class xe extends yt{constructor(e,a,r,n){super(e,r,n),this.name=a,this.status=r}}class ge extends xe{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Go(t){return A(t)&&t.name==="AuthSessionMissingError"}class Ue extends xe{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class _t extends xe{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class kt extends xe{constructor(e,a=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=a}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function zo(t){return A(t)&&t.name==="AuthImplicitGrantRedirectError"}class lr extends xe{constructor(e,a=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=a}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class ka extends xe{constructor(e,a){super(e,"AuthRetryableFetchError",a,void 0)}}function ra(t){return A(t)&&t.name==="AuthRetryableFetchError"}class dr extends xe{constructor(e,a,r){super(e,"AuthWeakPasswordError",a,"weak_password"),this.reasons=r}}class ja extends xe{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),cr=` \r=`.split(""),Ko=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<cr.length;e+=1)t[cr[e].charCodeAt(0)]=-2;for(let e=0;e<Pt.length;e+=1)t[Pt[e].charCodeAt(0)]=e;return t})();function ur(t,e,a){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;a(Pt[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;a(Pt[r]),e.queuedBits-=6}}function an(t,e,a){const r=Ko[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)a(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function hr(t){const e=[],a=i=>{e.push(String.fromCodePoint(i))},r={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},o=i=>{Vo(i,r,a)};for(let i=0;i<t.length;i+=1)an(t.charCodeAt(i),n,o);return e.join("")}function Jo(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Yo(t,e){for(let a=0;a<t.length;a+=1){let r=t.charCodeAt(a);if(r>55295&&r<=56319){const n=(r-55296)*1024&65535;r=(t.charCodeAt(a+1)-56320&65535|n)+65536,a+=1}Jo(r,e)}}function Vo(t,e,a){if(e.utf8seq===0){if(t<=127){a(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&a(e.codepoint)}}function Je(t){const e=[],a={queue:0,queuedBits:0},r=n=>{e.push(n)};for(let n=0;n<t.length;n+=1)an(t.charCodeAt(n),a,r);return new Uint8Array(e)}function Zo(t){const e=[];return Yo(t,a=>e.push(a)),new Uint8Array(e)}function Pe(t){const e=[],a={queue:0,queuedBits:0},r=n=>{e.push(n)};return t.forEach(n=>ur(n,a,r)),ur(null,a,r),e.join("")}function Qo(t){return Math.round(Date.now()/1e3)+t}function Xo(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}const V=()=>typeof window<"u"&&typeof document<"u",_e={tested:!1,writable:!1},rn=()=>{if(!V())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(_e.tested)return _e.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),_e.tested=!0,_e.writable=!0}catch{_e.tested=!0,_e.writable=!1}return _e.writable};function ei(t){const e={},a=new URL(t);if(a.hash&&a.hash[0]==="#")try{new URLSearchParams(a.hash.substring(1)).forEach((n,o)=>{e[o]=n})}catch{}return a.searchParams.forEach((r,n)=>{e[n]=r}),e}const nn=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...a)=>pe(async()=>{const{default:r}=await Promise.resolve().then(()=>Qe);return{default:r}},void 0).then(({default:r})=>r(...a)):e=fetch,(...a)=>e(...a)},ti=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",qe=async(t,e,a)=>{await t.setItem(e,JSON.stringify(a))},ke=async(t,e)=>{const a=await t.getItem(e);if(!a)return null;try{return JSON.parse(a)}catch{return a}},ye=async(t,e)=>{await t.removeItem(e)};class Gt{constructor(){this.promise=new Gt.promiseConstructor((e,a)=>{this.resolve=e,this.reject=a})}}Gt.promiseConstructor=Promise;function na(t){const e=t.split(".");if(e.length!==3)throw new ja("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!Fo.test(e[r]))throw new ja("JWT not in base64url format");return{header:JSON.parse(hr(e[0])),payload:JSON.parse(hr(e[1])),signature:Je(e[2]),raw:{header:e[0],payload:e[1]}}}async function ai(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function ri(t,e){return new Promise((r,n)=>{(async()=>{for(let o=0;o<1/0;o++)try{const i=await t(o);if(!e(o,null,i)){r(i);return}}catch(i){if(!e(o,i)){n(i);return}}})()})}function ni(t){return("0"+t.toString(16)).substr(-2)}function si(){const e=new Uint32Array(56);if(typeof crypto>"u"){const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=a.length;let n="";for(let o=0;o<56;o++)n+=a.charAt(Math.floor(Math.random()*r));return n}return crypto.getRandomValues(e),Array.from(e,ni).join("")}async function oi(t){const a=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",a),n=new Uint8Array(r);return Array.from(n).map(o=>String.fromCharCode(o)).join("")}async function ii(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const a=await oi(t);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Me(t,e,a=!1){const r=si();let n=r;a&&(n+="/PASSWORD_RECOVERY"),await qe(t,`${e}-code-verifier`,n);const o=await ii(r);return[o,r===o?"plain":"s256"]}const li=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function di(t){const e=t.headers.get(_a);if(!e||!e.match(li))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function ci(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function ui(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const hi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Be(t){if(!hi.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function sa(){const t={};return new Proxy(t,{get:(e,a)=>{if(a==="__isUserNotAvailableProxy")return!0;if(typeof a=="symbol"){const r=a.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${a}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,a)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${a}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,a)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${a}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function pr(t){return JSON.parse(JSON.stringify(t))}var pi=function(t,e){var a={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(a[r[n]]=t[r[n]]);return a};const Se=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),fi=[502,503,504];async function fr(t){var e;if(!ti(t))throw new ka(Se(t),0);if(fi.includes(t.status))throw new ka(Se(t),t.status);let a;try{a=await t.json()}catch(o){throw new Ae(Se(o),o)}let r;const n=di(t);if(n&&n.getTime()>=tn["2024-01-01"].timestamp&&typeof a=="object"&&a&&typeof a.code=="string"?r=a.code:typeof a=="object"&&a&&typeof a.error_code=="string"&&(r=a.error_code),r){if(r==="weak_password")throw new dr(Se(a),t.status,((e=a.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new ge}else if(typeof a=="object"&&a&&typeof a.weak_password=="object"&&a.weak_password&&Array.isArray(a.weak_password.reasons)&&a.weak_password.reasons.length&&a.weak_password.reasons.reduce((o,i)=>o&&typeof i=="string",!0))throw new dr(Se(a),t.status,a.weak_password.reasons);throw new Ho(Se(a),t.status||500,r)}const yi=(t,e,a,r)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(r),Object.assign(Object.assign({},n),a))};async function P(t,e,a,r){var n;const o=Object.assign({},r==null?void 0:r.headers);o[_a]||(o[_a]=tn["2024-01-01"].name),r!=null&&r.jwt&&(o.Authorization=`Bearer ${r.jwt}`);const i=(n=r==null?void 0:r.query)!==null&&n!==void 0?n:{};r!=null&&r.redirectTo&&(i.redirect_to=r.redirectTo);const l=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",c=await mi(t,e,a+l,{headers:o,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(c):{data:Object.assign({},c),error:null}}async function mi(t,e,a,r,n,o){const i=yi(e,r,n,o);let l;try{l=await t(a,Object.assign({},i))}catch(c){throw console.error(c),new ka(Se(c),0)}if(l.ok||await fr(l),r!=null&&r.noResolveJson)return l;try{return await l.json()}catch(c){await fr(c)}}function ae(t){var e;let a=null;bi(t)&&(a=Object.assign({},t),t.expires_at||(a.expires_at=Qo(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:a,user:r},error:null}}function yr(t){const e=ae(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((a,r)=>a&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function ve(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function gi(t){return{data:t,error:null}}function vi(t){const{action_link:e,email_otp:a,hashed_token:r,redirect_to:n,verification_type:o}=t,i=pi(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:a,hashed_token:r,redirect_to:n,verification_type:o},c=Object.assign({},i);return{data:{properties:l,user:c},error:null}}function mr(t){return t}function bi(t){return t.access_token&&t.refresh_token&&t.expires_in}const oa=["global","local","others"];var xi=function(t,e){var a={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(a[r[n]]=t[r[n]]);return a};class wi{constructor({url:e="",headers:a={},fetch:r}){this.url=e,this.headers=a,this.fetch=nn(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,a=oa[0]){if(oa.indexOf(a)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${oa.join(", ")}`);try{return await P(this.fetch,"POST",`${this.url}/logout?scope=${a}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(A(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,a={}){try{return await P(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:a.data},headers:this.headers,redirectTo:a.redirectTo,xform:ve})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:a}=e,r=xi(e,["options"]),n=Object.assign(Object.assign({},r),a);return"newEmail"in r&&(n.new_email=r==null?void 0:r.newEmail,delete n.newEmail),await P(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:vi,redirectTo:a==null?void 0:a.redirectTo})}catch(a){if(A(a))return{data:{properties:null,user:null},error:a};throw a}}async createUser(e){try{return await P(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ve})}catch(a){if(A(a))return{data:{user:null},error:a};throw a}}async listUsers(e){var a,r,n,o,i,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await P(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(a=e==null?void 0:e.page)===null||a===void 0?void 0:a.toString())!==null&&r!==void 0?r:"",per_page:(o=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&o!==void 0?o:""},xform:mr});if(u.error)throw u.error;const h=await u.json(),p=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,f=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(v=>{const w=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),m=JSON.parse(v.split(";")[1].split("=")[1]);d[`${m}Page`]=w}),d.total=parseInt(p)),{data:Object.assign(Object.assign({},h),d),error:null}}catch(d){if(A(d))return{data:{users:[]},error:d};throw d}}async getUserById(e){Be(e);try{return await P(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ve})}catch(a){if(A(a))return{data:{user:null},error:a};throw a}}async updateUserById(e,a){Be(e);try{return await P(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:a,headers:this.headers,xform:ve})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,a=!1){Be(e);try{return await P(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:a},xform:ve})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Be(e.userId);try{const{data:a,error:r}=await P(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:a,error:r}}catch(a){if(A(a))return{data:null,error:a};throw a}}async _deleteFactor(e){Be(e.userId),Be(e.id);try{return{data:await P(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(a){if(A(a))return{data:null,error:a};throw a}}async _listOAuthClients(e){var a,r,n,o,i,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await P(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(a=e==null?void 0:e.page)===null||a===void 0?void 0:a.toString())!==null&&r!==void 0?r:"",per_page:(o=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&o!==void 0?o:""},xform:mr});if(u.error)throw u.error;const h=await u.json(),p=(i=u.headers.get("x-total-count"))!==null&&i!==void 0?i:0,f=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return f.length>0&&(f.forEach(v=>{const w=parseInt(v.split(";")[0].split("=")[1].substring(0,1)),m=JSON.parse(v.split(";")[1].split("=")[1]);d[`${m}Page`]=w}),d.total=parseInt(p)),{data:Object.assign(Object.assign({},h),d),error:null}}catch(d){if(A(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(e){try{return await P(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(A(a))return{data:null,error:a};throw a}}async _getOAuthClient(e){try{return await P(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(A(a))return{data:null,error:a};throw a}}async _deleteOAuthClient(e){try{return await P(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(A(a))return{data:null,error:a};throw a}}async _regenerateOAuthClientSecret(e){try{return await P(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(A(a))return{data:null,error:a};throw a}}}function gr(t={}){return{getItem:e=>t[e]||null,setItem:(e,a)=>{t[e]=a},removeItem:e=>{delete t[e]}}}const Fe={debug:!!(globalThis&&rn()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class sn extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Ti extends sn{}async function _i(t,e,a){Fe.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),Fe.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async n=>{if(n){Fe.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,n.name);try{return await a()}finally{Fe.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,n.name)}}else{if(e===0)throw Fe.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Ti(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Fe.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await a()}}))}function ki(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function on(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function ji(t){return parseInt(t,16)}function Si(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function Ei(t){var e;const{chainId:a,domain:r,expirationTime:n,issuedAt:o=new Date,nonce:i,notBefore:l,requestId:c,resources:d,scheme:u,uri:h,version:p}=t;{if(!Number.isInteger(a))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${a}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(i&&i.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${i}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(p!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${p}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=on(t.address),v=u?`${u}://${r}`:r,w=t.statement?`${t.statement} `:"",m=`${v} wants you to sign in with your Ethereum account: ${f} ${w}`;let y=`URI: ${h} Version: ${p} Chain ID: ${a}${i?` Nonce: ${i}`:""} Issued At: ${o.toISOString()}`;if(n&&(y+=` Expiration Time: ${n.toISOString()}`),l&&(y+=` Not Before: ${l.toISOString()}`),c&&(y+=` Request ID: ${c}`),d){let x=` Resources:`;for(const T of d){if(!T||typeof T!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${T}`);x+=` - ${T}`}y+=x}return`${m} ${y}`}class B extends Error{constructor({message:e,code:a,cause:r,name:n}){var o;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(o=n??(r instanceof Error?r.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=a}}class Ot extends B{constructor(e,a){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:a,message:e}),this.name="WebAuthnUnknownError",this.originalError=a}}function Ni({error:t,options:e}){var a,r,n;const{publicKey:o}=e;if(!o)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new B({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((a=o.authenticatorSelection)===null||a===void 0?void 0:a.requireResidentKey)===!0)return new B({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=o.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new B({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new B({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new B({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new B({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new B({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new B({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const i=window.location.hostname;if(dn(i)){if(o.rp.id!==i)return new B({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new B({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new B({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new B({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new B({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Ai({error:t,options:e}){const{publicKey:a}=e;if(!a)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new B({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new B({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(dn(r)){if(a.rpId!==r)return new B({message:`The RP ID "${a.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new B({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new B({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new B({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}var ln=function(t,e){var a={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(a[r[n]]=t[r[n]]);return a};class Pi{createNewAbortSignal(){if(this.controller){const a=new Error("Cancelling existing WebAuthn API call for new one");a.name="AbortError",this.controller.abort(a)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const Oi=new Pi;function Ii(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:a,excludeCredentials:r}=t,n=ln(t,["challenge","user","excludeCredentials"]),o=Je(e).buffer,i=Object.assign(Object.assign({},a),{id:Je(a.id).buffer}),l=Object.assign(Object.assign({},n),{challenge:o,user:i});if(r&&r.length>0){l.excludeCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const d=r[c];l.excludeCredentials[c]=Object.assign(Object.assign({},d),{id:Je(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function Ri(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:a}=t,r=ln(t,["challenge","allowCredentials"]),n=Je(e).buffer,o=Object.assign(Object.assign({},r),{challenge:n});if(a&&a.length>0){o.allowCredentials=new Array(a.length);for(let i=0;i<a.length;i++){const l=a[i];o.allowCredentials[i]=Object.assign(Object.assign({},l),{id:Je(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return o}function Ci(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const a=t;return{id:t.id,rawId:t.id,response:{attestationObject:Pe(new Uint8Array(t.response.attestationObject)),clientDataJSON:Pe(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=a.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function $i(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const a=t,r=t.getClientExtensionResults(),n=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Pe(new Uint8Array(n.authenticatorData)),clientDataJSON:Pe(new Uint8Array(n.clientDataJSON)),signature:Pe(new Uint8Array(n.signature)),userHandle:n.userHandle?Pe(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=a.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function dn(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function vr(){var t,e;return!!(V()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Di(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ot("Browser returned unexpected credential type",e)}:{data:null,error:new Ot("Empty credential response",e)}}catch(e){return{data:null,error:Ni({error:e,options:t})}}}async function Li(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ot("Browser returned unexpected credential type",e)}:{data:null,error:new Ot("Empty credential response",e)}}catch(e){return{data:null,error:Ai({error:e,options:t})}}}const Ui={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},Mi={userVerification:"preferred",hints:["security-key"]};function It(...t){const e=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),a=n=>n instanceof ArrayBuffer||ArrayBuffer.isView(n),r={};for(const n of t)if(n)for(const o in n){const i=n[o];if(i!==void 0)if(Array.isArray(i))r[o]=i;else if(a(i))r[o]=i;else if(e(i)){const l=r[o];e(l)?r[o]=It(l,i):r[o]=It(i)}else r[o]=i}return r}function Bi(t,e){return It(Ui,t,e||{})}function Fi(t,e){return It(Mi,t,e||{})}class Wi{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:a,friendlyName:r,signal:n},o){try{const{data:i,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:a});if(!i)return{data:null,error:l};const c=n??Oi.createNewAbortSignal();if(i.webauthn.type==="create"){const{user:d}=i.webauthn.credential_options.publicKey;d.name||(d.name=`${d.id}:${r}`),d.displayName||(d.displayName=d.name)}switch(i.webauthn.type){case"create":{const d=Bi(i.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:u,error:h}=await Di({publicKey:d,signal:c});return u?{data:{factorId:e,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:u}},error:null}:{data:null,error:h}}case"request":{const d=Fi(i.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:u,error:h}=await Li(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:d,signal:c}));return u?{data:{factorId:e,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:u}},error:null}:{data:null,error:h}}}}catch(i){return A(i)?{data:null,error:i}:{data:null,error:new Ae("Unexpected error in challenge",i)}}}async _verify({challengeId:e,factorId:a,webauthn:r}){return this.client.mfa.verify({factorId:a,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:a=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n}},o){if(!a)return{data:null,error:new yt("rpId is required for WebAuthn authentication")};try{if(!vr())return{data:null,error:new Ae("Browser does not support WebAuthn",null)};const{data:i,error:l}=await this.challenge({factorId:e,webauthn:{rpId:a,rpOrigins:r},signal:n},{request:o});if(!i)return{data:null,error:l};const{webauthn:c}=i;return this._verify({factorId:e,challengeId:i.challengeId,webauthn:{type:c.type,rpId:a,rpOrigins:r,credential_response:c.credential_response}})}catch(i){return A(i)?{data:null,error:i}:{data:null,error:new Ae("Unexpected error in authenticate",i)}}}async _register({friendlyName:e,rpId:a=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n},o){if(!a)return{data:null,error:new yt("rpId is required for WebAuthn registration")};try{if(!vr())return{data:null,error:new Ae("Browser does not support WebAuthn",null)};const{data:i,error:l}=await this._enroll({friendlyName:e});if(!i)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(p=>p.factor_type==="webauthn"&&p.friendly_name===e&&p.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:l};const{data:c,error:d}=await this._challenge({factorId:i.id,friendlyName:i.friendly_name,webauthn:{rpId:a,rpOrigins:r},signal:n},{create:o});return c?this._verify({factorId:i.id,challengeId:c.challengeId,webauthn:{rpId:a,rpOrigins:r,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:d}}catch(i){return A(i)?{data:null,error:i}:{data:null,error:new Ae("Unexpected error in register",i)}}}}ki();const Hi={url:Uo,storageKey:Mo,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Bo,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function br(t,e,a){return await a()}const We={};class mt{get jwks(){var e,a;return(a=(e=We[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&a!==void 0?a:{keys:[]}}set jwks(e){We[this.storageKey]=Object.assign(Object.assign({},We[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,a;return(a=(e=We[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&a!==void 0?a:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){We[this.storageKey]=Object.assign(Object.assign({},We[this.storageKey]),{cachedAt:e})}constructor(e){var a,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=mt.nextInstanceID,mt.nextInstanceID+=1,this.instanceID>0&&V()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const n=Object.assign(Object.assign({},Hi),e);if(this.logDebugMessages=!!n.debug,typeof n.debug=="function"&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new wi({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=nn(n.fetch),this.lock=n.lock||br,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:V()&&(!((a=globalThis==null?void 0:globalThis.navigator)===null||a===void 0)&&a.locks)?this.lock=_i:this.lock=br,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Wi(this)},this.persistSession?(n.storage?this.storage=n.storage:rn()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=gr(this.memoryStorage)),n.userStorage&&(this.userStorage=n.userStorage)):(this.memoryStorage={},this.storage=gr(this.memoryStorage)),V()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(r=this.broadcastChannel)===null||r===void 0||r.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${en}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{const a=ei(window.location.href);let r="none";if(this._isImplicitGrantCallback(a)?r="implicit":await this._isPKCECallback(a)&&(r="pkce"),V()&&this.detectSessionInUrl&&r!=="none"){const{data:n,error:o}=await this._getSessionFromURL(a,r);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),zo(o)){const c=(e=o.details)===null||e===void 0?void 0:e.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:i,redirectType:l}=n;return this._debug("#_initialize()","detected session in URL",i,"redirect type",l),await this._saveSession(i),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(a){return A(a)?{error:a}:{error:new Ae("Unexpected error during initialization",a)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var a,r,n;try{const o=await P(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(a=e==null?void 0:e.options)===null||a===void 0?void 0:a.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:ae}),{data:i,error:l}=o;if(l||!i)return{data:{user:null,session:null},error:l};const c=i.session,d=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(o){if(A(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(e){var a,r,n;try{let o;if("email"in e){const{email:u,password:h,options:p}=e;let f=null,v=null;this.flowType==="pkce"&&([f,v]=await Me(this.storage,this.storageKey)),o=await P(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:p==null?void 0:p.emailRedirectTo,body:{email:u,password:h,data:(a=p==null?void 0:p.data)!==null&&a!==void 0?a:{},gotrue_meta_security:{captcha_token:p==null?void 0:p.captchaToken},code_challenge:f,code_challenge_method:v},xform:ae})}else if("phone"in e){const{phone:u,password:h,options:p}=e;o=await P(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=p==null?void 0:p.data)!==null&&r!==void 0?r:{},channel:(n=p==null?void 0:p.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:p==null?void 0:p.captchaToken}},xform:ae})}else throw new _t("You must provide either an email or phone number and a password");const{data:i,error:l}=o;if(l||!i)return{data:{user:null,session:null},error:l};const c=i.session,d=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(o){if(A(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(e){try{let a;if("email"in e){const{email:o,password:i,options:l}=e;a=await P(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:i,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:yr})}else if("phone"in e){const{phone:o,password:i,options:l}=e;a=await P(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:i,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:yr})}else throw new _t("You must provide either an email or phone number and a password");const{data:r,error:n}=a;return n?{data:{user:null,session:null},error:n}:!r||!r.session||!r.user?{data:{user:null,session:null},error:new Ue}:(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n})}catch(a){if(A(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithOAuth(e){var a,r,n,o;return await this._handleProviderSignIn(e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(o=e.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:a}=e;switch(a){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${a}"`)}}async signInWithEthereum(e){var a,r,n,o,i,l,c,d,u,h,p;let f,v;if("message"in e)f=e.message,v=e.signature;else{const{chain:w,wallet:m,statement:y,options:x}=e;let T;if(V())if(typeof m=="object")T=m;else{const _=window;if("ethereum"in _&&typeof _.ethereum=="object"&&"request"in _.ethereum&&typeof _.ethereum.request=="function")T=_.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof m!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");T=m}const j=new URL((a=x==null?void 0:x.url)!==null&&a!==void 0?a:window.location.href),N=await T.request({method:"eth_requestAccounts"}).then(_=>_).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!N||N.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=on(N[0]);let E=(r=x==null?void 0:x.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!E){const _=await T.request({method:"eth_chainId"});E=ji(_)}const k={domain:j.host,address:S,statement:y,uri:j.href,version:"1",chainId:E,nonce:(n=x==null?void 0:x.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(i=(o=x==null?void 0:x.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&i!==void 0?i:new Date,expirationTime:(l=x==null?void 0:x.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=x==null?void 0:x.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(d=x==null?void 0:x.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(u=x==null?void 0:x.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Ei(k),v=await T.request({method:"personal_sign",params:[Si(f),S]})}try{const{data:w,error:m}=await P(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:v},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:ae});if(m)throw m;return!w||!w.session||!w.user?{data:{user:null,session:null},error:new Ue}:(w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),{data:Object.assign({},w),error:m})}catch(w){if(A(w))return{data:{user:null,session:null},error:w};throw w}}async signInWithSolana(e){var a,r,n,o,i,l,c,d,u,h,p,f;let v,w;if("message"in e)v=e.message,w=e.signature;else{const{chain:m,wallet:y,statement:x,options:T}=e;let j;if(V())if(typeof y=="object")j=y;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))j=S.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof y!="object"||!(T!=null&&T.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=y}const N=new URL((a=T==null?void 0:T.url)!==null&&a!==void 0?a:window.location.href);if("signIn"in j&&j.signIn){const S=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},T==null?void 0:T.signInWithSolana),{version:"1",domain:N.host,uri:N.href}),x?{statement:x}:null));let E;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")E=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)E=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in E&&"signature"in E&&(typeof E.signedMessage=="string"||E.signedMessage instanceof Uint8Array)&&E.signature instanceof Uint8Array)v=typeof E.signedMessage=="string"?E.signedMessage:new TextDecoder().decode(E.signedMessage),w=E.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");v=[`${N.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${N.href}`,`Issued At: ${(n=(r=T==null?void 0:T.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((o=T==null?void 0:T.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${T.signInWithSolana.notBefore}`]:[],...!((i=T==null?void 0:T.signInWithSolana)===null||i===void 0)&&i.expirationTime?[`Expiration Time: ${T.signInWithSolana.expirationTime}`]:[],...!((l=T==null?void 0:T.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${T.signInWithSolana.chainId}`]:[],...!((c=T==null?void 0:T.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${T.signInWithSolana.nonce}`]:[],...!((d=T==null?void 0:T.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${T.signInWithSolana.requestId}`]:[],...!((h=(u=T==null?void 0:T.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...T.signInWithSolana.resources.map(E=>`- ${E}`)]:[]].join(` `);const S=await j.signMessage(new TextEncoder().encode(v),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=S}}try{const{data:m,error:y}=await P(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:v,signature:Pe(w)},!((p=e.options)===null||p===void 0)&&p.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ae});if(y)throw y;return!m||!m.session||!m.user?{data:{user:null,session:null},error:new Ue}:(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),{data:Object.assign({},m),error:y})}catch(m){if(A(m))return{data:{user:null,session:null},error:m};throw m}}async _exchangeCodeForSession(e){const a=await ke(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(a??"").split("/");try{const{data:o,error:i}=await P(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:ae});if(await ye(this.storage,`${this.storageKey}-code-verifier`),i)throw i;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new Ue}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:n??null}),error:i})}catch(o){if(A(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(e){try{const{options:a,provider:r,token:n,access_token:o,nonce:i}=e,l=await P(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:o,nonce:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:ae}),{data:c,error:d}=l;return d?{data:{user:null,session:null},error:d}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new Ue}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:d})}catch(a){if(A(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithOtp(e){var a,r,n,o,i;try{if("email"in e){const{email:l,options:c}=e;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await Me(this.storage,this.storageKey));const{error:h}=await P(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(a=c==null?void 0:c.data)!==null&&a!==void 0?a:{},create_user:(r=c==null?void 0:c.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:d,code_challenge_method:u},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:l,options:c}=e,{data:d,error:u}=await P(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(o=c==null?void 0:c.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(i=c==null?void 0:c.channel)!==null&&i!==void 0?i:"sms"}});return{data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u}}throw new _t("You must provide either an email or phone number.")}catch(l){if(A(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var a,r;try{let n,o;"options"in e&&(n=(a=e.options)===null||a===void 0?void 0:a.redirectTo,o=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:i,error:l}=await P(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:n,xform:ae});if(l)throw l;if(!i)throw new Error("An error occurred on token verification.");const c=i.session,d=i.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(e){var a,r,n;try{let o=null,i=null;return this.flowType==="pkce"&&([o,i]=await Me(this.storage,this.storageKey)),await P(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(a=e.options)===null||a===void 0?void 0:a.redirectTo)!==null&&r!==void 0?r:void 0}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:i}),headers:this.headers,xform:gi})}catch(o){if(A(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:a},error:r}=e;if(r)throw r;if(!a)throw new ge;const{error:n}=await P(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:a.access_token});return{data:{user:null,session:null},error:n}})}catch(e){if(A(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const a=`${this.url}/resend`;if("email"in e){const{email:r,type:n,options:o}=e,{error:i}=await P(this.fetch,"POST",a,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:i}}else if("phone"in e){const{phone:r,type:n,options:o}=e,{data:i,error:l}=await P(this.fetch,"POST",a,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:i==null?void 0:i.message_id},error:l}}throw new _t("You must provide either an email or phone number and a type")}catch(a){if(A(a))return{data:{user:null,session:null},error:a};throw a}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async a=>a))}async _acquireLock(e,a){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await r,await a()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=a();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const a=await this.__loadSession();return await e(a)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const a=await ke(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",a),a!==null&&(this._isValidSession(a)?e=a:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<aa:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const i=await ke(this.userStorage,this.storageKey+"-user");i!=null&&i.user?e.user=i.user:e.user=sa()}if(this.storage.isServer&&e.user){let i=this.suppressGetSessionWarning;e=new Proxy(e,{get:(c,d,u)=>(!i&&d==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),i=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,d,u))})}return{data:{session:e},error:null}}const{data:n,error:o}=await this._callRefreshToken(e.refresh_token);return o?{data:{session:null},error:o}:{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await P(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ve}):await this._useSession(async a=>{var r,n,o;const{data:i,error:l}=a;if(l)throw l;return!(!((r=i.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ge}:await P(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&o!==void 0?o:void 0,xform:ve})})}catch(a){if(A(a))return Go(a)&&(await this._removeSession(),await ye(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:a};throw a}}async updateUser(e,a={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,a))}async _updateUser(e,a={}){try{return await this._useSession(async r=>{const{data:n,error:o}=r;if(o)throw o;if(!n.session)throw new ge;const i=n.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await Me(this.storage,this.storageKey));const{data:d,error:u}=await P(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:a==null?void 0:a.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:i.access_token,xform:ve});if(u)throw u;return i.user=d.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),{data:{user:i.user},error:null}})}catch(r){if(A(r))return{data:{user:null},error:r};throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ge;const a=Date.now()/1e3;let r=a,n=!0,o=null;const{payload:i}=na(e.access_token);if(i.exp&&(r=i.exp,n=r<=a),n){const{data:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!l)return{data:{user:null,session:null},error:null};o=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;o={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:r-a,expires_at:r},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(a){if(A(a))return{data:{session:null,user:null},error:a};throw a}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async a=>{var r;if(!e){const{data:i,error:l}=a;if(l)throw l;e=(r=i.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new ge;const{data:n,error:o}=await this._callRefreshToken(e.refresh_token);return o?{data:{user:null,session:null},error:o}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(a){if(A(a))return{data:{user:null,session:null},error:a};throw a}}async _getSessionFromURL(e,a){try{if(!V())throw new kt("No browser detected.");if(e.error||e.error_description||e.error_code)throw new kt(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(a){case"implicit":if(this.flowType==="pkce")throw new lr("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new kt("Not a valid implicit grant flow url.");break;default:}if(a==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new lr("No code detected.");const{data:x,error:T}=await this._exchangeCodeForSession(e.code);if(T)throw T;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:x.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:n,access_token:o,refresh_token:i,expires_in:l,expires_at:c,token_type:d}=e;if(!o||!l||!i||!d)throw new kt("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(l);let p=u+h;c&&(p=parseInt(c));const f=p-u;f*1e3<=He&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);const v=p-h;u-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,p,u):u-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,p,u);const{data:w,error:m}=await this._getUser(o);if(m)throw m;const y={provider_token:r,provider_refresh_token:n,access_token:o,expires_in:h,expires_at:p,refresh_token:i,token_type:d,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:e.type},error:null}}catch(r){if(A(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const a=await ke(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&a)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async a=>{var r;const{data:n,error:o}=a;if(o)return{error:o};const i=(r=n.session)===null||r===void 0?void 0:r.access_token;if(i){const{error:l}=await this.admin.signOut(i,e);if(l&&!(qo(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await ye(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const a=Xo(),r={id:a,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",a),this.stateChangeEmitters.delete(a)}};return this._debug("#onAuthStateChange()","registered callback with id",a),this.stateChangeEmitters.set(a,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(a)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async a=>{var r,n;try{const{data:{session:o},error:i}=a;if(i)throw i;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",e,"session",o)}catch(o){await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",o),console.error(o)}})}async resetPasswordForEmail(e,a={}){let r=null,n=null;this.flowType==="pkce"&&([r,n]=await Me(this.storage,this.storageKey,!0));try{return await P(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:a.captchaToken}},headers:this.headers,redirectTo:a.redirectTo})}catch(o){if(A(o))return{data:null,error:o};throw o}}async getUserIdentities(){var e;try{const{data:a,error:r}=await this.getUser();if(r)throw r;return{data:{identities:(e=a.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(a){if(A(a))return{data:null,error:a};throw a}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var a;try{const{data:r,error:n}=await this._useSession(async o=>{var i,l,c,d,u;const{data:h,error:p}=o;if(p)throw p;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(i=e.options)===null||i===void 0?void 0:i.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await P(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(d=h.session)===null||d===void 0?void 0:d.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return V()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),{data:{provider:e.provider,url:r==null?void 0:r.url},error:null}}catch(r){if(A(r))return{data:{provider:e.provider,url:null},error:r};throw r}}async linkIdentityIdToken(e){return await this._useSession(async a=>{var r;try{const{error:n,data:{session:o}}=a;if(n)throw n;const{options:i,provider:l,token:c,access_token:d,nonce:u}=e,h=await P(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=o==null?void 0:o.access_token)!==null&&r!==void 0?r:void 0,body:{provider:l,id_token:c,access_token:d,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:ae}),{data:p,error:f}=h;return f?{data:{user:null,session:null},error:f}:!p||!p.session||!p.user?{data:{user:null,session:null},error:new Ue}:(p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("USER_UPDATED",p.session)),{data:p,error:f})}catch(n){if(A(n))return{data:{user:null,session:null},error:n};throw n}})}async unlinkIdentity(e){try{return await this._useSession(async a=>{var r,n;const{data:o,error:i}=a;if(i)throw i;return await P(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:void 0})})}catch(a){if(A(a))return{data:null,error:a};throw a}}async _refreshAccessToken(e){const a=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(a,"begin");try{const r=Date.now();return await ri(async n=>(n>0&&await ai(200*Math.pow(2,n-1)),this._debug(a,"refreshing attempt",n),await P(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ae})),(n,o)=>{const i=200*Math.pow(2,n);return o&&ra(o)&&Date.now()+i-r<He})}catch(r){if(this._debug(a,"error",r),A(r))return{data:{session:null,user:null},error:r};throw r}finally{this._debug(a,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,a){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:a.redirectTo,scopes:a.scopes,queryParams:a.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",a,"url",r),V()&&!a.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,a;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const n=await ke(this.storage,this.storageKey);if(n&&this.userStorage){let i=await ke(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!i&&(i={user:n.user},await qe(this.userStorage,this.storageKey+"-user",i)),n.user=(e=i==null?void 0:i.user)!==null&&e!==void 0?e:sa()}else if(n&&!n.user&&!n.user){const i=await ke(this.storage,this.storageKey+"-user");i&&(i!=null&&i.user)?(n.user=i.user,await ye(this.storage,this.storageKey+"-user"),await qe(this.storage,this.storageKey,n)):n.user=sa()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),n!==null&&await this._removeSession();return}const o=((a=n.expires_at)!==null&&a!==void 0?a:1/0)*1e3-Date.now()<aa;if(this._debug(r,`session has${o?"":" not"} expired with margin of ${aa}s`),o){if(this.autoRefreshToken&&n.refresh_token){const{error:i}=await this._callRefreshToken(n.refresh_token);i&&(console.error(i),ra(i)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",i),await this._removeSession()))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:i,error:l}=await this._getUser(n.access_token);!l&&(i!=null&&i.user)?(n.user=i.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(i){console.error("Error getting user data:",i),this._debug(r,"error getting user data, skipping SIGNED_IN notification",i)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(r,"error",n),console.error(n);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var a,r;if(!e)throw new ge;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Gt;const{data:o,error:i}=await this._refreshAccessToken(e);if(i)throw i;if(!o.session)throw new ge;await this._saveSession(o.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const l={data:o.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(o){if(this._debug(n,"error",o),A(o)){const i={data:null,error:o};return ra(o)||await this._removeSession(),(a=this.refreshingDeferred)===null||a===void 0||a.resolve(i),i}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(o),o}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,a,r=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",a,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:a});const o=[],i=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,a)}catch(c){o.push(c)}});if(await Promise.all(i),o.length>0){for(let l=0;l<o.length;l+=1)console.error(o[l]);throw o[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const a=Object.assign({},e),r=a.user&&a.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&a.user&&await qe(this.userStorage,this.storageKey+"-user",{user:a.user});const n=Object.assign({},a);delete n.user;const o=pr(n);await qe(this.storage,this.storageKey,o)}else{const n=pr(a);await qe(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),await ye(this.storage,this.storageKey),await ye(this.storage,this.storageKey+"-code-verifier"),await ye(this.storage,this.storageKey+"-user"),this.userStorage&&await ye(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&V()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(a){console.error("removing visibilitychange callback failed",a)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),He);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async a=>{const{data:{session:r}}=a;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((r.expires_at*1e3-e)/He);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${He}ms, refresh threshold is ${Ta} ticks`),n<=Ta&&await this._callRefreshToken(r.refresh_token)})}catch(a){console.error("Auto refresh tick failed with error. This is likely a transient error.",a)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof sn)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!V()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const a=`#_onVisibilityChanged(${e})`;this._debug(a,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(a,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,a,r){const n=[`provider=${encodeURIComponent(a)}`];if(r!=null&&r.redirectTo&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[o,i]=await Me(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(i)}`});n.push(l.toString())}if(r!=null&&r.queryParams){const o=new URLSearchParams(r.queryParams);n.push(o.toString())}return r!=null&&r.skipBrowserRedirect&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async a=>{var r;const{data:n,error:o}=a;return o?{data:null,error:o}:await P(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token})})}catch(a){if(A(a))return{data:null,error:a};throw a}}async _enroll(e){try{return await this._useSession(async a=>{var r,n;const{data:o,error:i}=a;if(i)return{data:null,error:i};const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:c,error:d}=await P(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(r=o==null?void 0:o.session)===null||r===void 0?void 0:r.access_token});return d?{data:null,error:d}:(e.factorType==="totp"&&c.type==="totp"&&(!((n=c==null?void 0:c.totp)===null||n===void 0)&&n.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(a){if(A(a))return{data:null,error:a};throw a}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async a=>{var r;const{data:n,error:o}=a;if(o)return{data:null,error:o};const i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Ci(e.webauthn.credential_response):$i(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:c}=await P(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token});return c?{data:null,error:c}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),{data:l,error:c})})}catch(a){if(A(a))return{data:null,error:a};throw a}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async a=>{var r;const{data:n,error:o}=a;if(o)return{data:null,error:o};const i=await P(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token});if(i.error)return i;const{data:l}=i;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:Ii(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:Ri(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(A(a))return{data:null,error:a};throw a}})}async _challengeAndVerify(e){const{data:a,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:a.id,code:e.code})}async _listFactors(){var e;const{data:{user:a},error:r}=await this.getUser();if(r)return{data:null,error:r};const n={all:[],phone:[],totp:[],webauthn:[]};for(const o of(e=a==null?void 0:a.factors)!==null&&e!==void 0?e:[])n.all.push(o),o.status==="verified"&&n[o.factor_type].push(o);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var a,r;const{data:{session:n},error:o}=e;if(o)return{data:null,error:o};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:i}=na(n.access_token);let l=null;i.aal&&(l=i.aal);let c=l;((r=(a=n.user.factors)===null||a===void 0?void 0:a.filter(h=>h.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(c="aal2");const u=i.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:u},error:null}}))}async fetchJwk(e,a={keys:[]}){let r=a.keys.find(l=>l.kid===e);if(r)return r;const n=Date.now();if(r=this.jwks.keys.find(l=>l.kid===e),r&&this.jwks_cached_at+Wo>n)return r;const{data:o,error:i}=await P(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=n,r=o.keys.find(l=>l.kid===e),!r)?null:r}async getClaims(e,a={}){try{let r=e;if(!r){const{data:f,error:v}=await this.getSession();if(v||!f.session)return{data:null,error:v};r=f.session.access_token}const{header:n,payload:o,signature:i,raw:{header:l,payload:c}}=na(r);a!=null&&a.allowExpired||ci(o.exp);const d=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,a!=null&&a.keys?{keys:a.keys}:a==null?void 0:a.jwks);if(!d){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:o,header:n,signature:i},error:null}}const u=ui(n.alg),h=await crypto.subtle.importKey("jwk",d,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,i,Zo(`${l}.${c}`)))throw new ja("Invalid JWT signature");return{data:{claims:o,header:n,signature:i},error:null}}catch(r){if(A(r))return{data:null,error:r};throw r}}}mt.nextInstanceID=0;const qi=mt;class Gi extends qi{constructor(e){super(e)}}var zi=function(t,e,a,r){function n(o){return o instanceof a?o:new a(function(i){i(o)})}return new(a||(a=Promise))(function(o,i){function l(u){try{d(r.next(u))}catch(h){i(h)}}function c(u){try{d(r.throw(u))}catch(h){i(h)}}function d(u){u.done?o(u.value):n(u.value).then(l,c)}d((r=r.apply(t,e||[])).next())})};class Ki{constructor(e,a,r){var n,o,i;this.supabaseUrl=e,this.supabaseKey=a;const l=Lo(e);if(!a)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const c=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:Eo,realtime:Ao,auth:Object.assign(Object.assign({},No),{storageKey:c}),global:So},u=Do(r??{},d);this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(o=u.global.headers)!==null&&o!==void 0?o:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(h,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((i=u.auth)!==null&&i!==void 0?i:{},this.headers,u.global.fetch),this.fetch=Ro(a,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.rest=new Ws(new URL("rest/v1",l).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new _o(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new xs(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,a={},r={}){return this.rest.rpc(e,a,r)}channel(e,a={config:{}}){return this.realtime.channel(e,a)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){return zi(this,void 0,void 0,function*(){var e,a;if(this.accessToken)return yield this.accessToken();const{data:r}=yield this.auth.getSession();return(a=(e=r.session)===null||e===void 0?void 0:e.access_token)!==null&&a!==void 0?a:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:a,detectSessionInUrl:r,storage:n,userStorage:o,storageKey:i,flowType:l,lock:c,debug:d},u,h){const p={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Gi({url:this.authUrl.href,headers:Object.assign(Object.assign({},p),u),storageKey:i,autoRefreshToken:e,persistSession:a,detectSessionInUrl:r,storage:n,userStorage:o,flowType:l,lock:c,debug:d,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new so(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((a,r)=>{this._handleTokenChanged(a,"CLIENT",r==null?void 0:r.access_token)})}_handleTokenChanged(e,a,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const Ji=(t,e,a)=>new Ki(t,e,a);function Yi(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Yi()&&console.warn("âš ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Vi="https://ftwlzdhkzqfuosdorgjt.supabase.co",Zi="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ0d2x6ZGhrenFmdW9zZG9yZ2p0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzE1Mjc0MzksImV4cCI6MjA0NzEwMzQzOX0.msaWtaLGNMDiyuxIOFDwULWee0nqcM7p_LAYWB14j1k",L=Ji(Vi,Zi,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),Qi=b.createContext({user:null,isAdmin:!1,loading:!0,signIn:async()=>{},signOut:async()=>{}}),ia="ben@phippsmusic.com";function Xi({children:t}){const[e,a]=b.useState(null),[r,n]=b.useState(!1),[o,i]=b.useState(!0);b.useEffect(()=>{L.auth.getSession().then(({data:{session:u}})=>{u!=null&&u.user&&(a({id:u.user.id,email:u.user.email||""}),n(u.user.email===ia)),i(!1)});const{data:{subscription:d}}=L.auth.onAuthStateChange((u,h)=>{h!=null&&h.user?(a({id:h.user.id,email:h.user.email||""}),n(h.user.email===ia)):(a(null),n(!1)),i(!1)});return()=>{d.unsubscribe()}},[]);const l=async(d,u)=>{i(!0);try{const{data:h,error:p}=await L.auth.signInWithPassword({email:d,password:u});if(p)throw p;if(h.user.email!==ia)throw await L.auth.signOut(),new Error("Unauthorized access");a({id:h.user.id,email:h.user.email}),n(!0)}catch(h){throw console.error("Sign in failed:",h),h}finally{i(!1)}},c=async()=>{try{await L.auth.signOut(),a(null),n(!1)}catch(d){throw console.error("Sign out failed:",d),d}};return s.jsx(Qi.Provider,{value:{user:e,isAdmin:r,loading:o,signIn:l,signOut:c},children:t})}/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var el={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tl=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),C=(t,e)=>{const a=b.forwardRef(({color:r="currentColor",size:n=24,strokeWidth:o=2,absoluteStrokeWidth:i,className:l="",children:c,...d},u)=>b.createElement("svg",{ref:u,...el,width:n,height:n,stroke:r,strokeWidth:i?Number(o)*24/Number(n):o,className:["lucide",`lucide-${tl(t)}`,l].join(" "),...d},[...e.map(([h,p])=>b.createElement(h,p)),...Array.isArray(c)?c:[c]]));return a.displayName=`${t}`,a};/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ue=C("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const al=C("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const he=C("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gt=C("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fa=C("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rl=C("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const st=C("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cn=C("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const un=C("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nl=C("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sl=C("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hn=C("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ol=C("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const il=C("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ie=C("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ll=C("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dl=C("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cl=C("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fe=C("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zt=C("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ul=C("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hl=C("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rt=C("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pn=C("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fn=C("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sa=C("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kt=C("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jt=C("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const et=C("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.344.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pl=C("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);class yn extends b.Component{constructor(){super(...arguments);te(this,"state",{hasError:!1,error:null});te(this,"handleRetry",()=>{window.location.reload()})}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,r){console.error("Uncaught error:",a,r)}render(){var a,r;if(this.state.hasError){const o=((a=this.state.error)==null?void 0:a.message.includes("Supabase"))?"Unable to connect to the database. Please check your connection and try again.":"Something went wrong. Please try refreshing the page.";return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 p-4",children:s.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-lg max-w-md w-full",children:[s.jsxs("div",{className:"flex items-center gap-3 text-red-600 mb-4",children:[s.jsx(al,{className:"w-6 h-6"}),s.jsx("h2",{className:"text-lg font-semibold",children:"Error"})]}),s.jsx("p",{className:"text-gray-600 mb-4",children:o}),((r=this.state.error)==null?void 0:r.message)&&s.jsx("pre",{className:"bg-gray-50 p-3 rounded text-sm text-gray-700 mb-4 overflow-auto",children:this.state.error.message}),s.jsxs("button",{onClick:this.handleRetry,className:"w-full bg-red-600 text-white py-2 rounded-lg hover:bg-red-700 transition-colors flex items-center justify-center gap-2",children:[s.jsx(hl,{className:"w-4 h-4"}),"Retry"]})]})})}return this.props.children}}function $e(){const[t,e]=b.useState([]),[a,r]=b.useState(!0),[n,o]=b.useState(null);return b.useEffect(()=>{async function i(){try{r(!0),o(null);const{data:l,error:c}=await L.from("genres").select("*").order("display_order");if(c)throw c;const{data:d,error:u}=await L.from("sub_genres").select("*").order("name");if(u)throw u;const h=l.map(p=>({...p,subGenres:d.filter(f=>f.genre_id===p.id).map(f=>({id:f.id,name:f.name,description:f.description}))}));e(h)}catch(l){console.error("Failed to fetch genres:",l),o(l instanceof Error?l:new Error("Failed to fetch genres"))}finally{r(!1)}}i()},[]),{genres:t,loading:a,error:n}}function ft(t){return t?t.toLowerCase().includes("r&b")?"rnb-soul":t.toString().toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,""):""}function Ge(){const t=new Date;return`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`}function z(t){let e=0;for(let a=0;a<t.length;a++){const r=t.charCodeAt(a);e=(e<<5)-e+r,e=e&e}return e}function fl({onClose:t}){const{genres:e,loading:a}=$e();if(a)return s.jsx("div",{className:"p-6",children:s.jsx("div",{className:"grid grid-cols-3 gap-4",children:[...Array(6)].map((n,o)=>s.jsx("div",{className:"h-12 bg-gray-100 rounded-lg animate-pulse"},`skeleton-${o}`))})});const r=e.reduce((n,o,i)=>{const l=Math.floor(i/Math.ceil(e.length/3));return n[l]||(n[l]=[]),n[l].push(o),n},[]);return s.jsxs("div",{className:"p-6",children:[s.jsxs(I,{to:"/genres",onClick:t,className:"flex items-center gap-2 p-3 mb-4 text-gray-600 hover:text-green-600 hover:bg-gray-50 rounded-lg transition-colors",children:[s.jsx(il,{className:"w-5 h-5"}),s.jsx("span",{className:"font-medium",children:"View All Genres & Sub-genres"})]}),s.jsx("div",{className:"grid grid-cols-3 gap-6",children:r.map((n,o)=>s.jsx("div",{className:"space-y-1",children:n.map(i=>s.jsxs(I,{to:`/genre/${ft(i.name)}`,onClick:t,className:"flex items-center gap-2 p-3 rounded-lg hover:bg-gray-50 text-gray-900 group",children:[s.jsx("div",{className:"p-1.5 bg-gray-50 rounded group-hover:bg-green-50 transition-colors",children:s.jsx(fe,{className:"w-4 h-4 text-gray-500 group-hover:text-green-600"})}),s.jsx("span",{className:"font-medium",children:i.name})]},i.id))},o))})]})}function Z(){const t=Mt(),e=Re(),[a,r]=b.useState(!1),[n,o]=b.useState(!1),i=b.useRef();b.useRef(null);const l=t.pathname.startsWith("/submit"),c=()=>{i.current&&clearTimeout(i.current),r(!0)},d=()=>{i.current=setTimeout(()=>{r(!1)},300)};b.useEffect(()=>{o(!1)},[t.pathname]),b.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const u=()=>{e("/playlists",{state:{focusSearch:!0}})};return s.jsx("header",{className:"bg-gradient-to-r from-green-500 to-green-600 text-white relative z-50",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"flex justify-between items-center h-16",children:[s.jsxs(I,{to:"/",className:"flex items-center gap-2 sm:gap-3 hover:opacity-90 transition-opacity",children:[s.jsx(zt,{className:"w-6 h-6 sm:w-8 sm:h-8 flex-shrink-0"}),s.jsx("h1",{className:"text-lg sm:text-2xl font-bold whitespace-nowrap",children:"Playlist Partner"})]}),s.jsxs("div",{className:"md:hidden flex items-center gap-2",children:[s.jsx("button",{onClick:u,className:"p-2 hover:bg-white/10 rounded-lg","aria-label":"Search",children:s.jsx(Rt,{className:"w-6 h-6"})}),!l&&s.jsx(I,{to:"/submit",className:"flex items-center gap-2 bg-white text-green-600 px-4 py-2 rounded-lg hover:bg-green-50 transition-colors",children:"Submit"}),s.jsx("button",{onClick:()=>o(!n),className:"p-2 hover:bg-white/10 rounded-lg","aria-label":"Toggle menu",children:n?s.jsx(et,{className:"w-6 h-6"}):s.jsx(dl,{className:"w-6 h-6"})})]}),s.jsxs("div",{className:"hidden md:flex items-center gap-6",children:[s.jsxs("button",{onClick:u,className:"flex items-center gap-2 px-4 py-2 bg-white/10 backdrop-blur-sm text-white/90 rounded-lg border border-white/20 hover:bg-white/20 hover:border-white/40 transition-all",children:[s.jsx(Rt,{className:"w-4 h-4"}),s.jsx("span",{className:"text-sm",children:"Search playlists..."})]}),s.jsx(I,{to:"/playlists",className:"flex items-center gap-2 text-white hover:text-white/90 transition-colors py-2 px-3 -ml-3",children:"Browse Playlists"}),s.jsxs("div",{onMouseEnter:c,onMouseLeave:d,className:"relative",children:[s.jsx(I,{to:"/genres",className:"flex items-center gap-2 text-white hover:text-white/90 transition-colors py-2 px-3 -ml-3",children:"Browse Genres"}),a&&s.jsxs("div",{className:"absolute top-full right-0 w-[800px] bg-white shadow-xl rounded-lg mt-1",children:[s.jsx("div",{className:"absolute h-3 -top-3 inset-x-0"}),s.jsx(fl,{onClose:()=>r(!1)})]})]}),s.jsx(I,{to:"/for-curators",className:"flex items-center gap-2 text-white hover:text-white/90 transition-colors py-2 px-3 -ml-3",children:"For Curators"}),s.jsx(I,{to:"/about",className:"flex items-center gap-2 text-white hover:text-white/90 transition-colors py-2 px-3 -ml-3",children:"About"}),s.jsx(I,{to:"/blog",className:"flex items-center gap-2 text-white hover:text-white/90 transition-colors py-2 px-3 -ml-3",children:"Blog"}),!l&&s.jsx(I,{to:"/submit",className:"flex items-center gap-2 bg-white text-green-600 px-4 py-2 rounded-lg hover:bg-green-50 transition-colors",children:"Submit Track"})]})]}),n&&s.jsx("div",{className:"md:hidden border-t border-white/10",children:s.jsxs("nav",{className:"py-4 space-y-2",children:[s.jsx(I,{to:"/playlists",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>o(!1),children:"Browse Playlists"}),s.jsx(I,{to:"/genres",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>o(!1),children:"Browse Genres"}),s.jsx(I,{to:"/for-curators",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>o(!1),children:"For Curators"}),s.jsx(I,{to:"/about",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>o(!1),children:"About"}),s.jsx(I,{to:"/blog",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>o(!1),children:"Blog"})]})})]})})}function Q(){const{genres:t}=$e();return s.jsx("footer",{className:"bg-gray-900 text-gray-300 mt-auto",children:s.jsxs("div",{className:"container mx-auto px-4 py-12",children:[s.jsxs("div",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx(zt,{className:"w-8 h-8"}),s.jsx("h2",{className:"text-2xl font-bold",children:"Playlist Partner"})]}),s.jsx("p",{className:"text-gray-400 max-w-2xl",children:"Artists have made over 100,000+ successful submissions through Playlist Partner. No barriers, no fees—just music finding its rightful audience. Your next fan is waiting."})]}),s.jsxs("div",{className:"border-t border-gray-800 pt-8",children:[s.jsx("h3",{className:"text-lg font-semibold mb-6",children:"Browse Genres"}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-x-4 gap-y-3",children:t.map(e=>s.jsx(I,{to:`/genre/${e.slug}`,className:"text-gray-400 hover:text-green-500 transition-colors",children:e.name},e.id))})]}),s.jsx("div",{className:"border-t border-gray-800 mt-12 pt-8 text-center text-sm text-gray-500",children:s.jsxs("p",{children:["© ",new Date().getFullYear()," PlaylistPartner. All rights reserved."]})})]})})}function le({title:t,description:e,image:a="https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png",url:r,type:n="website",noIndex:o=!1,playlist:i,article:l,structuredData:c}){var v;const d=i?`Submit Music to ${i.name} - Free Spotify Playlist Submission`:t||"Free Spotify Playlist Submission – No Signup | PlaylistPartner",u=i?`Get your music featured on ${i.name}, a Spotify playlist curated by ${i.curator_name} with ${i.followers.toLocaleString()} followers. No account needed! Access ${((v=i.genre_count)==null?void 0:v.toLocaleString())||"thousands of"} ${i.genre||"playlists"} and connect with curators on PlaylistPartner.com.`:"Submit your music to thousands of independent Spotify playlist curators for free. No signup required—connect with curators and grow your audience today with PlaylistPartner.",h=e||u,p=r||window.location.href.split("?")[0],f=window.location.origin;return s.jsxs(ys,{children:[s.jsx("title",{children:d}),s.jsx("meta",{name:"description",content:h,"data-react-helmet":"true"}),s.jsx("link",{rel:"canonical",href:p}),s.jsx("meta",{name:"robots",content:o?"noindex, nofollow":"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"}),s.jsx("meta",{property:"og:site_name",content:"PlaylistPartner"}),s.jsx("meta",{property:"og:title",content:d,"data-react-helmet":"true"}),s.jsx("meta",{property:"og:description",content:h,"data-react-helmet":"true"}),s.jsx("meta",{property:"og:type",content:n}),s.jsx("meta",{property:"og:url",content:p}),s.jsx("meta",{property:"og:image",content:a,"data-react-helmet":"true"}),s.jsx("meta",{property:"og:image:width",content:"1200"}),s.jsx("meta",{property:"og:image:height",content:"630"}),s.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),s.jsx("meta",{name:"twitter:title",content:d,"data-react-helmet":"true"}),s.jsx("meta",{name:"twitter:description",content:h,"data-react-helmet":"true"}),s.jsx("meta",{name:"twitter:image",content:a,"data-react-helmet":"true"}),s.jsx("meta",{name:"twitter:site",content:"@playlistpartner"}),l&&s.jsxs(s.Fragment,{children:[s.jsx("meta",{property:"article:published_time",content:l.publishedTime}),l.modifiedTime&&s.jsx("meta",{property:"article:modified_time",content:l.modifiedTime}),l.author&&s.jsx("meta",{property:"article:author",content:l.author}),l.section&&s.jsx("meta",{property:"article:section",content:l.section})]}),s.jsx("script",{type:"application/ld+json",children:JSON.stringify(c||{"@context":"https://schema.org","@type":"WebSite",name:"PlaylistPartner",url:f,inLanguage:"en-US",description:"Submit your music to thousands of independent Spotify playlist curators for free. No signup required—connect with curators and grow your audience today with PlaylistPartner.",publisher:{"@type":"Organization",name:"PlaylistPartner",logo:{"@type":"ImageObject",url:"https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public//playlist%20partner%20logo%20square.png",width:"500",height:"500"}},potentialAction:{"@type":"ViewAction",target:p}})})]})}const Ct="last_submission_data",yl=30*24*60*60*1e3;function mn(t){try{const e={artistName:t.artistName,email:t.email,lastTrack:t.track,lastUpdated:Date.now()};localStorage.setItem(Ct,JSON.stringify(e))}catch(e){console.error("Failed to save submission data:",e)}}function Ze(){try{const t=localStorage.getItem(Ct);if(!t)return null;const e=JSON.parse(t);return Date.now()-e.lastUpdated>yl?(localStorage.removeItem(Ct),null):{artistName:e.artistName,email:e.email,lastTrack:e.lastTrack}}catch(t){return console.error("Failed to retrieve submission data:",t),null}}function gn(){try{localStorage.removeItem(Ct),localStorage.removeItem("trackSubmissions"),localStorage.removeItem("playlist_submissions"),localStorage.removeItem("spotify_token"),sessionStorage.clear()}catch(t){console.error("Failed to reset storage data:",t)}}const Wa=[{id:"1J687xGAR77U3bLOgZy6rQ",title:"Spotify's CEO is out + Amazon's monthly Wrapped",slug:"spotifys-ceo-is-out-amazons-monthly-wrapped",body:{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Bypass: Music Industry News for Independent Artists",nodeType:"text"}],nodeType:"heading-1"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"Friday edition - 3 min read",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Ek Finally Reads the Room, Steps Back",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What's Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"So what did it, Ek? The artist exodus? The AI fiasco? Spotify CEO Daniel Ek is stepping back from the heat. Come January 2026, he'll be Executive Chairman while two longtime execs (Gustav Söderström and Alex Norström) become co-CEOs. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"With Spotify being THE biggest music streaming platform in the world (unfortunately), leadership changes could affect your payouts, your visibility, everything. The timing’s sus, though. The announcement dropped the same day Sylvan Esso pulled their entire catalog (that’s nearly 1 billion streams) from Spotify. They’re not the first, though—artists have been jumping ship over Ek's investments in defense tech company Helsing.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Diversify yesterday. You need to be in a position where you can drop Spotify like a bad habit if you have to. Söderström and Norström have been running things since 2023, so it might be the same old rodeo. Either way, don’t keep all your streams in one pool.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://techcrunch.com/2025/09/30/spotifys-founder-and-ceo-daniel-ek-is-stepping-down/"},content:[{data:{},marks:[{type:"underline"}],value:"[Full story at TechCrunch]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Amazon Music Insights: Wrapped, But Monthly",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What’s Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Guess who just rolled out Wrapped, I mean, ",nodeType:"text"},{data:{},marks:[{type:"italic"}],value:"Insights",nodeType:"text"},{data:{},marks:[],value:". Amazon Music is finally catching up with every other streaming platform, launching recaps showing fans their top artists and songs. But here’s the twist: instead of it being at the end of every year, it’s every month.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"You know that friend who won't shut up about an artist until you finally cave and listen? You need those fans. Every time that fan shares their Insight on Instagram, that's free promo. They do all the footwork and can reach followers you otherwise wouldn’t. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Download the Amazon Music app, check your own Insights (tap LIBRARY, then the Insights icon), then start encouraging fans to share theirs. Repost their highlights, shout out your top listeners, make it a thing. This is how you turn casual listeners into superfans.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://www.hypebot.com/hypebot/2025/10/amazon-music-insights-are-a-win-for-artists-and-fans.html"},content:[{data:{},marks:[{type:"underline"}],value:"[Read more on Hypebot]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"The White House Wants Your Take On AI… No, Really",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What's Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Someone’s finally listening to indies, and it’s not just their music. The White House opened a Request for Information on AI regulation, and the best part is, anyone can submit comments. Deadline: October 27, 2025.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"For once, you get a seat at the table ",nodeType:"text"},{data:{},marks:[{type:"italic"}],value:"before",nodeType:"text"},{data:{},marks:[],value:" the laws are written. The White House doesn’t do this often, so here are three things you need them to hear: (1) AI companies need to tell us what they stole – sorry, “trained onâ€. (2) Give us a real opt-out system, no BS. (3) “We need to beat China†won’t cut it this time. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Plot twist: the government just shut down (no funding = no accepting comments, I guess). But don’t let that stop you. Set a reminder for October 20 so you don't forget the October 27 deadline. Remember to bookmark ",nodeType:"text"},{data:{uri:"https://www.federalregister.gov/documents/2025/09/26/2025-18737/notice-of-request-for-information-regulatory-reform-on-artificial-intelligence"},content:[{data:{},marks:[{type:"underline"}],value:"this link",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:". Ten minutes could be the difference between you getting your songs protected and AI companies being protected.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://www.hypebot.com/hypebot/2025/10/artists-voice-your-opinion-in-white-houses-rfi-on-future-ai-regulation.html"},content:[{data:{},marks:[{type:"underline"}],value:"[Read more on Hypebot]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"While You Were Making Music...",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:"🤦â€â™‚ï¸ ",nodeType:"text"},{data:{uri:"https://www.billboard.com/pro/rod-wave-last-lap-tour-lawsuit-promoter-sues-advance/"},content:[{data:{},marks:[{type:"underline"}],value:`Google wants AI regulators to "oversee outputs, not inputs" [translation: don't look at what we stole, look at what users made instead] `,nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"📊 ",nodeType:"text"},{data:{uri:"https://www.hypebot.com/hypebot/2025/10/global-music-revenue-grew-first-half-of-2025.html"},content:[{data:{},marks:[{type:"underline"}],value:"Global music revenue hit $18.3B in H1 2025, but DSPs are grabbing more value than artists [what? DSPs were screwing artists all this time? No…] ",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"âš–ï¸ ",nodeType:"text"},{data:{uri:"https://www.billboard.com/pro/rod-wave-last-lap-tour-lawsuit-promoter-sues-advance/"},content:[{data:{},marks:[{type:"underline"}],value:"Rod Wave keeping $27M in tour advances for shows he didn't do [your daily reminder to read contracts before buying jets]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"Today's edition by Jordan F.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"For indies who ship music, not excuses.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"document"},excerpt:"Spotify CEO Daniel Ek transitions to Executive Chairman role amid artist exodus over defense investments. Amazon Music launches monthly Insights feature while White House opens public comments on AI regulation affecting musicians. Key updates for independent artists.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/01qlDA9O6BXPn1fZ94WF90/7cc52425ccf9dbd2be47fae78d2739ff/Spotifys_CEO_is_out___Amazons_monthly_Wrapped.jpg",title:"Bypass newsletter header about Spotify CEO changes and Amazon Music monthly Wrapped feature"},publishDate:"2025-10-03T00:00-07:00",featured:!1,createdAt:"2025-10-04T00:37:46.694Z",updatedAt:"2025-10-04T00:37:46.694Z"},{id:"pueMapCf2q8qbKltJfHia",title:"Bypass: You could pay rent with music soon?! + Spotify fights AI",slug:"bypass-you-could-pay-rent-with-music-soon-spotify-fights-ai",body:{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Bypass: Music Industry News for Independent Artists",nodeType:"text"}],nodeType:"heading-1"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"Wednesday edition - 3 min read",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:`Spotify Fights AI Slop `,nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What's Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Seems like all the criticism finally got to Spotify. They just announced they’ve removed 75 million AI spam tracks in the past year. All that slop was and is diluting YOUR royalty pool. Now they’re rolling out a new spam filter this fall that’ll tag bad uploads and stop recommending them to listeners. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"The spam filter matters, but Spotify’s also taking “content mismatch†seriously (finally). This is a long-standing issue with Spotify, where randos can upload slop straight to your Spotify profile. If you’ve been a victim, you know how frustrating this gets. It seriously tanks your stats because listeners are confused about the quality of your music.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Been impersonated? Then these new policies from Spotify might help you. They claim they’re “reducing wait times†for content mismatch forms - but we’ll have to see about that. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://musically.com/2025/09/25/spotify-reveals-its-latest-measures-to-handle-ai-music/"},content:[{data:{},marks:[{type:"underline"}],value:"[Read more on HypeBot]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Being an Indie Artist Could Actually Pay",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What’s Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Throw away those aprons, Rep. Rashida Tlaib just reintroduced the Living Wage for Musicians Act, which would set a penny per stream minimum. Right now, streaming is 84% of recorded music revenue but artists only make fractions of pennies after everyone takes their cut.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Streaming platforms would have to add 50% of subscription fees (capped at $4-$10) plus 10% of ad revenue into a fund that pays you directly. Currently, you need 800K monthly streams just to make $15/hr. With this bill, you’ll get to live every musician's dream: finally paying rent.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Look, congress loves big tech more than struggling artists. So put some pressure on them by writing your congressional representative and asking them to co-sponsor the bill. Reps. Ocasio-Cortez, Omar, Thompson, and Ramirez already signed on. Even if it dies in committee (because let’s be real here), momentum matters for the next attempt.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://musically.com/2025/08/19/living-wage-for-musicians-act-to-be-reintroduced-in-us-congress/"},content:[{data:{},marks:[{type:"underline"}],value:"[Read more on Music Ally]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Facebook Launches Free Fan-Building Tools",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What's Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Facebook. That’s a name you wouldn’t think would pop up in music discovery. Meta recently launched free fan-building tools, one of which is Fan Challenges—a potential game changer (what's your game, Zuck?).",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Facebook isn’t just for grandmas posting wholesome memes. Meta’s betting on creator tools now - and Fan Challenges is honestly a great idea. It lets you encourage covers or remixes. That right there is organic growth. And with TikTok’s ownership still in limbo, betting your entire fanbase on one platform looks riskier every day.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Launch a Fan Challenge this week with the right hashtags. They are live on your Facebook page right now - just sign in.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:" ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://www.hypebot.com/hypebot/2025/09/facebook-marketing-for-musicians-new-tools.html"},content:[{data:{},marks:[{type:"underline"}],value:"[Read more on HypeBot]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"While You Were Making Music...",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:"🤖",nodeType:"text"},{data:{uri:"https://www.musicbusinessworldwide.com/universal-and-sony-music-partner-with-new-platform-to-detect-ai-music-copyright-theft-using-groundbreaking-neural-fingerprinting-technology/"},content:[{data:{},marks:[{type:"underline"}],value:"Universal and Sony launch AI detection tool [great to see major record labels protecting… major labels]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"📱 ",nodeType:"text"},{data:{uri:"https://www.hypebot.com/hypebot/2025/09/intagram-tops-3-billion-users-and-points-to-a-future-where-reel-and-dms-dominate.html"},content:[{data:{},marks:[{type:"underline"}],value:"Instagram hits 3 billion users as Reels and DMs dominate [somehow still not as useful as a 2014 SoundCloud comment section]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"👕 ",nodeType:"text"},{data:{uri:"https://www.musicbusinessworldwide.com/why-lawsuits-over-counterfeit-merch-are-on-the-rise/"},content:[{data:{},marks:[{type:"underline"}],value:"Counterfeit merch lawsuits are exploding [DUCK!!! There are suits flying here, there and everywhere]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"Today's edition by Jordan F.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"For indies who ship music, not excuses.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"}],nodeType:"document"},excerpt:"Spotify removes 75 million AI spam tracks and launches new filter. Living Wage for Musicians Act proposes penny-per-stream minimum while Facebook debuts Fan Challenges tool. Essential updates for independent artists navigating streaming economics and platform changes.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/pDV1GjRAh4JgWp0vARYNh/6e106121e219d3c5a49c0e01a626647a/Your_paragraph_text.jpg",title:"Bypass newsletter header about music streaming pay rates and Spotify AI spam filter"},publishDate:"2025-10-01T00:00-07:00",featured:!1,createdAt:"2025-10-01T12:30:55.093Z",updatedAt:"2025-10-01T12:30:55.093Z"},{id:"2A7avBY5cKakFWpYj2v8uh",title:"Bypass: YouTube's new tools + fan conversion + data rights",slug:"bypass-youtubes-new-tools-fan-conversion-data-rights",body:{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Bypass: Music Industry News for Independent Artists",nodeType:"text"}],nodeType:"heading-1"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"Friday edition - 2 min read",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"YouTube Music Launches Superfan Tools (Finally)",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What's Up",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"YouTube finally caught up with its launch of countdown timers for your releases, exclusive thank-you videos for top fans, and merch drop features.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"For indies, super fans are 100x more valuable than casual listeners. Right now, YouTube is letting artists take advantage of that. Their new tools let you reward your biggest supporters with exclusive content and early access. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:"Set up your YouTube Music for Artists account if you haven't already. Start setting up countdown timers for your next releases and plan exclusive thank-you videos for your most engaged fans. Superfans are like your own unpaid marketing team, so give them a little something special from time to time.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://www.musicbusinessworldwide.com/youtube-music-launches-new-tools-to-connect-artists-with-superfans/"},content:[{data:{},marks:[{type:"underline"}],value:"[Read more on MusicBusiness Worldwide]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"The Fan Conversion Toolkit: Temple by Groover",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What’s Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"New tool alert: Temple by Groover is a new suite of digital tools that help you reach new listeners, engage with your fanbase, and centralize all your music, merch and social links ",nodeType:"text"},{data:{},marks:[{type:"italic"}],value:"(cool name, by the way; Amazon, take notes)",nodeType:"text"},{data:{},marks:[],value:".",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Let’s be honest, getting streams is the easy part; getting actual fans is a whole other ball game. You might have thousands of monthly listeners, but how many email addresses do you have? Temple gives you microsites, email captures, and advertising tools to own your audience.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Check out Temple by Groover, especially if you’re already using Groover for playlist promotion. Start with their link-in-bio microsites to consolidate everything in one place. If you want a stable music career, relying on algorithms alone won’t cut it.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://www.hypebot.com/hypebot/2025/09/temple-by-groover-new-tools-help-indie-artists-grow-an-audience.html"},content:[{data:{},marks:[{type:"underline"}],value:"[Read more on Hypebot]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"OpenPlay vs. The Data Kidnappers",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"What's Up",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"This rights management platform is raising millions. Sounds boring, but this is huge for indies. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"So What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"You know that nightmare where someone steals your keys to keep you locked outside your car, and you can't just leave without it, so you're stuck there? No? Well, it's the same thing distributors do. If you've been through this, you know how brutal it gets. OpenPlay is fighting the scummy behavior of distributors who trap you with your own data. ",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Now What",nodeType:"text"}],nodeType:"heading-3"},{data:{},content:[{data:{},marks:[],value:` `,nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Start asking serious questions if you’re taking your music career seriously – who’s controlling my data right now? If you don't know, that's exactly what OpenPlay is solving. Word is they’re dropping new tools soon.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"",nodeType:"text"},{data:{uri:"https://musically.com/2025/09/16/openplay-raises-a-new-multi-million-dollar-funding-round/"},content:[{data:{},marks:[{type:"underline"}],value:"[Full story at Music Ally]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"While You Were Making Music...",nodeType:"text"}],nodeType:"heading-2"},{data:{},content:[{data:{},marks:[],value:"📰 ",nodeType:"text"},{data:{uri:"https://www.billboard.com/pro/xania-monet-ai-artist-million-dollar-record-deal-what-mean/"},content:[{data:{},marks:[{type:"underline"}],value:"Xania Monet (AI artist) signs million-dollar record deal [wait, how would concerts work?]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"🔊 ",nodeType:"text"},{data:{uri:"https://www.digitalmusicnews.com/2025/09/18/kali-uchis-pulls-d4vd-collab/"},content:[{data:{},marks:[{type:"underline"}],value:"Kali Uchis pulls D4vd collaboration [when features go wrong]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"ðŸƒâ€â™€ï¸ ",nodeType:"text"},{data:{uri:"https://www.billboard.com/pro/poppy-amy-lee-courtney-laplante-end-of-you-hard-rock-songs/"},content:[{data:{},marks:[{type:"underline"}],value:"Poppy collaborates with Amy Lee and Courtney LaPlante [talk about a generational run]",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"bold"}],value:"One Thing To Do Today: ",nodeType:"text"},{data:{uri:"https://labs.spitfireaudio.com/"},content:[{data:{},marks:[{type:"underline"}],value:"Who says you can't afford an orchestra? Download Spitfire Audio's LABS collection and add professional orchestral elements to your tracks.",nodeType:"text"}],nodeType:"hyperlink"},{data:{},marks:[],value:"",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[],nodeType:"hr"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:"Today's edition by Jordan F.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[{type:"italic"}],value:`For indies who ship music, not excuses. `,nodeType:"text"}],nodeType:"paragraph"}],nodeType:"document"},excerpt:"YouTube Music launches countdown timers and superfan features for artists. Temple by Groover offers new fan conversion tools while OpenPlay raises millions to fight distributor data control. Essential updates for independent musicians building direct fan relationships.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/3hWAWFZxZ5j2JWGw5TuEZm/2ed859f2ece8b7c9d957e4e8309cddc6/YouTube-s_new_tools___fan_conversion___data_rights.jpg",title:"Bypass newsletter header about YouTube Music tools, fan conversion, and artist data rights"},publishDate:"2025-09-26T00:00-07:00",featured:!1,createdAt:"2025-09-26T07:30:04.053Z",updatedAt:"2025-09-26T07:30:04.053Z"},{id:"U3C9icaqjculieghca7aA",title:"Bypass: Why going viral won't save you + Spotify news",slug:"bypass-why-going-viral-wont-save-you-spotify-news",body:{nodeType:"document",data:{},content:[{nodeType:"heading-1",data:{},content:[{nodeType:"text",value:"Bypass: Music Industry News for Independent Artists",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Tuesday edition - 2 min read",marks:[{type:"italic"}],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:`Viral ≠Fans `,marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"New MIDiA Research data just dropped a bomb. Turns out “go viral and you’ll make it†is a big, fat lie. 48% of people who listen to music on social media never actually stream it. ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Ever wonder why some artists get their moment of virality and then disappear? Once listeners hear a snippet enough times, they’re never going to play the full song. Young listeners (16-24) are especially guilty of this - they discover but don’t go on to become actual fans.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Don’t get it twisted, viral moments do work… ",marks:[],data:{}},{nodeType:"text",value:"sometimes",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:". But getting real fans takes strategy. Make clips unsatisfying on purpose. Think of this like leading your listeners to where you want them. You can also directly tell them to listen to the full song instead of hoping they’ll check it out.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.hypebot.com/hypebot/2025/09/all-eyes-no-ears-new-midia-data-shows-why-virality-is-not-building-fandom.html"},content:[{nodeType:"text",value:"[Read more on Hypebot]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:`TikTok Ban Delayed: Use it or Lose it `,marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"What’s Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"So, the TikTok ban was extended again. Why not just lift the ban at this point? Either way, this is good news for indies who want to get the most out of the platform before it's really gone. ",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Indies have another three months (or more) to milk the platform for discovery. There are talks about a potential sale to the US, but don’t count on that. Who knows what the algorithm might be like under new ownership?",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Keep using TikTok for discovery, but use this breathing room to make backup plans. Get as many email addresses as possible from your TikTok traffic and drive followers to platforms you control. Treat this like extra time, not a permanent solution.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://musically.com/2025/09/17/tiktok-us-sale-or-ban-deadline-has-been-extended-to-16-december/"},content:[{nodeType:"text",value:"[Full story at Music Ally]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:`Spotify Finally Kills Shuffle Hell `,marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Spotify just scrapped the shuffle-only model for mobile free-tier users. Yes, you heard that right. Free users make up about 60% of users on the platform - it makes you wonder who came up with this thing in the first place.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"The shuffle-only thing was basically a paywall that hurt indies. Major artists get radio plays and editorial playlists; you only have social media. You can now share your music with anyone without having to worry if they have a Spotify Premium plan. ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Make sure your Spotify metadata is up-to-date. Free users aren’t waiting to start searching for music; they’re doing it now. Test this for yourself – search for your own tracks using a free account.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.musicbusinessworldwide.com/spotify-scraps-shuffle-restriction-for-users-of-free-tier/"},content:[{nodeType:"text",value:"[Read more on MusicBusiness Worldwide]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"While You Were Making Music...",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"🎬 ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://musically.com/2025/09/22/indian-electronic-musician-ritviz-releases-ai-music-video/"},content:[{nodeType:"text",value:"Indian artist Ritviz drops AI-generated music video [we got AI music videos before GTA 6?!]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"🎫 ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.hypebot.com/hypebot/2025/09/radiohead-tickets-listed-on-secondary-sites-despite-bands-efforts.html"},content:[{nodeType:"text",value:"Radiohead tickets hit secondary sites despite band's anti-scalping efforts [scalpers proving they're creeps and weirdos since 1992]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"âš–ï¸ ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://musically.com/2025/09/22/labels-amend-suno-lawsuit-and-focus-on-source-of-training-data/"},content:[{nodeType:"text",value:"Labels amend Suno lawsuit to focus on AI training data sources [hey, Suno, “I found it on the internet†isn’t legal defense]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Today's edition by Jordan F.",marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"For indies who ship music, not excuses.",marks:[{type:"italic"}],data:{}}]}]},excerpt:"New research shows viral TikTok music doesn't convert to streaming fans. Spotify ends shuffle-only mode for free users while TikTok ban gets extended, giving independent artists more discovery time.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/65NyL2TJ2hC4Y80oyd6gPq/d24e9d0c38274aa3ecef1ca95a7e01b9/Why_going_viral_won-t_save_you___Spotify_news.jpg",title:"Bypass newsletter header about viral music not converting to fans and Spotify news"},publishDate:"2025-09-23T00:00-07:00",featured:!1,createdAt:"2025-09-24T00:25:29.887Z",updatedAt:"2025-09-24T00:29:36.553Z"},{id:"91j7wtHobD28y948s9g4c",title:"Bypass: Deezer fights AI + Indies ditch Spotify",slug:"bypass-deezer-fights-ai-indies-ditch-spotify",body:{nodeType:"document",data:{},content:[{nodeType:"heading-1",data:{},content:[{nodeType:"text",value:"Bypass: Music Industry News for Independent Artists",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Thursday edition - 2 min read",marks:[{type:"italic"}],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"Deezer Fights Back Against the AI Invasion",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Wow… a streaming platform that actually cares. Deezer has been tracking AI-generated music since the beginning of this year. As of September, 30,000 AI tracks are being uploaded daily. That's 28% of all uploads, up from just 10% in January.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Deezer is the ONLY platform that tags 100% of AI-generated content and removes these tracks from the algorithm. That tells you all you need to hear ",marks:[],data:{}},{nodeType:"text",value:"(looking at you, Spotify)",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:". If you’re planning to join the Spotify exodus, Deezer might be your best bet.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Add Deezer to your distribution, if you haven’t already. It’s definitely the only platform that protects human artists. Going forward, consider working with platforms that are fighting for you, not against you.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.digitalmusicnews.com/2025/09/11/deezer-ai-tracks-daily-stat/"},content:[{nodeType:"text",value:"[Full story at Digital Music News]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"Why These Indies Can Afford to Leave Spotify",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"Who Did It",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Young Widows just joined the growing list of indies ditching Spotify completely. So far, King Gizzard & The Lizard Wizard, Xiu Xiu, Deerhoof, Hotline TNT and now Young Widows are protesting Daniel Ek’s $700+ million investment in military AI company Helsing. But how can they afford to do this? ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"How They Did It",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"They know not to depend on one platform, especially Spotify. Think Bandcamp, vinyl sales, live shows, and direct fan relationships. Young Widows weren’t afraid to ask their fans for support. As they put it, “if you truly value an artist, buy their records, go to their shows, and support them directly.â€",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"How You Can Too",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Start building multiple streams of income: create a strong Bandcamp presence, develop live performance income, and invest in physical merch. Basic stuff, but these artists proved it works.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.digitalmusicnews.com/2025/09/11/young-widows-spotify-removal/"},content:[{nodeType:"text",value:"[Full Story at Digital Music News]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"TikTok Europe Hits 200M Monthly Users",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"TikTok just reminded us why it is the king of music discovery. They announced they’ve reached a significant milestone: over 200 million monthly users in Europe – and that’s nothing to scoff at. ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Europe is a huge continent, and according to TikTok, roughly one in four citizens in the region use the app monthly. That’s an untapped opportunity if I ever saw one. Your songs can reach multiple countries in the region simultaneously.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Set up TikTok for Artists. You’ll get an idea of which European country vibes with your music. If people from Spain are listening to your songs more than anyone else, try to figure out why and appeal to that.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.musicbusinessworldwide.com/tiktok-tops-200-million-monthly-users-in-europe/"},content:[{nodeType:"text",value:"[Read more on MusicBusiness Worldwide]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"While You Were Making Music...",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"🆠",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.billboard.com/music/chart-beat/kpop-demon-hunters-another-aria-chart-double-1236065204/"},content:[{nodeType:"text",value:"Netflix’s KPop Demon Hunters dominates Aussie charts [maybe they’ll start a record label after this]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:" ",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"🎤 ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://musically.com/2025/09/12/on-the-radar-radio-continues-international-expansion-with-uk-debut/"},content:[{nodeType:"text",value:"On the Radar Radio brings freestyles to the UK [guess they did cross the pond]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"âš–ï¸ ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.digitalmusicnews.com/2025/09/12/neil-young-lawsuit-chrome-hearts/"},content:[{nodeType:"text",value:"Chrome Hearts is suing Neil Young and his band, the Chrome Hearts for trademark infringement [well… good luck, Neil; you’re gonna need it]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Today's edition by Jordan F.",marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` For indies who ship music, not excuses.`,marks:[{type:"italic"}],data:{}}]}]},excerpt:"Deezer removes AI-generated music from algorithms while indie artists leave Spotify for Bandcamp and direct sales. TikTok Europe's 200 million users create new music discovery opportunities for independent musicians.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/3iiGFVASeZNAIikbL0yT72/f6e6f83a15de1c7e09ce9b95e0255879/Deezer_fights_AI___Indies_ditch_Spotify.jpg",title:"Bypass newsletter header about Deezer fighting AI music and indies leaving Spotify"},publishDate:"2025-09-18T00:00-07:00",featured:!1,createdAt:"2025-09-18T07:30:09.163Z",updatedAt:"2025-09-24T00:30:25.135Z"},{id:"6Nqo9xE8IlJS4P3ndtOf3b",title:"Bypass: Coda promises 100x payouts + RADAR launched Teen Jesus",slug:"bypass-coda-promises-100x-payouts-radar-launched-teen-jesus",body:{nodeType:"document",data:{},content:[{nodeType:"heading-1",data:{},content:[{nodeType:"text",value:"Bypass: Music Industry News for Independent Artists",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Wednesday edition - 3 min read",marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[{type:"italic"}],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"Coda Promises What Spotify Won’t",marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Move out of the way Spotify, there’s a new kid on the block. MassiveMusic’s Coda Music just launched with a big claim: you can earn up to 100x what other streaming platforms pay you now. The deal’s so good that even Eric Clapton and Evanescence signed up. ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"It’s pretty rare for a streaming platform to put artists first, let alone indies. But since it’s backed by Merlin, the major digital rights agency for independent artists, this isn’t your typical startup BS. Here’s how it works: you get a custom link, and every time fans sign up using that link, you get a percentage of their monthly subscription. ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Check if Coda is accepting new artists in your region. If you haven’t already, start building your email list to recruit fans for when you have access. You will be leagues ahead of other artists who are still making pennies per stream on other platforms. ",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.digitalmusicnews.com/2025/09/02/coda-massivemusic-artist-friendly-model/"},content:[{nodeType:"text",value:"[Full story at Digital Media News]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"How RADAR Launched Teen Jesus",marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Who Did It",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Searching, searching",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:"… found. Let’s be honest, Spotify has barely done anything to help indie artists, but once in a while, they get it right. Their RADAR program took Australian indie rock band Teen Jesus and the Jean Teasers from being indie unknowns to opening for Pearl Jam.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"How They Did It",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"After just six months of joining RADAR, Teen Jesus witnessed a 224% jump in monthly listeners and 54% follower growth. They didn’t start with RADAR, though – they worked their way up through other programs like Fresh Finds and GLOW to get to where they are. ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"How You Can Too",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"If you want to open for Pearl Jam ",marks:[],data:{}},{nodeType:"text",value:"(I mean, who doesn’t)",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:", take a page out of Teen Jesus’ book. Focus on building genuine early listeners who might just be Spotify’s tastemakers. Release tracks consistently, promote authentically and track your growth. You can’t game the system here – it’s all organic growth.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.musicbusinessworldwide.com/spotify-says-1000-artists-have-featured-in-its-radar-program-and-have-racked-up-338bn-streams-on-the-platform/"},content:[{nodeType:"text",value:"[Read more on MusicBusiness Worldwide]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"The Amazon Music Opportunity You're Missing",marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Another week, another new AI feature. It’s getting hard to keep up. Amazon Music just launched its new Monday playlist generator with the most corporate-sounding name ever, ",marks:[],data:{}},{nodeType:"text",value:"“Weekly Vibeâ€",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:". If you can look past the cheesy name, though, there’s a real opportunity to promote your music.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Unlike Spotify’s editorial-heavy approach, being featured on the Weekly Vibe playlist is entirely up to Amazon’s algorithm, which might not be a bad thing. We don’t know how Amazon’s algorithm works, but it definitely beats waiting around for playlist editors to finish sipping their coffee.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Start uploading your tracks to Amazon Music if you haven’t already. Keep an eye out for the songs that perform the best and double down on similar styles. The real opportunity here is having your music in front of listeners who might not have found you on oversaturated Spotify.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://techcrunch.com/2025/09/08/amazon-musics-new-ai-feature-generates-personalized-playlists-every-monday/"},content:[{nodeType:"text",value:"[Full Story at TechCrunch]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"While You Were Making Music...",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"🎧 ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.billboard.com/pro/spotify-hifi-lossless-audio-release-plan-cost-feature/"},content:[{nodeType:"text",value:"Spotify’s Hifi finally arrives [it only took you guys 4 years]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"â–¶ï¸ ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://routenote.com/blog/ed-sheeran-brings-new-album-play-to-fans-via-tiktoks-exclusive-livestream/"},content:[{nodeType:"text",value:"Ed Sheeran hits ‘Play’ on TikTok [showing everyone how it’s done] ",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"👕 ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.musicbusinessworldwide.com/twenty-one-pilots-sue-temu-for-trademark-infringement-over-blatant-copies-of-merch/"},content:[{nodeType:"text",value:"Twenty One Pilots sues Temu for merch knockoffs [team up, lawyer up]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Today's edition by Jordan F.",marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` For indies who ship music, not excuses.`,marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` `,marks:[],data:{}}]}]},excerpt:"Independent artists can earn 100x more on Coda Music streaming platform, Spotify RADAR program success strategies, and Amazon Music's Weekly Vibe algorithmic playlist opportunities for unsigned musicians.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/1h3Pk71V8LQKVi1pUEIvS7/d6ca52b78bfa0221acd35646ea24eefc/Coda_promises_100x_payouts___RADAR_launched_Teen_Jesus.jpg",title:"Bypass newsletter header featuring Coda Music 100x payouts and Spotify RADAR Teen Jesus stories"},publishDate:"2025-09-17T00:00-07:00",featured:!1,createdAt:"2025-09-17T14:33:45.198Z",updatedAt:"2025-09-24T00:30:44.856Z"},{id:"7fT1oSTtNDBaXwFsTxdjFv",title:"Bypass: Spotify DMs Are Here + Why TikTok's Panicking About Music",slug:"bypass-spotify-dms-are-here-why-tiktoks-panicking-about-music",body:{nodeType:"document",data:{},content:[{nodeType:"heading-1",data:{},content:[{nodeType:"text",value:"Bypass: Music Industry News for Independent Artists",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Wednesday edition - 2 min read",marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` This is the first edition of Bypass—our new 2-minute news brief for independent artists.`,marks:[{type:"italic"}],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"TikTok Goes All-In on Music Discovery",marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"TikTok just launched its first global music campaign, ",marks:[],data:{}},{nodeType:"text",value:"“See Where Music Takes You.â€",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:" Pretty sure this has nothing to do with the ban coming up in mid-September ",marks:[],data:{}},{nodeType:"text",value:"(cough, cough)",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:".",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Regardless, TikTok is betting big on music discovery. They’re showcasing artists like Ravyn Lenae, who was able to amass 500 million streams using their platform. Basically, TikTok is saying, ",marks:[],data:{}},{nodeType:"text",value:"“Use us before we’re gone.â€Â  ",marks:[{type:"italic"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What ",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"This is what you need to do: post your music snippets daily to exploit the algorithm. Features like",marks:[],data:{}},{nodeType:"text",value:" “Add to Music Appâ€",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:" allow users to easily save your songs to platforms like Spotify and Apple Music. This way, you can turn those viral moments into actual money.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.digitalmusicnews.com/2025/08/28/tiktok-ad-blitz-music-discovery-campaign/"},content:[{nodeType:"text",value:"[Full story at Digital Media News]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"Spotify Wants to Be TikTok (But Baby Steps, Please)",marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"What’s Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Is it me, or does every app want to be social media these days? Spotify just launched DMs as a way to “drive hype†",marks:[],data:{}},{nodeType:"text",value:"(I mean, it took you long enough)",marks:[{type:"italic"}],data:{}},{nodeType:"text",value:". ",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"When you think about it, this could help indie artists stay connected with fans about new music. Except Spotify is only rolling out DMs for fan-to-fan communications right now (yay). An artist messaging feature might be the next logical step for their promised “Superfan plan,†though, but no promises on timing.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"In the meantime, start planning your DM strategy in case artist messaging does roll out. Study how other artists use Instagram DMs and Bandsintown messaging. Don’t forget your email list; it’s one of the best ways of reach fans directly.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.hypebot.com/hypebot/2025/08/spotify-adds-dms.html"},content:[{nodeType:"text",value:"[Read more on Hypebot]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"Your Merch Orders Just Got Complicated",marks:[{type:"bold"}],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"What's Up",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Merch sales just hit a wall. Bandcamp warns users that some international carriers are pausing shipments to the US because of tariffs.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"So What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Physical sales are stuck, but digital isn’t. The shipping freeze could actually push more fans to instant downloads and streaming. When fans can't wait for vinyl, they'll pay for the digital instead. That way, you can get sales right now - not to mention better margins.",marks:[],data:{}}]},{nodeType:"heading-3",data:{},content:[{nodeType:"text",value:"Now What",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Take advantage of digital sales. Also, check with international suppliers about shipping timelines. If the timeline drags out, consider switching to domestic fulfilment until things clear up.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.digitalmusicnews.com/2025/08/28/us-tariffs-merch-order-chaos/"},content:[{nodeType:"text",value:"[Full story at Digital Music News]",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"heading-2",data:{},content:[{nodeType:"text",value:"While You Were Making Music...",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"🤠",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.billboard.com/video/lil-nas-x-speaks-out-after-being-arrested/"},content:[{nodeType:"text",value:'Lil Nas X speaks out after recent arrest [guess that "Old Town Road" got a little bumpy]',marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"âš–ï¸ ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.digitalmusicnews.com/2025/08/29/benson-boone-ceremony-of-roses-lawsuit/"},content:[{nodeType:"text",value:"Sony sues counterfeit Benson Boone merch sellers ",marks:[{type:"underline"}],data:{}},{nodeType:"text",value:"[some things never change]",marks:[{type:"underline"},{type:"italic"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"💸 ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.hypebot.com/hypebot/2025/08/soundexchange-distributions-topped-242-million-in-q2-2025.html"},content:[{nodeType:"text",value:"$242M in royalties paid out by SoundExchange ",marks:[{type:"underline"}],data:{}},{nodeType:"text",value:"[check if they owe you money]",marks:[{type:"underline"},{type:"italic"}],data:{}}]},{nodeType:"text",value:` `,marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"",marks:[{type:"bold"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"One Thing To Do Today:",marks:[{type:"bold"}],data:{}},{nodeType:"text",value:" ",marks:[],data:{}},{nodeType:"hyperlink",data:{uri:"https://www.uaudio.com/blogs/press/universal-audio-offers-free-la-2a-plug-in-during-labor-day-flash-sale"},content:[{nodeType:"text",value:"Free compressor, anyone? Universal Audio celebrates Labor Day by giving away its LA-2A compressor plugin for free.",marks:[{type:"underline"}],data:{}}]},{nodeType:"text",value:"",marks:[],data:{}}]},{nodeType:"hr",data:{},content:[]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Today's edition by Jordan F.",marks:[{type:"italic"}],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:` For indies who ship music, not excuses.`,marks:[{type:"italic"}],data:{}}]}]},excerpt:"Independent music industry news covering TikTok's new music discovery campaign, Spotify DMs for artists, and how US tariffs affect merchandise shipping. Actionable insights for unsigned artists navigating platform changes.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/Jh5FPtOAtJ4g3XTTvy44H/bc6715c0ad1e4c472c12baeb45286e1d/bypass_sep_3_2025_spotify_tiktok_2.jpg",title:"Bypass logo and header for music industry news brief with article title about Spotify DMs and TikTok"},publishDate:"2025-09-03T00:00-07:00",featured:!1,createdAt:"2025-09-03T16:37:58.239Z",updatedAt:"2025-09-03T17:04:40.151Z"},{id:"7K2P6aKXnvRPX39RyaiY3U",title:"Summer Update: 200K Submissions & Bug Fixes",slug:"summer-update-200k-submissions-and-bug-fixes",body:{data:{},content:[{data:{},content:[{data:{},marks:[],value:"I hope you're all getting some sun and inspiration wherever you're at (and if you're in the Southern Hemisphere, I hope winter is treating you kindly!). We've been busy making music, squashing bugs, and sanding down some rough edges in the Playlist Partner code. Plus, we have a milestone to celebrate!",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"First, we've addressed several bugs that you’ve reported, including:",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:'"Back to Playlists"',nodeType:"text"},{data:{},marks:[],value:" now correctly returns you to the right page every time.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Sorting by Most Recent",nodeType:"text"},{data:{},marks:[],value:" no longer gives inconsistent orders.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"New Labels",nodeType:"text"},{data:{},marks:[],value:' clearly marking playlists as "Added Today," "Added Yesterday," and "Added This Week". This helps both curators showcase their new playlists and artists discover fresh opportunities more easily.',nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"}],nodeType:"unordered-list"},{data:{},content:[{data:{},marks:[],value:"Second, we just crossed ",nodeType:"text"},{data:{},marks:[{type:"bold"}],value:"200,000 successful submissions",nodeType:"text"},{data:{},marks:[],value:"! Huge thanks to you legends: artists and curators alike, for connecting, sharing your music, and making the platform thrive. We're also onboarding more new playlists than ever, giving you even more chances to get your music heard.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Whether you're enjoying the warmth or staying cozy indoors, have a fantastic August. Here's to good music being written and many more successful artist-curator connections!",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"- TEAM Playlist Partner",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"document"},excerpt:"We've hit 200,000 successful submissions! Plus, check out recent bug fixes and new labels to easily find fresh playlists. Here's to more successful connections!",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/5VBIPlLBnHZ8lH2w15Guv8/defedf3a23079f734ee3f09b2d97fa09/summer_update.jpeg",title:"Summer Update Graphic with Celebration Icons and Bold Text"},publishDate:"2025-08-01T08:08-07:00",featured:!1,createdAt:"2025-08-01T15:58:19.114Z",updatedAt:"2025-08-01T15:59:15.237Z"},{id:"6bHa6vnOHiKZdRjQaIWE5G",title:"Announcing Our New Music Marketing Guide Series",slug:"announcing-our-new-music-marketing-guide-series",body:{data:{},content:[{data:{},content:[{data:{},marks:[],value:"Since launching Playlist Partner and diving into the world of playlist submissions, we've always had bigger dreams. Today, we're excited to announce our upcoming series of music marketing guides, designed to help you expand your reach and build a sustainable career far beyond just playlist placements.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"We're collaborating with some amazing experts in the music marketing space to deliver insightful, actionable guides that will cover essential topics such as:",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Marketing Strategy and Release Planning",nodeType:"text"},{data:{},marks:[],value:" – How to strategically execute your releases for maximum impact across all platforms.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Email Marketing",nodeType:"text"},{data:{},marks:[],value:" – Learn how building and nurturing a dedicated email list can significantly boost your career growth.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Fanbase Loyalty",nodeType:"text"},{data:{},marks:[],value:" – Practical ways to build lasting, meaningful relationships with your fans.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Playlist Placement Strategies",nodeType:"text"},{data:{},marks:[],value:" – Proven tactics to improve your chances of getting featured on playlists.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Spotify Editorial Playlists",nodeType:"text"},{data:{},marks:[],value:" – Discover how Spotify selects tracks for their exclusive editorial playlists and how to increase your odds.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Spotify Algorithmic Playlists and Radio",nodeType:"text"},{data:{},marks:[],value:" – Tips on maximizing your music’s presence on Spotify Radio and other algorithmic playlists.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Social Media Mastery",nodeType:"text"},{data:{},marks:[],value:" – Building your brand authentically and effectively on social platforms.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Networking and Collaboration",nodeType:"text"},{data:{},marks:[],value:" – How to find and nurture collaborations that can amplify your exposure and credibility.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"},{data:{},content:[{data:{},content:[{data:{},marks:[{type:"bold"}],value:"Digital Advertising for Musicians",nodeType:"text"},{data:{},marks:[],value:" – Leverage ads on social media and streaming platforms to grow your audience strategically.",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"list-item"}],nodeType:"unordered-list"},{data:{},content:[{data:{},marks:[],value:"Stay tuned—we’re committed to giving you the tools and insights needed to amplify your music and reach new heights in your career.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Thanks for your continued support and here's to growing together!",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"— TEAM Playlist Partner",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"document"},excerpt:"Introducing our new music marketing guide series! Learn how to maximize your impact with strategic release planning, playlist placements, email marketing, and more.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/6mcBY1GpfQvml3Y7NmlFuI/2161aefa678e313657baef0297599483/spotify_marketing_guides.jpg",title:"Illustration of music marketing concepts with icons on a blue background."},publishDate:"2025-06-23T00:00-07:00",featured:!1,createdAt:"2025-06-23T23:16:50.555Z",updatedAt:"2025-06-23T23:16:50.555Z"},{id:"5TT2Cna5qQIGiOl6rKVlHo",title:"Recent Fixes and Updates",slug:"recent-fixes-and-updates",body:{nodeType:"document",data:{},content:[{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Thanks to everyone for submitting feedback on Playlist Partner 2.0 - we truly appreciate it!",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Here's what we've addressed in the last few weeks:",marks:[],data:{}}]},{nodeType:"unordered-list",data:{},content:[{nodeType:"list-item",data:{},content:[{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Search Improvements",marks:[{type:"bold"}],data:{}},{nodeType:"text",value:": Search now works much better when applying multiple filters. We'd say it's pretty flawless now. 😊",marks:[],data:{}}]}]},{nodeType:"list-item",data:{},content:[{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Song Selection Saved",marks:[{type:"bold"}],data:{}},{nodeType:"text",value:": Your song selections are now preserved even if you close your browser window.",marks:[],data:{}}]}]},{nodeType:"list-item",data:{},content:[{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Daily Metadata Updates",marks:[{type:"bold"}],data:{}},{nodeType:"text",value:": Playlist metadata, such as follower count and track count, is now updated daily.",marks:[],data:{}}]}]},{nodeType:"list-item",data:{},content:[{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Featured Playlists",marks:[{type:"bold"}],data:{}},{nodeType:"text",value:": We've added a new section to highlight some of our favorite playlists and curators.",marks:[],data:{}}]}]},{nodeType:"list-item",data:{},content:[{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Clearer Notifications",marks:[{type:"bold"}],data:{}},{nodeType:"text",value:': Introduced clear "toast" messages to confirm all actions.',marks:[],data:{}}]}]},{nodeType:"list-item",data:{},content:[{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"More Playlists",marks:[{type:"bold"}],data:{}},{nodeType:"text",value:": We're actively onboarding even more playlists!",marks:[],data:{}}]}]}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"We've got plenty of exciting features in the pipeline - not just bug fixes. Stay tuned!",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"Thanks again for your continued support.",marks:[],data:{}}]},{nodeType:"paragraph",data:{},content:[{nodeType:"text",value:"-",marks:[],data:{}},{nodeType:"text",value:" TEAM Playlist Partner",marks:[],data:{}}]}]},excerpt:"We've tackled your top requests and improved Playlist Partner 2.0! Enjoy smoother search, saved selections, daily metadata updates, and more.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/7ds4PCuy0lCKDJCIUV1xUY/93fe1218873ae3a1bdf424e00c2a3367/bug_fixes.png",title:"Cheerful ladybug illustration with the title “Recent Fixes and Updates†on a blue background"},publishDate:"2025-05-08T09:54-07:00",featured:!1,createdAt:"2025-06-23T22:36:46.075Z",updatedAt:"2025-06-23T23:33:34.006Z"},{id:"2s8044B1fJGMzeDA0NL700",title:"Introducing Playlist Partner 2.0",slug:"introducing-playlistpartner-2-0",body:{data:{},content:[{data:{},content:[{data:{},marks:[],value:"After getting frustrated by the existing playlist submission options, we, a small group of indie musicians, came together one weekend and quickly hacked together the first version of Playlist Partner. It was a scrappy patchwork of code, platforms, and duct tape holding it all together. This rough-and-ready MVP was our way of testing if there was interest in a 100% free, community-driven project created purely out of love for music.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Our goal was clear: create a new kind of site that didn’t destroy your Spotify account by forcing you to follow countless playlists that might not even feature your song, or artists you'd never listen to. Instead, we wanted to foster genuine connections and a mutual exchange of value agreed upon directly by artists and curators, not dictated by the platform.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"We were blown away by the response and the love our weekend experiment received. With your invaluable feedback in hand, we went back to the drawing board and meticulously rebuilt the platform from the ground up. And now, here we are on launch day!",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"PlaylistPartner 2.0 is smoother, faster, and more intuitive, both on the frontend and backend. It provides artists and curators with a robust, reliable foundation, enabling us to roll out even more powerful features in the future. Expect a snappier interface, a streamlined user experience, and a powerful new engine built to amplify your music's reach.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Over the coming weeks, you’ll notice a little feedback button floating around the right side of the site. Please use it to report any issues or submit your feature requests, we're excited to keep improving based on your input.",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"Thanks for supporting our project, and may the odds ever be in your favor!",nodeType:"text"}],nodeType:"paragraph"},{data:{},content:[{data:{},marks:[],value:"— TEAM Playlist Partner",nodeType:"text"}],nodeType:"paragraph"}],nodeType:"document"},excerpt:"PlaylistPartner 2.0 is here, rebuilt from scratch! Now smoother, faster, and built specifically for artists and curators. Check out the new features, give us your feedback, and help shape the future of free playlist submissions.",category:"News",featuredImage:{url:"//images.ctfassets.net/b3nqx2d7xn8z/18zwyIaISSiy1k32iYFKwm/db3f8c7ad0bfe902cdd29baea9b4276f/playlist_partner_2.0_featured_image_2.png",title:"Playlist Partner 2.0 Announcement"},publishDate:"2025-04-02T14:14-07:00",featured:!1,createdAt:"2025-06-23T22:23:06.179Z",updatedAt:"2025-06-23T22:26:31.945Z"}];function ml(){const e=Wa.filter(n=>n.category==="News").slice(0,2);function a(n){return new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function r(n){return n.startsWith("//")?`https:${n}`:n}return e.length===0?null:s.jsx("div",{className:"my-16",children:s.jsxs("div",{className:"max-w-[1400px] mx-auto",children:[s.jsx("h2",{className:"text-2xl font-semibold text-gray-900 mb-8",children:"Latest News from Playlist Partner"}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.map(n=>{var o;return s.jsxs(I,{to:`/blog/news/${n.slug}`,className:"group bg-white border border-gray-200 rounded-lg overflow-hidden hover:border-green-500 hover:shadow-md transition-all",children:[((o=n.featuredImage)==null?void 0:o.url)&&s.jsx("div",{className:"aspect-[3/2] overflow-hidden",children:s.jsx("img",{src:r(n.featuredImage.url),alt:n.featuredImage.title||n.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),s.jsxs("div",{className:"p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 group-hover:text-green-600 transition-colors line-clamp-2 mb-3",children:n.title}),n.excerpt&&s.jsx("p",{className:"text-gray-600 text-sm mb-4 line-clamp-2",children:n.excerpt}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:[s.jsx(Fa,{className:"w-3 h-3"}),s.jsx("span",{children:a(n.publishDate||n.createdAt)})]}),s.jsxs("span",{className:"text-green-600 text-sm flex items-center gap-1 group-hover:gap-2 transition-all",children:["Read",s.jsx(gt,{className:"w-4 h-4"})]})]})]})]},n.id)}),s.jsx(I,{to:"/blog",className:"group bg-gradient-to-br from-green-50 to-green-100 border border-green-200 rounded-lg overflow-hidden hover:border-green-500 hover:shadow-md transition-all flex flex-col",children:s.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center p-6",children:[s.jsx("div",{className:"mb-4",children:s.jsx("div",{className:"w-16 h-16 bg-green-600 rounded-full flex items-center justify-center group-hover:scale-110 transition-transform",children:s.jsx(gt,{className:"w-8 h-8 text-white"})})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"View All Posts"}),s.jsx("p",{className:"text-gray-600 text-sm",children:"Explore all blog posts and updates"})]})})]})]})})}const gl=b.lazy(()=>pe(()=>import("./FeaturedPlaylists-CSpE8ynS.js"),__vite__mapDeps([0,1,2])).then(t=>({default:t.FeaturedPlaylists}))),vl=b.lazy(()=>pe(()=>Promise.resolve().then(()=>Ll),void 0).then(t=>({default:t.SubmissionModal}))),bl=()=>s.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:s.jsx("div",{className:"container mx-auto px-4 py-12",children:s.jsxs("div",{className:"max-w-[1400px] mx-auto",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Free Spotify Playlist Submissions - No Signup"}),s.jsx("h2",{className:"text-xl text-gray-600",children:"Connect Instantly with Thousands of Independent Playlist Curators"})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-8 text-left",children:[s.jsxs("div",{className:"bg-white border border-gray-200 p-8 hover:border-green-500 transition-colors rounded-md",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Direct Connections"}),s.jsx("p",{className:"text-gray-600",children:"Skip the middlemen and connect with real playlist curators who are passionate about discovering new music. Our platform eliminates gatekeepers, letting your music speak directly to those who can share it with their audiences."})]}),s.jsxs("div",{className:"bg-white border border-gray-200 p-8 hover:border-green-500 transition-colors rounded-md",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Zero Barriers"}),s.jsx("p",{className:"text-gray-600",children:"No accounts, no credits—just instant Spotify submissions without hassle. Paste your track link and start submitting to playlists immediately. We've removed every obstacle between independent artists and playlist opportunities."})]}),s.jsxs("div",{className:"bg-white border border-gray-200 p-8 hover:border-green-500 transition-colors rounded-md",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Community-Driven"}),s.jsx("p",{className:"text-gray-600",children:"Built by independent musicians for the indie community. Our platform fosters genuine relationships between artists and curators based on mutual appreciation rather than transactional expectations."})]})]})]})})}),xl=()=>{var e,a;const t=Ze();return s.jsx("div",{className:"my-8 pt-8 border-t border-gray-200",children:s.jsxs("div",{className:"max-w-[1400px] mx-auto",children:[s.jsxs("h2",{className:"text-2xl font-semibold text-gray-900 mb-6",children:["Today's Featured Playlists - ",new Date().toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})]}),(t==null?void 0:t.lastTrack)&&s.jsxs("div",{className:"mb-6 flex items-center justify-between bg-white p-4 shadow-sm rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("img",{src:(e=t.lastTrack.album.images[2])==null?void 0:e.url,alt:t.lastTrack.name,className:"w-12 h-12 object-cover rounded-md",loading:"lazy"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:t.lastTrack.name}),s.jsx("p",{className:"text-sm text-gray-600",children:(a=t.lastTrack.artists[0])==null?void 0:a.name})]})]}),s.jsx("button",{onClick:()=>{gn(),window.location.reload()},className:"p-2 hover:bg-gray-100 rounded-full transition-colors",title:"Clear selected track",children:s.jsx(et,{className:"w-5 h-5 text-gray-500"})})]}),s.jsx("div",{className:"border-l-4 border-green-500 pl-6",children:s.jsx(b.Suspense,{fallback:s.jsx("div",{className:"h-32 flex items-center justify-center",children:s.jsx(Ie,{className:"w-8 h-8 animate-spin"})}),children:s.jsx(gl,{})})})]})})},wl=()=>s.jsx("div",{className:"bg-gradient-to-b from-gray-50 via-gray-100 to-gray-50 py-12 mt-16 mb-16 border-y border-gray-200",children:s.jsxs("div",{className:"text-center max-w-[1400px] mx-auto px-4",children:[s.jsx("p",{className:"text-gray-800 text-xl font-medium mb-6",children:"Find the Perfect Playlist for Your Music"}),s.jsx(I,{to:"/playlists",className:"inline-block px-12 py-5 bg-blue-600 text-white text-xl font-semibold rounded-lg hover:bg-blue-700 transition-all transform hover:scale-105 shadow-lg hover:shadow-xl",children:"Explore All Playlists"})]})});function Tl(){const[t,e]=b.useState(null);return s.jsxs(s.Fragment,{children:[s.jsx(le,{}),s.jsxs("main",{children:[s.jsx(bl,{}),s.jsxs("div",{className:"container mx-auto px-4 pb-12",children:[s.jsx(b.Suspense,{fallback:null,children:s.jsx(xl,{})}),s.jsx(wl,{}),s.jsx(ml,{}),s.jsxs(b.Suspense,{fallback:null,children:[s.jsx(_l,{}),s.jsx(kl,{})]})]}),t&&s.jsx(b.Suspense,{fallback:null,children:s.jsx(vl,{playlist:t,onClose:()=>e(null),onSubmit:()=>e(null)})})]})]})}const _l=b.lazy(()=>pe(()=>import("./FAQSection-DcHK2fun.js"),__vite__mapDeps([3,1,2]))),kl=b.lazy(()=>pe(()=>import("./AdditionalInfoSection-dqJvne_B.js"),__vite__mapDeps([4,1,2])));function jl(t){const[e,a]=b.useState(null),[r,n]=b.useState(!0),[o,i]=b.useState(null),[l,c]=b.useState([]);return b.useEffect(()=>{let d=!0;async function u(){if(!t){i(new Error("Invalid playlist URL")),n(!1);return}try{n(!0),i(null);const{data:h,error:p}=await L.from("playlist_details").select("*").eq("slug",t).limit(1);if(p)throw p;if(!h||h.length===0)throw new Error("Playlist not found");const f=h[0];if(d){a(f);const{data:v,error:w}=await L.from("playlist_details").select("*").eq("genre",f.genre).neq("id",f.id).order("followers",{ascending:!1}).limit(4);!w&&v&&c(v)}}catch(h){console.error("Failed to fetch playlist:",h),d&&(i(h instanceof Error?h:new Error("Failed to fetch playlist")),a(null),c([]))}finally{d&&n(!1)}}return u(),()=>{d=!1}},[t]),{playlist:e,loading:r,error:o,relatedPlaylists:l,isNotFound:(o==null?void 0:o.message)==="Playlist not found"}}const Ea="playlist_submissions";function Sl(t,e){try{const a=JSON.parse(localStorage.getItem(Ea)||"[]"),r=a.find(n=>n.playlistId===t);r?r.tracks.some(n=>n.spotifyUrl===e)||r.tracks.push({spotifyUrl:e,timestamp:Date.now()}):a.push({playlistId:t,tracks:[{spotifyUrl:e,timestamp:Date.now()}]}),localStorage.setItem(Ea,JSON.stringify(a))}catch(a){console.error("Failed to track submission:",a)}}function vn(t,e){try{const r=JSON.parse(localStorage.getItem(Ea)||"[]").find(n=>n.playlistId===t);return!!(r!=null&&r.tracks.some(n=>n.spotifyUrl===e))}catch(a){return console.error("Failed to check submission status:",a),!1}}const Na="scrollPositions",El=5*60*1e3,Nl=10,Al=100;function xr(){try{return JSON.parse(sessionStorage.getItem(Na)||"[]")}catch{return[]}}const bn={savePosition(t,e){try{const a=xr(),r=window.scrollY;if(r>0){a.push({pathname:t,position:r,timestamp:Date.now(),searchParams:e==null?void 0:e.toString()});const n=a.filter(o=>Date.now()-o.timestamp<El);sessionStorage.setItem(Na,JSON.stringify(n))}}catch(a){console.error("Failed to save scroll position:",a)}},restorePosition(t,e){try{const a=xr(),r=a.find(n=>n.pathname===t);if(r){const n=a.filter(l=>l!==r);sessionStorage.setItem(Na,JSON.stringify(n)),r.searchParams&&e&&e(new URLSearchParams(r.searchParams));let o=0;const i=()=>{const l=document.documentElement.scrollHeight,c=r.position;if(l>=c||o>=Nl){window.scrollTo({top:c,behavior:"instant"});return}o++,setTimeout(i,Al)};setTimeout(i,50)}}catch(a){console.error("Failed to restore scroll position:",a)}}};function xn(t){if(!t)return null;const e=new Date,a=new Date(t),r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),n=new Date(r);n.setDate(n.getDate()-1);const o=new Date(r);o.setDate(o.getDate()-7);const i=new Date(a.getFullYear(),a.getMonth(),a.getDate());return i.getTime()===r.getTime()?"today":i.getTime()===n.getTime()?"yesterday":i>o?"this-week":null}function Ha({playlist:t,onSubmit:e,isRelated:a,priority:r=!1,hideSubmit:n=!1,showFeaturedBadge:o=!1}){const i=Re(),l=Mt(),[c]=Ar(),[d,u]=b.useState(!1),h=Ze(),p=(h==null?void 0:h.lastTrack)&&vn(t.id,h.lastTrack.external_urls.spotify),f=v=>{v.preventDefault(),a||bn.savePosition(l.pathname,c);const w=l.pathname.startsWith("/genre/");window.scrollTo({top:0,behavior:"instant"}),i(`/playlist/${t.slug}`,{state:{from:w?"genre":"home"}})};return s.jsxs("div",{className:"bg-white shadow-sm hover:shadow-md transition-shadow h-full flex flex-col",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("a",{href:`/playlist/${t.slug}`,onClick:f,className:"cursor-pointer no-js-fallback",children:[s.jsxs("div",{className:"relative pb-[100%] bg-gray-100",children:[d||!t.image_url?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200",children:s.jsxs("div",{className:"text-center",children:[s.jsx(hn,{className:"w-12 h-12 text-gray-400 mx-auto mb-2"}),s.jsx("div",{className:"text-sm text-gray-500 font-medium px-4 truncate max-w-[200px]",children:t.name})]})}):s.jsx("img",{src:t.image_url,alt:t.name,className:"absolute inset-0 w-full h-full object-cover sm:rounded-[2px] lg:rounded-[4px]",loading:r?"eager":"lazy",onError:()=>u(!0)}),t.featured&&o&&s.jsxs("div",{className:"absolute top-2 right-2 bg-yellow-400 text-yellow-900 px-2 py-1 rounded-full text-xs font-medium flex items-center gap-1",children:[s.jsx(fn,{className:"w-3 h-3"}),"Featured"]})]}),s.jsx("h3",{className:"text-base font-bold text-gray-900 mb-1 line-clamp-1 hover:text-green-600 transition-colors p-4 pb-0",children:t.name})]}),s.jsxs("div",{className:"p-4 pt-2",children:[s.jsx("p",{className:"text-sm text-gray-600 mb-2 line-clamp-2 flex-1",children:t.description}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[s.jsxs(I,{to:`/genre/${t.genre_slug}`,onClick:v=>v.stopPropagation(),className:"flex items-center text-gray-700 hover:text-green-600 transition-colors",children:[s.jsx(fe,{className:"w-4 h-4 mr-1 flex-shrink-0"}),s.jsx("span",{className:"truncate",children:t.genre})]}),s.jsxs("div",{className:"flex items-center text-gray-700",children:[s.jsx(Jt,{className:"w-4 h-4 mr-1 flex-shrink-0"}),s.jsx("span",{children:t.followers.toLocaleString()})]})]}),t.curator_name&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[s.jsx(Kt,{className:"w-4 h-4 flex-shrink-0"}),t.curator_profile_url?s.jsx("a",{href:t.curator_profile_url,target:"_blank",rel:"noopener noreferrer",onClick:v=>v.stopPropagation(),className:"truncate hover:text-green-600 transition-colors",children:t.curator_name}):s.jsx("span",{className:"truncate",children:t.curator_name})]})]})]})]}),!n&&s.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 mt-auto flex items-center justify-between",children:[p?s.jsxs("div",{className:"flex items-center gap-1.5 bg-gray-100 text-gray-500 px-3 py-1.5 rounded-full text-sm",children:[s.jsx(cn,{className:"w-3.5 h-3.5"}),"Submitted"]}):s.jsxs("button",{onClick:v=>{v.stopPropagation(),e(t.id)},className:"flex items-center gap-1.5 bg-green-500 text-white px-3 py-1.5 rounded-full text-sm hover:bg-green-600 transition-colors",children:[s.jsx(pn,{className:"w-3.5 h-3.5"}),"Submit"]}),(()=>{const v=xn(t.published_at);if(!v)return null;const m={today:{text:"Added Today",bg:"bg-gray-100",textColor:"text-gray-600"},yesterday:{text:"Added Yesterday",bg:"bg-gray-100",textColor:"text-gray-600"},"this-week":{text:"Added This Week",bg:"bg-gray-100",textColor:"text-gray-600"}}[v];return s.jsxs("div",{className:`${m.bg} ${m.textColor} px-2 py-1 rounded-full text-xs font-medium flex items-center gap-1`,children:[s.jsx(un,{className:"w-3 h-3"}),m.text]})})()]})]})}const $t=10,la=24*60*60*1e3;function Nt(t){return Il(t,"track")||t}function Pl(t,e){try{if(!t||!e)return{allowed:!1,remainingSubmissions:0,timeUntilReset:null,totalSubmissions:0,alreadySubmittedToPlaylist:!1};const a=JSON.parse(localStorage.getItem("trackSubmissions")||"[]"),r=Date.now(),n=Nt(t),o=a.filter(c=>r-c.timestamp<la);o.length<a.length&&localStorage.setItem("trackSubmissions",JSON.stringify(o));const i=o.find(c=>Nt(c.spotifyUrl)===n&&c.playlistId===e);if(i)return{allowed:!1,remainingSubmissions:0,timeUntilReset:Math.max(0,la-(r-i.timestamp)),totalSubmissions:o.length,alreadySubmittedToPlaylist:!0};const l=o.filter(c=>Nt(c.spotifyUrl)===n);if(l.length>=$t){const c=l.reduce((u,h)=>h.timestamp<u.timestamp?h:u);return{allowed:!1,remainingSubmissions:0,timeUntilReset:Math.max(0,la-(r-c.timestamp)),totalSubmissions:l.length,alreadySubmittedToPlaylist:!1}}return{allowed:!0,remainingSubmissions:$t-l.length,timeUntilReset:null,totalSubmissions:l.length,alreadySubmittedToPlaylist:!1}}catch(a){return console.error("Rate limit check failed:",a),{allowed:!1,remainingSubmissions:0,timeUntilReset:null,totalSubmissions:0,alreadySubmittedToPlaylist:!1}}}function Ol(t,e){if(!(!t||!e))try{const a=JSON.parse(localStorage.getItem("trackSubmissions")||"[]");a.push({timestamp:Date.now(),spotifyUrl:Nt(t),playlistId:e}),localStorage.setItem("trackSubmissions",JSON.stringify(a))}catch(a){console.error("Failed to record submission:",a)}}function Il(t,e){if(!t)return null;try{const a=[new RegExp(`${e}/([a-zA-Z0-9]+)`),new RegExp(`${e}:([a-zA-Z0-9]+)`)];for(const r of a){const n=t.match(r);if(n&&n[1])return n[1]}return null}catch(a){return console.error("Failed to extract ID:",a),null}}const wn="https://bears.playlistpartner.com/api/spotify";function Rl(t){try{if(t.startsWith("spotify:")){const a=t.split(":");return`https://open.spotify.com/${a[1]}/${a[2]}`}return`https://open.spotify.com${new URL(t).pathname}`}catch{return t}}function Dt(t,e){if(!t)return null;try{const a=Rl(t),r=[new RegExp(`${e}/([a-zA-Z0-9]+)`),new RegExp(`${e}:([a-zA-Z0-9]+)`)];for(const n of r){const o=a.match(n);if(o&&o[1])return o[1]}return null}catch(a){return console.error("Failed to extract ID:",a),null}}async function Cl(t){if(!t.trim())return[];try{const e=await fetch(`${wn}/search?q=${encodeURIComponent(t)}&limit=5`);if(!e.ok){if(e.status===429){const r=await e.json();throw new Error(r.message||"Rate limit exceeded. Please try again later.")}throw new Error(`Search failed: ${e.status} ${e.statusText}`)}const a=await e.json();if(!a.tracks)throw new Error("Invalid response format from API");return a.tracks}catch(e){throw console.error("Failed to search tracks:",e),e instanceof Error?e:new Error("Failed to search tracks")}}async function wr(t){if(!t)return null;try{const e=await fetch(`${wn}/track/${encodeURIComponent(t)}`);if(!e.ok){if(e.status===404)return null;if(e.status===429){const r=await e.json();throw new Error(r.message||"Rate limit exceeded. Please try again later.")}throw new Error(`Failed to fetch track: ${e.status} ${e.statusText}`)}const a=await e.json();if(!a.id||!a.name||!a.artists||!a.album)throw new Error("Invalid track data received from API");return a}catch(e){throw console.error("Failed to fetch track:",e),e instanceof Error?e:new Error("Failed to fetch track data")}}function $l(t,e){const[a,r]=b.useState(t);return b.useEffect(()=>{const n=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(n)}},[t,e]),a}function Tn({onTrackSelect:t,initialUrl:e,selectedTrack:a,onClearTrack:r}){var E;const[n,o]=b.useState(""),[i,l]=b.useState([]),[c,d]=b.useState(!1),[u,h]=b.useState(!1),[p,f]=b.useState(null),[v,w]=b.useState(-1),m=$l(n,300),y=b.useRef(null),x=b.useRef(null);b.useEffect(()=>{const k=_=>{y.current&&!y.current.contains(_.target)&&h(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]),b.useEffect(()=>{async function k(){if(!m.trim()){l([]),f(null);return}if(m.trim().length<2){l([]),f(null),h(!1);return}d(!0),f(null);try{const _=await Cl(m);_.length===0&&f("No tracks found"),l(_),h(!0),w(-1)}catch(_){console.error("Failed to fetch tracks:",_),f("Failed to search tracks. Please try again.")}finally{d(!1)}}k()},[m]),b.useEffect(()=>{if(v>=0&&x.current){const k=x.current.querySelectorAll("button");k[v]&&k[v].scrollIntoView({behavior:"smooth",block:"nearest"})}},[v]),b.useEffect(()=>{async function k(){if(e){const _=Dt(e,"track");if(_){d(!0),f(null);try{const D=await wr(_);D?t(D):f("Track not found")}catch(D){console.error("Failed to fetch initial track:",D),f("Failed to load track. Please try again.")}finally{d(!1)}}}}k()},[e,t]);const T=async k=>{t(k),h(!1),o(""),f(null)},j=async k=>{o(k),f(null);const _=Dt(k,"track");if(_){d(!0);try{const D=await wr(_);D?T(D):f("Invalid Spotify URL or track not found")}catch(D){console.error("Failed to fetch track:",D),f("Failed to load track. Please try again.")}finally{d(!1)}}},N=k=>{k.preventDefault(),k.stopPropagation(),r(),o(""),f(null),h(!1),setTimeout(()=>{var D;const _=(D=y.current)==null?void 0:D.querySelector("input");_&&_.focus()},0)},S=k=>{if(!u||i.length===0){k.key==="Enter"&&(k.preventDefault(),k.stopPropagation());return}switch(k.key){case"ArrowDown":k.preventDefault(),w(_=>_<i.length-1?_+1:_);break;case"ArrowUp":k.preventDefault(),w(_=>_>0?_-1:-1);break;case"Enter":k.preventDefault(),k.stopPropagation(),v>=0&&v<i.length&&T(i[v]);break;case"Escape":h(!1),w(-1);break}};return a?s.jsxs("div",{className:"mt-3 p-3 bg-gray-50 rounded-lg flex items-center gap-4 group relative",children:[s.jsx("img",{src:(E=a.album.images[a.album.images.length-1])==null?void 0:E.url,alt:a.album.name,className:"w-16 h-16 object-cover rounded-md"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-medium text-gray-900",children:a.name}),s.jsx("p",{className:"text-sm text-gray-600",children:a.artists.map(k=>k.name).join(", ")}),s.jsx("p",{className:"text-xs text-gray-500",children:a.album.name})]}),s.jsx("button",{onClick:N,className:"absolute top-2 right-2 p-1 rounded-full bg-gray-200 hover:bg-gray-300 transition-colors","aria-label":"Clear selection",children:s.jsx(et,{className:"w-4 h-4 text-gray-600"})})]}):s.jsxs("div",{ref:y,className:"relative",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Rt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),s.jsx("input",{type:"text",placeholder:"Search for your track or paste Spotify URL...",value:n,onChange:k=>j(k.target.value),onFocus:()=>h(!0),onKeyDown:S,className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent"}),c&&s.jsx(Ie,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5 animate-spin"})]}),p&&s.jsxs("div",{className:"mt-2 text-sm text-red-600 flex items-center gap-1",children:[s.jsx(ue,{className:"w-4 h-4"}),p]}),u&&(i.length>0||c)&&s.jsxs("div",{ref:x,className:"absolute z-50 w-full mt-1 bg-white rounded-lg shadow-lg border border-gray-200 max-h-80 overflow-y-auto",children:[i.map((k,_)=>{var D;return s.jsxs("button",{onClick:H=>{H.preventDefault(),T(k)},onMouseEnter:()=>w(_),className:`w-full p-3 flex items-center gap-3 border-b border-gray-100 last:border-0 transition-colors ${_===v?"bg-indigo-50":"hover:bg-gray-50"}`,children:[s.jsx("img",{src:(D=k.album.images[k.album.images.length-1])==null?void 0:D.url,alt:k.album.name,className:"w-10 h-10 object-cover rounded"}),s.jsxs("div",{className:"flex-1 text-left",children:[s.jsx("p",{className:"font-medium text-gray-900 line-clamp-1",children:k.name}),s.jsx("p",{className:"text-sm text-gray-500 line-clamp-1",children:k.artists.map(H=>H.name).join(", ")})]})]},k.id)}),c&&s.jsxs("div",{className:"p-4 text-center text-gray-500",children:[s.jsx(Ie,{className:"w-6 h-6 animate-spin mx-auto"}),s.jsx("p",{className:"mt-2",children:"Searching tracks..."})]})]})]})}const Dl={async submit(t){const{data:e,error:a}=await L.from("submissions").insert({playlist_id:t.playlistId,track_id:t.trackId,track_name:t.trackName,track_url:t.trackUrl,artist_name:t.artistName,email:t.email,message:t.message,status:"pending",created_at:new Date().toISOString(),updated_at:new Date().toISOString()}).select(` *, playlist:playlists ( name ) `).single();if(a)throw console.error("Failed to create submission:",a),a;return e},async getAll(){const{data:t,error:e}=await L.from("submission_details").select("*").order("created_at",{ascending:!1});if(e)throw console.error("Failed to fetch submissions:",e),e;return t.map(a=>({...a,playlist:{name:a.playlist_name}}))},async getHistory(t){const{data:e,error:a}=await L.from("submission_details").select("*").eq("email",t).order("created_at",{ascending:!1});if(a)throw console.error("Failed to fetch submission history:",a),a;return e.map(r=>({...r,playlist:{name:r.playlist_name}}))},async getForPlaylist(t){const{data:e,error:a}=await L.from("submission_details").select("*").eq("playlist_id",t).order("created_at",{ascending:!1});if(a)throw console.error("Failed to fetch playlist submissions:",a),a;return e.map(r=>({...r,playlist:{name:r.playlist_name}}))},async updateStatus(t,e){const{data:a,error:r}=await L.from("submissions").update({status:e,reviewed_at:e==="pending"?null:new Date().toISOString(),updated_at:new Date().toISOString()}).eq("id",t).select(` *, playlist:playlists ( name ) `).single();if(r)throw console.error("Failed to update submission status:",r),r;return a}};function tt({playlist:t,onClose:e,onSubmit:a}){const[r,n]=b.useState(()=>{var x;const y=Ze();return{spotifyUrl:((x=y==null?void 0:y.lastTrack)==null?void 0:x.external_urls.spotify)||"",artistName:(y==null?void 0:y.artistName)||"",email:(y==null?void 0:y.email)||"",message:""}}),[o,i]=b.useState(()=>{const y=Ze();return(y==null?void 0:y.lastTrack)||null}),[l,c]=b.useState({}),[d,u]=b.useState({allowed:!0,remainingSubmissions:$t,timeUntilReset:null,totalSubmissions:0,alreadySubmittedToPlaylist:!1}),[h,p]=b.useState("");b.useEffect(()=>{const y=T=>{const j=document.querySelector(".modal-content");j&&!j.contains(T.target)&&e()},x=T=>{T.key==="Escape"&&e()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",x)}},[e]),b.useEffect(()=>{if(r.spotifyUrl){const y=Pl(r.spotifyUrl,t.id);u(y)}},[r.spotifyUrl,t.id]),b.useEffect(()=>{let y;const x=()=>{if(d.timeUntilReset){const T=Math.floor(d.timeUntilReset/36e5),j=Math.floor(d.timeUntilReset%(1e3*60*60)/(1e3*60)),N=Math.floor(d.timeUntilReset%(1e3*60)/1e3);p(`${T}h ${j}m ${N}s`)}};return d.timeUntilReset&&(x(),y=setInterval(()=>{const T=d.timeUntilReset-1e3;T<=0?(clearInterval(y),u(j=>({...j,timeUntilReset:null,allowed:!0}))):(u(j=>({...j,timeUntilReset:T})),x())},1e3)),()=>{y&&clearInterval(y)}},[d.timeUntilReset]);const f=()=>{const y={};return o||(y.spotifyUrl="Please select a track"),r.artistName.trim()||(y.artistName="Artist name is required"),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.email)||(y.email="Please enter a valid email address"),c(y),Object.keys(y).length===0},v=async y=>{if(y.preventDefault(),!(!d.allowed||d.alreadySubmittedToPlaylist)&&f())try{const x=Dt(r.spotifyUrl,"track");if(!x||!o)throw new Error("Invalid track selection");await Dl.submit({playlistId:t.id,trackId:x,trackName:o.name,trackUrl:r.spotifyUrl,artistName:r.artistName,email:r.email,message:r.message}),mn({artistName:r.artistName,email:r.email,track:o}),Ol(r.spotifyUrl,t.id),Sl(t.id,r.spotifyUrl),a(r)}catch(x){console.error("Failed to submit track:",x),c(T=>({...T,submit:"Failed to submit track. Please try again."}))}},w=y=>{i(y),n(x=>{var T;return{...x,spotifyUrl:y.external_urls.spotify,artistName:((T=y.artists[0])==null?void 0:T.name)||x.artistName}}),c(x=>({...x,spotifyUrl:void 0}))},m=()=>{i(null),n(y=>({...y,spotifyUrl:"",artistName:y.artistName})),c(y=>({...y,spotifyUrl:void 0}))};return s.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",children:s.jsxs("div",{className:"modal-content bg-white rounded-xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[s.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-200",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{className:"flex gap-3 sm:gap-4",children:[t.image_url&&s.jsx("img",{src:t.image_url,alt:t.name,className:"w-12 h-12 sm:w-16 sm:h-16 rounded-lg object-cover shadow-sm",style:{marginTop:"0.43rem"}}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg sm:text-xl font-bold text-gray-900",children:"Submit Your Track"}),s.jsxs("p",{className:"text-sm sm:text-base text-gray-600",children:["Submitting to: ",s.jsx("span",{className:"font-medium",children:t.name})]})]})]}),s.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-500 transition-colors",children:s.jsx(et,{className:"w-6 h-6"})})]}),o&&s.jsx("div",{className:"mt-3 flex flex-col gap-2 text-sm",children:s.jsx("div",{className:`px-3 py-2 rounded-lg ${d.alreadySubmittedToPlaylist?"bg-yellow-100 text-yellow-800":d.allowed?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:d.alreadySubmittedToPlaylist?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ue,{className:"w-4 h-4"}),"Already submitted to this playlist"]}):d.allowed?s.jsxs("span",{children:[d.remainingSubmissions,"/",$t," Submissions Remaining Today"]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ue,{className:"w-4 h-4"}),"Each track can be submitted to up to 10 playlists per day."]}),h&&s.jsxs("div",{className:"text-sm mt-1",children:["(Resets in ",h,")"]})]})})})]}),s.jsxs("form",{onSubmit:v,className:"p-4 sm:p-6 space-y-3 sm:space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[s.jsx(ol,{className:"w-4 h-4"}),"Search and Select Your Track"]}),s.jsx(Tn,{onTrackSelect:w,selectedTrack:o,onClearTrack:m}),l.spotifyUrl&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:l.spotifyUrl})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[s.jsx(Kt,{className:"w-4 h-4"}),"Artist Name"]}),s.jsx("input",{type:"text",placeholder:"Your artist name",value:r.artistName,onChange:y=>n(x=>({...x,artistName:y.target.value})),className:"w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",disabled:!d.allowed||d.alreadySubmittedToPlaylist}),l.artistName&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:l.artistName})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[s.jsx(ll,{className:"w-4 h-4"}),"Email"]}),s.jsx("input",{type:"email",placeholder:"your@email.com",value:r.email,onChange:y=>n(x=>({...x,email:y.target.value})),className:"w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",disabled:!d.allowed||d.alreadySubmittedToPlaylist}),l.email&&s.jsx("p",{className:"mt-1 text-sm text-red-600",children:l.email})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[s.jsx(cl,{className:"w-4 h-4"}),"Message (Optional)"]}),s.jsx("textarea",{placeholder:"Tell the curator about your track...",value:r.message,onChange:y=>n(x=>({...x,message:y.target.value})),rows:3,className:"w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent resize-none sm:resize-y",disabled:!d.allowed||d.alreadySubmittedToPlaylist})]}),l.submit&&s.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-sm",children:[s.jsx(ue,{className:"w-4 h-4"}),s.jsx("p",{children:l.submit})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-2 sm:pt-4",children:[s.jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:!d.allowed||d.alreadySubmittedToPlaylist,className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${!d.allowed||d.alreadySubmittedToPlaylist?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-500 text-white hover:bg-green-600"}`,children:[s.jsx(fe,{className:"w-4 h-4"}),"Submit Track"]})]})]})]})})}const Ll=Object.freeze(Object.defineProperty({__proto__:null,SubmissionModal:tt},Symbol.toStringTag,{value:"Module"}));function Ul({message:t,type:e,onClose:a}){const[r,n]=b.useState(!1);b.useEffect(()=>{const l=setTimeout(()=>{n(!0)},4700);return()=>clearTimeout(l)},[]),b.useEffect(()=>{if(r){const l=setTimeout(()=>{a()},300);return()=>clearTimeout(l)}},[r,a]);const o={success:"bg-green-500",error:"bg-red-500",info:"bg-blue-500"}[e],i={success:rl,error:ue,info:ue}[e];return s.jsxs("div",{className:` fixed bottom-4 right-4 ${o} text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3 max-w-md transition-all duration-300 ${r?"opacity-0 translate-y-2":"opacity-100 translate-y-0"} `,children:[s.jsx(i,{className:"w-5 h-5 flex-shrink-0"}),s.jsx("p",{className:"flex-1",children:t}),s.jsx("button",{onClick:()=>n(!0),className:"p-1 hover:bg-white/20 rounded-full transition-colors",children:s.jsx(et,{className:"w-4 h-4"})})]})}function xt(t){const[e]=b.useState(()=>{let a=document.getElementById("toast-container");return a||(a=document.createElement("div"),a.id="toast-container",document.body.appendChild(a)),a});return Er.createPortal(s.jsx(Ul,{...t}),e)}function Ml({playlist:t,baseUrl:e}){var r;const a={"@context":"https://schema.org","@type":"MusicPlaylist",name:t.name,description:`Get your music featured on ${t.name}, a Spotify playlist curated by ${t.curator_name} with ${t.followers.toLocaleString()} followers. No account needed! Access thousands of playlists and connect with curators on PlaylistPartner.com.`,numTracks:t.track_count,url:`${e}/playlist/${t.spotify_id}`,sameAs:[`https://open.spotify.com/playlist/${t.spotify_id}`],dateModified:t.updated_at,image:t.image_url,author:{"@type":"Person",name:t.curator_name,url:t.curator_profile_url},genre:[t.genre,...((r=t.sub_genres)==null?void 0:r.slice(0,2))||[]].filter(Boolean),interactionStatistic:{"@type":"InteractionCounter",interactionType:"https://schema.org/FollowAction",userInteractionCount:t.followers},isPartOf:{"@id":e}};return s.jsx("script",{type:"application/ld+json",children:JSON.stringify(a)})}function Bl(){var N;const{slug:t}=Bt(),e=Re(),a=Mt(),[r,n]=b.useState(!1),[o,i]=b.useState(null),[l,c]=b.useState(0),{playlist:d,loading:u,error:h,relatedPlaylists:p,isNotFound:f}=jl(t||""),[v,w]=b.useState(!1);b.useEffect(()=>{w(!1)},[t]),b.useEffect(()=>{!u&&d&&!h&&!f&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[u,d,h,f]),b.useEffect(()=>{async function S(){if(d!=null&&d.genre){const{count:E}=await L.from("playlist_details").select("*",{count:"exact",head:!0}).eq("genre",d.genre);c(E||0)}}d&&S()},[d]);const m=Ze(),y=d&&(m==null?void 0:m.lastTrack)&&vn(d.id,m.lastTrack.external_urls.spotify),x=()=>{var E;const S=(E=a.state)==null?void 0:E.from;e(S==="genre"?-1:"/playlists")},T=async S=>{try{n(!1),i({type:"success",message:`Track submitted to ${d==null?void 0:d.name}! Watch your inbox for feedback from the curator.`})}catch(E){console.error("Failed to submit track:",E),i({type:"error",message:"Failed to submit track. Please try again."})}};if(u)return s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsxs("div",{className:"animate-pulse",children:[s.jsx("div",{className:"h-8 w-48 bg-gray-200 rounded mb-6"}),s.jsx("div",{className:"bg-white shadow-lg",children:s.jsxs("div",{className:"grid md:grid-cols-2",children:[s.jsx("div",{className:"aspect-square bg-gray-200"}),s.jsxs("div",{className:"p-6",children:[s.jsx("div",{className:"h-8 w-3/4 bg-gray-200 rounded mb-4"}),s.jsx("div",{className:"h-4 w-1/2 bg-gray-200 rounded mb-4"}),s.jsx("div",{className:"h-20 bg-gray-200 rounded mb-4"})]})]})})]})});if(f||!d)return s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 text-red-600 mb-4",children:[s.jsx(ue,{className:"w-6 h-6"}),s.jsx("h2",{className:"text-2xl font-bold",children:"Playlist Not Found"})]}),s.jsx("p",{className:"text-gray-600 mb-6",children:"The playlist you're looking for doesn't exist or may have been removed."}),s.jsxs("button",{onClick:x,className:"text-green-600 hover:text-green-700 flex items-center gap-2 mx-auto",children:[s.jsx(he,{className:"w-4 h-4"}),"Back to Playlists"]})]})});if(h)return s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 text-red-600 mb-4",children:[s.jsx(ue,{className:"w-6 h-6"}),s.jsx("h2",{className:"text-2xl font-bold",children:"Error Loading Playlist"})]}),s.jsx("p",{className:"text-gray-600 mb-6",children:h.message||"Something went wrong. Please try again."}),s.jsxs("button",{onClick:x,className:"text-green-600 hover:text-green-700 flex items-center gap-2 mx-auto",children:[s.jsx(he,{className:"w-4 h-4"}),"Back to Playlists"]})]})});const j=`Get your music featured on ${d.name}, a Spotify playlist curated by ${d.curator_name||"Independent Curator"}. No account needed! Access ${l} ${d.genre} playlists and connect with curators on PlaylistPartner.com.`;return s.jsxs(s.Fragment,{children:[s.jsx(le,{title:d==null?void 0:d.name,description:j,image:d==null?void 0:d.image_url,playlist:d?{name:d.name,curator_name:d.curator_name,followers:d.followers,updated_at:d.updated_at,genre:d.genre,genre_count:l}:void 0}),d&&s.jsx(Ml,{playlist:d,baseUrl:window.location.origin}),s.jsxs("main",{className:"container mx-auto px-4 py-8",children:[s.jsxs("button",{onClick:x,className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[s.jsx(he,{className:"w-4 h-4"}),"Back to Playlists"]}),s.jsx("div",{className:"bg-white shadow-lg",children:s.jsxs("div",{className:"grid md:grid-cols-2",children:[s.jsx("div",{className:"relative aspect-square bg-gray-100",children:!d.image_url||v?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200",children:s.jsxs("div",{className:"text-center",children:[s.jsx(hn,{className:"w-16 h-16 text-gray-400 mx-auto mb-3"}),s.jsx("div",{className:"text-base text-gray-500 font-medium px-4 truncate max-w-[300px]",children:d.name})]})}):s.jsx("img",{src:d.image_url,alt:d.name,className:"w-full h-full object-cover",onError:()=>w(!0)})}),s.jsxs("div",{className:"p-6 flex flex-col justify-between",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[s.jsx("h1",{className:"text-3xl md:text-4xl font-bold",children:d.name}),s.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[d.featured&&s.jsxs("div",{className:"bg-yellow-400 text-yellow-900 px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-1.5",children:[s.jsx(fn,{className:"w-4 h-4"}),"Featured"]}),(()=>{const S=xn(d.published_at);if(!S)return null;const k={today:{text:"Added Today",bg:"bg-green-500",textColor:"text-white"},yesterday:{text:"Added Yesterday",bg:"bg-blue-500",textColor:"text-white"},"this-week":{text:"Added This Week",bg:"bg-purple-500",textColor:"text-white"}}[S];return s.jsxs("div",{className:`${k.bg} ${k.textColor} px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-1.5`,children:[s.jsx(un,{className:"w-4 h-4"}),k.text]})})()]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-4",children:[s.jsx(Kt,{className:"w-5 h-5"}),s.jsx("span",{className:"text-lg",children:"Curated by "}),d.curator_profile_url?s.jsx("a",{href:d.curator_profile_url,target:"_blank",rel:"noopener noreferrer",className:"text-lg hover:text-green-600 transition-colors",children:d.curator_name}):s.jsx("span",{className:"text-lg",children:d.curator_name||"Independent Curator"})]}),s.jsx("p",{className:"text-gray-600 text-lg mb-4",children:d.description}),s.jsxs("div",{className:"flex flex-wrap gap-6 mb-4",children:[s.jsxs(I,{to:`/genre/${d.genre_slug}`,className:"flex items-center text-gray-700 hover:text-green-600 transition-colors",children:[s.jsx(fe,{className:"w-5 h-5 mr-2"}),s.jsx("span",{className:"text-lg",children:d.genre})]}),s.jsxs("div",{className:"flex items-center text-gray-700",children:[s.jsx(Jt,{className:"w-5 h-5 mr-2"}),s.jsxs("span",{className:"text-lg",children:[d.followers.toLocaleString()," followers"]})]})]}),((N=d.sub_genres)==null?void 0:N.length)>0&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:d.sub_genres.map(S=>s.jsx(I,{to:`/genre/${d.genre_slug}/${S.toLowerCase().replace(/\s+/g,"-")}`,className:"px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-sm hover:bg-gray-200 transition-colors",children:S},S))})]}),y?s.jsxs("div",{className:"w-full sm:w-auto flex items-center justify-center gap-2 bg-gray-100 text-gray-500 px-6 py-3 font-medium",children:[s.jsx(cn,{className:"w-5 h-5"}),"Track Submitted"]}):s.jsxs("button",{onClick:()=>n(!0),className:"w-full sm:w-auto flex items-center justify-center gap-2 bg-green-500 text-white px-6 py-3 hover:bg-green-600 transition-colors text-lg font-medium",children:[s.jsx(pn,{className:"w-5 h-5"}),"Submit Your Track"]})]})]})}),p.length>0&&s.jsxs("div",{className:"mt-12",children:[s.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Related Playlists"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:p.map(S=>s.jsx(Ha,{playlist:S,onSubmit:()=>n(!0),isRelated:!0,hideSubmit:!0},S.id))})]}),r&&d&&s.jsx(tt,{playlist:d,onClose:()=>n(!1),onSubmit:T}),o&&s.jsx(xt,{message:o.message,type:o.type,onClose:()=>i(null)})]})]})}function Fl({filters:t,onFilterChange:e,hideGenreFilter:a,autoFocus:r}){const{genres:n,loading:o}=$e(),i=n.find(d=>d.name===t.genre),l=b.useRef(null),c=b.useRef(null);return b.useEffect(()=>{r&&l.current&&c.current&&(l.current.focus(),c.current.classList.add("search-focus-animation"),setTimeout(()=>{var d;(d=c.current)==null||d.classList.remove("search-focus-animation")},1800),window.history.replaceState({},""))},[r]),s.jsx("div",{className:"bg-white shadow-sm -mx-4 px-4",children:s.jsx("div",{className:"max-w-[1400px] mx-auto",children:s.jsxs("div",{className:`grid ${a?"grid-cols-2":"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"} gap-4 py-4`,children:[s.jsxs("div",{ref:c,className:"relative search-container",children:[s.jsx(Rt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5 z-10"}),s.jsx("input",{ref:l,type:"text",placeholder:"Search playlists...",value:t.search,onChange:d=>e({...t,search:d.target.value}),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent transition-all"})]}),!a&&s.jsxs("div",{className:"relative",children:[s.jsx(fe,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),s.jsxs("select",{value:t.genre,onChange:d=>e({...t,genre:d.target.value,subGenre:""}),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg appearance-none focus:ring-2 focus:ring-green-500 focus:border-transparent disabled:bg-gray-50 disabled:text-gray-500",disabled:o,children:[s.jsx("option",{value:"",children:"All Genres"}),n.map(d=>s.jsx("option",{value:d.name,children:d.name},d.id))]})]}),s.jsx("div",{className:"relative",children:s.jsxs("select",{value:t.subGenre||"",onChange:d=>e({...t,subGenre:d.target.value}),className:`w-full px-4 py-2 border border-gray-300 rounded-lg appearance-none transition-colors ${i?"focus:ring-2 focus:ring-green-500 focus:border-transparent":"bg-gray-50 text-gray-400 cursor-not-allowed"}`,disabled:!i,children:[s.jsx("option",{value:"",children:i?"All Sub-genres":"-- Select a genre first --"}),i==null?void 0:i.subGenres.map(d=>s.jsx("option",{value:d.name,children:d.name},d.id))]})}),s.jsx("div",{className:"relative",children:s.jsxs("select",{value:t.sortBy,onChange:d=>e({...t,sortBy:d.target.value}),className:"w-full px-4 py-2 border border-gray-300 rounded-lg appearance-none focus:ring-2 focus:ring-green-500 focus:border-transparent",children:[s.jsx("option",{value:"default",children:"Default (Most Recent)"}),s.jsx("option",{value:"followers-high",children:"Most Followers"}),s.jsx("option",{value:"followers-low",children:"Least Followers"})]})})]})})})}const ot="playlist_state";function Yt(t){const[e,a]=b.useState(()=>{try{const w=sessionStorage.getItem(ot);if(w){const m=JSON.parse(w);if(JSON.stringify(m.filters)===JSON.stringify(t))return m.playlists}return[]}catch{return[]}}),[r,n]=b.useState(!0),[o,i]=b.useState(null),[l,c]=b.useState(!0),[d,u]=b.useState(()=>{try{const w=sessionStorage.getItem(ot);if(w){const m=JSON.parse(w);if(JSON.stringify(m.filters)===JSON.stringify(t))return m.currentPage}return 1}catch{return 1}}),[h,p]=b.useState(0),f=12;return b.useEffect(()=>{!r&&h>0&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[r,h]),b.useEffect(()=>{(()=>{const m=sessionStorage.getItem(ot);if(m){const y=JSON.parse(m);return JSON.stringify(y.filters)!==JSON.stringify(t)}return!0})()&&(a([]),u(1),c(!0),sessionStorage.removeItem(ot))},[t==null?void 0:t.genre,t==null?void 0:t.subGenre,t==null?void 0:t.search,t==null?void 0:t.sortBy]),b.useEffect(()=>{if(e.length>0){const w={playlists:e,currentPage:d,filters:t||{}};sessionStorage.setItem(ot,JSON.stringify(w))}},[e,d,t]),b.useEffect(()=>{async function w(){try{n(!0),i(null);let m=L.from("playlist_details").select("*",{count:"exact"});if(t!=null&&t.genre&&(m=m.eq("genre",t.genre)),t!=null&&t.subGenre&&(m=m.contains("sub_genres",[t.subGenre])),t!=null&&t.search){const y=`%${t.search}%`;m=m.or(`name.ilike.${y},description.ilike.${y}`)}switch(t==null?void 0:t.sortBy){case"followers-high":case"followers-low":if(!(t!=null&&t.genre)&&!(t!=null&&t.subGenre)){let y=L.from("playlist_details").select("*").eq("featured",!0).order("id",{ascending:!1});if(t!=null&&t.search){const _=`%${t.search}%`;y=y.or(`name.ilike.${_},description.ilike.${_}`)}const{data:x}=await y,T=x?[...x].sort((_,D)=>{const H=Ge(),we=z(`${H}-featured-${_.id}`),Te=z(`${H}-featured-${D.id}`);return we-Te}).slice(0,4):[];let j,N;d===1?(j=Math.max(8,12-T.length),N=0):(j=12,N=12-T.length+(d-2)*12);let S=L.from("playlist_details").select("*",{count:"exact"}).order("followers",{ascending:t.sortBy==="followers-low"}).order("id",{ascending:!1});if(t!=null&&t.search){const _=`%${t.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:k}=await S.range(N,N+j-1);if(d===1){const _=[...T,...E||[]];a(_)}else a(_=>[..._,...E||[]]);p(k||0),c(N+j<(k||0)),n(!1);return}else{let y=L.from("playlist_details").select("*").eq("featured",!0).eq("genre",t.genre).order("id",{ascending:!1});if(t!=null&&t.subGenre&&(y=y.contains("sub_genres",[t.subGenre])),t!=null&&t.search){const _=`%${t.search}%`;y=y.or(`name.ilike.${_},description.ilike.${_}`)}const{data:x}=await y,T=x?[...x].sort((_,D)=>{const H=Ge(),we=z(`${H}-featured-${_.id}`),Te=z(`${H}-featured-${D.id}`);return we-Te}).slice(0,4):[];let j,N;d===1?(j=Math.max(8,12-T.length),N=0):(j=12,N=12-T.length+(d-2)*12);let S=L.from("playlist_details").select("*",{count:"exact"}).eq("genre",t.genre).order("followers",{ascending:t.sortBy==="followers-low"}).order("id",{ascending:!1});if(t!=null&&t.subGenre&&(S=S.contains("sub_genres",[t.subGenre])),t!=null&&t.search){const _=`%${t.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:k}=await S.range(N,N+j-1);if(d===1){const _=[...T,...E||[]];a(_)}else a(_=>[..._,...E||[]]);p(k||0),c(N+j<(k||0)),n(!1);return}case"default":default:if(!(t!=null&&t.genre)&&!(t!=null&&t.subGenre)){let y=L.from("playlist_details").select("*").eq("featured",!0).order("id",{ascending:!1});if(t!=null&&t.search){const _=`%${t.search}%`;y=y.or(`name.ilike.${_},description.ilike.${_}`)}const{data:x}=await y,T=x?[...x].sort((_,D)=>{const H=Ge(),we=z(`${H}-featured-${_.id}`),Te=z(`${H}-featured-${D.id}`);return we-Te}).slice(0,4):[];let j,N;d===1?(j=Math.max(8,12-T.length),N=0):(j=12,N=12-T.length+(d-2)*12);let S=L.from("playlist_details").select("*",{count:"exact"}).order("published_at",{ascending:!1,nullsFirst:!1}).order("id",{ascending:!1});if(t!=null&&t.search){const _=`%${t.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:k}=await S.range(N,N+j-1);if(d===1){const _=[...T,...E||[]];a(_)}else a(_=>[..._,...E||[]]);p(k||0),c(N+j<(k||0)),n(!1);return}else{let y=L.from("playlist_details").select("*").eq("featured",!0).eq("genre",t.genre).order("id",{ascending:!1});if(t!=null&&t.subGenre&&(y=y.contains("sub_genres",[t.subGenre])),t!=null&&t.search){const _=`%${t.search}%`;y=y.or(`name.ilike.${_},description.ilike.${_}`)}const{data:x}=await y,T=x?[...x].sort((_,D)=>{const H=Ge(),we=z(`${H}-featured-${_.id}`),Te=z(`${H}-featured-${D.id}`);return we-Te}).slice(0,4):[];let j,N;d===1?(j=Math.max(8,12-T.length),N=0):(j=12,N=12-T.length+(d-2)*12);let S=L.from("playlist_details").select("*",{count:"exact"}).eq("genre",t.genre).order("published_at",{ascending:!1,nullsFirst:!1}).order("id",{ascending:!1});if(t!=null&&t.subGenre&&(S=S.contains("sub_genres",[t.subGenre])),t!=null&&t.search){const _=`%${t.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:k}=await S.range(N,N+j-1);if(d===1){const _=[...T,...E||[]];a(_)}else a(_=>[..._,...E||[]]);p(k||0),c(N+j<(k||0)),n(!1);return}}}catch(m){console.error("Failed to fetch playlists:",m),i(m instanceof Error?m:new Error("Failed to fetch playlists"))}finally{n(!1)}}w()},[d,t==null?void 0:t.genre,t==null?void 0:t.subGenre,t==null?void 0:t.search,t==null?void 0:t.sortBy]),{playlists:e,loading:r,error:o,hasMore:l,loadMore:()=>{!r&&l&&u(w=>w+1)},currentPage:d,totalCount:h,itemsPerPage:f}}function Wl(){var j,N,S;const t=Mt(),[e,a]=Ar(),[r,n]=b.useState(()=>{var _;const E=(_=t.state)==null?void 0:_.filters,k=sessionStorage.getItem("playlist_filters");return k&&!(E!=null&&E.fromSubmission)?JSON.parse(k):E?(window.history.replaceState({},""),{search:"",genre:E.genre||"",subGenre:E.subGenre||"",sortBy:"default"}):{search:"",genre:"",subGenre:"",sortBy:"default"}});b.useEffect(()=>{window.scrollTo(0,0)},[]);const{playlists:o,loading:i,error:l,hasMore:c,loadMore:d,totalCount:u}=Yt({...r,genre:r.genre||void 0,subGenre:r.subGenre||void 0}),[h,p]=b.useState(null),[f,v]=b.useState(null),w=Ze(),[m,y]=b.useState(!0);b.useEffect(()=>{var E;if(!i&&o.length>0&&m){const k=(E=t.state)==null?void 0:E.filters;k!=null&&k.fromSubmission?window.scrollTo(0,0):bn.restorePosition(t.pathname,a),y(!1)}},[i,o.length,t.pathname,t.state,a,m]),b.useEffect(()=>{sessionStorage.setItem("playlist_filters",JSON.stringify(r))},[r]);const x=o.length>0?1:0,T=o.length;return s.jsxs(s.Fragment,{children:[s.jsx(le,{}),s.jsxs("main",{children:[s.jsxs("div",{className:"container mx-auto px-4 pb-12",children:[s.jsx(Fl,{filters:r,onFilterChange:n,autoFocus:(j=t.state)==null?void 0:j.focusSearch}),(w==null?void 0:w.lastTrack)&&s.jsxs("div",{className:"mb-6 flex items-center justify-between bg-white p-4 shadow-sm rounded-lg max-w-[1400px] mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("img",{src:(N=w.lastTrack.album.images[2])==null?void 0:N.url,alt:w.lastTrack.name,className:"w-12 h-12 object-cover rounded-md"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:w.lastTrack.name}),s.jsx("p",{className:"text-sm text-gray-600",children:(S=w.lastTrack.artists[0])==null?void 0:S.name})]})]}),s.jsx("button",{onClick:()=>{gn(),window.location.reload()},className:"p-2 hover:bg-gray-100 rounded-full transition-colors",title:"Clear selected track",children:s.jsx(et,{className:"w-5 h-5 text-gray-500"})})]}),s.jsxs("div",{className:"max-w-[1400px] mx-auto",style:{minHeight:"800px"},children:[o.length>0&&s.jsxs("div",{className:"text-sm text-gray-600 mb-6 mt-6",children:["Showing ",x,"-",T," of ",u," playlists"]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:o.map((E,k)=>s.jsx(Ha,{playlist:E,onSubmit:_=>p(o.find(D=>D.id===_)||null),priority:k<4,showFeaturedBadge:k<4},`${E.id}-${k}`))}),i&&s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ie,{className:"w-8 h-8 text-green-500 animate-spin"})}),l&&s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-red-500",children:"Failed to load playlists. Please try again."})}),!i&&!l&&o.length===0&&s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-gray-500 text-lg",children:"No playlists found matching your criteria."})}),c&&!i&&s.jsx("div",{className:"text-center mt-8",children:s.jsx("button",{onClick:d,className:"px-6 py-3 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors",children:"Load More Playlists"})})]})]}),h&&s.jsx(tt,{playlist:h,onClose:()=>p(null),onSubmit:()=>{p(null),v({type:"success",message:`Track submitted to ${h.name}! Watch your inbox for feedback from the curator.`})}}),f&&s.jsx(xt,{message:f.message,type:f.type,onClose:()=>v(null)})]})]})}function Hl(){const t=Re(),[e,a]=b.useState(null);b.useEffect(()=>{typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[]);const r=n=>{var o;mn({artistName:((o=n.artists[0])==null?void 0:o.name)||"",email:"",track:n}),t("/submit/genre",{state:{selectedTrack:n}})};return s.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-2xl",children:[s.jsxs("button",{onClick:()=>t("/playlists"),className:"flex items-center gap-2 text-gray-600 hover:text-gray-800 transition-colors mb-6",children:[s.jsx(he,{className:"w-5 h-5"}),"Back to Playlists"]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Submit Your Track"}),s.jsx("p",{className:"text-gray-600",children:"Search for your track on Spotify to get started"})]}),s.jsx("div",{className:"bg-white p-6 rounded-xl shadow-lg",children:s.jsx(Tn,{onTrackSelect:r,selectedTrack:e,onClearTrack:()=>a(null)})}),e&&s.jsxs("button",{onClick:()=>r(e),className:"w-full flex items-center justify-center gap-2 bg-green-500 text-white p-4 rounded-lg hover:bg-green-600 transition-colors",children:["Continue to Genre Selection",s.jsx(gt,{className:"w-5 h-5"})]})]})]})}function ql(){const t=Re(),{genres:e}=$e(),[a,r]=b.useState(""),[n,o]=b.useState(""),i=e.find(u=>u.id===a),l=(i==null?void 0:i.subGenres)||[],c=u=>{o(u)},d=u=>{if(!a||!i)return;const h=n?l.find(p=>p.id===n):null;window.scrollTo(0,0),t("/playlists",{state:{filters:{genre:i.name,subGenre:(h==null?void 0:h.name)||"",fromSubmission:!0}},replace:!0})};return s.jsx("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Select Your Genre"}),s.jsx("p",{className:"text-gray-600",children:"Choose the main category that best fits your track"})]}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-medium mb-3",children:"Main Genre"}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:e.map(u=>s.jsxs("button",{onClick:()=>{r(u.id),o("")},className:`p-4 text-center border-2 rounded-lg transition-colors ${a===u.id?"border-green-500 bg-green-50":"border-gray-200 hover:border-green-500 hover:bg-green-50"}`,children:[s.jsx(fe,{className:"w-6 h-6 mx-auto mb-2 text-gray-600"}),s.jsx("span",{className:"font-medium",children:u.name})]},u.id))})]}),a&&l.length>0&&s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-medium mb-3",children:"Sub-genre (Optional)"}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:l.map(u=>s.jsx("button",{onClick:()=>c(u.id),className:`p-3 text-center border-2 rounded-lg transition-colors ${n===u.id?"border-green-500 bg-green-50":"border-gray-200 hover:border-green-500 hover:bg-green-50"}`,children:s.jsx("span",{className:"font-medium",children:u.name})},u.id))})]}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("button",{onClick:()=>t("/submit"),className:"flex items-center gap-2 text-gray-600 hover:text-gray-800 transition-colors",children:[s.jsx(he,{className:"w-5 h-5"}),"Back to Track Selection"]}),s.jsxs("button",{onClick:()=>d(),disabled:!a,className:`flex items-center gap-2 px-6 py-3 rounded-lg font-medium transition-colors ${a?"bg-green-500 text-white hover:bg-green-600":"bg-gray-200 text-gray-500 cursor-not-allowed"}`,children:["Continue to Playlists",s.jsx(gt,{className:"w-5 h-5"})]})]})]})})}function Gl(t=4,e,a){const[r,n]=b.useState([]),[o,i]=b.useState(!0),[l,c]=b.useState(null);return b.useEffect(()=>{!o&&r.length>0&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[o,r.length]),b.useEffect(()=>{async function d(){try{i(!0),c(null);let u=L.from("playlist_details").select("*").eq("featured",!0);e&&(u=u.eq("genre",e)),a&&(u=u.contains("sub_genres",[a]));const{data:h,error:p}=await u;if(p)throw p;const f=h||[];if(f.length>=t){const S=Ge(),E=[...f].sort((k,_)=>{const D=z(`${S}-${k.id}`),H=z(`${S}-${_.id}`);return D-H});n(E.slice(0,t));return}const v=t-f.length;let w=L.from("playlist_details").select("*").eq("featured",!1);e&&(w=w.eq("genre",e)),a&&(w=w.contains("sub_genres",[a]));const{data:m,error:y}=await w;if(y)throw y;const x=Ge(),T=[...f].sort((S,E)=>{const k=z(`${x}-featured-${S.id}`),_=z(`${x}-featured-${E.id}`);return k-_}),j=[...m||[]].sort((S,E)=>{const k=z(`${x}-nonfeatured-${S.id}`),_=z(`${x}-nonfeatured-${E.id}`);return k-_}),N=[...T,...j.slice(0,v)];n(N)}catch(u){console.error("Failed to fetch playlists:",u),c(u instanceof Error?u:new Error("Failed to fetch playlists"))}finally{i(!1)}}d()},[t,e,a]),{playlists:r,loading:o,error:l}}function _n({genre:t,subGenre:e,totalCount:a,onViewAll:r}){const{playlists:n,loading:o}=Gl(8,t,e),[i,l]=b.useState(null),[c,d]=b.useState(null);if(o||n.length===0)return null;const h=new Date().toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"}),p=e?`Today's Featured ${e} ${t} Playlists - ${h}`:`Today's Featured ${t} Playlists - ${h}`,f=new URLSearchParams;return f.set("genre",t),e&&f.set("subGenre",e),s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"border-l-4 border-green-500 pl-6 mb-8",children:[s.jsx("h2",{className:"text-2xl font-semibold text-gray-900 mb-6",children:p}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.map(v=>s.jsx(Ha,{playlist:v,onSubmit:w=>l(n.find(m=>m.id===w)||null),priority:!0,showFeaturedBadge:!0},v.id))})]}),s.jsx("div",{className:"text-center mb-12",children:s.jsxs("button",{onClick:r,className:"inline-block px-8 py-4 bg-green-500 text-white text-lg font-semibold rounded-lg hover:bg-green-600 transition-all transform hover:scale-105 shadow-lg hover:shadow-xl",children:["View All ",a.toLocaleString()," ",e?`${e} ${t}`:t," Playlists"]})}),i&&s.jsx(tt,{playlist:i,onClose:()=>l(null),onSubmit:()=>{l(null),d({type:"success",message:`Track submitted to ${i.name}! Watch your inbox for feedback from the curator.`})}}),c&&s.jsx(xt,{message:c.message,type:c.type,onClose:()=>d(null)})]})}const zl="https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png";function Kl(){const{genre:t}=Bt(),e=t?decodeURIComponent(t):"",{genres:a,loading:r}=$e(),n=a.find(y=>y.slug===e),[o,i]=b.useState(null),[l,c]=b.useState(!1),[d,u]=b.useState(null),h=Re(),{totalCount:p}=Yt({genre:n==null?void 0:n.name}),f=()=>{n&&(window.scrollTo(0,0),h("/playlists",{state:{filters:{genre:n.name,fromSubmission:!0}},replace:!0}))};if(r)return s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:s.jsx(Ie,{className:"w-8 h-8 text-green-500 animate-spin"})})});if(!r&&!n)return s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Genre Not Found"}),s.jsx(I,{to:"/",className:"text-green-600 hover:text-green-700",children:"Return to Home"})]});const v=`Free ${n.name} Spotify Playlist Submission - No Signup`,w=`Submit your ${n.name} tracks to ${p} Spotify playlists for free. Connect with independent curators and grow your audience — no signup needed.`,m=async y=>{try{c(!1),u({type:"success",message:`Track submitted to ${o==null?void 0:o.name}! Watch your inbox for feedback from the curator.`})}catch(x){console.error("Failed to submit track:",x),u({type:"error",message:"Failed to submit track. Please try again."})}};return s.jsxs(s.Fragment,{children:[s.jsx(le,{title:v,description:w,image:zl,url:`${window.location.origin}/genre/${n.slug}`,type:"website"}),s.jsxs("main",{className:"container mx-auto px-4 py-8",children:[s.jsxs(I,{to:"/",className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[s.jsx(he,{className:"w-4 h-4"}),"Back to All Genres"]}),s.jsx("div",{className:"bg-white p-6 rounded-lg shadow-sm mb-8",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:s.jsx(fe,{className:"w-8 h-8 text-green-600"})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold mb-2",children:[n.name," Spotify Playlist Submission"]}),s.jsx("p",{className:"text-gray-600 mb-4",children:n.description}),s.jsx("div",{className:"flex gap-4 text-sm text-gray-600",children:s.jsxs("span",{children:[p," Playlists"]})})]})]})}),s.jsx(_n,{genre:n.name,totalCount:p,onViewAll:f}),l&&o&&s.jsx(tt,{playlist:o,onClose:()=>{c(!1),i(null)},onSubmit:m}),d&&s.jsx(xt,{message:d.message,type:d.type,onClose:()=>u(null)})]})]})}const Jl="https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png";function Yl(){const{genre:t,subGenre:e}=Bt(),a=t?decodeURIComponent(t):"",r=e?decodeURIComponent(e):"",{genres:n,loading:o}=$e(),i=n.find(j=>j.slug===a),l=i==null?void 0:i.subGenres.find(j=>ft(j.name)===r),[c,d]=b.useState(null),[u,h]=b.useState(!1),[p,f]=b.useState(null),v=Re(),{totalCount:w}=Yt({genre:i==null?void 0:i.name,subGenre:l==null?void 0:l.name}),m=()=>{!i||!l||(window.scrollTo(0,0),v("/playlists",{state:{filters:{genre:i.name,subGenre:l.name,fromSubmission:!0}},replace:!0}))};if(o)return s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:s.jsx(Ie,{className:"w-8 h-8 text-green-500 animate-spin"})})});if(!o&&(!i||!l))return s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Sub-Genre Not Found"}),s.jsx(I,{to:"/",className:"text-green-600 hover:text-green-700",children:"Return to Home"})]});const y=`Free ${l.name} Spotify Playlist Submission - No Signup`,x=`Submit your ${l.name} tracks to ${w} Spotify playlists for free. Connect with independent curators and grow your audience — no signup needed.`,T=async j=>{try{h(!1),f({type:"success",message:`Track submitted to ${c==null?void 0:c.name}! Watch your inbox for feedback from the curator.`})}catch(N){console.error("Failed to submit track:",N),f({type:"error",message:"Failed to submit track. Please try again."})}};return s.jsxs(s.Fragment,{children:[s.jsx(le,{title:y,description:x,image:Jl,url:`${window.location.origin}/genre/${i.slug}/${l.slug}`,type:"website"}),s.jsxs("main",{className:"container mx-auto px-4 py-8",children:[s.jsxs(I,{to:`/genre/${encodeURIComponent(i.slug)}`,className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[s.jsx(he,{className:"w-4 h-4"}),"Back to ",i.name," Playlists"]}),s.jsx("div",{className:"bg-white p-6 rounded-lg shadow-sm mb-8",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:s.jsx(fe,{className:"w-8 h-8 text-green-600"})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold mb-2",children:[l.name," Spotify Playlist Submission"]}),s.jsx("p",{className:"text-gray-600 mb-4",children:l.description||`Discover curated playlists specializing in ${l.name} ${i.name} music. Submit your tracks to playlist curators who understand and appreciate your specific style.`}),s.jsx("div",{className:"flex gap-4 text-sm text-gray-600",children:s.jsxs("span",{children:[w," Playlists"]})})]})]})}),s.jsx(_n,{genre:i.name,subGenre:l.name,totalCount:w,onViewAll:m}),u&&c&&s.jsx(tt,{playlist:c,onClose:()=>{h(!1),d(null)},onSubmit:T}),p&&s.jsx(xt,{message:p.message,type:p.type,onClose:()=>f(null)})]})]})}function Vl(){const{genres:t,loading:e}=$e();return b.useEffect(()=>{!e&&t.length>0&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[e,t]),s.jsxs(s.Fragment,{children:[s.jsx(le,{title:"Browse Spotify Playlist Genres - Free Music Submission | PlaylistPartner",description:"Discover Spotify playlists in every genre and sub-genre. Submit your music directly to curators for free - from hip-hop to classical, find the perfect playlists for your sound.",image:"https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png",url:`${window.location.origin}/genres`,type:"website"}),s.jsxs("main",{className:"container mx-auto px-4 py-8 max-w-5xl",children:[s.jsxs(I,{to:"/",className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[s.jsx(he,{className:"w-4 h-4"}),"Back to Home"]}),s.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6 mb-8",children:[s.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Spotify Playlist Genres"}),s.jsx("p",{className:"text-gray-600",children:"Discover Spotify playlists in every genre and sub-genre. Submit your music directly to curators for free - from hip-hop to classical, find the perfect playlists for your sound."})]}),e?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((a,r)=>s.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm animate-pulse",children:[s.jsx("div",{className:"h-6 w-1/3 bg-gray-200 rounded mb-4"}),s.jsx("div",{className:"space-y-2",children:[...Array(4)].map((n,o)=>s.jsx("div",{className:"h-4 bg-gray-100 rounded w-2/3"},o))})]},r))}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(a=>s.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm",children:[s.jsxs(I,{to:`/genre/${ft(a.name)}`,className:"group flex items-center gap-3 mb-4",children:[s.jsx("div",{className:"p-2 bg-gray-50 rounded-lg group-hover:bg-green-50 transition-colors",children:s.jsx(fe,{className:"w-5 h-5 text-gray-500 group-hover:text-green-600"})}),s.jsx("h2",{className:"text-xl font-semibold text-gray-900 group-hover:text-green-600 transition-colors",children:a.name})]}),a.subGenres.length>0&&s.jsx("div",{className:"space-y-1",children:a.subGenres.map(r=>s.jsxs(I,{to:`/genre/${ft(a.name)}/${ft(r.name)}`,className:"block text-gray-600 hover:text-green-600 transition-colors pl-11",children:[r.name,r.description&&s.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:r.description})]},r.id))})]},a.id))})]})]})}function Zl(){const{totalCount:t}=Yt({});return s.jsxs(s.Fragment,{children:[s.jsx(le,{title:"About PlaylistPartner - Free Spotify Playlist Submission Platform",description:"Learn about PlaylistPartner, your free platform for submitting music to Spotify playlist curators. No signup required, direct curator connections."}),s.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:s.jsxs("div",{className:"container mx-auto px-4 py-16 md:py-24",children:[s.jsxs("div",{className:"max-w-3xl mx-auto text-center mb-16",children:[s.jsx(zt,{className:"w-12 h-12 text-green-600 mx-auto mb-6"}),s.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Music Promotion Made Simple"}),s.jsx("p",{className:"text-xl text-gray-600",children:"Submit your music directly to Spotify playlist curators without the typical barriers. No signups, no fees, and no waiting around. Only on PlaylistPartner."})]}),s.jsxs("div",{className:"max-w-5xl mx-auto grid md:grid-cols-3 gap-8 mb-24",children:[s.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm text-center",children:[s.jsx(sl,{className:"w-8 h-8 text-green-600 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Always Free"}),s.jsx("p",{className:"text-gray-600",children:"No hidden fees or premium features. Submit your music to 10 playlists daily – it's that simple."})]}),s.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm text-center",children:[s.jsx(pl,{className:"w-8 h-8 text-green-600 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Sign Up"}),s.jsx("p",{className:"text-gray-600",children:"Start submitting your music immediately. No account creation required."})]}),s.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm text-center",children:[s.jsx(Jt,{className:"w-8 h-8 text-green-600 mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Direct Connection"}),s.jsx("p",{className:"text-gray-600",children:"Connect directly with curators in your genre and style. Filter playlists by genre, sub-genre, or search."})]})]}),s.jsxs("div",{className:"max-w-4xl mx-auto mb-24",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"How It Works"}),s.jsxs("div",{className:"space-y-12",children:[s.jsxs("div",{className:"flex items-start gap-6",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-green-100 flex-shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-green-600 font-bold",children:"1"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Find Your Playlists"}),s.jsx("p",{className:"text-gray-600",children:"Browse our curated collection of Spotify playlists by genre, sub genre or follower count."})]})]}),s.jsxs("div",{className:"flex items-start gap-6",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-green-100 flex-shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-green-600 font-bold",children:"2"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Submit Your Track"}),s.jsx("p",{className:"text-gray-600",children:"Select your track from Spotify and submit it to any playlist that matches your style. Add a personal message to the curator to increase your chances."})]})]}),s.jsxs("div",{className:"flex items-start gap-6",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-green-100 flex-shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-green-600 font-bold",children:"3"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Get Featured"}),s.jsx("p",{className:"text-gray-600",children:"Curators review your submission and add tracks that fit their playlist. Build relationships with curators and grow your audience organically."})]})]})]})]}),s.jsx("div",{className:"max-w-4xl mx-auto border-t border-gray-200 pt-16",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8",children:[s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"text-3xl font-bold text-green-600 mb-1",children:[t.toLocaleString(),"+"]}),s.jsx("div",{className:"text-sm text-gray-600",children:"Active Playlists"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-600 mb-1",children:"15K+"}),s.jsx("div",{className:"text-sm text-gray-600",children:"Monthly Submissions"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-600 mb-1",children:"2000+"}),s.jsx("div",{className:"text-sm text-gray-600",children:"Curators"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-600 mb-1",children:"100%"}),s.jsx("div",{className:"text-sm text-gray-600",children:"Free"})]})]})}),s.jsxs("div",{className:"max-w-xl mx-auto text-center mt-24",children:[s.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Ready to Share Your Music?"}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsx("a",{href:"/submit",className:"inline-flex items-center justify-center bg-green-500 text-white px-8 py-3 rounded-lg hover:bg-green-600 transition-colors font-medium",children:"Submit Your Music"}),s.jsx("a",{href:"/playlists",className:"inline-flex items-center justify-center bg-white text-gray-700 px-8 py-3 rounded-lg hover:bg-gray-100 transition-colors font-medium border border-gray-200",children:"Browse Playlists"})]})]})]})})]})}function Ql(){const[t,e]=b.useState({name:"",email:"",playlistUrl:""}),[a,r]=b.useState(!1),[n,o]=b.useState(null),[i,l]=b.useState(!1);b.useEffect(()=>{typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[]);const c=u=>{const h=Dt(u,"playlist");if(!h)throw new Error("Please enter a valid Spotify playlist URL");return h},d=async u=>{u.preventDefault(),o(null),r(!0);try{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.email))throw new Error("Please enter a valid email address");const h=c(t.playlistUrl),{error:p}=await L.from("curator_applications").insert({name:t.name,email:t.email,playlist_url:t.playlistUrl,playlist_id:h});if(p)throw p;l(!0),e({name:"",email:"",playlistUrl:""})}catch(h){console.error("Application submission failed:",h),o(h instanceof Error?h.message:"Failed to submit application")}finally{r(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(le,{title:"Become a Curator - PlaylistPartner",description:"Join our network of Spotify playlist curators. Apply to list your playlists and connect with artists in your genre."}),s.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:s.jsx("div",{className:"container mx-auto px-4 py-16 md:py-24",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx(zt,{className:"w-12 h-12 text-green-600 mx-auto mb-6"}),s.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-12",children:"Join Our Curator Network"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[s.jsxs("div",{className:"bg-white p-8 rounded-xl shadow-sm",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg w-12 h-12 flex items-center justify-center mx-auto mb-4",children:s.jsx(nl,{className:"w-6 h-6 text-green-600"})}),s.jsx("h2",{className:"text-xl font-bold mb-4",children:"For Music Curators"}),s.jsx("p",{className:"text-gray-600",children:"Love discovering and sharing new music? Add your playlists to PlaylistPartner to receive fresh submissions from independent artists, grow your following, and strengthen your reputation as a tastemaker in your genre."})]}),s.jsxs("div",{className:"bg-white p-8 rounded-xl shadow-sm",children:[s.jsx("div",{className:"p-3 bg-green-50 rounded-lg w-12 h-12 flex items-center justify-center mx-auto mb-4",children:s.jsx(Jt,{className:"w-6 h-6 text-green-600"})}),s.jsx("h2",{className:"text-xl font-bold mb-4",children:"For Artists"}),s.jsx("p",{className:"text-gray-600",children:"Already making music? List your artist playlists to connect with other independent artists in your genre, expand your network, and build meaningful relationships within your music community."})]})]})]}),s.jsxs("div",{className:"bg-white p-8 rounded-xl shadow-sm mb-12",children:[s.jsx("h2",{className:"text-2xl font-bold mb-6",children:"What We Look For"}),s.jsx("p",{className:"text-gray-600 mb-4",children:"Our curator network maintains high standards to ensure quality. We look for:"}),s.jsxs("ul",{className:"space-y-3 text-gray-600",children:[s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Consistent playlist activity with regular updates"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Genuine follower engagement"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Clear genre focus and curation style"]}),s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Professional playlist presentation"]})]})]}),s.jsx("div",{className:"bg-white p-8 rounded-xl shadow-sm",children:i?s.jsxs("div",{className:"text-center py-8",children:[s.jsx(st,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),s.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Application Received!"}),s.jsx("p",{className:"text-gray-600 mb-6",children:"Thank you for your interest in joining PlaylistPartner. We'll review your application and get back to you as soon as possible."}),s.jsx("button",{onClick:()=>l(!1),className:"text-green-600 hover:text-green-700 font-medium",children:"Submit Another Application"})]}):s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Apply to Join"}),s.jsxs("form",{onSubmit:d,className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:"Your Name"}),s.jsx("input",{type:"text",id:"name",value:t.name,onChange:u=>e(h=>({...h,name:u.target.value})),className:"w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",placeholder:"Enter your name",required:!0,disabled:a})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-1",children:"Email Address"}),s.jsx("input",{type:"email",id:"email",value:t.email,onChange:u=>e(h=>({...h,email:u.target.value})),className:"w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",placeholder:"you@example.com",required:!0,disabled:a})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"playlistUrl",className:"block text-sm font-medium text-gray-700 mb-1",children:"Your Best Playlist"}),s.jsx("input",{type:"url",id:"playlistUrl",value:t.playlistUrl,onChange:u=>e(h=>({...h,playlistUrl:u.target.value})),className:"w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",placeholder:"https://open.spotify.com/playlist/...",required:!0,disabled:a}),s.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Please provide the Spotify URL of your best performing playlist"})]}),n&&s.jsxs("div",{className:"flex items-center gap-2 text-red-600 bg-red-50 p-3 rounded-lg",children:[s.jsx(ue,{className:"w-5 h-5 flex-shrink-0"}),s.jsx("p",{children:n})]}),s.jsx("button",{type:"submit",disabled:a,className:"w-full flex items-center justify-center gap-2 bg-green-500 text-white p-3 rounded-lg hover:bg-green-600 transition-colors disabled:bg-gray-400 disabled:cursor-not-allowed font-medium",children:a?s.jsxs(s.Fragment,{children:[s.jsx(Ie,{className:"w-5 h-5 animate-spin"}),"Submitting..."]}):"Submit Application"})]})]})}),s.jsxs("div",{className:"mt-12 bg-white p-8 rounded-xl shadow-sm",children:[s.jsx("h2",{className:"text-2xl font-bold mb-6",children:"What Happens Next?"}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:s.jsx("span",{className:"text-green-600 font-bold",children:"1"})}),s.jsx("div",{children:s.jsx("p",{className:"text-gray-600",children:"Submit your application with links to your playlists"})})]}),s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:s.jsx("span",{className:"text-green-600 font-bold",children:"2"})}),s.jsx("div",{children:s.jsx("p",{className:"text-gray-600",children:"Our team reviews your submission against our quality criteria"})})]}),s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:s.jsx("span",{className:"text-green-600 font-bold",children:"3"})}),s.jsx("div",{children:s.jsx("p",{className:"text-gray-600",children:"If approved, you'll receive instructions for adding your playlists"})})]}),s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:s.jsx("span",{className:"text-green-600 font-bold",children:"4"})}),s.jsx("div",{children:s.jsx("p",{className:"text-gray-600",children:"Start connecting with artists and growing your network"})})]})]})]})]})})})]})}function Xl(){const[t,e]=b.useState(1),a=9,r=Wa,n=r.length,o=Math.ceil(n/a),i=(t-1)*a,l=i+a,c=r.slice(i,l);function d(h){return new Date(h).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function u(h){return h.startsWith("//")?`https:${h}`:h}return s.jsxs(s.Fragment,{children:[s.jsx(le,{title:"Blog / News | PlaylistPartner",description:"Stay updated with the latest news, features, and improvements from PlaylistPartner. Plus practical music marketing tips.",type:"website",structuredData:{"@context":"https://schema.org","@type":"Blog",name:"Playlist Partner Blog",description:"Stay updated with the latest news, features, and improvements from Playlist Partner. Plus practical music marketing tips.",url:window.location.href,inLanguage:"en-US",publisher:{"@type":"Organization",name:"Playlist Partner",logo:{"@type":"ImageObject",url:"https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public//playlist%20partner%20logo%20square.png",width:"500",height:"500"}}}}),s.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:s.jsxs("section",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 md:py-20",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 mb-4",children:"Playlist Partner Blog"}),s.jsx("p",{className:"text-xl text-gray-600 max-w-3xl mx-auto",children:"Stay updated with the latest news, features, and improvements from Playlist Partner. Plus, coming soon: practical music marketing tips to boost your career."})]}),c.length===0&&s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-gray-600",children:"No blog posts available yet. Check back soon!"})}),c.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mb-12",children:c.map(h=>{var p,f,v;return s.jsxs("article",{className:"bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow",children:[((p=h.featuredImage)==null?void 0:p.url)&&s.jsx(I,{to:`/blog/${((f=h.category)==null?void 0:f.toLowerCase())||"news"}/${h.slug}`,children:s.jsx("img",{src:u(h.featuredImage.url),alt:h.featuredImage.title||h.title,className:"w-full aspect-[3/2] object-cover"})}),s.jsxs("div",{className:"p-6",children:[s.jsx(I,{to:`/blog/${((v=h.category)==null?void 0:v.toLowerCase())||"news"}/${h.slug}`,children:s.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2 hover:text-green-600 transition-colors",children:h.title})}),h.excerpt&&s.jsx("p",{className:"text-gray-600 mb-4 line-clamp-3",children:h.excerpt}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-gray-500",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Fa,{className:"w-4 h-4"}),s.jsx("span",{children:d(h.publishDate)})]}),h.category&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(Sa,{className:"w-4 h-4"}),s.jsx("span",{children:h.category})]})]})]})]},h.id)})}),o>1&&s.jsxs("div",{className:"flex justify-center gap-2",children:[s.jsx("button",{onClick:()=>e(t-1),disabled:t===1,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),s.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:o},(h,p)=>p+1).map(h=>s.jsx("button",{onClick:()=>e(h),className:`px-3 py-1 rounded-md ${h===t?"bg-green-600 text-white":"text-gray-700 hover:bg-gray-50"}`,children:h},h))}),s.jsx("button",{onClick:()=>e(t+1),disabled:t===o,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})})]})}var g=function(t){return t.DOCUMENT="document",t.PARAGRAPH="paragraph",t.HEADING_1="heading-1",t.HEADING_2="heading-2",t.HEADING_3="heading-3",t.HEADING_4="heading-4",t.HEADING_5="heading-5",t.HEADING_6="heading-6",t.OL_LIST="ordered-list",t.UL_LIST="unordered-list",t.LIST_ITEM="list-item",t.HR="hr",t.QUOTE="blockquote",t.EMBEDDED_ENTRY="embedded-entry-block",t.EMBEDDED_ASSET="embedded-asset-block",t.EMBEDDED_RESOURCE="embedded-resource-block",t.TABLE="table",t.TABLE_ROW="table-row",t.TABLE_CELL="table-cell",t.TABLE_HEADER_CELL="table-header-cell",t}({}),J=function(t){return t.ASSET_HYPERLINK="asset-hyperlink",t.EMBEDDED_ENTRY="embedded-entry-inline",t.EMBEDDED_RESOURCE="embedded-resource-inline",t.ENTRY_HYPERLINK="entry-hyperlink",t.HYPERLINK="hyperlink",t.RESOURCE_HYPERLINK="resource-hyperlink",t}({}),dt=function(t){return t.BOLD="bold",t.ITALIC="italic",t.UNDERLINE="underline",t.CODE="code",t.SUPERSCRIPT="superscript",t.SUBSCRIPT="subscript",t.STRIKETHROUGH="strikethrough",t}({});function Aa(t,e){(e==null||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function ed(t){if(Array.isArray(t))return Aa(t)}function me(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function td(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ad(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function rd(t){return ed(t)||td(t)||nd(t)||ad()}function nd(t,e){if(t){if(typeof t=="string")return Aa(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Aa(t,e)}}var kn=[g.PARAGRAPH,g.HEADING_1,g.HEADING_2,g.HEADING_3,g.HEADING_4,g.HEADING_5,g.HEADING_6,g.OL_LIST,g.UL_LIST,g.HR,g.QUOTE,g.EMBEDDED_ENTRY,g.EMBEDDED_ASSET,g.EMBEDDED_RESOURCE,g.TABLE],qa=[g.PARAGRAPH,g.HEADING_1,g.HEADING_2,g.HEADING_3,g.HEADING_4,g.HEADING_5,g.HEADING_6,g.OL_LIST,g.UL_LIST,g.HR,g.QUOTE,g.EMBEDDED_ENTRY,g.EMBEDDED_ASSET,g.EMBEDDED_RESOURCE],sd=[g.TABLE,g.TABLE_ROW,g.TABLE_CELL,g.TABLE_HEADER_CELL],od=[g.HR,g.EMBEDDED_ENTRY,g.EMBEDDED_ASSET,g.EMBEDDED_RESOURCE],se,jn=(se={},me(se,g.OL_LIST,[g.LIST_ITEM]),me(se,g.UL_LIST,[g.LIST_ITEM]),me(se,g.LIST_ITEM,qa),me(se,g.QUOTE,[g.PARAGRAPH]),me(se,g.TABLE,[g.TABLE_ROW]),me(se,g.TABLE_ROW,[g.TABLE_CELL,g.TABLE_HEADER_CELL]),me(se,g.TABLE_CELL,[g.PARAGRAPH,g.UL_LIST,g.OL_LIST]),me(se,g.TABLE_HEADER_CELL,[g.PARAGRAPH]),se),Sn=[g.HEADING_1,g.HEADING_2,g.HEADING_3,g.HEADING_4,g.HEADING_5,g.HEADING_6],id=[g.PARAGRAPH].concat(rd(Sn)),ld=[g.DOCUMENT,g.PARAGRAPH,g.HEADING_1,g.HEADING_2,g.HEADING_3,g.HEADING_4,g.HEADING_5,g.HEADING_6,g.OL_LIST,g.UL_LIST,g.LIST_ITEM,g.HR,g.QUOTE,g.EMBEDDED_ENTRY,g.EMBEDDED_ASSET,J.HYPERLINK,J.ENTRY_HYPERLINK,J.ASSET_HYPERLINK,J.EMBEDDED_ENTRY,"text"],dd=[dt.BOLD,dt.CODE,dt.ITALIC,dt.UNDERLINE],cd={nodeType:g.DOCUMENT,data:{},content:[{nodeType:g.PARAGRAPH,data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]}]};function ud(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function hd(t){for(var e=1;e<arguments.length;e++){var a=arguments[e]!=null?arguments[e]:{},r=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(a).filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable}))),r.forEach(function(n){ud(t,n,a[n])})}return t}function pd(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);a.push.apply(a,r)}return a}function fd(t,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):pd(Object(e)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(e,a))}),t}function yd(t){"@swc/helpers - typeof";return t&&typeof Symbol<"u"&&t.constructor===Symbol?"symbol":typeof t}function En(t,e){var a=!0,r=!1,n=void 0;try{for(var o=Object.keys(t)[Symbol.iterator](),i;!(a=(i=o.next()).done);a=!0){var l=i.value;if(e===t[l])return!0}}catch(c){r=!0,n=c}finally{try{!a&&o.return!=null&&o.return()}finally{if(r)throw n}}return!1}function md(t){return En(J,t.nodeType)}function gd(t){return En(g,t.nodeType)}function vd(t){return t.nodeType==="text"}function Nn(t){if(t.nodeType!==g.PARAGRAPH||t.content.length!==1)return!1;var e=t.content[0];return e.nodeType==="text"&&e.value===""}function bd(t){return t!=null&&(typeof t>"u"?"undefined":yd(t))==="object"&&"content"in t&&Array.isArray(t.content)}var xd=2;function wd(t){if(!bd(t)||t.content.length<xd)return t;var e=t.content[t.content.length-1];return Nn(e)?fd(hd({},t),{content:t.content.slice(0,-1)}):t}const Td=Object.freeze(Object.defineProperty({__proto__:null,isBlock:gd,isEmptyParagraph:Nn,isInline:md,isText:vd,stripEmptyTrailingParagraphFromDocument:wd},Symbol.toStringTag,{value:"Module"}));var _d=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype};const kd=Ut(_d);function Pa(t,e){(e==null||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function jd(t){if(Array.isArray(t))return Pa(t)}function Sd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ed(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Nd(t){return jd(t)||Sd(t)||Ad(t)||Ed()}function Ad(t,e){if(t){if(typeof t=="string")return Pa(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Pa(t,e)}}var jt=function(t){var e=t.path,a=t.property,r=t.typeName,n=t.value;return{details:'The type of "'.concat(a,'" is incorrect, expected type: ').concat(r),name:"type",path:e.toArray(),type:r,value:n}},Pd=function(t){var e=t.min,a=t.value,r=t.path;return{name:"size",min:e,path:r.toArray(),details:"Size must be at least ".concat(e),value:a}},Od=function(t){var e=t.max,a=t.value,r=t.path;return{name:"size",max:e,path:r.toArray(),details:"Size must be at most ".concat(e),value:a}},Id=function(t){var e=t.expected,a=t.value,r=t.path;return{details:"Value must be one of expected values",name:"in",expected:Nd(e).sort(),path:r.toArray(),value:a}},Rd=function(t){var e=t.property,a=t.path;return{details:'The property "'.concat(e,'" is not expected'),name:"unexpected",path:a.toArray()}},Cd=function(t){var e=t.property,a=t.path;return{details:'The property "'.concat(e,'" is required here'),name:"required",path:a.toArray()}};function Oa(t,e){(e==null||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function $d(t){if(Array.isArray(t))return Oa(t)}function Dd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ld(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ud(t,e,a){return e&&Ld(t.prototype,e),t}function G(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function Md(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Bd(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Tr(t){return $d(t)||Md(t)||Fd(t)||Bd()}function Fd(t,e){if(t){if(typeof t=="string")return Oa(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Oa(t,e)}}var ie=function(){function t(e,a){var r=this,n=this;Dd(this,t),G(this,"obj",void 0),G(this,"path",void 0),G(this,"_errors",void 0),G(this,"catch",void 0),G(this,"exists",void 0),G(this,"object",void 0),G(this,"string",void 0),G(this,"number",void 0),G(this,"array",void 0),G(this,"enum",void 0),G(this,"empty",void 0),G(this,"minLength",void 0),G(this,"noAdditionalProperties",void 0),G(this,"each",void 0),this.obj=e,this.path=a,this._errors=[],this.catch=function(){for(var o=arguments.length,i=new Array(o),l=0;l<o;l++)i[l]=arguments[l];var c;(c=n._errors).push.apply(c,Tr(i))},this.exists=function(o){return o in r.obj?!0:(r.catch(Cd({property:o,path:r.path.of(o)})),!1)},this.object=function(o){var i=o?r.obj[o]:r.obj;if(o&&!r.exists(o))return!1;if(kd(i))return!0;var l=o?r.path.of(o):r.path,c,d=(c=o??r.path.last())!==null&&c!==void 0?c:"value";return r.catch(jt({typeName:"Object",property:d,path:l,value:i})),!1},this.string=function(o){var i=r.obj[o];return o&&!r.exists(o)?!1:typeof i=="string"?!0:(r.catch(jt({typeName:"String",property:o,path:r.path.of(o),value:i})),!1)},this.number=function(o,i){var l=r.obj[o];return i&&!(o in r.obj)?!0:r.exists(o)?typeof l=="number"&&!Number.isNaN(l)?!0:(r.catch(jt({typeName:"Number",property:o,path:r.path.of(o),value:l})),!1):!1},this.array=function(o){var i=r.obj[o];return o&&!r.exists(o)?!1:Array.isArray(i)?!0:(r.catch(jt({typeName:"Array",property:o,path:r.path.of(o),value:i})),!1)},this.enum=function(o,i){var l=r.obj[o];return typeof l=="string"&&i.includes(l)?!0:(r.catch(Id({expected:i,value:l,path:r.path.of(o)})),!1)},this.empty=function(o){if(!r.array(o))return!1;var i=r.obj[o];return i.length===0?!0:(r.catch(Od({max:0,value:i,path:r.path.of(o)})),!1)},this.minLength=function(o,i){if(!r.array(o))return!1;var l=r.obj[o];return l.length>=i?!0:(r.catch(Pd({min:i,value:l,path:r.path.of(o)})),!1)},this.noAdditionalProperties=function(o){var i=Object.keys(r.obj).sort().filter(function(l){return!o.includes(l)});return i.forEach(function(l){return r.catch(Rd({property:l,path:r.path.of(l)}))}),i.length===0},this.each=function(o,i){if(r.array(o)){var l=r.obj[o],c=!1;l.forEach(function(d,u){if(!c){var h=i(d,r.path.of(o).of(u));h.length>0&&(c=!0),r.catch.apply(r,Tr(h))}})}}}return Ud(t,[{key:"errors",get:function(){var a=this,r=function(n){return JSON.stringify({details:n.details,path:n.path})};return this._errors.filter(function(n,o){return a._errors.findIndex(function(i){return r(n)===r(i)})===o})}}]),t}();function Ia(t,e){(e==null||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function Wd(t){if(Array.isArray(t))return Ia(t)}function Ga(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function An(t,e,a){return e=Lt(e),Kd(t,In()?Reflect.construct(e,a||[],Lt(t).constructor):e.apply(t,a))}function za(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hd(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function qd(t,e,a){return e&&Hd(t.prototype,e),t}function Ye(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function Lt(t){return Lt=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},Lt(t)}function Pn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ra(t,e)}function Gd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function zd(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kd(t,e){return e&&(Jd(e)==="object"||typeof e=="function")?e:Ga(t)}function Ra(t,e){return Ra=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},Ra(t,e)}function On(t){return Wd(t)||Gd(t)||Yd(t)||zd()}function Jd(t){"@swc/helpers - typeof";return t&&typeof Symbol<"u"&&t.constructor===Symbol?"symbol":typeof t}function Yd(t,e){if(t){if(typeof t=="string")return Ia(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Ia(t,e)}}function In(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(In=function(){return!!t})()}var ct=[],Ka=function(){function t(e,a){za(this,t),Ye(this,"contentRule",void 0),Ye(this,"validateData",void 0),this.contentRule=e,this.validateData=a}return qd(t,[{key:"assert",value:function(a,r){var n=new ie(a,r);if(!n.object())return n.errors;n.noAdditionalProperties(["nodeType","data","content"]);var o=Array.isArray(this.contentRule)?{nodeTypes:this.contentRule}:this.contentRule(a,r),i=o.nodeTypes,l=o.min,c=l===void 0?0:l;if(i.length===0&&c>0)throw new Error("Invalid content rule. Cannot have enforce a 'min' of ".concat(c," with no nodeTypes"));if(n.minLength("content",c),i.length===0?n.empty("content"):n.each("content",function(v,w){var m=new ie(v,w);return m.object()&&m.enum("nodeType",i),m.errors}),n.object("data")){var d,u,h,p,f=(p=(u=(h=this).validateData)===null||u===void 0?void 0:u.call(h,a.data,r.of("data")))!==null&&p!==void 0?p:[];(d=n).catch.apply(d,On(f))}return n.errors}}]),t}(),Vd=function(t){Pn(e,t);function e(a,r){za(this,e);var n;return n=An(this,e,[r,function(o,i){return Ga(n).assertLink(o,i)}]),Ye(n,"linkType",void 0),Ye(n,"type",void 0),Ye(n,"assertLink",void 0),n.linkType=a,n.assertLink=function(o,i){var l=new ie(o,i);if(l.object("target")){var c,d=new ie(o.target.sys,i.of("target").of("sys"));d.object()&&(d.enum("type",[n.type]),d.enum("linkType",[n.linkType]),n.type==="Link"?(d.string("id"),d.noAdditionalProperties(["type","linkType","id"])):n.type==="ResourceLink"&&(d.string("urn"),d.noAdditionalProperties(["type","linkType","urn"]))),(c=l).catch.apply(c,On(d.errors))}return l.noAdditionalProperties(["target"]),l.errors},n.type=n.linkType.startsWith("Contentful:")?"ResourceLink":"Link",n}return e}(Ka),Zd=function(t){Pn(e,t);function e(){za(this,e);var a;return a=An(this,e,[["text"],function(r,n){return Ga(a).assertLink(r,n)}]),Ye(a,"assertLink",function(r,n){var o=new ie(r,n);return o.string("uri"),o.noAdditionalProperties(["uri"]),o.errors}),a}return e}(Ka),ce=function(t,e){return new Ka(t,e)},Ee=function(t,e){return new Vd(t,e)};function Ca(t,e){(e==null||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function Qd(t){if(Array.isArray(t))return Ca(t)}function Xd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function it(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function ec(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function tc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ac(t){return Qd(t)||ec(t)||rc(t)||tc()}function rc(t,e){if(t){if(typeof t=="string")return Ca(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Ca(t,e)}}var nc=function t(){var e=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];Xd(this,t),it(this,"path",void 0),it(this,"of",void 0),it(this,"isRoot",void 0),it(this,"last",void 0),it(this,"toArray",void 0),this.path=a,this.of=function(r){return new t(ac(e.path).concat([r]))},this.isRoot=function(){return e.path.length===0},this.last=function(){return e.path[e.path.length-1]},this.toArray=function(){return e.path}};function sc(t,e){var a=new ie(t,e);return a.object()&&(a.noAdditionalProperties(["nodeType","data","value","marks"]),a.object("data"),a.each("marks",function(r,n){var o=new ie(r,n);return o.object()&&o.string("type"),o.errors}),a.string("value")),a.errors}function $a(t,e){(e==null||e>t.length)&&(e=t.length);for(var a=0,r=new Array(e);a<e;a++)r[a]=t[a];return r}function oc(t){if(Array.isArray(t))return $a(t)}function U(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function ic(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Rn(t){return oc(t)||ic(t)||dc(t)||lc()}function dc(t,e){if(t){if(typeof t=="string")return $a(t,e);var a=Object.prototype.toString.call(t).slice(8,-1);if(a==="Object"&&t.constructor&&(a=t.constructor.name),a==="Map"||a==="Set")return Array.from(a);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return $a(t,e)}}var je=ce(Rn(Object.values(J)).concat(["text"]).sort()),_r=ce([g.LIST_ITEM]),kr=Ee("Entry",ct),jr=ce(function(){return{nodeTypes:[g.PARAGRAPH],min:1}},function(t,e){var a=new ie(t,e);return a.noAdditionalProperties(["colspan","rowspan"]),a.number("colspan",!0),a.number("rowspan",!0),a.errors}),$,cc=($={},U($,g.DOCUMENT,ce(kn)),U($,g.PARAGRAPH,je),U($,g.HEADING_1,je),U($,g.HEADING_2,je),U($,g.HEADING_3,je),U($,g.HEADING_4,je),U($,g.HEADING_5,je),U($,g.HEADING_6,je),U($,g.QUOTE,ce(jn[g.QUOTE])),U($,g.EMBEDDED_ENTRY,kr),U($,g.EMBEDDED_ASSET,Ee("Asset",ct)),U($,g.EMBEDDED_RESOURCE,Ee("Contentful:Entry",ct)),U($,g.HR,ce(ct)),U($,g.OL_LIST,_r),U($,g.UL_LIST,_r),U($,g.LIST_ITEM,ce(Rn(qa).sort())),U($,g.TABLE,ce(function(){return{nodeTypes:[g.TABLE_ROW],min:1}})),U($,g.TABLE_ROW,ce(function(){return{nodeTypes:[g.TABLE_CELL,g.TABLE_HEADER_CELL],min:1}})),U($,g.TABLE_CELL,jr),U($,g.TABLE_HEADER_CELL,jr),U($,J.HYPERLINK,new Zd),U($,J.EMBEDDED_ENTRY,kr),U($,J.EMBEDDED_RESOURCE,Ee("Contentful:Entry",ct)),U($,J.ENTRY_HYPERLINK,Ee("Entry",["text"])),U($,J.ASSET_HYPERLINK,Ee("Asset",["text"])),U($,J.RESOURCE_HYPERLINK,Ee("Contentful:Entry",["text"])),$);function Cn(t,e){if(t.nodeType==="text")return sc(t,e);var a=cc[t.nodeType].assert(t,e);if(a.length>0)return a;var r=new ie(t,e);return r.each("content",function(n,o){return Cn(n,o)}),r.errors}var uc=function(t){var e=new nc,a=new ie(t,e);return a.object()&&a.enum("nodeType",[g.DOCUMENT]),a.errors.length>0?a.errors:Cn(t,e)};const hc=Object.freeze(Object.defineProperty({__proto__:null,BLOCKS:g,CONTAINERS:jn,EMPTY_DOCUMENT:cd,HEADINGS:Sn,INLINES:J,LIST_ITEM_BLOCKS:qa,MARKS:dt,TABLE_BLOCKS:sd,TEXT_CONTAINERS:id,TOP_LEVEL_BLOCKS:kn,V1_MARKS:dd,V1_NODE_TYPES:ld,VOID_BLOCKS:od,helpers:Td,validateRichTextDocument:uc},Symbol.toStringTag,{value:"Module"})),pc=Nr(hc);var R=b,O=pc;function fc(t,e){return R.isValidElement(t)&&t.key===null?R.cloneElement(t,{key:e}):t}function yc(t,e){return t.map((a,r)=>fc($n(a,e),r))}function $n(t,e){const{renderNode:a,renderMark:r,renderText:n,preserveWhitespace:o}=e;if(O.helpers.isText(t)){let i=n?n(t.value):t.value;if(o&&!n){i=i.replace(/ {2,}/g,d=>" ".repeat(d.length));const l=i.split(` `),c=[];l.forEach((d,u)=>{c.push(d),u!==l.length-1&&c.push(R.createElement("br",null))}),i=c}return t.marks.reduce((l,c)=>r[c.type]?r[c.type](l):l,i)}else{const i=yc(t.content,e);return!t.nodeType||!a[t.nodeType]?R.createElement(R.Fragment,null,i):a[t.nodeType](t,i)}}const mc={[O.BLOCKS.DOCUMENT]:(t,e)=>e,[O.BLOCKS.PARAGRAPH]:(t,e)=>R.createElement("p",null,e),[O.BLOCKS.HEADING_1]:(t,e)=>R.createElement("h1",null,e),[O.BLOCKS.HEADING_2]:(t,e)=>R.createElement("h2",null,e),[O.BLOCKS.HEADING_3]:(t,e)=>R.createElement("h3",null,e),[O.BLOCKS.HEADING_4]:(t,e)=>R.createElement("h4",null,e),[O.BLOCKS.HEADING_5]:(t,e)=>R.createElement("h5",null,e),[O.BLOCKS.HEADING_6]:(t,e)=>R.createElement("h6",null,e),[O.BLOCKS.EMBEDDED_ENTRY]:(t,e)=>R.createElement("div",null,e),[O.BLOCKS.EMBEDDED_RESOURCE]:(t,e)=>R.createElement("div",null,e),[O.BLOCKS.UL_LIST]:(t,e)=>R.createElement("ul",null,e),[O.BLOCKS.OL_LIST]:(t,e)=>R.createElement("ol",null,e),[O.BLOCKS.LIST_ITEM]:(t,e)=>R.createElement("li",null,e),[O.BLOCKS.QUOTE]:(t,e)=>R.createElement("blockquote",null,e),[O.BLOCKS.HR]:()=>R.createElement("hr",null),[O.BLOCKS.TABLE]:(t,e)=>R.createElement("table",null,R.createElement("tbody",null,e)),[O.BLOCKS.TABLE_ROW]:(t,e)=>R.createElement("tr",null,e),[O.BLOCKS.TABLE_HEADER_CELL]:(t,e)=>R.createElement("th",null,e),[O.BLOCKS.TABLE_CELL]:(t,e)=>R.createElement("td",null,e),[O.INLINES.ASSET_HYPERLINK]:t=>da(O.INLINES.ASSET_HYPERLINK,t),[O.INLINES.ENTRY_HYPERLINK]:t=>da(O.INLINES.ENTRY_HYPERLINK,t),[O.INLINES.RESOURCE_HYPERLINK]:t=>Sr(O.INLINES.RESOURCE_HYPERLINK,t),[O.INLINES.EMBEDDED_ENTRY]:t=>da(O.INLINES.EMBEDDED_ENTRY,t),[O.INLINES.EMBEDDED_RESOURCE]:(t,e)=>Sr(O.INLINES.EMBEDDED_RESOURCE,t),[O.INLINES.HYPERLINK]:(t,e)=>R.createElement("a",{href:t.data.uri},e)},gc={[O.MARKS.BOLD]:t=>R.createElement("b",null,t),[O.MARKS.ITALIC]:t=>R.createElement("i",null,t),[O.MARKS.UNDERLINE]:t=>R.createElement("u",null,t),[O.MARKS.CODE]:t=>R.createElement("code",null,t),[O.MARKS.SUPERSCRIPT]:t=>R.createElement("sup",null,t),[O.MARKS.SUBSCRIPT]:t=>R.createElement("sub",null,t),[O.MARKS.STRIKETHROUGH]:t=>R.createElement("s",null,t)};function da(t,e){return R.createElement("span",{key:e.data.target.sys.id},"type: ",e.nodeType," id: ",e.data.target.sys.id)}function Sr(t,e){return R.createElement("span",{key:e.data.target.sys.urn},"type: ",e.nodeType," urn: ",e.data.target.sys.urn)}function vc(t,e={}){if(!t)return null;let a=t;return e.stripEmptyTrailingParagraph&&(a=O.helpers.stripEmptyTrailingParagraphFromDocument(t)),$n(a,{renderNode:{...mc,...e.renderNode},renderMark:{...gc,...e.renderMark},renderText:e.renderText,preserveWhitespace:e.preserveWhitespace})}var bc=vc;function xc(){var u,h;const{category:t,slug:e}=Bt(),a=Wa,r=a.find(p=>p.slug===e),n=r?a.filter(p=>p.category===r.category&&p.slug!==e).slice(0,2):[];function o(p){return new Date(p).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function i(p){return p.startsWith("//")?`https:${p}`:p}const l={renderNode:{[g.PARAGRAPH]:(p,f)=>s.jsx("p",{className:"mb-6 text-gray-700 leading-relaxed",children:f}),[g.HEADING_1]:(p,f)=>s.jsx("h1",{className:"text-3xl font-bold mb-6 text-gray-900",children:f}),[g.HEADING_2]:(p,f)=>s.jsx("h2",{className:"text-2xl font-semibold mb-4 text-gray-900",children:f}),[g.HEADING_3]:(p,f)=>s.jsx("h3",{className:"text-xl font-semibold mb-3 text-gray-900",children:f}),[g.UL_LIST]:(p,f)=>s.jsx("ul",{className:"list-disc pl-6 mb-6 space-y-2",children:f}),[g.OL_LIST]:(p,f)=>s.jsx("ol",{className:"list-decimal pl-6 mb-6 space-y-2",children:f}),[g.LIST_ITEM]:(p,f)=>s.jsx("li",{className:"text-gray-700 leading-relaxed",children:f}),[g.QUOTE]:(p,f)=>s.jsx("blockquote",{className:"border-l-4 border-green-600 pl-4 italic my-6 text-gray-600",children:f}),[g.EMBEDDED_ASSET]:p=>{var w,m;if(!((m=(w=p.data.target)==null?void 0:w.fields)!=null&&m.file))return null;const{file:f,title:v}=p.data.target.fields;return s.jsx("img",{src:i(f.url),alt:v||"",className:"w-full rounded-lg my-6"})},[J.HYPERLINK]:(p,f)=>s.jsx("a",{href:p.data.uri,target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-700 underline",children:f})}};if(!r)return s.jsxs("div",{className:"min-h-screen flex flex-col justify-center items-center",children:[s.jsx("p",{className:"text-red-600 mb-4",children:"Post not found"}),s.jsx(I,{to:"/blog",className:"text-green-600 hover:text-green-700",children:"Back to Blog"})]});const c=(u=r.featuredImage)!=null&&u.url?i(r.featuredImage.url):void 0,d=[{"@context":"https://schema.org","@type":"BlogPosting",headline:r.title,description:r.excerpt||"",image:c||"https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png",datePublished:r.publishDate||r.createdAt,dateModified:r.updatedAt||r.publishDate||r.createdAt,author:{"@type":"Organization",name:"Playlist Partner",url:window.location.origin},publisher:{"@type":"Organization",name:"Playlist Partner",logo:{"@type":"ImageObject",url:"https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public//playlist%20partner%20logo%20square.png",width:"500",height:"500"}},mainEntityOfPage:{"@type":"WebPage","@id":window.location.href},articleSection:r.category||"News",inLanguage:"en-US"},{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:window.location.origin},{"@type":"ListItem",position:2,name:"Blog",item:`${window.location.origin}/blog`},{"@type":"ListItem",position:3,name:r.title,item:window.location.href}]}];return s.jsxs(s.Fragment,{children:[s.jsx(le,{title:`${r.title} | PlaylistPartner`,description:r.excerpt||`Read ${r.title} on the PlaylistPartner blog`,image:c,type:"article",article:{publishedTime:r.publishDate||r.createdAt,modifiedTime:r.updatedAt||r.publishDate||r.createdAt,author:"Playlist Partner",section:r.category||"News"},structuredData:d}),s.jsxs("article",{className:"bg-white",children:[s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[s.jsxs(I,{to:"/blog",className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-8",children:[s.jsx(he,{className:"w-4 h-4"}),"Back to Blog"]}),((h=r.featuredImage)==null?void 0:h.url)&&s.jsx("img",{src:i(r.featuredImage.url),alt:r.featuredImage.title||r.title,className:"w-full aspect-[3/2] object-cover rounded-lg mb-8"}),s.jsxs("header",{className:"mb-8",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 mb-4",children:r.title}),s.jsxs("div",{className:"flex flex-wrap items-center gap-6 text-gray-600",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fa,{className:"w-5 h-5"}),s.jsx("span",{children:o(r.publishDate||r.createdAt)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Kt,{className:"w-5 h-5"}),s.jsxs("span",{children:["By ",s.jsx(I,{to:"/",className:"hover:text-green-600 transition-colors",children:"Playlist Partner"})]})]}),r.category&&s.jsxs("div",{className:"inline-flex items-center gap-1 px-3 py-1 bg-green-100 text-green-800 text-sm font-medium rounded-full",children:[s.jsx(Sa,{className:"w-3 h-3"}),r.category]})]})]}),s.jsx("div",{className:"prose prose-lg max-w-none mt-8 prose-ul:list-disc prose-ol:list-decimal prose-li:marker:text-gray-700",children:r.body?bc(r.body,l):s.jsx("div",{className:"bg-gray-50 p-6 rounded-lg",children:s.jsx("p",{className:"text-gray-600",children:"No content available for this post."})})}),s.jsx("div",{className:"mt-12 pt-8 border-t border-gray-200",children:s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[s.jsx("span",{children:"Filed under:"}),s.jsxs("div",{className:"inline-flex items-center gap-1 px-3 py-1 bg-gray-100 rounded-full",children:[s.jsx(Sa,{className:"w-3 h-3"}),r.category||"News"]})]})})]}),n.length>0&&s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 mt-8",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[s.jsx(ul,{className:"w-6 h-6 text-gray-700"}),s.jsx("h2",{className:"text-2xl font-semibold text-gray-900",children:"Related News & Guides"})]}),s.jsx("div",{className:"grid md:grid-cols-2 gap-6 mb-16",children:n.map(p=>{var f,v;return s.jsxs(I,{to:`/blog/${((f=p.category)==null?void 0:f.toLowerCase())||"news"}/${p.slug}`,className:"bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md transition-shadow overflow-hidden group",children:[((v=p.featuredImage)==null?void 0:v.url)&&s.jsx("div",{className:"aspect-[3/2] overflow-hidden",children:s.jsx("img",{src:i(p.featuredImage.url),alt:p.featuredImage.title||p.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),s.jsxs("div",{className:"p-6",children:[s.jsx("h3",{className:"font-semibold text-gray-900 group-hover:text-green-600 transition-colors line-clamp-2",children:p.title}),p.excerpt&&s.jsx("p",{className:"text-sm text-gray-600 mt-2 line-clamp-2",children:p.excerpt})]})]},p.id)})})]}),s.jsx("section",{className:"bg-gradient-to-r from-green-600 to-green-700 py-12",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[s.jsx("h2",{className:"text-3xl font-bold text-white mb-2",children:"Ready to Submit Your Music?"}),s.jsx("p",{className:"text-xl text-green-100 mb-8",children:"Browse 10,000+ curated playlists"}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsx(I,{to:"/playlists",className:"inline-flex items-center justify-center px-6 py-3 bg-white text-green-700 font-semibold rounded-lg hover:bg-gray-100 transition-colors",children:"Browse Playlists"}),s.jsxs(I,{to:"/submit",className:"inline-flex items-center justify-center px-6 py-3 bg-green-800 text-white font-semibold rounded-lg hover:bg-green-900 transition-colors",children:["Submit Track",s.jsx(gt,{className:"w-5 h-5 ml-2"})]})]})]})})]})]})}function wc(){return s.jsx(yn,{children:s.jsx("div",{className:"min-h-screen flex flex-col",children:s.jsxs(Un,{children:[s.jsx(Y,{path:"/",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Tl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/playlists",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Wl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/submit",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Hl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/submit/genre",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(ql,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/playlist/:slug/*",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Bl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/genres",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Vl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/genre/:genre",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Kl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/genre/:genre/:subGenre",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Yl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/about",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Zl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/for-curators",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Ql,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/blog",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(Xl,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"/blog/:category/:slug",element:s.jsxs(s.Fragment,{children:[s.jsx(Z,{}),s.jsx(xc,{}),s.jsx(Q,{})]})}),s.jsx(Y,{path:"*",element:s.jsx(Mn,{to:"/",replace:!0})})]})})})}const Tc={};Pr(document.getElementById("root")).render(s.jsx(b.StrictMode,{children:s.jsx(Lr,{context:Tc,children:s.jsx(Bn,{children:s.jsx(Xi,{children:s.jsx(yn,{children:s.jsx(wc,{})})})})})}));export{Ie as L,Ha as P,tt as S,xt as T,Gl as u}; //# sourceMappingURL=index-CUi3HL4t.js.map