const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FeaturedPlaylists-Cx2vX-c6.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 Mn=Object.defineProperty;var Bn=(r,e,t)=>e in r?Mn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var X=(r,e,t)=>Bn(r,typeof e!="symbol"?e+"":e,t);import{j as a}from"./ui-vendor-BiK-nlin.js";import{a as Ns,g as Lt,r as y,R as be,b as Ps,c as Z,L as I,u as Dt,d as Ie,e as As,f as Ut,h as Fn,i as V,N as Hn,B as qn}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"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=t(n);fetch(n.href,i)}})();var Os,Yr=Ns;Os=Yr.createRoot,Yr.hydrateRoot;var Gn=typeof Element<"u",Wn=typeof Map=="function",zn=typeof Set=="function",Kn=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Tt(r,e){if(r===e)return!0;if(r&&e&&typeof r=="object"&&typeof e=="object"){if(r.constructor!==e.constructor)return!1;var t,s,n;if(Array.isArray(r)){if(t=r.length,t!=e.length)return!1;for(s=t;s--!==0;)if(!Tt(r[s],e[s]))return!1;return!0}var i;if(Wn&&r instanceof Map&&e instanceof Map){if(r.size!==e.size)return!1;for(i=r.entries();!(s=i.next()).done;)if(!e.has(s.value[0]))return!1;for(i=r.entries();!(s=i.next()).done;)if(!Tt(s.value[1],e.get(s.value[0])))return!1;return!0}if(zn&&r instanceof Set&&e instanceof Set){if(r.size!==e.size)return!1;for(i=r.entries();!(s=i.next()).done;)if(!e.has(s.value[0]))return!1;return!0}if(Kn&&ArrayBuffer.isView(r)&&ArrayBuffer.isView(e)){if(t=r.length,t!=e.length)return!1;for(s=t;s--!==0;)if(r[s]!==e[s])return!1;return!0}if(r.constructor===RegExp)return r.source===e.source&&r.flags===e.flags;if(r.valueOf!==Object.prototype.valueOf&&typeof r.valueOf=="function"&&typeof e.valueOf=="function")return r.valueOf()===e.valueOf();if(r.toString!==Object.prototype.toString&&typeof r.toString=="function"&&typeof e.toString=="function")return r.toString()===e.toString();if(n=Object.keys(r),t=n.length,t!==Object.keys(e).length)return!1;for(s=t;s--!==0;)if(!Object.prototype.hasOwnProperty.call(e,n[s]))return!1;if(Gn&&r instanceof Element)return!1;for(s=t;s--!==0;)if(!((n[s]==="_owner"||n[s]==="__v"||n[s]==="__o")&&r.$$typeof)&&!Tt(r[n[s]],e[n[s]]))return!1;return!0}return r!==r&&e!==e}var Vn=function(e,t){try{return Tt(e,t)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const Jn=Lt(Vn);var Yn=function(r,e,t,s,n,i,o,l){if(!r){var d;if(e===void 0)d=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[t,s,n,i,o,l],u=0;d=new Error(e.replace(/%s/g,function(){return c[u++]})),d.name="Invariant Violation"}throw d.framesToPop=1,d}},Qn=Yn;const Qr=Lt(Qn);var Zn=function(e,t,s,n){var i=s?s.call(n,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;var o=Object.keys(e),l=Object.keys(t);if(o.length!==l.length)return!1;for(var d=Object.prototype.hasOwnProperty.bind(t),c=0;c<o.length;c++){var u=o[c];if(!d(u))return!1;var h=e[u],f=t[u];if(i=s?s.call(n,h,f,u):void 0,i===!1||i===void 0&&h!==f)return!1}return!0};const Xn=Lt(Zn);var Is=(r=>(r.BASE="base",r.BODY="body",r.HEAD="head",r.HTML="html",r.LINK="link",r.META="meta",r.NOSCRIPT="noscript",r.SCRIPT="script",r.STYLE="style",r.TITLE="title",r.FRAGMENT="Symbol(react.fragment)",r))(Is||{}),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"]}},Zr=Object.values(Is),$r={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},ea=Object.entries($r).reduce((r,[e,t])=>(r[t]=e,r),{}),re="data-rh",Ge={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},We=(r,e)=>{for(let t=r.length-1;t>=0;t-=1){const s=r[t];if(Object.prototype.hasOwnProperty.call(s,e))return s[e]}return null},ta=r=>{let e=We(r,"title");const t=We(r,Ge.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),t&&e)return t.replace(/%s/g,()=>e);const s=We(r,Ge.DEFAULT_TITLE);return e||s||void 0},ra=r=>We(r,Ge.ON_CHANGE_CLIENT_STATE)||(()=>{}),Jt=(r,e)=>e.filter(t=>typeof t[r]<"u").map(t=>t[r]).reduce((t,s)=>({...t,...s}),{}),sa=(r,e)=>e.filter(t=>typeof t.base<"u").map(t=>t.base).reverse().reduce((t,s)=>{if(!t.length){const n=Object.keys(s);for(let i=0;i<n.length;i+=1){const l=n[i].toLowerCase();if(r.indexOf(l)!==-1&&s[l])return t.concat(s)}}return t},[]),na=r=>console&&typeof console.warn=="function"&&console.warn(r),et=(r,e,t)=>{const s={};return t.filter(n=>Array.isArray(n[r])?!0:(typeof n[r]<"u"&&na(`Helmet: ${r} should be of type "Array". Instead found type "${typeof n[r]}"`),!1)).map(n=>n[r]).reverse().reduce((n,i)=>{const o={};i.filter(d=>{let c;const u=Object.keys(d);for(let f=0;f<u.length;f+=1){const m=u[f],b=m.toLowerCase();e.indexOf(b)!==-1&&!(c==="rel"&&d[c].toLowerCase()==="canonical")&&!(b==="rel"&&d[b].toLowerCase()==="stylesheet")&&(c=b),e.indexOf(m)!==-1&&(m==="innerHTML"||m==="cssText"||m==="itemprop")&&(c=m)}if(!c||!d[c])return!1;const h=d[c].toLowerCase();return s[c]||(s[c]={}),o[c]||(o[c]={}),s[c][h]?!1:(o[c][h]=!0,!0)}).reverse().forEach(d=>n.push(d));const l=Object.keys(o);for(let d=0;d<l.length;d+=1){const c=l[d],u={...s[c],...o[c]};s[c]=u}return n},[]).reverse()},aa=(r,e)=>{if(Array.isArray(r)&&r.length){for(let t=0;t<r.length;t+=1)if(r[t][e])return!0}return!1},ia=r=>({baseTag:sa(["href"],r),bodyAttributes:Jt("bodyAttributes",r),defer:We(r,Ge.DEFER),encode:We(r,Ge.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Jt("htmlAttributes",r),linkTags:et("link",["rel","href"],r),metaTags:et("meta",["name","charset","http-equiv","property","itemprop"],r),noscriptTags:et("noscript",["innerHTML"],r),onChangeClientState:ra(r),scriptTags:et("script",["src","innerHTML"],r),styleTags:et("style",["cssText"],r),title:ta(r),titleAttributes:Jt("titleAttributes",r),prioritizeSeoTags:aa(r,Ge.PRIORITIZE_SEO_TAGS)}),Cs=r=>Array.isArray(r)?r.join(""):r,oa=(r,e)=>{const t=Object.keys(r);for(let s=0;s<t.length;s+=1)if(e[t[s]]&&e[t[s]].includes(r[t[s]]))return!0;return!1},Yt=(r,e)=>Array.isArray(r)?r.reduce((t,s)=>(oa(s,e)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:r,priority:[]},Xr=(r,e)=>({...r,[e]:void 0}),la=["noscript","script","style"],cr=(r,e=!0)=>e===!1?String(r):String(r).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;"),Rs=r=>Object.keys(r).reduce((e,t)=>{const s=typeof r[t]<"u"?`${t}="${r[t]}"`:`${t}`;return e?`${e} ${s}`:s},""),ca=(r,e,t,s)=>{const n=Rs(t),i=Cs(e);return n?`<${r} ${re}="true" ${n}>${cr(i,s)}</${r}>`:`<${r} ${re}="true">${cr(i,s)}</${r}>`},da=(r,e,t=!0)=>e.reduce((s,n)=>{const i=n,o=Object.keys(i).filter(c=>!(c==="innerHTML"||c==="cssText")).reduce((c,u)=>{const h=typeof i[u]>"u"?u:`${u}="${cr(i[u],t)}"`;return c?`${c} ${h}`:h},""),l=i.innerHTML||i.cssText||"",d=la.indexOf(r)===-1;return`${s}<${r} ${re}="true" ${o}${d?"/>":`>${l}</${r}>`}`},""),$s=(r,e={})=>Object.keys(r).reduce((t,s)=>{const n=$r[s];return t[n||s]=r[s],t},e),ua=(r,e,t)=>{const s={key:e,[re]:!0},n=$s(t,s);return[be.createElement("title",n,e)]},kt=(r,e)=>e.map((t,s)=>{const n={key:s,[re]:!0};return Object.keys(t).forEach(i=>{const l=$r[i]||i;if(l==="innerHTML"||l==="cssText"){const d=t.innerHTML||t.cssText;n.dangerouslySetInnerHTML={__html:d}}else n[l]=t[i]}),be.createElement(r,n)}),Q=(r,e,t=!0)=>{switch(r){case"title":return{toComponent:()=>ua(r,e.title,e.titleAttributes),toString:()=>ca(r,e.title,e.titleAttributes,t)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>$s(e),toString:()=>Rs(e)};default:return{toComponent:()=>kt(r,e),toString:()=>da(r,e,t)}}},ha=({metaTags:r,linkTags:e,scriptTags:t,encode:s})=>{const n=Yt(r,Vt.meta),i=Yt(e,Vt.link),o=Yt(t,Vt.script);return{priorityMethods:{toComponent:()=>[...kt("meta",n.priority),...kt("link",i.priority),...kt("script",o.priority)],toString:()=>`${Q("meta",n.priority,s)} ${Q("link",i.priority,s)} ${Q("script",o.priority,s)}`},metaTags:n.default,linkTags:i.default,scriptTags:o.default}},fa=r=>{const{baseTag:e,bodyAttributes:t,encode:s=!0,htmlAttributes:n,noscriptTags:i,styleTags:o,title:l="",titleAttributes:d,prioritizeSeoTags:c}=r;let{linkTags:u,metaTags:h,scriptTags:f}=r,m={toComponent:()=>{},toString:()=>""};return c&&({priorityMethods:m,linkTags:u,metaTags:h,scriptTags:f}=ha(r)),{priority:m,base:Q("base",e,s),bodyAttributes:Q("bodyAttributes",t,s),htmlAttributes:Q("htmlAttributes",n,s),link:Q("link",u,s),meta:Q("meta",h,s),noscript:Q("noscript",i,s),script:Q("script",f,s),style:Q("style",o,s),title:Q("title",{title:l,titleAttributes:d},s)}},dr=fa,bt=[],Ls=!!(typeof window<"u"&&window.document&&window.document.createElement),ur=class{constructor(r,e){X(this,"instances",[]);X(this,"canUseDOM",Ls);X(this,"context");X(this,"value",{setHelmet:r=>{this.context.helmet=r},helmetInstances:{get:()=>this.canUseDOM?bt:this.instances,add:r=>{(this.canUseDOM?bt:this.instances).push(r)},remove:r=>{const e=(this.canUseDOM?bt:this.instances).indexOf(r);(this.canUseDOM?bt:this.instances).splice(e,1)}}});this.context=r,this.canUseDOM=e||!1,e||(r.helmet=dr({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ma={},Ds=be.createContext(ma),Ae,Us=(Ae=class extends y.Component{constructor(t){super(t);X(this,"helmetData");this.helmetData=new ur(this.props.context||{},Ae.canUseDOM)}render(){return be.createElement(Ds.Provider,{value:this.helmetData.value},this.props.children)}},X(Ae,"canUseDOM",Ls),Ae),$e=(r,e)=>{const t=document.head||document.querySelector("head"),s=t.querySelectorAll(`${r}[${re}]`),n=[].slice.call(s),i=[];let o;return e&&e.length&&e.forEach(l=>{const d=document.createElement(r);for(const c in l)if(Object.prototype.hasOwnProperty.call(l,c))if(c==="innerHTML")d.innerHTML=l.innerHTML;else if(c==="cssText")d.styleSheet?d.styleSheet.cssText=l.cssText:d.appendChild(document.createTextNode(l.cssText));else{const u=c,h=typeof l[u]>"u"?"":l[u];d.setAttribute(c,h)}d.setAttribute(re,"true"),n.some((c,u)=>(o=u,d.isEqualNode(c)))?n.splice(o,1):i.push(d)}),n.forEach(l=>{var d;return(d=l.parentNode)==null?void 0:d.removeChild(l)}),i.forEach(l=>t.appendChild(l)),{oldTags:n,newTags:i}},hr=(r,e)=>{const t=document.getElementsByTagName(r)[0];if(!t)return;const s=t.getAttribute(re),n=s?s.split(","):[],i=[...n],o=Object.keys(e);for(const l of o){const d=e[l]||"";t.getAttribute(l)!==d&&t.setAttribute(l,d),n.indexOf(l)===-1&&n.push(l);const c=i.indexOf(l);c!==-1&&i.splice(c,1)}for(let l=i.length-1;l>=0;l-=1)t.removeAttribute(i[l]);n.length===i.length?t.removeAttribute(re):t.getAttribute(re)!==o.join(",")&&t.setAttribute(re,o.join(","))},pa=(r,e)=>{typeof r<"u"&&document.title!==r&&(document.title=Cs(r)),hr("title",e)},es=(r,e)=>{const{baseTag:t,bodyAttributes:s,htmlAttributes:n,linkTags:i,metaTags:o,noscriptTags:l,onChangeClientState:d,scriptTags:c,styleTags:u,title:h,titleAttributes:f}=r;hr("body",s),hr("html",n),pa(h,f);const m={baseTag:$e("base",t),linkTags:$e("link",i),metaTags:$e("meta",o),noscriptTags:$e("noscript",l),scriptTags:$e("script",c),styleTags:$e("style",u)},b={},v={};Object.keys(m).forEach(x=>{const{newTags:p,oldTags:j}=m[x];p.length&&(b[x]=p),j.length&&(v[x]=m[x].oldTags)}),e&&e(),d(r,b,v)},tt=null,ga=r=>{tt&&cancelAnimationFrame(tt),r.defer?tt=requestAnimationFrame(()=>{es(r,()=>{tt=null})}):(es(r),tt=null)},ya=ga,ts=class extends y.Component{constructor(){super(...arguments);X(this,"rendered",!1)}shouldComponentUpdate(e){return!Xn(e,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:e}=this.props.context;e.remove(this),this.emitChange()}emitChange(){const{helmetInstances:e,setHelmet:t}=this.props.context;let s=null;const n=ia(e.get().map(i=>{const o={...i.props};return delete o.context,o}));Us.canUseDOM?ya(n):dr&&(s=dr(n)),t(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},lr,ba=(lr=class extends y.Component{shouldComponentUpdate(r){return!Jn(Xr(this.props,"helmetData"),Xr(r,"helmetData"))}mapNestedChildrenToProps(r,e){if(!e)return null;switch(r.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${r.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(r,e,t,s){return{...e,[r.type]:[...e[r.type]||[],{...t,...this.mapNestedChildrenToProps(r,s)}]}}mapObjectTypeChildren(r,e,t,s){switch(r.type){case"title":return{...e,[r.type]:s,titleAttributes:{...t}};case"body":return{...e,bodyAttributes:{...t}};case"html":return{...e,htmlAttributes:{...t}};default:return{...e,[r.type]:{...t}}}}mapArrayTypeChildrenToProps(r,e){let t={...e};return Object.keys(r).forEach(s=>{t={...t,[s]:r[s]}}),t}warnOnInvalidChildren(r,e){return Qr(Zr.some(t=>r.type===t),typeof r.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 ${Zr.join(", ")} are allowed. Helmet does not support rendering <${r.type}> elements. Refer to our API for more information.`),Qr(!e||typeof e=="string"||Array.isArray(e)&&!e.some(t=>typeof t!="string"),`Helmet expects a string as a child of <${r.type}>. Did you forget to wrap your children in braces? ( <${r.type}>{\`\`}</${r.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(r,e){let t={};return be.Children.forEach(r,s=>{if(!s||!s.props)return;const{children:n,...i}=s.props,o=Object.keys(i).reduce((d,c)=>(d[ea[c]||c]=i[c],d),{});let{type:l}=s;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(s,n),l){case"Symbol(react.fragment)":e=this.mapChildrenToProps(n,e);break;case"link":case"meta":case"noscript":case"script":case"style":t=this.flattenArrayTypeChildren(s,t,o,n);break;default:e=this.mapObjectTypeChildren(s,e,o,n);break}}),this.mapArrayTypeChildrenToProps(t,e)}render(){const{children:r,...e}=this.props;let t={...e},{helmetData:s}=e;if(r&&(t=this.mapChildrenToProps(r,t)),s&&!(s instanceof ur)){const n=s;s=new ur(n.context,!0),delete t.helmetData}return s?be.createElement(ts,{...t,context:s.value}):be.createElement(Ds.Consumer,null,n=>be.createElement(ts,{...t,context:n}))}},X(lr,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),lr);const xa="modulepreload",va=function(r){return"/"+r},rs={},he=function(e,t,s){let n=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));n=Promise.allSettled(t.map(d=>{if(d=va(d),d in rs)return;rs[d]=!0;const c=d.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":xa,c||(h.as="script"),h.crossOrigin="",h.href=d,l&&h.setAttribute("nonce",l),document.head.appendChild(h),c)return new Promise((f,m)=>{h.addEventListener("load",f),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return n.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})},wa=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>he(async()=>{const{default:s}=await Promise.resolve().then(()=>Je);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)};class Lr extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class _a extends Lr{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class ss extends Lr{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class ns extends Lr{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var fr;(function(r){r.Any="any",r.ApNortheast1="ap-northeast-1",r.ApNortheast2="ap-northeast-2",r.ApSouth1="ap-south-1",r.ApSoutheast1="ap-southeast-1",r.ApSoutheast2="ap-southeast-2",r.CaCentral1="ca-central-1",r.EuCentral1="eu-central-1",r.EuWest1="eu-west-1",r.EuWest2="eu-west-2",r.EuWest3="eu-west-3",r.SaEast1="sa-east-1",r.UsEast1="us-east-1",r.UsWest1="us-west-1",r.UsWest2="us-west-2"})(fr||(fr={}));var ja=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};class Ta{constructor(e,{headers:t={},customFetch:s,region:n=fr.Any}={}){this.url=e,this.headers=t,this.region=n,this.fetch=wa(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return ja(this,void 0,void 0,function*(){try{const{headers:n,method:i,body:o}=t;let l={},{region:d}=t;d||(d=this.region);const c=new URL(`${this.url}/${e}`);d&&d!=="any"&&(l["x-region"]=d,c.searchParams.set("forceFunctionRegion",d));let u;o&&(n&&!Object.prototype.hasOwnProperty.call(n,"Content-Type")||!n)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",u=o):typeof o=="string"?(l["Content-Type"]="text/plain",u=o):typeof FormData<"u"&&o instanceof FormData?u=o:(l["Content-Type"]="application/json",u=JSON.stringify(o)));const h=yield this.fetch(c.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),n),body:u}).catch(v=>{throw new _a(v)}),f=h.headers.get("x-relay-error");if(f&&f==="true")throw new ss(h);if(!h.ok)throw new ns(h);let m=((s=h.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),b;return m==="application/json"?b=yield h.json():m==="application/octet-stream"?b=yield h.blob():m==="text/event-stream"?b=h:m==="multipart/form-data"?b=yield h.formData():b=yield h.text(),{data:b,error:null,response:h}}catch(n){return{data:null,error:n,response:n instanceof ns||n instanceof ss?n.context:void 0}}})}}var z={},Dr={},Mt={},pt={},Bt={},Ft={},ka=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")},Ke=ka();const Sa=Ke.fetch,Ms=Ke.fetch.bind(Ke),Bs=Ke.Headers,Ea=Ke.Request,Na=Ke.Response,Je=Object.freeze(Object.defineProperty({__proto__:null,Headers:Bs,Request:Ea,Response:Na,default:Ms,fetch:Sa},Symbol.toStringTag,{value:"Module"})),Pa=Ps(Je);var Ht={};Object.defineProperty(Ht,"__esModule",{value:!0});let Aa=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Ht.default=Aa;var Fs=Z&&Z.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ft,"__esModule",{value:!0});const Oa=Fs(Pa),Ia=Fs(Ht);let Ca=class{constructor(e){var t,s;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=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(s=e.isMaybeSingle)!==null&&s!==void 0?s:!1,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=Oa.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){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 s=this.fetch;let n=s(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,l,d,c;let u=null,h=null,f=null,m=i.status,b=i.statusText;if(i.ok){if(this.method!=="HEAD"){const j=await i.text();j===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?h=j:h=JSON.parse(j))}const x=(l=this.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),p=(d=i.headers.get("content-range"))===null||d===void 0?void 0:d.split("/");x&&p&&p.length>1&&(f=parseInt(p[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,f=null,m=406,b="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{const x=await i.text();try{u=JSON.parse(x),Array.isArray(u)&&i.status===404&&(h=[],u=null,m=200,b="OK")}catch{i.status===404&&x===""?(m=204,b="No Content"):u={message:x}}if(u&&this.isMaybeSingle&&(!((c=u==null?void 0:u.details)===null||c===void 0)&&c.includes("0 rows"))&&(u=null,m=200,b="OK"),u&&this.shouldThrowOnError)throw new Ia.default(u)}return{error:u,data:h,count:f,status:m,statusText:b}});return this.shouldThrowOnError||(n=n.catch(i=>{var o,l,d;return{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(l=i==null?void 0:i.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(d=i==null?void 0:i.code)!==null&&d!==void 0?d:""}`},data:null,count:null,status:0,statusText:""}})),n.then(e,t)}returns(){return this}overrideTypes(){return this}};Ft.default=Ca;var Ra=Z&&Z.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bt,"__esModule",{value:!0});const $a=Ra(Ft);let La=class extends $a.default{select(e){let t=!1;const s=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:n,referencedTable:i=n}={}){const o=i?`${i}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const n=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:n=s}={}){const i=typeof n>"u"?"offset":`${n}.offset`,o=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(o,`${t-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:t=!1,settings:s=!1,buffers:n=!1,wal:i=!1,format:o="text"}={}){var l;const d=[e?"analyze":null,t?"verbose":null,s?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(l=this.headers.get("Accept"))!==null&&l!==void 0?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${d};`),o==="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}};Bt.default=La;var Da=Z&&Z.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(pt,"__esModule",{value:!0});const Ua=Da(Bt);let Ma=class extends Ua.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=Array.from(new Set(t)).map(n=>typeof n=="string"&&new RegExp("[,()]").test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:n}={}){let i="";n==="plain"?i="pl":n==="phrase"?i="ph":n==="websearch"&&(i="w");const o=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${i}fts${o}.${t}`),this}match(e){return Object.entries(e).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const n=s?`${s}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}};pt.default=Ma;var Ba=Z&&Z.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Mt,"__esModule",{value:!0});const rt=Ba(pt);let Fa=class{constructor(e,{headers:t={},schema:s,fetch:n}){this.url=e,this.headers=new Headers(t),this.schema=s,this.fetch=n}select(e,{head:t=!1,count:s}={}){const n=t?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",o),s&&this.headers.append("Prefer",`count=${s}`),new rt.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:s=!0}={}){var n;const i="POST";if(t&&this.headers.append("Prefer",`count=${t}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((l,d)=>l.concat(Object.keys(d)),[]);if(o.length>0){const l=[...new Set(o)].map(d=>`"${d}"`);this.url.searchParams.set("columns",l.join(","))}}return new rt.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:n,defaultToNull:i=!0}={}){var o;const l="POST";if(this.headers.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),n&&this.headers.append("Prefer",`count=${n}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){const d=e.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(d.length>0){const c=[...new Set(d)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new rt.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:t}={}){var s;const n="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new rt.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}delete({count:e}={}){var t;const s="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new rt.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}};Mt.default=Fa;var Hs=Z&&Z.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Dr,"__esModule",{value:!0});const Ha=Hs(Mt),qa=Hs(pt);let Ga=class qs{constructor(e,{headers:t={},schema:s,fetch:n}={}){this.url=e,this.headers=new Headers(t),this.schemaName=s,this.fetch=n}from(e){const t=new URL(`${this.url}/${e}`);return new Ha.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new qs(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,get:n=!1,count:i}={}){var o;let l;const d=new URL(`${this.url}/rpc/${e}`);let c;s||n?(l=s?"HEAD":"GET",Object.entries(t).filter(([h,f])=>f!==void 0).map(([h,f])=>[h,Array.isArray(f)?`{${f.join(",")}}`:`${f}`]).forEach(([h,f])=>{d.searchParams.append(h,f)})):(l="POST",c=t);const u=new Headers(this.headers);return i&&u.set("Prefer",`count=${i}`),new qa.default({method:l,url:d,headers:u,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};Dr.default=Ga;var Ye=Z&&Z.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(z,"__esModule",{value:!0});z.PostgrestError=z.PostgrestBuilder=z.PostgrestTransformBuilder=z.PostgrestFilterBuilder=z.PostgrestQueryBuilder=z.PostgrestClient=void 0;const Gs=Ye(Dr);z.PostgrestClient=Gs.default;const Ws=Ye(Mt);z.PostgrestQueryBuilder=Ws.default;const zs=Ye(pt);z.PostgrestFilterBuilder=zs.default;const Ks=Ye(Bt);z.PostgrestTransformBuilder=Ks.default;const Vs=Ye(Ft);z.PostgrestBuilder=Vs.default;const Js=Ye(Ht);z.PostgrestError=Js.default;var Wa=z.default={PostgrestClient:Gs.default,PostgrestQueryBuilder:Ws.default,PostgrestFilterBuilder:zs.default,PostgrestTransformBuilder:Ks.default,PostgrestBuilder:Vs.default,PostgrestError:Js.default};const{PostgrestClient:za,PostgrestQueryBuilder:Pd,PostgrestFilterBuilder:Ad,PostgrestTransformBuilder:Od,PostgrestBuilder:Id,PostgrestError:Cd}=Wa;class Ka{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 t=process.versions;if(t&&t.node){const s=t.node,n=parseInt(s.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 t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`

Suggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){const s=this.getWebSocketConstructor();return new s(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Va="2.15.5",Ja=`realtime-js/${Va}`,Ya="1.0.0",mr=1e4,Qa=1e3,Za=100;var ct;(function(r){r[r.connecting=0]="connecting",r[r.open=1]="open",r[r.closing=2]="closing",r[r.closed=3]="closed"})(ct||(ct={}));var B;(function(r){r.closed="closed",r.errored="errored",r.joined="joined",r.joining="joining",r.leaving="leaving"})(B||(B={}));var te;(function(r){r.close="phx_close",r.error="phx_error",r.join="phx_join",r.reply="phx_reply",r.leave="phx_leave",r.access_token="access_token"})(te||(te={}));var pr;(function(r){r.websocket="websocket"})(pr||(pr={}));var Pe;(function(r){r.Connecting="connecting",r.Open="open",r.Closing="closing",r.Closed="closed"})(Pe||(Pe={}));class Xa{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const n=t.getUint8(1),i=t.getUint8(2);let o=this.HEADER_LENGTH+2;const l=s.decode(e.slice(o,o+n));o=o+n;const d=s.decode(e.slice(o,o+i));o=o+i;const c=JSON.parse(s.decode(e.slice(o,e.byteLength)));return{ref:null,topic:l,event:d,payload:c}}}class Ys{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}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(r){r.abstime="abstime",r.bool="bool",r.date="date",r.daterange="daterange",r.float4="float4",r.float8="float8",r.int2="int2",r.int4="int4",r.int4range="int4range",r.int8="int8",r.int8range="int8range",r.json="json",r.jsonb="jsonb",r.money="money",r.numeric="numeric",r.oid="oid",r.reltime="reltime",r.text="text",r.time="time",r.timestamp="timestamp",r.timestamptz="timestamptz",r.timetz="timetz",r.tsrange="tsrange",r.tstzrange="tstzrange"})(M||(M={}));const as=(r,e,t={})=>{var s;const n=(s=t.skipTypes)!==null&&s!==void 0?s:[];return Object.keys(e).reduce((i,o)=>(i[o]=ei(o,r,e,n),i),{})},ei=(r,e,t,s)=>{const n=e.find(l=>l.name===r),i=n==null?void 0:n.type,o=t[r];return i&&!s.includes(i)?Qs(i,o):gr(o)},Qs=(r,e)=>{if(r.charAt(0)==="_"){const t=r.slice(1,r.length);return ni(e,t)}switch(r){case M.bool:return ti(e);case M.float4:case M.float8:case M.int2:case M.int4:case M.int8:case M.numeric:case M.oid:return ri(e);case M.json:case M.jsonb:return si(e);case M.timestamp:return ai(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 gr(e);default:return gr(e)}},gr=r=>r,ti=r=>{switch(r){case"t":return!0;case"f":return!1;default:return r}},ri=r=>{if(typeof r=="string"){const e=parseFloat(r);if(!Number.isNaN(e))return e}return r},si=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(e){return console.log(`JSON parse error: ${e}`),r}return r},ni=(r,e)=>{if(typeof r!="string")return r;const t=r.length-1,s=r[t];if(r[0]==="{"&&s==="}"){let i;const o=r.slice(1,t);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>Qs(e,l))}return r},ai=r=>typeof r=="string"?r.replace(" ","T"):r,Zs=r=>{let e=r;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"};class Qt{constructor(e,t,s={},n=mr){this.channel=e,this.event=t,this.payload=s,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,t){var s;return this._hasReceived(e)&&t((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}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:t}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var is;(function(r){r.SYNC="sync",r.JOIN="join",r.LEAVE="leave"})(is||(is={}));class dt{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},n=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=dt.syncState(this.state,n,i,o),this.pendingDiffs.forEach(d=>{this.state=dt.syncDiff(this.state,d,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(s.diff,{},n=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=dt.syncDiff(this.state,n,i,o),l())}),this.onJoin((n,i,o)=>{this.channel._trigger("presence",{event:"join",key:n,currentPresences:i,newPresences:o})}),this.onLeave((n,i,o)=>{this.channel._trigger("presence",{event:"leave",key:n,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,s,n){const i=this.cloneDeep(e),o=this.transformState(t),l={},d={};return this.map(i,(c,u)=>{o[c]||(d[c]=u)}),this.map(o,(c,u)=>{const h=i[c];if(h){const f=u.map(x=>x.presence_ref),m=h.map(x=>x.presence_ref),b=u.filter(x=>m.indexOf(x.presence_ref)<0),v=h.filter(x=>f.indexOf(x.presence_ref)<0);b.length>0&&(l[c]=b),v.length>0&&(d[c]=v)}else l[c]=u}),this.syncDiff(i,{joins:l,leaves:d},s,n)}static syncDiff(e,t,s,n){const{joins:i,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),n||(n=()=>{}),this.map(i,(l,d)=>{var c;const u=(c=e[l])!==null&&c!==void 0?c:[];if(e[l]=this.cloneDeep(d),u.length>0){const h=e[l].map(m=>m.presence_ref),f=u.filter(m=>h.indexOf(m.presence_ref)<0);e[l].unshift(...f)}s(l,u,d)}),this.map(o,(l,d)=>{let c=e[l];if(!c)return;const u=d.map(h=>h.presence_ref);c=c.filter(h=>u.indexOf(h.presence_ref)<0),e[l]=c,n(l,c,d),c.length===0&&delete e[l]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,s)=>{const n=e[s];return"metas"in n?t[s]=n.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[s]=n,t},{})}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 os;(function(r){r.ALL="*",r.INSERT="INSERT",r.UPDATE="UPDATE",r.DELETE="DELETE"})(os||(os={}));var ut;(function(r){r.BROADCAST="broadcast",r.PRESENCE="presence",r.POSTGRES_CHANGES="postgres_changes",r.SYSTEM="system"})(ut||(ut={}));var le;(function(r){r.SUBSCRIBED="SUBSCRIBED",r.TIMED_OUT="TIMED_OUT",r.CLOSED="CLOSED",r.CHANNEL_ERROR="CHANNEL_ERROR"})(le||(le={}));class Ur{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=B.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},t.config),this.timeout=this.socket.timeout,this.joinPush=new Qt(this,te.join,this.params,this.timeout),this.rejoinTimer=new Ys(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=B.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=B.closed,this.socket._remove(this)}),this._onError(n=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,n),this.state=B.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=B.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",n=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,n),this.state=B.errored,this.rejoinTimer.scheduleTimeout())}),this._on(te.reply,{},(n,i)=>{this._trigger(this._replyEventName(i),n)}),this.presence=new dt(this),this.broadcastEndpointURL=Zs(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var s,n,i;if(this.socket.isConnected()||this.socket.connect(),this.state==B.closed){const{config:{broadcast:o,presence:l,private:d}}=this.params,c=(n=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(m=>m.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[ut.PRESENCE]&&this.bindings[ut.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},f={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:u}),postgres_changes:c,private:d};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(m=>e==null?void 0:e(le.CHANNEL_ERROR,m)),this._onClose(()=>e==null?void 0:e(le.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:m})=>{var b;if(this.socket.setAuth(),m===void 0){e==null||e(le.SUBSCRIBED);return}else{const v=this.bindings.postgres_changes,x=(b=v==null?void 0:v.length)!==null&&b!==void 0?b:0,p=[];for(let j=0;j<x;j++){const w=v[j],{filter:{event:k,schema:N,table:S,filter:E}}=w,T=m&&m[j];if(T&&T.event===k&&T.schema===N&&T.table===S&&T.filter===E)p.push(Object.assign(Object.assign({},w),{id:T.id}));else{this.unsubscribe(),this.state=B.errored,e==null||e(le.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=p,e&&e(le.SUBSCRIBED);return}}).receive("error",m=>{this.state=B.errored,e==null||e(le.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(m).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(le.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this.state===B.joined&&e===ut.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,t,s)}async send(e,t={}){var s,n;if(!this._canPush()&&e.type==="broadcast"){const{event:i,payload:o}=e,d={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:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,d,(s=t.timeout)!==null&&s!==void 0?s:this.timeout);return await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,d;const c=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((d=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||d===void 0)&&d.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=B.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(te.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(n=>{s=new Qt(this,te.leave,{},e),s.receive("ok",()=>{t(),n("ok")}).receive("timeout",()=>{t(),n("timed out")}).receive("error",()=>{n("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=B.closed,this.bindings={}}async _fetchWithTimeout(e,t,s){const n=new AbortController,i=setTimeout(()=>n.abort(),s),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(i),o}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let n=new Qt(this,e,t,s);return this._canPush()?n.send():this._addToPushBuffer(n),n}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Za){const t=this.pushBuffer.shift();t&&(t.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${t.event}`,t.payload))}}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var n,i;const o=e.toLocaleLowerCase(),{close:l,error:d,leave:c,join:u}=te;if(s&&[l,d,c,u].indexOf(o)>=0&&s!==this._joinRef())return;let f=this._onMessage(o,t,s);if(t&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(n=this.bindings.postgres_changes)===null||n===void 0||n.filter(m=>{var b,v,x;return((b=m.filter)===null||b===void 0?void 0:b.event)==="*"||((x=(v=m.filter)===null||v===void 0?void 0:v.event)===null||x===void 0?void 0:x.toLocaleLowerCase())===o}).map(m=>m.callback(f,s)):(i=this.bindings[o])===null||i===void 0||i.filter(m=>{var b,v,x,p,j,w;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in m){const k=m.id,N=(b=m.filter)===null||b===void 0?void 0:b.event;return k&&((v=t.ids)===null||v===void 0?void 0:v.includes(k))&&(N==="*"||(N==null?void 0:N.toLocaleLowerCase())===((x=t.data)===null||x===void 0?void 0:x.type.toLocaleLowerCase()))}else{const k=(j=(p=m==null?void 0:m.filter)===null||p===void 0?void 0:p.event)===null||j===void 0?void 0:j.toLocaleLowerCase();return k==="*"||k===((w=t==null?void 0:t.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===o}).map(m=>{if(typeof f=="object"&&"ids"in f){const b=f.data,{schema:v,table:x,commit_timestamp:p,type:j,errors:w}=b;f=Object.assign(Object.assign({},{schema:v,table:x,commit_timestamp:p,eventType:j,new:{},old:{},errors:w}),this._getPayloadRecords(b))}m.callback(f,s)})}_isClosed(){return this.state===B.closed}_isJoined(){return this.state===B.joined}_isJoining(){return this.state===B.joining}_isLeaving(){return this.state===B.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const n=e.toLocaleLowerCase(),i={type:n,filter:t,callback:s};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(n=>{var i;return!(((i=n.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===s&&Ur.isEqual(n.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(te.close,{},e)}_onError(e){this._on(te.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=B.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=as(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=as(e.columns,e.old_record)),t}}const Zt=()=>{},xt={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},ii=[1e3,2e3,5e3,1e4],oi=1e4,li=`
  addEventListener("message", (e) => {
    if (e.data.event === "start") {
      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
    }
  });`;class ci{constructor(e,t){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=mr,this.transport=null,this.heartbeatIntervalMs=xt.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Zt,this.ref=0,this.reconnectTimer=null,this.logger=Zt,this.conn=null,this.sendBuffer=[],this.serializer=new Xa,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=n=>{let i;return n?i=n:typeof fetch>"u"?i=(...o)=>he(async()=>{const{default:l}=await Promise.resolve().then(()=>Je);return{default:l}},void 0).then(({default:l})=>l(...o)).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.`)}):i=fetch,(...o)=>i(...o)},!(!((s=t==null?void 0:t.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${pr.websocket}`,this.httpEndpoint=Zs(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(t==null?void 0:t.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=Ka.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;throw t.includes("Node.js")?new Error(`${t}

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: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Ya}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},e?this.conn.close(e,t??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case ct.connecting:return Pe.Connecting;case ct.open:return Pe.Open;case ct.closing:return Pe.Closing;default:return Pe.Closed}}isConnected(){return this.connectionState()===Pe.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,t={config:{}}){const s=`realtime:${e}`,n=this.getChannels().find(i=>i.topic===s);if(n)return n;{const i=new Ur(`realtime:${e}`,t,this);return this.channels.push(i),i}}push(e){const{topic:t,event:s,payload:n,ref:i}=e,o=()=>{this.encode(e,l=>{var d;(d=this.conn)===null||d===void 0||d.send(l)})};this.log("push",`${t} ${s} (${i})`,n),this.isConnected()?o():this.sendBuffer.push(o)}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(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(Qa,"heartbeat timeout"),setTimeout(()=>{var t;this.isConnected()||(t=this.reconnectTimer)===null||t===void 0||t.scheduleTimeout()},xt.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}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 t=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,t=>{if(t.topic==="phoenix"&&t.event==="phx_reply")try{this.heartbeatCallback(t.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}t.ref&&t.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:n,payload:i,ref:o}=t,l=o?`(${o})`:"",d=i.status||"";this.log("receive",`${d} ${s} ${n} ${l}`.trim(),i),this.channels.filter(c=>c._isMember(s)).forEach(c=>c._trigger(n,i,o)),this._triggerStateCallbacks("message",t)})}_clearTimer(e){var t;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((t=this.reconnectTimer)===null||t===void 0||t.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=t=>{this.log("worker","worker error",t.message),this.workerRef.terminate()},this.workerRef.onmessage=t=>{t.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(t=this.reconnectTimer)===null||t===void 0||t.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(te.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const s=e.match(/\?/)?"&":"?",n=new URLSearchParams(t);return`${e}${s}${n}`}_workerObjectUrl(e){let t;if(e)t=e;else{const s=new Blob([li],{type:"application/javascript"});t=URL.createObjectURL(s)}return t}_setConnectionState(e,t=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;e?t=e:this.accessToken?t=await this.accessToken():t=this.accessTokenValue,this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(s=>{const n={access_token:t,version:Ja};t&&s.updateJoinPayload(n),s.joinedOnce&&s._isJoined()&&s._push(te.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(s=>{try{s(t)}catch(n){this.log("error",`error in ${e} callback`,n)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new Ys(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},xt.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,s,n,i,o,l,d,c,u;if(this.transport=(t=e==null?void 0:e.transport)!==null&&t!==void 0?t:null,this.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:mr,this.heartbeatIntervalMs=(n=e==null?void 0:e.heartbeatIntervalMs)!==null&&n!==void 0?n:xt.HEARTBEAT_INTERVAL,this.worker=(i=e==null?void 0:e.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=e==null?void 0:e.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(l=e==null?void 0:e.heartbeatCallback)!==null&&l!==void 0?l:Zt,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=(d=e==null?void 0:e.reconnectAfterMs)!==null&&d!==void 0?d:h=>ii[h-1]||oi,this.encode=(c=e==null?void 0:e.encode)!==null&&c!==void 0?c:(h,f)=>f(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 Mr extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function F(r){return typeof r=="object"&&r!==null&&"__isStorageError"in r}class di extends Mr{constructor(e,t,s){super(e),this.name="StorageApiError",this.status=t,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class yr extends Mr{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var ui=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};const Xs=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>he(async()=>{const{default:s}=await Promise.resolve().then(()=>Je);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},hi=()=>ui(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield he(()=>Promise.resolve().then(()=>Je),void 0)).Response:Response}),br=r=>{if(Array.isArray(r))return r.map(t=>br(t));if(typeof r=="function"||r!==Object(r))return r;const e={};return Object.entries(r).forEach(([t,s])=>{const n=t.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=br(s)}),e},fi=r=>{if(typeof r!="object"||r===null)return!1;const e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)};var Ce=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};const Xt=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),mi=(r,e,t)=>Ce(void 0,void 0,void 0,function*(){const s=yield hi();r instanceof s&&!(t!=null&&t.noResolveJson)?r.json().then(n=>{const i=r.status||500,o=(n==null?void 0:n.statusCode)||i+"";e(new di(Xt(n),i,o))}).catch(n=>{e(new yr(Xt(n),n))}):e(new yr(Xt(r),r))}),pi=(r,e,t,s)=>{const n={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"||!s?n:(fi(s)?(n.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),n.body=JSON.stringify(s)):n.body=s,e!=null&&e.duplex&&(n.duplex=e.duplex),Object.assign(Object.assign({},n),t))};function gt(r,e,t,s,n,i){return Ce(this,void 0,void 0,function*(){return new Promise((o,l)=>{r(t,pi(e,s,n,i)).then(d=>{if(!d.ok)throw d;return s!=null&&s.noResolveJson?d:d.json()}).then(d=>o(d)).catch(d=>mi(d,l,s))})})}function Et(r,e,t,s){return Ce(this,void 0,void 0,function*(){return gt(r,"GET",e,t,s)})}function ne(r,e,t,s,n){return Ce(this,void 0,void 0,function*(){return gt(r,"POST",e,s,n,t)})}function xr(r,e,t,s,n){return Ce(this,void 0,void 0,function*(){return gt(r,"PUT",e,s,n,t)})}function gi(r,e,t,s){return Ce(this,void 0,void 0,function*(){return gt(r,"HEAD",e,Object.assign(Object.assign({},t),{noResolveJson:!0}),s)})}function en(r,e,t,s,n){return Ce(this,void 0,void 0,function*(){return gt(r,"DELETE",e,s,n,t)})}var q=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};const yi={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ls={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class bi{constructor(e,t={},s,n){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=s,this.fetch=Xs(n)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,s,n){return q(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},ls),n);let l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const d=o.metadata;typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),d&&i.append("metadata",this.encodeMetadata(d)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.append("cacheControl",o.cacheControl),d&&i.append("metadata",this.encodeMetadata(d))):(i=s,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,d&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(d)))),n!=null&&n.headers&&(l=Object.assign(Object.assign({},l),n.headers));const c=this._removeEmptyFolders(t),u=this._getFinalPath(c),h=yield(e=="PUT"?xr:ne)(this.fetch,`${this.url}/object/${u}`,i,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(F(i))return{data:null,error:i};throw i}})}upload(e,t,s){return q(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,s)})}uploadToSignedUrl(e,t,s,n){return q(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(e),o=this._getFinalPath(i),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",t);try{let d;const c=Object.assign({upsert:ls.upsert},n),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&s instanceof Blob?(d=new FormData,d.append("cacheControl",c.cacheControl),d.append("",s)):typeof FormData<"u"&&s instanceof FormData?(d=s,d.append("cacheControl",c.cacheControl)):(d=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType);const h=yield xr(this.fetch,l.toString(),d,{headers:u});return{data:{path:i,fullPath:h.Key},error:null}}catch(d){if(this.shouldThrowOnError)throw d;if(F(d))return{data:null,error:d};throw d}})}createSignedUploadUrl(e,t){return q(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const n=Object.assign({},this.headers);t!=null&&t.upsert&&(n["x-upsert"]="true");const i=yield ne(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:n}),o=new URL(this.url+i.url),l=o.searchParams.get("token");if(!l)throw new Mr("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:l},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(F(s))return{data:null,error:s};throw s}})}update(e,t,s){return q(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,s)})}move(e,t,s){return q(this,void 0,void 0,function*(){try{return{data:yield ne(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.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,t,s){return q(this,void 0,void 0,function*(){try{return{data:{path:(yield ne(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.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,t,s){return q(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=yield ne(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:t},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}createSignedUrls(e,t,s){return q(this,void 0,void 0,function*(){try{const n=yield ne(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:n.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}download(e,t){return q(this,void 0,void 0,function*(){const n=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),o=i?`?${i}`:"";try{const l=this._getFinalPath(e);return{data:yield(yield Et(this.fetch,`${this.url}/${n}/${l}${o}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(this.shouldThrowOnError)throw l;if(F(l))return{data:null,error:l};throw l}})}info(e){return q(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{const s=yield Et(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:br(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(F(s))return{data:null,error:s};throw s}})}exists(e){return q(this,void 0,void 0,function*(){const t=this._getFinalPath(e);try{return yield gi(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(F(s)&&s instanceof yr){const n=s.originalError;if([400,404].includes(n==null?void 0:n.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,t){const s=this._getFinalPath(e),n=[],i=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";i!==""&&n.push(i);const l=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",d=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});d!==""&&n.push(d);let c=n.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${s}${c}`)}}}remove(e){return q(this,void 0,void 0,function*(){try{return{data:yield en(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(F(t))return{data:null,error:t};throw t}})}list(e,t,s){return q(this,void 0,void 0,function*(){try{const n=Object.assign(Object.assign(Object.assign({},yi),t),{prefix:e||""});return{data:yield ne(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},s),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(F(n))return{data:null,error:n};throw n}})}listV2(e,t){return q(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield ne(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},t),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(F(s))return{data:null,error:s};throw s}})}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 t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const xi="2.12.1",vi={"X-Client-Info":`storage-js/${xi}`};var Le=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};class wi{constructor(e,t={},s,n){this.shouldThrowOnError=!1;const i=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},vi),t),this.fetch=Xs(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(){return Le(this,void 0,void 0,function*(){try{return{data:yield Et(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 Et(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(F(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return Le(this,void 0,void 0,function*(){try{return{data:yield ne(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(F(s))return{data:null,error:s};throw s}})}updateBucket(e,t){return Le(this,void 0,void 0,function*(){try{return{data:yield xr(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(F(s))return{data:null,error:s};throw s}})}emptyBucket(e){return Le(this,void 0,void 0,function*(){try{return{data:yield ne(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(F(t))return{data:null,error:t};throw t}})}deleteBucket(e){return Le(this,void 0,void 0,function*(){try{return{data:yield en(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(F(t))return{data:null,error:t};throw t}})}}class _i extends wi{constructor(e,t={},s,n){super(e,t,s,n)}from(e){return new bi(this.url,this.headers,e,this.fetch)}}const ji="2.57.4";let it="";typeof Deno<"u"?it="deno":typeof document<"u"?it="web":typeof navigator<"u"&&navigator.product==="ReactNative"?it="react-native":it="node";const Ti={"X-Client-Info":`supabase-js-${it}/${ji}`},ki={headers:Ti},Si={schema:"public"},Ei={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Ni={};var Pi=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};const Ai=r=>{let e;return r?e=r:typeof fetch>"u"?e=Ms:e=fetch,(...t)=>e(...t)},Oi=()=>typeof Headers>"u"?Bs:Headers,Ii=(r,e,t)=>{const s=Ai(t),n=Oi();return(i,o)=>Pi(void 0,void 0,void 0,function*(){var l;const d=(l=yield e())!==null&&l!==void 0?l:r;let c=new n(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",r),c.has("Authorization")||c.set("Authorization",`Bearer ${d}`),s(i,Object.assign(Object.assign({},o),{headers:c}))})};var Ci=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};function Ri(r){return r.endsWith("/")?r:r+"/"}function $i(r,e){var t,s;const{db:n,auth:i,realtime:o,global:l}=r,{db:d,auth:c,realtime:u,global:h}=e,f={db:Object.assign(Object.assign({},d),n),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},u),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),l),{headers:Object.assign(Object.assign({},(t=h==null?void 0:h.headers)!==null&&t!==void 0?t:{}),(s=l==null?void 0:l.headers)!==null&&s!==void 0?s:{})}),accessToken:()=>Ci(this,void 0,void 0,function*(){return""})};return r.accessToken?f.accessToken=r.accessToken:delete f.accessToken,f}function Li(r){const e=r==null?void 0:r.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(Ri(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const tn="2.71.1",Fe=30*1e3,vr=3,er=vr*Fe,Di="http://localhost:9999",Ui="supabase.auth.token",Mi={"X-Client-Info":`gotrue-js/${tn}`},wr="X-Supabase-Api-Version",rn={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Bi=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Fi=10*60*1e3;class Br extends Error{constructor(e,t,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=s}}function P(r){return typeof r=="object"&&r!==null&&"__isAuthError"in r}class Hi extends Br{constructor(e,t,s){super(e,t,s),this.name="AuthApiError",this.status=t,this.code=s}}function qi(r){return P(r)&&r.name==="AuthApiError"}class sn extends Br{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class ve extends Br{constructor(e,t,s,n){super(e,s,n),this.name=t,this.status=s}}class ge extends ve{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Gi(r){return P(r)&&r.name==="AuthSessionMissingError"}class vt extends ve{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class wt extends ve{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class _t extends ve{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Wi(r){return P(r)&&r.name==="AuthImplicitGrantRedirectError"}class cs extends ve{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class _r extends ve{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function tr(r){return P(r)&&r.name==="AuthRetryableFetchError"}class ds extends ve{constructor(e,t,s){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=s}}class jr extends ve{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),us=` 	
\r=`.split(""),zi=(()=>{const r=new Array(128);for(let e=0;e<r.length;e+=1)r[e]=-1;for(let e=0;e<us.length;e+=1)r[us[e].charCodeAt(0)]=-2;for(let e=0;e<Nt.length;e+=1)r[Nt[e].charCodeAt(0)]=e;return r})();function hs(r,e,t){if(r!==null)for(e.queue=e.queue<<8|r,e.queuedBits+=8;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;t(Nt[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;t(Nt[s]),e.queuedBits-=6}}function nn(r,e,t){const s=zi[r];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)t(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(r)}"`)}}function fs(r){const e=[],t=o=>{e.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{Ji(o,s,t)};for(let o=0;o<r.length;o+=1)nn(r.charCodeAt(o),n,i);return e.join("")}function Ki(r,e){if(r<=127){e(r);return}else if(r<=2047){e(192|r>>6),e(128|r&63);return}else if(r<=65535){e(224|r>>12),e(128|r>>6&63),e(128|r&63);return}else if(r<=1114111){e(240|r>>18),e(128|r>>12&63),e(128|r>>6&63),e(128|r&63);return}throw new Error(`Unrecognized Unicode codepoint: ${r.toString(16)}`)}function Vi(r,e){for(let t=0;t<r.length;t+=1){let s=r.charCodeAt(t);if(s>55295&&s<=56319){const n=(s-55296)*1024&65535;s=(r.charCodeAt(t+1)-56320&65535|n)+65536,t+=1}Ki(s,e)}}function Ji(r,e,t){if(e.utf8seq===0){if(r<=127){t(r);return}for(let s=1;s<6;s+=1)if(!(r>>7-s&1)){e.utf8seq=s;break}if(e.utf8seq===2)e.codepoint=r&31;else if(e.utf8seq===3)e.codepoint=r&15;else if(e.utf8seq===4)e.codepoint=r&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(r<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|r&63,e.utf8seq-=1,e.utf8seq===0&&t(e.codepoint)}}function Yi(r){const e=[],t={queue:0,queuedBits:0},s=n=>{e.push(n)};for(let n=0;n<r.length;n+=1)nn(r.charCodeAt(n),t,s);return new Uint8Array(e)}function Qi(r){const e=[];return Vi(r,t=>e.push(t)),new Uint8Array(e)}function Zi(r){const e=[],t={queue:0,queuedBits:0},s=n=>{e.push(n)};return r.forEach(n=>hs(n,t,s)),hs(null,t,s),e.join("")}function Xi(r){return Math.round(Date.now()/1e3)+r}function eo(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){const e=Math.random()*16|0;return(r=="x"?e:e&3|8).toString(16)})}const ee=()=>typeof window<"u"&&typeof document<"u",je={tested:!1,writable:!1},an=()=>{if(!ee())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(je.tested)return je.writable;const r=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(r,r),globalThis.localStorage.removeItem(r),je.tested=!0,je.writable=!0}catch{je.tested=!0,je.writable=!1}return je.writable};function to(r){const e={},t=new URL(r);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch{}return t.searchParams.forEach((s,n)=>{e[n]=s}),e}const on=r=>{let e;return r?e=r:typeof fetch>"u"?e=(...t)=>he(async()=>{const{default:s}=await Promise.resolve().then(()=>Je);return{default:s}},void 0).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},ro=r=>typeof r=="object"&&r!==null&&"status"in r&&"ok"in r&&"json"in r&&typeof r.json=="function",He=async(r,e,t)=>{await r.setItem(e,JSON.stringify(t))},Te=async(r,e)=>{const t=await r.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},me=async(r,e)=>{await r.removeItem(e)};class qt{constructor(){this.promise=new qt.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}qt.promiseConstructor=Promise;function rr(r){const e=r.split(".");if(e.length!==3)throw new jr("Invalid JWT structure");for(let s=0;s<e.length;s++)if(!Bi.test(e[s]))throw new jr("JWT not in base64url format");return{header:JSON.parse(fs(e[0])),payload:JSON.parse(fs(e[1])),signature:Yi(e[2]),raw:{header:e[0],payload:e[1]}}}async function so(r){return await new Promise(e=>{setTimeout(()=>e(null),r)})}function no(r,e){return new Promise((s,n)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await r(i);if(!e(i,null,o)){s(o);return}}catch(o){if(!e(i,o)){n(o);return}}})()})}function ao(r){return("0"+r.toString(16)).substr(-2)}function io(){const e=new Uint32Array(56);if(typeof crypto>"u"){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=t.length;let n="";for(let i=0;i<56;i++)n+=t.charAt(Math.floor(Math.random()*s));return n}return crypto.getRandomValues(e),Array.from(e,ao).join("")}async function oo(r){const t=new TextEncoder().encode(r),s=await crypto.subtle.digest("SHA-256",t),n=new Uint8Array(s);return Array.from(n).map(i=>String.fromCharCode(i)).join("")}async function lo(r){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."),r;const t=await oo(r);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function De(r,e,t=!1){const s=io();let n=s;t&&(n+="/PASSWORD_RECOVERY"),await He(r,`${e}-code-verifier`,n);const i=await lo(s);return[i,s===i?"plain":"s256"]}const co=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function uo(r){const e=r.headers.get(wr);if(!e||!e.match(co))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function ho(r){if(!r)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(r<=e)throw new Error("JWT has expired")}function fo(r){switch(r){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 mo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ue(r){if(!mo.test(r))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function sr(){const r={};return new Proxy(r,{get:(e,t)=>{if(t==="__isUserNotAvailableProxy")return!0;if(typeof t=="symbol"){const s=t.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="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 "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ms(r){return JSON.parse(JSON.stringify(r))}var po=function(r,e){var t={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(r);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(r,s[n])&&(t[s[n]]=r[s[n]]);return t};const Ee=r=>r.msg||r.message||r.error_description||r.error||JSON.stringify(r),go=[502,503,504];async function ps(r){var e;if(!ro(r))throw new _r(Ee(r),0);if(go.includes(r.status))throw new _r(Ee(r),r.status);let t;try{t=await r.json()}catch(i){throw new sn(Ee(i),i)}let s;const n=uo(r);if(n&&n.getTime()>=rn["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?s=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(s=t.error_code),s){if(s==="weak_password")throw new ds(Ee(t),r.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new ge}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new ds(Ee(t),r.status,t.weak_password.reasons);throw new Hi(Ee(t),r.status||500,s)}const yo=(r,e,t,s)=>{const n={method:r,headers:(e==null?void 0:e.headers)||{}};return r==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(s),Object.assign(Object.assign({},n),t))};async function O(r,e,t,s){var n;const i=Object.assign({},s==null?void 0:s.headers);i[wr]||(i[wr]=rn["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(n=s==null?void 0:s.query)!==null&&n!==void 0?n:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",d=await bo(r,e,t+l,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(d):{data:Object.assign({},d),error:null}}async function bo(r,e,t,s,n,i){const o=yo(e,s,n,i);let l;try{l=await r(t,Object.assign({},o))}catch(d){throw console.error(d),new _r(Ee(d),0)}if(l.ok||await ps(l),s!=null&&s.noResolveJson)return l;try{return await l.json()}catch(d){await ps(d)}}function oe(r){var e;let t=null;_o(r)&&(t=Object.assign({},r),r.expires_at||(t.expires_at=Xi(r.expires_in)));const s=(e=r.user)!==null&&e!==void 0?e:r;return{data:{session:t,user:s},error:null}}function gs(r){const e=oe(r);return!e.error&&r.weak_password&&typeof r.weak_password=="object"&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.message&&typeof r.weak_password.message=="string"&&r.weak_password.reasons.reduce((t,s)=>t&&typeof s=="string",!0)&&(e.data.weak_password=r.weak_password),e}function ye(r){var e;return{data:{user:(e=r.user)!==null&&e!==void 0?e:r},error:null}}function xo(r){return{data:r,error:null}}function vo(r){const{action_link:e,email_otp:t,hashed_token:s,redirect_to:n,verification_type:i}=r,o=po(r,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:t,hashed_token:s,redirect_to:n,verification_type:i},d=Object.assign({},o);return{data:{properties:l,user:d},error:null}}function wo(r){return r}function _o(r){return r.access_token&&r.refresh_token&&r.expires_in}const nr=["global","local","others"];var jo=function(r,e){var t={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.indexOf(s)<0&&(t[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(r);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(r,s[n])&&(t[s[n]]=r[s[n]]);return t};class To{constructor({url:e="",headers:t={},fetch:s}){this.url=e,this.headers=t,this.fetch=on(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t=nr[0]){if(nr.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${nr.join(", ")}`);try{return await O(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(P(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,t={}){try{return await O(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:ye})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:t}=e,s=jo(e,["options"]),n=Object.assign(Object.assign({},s),t);return"newEmail"in s&&(n.new_email=s==null?void 0:s.newEmail,delete n.newEmail),await O(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:vo,redirectTo:t==null?void 0:t.redirectTo})}catch(t){if(P(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await O(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ye})}catch(t){if(P(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,s,n,i,o,l,d;try{const c={nextPage:null,lastPage:0,total:0},u=await O(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(t=e==null?void 0:e.page)===null||t===void 0?void 0:t.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:wo});if(u.error)throw u.error;const h=await u.json(),f=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(d=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&d!==void 0?d:[];return m.length>0&&(m.forEach(b=>{const v=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(b.split(";")[1].split("=")[1]);c[`${x}Page`]=v}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(P(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Ue(e);try{return await O(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ye})}catch(t){if(P(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){Ue(e);try{return await O(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:ye})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,t=!1){Ue(e);try{return await O(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:ye})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){Ue(e.userId);try{const{data:t,error:s}=await O(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:t,error:s}}catch(t){if(P(t))return{data:null,error:t};throw t}}async _deleteFactor(e){Ue(e.userId),Ue(e.id);try{return{data:await O(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(P(t))return{data:null,error:t};throw t}}}function ys(r={}){return{getItem:e=>r[e]||null,setItem:(e,t)=>{r[e]=t},removeItem:e=>{delete r[e]}}}function ko(){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)}}const Me={debug:!!(globalThis&&an()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class ln extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class So extends ln{}async function Eo(r,e,t){Me.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",r,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),Me.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",r)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(r,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async n=>{if(n){Me.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",r,n.name);try{return await t()}finally{Me.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",r,n.name)}}else{if(e===0)throw Me.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",r),new So(`Acquiring an exclusive Navigator LockManager lock "${r}" immediately failed`);if(Me.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null,"  "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}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 t()}}))}ko();const No={url:Di,storageKey:Ui,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Mi,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function bs(r,e,t){return await t()}const Be={};class ft{constructor(e){var t,s;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=ft.nextInstanceID,ft.nextInstanceID+=1,this.instanceID>0&&ee()&&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({},No),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 To({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=on(n.fetch),this.lock=n.lock||bs,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:ee()&&(!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks)?this.lock=Eo:this.lock=bs,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)},this.persistSession?(n.storage?this.storage=n.storage:an()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ys(this.memoryStorage)),n.userStorage&&(this.userStorage=n.userStorage)):(this.memoryStorage={},this.storage=ys(this.memoryStorage)),ee()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var e,t;return(t=(e=Be[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&t!==void 0?t:{keys:[]}}set jwks(e){Be[this.storageKey]=Object.assign(Object.assign({},Be[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return(t=(e=Be[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&t!==void 0?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Be[this.storageKey]=Object.assign(Object.assign({},Be[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${tn}) ${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 t=to(window.location.href);let s="none";if(this._isImplicitGrantCallback(t)?s="implicit":await this._isPKCECallback(t)&&(s="pkce"),ee()&&this.detectSessionInUrl&&s!=="none"){const{data:n,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Wi(i)){const d=(e=i.details)===null||e===void 0?void 0:e.code;if(d==="identity_already_exists"||d==="identity_not_found"||d==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:l}=n;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return P(t)?{error:t}:{error:new sn("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,s,n;try{const i=await O(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:oe}),{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const d=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",d)),{data:{user:c,session:d},error:null}}catch(i){if(P(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(e){var t,s,n;try{let i;if("email"in e){const{email:u,password:h,options:f}=e;let m=null,b=null;this.flowType==="pkce"&&([m,b]=await De(this.storage,this.storageKey)),i=await O(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:u,password:h,data:(t=f==null?void 0:f.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:m,code_challenge_method:b},xform:oe})}else if("phone"in e){const{phone:u,password:h,options:f}=e;i=await O(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(s=f==null?void 0:f.data)!==null&&s!==void 0?s:{},channel:(n=f==null?void 0:f.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:oe})}else throw new wt("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const d=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",d)),{data:{user:c,session:d},error:null}}catch(i){if(P(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(e){try{let t;if("email"in e){const{email:i,password:o,options:l}=e;t=await O(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:gs})}else if("phone"in e){const{phone:i,password:o,options:l}=e;t=await O(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:gs})}else throw new wt("You must provide either an email or phone number and a password");const{data:s,error:n}=t;return n?{data:{user:null,session:null},error:n}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new vt}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:n})}catch(t){if(P(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,s,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;if(t==="solana")return await this.signInWithSolana(e);throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}async signInWithSolana(e){var t,s,n,i,o,l,d,c,u,h,f,m;let b,v;if("message"in e)b=e.message,v=e.signature;else{const{chain:x,wallet:p,statement:j,options:w}=e;let k;if(ee())if(typeof p=="object")k=p;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"))k=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 p!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=p}const N=new URL((t=w==null?void 0:w.url)!==null&&t!==void 0?t:window.location.href);if("signIn"in k&&k.signIn){const S=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:N.host,uri:N.href}),j?{statement:j}: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)b=typeof E.signedMessage=="string"?E.signedMessage:new TextDecoder().decode(E.signedMessage),v=E.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${N.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...j?["",j,""]:[""],"Version: 1",`URI: ${N.href}`,`Issued At: ${(n=(s=w==null?void 0:w.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=w==null?void 0:w.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((d=w==null?void 0:w.signInWithSolana)===null||d===void 0)&&d.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(u=w==null?void 0:w.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...w.signInWithSolana.resources.map(E=>`- ${E}`)]:[]].join(`
`);const S=await k.signMessage(new TextEncoder().encode(b),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=S}}try{const{data:x,error:p}=await O(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:Zi(v)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=e.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:oe});if(p)throw p;return!x||!x.session||!x.user?{data:{user:null,session:null},error:new vt}:(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),{data:Object.assign({},x),error:p})}catch(x){if(P(x))return{data:{user:null,session:null},error:x};throw x}}async _exchangeCodeForSession(e){const t=await Te(this.storage,`${this.storageKey}-code-verifier`),[s,n]=(t??"").split("/");try{const{data:i,error:o}=await O(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:oe});if(await me(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new vt}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:n??null}),error:o})}catch(i){if(P(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(e){try{const{options:t,provider:s,token:n,access_token:i,nonce:o}=e,l=await O(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:n,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:oe}),{data:d,error:c}=l;return c?{data:{user:null,session:null},error:c}:!d||!d.session||!d.user?{data:{user:null,session:null},error:new vt}:(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),{data:d,error:c})}catch(t){if(P(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,s,n,i,o;try{if("email"in e){const{email:l,options:d}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await De(this.storage,this.storageKey));const{error:h}=await O(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(t=d==null?void 0:d.data)!==null&&t!==void 0?t:{},create_user:(s=d==null?void 0:d.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:d==null?void 0:d.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:l,options:d}=e,{data:c,error:u}=await O(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},create_user:(i=d==null?void 0:d.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},channel:(o=d==null?void 0:d.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u}}throw new wt("You must provide either an email or phone number.")}catch(l){if(P(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var t,s;try{let n,i;"options"in e&&(n=(t=e.options)===null||t===void 0?void 0:t.redirectTo,i=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:l}=await O(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:oe});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const d=o.session,c=o.user;return d!=null&&d.access_token&&(await this._saveSession(d),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d)),{data:{user:c,session:d},error:null}}catch(n){if(P(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(e){var t,s,n;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await De(this.storage,this.storageKey)),await O(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:(s=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&s!==void 0?s: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:i,code_challenge_method:o}),headers:this.headers,xform:xo})}catch(i){if(P(i))return{data:null,error:i};throw i}}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:t},error:s}=e;if(s)throw s;if(!t)throw new ge;const{error:n}=await O(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:n}})}catch(e){if(P(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:s,type:n,options:i}=e,{error:o}=await O(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:s,type:n,options:i}=e,{data:o,error:l}=await O(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new wt("You must provide either an email or phone number and a type")}catch(t){if(P(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async t=>t))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await s,await t()))();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 s=t();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await s}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 t=await this.__loadSession();return await e(t)}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 t=await Te(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at*1e3-Date.now()<er:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s){if(this.userStorage){const o=await Te(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=sr()}if(this.storage.isServer&&e.user){let o=this.suppressGetSessionWarning;e=new Proxy(e,{get:(d,c,u)=>(!o&&c==="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."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(d,c,u))})}return{data:{session:e},error:null}}const{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{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 O(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ye}):await this._useSession(async t=>{var s,n,i;const{data:o,error:l}=t;if(l)throw l;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ge}:await O(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:ye})})}catch(t){if(P(t))return Gi(t)&&(await this._removeSession(),await me(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:n,error:i}=s;if(i)throw i;if(!n.session)throw new ge;const o=n.session;let l=null,d=null;this.flowType==="pkce"&&e.email!=null&&([l,d]=await De(this.storage,this.storageKey));const{data:c,error:u}=await O(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:d}),jwt:o.access_token,xform:ye});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}}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 t=Date.now()/1e3;let s=t,n=!0,i=null;const{payload:o}=rr(e.access_token);if(o.exp&&(s=o.exp,n=s<=t),n){const{session:l,error:d}=await this._callRefreshToken(e.refresh_token);if(d)return{data:{user:null,session:null},error:d};if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:d}=await this._getUser(e.access_token);if(d)throw d;i={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(t){if(P(t))return{data:{session:null,user:null},error:t};throw t}}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 t=>{var s;if(!e){const{data:o,error:l}=t;if(l)throw l;e=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new ge;const{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(P(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e,t){try{if(!ee())throw new _t("No browser detected.");if(e.error||e.error_description||e.error_code)throw new _t(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if(this.flowType==="pkce")throw new cs("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new _t("Not a valid implicit grant flow url.");break;default:}if(t==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new cs("No code detected.");const{data:j,error:w}=await this._exchangeCodeForSession(e.code);if(w)throw w;const k=new URL(window.location.href);return k.searchParams.delete("code"),window.history.replaceState(window.history.state,"",k.toString()),{data:{session:j.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:n,access_token:i,refresh_token:o,expires_in:l,expires_at:d,token_type:c}=e;if(!i||!l||!o||!c)throw new _t("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(l);let f=u+h;d&&(f=parseInt(d));const m=f-u;m*1e3<=Fe&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${h}s`);const b=f-h;u-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,f,u):u-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,f,u);const{data:v,error:x}=await this._getUser(i);if(x)throw x;const p={provider_token:s,provider_refresh_token:n,access_token:i,expires_in:h,expires_at:f,refresh_token:o,token_type:c,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:p,redirectType:e.type},error:null}}catch(s){if(P(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Te(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}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 t=>{var s;const{data:n,error:i}=t;if(i)return{error:i};const o=(s=n.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!(qi(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await me(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const t=eo(),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,n;try{const{data:{session:i},error:o}=t;if(o)throw o;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){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",i),console.error(i)}})}async resetPasswordForEmail(e,t={}){let s=null,n=null;this.flowType==="pkce"&&([s,n]=await De(this.storage,this.storageKey,!0));try{return await O(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(i){if(P(i))return{data:null,error:i};throw i}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(P(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{const{data:s,error:n}=await this._useSession(async i=>{var o,l,d,c,u;const{data:h,error:f}=i;if(f)throw f;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(d=e.options)===null||d===void 0?void 0:d.queryParams,skipBrowserRedirect:!0});return await O(this.fetch,"GET",m,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return ee()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:e.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(P(s))return{data:{provider:e.provider,url:null},error:s};throw s}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,n;const{data:i,error:o}=t;if(o)throw o;return await O(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&n!==void 0?n:void 0})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const s=Date.now();return await no(async n=>(n>0&&await so(200*Math.pow(2,n-1)),this._debug(t,"refreshing attempt",n),await O(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:oe})),(n,i)=>{const o=200*Math.pow(2,n);return i&&tr(i)&&Date.now()+o-s<Fe})}catch(s){if(this._debug(t,"error",s),P(s))return{data:{session:null,user:null},error:s};throw s}finally{this._debug(t,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const s=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",s),ee()&&!t.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e,t;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const n=await Te(this.storage,this.storageKey);if(n&&this.userStorage){let o=await Te(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await He(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:sr()}else if(n&&!n.user&&!n.user){const o=await Te(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await me(this.storage,this.storageKey+"-user"),await He(this.storage,this.storageKey,n)):n.user=sr()}if(this._debug(s,"session from storage",n),!this._isValidSession(n)){this._debug(s,"session is not valid"),n!==null&&await this._removeSession();return}const i=((t=n.expires_at)!==null&&t!==void 0?t:1/0)*1e3-Date.now()<er;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${er}s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=await this._callRefreshToken(n.refresh_token);o&&(console.error(o),tr(o)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(n.access_token);!l&&(o!=null&&o.user)?(n.user=o.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(s,"error",n),console.error(n);return}finally{this._debug(s,"end")}}async _callRefreshToken(e){var t,s;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 qt;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new ge;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={session:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(n,"error",i),P(i)){const o={session:null,error:i};return tr(i)||await this._removeSession(),(t=this.refreshingDeferred)===null||t===void 0||t.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,t,s=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(e,t)}catch(d){i.push(d)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const t=Object.assign({},e),s=t.user&&t.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&t.user&&await He(this.userStorage,this.storageKey+"-user",{user:t.user});const n=Object.assign({},t);delete n.user;const i=ms(n);await He(this.storage,this.storageKey,i)}else{const n=ms(t);await He(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),await me(this.storage,this.storageKey),await me(this.storage,this.storageKey+"-code-verifier"),await me(this.storage,this.storageKey+"-user"),this.userStorage&&await me(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ee()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Fe);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 t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((s.expires_at*1e3-e)/Fe);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${Fe}ms, refresh threshold is ${vr} ticks`),n<=vr&&await this._callRefreshToken(s.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof ln)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ee()||!(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 t=`#_onVisibilityChanged(${e})`;this._debug(t,"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(t,"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,t,s){const n=[`provider=${encodeURIComponent(t)}`];if(s!=null&&s.redirectTo&&n.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&n.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,o]=await De(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});n.push(l.toString())}if(s!=null&&s.queryParams){const i=new URLSearchParams(s.queryParams);n.push(i.toString())}return s!=null&&s.skipBrowserRedirect&&n.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:n,error:i}=t;return i?{data:null,error:i}:await O(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var s,n;const{data:i,error:o}=t;if(o)return{data:null,error:o};const l=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:{issuer:e.issuer}),{data:d,error:c}=await O(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return c?{data:null,error:c}:(e.factorType==="totp"&&(!((n=d==null?void 0:d.totp)===null||n===void 0)&&n.qr_code)&&(d.totp.qr_code=`data:image/svg+xml;utf-8,${d.totp.qr_code}`),{data:d,error:null})})}catch(t){if(P(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:n,error:i}=t;if(i)return{data:null,error:i};const{data:o,error:l}=await O(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:l})})}catch(t){if(P(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:n,error:i}=t;return i?{data:null,error:i}:await O(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if(P(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=(e==null?void 0:e.factors)||[],n=s.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=s.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:s,totp:n,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,s;const{data:{session:n},error:i}=e;if(i)return{data:null,error:i};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=rr(n.access_token);let l=null;o.aal&&(l=o.aal);let d=l;((s=(t=n.user.factors)===null||t===void 0?void 0:t.filter(h=>h.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(d="aal2");const u=o.amr||[];return{data:{currentLevel:l,nextLevel:d,currentAuthenticationMethods:u},error:null}}))}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(l=>l.kid===e);if(s)return s;const n=Date.now();if(s=this.jwks.keys.find(l=>l.kid===e),s&&this.jwks_cached_at+Fi>n)return s;const{data:i,error:o}=await O(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=n,s=i.keys.find(l=>l.kid===e),!s)?null:s}async getClaims(e,t={}){try{let s=e;if(!s){const{data:m,error:b}=await this.getSession();if(b||!m.session)return{data:null,error:b};s=m.session.access_token}const{header:n,payload:i,signature:o,raw:{header:l,payload:d}}=rr(s);t!=null&&t.allowExpired||ho(i.exp);const c=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,t!=null&&t.keys?{keys:t.keys}:t==null?void 0:t.jwks);if(!c){const{error:m}=await this.getUser(s);if(m)throw m;return{data:{claims:i,header:n,signature:o},error:null}}const u=fo(n.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,Qi(`${l}.${d}`)))throw new jr("Invalid JWT signature");return{data:{claims:i,header:n,signature:o},error:null}}catch(s){if(P(s))return{data:null,error:s};throw s}}}ft.nextInstanceID=0;const Po=ft;class Ao extends Po{constructor(e){super(e)}}var Oo=function(r,e,t,s){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function l(u){try{c(s.next(u))}catch(h){o(h)}}function d(u){try{c(s.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(l,d)}c((s=s.apply(r,e||[])).next())})};class Io{constructor(e,t,s){var n,i,o;this.supabaseUrl=e,this.supabaseKey=t;const l=Li(e);if(!t)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 d=`sb-${l.hostname.split(".")[0]}-auth-token`,c={db:Si,realtime:Ni,auth:Object.assign(Object.assign({},Ei),{storageKey:d}),global:ki},u=$i(s??{},c);this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(h,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=u.auth)!==null&&o!==void 0?o:{},this.headers,u.global.fetch),this.fetch=Ii(t,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 za(new URL("rest/v1",l).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new _i(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new Ta(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,t={},s={}){return this.rest.rpc(e,t,s)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return Oo(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:s}=yield this.auth.getSession();return(t=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:i,storageKey:o,flowType:l,lock:d,debug:c},u,h){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ao({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),u),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:i,flowType:l,lock:d,debug:c,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new ci(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((t,s)=>{this._handleTokenChanged(t,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(e,t,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?this.changedAccessToken=s:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const Co=(r,e,t)=>new Io(r,e,t);function Ro(){if(typeof window<"u"||typeof process>"u")return!1;const r=process.version;if(r==null)return!1;const e=r.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Ro()&&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 $o="https://ftwlzdhkzqfuosdorgjt.supabase.co",Lo="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZ0d2x6ZGhrenFmdW9zZG9yZ2p0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzE1Mjc0MzksImV4cCI6MjA0NzEwMzQzOX0.msaWtaLGNMDiyuxIOFDwULWee0nqcM7p_LAYWB14j1k",D=Co($o,Lo,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),Do=y.createContext({user:null,isAdmin:!1,loading:!0,signIn:async()=>{},signOut:async()=>{}}),ar="ben@phippsmusic.com";function Uo({children:r}){const[e,t]=y.useState(null),[s,n]=y.useState(!1),[i,o]=y.useState(!0);y.useEffect(()=>{D.auth.getSession().then(({data:{session:u}})=>{u!=null&&u.user&&(t({id:u.user.id,email:u.user.email||""}),n(u.user.email===ar)),o(!1)});const{data:{subscription:c}}=D.auth.onAuthStateChange((u,h)=>{h!=null&&h.user?(t({id:h.user.id,email:h.user.email||""}),n(h.user.email===ar)):(t(null),n(!1)),o(!1)});return()=>{c.unsubscribe()}},[]);const l=async(c,u)=>{o(!0);try{const{data:h,error:f}=await D.auth.signInWithPassword({email:c,password:u});if(f)throw f;if(h.user.email!==ar)throw await D.auth.signOut(),new Error("Unauthorized access");t({id:h.user.id,email:h.user.email}),n(!0)}catch(h){throw console.error("Sign in failed:",h),h}finally{o(!1)}},d=async()=>{try{await D.auth.signOut(),t(null),n(!1)}catch(c){throw console.error("Sign out failed:",c),c}};return a.jsx(Do.Provider,{value:{user:e,isAdmin:s,loading:i,signIn:l,signOut:d},children:r})}/**
 * @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 Mo={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 Bo=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),R=(r,e)=>{const t=y.forwardRef(({color:s="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:l="",children:d,...c},u)=>y.createElement("svg",{ref:u,...Mo,width:n,height:n,stroke:s,strokeWidth:o?Number(i)*24/Number(n):i,className:["lucide",`lucide-${Bo(r)}`,l].join(" "),...c},[...e.map(([h,f])=>y.createElement(h,f)),...Array.isArray(d)?d:[d]]));return t.displayName=`${r}`,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.
 */const de=R("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 Fo=R("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 ue=R("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 mt=R("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 Fr=R("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 Ho=R("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=R("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=R("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 dn=R("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 qo=R("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 Go=R("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 un=R("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 Wo=R("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 zo=R("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 Oe=R("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 Ko=R("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 Vo=R("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 Jo=R("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=R("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 Gt=R("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 Yo=R("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 Qo=R("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 Pt=R("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 hn=R("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=R("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 Tr=R("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 Wt=R("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 zt=R("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 Qe=R("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 Zo=R("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);class mn extends y.Component{constructor(){super(...arguments);X(this,"state",{hasError:!1,error:null});X(this,"handleRetry",()=>{window.location.reload()})}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,s){console.error("Uncaught error:",t,s)}render(){var t,s;if(this.state.hasError){const i=((t=this.state.error)==null?void 0:t.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 a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 p-4",children:a.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-lg max-w-md w-full",children:[a.jsxs("div",{className:"flex items-center gap-3 text-red-600 mb-4",children:[a.jsx(Fo,{className:"w-6 h-6"}),a.jsx("h2",{className:"text-lg font-semibold",children:"Error"})]}),a.jsx("p",{className:"text-gray-600 mb-4",children:i}),((s=this.state.error)==null?void 0:s.message)&&a.jsx("pre",{className:"bg-gray-50 p-3 rounded text-sm text-gray-700 mb-4 overflow-auto",children:this.state.error.message}),a.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:[a.jsx(Qo,{className:"w-4 h-4"}),"Retry"]})]})})}return this.props.children}}function Re(){const[r,e]=y.useState([]),[t,s]=y.useState(!0),[n,i]=y.useState(null);return y.useEffect(()=>{async function o(){try{s(!0),i(null);const{data:l,error:d}=await D.from("genres").select("*").order("display_order");if(d)throw d;const{data:c,error:u}=await D.from("sub_genres").select("*").order("name");if(u)throw u;const h=l.map(f=>({...f,subGenres:c.filter(m=>m.genre_id===f.id).map(m=>({id:m.id,name:m.name,description:m.description}))}));e(h)}catch(l){console.error("Failed to fetch genres:",l),i(l instanceof Error?l:new Error("Failed to fetch genres"))}finally{s(!1)}}o()},[]),{genres:r,loading:t,error:n}}function ht(r){return r?r.toLowerCase().includes("r&b")?"rnb-soul":r.toString().toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,""):""}function qe(){const r=new Date;return`${r.getFullYear()}-${r.getMonth()+1}-${r.getDate()}`}function W(r){let e=0;for(let t=0;t<r.length;t++){const s=r.charCodeAt(t);e=(e<<5)-e+s,e=e&e}return e}function Xo({onClose:r}){const{genres:e,loading:t}=Re();if(t)return a.jsx("div",{className:"p-6",children:a.jsx("div",{className:"grid grid-cols-3 gap-4",children:[...Array(6)].map((n,i)=>a.jsx("div",{className:"h-12 bg-gray-100 rounded-lg animate-pulse"},`skeleton-${i}`))})});const s=e.reduce((n,i,o)=>{const l=Math.floor(o/Math.ceil(e.length/3));return n[l]||(n[l]=[]),n[l].push(i),n},[]);return a.jsxs("div",{className:"p-6",children:[a.jsxs(I,{to:"/genres",onClick:r,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:[a.jsx(zo,{className:"w-5 h-5"}),a.jsx("span",{className:"font-medium",children:"View All Genres & Sub-genres"})]}),a.jsx("div",{className:"grid grid-cols-3 gap-6",children:s.map((n,i)=>a.jsx("div",{className:"space-y-1",children:n.map(o=>a.jsxs(I,{to:`/genre/${ht(o.name)}`,onClick:r,className:"flex items-center gap-2 p-3 rounded-lg hover:bg-gray-50 text-gray-900 group",children:[a.jsx("div",{className:"p-1.5 bg-gray-50 rounded group-hover:bg-green-50 transition-colors",children:a.jsx(fe,{className:"w-4 h-4 text-gray-500 group-hover:text-green-600"})}),a.jsx("span",{className:"font-medium",children:o.name})]},o.id))},i))})]})}function J(){const r=Dt(),e=Ie(),[t,s]=y.useState(!1),[n,i]=y.useState(!1),o=y.useRef();y.useRef(null);const l=r.pathname.startsWith("/submit"),d=()=>{o.current&&clearTimeout(o.current),s(!0)},c=()=>{o.current=setTimeout(()=>{s(!1)},300)};y.useEffect(()=>{i(!1)},[r.pathname]),y.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const u=()=>{e("/playlists",{state:{focusSearch:!0}})};return a.jsx("header",{className:"bg-gradient-to-r from-green-500 to-green-600 text-white relative z-50",children:a.jsxs("div",{className:"container mx-auto px-4",children:[a.jsxs("div",{className:"flex justify-between items-center h-16",children:[a.jsxs(I,{to:"/",className:"flex items-center gap-2 sm:gap-3 hover:opacity-90 transition-opacity",children:[a.jsx(Gt,{className:"w-6 h-6 sm:w-8 sm:h-8 flex-shrink-0"}),a.jsx("h1",{className:"text-lg sm:text-2xl font-bold whitespace-nowrap",children:"Playlist Partner"})]}),a.jsxs("div",{className:"md:hidden flex items-center gap-2",children:[a.jsx("button",{onClick:u,className:"p-2 hover:bg-white/10 rounded-lg","aria-label":"Search",children:a.jsx(Pt,{className:"w-6 h-6"})}),!l&&a.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"}),a.jsx("button",{onClick:()=>i(!n),className:"p-2 hover:bg-white/10 rounded-lg","aria-label":"Toggle menu",children:n?a.jsx(Qe,{className:"w-6 h-6"}):a.jsx(Vo,{className:"w-6 h-6"})})]}),a.jsxs("div",{className:"hidden md:flex items-center gap-6",children:[a.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:[a.jsx(Pt,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm",children:"Search playlists..."})]}),a.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"}),a.jsxs("div",{onMouseEnter:d,onMouseLeave:c,className:"relative",children:[a.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"}),t&&a.jsxs("div",{className:"absolute top-full right-0 w-[800px] bg-white shadow-xl rounded-lg mt-1",children:[a.jsx("div",{className:"absolute h-3 -top-3 inset-x-0"}),a.jsx(Xo,{onClose:()=>s(!1)})]})]}),a.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"}),a.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"}),a.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&&a.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&&a.jsx("div",{className:"md:hidden border-t border-white/10",children:a.jsxs("nav",{className:"py-4 space-y-2",children:[a.jsx(I,{to:"/playlists",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>i(!1),children:"Browse Playlists"}),a.jsx(I,{to:"/genres",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>i(!1),children:"Browse Genres"}),a.jsx(I,{to:"/for-curators",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>i(!1),children:"For Curators"}),a.jsx(I,{to:"/about",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>i(!1),children:"About"}),a.jsx(I,{to:"/blog",className:"block px-4 py-2 hover:bg-white/10 rounded-lg",onClick:()=>i(!1),children:"Blog"})]})})]})})}function Y(){const{genres:r}=Re();return a.jsx("footer",{className:"bg-gray-900 text-gray-300 mt-auto",children:a.jsxs("div",{className:"container mx-auto px-4 py-12",children:[a.jsxs("div",{className:"mb-12",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsx(Gt,{className:"w-8 h-8"}),a.jsx("h2",{className:"text-2xl font-bold",children:"Playlist Partner"})]}),a.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."})]}),a.jsxs("div",{className:"border-t border-gray-800 pt-8",children:[a.jsx("h3",{className:"text-lg font-semibold mb-6",children:"Browse Genres"}),a.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:r.map(e=>a.jsx(I,{to:`/genre/${e.slug}`,className:"text-gray-400 hover:text-green-500 transition-colors",children:e.name},e.id))})]}),a.jsx("div",{className:"border-t border-gray-800 mt-12 pt-8 text-center text-sm text-gray-500",children:a.jsxs("p",{children:["© ",new Date().getFullYear()," PlaylistPartner. All rights reserved."]})})]})})}function ie({title:r,description:e,image:t="https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png",url:s,type:n="website",noIndex:i=!1,playlist:o,article:l,structuredData:d}){var b;const c=o?`Submit Music to ${o.name} - Free Spotify Playlist Submission`:r||"Free Spotify Playlist Submission – No Signup | PlaylistPartner",u=o?`Get your music featured on ${o.name}, a Spotify playlist curated by ${o.curator_name} with ${o.followers.toLocaleString()} followers. No account needed! Access ${((b=o.genre_count)==null?void 0:b.toLocaleString())||"thousands of"} ${o.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,f=s||window.location.href.split("?")[0],m=window.location.origin;return a.jsxs(ba,{children:[a.jsx("title",{children:c}),a.jsx("meta",{name:"description",content:h,"data-react-helmet":"true"}),a.jsx("link",{rel:"canonical",href:f}),a.jsx("meta",{name:"robots",content:i?"noindex, nofollow":"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"}),a.jsx("meta",{property:"og:site_name",content:"PlaylistPartner"}),a.jsx("meta",{property:"og:title",content:c,"data-react-helmet":"true"}),a.jsx("meta",{property:"og:description",content:h,"data-react-helmet":"true"}),a.jsx("meta",{property:"og:type",content:n}),a.jsx("meta",{property:"og:url",content:f}),a.jsx("meta",{property:"og:image",content:t,"data-react-helmet":"true"}),a.jsx("meta",{property:"og:image:width",content:"1200"}),a.jsx("meta",{property:"og:image:height",content:"630"}),a.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),a.jsx("meta",{name:"twitter:title",content:c,"data-react-helmet":"true"}),a.jsx("meta",{name:"twitter:description",content:h,"data-react-helmet":"true"}),a.jsx("meta",{name:"twitter:image",content:t,"data-react-helmet":"true"}),a.jsx("meta",{name:"twitter:site",content:"@playlistpartner"}),l&&a.jsxs(a.Fragment,{children:[a.jsx("meta",{property:"article:published_time",content:l.publishedTime}),l.modifiedTime&&a.jsx("meta",{property:"article:modified_time",content:l.modifiedTime}),l.author&&a.jsx("meta",{property:"article:author",content:l.author}),l.section&&a.jsx("meta",{property:"article:section",content:l.section})]}),a.jsx("script",{type:"application/ld+json",children:JSON.stringify(d||{"@context":"https://schema.org","@type":"WebSite",name:"PlaylistPartner",url:m,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:f}})})]})}const At="last_submission_data",el=30*24*60*60*1e3;function pn(r){try{const e={artistName:r.artistName,email:r.email,lastTrack:r.track,lastUpdated:Date.now()};localStorage.setItem(At,JSON.stringify(e))}catch(e){console.error("Failed to save submission data:",e)}}function Ve(){try{const r=localStorage.getItem(At);if(!r)return null;const e=JSON.parse(r);return Date.now()-e.lastUpdated>el?(localStorage.removeItem(At),null):{artistName:e.artistName,email:e.email,lastTrack:e.lastTrack}}catch(r){return console.error("Failed to retrieve submission data:",r),null}}function gn(){try{localStorage.removeItem(At),localStorage.removeItem("trackSubmissions"),localStorage.removeItem("playlist_submissions"),localStorage.removeItem("spotify_token"),sessionStorage.clear()}catch(r){console.error("Failed to reset storage data:",r)}}const Hr=[{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 tl(){const e=Hr.filter(n=>n.category==="News").slice(0,2);function t(n){return new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function s(n){return n.startsWith("//")?`https:${n}`:n}return e.length===0?null:a.jsx("div",{className:"my-16",children:a.jsxs("div",{className:"max-w-[1400px] mx-auto",children:[a.jsx("h2",{className:"text-2xl font-semibold text-gray-900 mb-8",children:"Latest News from Playlist Partner"}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.map(n=>{var i;return a.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:[((i=n.featuredImage)==null?void 0:i.url)&&a.jsx("div",{className:"aspect-[3/2] overflow-hidden",children:a.jsx("img",{src:s(n.featuredImage.url),alt:n.featuredImage.title||n.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),a.jsxs("div",{className:"p-6",children:[a.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&&a.jsx("p",{className:"text-gray-600 text-sm mb-4 line-clamp-2",children:n.excerpt}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:[a.jsx(Fr,{className:"w-3 h-3"}),a.jsx("span",{children:t(n.publishDate||n.createdAt)})]}),a.jsxs("span",{className:"text-green-600 text-sm flex items-center gap-1 group-hover:gap-2 transition-all",children:["Read",a.jsx(mt,{className:"w-4 h-4"})]})]})]})]},n.id)}),a.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:a.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center p-6",children:[a.jsx("div",{className:"mb-4",children:a.jsx("div",{className:"w-16 h-16 bg-green-600 rounded-full flex items-center justify-center group-hover:scale-110 transition-transform",children:a.jsx(mt,{className:"w-8 h-8 text-white"})})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"View All Posts"}),a.jsx("p",{className:"text-gray-600 text-sm",children:"Explore all blog posts and updates"})]})})]})]})})}const rl=y.lazy(()=>he(()=>import("./FeaturedPlaylists-Cx2vX-c6.js"),__vite__mapDeps([0,1,2])).then(r=>({default:r.FeaturedPlaylists}))),sl=y.lazy(()=>he(()=>Promise.resolve().then(()=>_l),void 0).then(r=>({default:r.SubmissionModal}))),nl=()=>a.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:a.jsx("div",{className:"container mx-auto px-4 py-12",children:a.jsxs("div",{className:"max-w-[1400px] mx-auto",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Free Spotify Playlist Submissions - No Signup"}),a.jsx("h2",{className:"text-xl text-gray-600",children:"Connect Instantly with Thousands of Independent Playlist Curators"})]}),a.jsxs("div",{className:"grid md:grid-cols-3 gap-8 text-left",children:[a.jsxs("div",{className:"bg-white border border-gray-200 p-8 hover:border-green-500 transition-colors rounded-md",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Direct Connections"}),a.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."})]}),a.jsxs("div",{className:"bg-white border border-gray-200 p-8 hover:border-green-500 transition-colors rounded-md",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Zero Barriers"}),a.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."})]}),a.jsxs("div",{className:"bg-white border border-gray-200 p-8 hover:border-green-500 transition-colors rounded-md",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-3",children:"Community-Driven"}),a.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."})]})]})]})})}),al=()=>{var e,t;const r=Ve();return a.jsx("div",{className:"my-8 pt-8 border-t border-gray-200",children:a.jsxs("div",{className:"max-w-[1400px] mx-auto",children:[a.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"})]}),(r==null?void 0:r.lastTrack)&&a.jsxs("div",{className:"mb-6 flex items-center justify-between bg-white p-4 shadow-sm rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("img",{src:(e=r.lastTrack.album.images[2])==null?void 0:e.url,alt:r.lastTrack.name,className:"w-12 h-12 object-cover rounded-md",loading:"lazy"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:r.lastTrack.name}),a.jsx("p",{className:"text-sm text-gray-600",children:(t=r.lastTrack.artists[0])==null?void 0:t.name})]})]}),a.jsx("button",{onClick:()=>{gn(),window.location.reload()},className:"p-2 hover:bg-gray-100 rounded-full transition-colors",title:"Clear selected track",children:a.jsx(Qe,{className:"w-5 h-5 text-gray-500"})})]}),a.jsx("div",{className:"border-l-4 border-green-500 pl-6",children:a.jsx(y.Suspense,{fallback:a.jsx("div",{className:"h-32 flex items-center justify-center",children:a.jsx(Oe,{className:"w-8 h-8 animate-spin"})}),children:a.jsx(rl,{})})})]})})},il=()=>a.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:a.jsxs("div",{className:"text-center max-w-[1400px] mx-auto px-4",children:[a.jsx("p",{className:"text-gray-800 text-xl font-medium mb-6",children:"Find the Perfect Playlist for Your Music"}),a.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 ol(){const[r,e]=y.useState(null);return a.jsxs(a.Fragment,{children:[a.jsx(ie,{}),a.jsxs("main",{children:[a.jsx(nl,{}),a.jsxs("div",{className:"container mx-auto px-4 pb-12",children:[a.jsx(y.Suspense,{fallback:null,children:a.jsx(al,{})}),a.jsx(il,{}),a.jsx(tl,{}),a.jsxs(y.Suspense,{fallback:null,children:[a.jsx(ll,{}),a.jsx(cl,{})]})]}),r&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(sl,{playlist:r,onClose:()=>e(null),onSubmit:()=>e(null)})})]})]})}const ll=y.lazy(()=>he(()=>import("./FAQSection-DcHK2fun.js"),__vite__mapDeps([3,1,2]))),cl=y.lazy(()=>he(()=>import("./AdditionalInfoSection-dqJvne_B.js"),__vite__mapDeps([4,1,2])));function dl(r){const[e,t]=y.useState(null),[s,n]=y.useState(!0),[i,o]=y.useState(null),[l,d]=y.useState([]);return y.useEffect(()=>{let c=!0;async function u(){if(!r){o(new Error("Invalid playlist URL")),n(!1);return}try{n(!0),o(null);const{data:h,error:f}=await D.from("playlist_details").select("*").eq("slug",r).limit(1);if(f)throw f;if(!h||h.length===0)throw new Error("Playlist not found");const m=h[0];if(c){t(m);const{data:b,error:v}=await D.from("playlist_details").select("*").eq("genre",m.genre).neq("id",m.id).order("followers",{ascending:!1}).limit(4);!v&&b&&d(b)}}catch(h){console.error("Failed to fetch playlist:",h),c&&(o(h instanceof Error?h:new Error("Failed to fetch playlist")),t(null),d([]))}finally{c&&n(!1)}}return u(),()=>{c=!1}},[r]),{playlist:e,loading:s,error:i,relatedPlaylists:l,isNotFound:(i==null?void 0:i.message)==="Playlist not found"}}const kr="playlist_submissions";function ul(r,e){try{const t=JSON.parse(localStorage.getItem(kr)||"[]"),s=t.find(n=>n.playlistId===r);s?s.tracks.some(n=>n.spotifyUrl===e)||s.tracks.push({spotifyUrl:e,timestamp:Date.now()}):t.push({playlistId:r,tracks:[{spotifyUrl:e,timestamp:Date.now()}]}),localStorage.setItem(kr,JSON.stringify(t))}catch(t){console.error("Failed to track submission:",t)}}function yn(r,e){try{const s=JSON.parse(localStorage.getItem(kr)||"[]").find(n=>n.playlistId===r);return!!(s!=null&&s.tracks.some(n=>n.spotifyUrl===e))}catch(t){return console.error("Failed to check submission status:",t),!1}}const Sr="scrollPositions",hl=5*60*1e3,fl=10,ml=100;function xs(){try{return JSON.parse(sessionStorage.getItem(Sr)||"[]")}catch{return[]}}const bn={savePosition(r,e){try{const t=xs(),s=window.scrollY;if(s>0){t.push({pathname:r,position:s,timestamp:Date.now(),searchParams:e==null?void 0:e.toString()});const n=t.filter(i=>Date.now()-i.timestamp<hl);sessionStorage.setItem(Sr,JSON.stringify(n))}}catch(t){console.error("Failed to save scroll position:",t)}},restorePosition(r,e){try{const t=xs(),s=t.find(n=>n.pathname===r);if(s){const n=t.filter(l=>l!==s);sessionStorage.setItem(Sr,JSON.stringify(n)),s.searchParams&&e&&e(new URLSearchParams(s.searchParams));let i=0;const o=()=>{const l=document.documentElement.scrollHeight,d=s.position;if(l>=d||i>=fl){window.scrollTo({top:d,behavior:"instant"});return}i++,setTimeout(o,ml)};setTimeout(o,50)}}catch(t){console.error("Failed to restore scroll position:",t)}}};function xn(r){if(!r)return null;const e=new Date,t=new Date(r),s=new Date(e.getFullYear(),e.getMonth(),e.getDate()),n=new Date(s);n.setDate(n.getDate()-1);const i=new Date(s);i.setDate(i.getDate()-7);const o=new Date(t.getFullYear(),t.getMonth(),t.getDate());return o.getTime()===s.getTime()?"today":o.getTime()===n.getTime()?"yesterday":o>i?"this-week":null}function qr({playlist:r,onSubmit:e,isRelated:t,priority:s=!1,hideSubmit:n=!1,showFeaturedBadge:i=!1}){const o=Ie(),l=Dt(),[d]=As(),[c,u]=y.useState(!1),h=Ve(),f=(h==null?void 0:h.lastTrack)&&yn(r.id,h.lastTrack.external_urls.spotify),m=b=>{b.preventDefault(),t||bn.savePosition(l.pathname,d);const v=l.pathname.startsWith("/genre/");window.scrollTo({top:0,behavior:"instant"}),o(`/playlist/${r.slug}`,{state:{from:v?"genre":"home"}})};return a.jsxs("div",{className:"bg-white shadow-sm hover:shadow-md transition-shadow h-full flex flex-col",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("a",{href:`/playlist/${r.slug}`,onClick:m,className:"cursor-pointer no-js-fallback",children:[a.jsxs("div",{className:"relative pb-[100%] bg-gray-100",children:[c||!r.image_url?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200",children:a.jsxs("div",{className:"text-center",children:[a.jsx(un,{className:"w-12 h-12 text-gray-400 mx-auto mb-2"}),a.jsx("div",{className:"text-sm text-gray-500 font-medium px-4 truncate max-w-[200px]",children:r.name})]})}):a.jsx("img",{src:r.image_url,alt:r.name,className:"absolute inset-0 w-full h-full object-cover sm:rounded-[2px] lg:rounded-[4px]",loading:s?"eager":"lazy",onError:()=>u(!0)}),r.featured&&i&&a.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:[a.jsx(fn,{className:"w-3 h-3"}),"Featured"]})]}),a.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:r.name})]}),a.jsxs("div",{className:"p-4 pt-2",children:[a.jsx("p",{className:"text-sm text-gray-600 mb-2 line-clamp-2 flex-1",children:r.description}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[a.jsxs(I,{to:`/genre/${r.genre_slug}`,onClick:b=>b.stopPropagation(),className:"flex items-center text-gray-700 hover:text-green-600 transition-colors",children:[a.jsx(fe,{className:"w-4 h-4 mr-1 flex-shrink-0"}),a.jsx("span",{className:"truncate",children:r.genre})]}),a.jsxs("div",{className:"flex items-center text-gray-700",children:[a.jsx(zt,{className:"w-4 h-4 mr-1 flex-shrink-0"}),a.jsx("span",{children:r.followers.toLocaleString()})]})]}),r.curator_name&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx(Wt,{className:"w-4 h-4 flex-shrink-0"}),r.curator_profile_url?a.jsx("a",{href:r.curator_profile_url,target:"_blank",rel:"noopener noreferrer",onClick:b=>b.stopPropagation(),className:"truncate hover:text-green-600 transition-colors",children:r.curator_name}):a.jsx("span",{className:"truncate",children:r.curator_name})]})]})]})]}),!n&&a.jsxs("div",{className:"px-4 py-3 border-t border-gray-100 mt-auto flex items-center justify-between",children:[f?a.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:[a.jsx(cn,{className:"w-3.5 h-3.5"}),"Submitted"]}):a.jsxs("button",{onClick:b=>{b.stopPropagation(),e(r.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:[a.jsx(hn,{className:"w-3.5 h-3.5"}),"Submit"]}),(()=>{const b=xn(r.published_at);if(!b)return null;const x={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"}}[b];return a.jsxs("div",{className:`${x.bg} ${x.textColor} px-2 py-1 rounded-full text-xs font-medium flex items-center gap-1`,children:[a.jsx(dn,{className:"w-3 h-3"}),x.text]})})()]})]})}const Ot=10,ir=24*60*60*1e3;function St(r){return yl(r,"track")||r}function pl(r,e){try{if(!r||!e)return{allowed:!1,remainingSubmissions:0,timeUntilReset:null,totalSubmissions:0,alreadySubmittedToPlaylist:!1};const t=JSON.parse(localStorage.getItem("trackSubmissions")||"[]"),s=Date.now(),n=St(r),i=t.filter(d=>s-d.timestamp<ir);i.length<t.length&&localStorage.setItem("trackSubmissions",JSON.stringify(i));const o=i.find(d=>St(d.spotifyUrl)===n&&d.playlistId===e);if(o)return{allowed:!1,remainingSubmissions:0,timeUntilReset:Math.max(0,ir-(s-o.timestamp)),totalSubmissions:i.length,alreadySubmittedToPlaylist:!0};const l=i.filter(d=>St(d.spotifyUrl)===n);if(l.length>=Ot){const d=l.reduce((u,h)=>h.timestamp<u.timestamp?h:u);return{allowed:!1,remainingSubmissions:0,timeUntilReset:Math.max(0,ir-(s-d.timestamp)),totalSubmissions:l.length,alreadySubmittedToPlaylist:!1}}return{allowed:!0,remainingSubmissions:Ot-l.length,timeUntilReset:null,totalSubmissions:l.length,alreadySubmittedToPlaylist:!1}}catch(t){return console.error("Rate limit check failed:",t),{allowed:!1,remainingSubmissions:0,timeUntilReset:null,totalSubmissions:0,alreadySubmittedToPlaylist:!1}}}function gl(r,e){if(!(!r||!e))try{const t=JSON.parse(localStorage.getItem("trackSubmissions")||"[]");t.push({timestamp:Date.now(),spotifyUrl:St(r),playlistId:e}),localStorage.setItem("trackSubmissions",JSON.stringify(t))}catch(t){console.error("Failed to record submission:",t)}}function yl(r,e){if(!r)return null;try{const t=[new RegExp(`${e}/([a-zA-Z0-9]+)`),new RegExp(`${e}:([a-zA-Z0-9]+)`)];for(const s of t){const n=r.match(s);if(n&&n[1])return n[1]}return null}catch(t){return console.error("Failed to extract ID:",t),null}}const vn="https://bears.playlistpartner.com/api/spotify";function bl(r){try{if(r.startsWith("spotify:")){const t=r.split(":");return`https://open.spotify.com/${t[1]}/${t[2]}`}return`https://open.spotify.com${new URL(r).pathname}`}catch{return r}}function It(r,e){if(!r)return null;try{const t=bl(r),s=[new RegExp(`${e}/([a-zA-Z0-9]+)`),new RegExp(`${e}:([a-zA-Z0-9]+)`)];for(const n of s){const i=t.match(n);if(i&&i[1])return i[1]}return null}catch(t){return console.error("Failed to extract ID:",t),null}}async function xl(r){if(!r.trim())return[];try{const e=await fetch(`${vn}/search?q=${encodeURIComponent(r)}&limit=5`);if(!e.ok){if(e.status===429){const s=await e.json();throw new Error(s.message||"Rate limit exceeded. Please try again later.")}throw new Error(`Search failed: ${e.status} ${e.statusText}`)}const t=await e.json();if(!t.tracks)throw new Error("Invalid response format from API");return t.tracks}catch(e){throw console.error("Failed to search tracks:",e),e instanceof Error?e:new Error("Failed to search tracks")}}async function vs(r){if(!r)return null;try{const e=await fetch(`${vn}/track/${encodeURIComponent(r)}`);if(!e.ok){if(e.status===404)return null;if(e.status===429){const s=await e.json();throw new Error(s.message||"Rate limit exceeded. Please try again later.")}throw new Error(`Failed to fetch track: ${e.status} ${e.statusText}`)}const t=await e.json();if(!t.id||!t.name||!t.artists||!t.album)throw new Error("Invalid track data received from API");return t}catch(e){throw console.error("Failed to fetch track:",e),e instanceof Error?e:new Error("Failed to fetch track data")}}function vl(r,e){const[t,s]=y.useState(r);return y.useEffect(()=>{const n=setTimeout(()=>{s(r)},e);return()=>{clearTimeout(n)}},[r,e]),t}function wn({onTrackSelect:r,initialUrl:e,selectedTrack:t,onClearTrack:s}){var E;const[n,i]=y.useState(""),[o,l]=y.useState([]),[d,c]=y.useState(!1),[u,h]=y.useState(!1),[f,m]=y.useState(null),[b,v]=y.useState(-1),x=vl(n,300),p=y.useRef(null),j=y.useRef(null);y.useEffect(()=>{const T=_=>{p.current&&!p.current.contains(_.target)&&h(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),y.useEffect(()=>{async function T(){if(!x.trim()){l([]),m(null);return}if(x.trim().length<2){l([]),m(null),h(!1);return}c(!0),m(null);try{const _=await xl(x);_.length===0&&m("No tracks found"),l(_),h(!0),v(-1)}catch(_){console.error("Failed to fetch tracks:",_),m("Failed to search tracks. Please try again.")}finally{c(!1)}}T()},[x]),y.useEffect(()=>{if(b>=0&&j.current){const T=j.current.querySelectorAll("button");T[b]&&T[b].scrollIntoView({behavior:"smooth",block:"nearest"})}},[b]),y.useEffect(()=>{async function T(){if(e){const _=It(e,"track");if(_){c(!0),m(null);try{const L=await vs(_);L?r(L):m("Track not found")}catch(L){console.error("Failed to fetch initial track:",L),m("Failed to load track. Please try again.")}finally{c(!1)}}}}T()},[e,r]);const w=async T=>{r(T),h(!1),i(""),m(null)},k=async T=>{i(T),m(null);const _=It(T,"track");if(_){c(!0);try{const L=await vs(_);L?w(L):m("Invalid Spotify URL or track not found")}catch(L){console.error("Failed to fetch track:",L),m("Failed to load track. Please try again.")}finally{c(!1)}}},N=T=>{T.preventDefault(),T.stopPropagation(),s(),i(""),m(null),h(!1),setTimeout(()=>{var L;const _=(L=p.current)==null?void 0:L.querySelector("input");_&&_.focus()},0)},S=T=>{if(!u||o.length===0){T.key==="Enter"&&(T.preventDefault(),T.stopPropagation());return}switch(T.key){case"ArrowDown":T.preventDefault(),v(_=>_<o.length-1?_+1:_);break;case"ArrowUp":T.preventDefault(),v(_=>_>0?_-1:-1);break;case"Enter":T.preventDefault(),T.stopPropagation(),b>=0&&b<o.length&&w(o[b]);break;case"Escape":h(!1),v(-1);break}};return t?a.jsxs("div",{className:"mt-3 p-3 bg-gray-50 rounded-lg flex items-center gap-4 group relative",children:[a.jsx("img",{src:(E=t.album.images[t.album.images.length-1])==null?void 0:E.url,alt:t.album.name,className:"w-16 h-16 object-cover rounded-md"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"font-medium text-gray-900",children:t.name}),a.jsx("p",{className:"text-sm text-gray-600",children:t.artists.map(T=>T.name).join(", ")}),a.jsx("p",{className:"text-xs text-gray-500",children:t.album.name})]}),a.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:a.jsx(Qe,{className:"w-4 h-4 text-gray-600"})})]}):a.jsxs("div",{ref:p,className:"relative",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Pt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),a.jsx("input",{type:"text",placeholder:"Search for your track or paste Spotify URL...",value:n,onChange:T=>k(T.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"}),d&&a.jsx(Oe,{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5 animate-spin"})]}),f&&a.jsxs("div",{className:"mt-2 text-sm text-red-600 flex items-center gap-1",children:[a.jsx(de,{className:"w-4 h-4"}),f]}),u&&(o.length>0||d)&&a.jsxs("div",{ref:j,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:[o.map((T,_)=>{var L;return a.jsxs("button",{onClick:H=>{H.preventDefault(),w(T)},onMouseEnter:()=>v(_),className:`w-full p-3 flex items-center gap-3 border-b border-gray-100 last:border-0 transition-colors ${_===b?"bg-indigo-50":"hover:bg-gray-50"}`,children:[a.jsx("img",{src:(L=T.album.images[T.album.images.length-1])==null?void 0:L.url,alt:T.album.name,className:"w-10 h-10 object-cover rounded"}),a.jsxs("div",{className:"flex-1 text-left",children:[a.jsx("p",{className:"font-medium text-gray-900 line-clamp-1",children:T.name}),a.jsx("p",{className:"text-sm text-gray-500 line-clamp-1",children:T.artists.map(H=>H.name).join(", ")})]})]},T.id)}),d&&a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(Oe,{className:"w-6 h-6 animate-spin mx-auto"}),a.jsx("p",{className:"mt-2",children:"Searching tracks..."})]})]})]})}const wl={async submit(r){const{data:e,error:t}=await D.from("submissions").insert({playlist_id:r.playlistId,track_id:r.trackId,track_name:r.trackName,track_url:r.trackUrl,artist_name:r.artistName,email:r.email,message:r.message,status:"pending",created_at:new Date().toISOString(),updated_at:new Date().toISOString()}).select(`
        *,
        playlist:playlists (
          name
        )
      `).single();if(t)throw console.error("Failed to create submission:",t),t;return e},async getAll(){const{data:r,error:e}=await D.from("submission_details").select("*").order("created_at",{ascending:!1});if(e)throw console.error("Failed to fetch submissions:",e),e;return r.map(t=>({...t,playlist:{name:t.playlist_name}}))},async getHistory(r){const{data:e,error:t}=await D.from("submission_details").select("*").eq("email",r).order("created_at",{ascending:!1});if(t)throw console.error("Failed to fetch submission history:",t),t;return e.map(s=>({...s,playlist:{name:s.playlist_name}}))},async getForPlaylist(r){const{data:e,error:t}=await D.from("submission_details").select("*").eq("playlist_id",r).order("created_at",{ascending:!1});if(t)throw console.error("Failed to fetch playlist submissions:",t),t;return e.map(s=>({...s,playlist:{name:s.playlist_name}}))},async updateStatus(r,e){const{data:t,error:s}=await D.from("submissions").update({status:e,reviewed_at:e==="pending"?null:new Date().toISOString(),updated_at:new Date().toISOString()}).eq("id",r).select(`
        *,
        playlist:playlists (
          name
        )
      `).single();if(s)throw console.error("Failed to update submission status:",s),s;return t}};function Ze({playlist:r,onClose:e,onSubmit:t}){const[s,n]=y.useState(()=>{var j;const p=Ve();return{spotifyUrl:((j=p==null?void 0:p.lastTrack)==null?void 0:j.external_urls.spotify)||"",artistName:(p==null?void 0:p.artistName)||"",email:(p==null?void 0:p.email)||"",message:""}}),[i,o]=y.useState(()=>{const p=Ve();return(p==null?void 0:p.lastTrack)||null}),[l,d]=y.useState({}),[c,u]=y.useState({allowed:!0,remainingSubmissions:Ot,timeUntilReset:null,totalSubmissions:0,alreadySubmittedToPlaylist:!1}),[h,f]=y.useState("");y.useEffect(()=>{const p=w=>{const k=document.querySelector(".modal-content");k&&!k.contains(w.target)&&e()},j=w=>{w.key==="Escape"&&e()};return document.addEventListener("mousedown",p),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",j)}},[e]),y.useEffect(()=>{if(s.spotifyUrl){const p=pl(s.spotifyUrl,r.id);u(p)}},[s.spotifyUrl,r.id]),y.useEffect(()=>{let p;const j=()=>{if(c.timeUntilReset){const w=Math.floor(c.timeUntilReset/36e5),k=Math.floor(c.timeUntilReset%(1e3*60*60)/(1e3*60)),N=Math.floor(c.timeUntilReset%(1e3*60)/1e3);f(`${w}h ${k}m ${N}s`)}};return c.timeUntilReset&&(j(),p=setInterval(()=>{const w=c.timeUntilReset-1e3;w<=0?(clearInterval(p),u(k=>({...k,timeUntilReset:null,allowed:!0}))):(u(k=>({...k,timeUntilReset:w})),j())},1e3)),()=>{p&&clearInterval(p)}},[c.timeUntilReset]);const m=()=>{const p={};return i||(p.spotifyUrl="Please select a track"),s.artistName.trim()||(p.artistName="Artist name is required"),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.email)||(p.email="Please enter a valid email address"),d(p),Object.keys(p).length===0},b=async p=>{if(p.preventDefault(),!(!c.allowed||c.alreadySubmittedToPlaylist)&&m())try{const j=It(s.spotifyUrl,"track");if(!j||!i)throw new Error("Invalid track selection");await wl.submit({playlistId:r.id,trackId:j,trackName:i.name,trackUrl:s.spotifyUrl,artistName:s.artistName,email:s.email,message:s.message}),pn({artistName:s.artistName,email:s.email,track:i}),gl(s.spotifyUrl,r.id),ul(r.id,s.spotifyUrl),t(s)}catch(j){console.error("Failed to submit track:",j),d(w=>({...w,submit:"Failed to submit track. Please try again."}))}},v=p=>{o(p),n(j=>{var w;return{...j,spotifyUrl:p.external_urls.spotify,artistName:((w=p.artists[0])==null?void 0:w.name)||j.artistName}}),d(j=>({...j,spotifyUrl:void 0}))},x=()=>{o(null),n(p=>({...p,spotifyUrl:"",artistName:p.artistName})),d(p=>({...p,spotifyUrl:void 0}))};return a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",children:a.jsxs("div",{className:"modal-content bg-white rounded-xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[a.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-200",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{className:"flex gap-3 sm:gap-4",children:[r.image_url&&a.jsx("img",{src:r.image_url,alt:r.name,className:"w-12 h-12 sm:w-16 sm:h-16 rounded-lg object-cover shadow-sm",style:{marginTop:"0.43rem"}}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg sm:text-xl font-bold text-gray-900",children:"Submit Your Track"}),a.jsxs("p",{className:"text-sm sm:text-base text-gray-600",children:["Submitting to: ",a.jsx("span",{className:"font-medium",children:r.name})]})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-gray-500 transition-colors",children:a.jsx(Qe,{className:"w-6 h-6"})})]}),i&&a.jsx("div",{className:"mt-3 flex flex-col gap-2 text-sm",children:a.jsx("div",{className:`px-3 py-2 rounded-lg ${c.alreadySubmittedToPlaylist?"bg-yellow-100 text-yellow-800":c.allowed?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:c.alreadySubmittedToPlaylist?a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(de,{className:"w-4 h-4"}),"Already submitted to this playlist"]}):c.allowed?a.jsxs("span",{children:[c.remainingSubmissions,"/",Ot," Submissions Remaining Today"]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(de,{className:"w-4 h-4"}),"Each track can be submitted to up to 10 playlists per day."]}),h&&a.jsxs("div",{className:"text-sm mt-1",children:["(Resets in ",h,")"]})]})})})]}),a.jsxs("form",{onSubmit:b,className:"p-4 sm:p-6 space-y-3 sm:space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[a.jsx(Wo,{className:"w-4 h-4"}),"Search and Select Your Track"]}),a.jsx(wn,{onTrackSelect:v,selectedTrack:i,onClearTrack:x}),l.spotifyUrl&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:l.spotifyUrl})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[a.jsx(Wt,{className:"w-4 h-4"}),"Artist Name"]}),a.jsx("input",{type:"text",placeholder:"Your artist name",value:s.artistName,onChange:p=>n(j=>({...j,artistName:p.target.value})),className:"w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",disabled:!c.allowed||c.alreadySubmittedToPlaylist}),l.artistName&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:l.artistName})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[a.jsx(Ko,{className:"w-4 h-4"}),"Email"]}),a.jsx("input",{type:"email",placeholder:"your@email.com",value:s.email,onChange:p=>n(j=>({...j,email:p.target.value})),className:"w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",disabled:!c.allowed||c.alreadySubmittedToPlaylist}),l.email&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:l.email})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"flex gap-2 text-sm font-medium text-gray-700 mb-1",children:[a.jsx(Jo,{className:"w-4 h-4"}),"Message (Optional)"]}),a.jsx("textarea",{placeholder:"Tell the curator about your track...",value:s.message,onChange:p=>n(j=>({...j,message:p.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:!c.allowed||c.alreadySubmittedToPlaylist})]}),l.submit&&a.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-sm",children:[a.jsx(de,{className:"w-4 h-4"}),a.jsx("p",{children:l.submit})]}),a.jsxs("div",{className:"flex justify-end gap-3 pt-2 sm:pt-4",children:[a.jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:!c.allowed||c.alreadySubmittedToPlaylist,className:`px-4 py-2 rounded-lg flex items-center gap-2 transition-colors ${!c.allowed||c.alreadySubmittedToPlaylist?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-500 text-white hover:bg-green-600"}`,children:[a.jsx(fe,{className:"w-4 h-4"}),"Submit Track"]})]})]})]})})}const _l=Object.freeze(Object.defineProperty({__proto__:null,SubmissionModal:Ze},Symbol.toStringTag,{value:"Module"}));function jl({message:r,type:e,onClose:t}){const[s,n]=y.useState(!1);y.useEffect(()=>{const l=setTimeout(()=>{n(!0)},4700);return()=>clearTimeout(l)},[]),y.useEffect(()=>{if(s){const l=setTimeout(()=>{t()},300);return()=>clearTimeout(l)}},[s,t]);const i={success:"bg-green-500",error:"bg-red-500",info:"bg-blue-500"}[e],o={success:Ho,error:de,info:de}[e];return a.jsxs("div",{className:`
        fixed bottom-4 right-4 
        ${i} text-white px-4 py-3 rounded-lg shadow-lg 
        flex items-center gap-3 max-w-md
        transition-all duration-300
        ${s?"opacity-0 translate-y-2":"opacity-100 translate-y-0"}
      `,children:[a.jsx(o,{className:"w-5 h-5 flex-shrink-0"}),a.jsx("p",{className:"flex-1",children:r}),a.jsx("button",{onClick:()=>n(!0),className:"p-1 hover:bg-white/20 rounded-full transition-colors",children:a.jsx(Qe,{className:"w-4 h-4"})})]})}function yt(r){const[e]=y.useState(()=>{let t=document.getElementById("toast-container");return t||(t=document.createElement("div"),t.id="toast-container",document.body.appendChild(t)),t});return Ns.createPortal(a.jsx(jl,{...r}),e)}function Tl({playlist:r,baseUrl:e}){var s;const t={"@context":"https://schema.org","@type":"MusicPlaylist",name:r.name,description:`Get your music featured on ${r.name}, a Spotify playlist curated by ${r.curator_name} with ${r.followers.toLocaleString()} followers. No account needed! Access thousands of playlists and connect with curators on PlaylistPartner.com.`,numTracks:r.track_count,url:`${e}/playlist/${r.spotify_id}`,sameAs:[`https://open.spotify.com/playlist/${r.spotify_id}`],dateModified:r.updated_at,image:r.image_url,author:{"@type":"Person",name:r.curator_name,url:r.curator_profile_url},genre:[r.genre,...((s=r.sub_genres)==null?void 0:s.slice(0,2))||[]].filter(Boolean),interactionStatistic:{"@type":"InteractionCounter",interactionType:"https://schema.org/FollowAction",userInteractionCount:r.followers},isPartOf:{"@id":e}};return a.jsx("script",{type:"application/ld+json",children:JSON.stringify(t)})}function kl(){var N;const{slug:r}=Ut(),e=Ie(),t=Dt(),[s,n]=y.useState(!1),[i,o]=y.useState(null),[l,d]=y.useState(0),{playlist:c,loading:u,error:h,relatedPlaylists:f,isNotFound:m}=dl(r||""),[b,v]=y.useState(!1);y.useEffect(()=>{v(!1)},[r]),y.useEffect(()=>{!u&&c&&!h&&!m&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[u,c,h,m]),y.useEffect(()=>{async function S(){if(c!=null&&c.genre){const{count:E}=await D.from("playlist_details").select("*",{count:"exact",head:!0}).eq("genre",c.genre);d(E||0)}}c&&S()},[c]);const x=Ve(),p=c&&(x==null?void 0:x.lastTrack)&&yn(c.id,x.lastTrack.external_urls.spotify),j=()=>{var E;const S=(E=t.state)==null?void 0:E.from;e(S==="genre"?-1:"/playlists")},w=async S=>{try{n(!1),o({type:"success",message:`Track submitted to ${c==null?void 0:c.name}! Watch your inbox for feedback from the curator.`})}catch(E){console.error("Failed to submit track:",E),o({type:"error",message:"Failed to submit track. Please try again."})}};if(u)return a.jsx("div",{className:"container mx-auto px-4 py-8",children:a.jsxs("div",{className:"animate-pulse",children:[a.jsx("div",{className:"h-8 w-48 bg-gray-200 rounded mb-6"}),a.jsx("div",{className:"bg-white shadow-lg",children:a.jsxs("div",{className:"grid md:grid-cols-2",children:[a.jsx("div",{className:"aspect-square bg-gray-200"}),a.jsxs("div",{className:"p-6",children:[a.jsx("div",{className:"h-8 w-3/4 bg-gray-200 rounded mb-4"}),a.jsx("div",{className:"h-4 w-1/2 bg-gray-200 rounded mb-4"}),a.jsx("div",{className:"h-20 bg-gray-200 rounded mb-4"})]})]})})]})});if(m||!c)return a.jsx("div",{className:"container mx-auto px-4 py-8",children:a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 text-red-600 mb-4",children:[a.jsx(de,{className:"w-6 h-6"}),a.jsx("h2",{className:"text-2xl font-bold",children:"Playlist Not Found"})]}),a.jsx("p",{className:"text-gray-600 mb-6",children:"The playlist you're looking for doesn't exist or may have been removed."}),a.jsxs("button",{onClick:j,className:"text-green-600 hover:text-green-700 flex items-center gap-2 mx-auto",children:[a.jsx(ue,{className:"w-4 h-4"}),"Back to Playlists"]})]})});if(h)return a.jsx("div",{className:"container mx-auto px-4 py-8",children:a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"flex items-center justify-center gap-2 text-red-600 mb-4",children:[a.jsx(de,{className:"w-6 h-6"}),a.jsx("h2",{className:"text-2xl font-bold",children:"Error Loading Playlist"})]}),a.jsx("p",{className:"text-gray-600 mb-6",children:h.message||"Something went wrong. Please try again."}),a.jsxs("button",{onClick:j,className:"text-green-600 hover:text-green-700 flex items-center gap-2 mx-auto",children:[a.jsx(ue,{className:"w-4 h-4"}),"Back to Playlists"]})]})});const k=`Get your music featured on ${c.name}, a Spotify playlist curated by ${c.curator_name||"Independent Curator"}. No account needed! Access ${l} ${c.genre} playlists and connect with curators on PlaylistPartner.com.`;return a.jsxs(a.Fragment,{children:[a.jsx(ie,{title:c==null?void 0:c.name,description:k,image:c==null?void 0:c.image_url,playlist:c?{name:c.name,curator_name:c.curator_name,followers:c.followers,updated_at:c.updated_at,genre:c.genre,genre_count:l}:void 0}),c&&a.jsx(Tl,{playlist:c,baseUrl:window.location.origin}),a.jsxs("main",{className:"container mx-auto px-4 py-8",children:[a.jsxs("button",{onClick:j,className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[a.jsx(ue,{className:"w-4 h-4"}),"Back to Playlists"]}),a.jsx("div",{className:"bg-white shadow-lg",children:a.jsxs("div",{className:"grid md:grid-cols-2",children:[a.jsx("div",{className:"relative aspect-square bg-gray-100",children:!c.image_url||b?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200",children:a.jsxs("div",{className:"text-center",children:[a.jsx(un,{className:"w-16 h-16 text-gray-400 mx-auto mb-3"}),a.jsx("div",{className:"text-base text-gray-500 font-medium px-4 truncate max-w-[300px]",children:c.name})]})}):a.jsx("img",{src:c.image_url,alt:c.name,className:"w-full h-full object-cover",onError:()=>v(!0)})}),a.jsxs("div",{className:"p-6 flex flex-col justify-between",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[a.jsx("h1",{className:"text-3xl md:text-4xl font-bold",children:c.name}),a.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[c.featured&&a.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:[a.jsx(fn,{className:"w-4 h-4"}),"Featured"]}),(()=>{const S=xn(c.published_at);if(!S)return null;const T={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 a.jsxs("div",{className:`${T.bg} ${T.textColor} px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-1.5`,children:[a.jsx(dn,{className:"w-4 h-4"}),T.text]})})()]})]}),a.jsxs("div",{className:"flex items-center gap-2 text-gray-600 mb-4",children:[a.jsx(Wt,{className:"w-5 h-5"}),a.jsx("span",{className:"text-lg",children:"Curated by "}),c.curator_profile_url?a.jsx("a",{href:c.curator_profile_url,target:"_blank",rel:"noopener noreferrer",className:"text-lg hover:text-green-600 transition-colors",children:c.curator_name}):a.jsx("span",{className:"text-lg",children:c.curator_name||"Independent Curator"})]}),a.jsx("p",{className:"text-gray-600 text-lg mb-4",children:c.description}),a.jsxs("div",{className:"flex flex-wrap gap-6 mb-4",children:[a.jsxs(I,{to:`/genre/${c.genre_slug}`,className:"flex items-center text-gray-700 hover:text-green-600 transition-colors",children:[a.jsx(fe,{className:"w-5 h-5 mr-2"}),a.jsx("span",{className:"text-lg",children:c.genre})]}),a.jsxs("div",{className:"flex items-center text-gray-700",children:[a.jsx(zt,{className:"w-5 h-5 mr-2"}),a.jsxs("span",{className:"text-lg",children:[c.followers.toLocaleString()," followers"]})]})]}),((N=c.sub_genres)==null?void 0:N.length)>0&&a.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:c.sub_genres.map(S=>a.jsx(I,{to:`/genre/${c.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))})]}),p?a.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:[a.jsx(cn,{className:"w-5 h-5"}),"Track Submitted"]}):a.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:[a.jsx(hn,{className:"w-5 h-5"}),"Submit Your Track"]})]})]})}),f.length>0&&a.jsxs("div",{className:"mt-12",children:[a.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Related Playlists"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:f.map(S=>a.jsx(qr,{playlist:S,onSubmit:()=>n(!0),isRelated:!0,hideSubmit:!0},S.id))})]}),s&&c&&a.jsx(Ze,{playlist:c,onClose:()=>n(!1),onSubmit:w}),i&&a.jsx(yt,{message:i.message,type:i.type,onClose:()=>o(null)})]})]})}function Sl({filters:r,onFilterChange:e,hideGenreFilter:t,autoFocus:s}){const{genres:n,loading:i}=Re(),o=n.find(c=>c.name===r.genre),l=y.useRef(null),d=y.useRef(null);return y.useEffect(()=>{s&&l.current&&d.current&&(l.current.focus(),d.current.classList.add("search-focus-animation"),setTimeout(()=>{var c;(c=d.current)==null||c.classList.remove("search-focus-animation")},1800),window.history.replaceState({},""))},[s]),a.jsx("div",{className:"bg-white shadow-sm -mx-4 px-4",children:a.jsx("div",{className:"max-w-[1400px] mx-auto",children:a.jsxs("div",{className:`grid ${t?"grid-cols-2":"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"} gap-4 py-4`,children:[a.jsxs("div",{ref:d,className:"relative search-container",children:[a.jsx(Pt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5 z-10"}),a.jsx("input",{ref:l,type:"text",placeholder:"Search playlists...",value:r.search,onChange:c=>e({...r,search:c.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"})]}),!t&&a.jsxs("div",{className:"relative",children:[a.jsx(fe,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-5 h-5"}),a.jsxs("select",{value:r.genre,onChange:c=>e({...r,genre:c.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:i,children:[a.jsx("option",{value:"",children:"All Genres"}),n.map(c=>a.jsx("option",{value:c.name,children:c.name},c.id))]})]}),a.jsx("div",{className:"relative",children:a.jsxs("select",{value:r.subGenre||"",onChange:c=>e({...r,subGenre:c.target.value}),className:`w-full px-4 py-2 border border-gray-300 rounded-lg appearance-none transition-colors
                ${o?"focus:ring-2 focus:ring-green-500 focus:border-transparent":"bg-gray-50 text-gray-400 cursor-not-allowed"}`,disabled:!o,children:[a.jsx("option",{value:"",children:o?"All Sub-genres":"-- Select a genre first --"}),o==null?void 0:o.subGenres.map(c=>a.jsx("option",{value:c.name,children:c.name},c.id))]})}),a.jsx("div",{className:"relative",children:a.jsxs("select",{value:r.sortBy,onChange:c=>e({...r,sortBy:c.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:[a.jsx("option",{value:"default",children:"Default (Most Recent)"}),a.jsx("option",{value:"followers-high",children:"Most Followers"}),a.jsx("option",{value:"followers-low",children:"Least Followers"})]})})]})})})}const nt="playlist_state";function Kt(r){const[e,t]=y.useState(()=>{try{const v=sessionStorage.getItem(nt);if(v){const x=JSON.parse(v);if(JSON.stringify(x.filters)===JSON.stringify(r))return x.playlists}return[]}catch{return[]}}),[s,n]=y.useState(!0),[i,o]=y.useState(null),[l,d]=y.useState(!0),[c,u]=y.useState(()=>{try{const v=sessionStorage.getItem(nt);if(v){const x=JSON.parse(v);if(JSON.stringify(x.filters)===JSON.stringify(r))return x.currentPage}return 1}catch{return 1}}),[h,f]=y.useState(0),m=12;return y.useEffect(()=>{!s&&h>0&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[s,h]),y.useEffect(()=>{(()=>{const x=sessionStorage.getItem(nt);if(x){const p=JSON.parse(x);return JSON.stringify(p.filters)!==JSON.stringify(r)}return!0})()&&(t([]),u(1),d(!0),sessionStorage.removeItem(nt))},[r==null?void 0:r.genre,r==null?void 0:r.subGenre,r==null?void 0:r.search,r==null?void 0:r.sortBy]),y.useEffect(()=>{if(e.length>0){const v={playlists:e,currentPage:c,filters:r||{}};sessionStorage.setItem(nt,JSON.stringify(v))}},[e,c,r]),y.useEffect(()=>{async function v(){try{n(!0),o(null);let x=D.from("playlist_details").select("*",{count:"exact"});if(r!=null&&r.genre&&(x=x.eq("genre",r.genre)),r!=null&&r.subGenre&&(x=x.contains("sub_genres",[r.subGenre])),r!=null&&r.search){const p=`%${r.search}%`;x=x.or(`name.ilike.${p},description.ilike.${p}`)}switch(r==null?void 0:r.sortBy){case"followers-high":case"followers-low":if(!(r!=null&&r.genre)&&!(r!=null&&r.subGenre)){let p=D.from("playlist_details").select("*").eq("featured",!0).order("id",{ascending:!1});if(r!=null&&r.search){const _=`%${r.search}%`;p=p.or(`name.ilike.${_},description.ilike.${_}`)}const{data:j}=await p,w=j?[...j].sort((_,L)=>{const H=qe(),we=W(`${H}-featured-${_.id}`),_e=W(`${H}-featured-${L.id}`);return we-_e}).slice(0,4):[];let k,N;c===1?(k=Math.max(8,12-w.length),N=0):(k=12,N=12-w.length+(c-2)*12);let S=D.from("playlist_details").select("*",{count:"exact"}).order("followers",{ascending:r.sortBy==="followers-low"}).order("id",{ascending:!1});if(r!=null&&r.search){const _=`%${r.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:T}=await S.range(N,N+k-1);if(c===1){const _=[...w,...E||[]];t(_)}else t(_=>[..._,...E||[]]);f(T||0),d(N+k<(T||0)),n(!1);return}else{let p=D.from("playlist_details").select("*").eq("featured",!0).eq("genre",r.genre).order("id",{ascending:!1});if(r!=null&&r.subGenre&&(p=p.contains("sub_genres",[r.subGenre])),r!=null&&r.search){const _=`%${r.search}%`;p=p.or(`name.ilike.${_},description.ilike.${_}`)}const{data:j}=await p,w=j?[...j].sort((_,L)=>{const H=qe(),we=W(`${H}-featured-${_.id}`),_e=W(`${H}-featured-${L.id}`);return we-_e}).slice(0,4):[];let k,N;c===1?(k=Math.max(8,12-w.length),N=0):(k=12,N=12-w.length+(c-2)*12);let S=D.from("playlist_details").select("*",{count:"exact"}).eq("genre",r.genre).order("followers",{ascending:r.sortBy==="followers-low"}).order("id",{ascending:!1});if(r!=null&&r.subGenre&&(S=S.contains("sub_genres",[r.subGenre])),r!=null&&r.search){const _=`%${r.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:T}=await S.range(N,N+k-1);if(c===1){const _=[...w,...E||[]];t(_)}else t(_=>[..._,...E||[]]);f(T||0),d(N+k<(T||0)),n(!1);return}case"default":default:if(!(r!=null&&r.genre)&&!(r!=null&&r.subGenre)){let p=D.from("playlist_details").select("*").eq("featured",!0).order("id",{ascending:!1});if(r!=null&&r.search){const _=`%${r.search}%`;p=p.or(`name.ilike.${_},description.ilike.${_}`)}const{data:j}=await p,w=j?[...j].sort((_,L)=>{const H=qe(),we=W(`${H}-featured-${_.id}`),_e=W(`${H}-featured-${L.id}`);return we-_e}).slice(0,4):[];let k,N;c===1?(k=Math.max(8,12-w.length),N=0):(k=12,N=12-w.length+(c-2)*12);let S=D.from("playlist_details").select("*",{count:"exact"}).order("published_at",{ascending:!1,nullsFirst:!1}).order("id",{ascending:!1});if(r!=null&&r.search){const _=`%${r.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:T}=await S.range(N,N+k-1);if(c===1){const _=[...w,...E||[]];t(_)}else t(_=>[..._,...E||[]]);f(T||0),d(N+k<(T||0)),n(!1);return}else{let p=D.from("playlist_details").select("*").eq("featured",!0).eq("genre",r.genre).order("id",{ascending:!1});if(r!=null&&r.subGenre&&(p=p.contains("sub_genres",[r.subGenre])),r!=null&&r.search){const _=`%${r.search}%`;p=p.or(`name.ilike.${_},description.ilike.${_}`)}const{data:j}=await p,w=j?[...j].sort((_,L)=>{const H=qe(),we=W(`${H}-featured-${_.id}`),_e=W(`${H}-featured-${L.id}`);return we-_e}).slice(0,4):[];let k,N;c===1?(k=Math.max(8,12-w.length),N=0):(k=12,N=12-w.length+(c-2)*12);let S=D.from("playlist_details").select("*",{count:"exact"}).eq("genre",r.genre).order("published_at",{ascending:!1,nullsFirst:!1}).order("id",{ascending:!1});if(r!=null&&r.subGenre&&(S=S.contains("sub_genres",[r.subGenre])),r!=null&&r.search){const _=`%${r.search}%`;S=S.or(`name.ilike.${_},description.ilike.${_}`)}const{data:E,count:T}=await S.range(N,N+k-1);if(c===1){const _=[...w,...E||[]];t(_)}else t(_=>[..._,...E||[]]);f(T||0),d(N+k<(T||0)),n(!1);return}}}catch(x){console.error("Failed to fetch playlists:",x),o(x instanceof Error?x:new Error("Failed to fetch playlists"))}finally{n(!1)}}v()},[c,r==null?void 0:r.genre,r==null?void 0:r.subGenre,r==null?void 0:r.search,r==null?void 0:r.sortBy]),{playlists:e,loading:s,error:i,hasMore:l,loadMore:()=>{!s&&l&&u(v=>v+1)},currentPage:c,totalCount:h,itemsPerPage:m}}function El(){var k,N,S;const r=Dt(),[e,t]=As(),[s,n]=y.useState(()=>{var _;const E=(_=r.state)==null?void 0:_.filters,T=sessionStorage.getItem("playlist_filters");return T&&!(E!=null&&E.fromSubmission)?JSON.parse(T):E?(window.history.replaceState({},""),{search:"",genre:E.genre||"",subGenre:E.subGenre||"",sortBy:"default"}):{search:"",genre:"",subGenre:"",sortBy:"default"}});y.useEffect(()=>{window.scrollTo(0,0)},[]);const{playlists:i,loading:o,error:l,hasMore:d,loadMore:c,totalCount:u}=Kt({...s,genre:s.genre||void 0,subGenre:s.subGenre||void 0}),[h,f]=y.useState(null),[m,b]=y.useState(null),v=Ve(),[x,p]=y.useState(!0);y.useEffect(()=>{var E;if(!o&&i.length>0&&x){const T=(E=r.state)==null?void 0:E.filters;T!=null&&T.fromSubmission?window.scrollTo(0,0):bn.restorePosition(r.pathname,t),p(!1)}},[o,i.length,r.pathname,r.state,t,x]),y.useEffect(()=>{sessionStorage.setItem("playlist_filters",JSON.stringify(s))},[s]);const j=i.length>0?1:0,w=i.length;return a.jsxs(a.Fragment,{children:[a.jsx(ie,{}),a.jsxs("main",{children:[a.jsxs("div",{className:"container mx-auto px-4 pb-12",children:[a.jsx(Sl,{filters:s,onFilterChange:n,autoFocus:(k=r.state)==null?void 0:k.focusSearch}),(v==null?void 0:v.lastTrack)&&a.jsxs("div",{className:"mb-6 flex items-center justify-between bg-white p-4 shadow-sm rounded-lg max-w-[1400px] mx-auto",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("img",{src:(N=v.lastTrack.album.images[2])==null?void 0:N.url,alt:v.lastTrack.name,className:"w-12 h-12 object-cover rounded-md"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium",children:v.lastTrack.name}),a.jsx("p",{className:"text-sm text-gray-600",children:(S=v.lastTrack.artists[0])==null?void 0:S.name})]})]}),a.jsx("button",{onClick:()=>{gn(),window.location.reload()},className:"p-2 hover:bg-gray-100 rounded-full transition-colors",title:"Clear selected track",children:a.jsx(Qe,{className:"w-5 h-5 text-gray-500"})})]}),a.jsxs("div",{className:"max-w-[1400px] mx-auto",style:{minHeight:"800px"},children:[i.length>0&&a.jsxs("div",{className:"text-sm text-gray-600 mb-6 mt-6",children:["Showing ",j,"-",w," of ",u," playlists"]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map((E,T)=>a.jsx(qr,{playlist:E,onSubmit:_=>f(i.find(L=>L.id===_)||null),priority:T<4,showFeaturedBadge:T<4},`${E.id}-${T}`))}),o&&a.jsx("div",{className:"flex items-center justify-center py-12",children:a.jsx(Oe,{className:"w-8 h-8 text-green-500 animate-spin"})}),l&&a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-red-500",children:"Failed to load playlists. Please try again."})}),!o&&!l&&i.length===0&&a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-500 text-lg",children:"No playlists found matching your criteria."})}),d&&!o&&a.jsx("div",{className:"text-center mt-8",children:a.jsx("button",{onClick:c,className:"px-6 py-3 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors",children:"Load More Playlists"})})]})]}),h&&a.jsx(Ze,{playlist:h,onClose:()=>f(null),onSubmit:()=>{f(null),b({type:"success",message:`Track submitted to ${h.name}! Watch your inbox for feedback from the curator.`})}}),m&&a.jsx(yt,{message:m.message,type:m.type,onClose:()=>b(null)})]})]})}function Nl(){const r=Ie(),[e,t]=y.useState(null);y.useEffect(()=>{typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[]);const s=n=>{var i;pn({artistName:((i=n.artists[0])==null?void 0:i.name)||"",email:"",track:n}),r("/submit/genre",{state:{selectedTrack:n}})};return a.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-2xl",children:[a.jsxs("button",{onClick:()=>r("/playlists"),className:"flex items-center gap-2 text-gray-600 hover:text-gray-800 transition-colors mb-6",children:[a.jsx(ue,{className:"w-5 h-5"}),"Back to Playlists"]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Submit Your Track"}),a.jsx("p",{className:"text-gray-600",children:"Search for your track on Spotify to get started"})]}),a.jsx("div",{className:"bg-white p-6 rounded-xl shadow-lg",children:a.jsx(wn,{onTrackSelect:s,selectedTrack:e,onClearTrack:()=>t(null)})}),e&&a.jsxs("button",{onClick:()=>s(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",a.jsx(mt,{className:"w-5 h-5"})]})]})]})}function Pl(){const r=Ie(),{genres:e}=Re(),[t,s]=y.useState(""),[n,i]=y.useState(""),o=e.find(u=>u.id===t),l=(o==null?void 0:o.subGenres)||[],d=u=>{i(u)},c=u=>{if(!t||!o)return;const h=n?l.find(f=>f.id===n):null;window.scrollTo(0,0),r("/playlists",{state:{filters:{genre:o.name,subGenre:(h==null?void 0:h.name)||"",fromSubmission:!0}},replace:!0})};return a.jsx("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:a.jsxs("div",{className:"space-y-8",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Select Your Genre"}),a.jsx("p",{className:"text-gray-600",children:"Choose the main category that best fits your track"})]}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-medium mb-3",children:"Main Genre"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:e.map(u=>a.jsxs("button",{onClick:()=>{s(u.id),i("")},className:`p-4 text-center border-2 rounded-lg transition-colors ${t===u.id?"border-green-500 bg-green-50":"border-gray-200 hover:border-green-500 hover:bg-green-50"}`,children:[a.jsx(fe,{className:"w-6 h-6 mx-auto mb-2 text-gray-600"}),a.jsx("span",{className:"font-medium",children:u.name})]},u.id))})]}),t&&l.length>0&&a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-medium mb-3",children:"Sub-genre (Optional)"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:l.map(u=>a.jsx("button",{onClick:()=>d(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:a.jsx("span",{className:"font-medium",children:u.name})},u.id))})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("button",{onClick:()=>r("/submit"),className:"flex items-center gap-2 text-gray-600 hover:text-gray-800 transition-colors",children:[a.jsx(ue,{className:"w-5 h-5"}),"Back to Track Selection"]}),a.jsxs("button",{onClick:()=>c(),disabled:!t,className:`flex items-center gap-2 px-6 py-3 rounded-lg font-medium transition-colors ${t?"bg-green-500 text-white hover:bg-green-600":"bg-gray-200 text-gray-500 cursor-not-allowed"}`,children:["Continue to Playlists",a.jsx(mt,{className:"w-5 h-5"})]})]})]})})}function Al(r=4,e,t){const[s,n]=y.useState([]),[i,o]=y.useState(!0),[l,d]=y.useState(null);return y.useEffect(()=>{!i&&s.length>0&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[i,s.length]),y.useEffect(()=>{async function c(){try{o(!0),d(null);let u=D.from("playlist_details").select("*").eq("featured",!0);e&&(u=u.eq("genre",e)),t&&(u=u.contains("sub_genres",[t]));const{data:h,error:f}=await u;if(f)throw f;const m=h||[];if(m.length>=r){const S=qe(),E=[...m].sort((T,_)=>{const L=W(`${S}-${T.id}`),H=W(`${S}-${_.id}`);return L-H});n(E.slice(0,r));return}const b=r-m.length;let v=D.from("playlist_details").select("*").eq("featured",!1);e&&(v=v.eq("genre",e)),t&&(v=v.contains("sub_genres",[t]));const{data:x,error:p}=await v;if(p)throw p;const j=qe(),w=[...m].sort((S,E)=>{const T=W(`${j}-featured-${S.id}`),_=W(`${j}-featured-${E.id}`);return T-_}),k=[...x||[]].sort((S,E)=>{const T=W(`${j}-nonfeatured-${S.id}`),_=W(`${j}-nonfeatured-${E.id}`);return T-_}),N=[...w,...k.slice(0,b)];n(N)}catch(u){console.error("Failed to fetch playlists:",u),d(u instanceof Error?u:new Error("Failed to fetch playlists"))}finally{o(!1)}}c()},[r,e,t]),{playlists:s,loading:i,error:l}}function _n({genre:r,subGenre:e,totalCount:t,onViewAll:s}){const{playlists:n,loading:i}=Al(8,r,e),[o,l]=y.useState(null),[d,c]=y.useState(null);if(i||n.length===0)return null;const h=new Date().toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"}),f=e?`Today's Featured ${e} ${r} Playlists - ${h}`:`Today's Featured ${r} Playlists - ${h}`,m=new URLSearchParams;return m.set("genre",r),e&&m.set("subGenre",e),a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"border-l-4 border-green-500 pl-6 mb-8",children:[a.jsx("h2",{className:"text-2xl font-semibold text-gray-900 mb-6",children:f}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.map(b=>a.jsx(qr,{playlist:b,onSubmit:v=>l(n.find(x=>x.id===v)||null),priority:!0,showFeaturedBadge:!0},b.id))})]}),a.jsx("div",{className:"text-center mb-12",children:a.jsxs("button",{onClick:s,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 ",t.toLocaleString()," ",e?`${e} ${r}`:r," Playlists"]})}),o&&a.jsx(Ze,{playlist:o,onClose:()=>l(null),onSubmit:()=>{l(null),c({type:"success",message:`Track submitted to ${o.name}! Watch your inbox for feedback from the curator.`})}}),d&&a.jsx(yt,{message:d.message,type:d.type,onClose:()=>c(null)})]})}const Ol="https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png";function Il(){const{genre:r}=Ut(),e=r?decodeURIComponent(r):"",{genres:t,loading:s}=Re(),n=t.find(p=>p.slug===e),[i,o]=y.useState(null),[l,d]=y.useState(!1),[c,u]=y.useState(null),h=Ie(),{totalCount:f}=Kt({genre:n==null?void 0:n.name}),m=()=>{n&&(window.scrollTo(0,0),h("/playlists",{state:{filters:{genre:n.name,fromSubmission:!0}},replace:!0}))};if(s)return a.jsx("div",{className:"container mx-auto px-4 py-8",children:a.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:a.jsx(Oe,{className:"w-8 h-8 text-green-500 animate-spin"})})});if(!s&&!n)return a.jsxs("div",{className:"container mx-auto px-4 py-8",children:[a.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Genre Not Found"}),a.jsx(I,{to:"/",className:"text-green-600 hover:text-green-700",children:"Return to Home"})]});const b=`Free ${n.name} Spotify Playlist Submission - No Signup`,v=`Submit your ${n.name} tracks to ${f} Spotify playlists for free. Connect with independent curators and grow your audience — no signup needed.`,x=async p=>{try{d(!1),u({type:"success",message:`Track submitted to ${i==null?void 0:i.name}! Watch your inbox for feedback from the curator.`})}catch(j){console.error("Failed to submit track:",j),u({type:"error",message:"Failed to submit track. Please try again."})}};return a.jsxs(a.Fragment,{children:[a.jsx(ie,{title:b,description:v,image:Ol,url:`${window.location.origin}/genre/${n.slug}`,type:"website"}),a.jsxs("main",{className:"container mx-auto px-4 py-8",children:[a.jsxs(I,{to:"/",className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[a.jsx(ue,{className:"w-4 h-4"}),"Back to All Genres"]}),a.jsx("div",{className:"bg-white p-6 rounded-lg shadow-sm mb-8",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:a.jsx(fe,{className:"w-8 h-8 text-green-600"})}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold mb-2",children:[n.name," Spotify Playlist Submission"]}),a.jsx("p",{className:"text-gray-600 mb-4",children:n.description}),a.jsx("div",{className:"flex gap-4 text-sm text-gray-600",children:a.jsxs("span",{children:[f," Playlists"]})})]})]})}),a.jsx(_n,{genre:n.name,totalCount:f,onViewAll:m}),l&&i&&a.jsx(Ze,{playlist:i,onClose:()=>{d(!1),o(null)},onSubmit:x}),c&&a.jsx(yt,{message:c.message,type:c.type,onClose:()=>u(null)})]})]})}const Cl="https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png";function Rl(){const{genre:r,subGenre:e}=Ut(),t=r?decodeURIComponent(r):"",s=e?decodeURIComponent(e):"",{genres:n,loading:i}=Re(),o=n.find(k=>k.slug===t),l=o==null?void 0:o.subGenres.find(k=>ht(k.name)===s),[d,c]=y.useState(null),[u,h]=y.useState(!1),[f,m]=y.useState(null),b=Ie(),{totalCount:v}=Kt({genre:o==null?void 0:o.name,subGenre:l==null?void 0:l.name}),x=()=>{!o||!l||(window.scrollTo(0,0),b("/playlists",{state:{filters:{genre:o.name,subGenre:l.name,fromSubmission:!0}},replace:!0}))};if(i)return a.jsx("div",{className:"container mx-auto px-4 py-8",children:a.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:a.jsx(Oe,{className:"w-8 h-8 text-green-500 animate-spin"})})});if(!i&&(!o||!l))return a.jsxs("div",{className:"container mx-auto px-4 py-8",children:[a.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Sub-Genre Not Found"}),a.jsx(I,{to:"/",className:"text-green-600 hover:text-green-700",children:"Return to Home"})]});const p=`Free ${l.name} Spotify Playlist Submission - No Signup`,j=`Submit your ${l.name} tracks to ${v} Spotify playlists for free. Connect with independent curators and grow your audience — no signup needed.`,w=async k=>{try{h(!1),m({type:"success",message:`Track submitted to ${d==null?void 0:d.name}! Watch your inbox for feedback from the curator.`})}catch(N){console.error("Failed to submit track:",N),m({type:"error",message:"Failed to submit track. Please try again."})}};return a.jsxs(a.Fragment,{children:[a.jsx(ie,{title:p,description:j,image:Cl,url:`${window.location.origin}/genre/${o.slug}/${l.slug}`,type:"website"}),a.jsxs("main",{className:"container mx-auto px-4 py-8",children:[a.jsxs(I,{to:`/genre/${encodeURIComponent(o.slug)}`,className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[a.jsx(ue,{className:"w-4 h-4"}),"Back to ",o.name," Playlists"]}),a.jsx("div",{className:"bg-white p-6 rounded-lg shadow-sm mb-8",children:a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"p-3 bg-green-50 rounded-lg",children:a.jsx(fe,{className:"w-8 h-8 text-green-600"})}),a.jsxs("div",{children:[a.jsxs("h1",{className:"text-3xl font-bold mb-2",children:[l.name," Spotify Playlist Submission"]}),a.jsx("p",{className:"text-gray-600 mb-4",children:l.description||`Discover curated playlists specializing in ${l.name} ${o.name} music. Submit your tracks to playlist curators who understand and appreciate your specific style.`}),a.jsx("div",{className:"flex gap-4 text-sm text-gray-600",children:a.jsxs("span",{children:[v," Playlists"]})})]})]})}),a.jsx(_n,{genre:o.name,subGenre:l.name,totalCount:v,onViewAll:x}),u&&d&&a.jsx(Ze,{playlist:d,onClose:()=>{h(!1),c(null)},onSubmit:w}),f&&a.jsx(yt,{message:f.message,type:f.type,onClose:()=>m(null)})]})]})}function $l(){const{genres:r,loading:e}=Re();return y.useEffect(()=>{!e&&r.length>0&&typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[e,r]),a.jsxs(a.Fragment,{children:[a.jsx(ie,{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"}),a.jsxs("main",{className:"container mx-auto px-4 py-8 max-w-5xl",children:[a.jsxs(I,{to:"/",className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-6",children:[a.jsx(ue,{className:"w-4 h-4"}),"Back to Home"]}),a.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6 mb-8",children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Spotify Playlist Genres"}),a.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?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((t,s)=>a.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm animate-pulse",children:[a.jsx("div",{className:"h-6 w-1/3 bg-gray-200 rounded mb-4"}),a.jsx("div",{className:"space-y-2",children:[...Array(4)].map((n,i)=>a.jsx("div",{className:"h-4 bg-gray-100 rounded w-2/3"},i))})]},s))}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:r.map(t=>a.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm",children:[a.jsxs(I,{to:`/genre/${ht(t.name)}`,className:"group flex items-center gap-3 mb-4",children:[a.jsx("div",{className:"p-2 bg-gray-50 rounded-lg group-hover:bg-green-50 transition-colors",children:a.jsx(fe,{className:"w-5 h-5 text-gray-500 group-hover:text-green-600"})}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900 group-hover:text-green-600 transition-colors",children:t.name})]}),t.subGenres.length>0&&a.jsx("div",{className:"space-y-1",children:t.subGenres.map(s=>a.jsxs(I,{to:`/genre/${ht(t.name)}/${ht(s.name)}`,className:"block text-gray-600 hover:text-green-600 transition-colors pl-11",children:[s.name,s.description&&a.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:s.description})]},s.id))})]},t.id))})]})]})}function Ll(){const{totalCount:r}=Kt({});return a.jsxs(a.Fragment,{children:[a.jsx(ie,{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."}),a.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:a.jsxs("div",{className:"container mx-auto px-4 py-16 md:py-24",children:[a.jsxs("div",{className:"max-w-3xl mx-auto text-center mb-16",children:[a.jsx(Gt,{className:"w-12 h-12 text-green-600 mx-auto mb-6"}),a.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Music Promotion Made Simple"}),a.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."})]}),a.jsxs("div",{className:"max-w-5xl mx-auto grid md:grid-cols-3 gap-8 mb-24",children:[a.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm text-center",children:[a.jsx(Go,{className:"w-8 h-8 text-green-600 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Always Free"}),a.jsx("p",{className:"text-gray-600",children:"No hidden fees or premium features. Submit your music to 10 playlists daily – it's that simple."})]}),a.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm text-center",children:[a.jsx(Zo,{className:"w-8 h-8 text-green-600 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Sign Up"}),a.jsx("p",{className:"text-gray-600",children:"Start submitting your music immediately. No account creation required."})]}),a.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-sm text-center",children:[a.jsx(zt,{className:"w-8 h-8 text-green-600 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Direct Connection"}),a.jsx("p",{className:"text-gray-600",children:"Connect directly with curators in your genre and style. Filter playlists by genre, sub-genre, or search."})]})]}),a.jsxs("div",{className:"max-w-4xl mx-auto mb-24",children:[a.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"How It Works"}),a.jsxs("div",{className:"space-y-12",children:[a.jsxs("div",{className:"flex items-start gap-6",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-green-100 flex-shrink-0 flex items-center justify-center",children:a.jsx("span",{className:"text-green-600 font-bold",children:"1"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Find Your Playlists"}),a.jsx("p",{className:"text-gray-600",children:"Browse our curated collection of Spotify playlists by genre, sub genre or follower count."})]})]}),a.jsxs("div",{className:"flex items-start gap-6",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-green-100 flex-shrink-0 flex items-center justify-center",children:a.jsx("span",{className:"text-green-600 font-bold",children:"2"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Submit Your Track"}),a.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."})]})]}),a.jsxs("div",{className:"flex items-start gap-6",children:[a.jsx("div",{className:"w-10 h-10 rounded-full bg-green-100 flex-shrink-0 flex items-center justify-center",children:a.jsx("span",{className:"text-green-600 font-bold",children:"3"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Get Featured"}),a.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."})]})]})]})]}),a.jsx("div",{className:"max-w-4xl mx-auto border-t border-gray-200 pt-16",children:a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8",children:[a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-3xl font-bold text-green-600 mb-1",children:[r.toLocaleString(),"+"]}),a.jsx("div",{className:"text-sm text-gray-600",children:"Active Playlists"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-3xl font-bold text-green-600 mb-1",children:"15K+"}),a.jsx("div",{className:"text-sm text-gray-600",children:"Monthly Submissions"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-3xl font-bold text-green-600 mb-1",children:"2000+"}),a.jsx("div",{className:"text-sm text-gray-600",children:"Curators"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-3xl font-bold text-green-600 mb-1",children:"100%"}),a.jsx("div",{className:"text-sm text-gray-600",children:"Free"})]})]})}),a.jsxs("div",{className:"max-w-xl mx-auto text-center mt-24",children:[a.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Ready to Share Your Music?"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.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"}),a.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 Dl(){const[r,e]=y.useState({name:"",email:"",playlistUrl:""}),[t,s]=y.useState(!1),[n,i]=y.useState(null),[o,l]=y.useState(!1);y.useEffect(()=>{typeof window<"u"&&window.prerenderReady!==void 0&&(window.prerenderReady=!0)},[]);const d=u=>{const h=It(u,"playlist");if(!h)throw new Error("Please enter a valid Spotify playlist URL");return h},c=async u=>{u.preventDefault(),i(null),s(!0);try{if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r.email))throw new Error("Please enter a valid email address");const h=d(r.playlistUrl),{error:f}=await D.from("curator_applications").insert({name:r.name,email:r.email,playlist_url:r.playlistUrl,playlist_id:h});if(f)throw f;l(!0),e({name:"",email:"",playlistUrl:""})}catch(h){console.error("Application submission failed:",h),i(h instanceof Error?h.message:"Failed to submit application")}finally{s(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(ie,{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."}),a.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:a.jsx("div",{className:"container mx-auto px-4 py-16 md:py-24",children:a.jsxs("div",{className:"max-w-4xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx(Gt,{className:"w-12 h-12 text-green-600 mx-auto mb-6"}),a.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-12",children:"Join Our Curator Network"}),a.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[a.jsxs("div",{className:"bg-white p-8 rounded-xl shadow-sm",children:[a.jsx("div",{className:"p-3 bg-green-50 rounded-lg w-12 h-12 flex items-center justify-center mx-auto mb-4",children:a.jsx(qo,{className:"w-6 h-6 text-green-600"})}),a.jsx("h2",{className:"text-xl font-bold mb-4",children:"For Music Curators"}),a.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."})]}),a.jsxs("div",{className:"bg-white p-8 rounded-xl shadow-sm",children:[a.jsx("div",{className:"p-3 bg-green-50 rounded-lg w-12 h-12 flex items-center justify-center mx-auto mb-4",children:a.jsx(zt,{className:"w-6 h-6 text-green-600"})}),a.jsx("h2",{className:"text-xl font-bold mb-4",children:"For Artists"}),a.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."})]})]})]}),a.jsxs("div",{className:"bg-white p-8 rounded-xl shadow-sm mb-12",children:[a.jsx("h2",{className:"text-2xl font-bold mb-6",children:"What We Look For"}),a.jsx("p",{className:"text-gray-600 mb-4",children:"Our curator network maintains high standards to ensure quality. We look for:"}),a.jsxs("ul",{className:"space-y-3 text-gray-600",children:[a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Consistent playlist activity with regular updates"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Genuine follower engagement"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Clear genre focus and curation style"]}),a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(st,{className:"w-5 h-5 text-green-500 flex-shrink-0"}),"Professional playlist presentation"]})]})]}),a.jsx("div",{className:"bg-white p-8 rounded-xl shadow-sm",children:o?a.jsxs("div",{className:"text-center py-8",children:[a.jsx(st,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),a.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Application Received!"}),a.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."}),a.jsx("button",{onClick:()=>l(!1),className:"text-green-600 hover:text-green-700 font-medium",children:"Submit Another Application"})]}):a.jsxs(a.Fragment,{children:[a.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Apply to Join"}),a.jsxs("form",{onSubmit:c,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:"Your Name"}),a.jsx("input",{type:"text",id:"name",value:r.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:t})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-1",children:"Email Address"}),a.jsx("input",{type:"email",id:"email",value:r.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:t})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"playlistUrl",className:"block text-sm font-medium text-gray-700 mb-1",children:"Your Best Playlist"}),a.jsx("input",{type:"url",id:"playlistUrl",value:r.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:t}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Please provide the Spotify URL of your best performing playlist"})]}),n&&a.jsxs("div",{className:"flex items-center gap-2 text-red-600 bg-red-50 p-3 rounded-lg",children:[a.jsx(de,{className:"w-5 h-5 flex-shrink-0"}),a.jsx("p",{children:n})]}),a.jsx("button",{type:"submit",disabled:t,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:t?a.jsxs(a.Fragment,{children:[a.jsx(Oe,{className:"w-5 h-5 animate-spin"}),"Submitting..."]}):"Submit Application"})]})]})}),a.jsxs("div",{className:"mt-12 bg-white p-8 rounded-xl shadow-sm",children:[a.jsx("h2",{className:"text-2xl font-bold mb-6",children:"What Happens Next?"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:a.jsx("span",{className:"text-green-600 font-bold",children:"1"})}),a.jsx("div",{children:a.jsx("p",{className:"text-gray-600",children:"Submit your application with links to your playlists"})})]}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:a.jsx("span",{className:"text-green-600 font-bold",children:"2"})}),a.jsx("div",{children:a.jsx("p",{className:"text-gray-600",children:"Our team reviews your submission against our quality criteria"})})]}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:a.jsx("span",{className:"text-green-600 font-bold",children:"3"})}),a.jsx("div",{children:a.jsx("p",{className:"text-gray-600",children:"If approved, you'll receive instructions for adding your playlists"})})]}),a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsx("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0",children:a.jsx("span",{className:"text-green-600 font-bold",children:"4"})}),a.jsx("div",{children:a.jsx("p",{className:"text-gray-600",children:"Start connecting with artists and growing your network"})})]})]})]})]})})})]})}function Ul(){const[r,e]=y.useState(1),t=9,s=Hr,n=s.length,i=Math.ceil(n/t),o=(r-1)*t,l=o+t,d=s.slice(o,l);function c(h){return new Date(h).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function u(h){return h.startsWith("//")?`https:${h}`:h}return a.jsxs(a.Fragment,{children:[a.jsx(ie,{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"}}}}),a.jsx("div",{className:"bg-gradient-to-b from-green-50 to-white",children:a.jsxs("section",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 md:py-20",children:[a.jsxs("div",{className:"text-center mb-12",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 mb-4",children:"Playlist Partner Blog"}),a.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."})]}),d.length===0&&a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-gray-600",children:"No blog posts available yet. Check back soon!"})}),d.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mb-12",children:d.map(h=>{var f,m,b;return a.jsxs("article",{className:"bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow",children:[((f=h.featuredImage)==null?void 0:f.url)&&a.jsx(I,{to:`/blog/${((m=h.category)==null?void 0:m.toLowerCase())||"news"}/${h.slug}`,children:a.jsx("img",{src:u(h.featuredImage.url),alt:h.featuredImage.title||h.title,className:"w-full aspect-[3/2] object-cover"})}),a.jsxs("div",{className:"p-6",children:[a.jsx(I,{to:`/blog/${((b=h.category)==null?void 0:b.toLowerCase())||"news"}/${h.slug}`,children:a.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2 hover:text-green-600 transition-colors",children:h.title})}),h.excerpt&&a.jsx("p",{className:"text-gray-600 mb-4 line-clamp-3",children:h.excerpt}),a.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-gray-500",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Fr,{className:"w-4 h-4"}),a.jsx("span",{children:c(h.publishDate)})]}),h.category&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Tr,{className:"w-4 h-4"}),a.jsx("span",{children:h.category})]})]})]})]},h.id)})}),i>1&&a.jsxs("div",{className:"flex justify-center gap-2",children:[a.jsx("button",{onClick:()=>e(r-1),disabled:r===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"}),a.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:i},(h,f)=>f+1).map(h=>a.jsx("button",{onClick:()=>e(h),className:`px-3 py-1 rounded-md ${h===r?"bg-green-600 text-white":"text-gray-700 hover:bg-gray-50"}`,children:h},h))}),a.jsx("button",{onClick:()=>e(r+1),disabled:r===i,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(r){return r.DOCUMENT="document",r.PARAGRAPH="paragraph",r.HEADING_1="heading-1",r.HEADING_2="heading-2",r.HEADING_3="heading-3",r.HEADING_4="heading-4",r.HEADING_5="heading-5",r.HEADING_6="heading-6",r.OL_LIST="ordered-list",r.UL_LIST="unordered-list",r.LIST_ITEM="list-item",r.HR="hr",r.QUOTE="blockquote",r.EMBEDDED_ENTRY="embedded-entry-block",r.EMBEDDED_ASSET="embedded-asset-block",r.EMBEDDED_RESOURCE="embedded-resource-block",r.TABLE="table",r.TABLE_ROW="table-row",r.TABLE_CELL="table-cell",r.TABLE_HEADER_CELL="table-header-cell",r}({}),K=function(r){return r.ASSET_HYPERLINK="asset-hyperlink",r.EMBEDDED_ENTRY="embedded-entry-inline",r.EMBEDDED_RESOURCE="embedded-resource-inline",r.ENTRY_HYPERLINK="entry-hyperlink",r.HYPERLINK="hyperlink",r.RESOURCE_HYPERLINK="resource-hyperlink",r}({}),ot=function(r){return r.BOLD="bold",r.ITALIC="italic",r.UNDERLINE="underline",r.CODE="code",r.SUPERSCRIPT="superscript",r.SUBSCRIPT="subscript",r.STRIKETHROUGH="strikethrough",r}({});function Er(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=r[t];return s}function Ml(r){if(Array.isArray(r))return Er(r)}function pe(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bl(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Fl(){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 Hl(r){return Ml(r)||Bl(r)||ql(r)||Fl()}function ql(r,e){if(r){if(typeof r=="string")return Er(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Er(r,e)}}var jn=[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],Gr=[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],Gl=[g.TABLE,g.TABLE_ROW,g.TABLE_CELL,g.TABLE_HEADER_CELL],Wl=[g.HR,g.EMBEDDED_ENTRY,g.EMBEDDED_ASSET,g.EMBEDDED_RESOURCE],se,Tn=(se={},pe(se,g.OL_LIST,[g.LIST_ITEM]),pe(se,g.UL_LIST,[g.LIST_ITEM]),pe(se,g.LIST_ITEM,Gr),pe(se,g.QUOTE,[g.PARAGRAPH]),pe(se,g.TABLE,[g.TABLE_ROW]),pe(se,g.TABLE_ROW,[g.TABLE_CELL,g.TABLE_HEADER_CELL]),pe(se,g.TABLE_CELL,[g.PARAGRAPH,g.UL_LIST,g.OL_LIST]),pe(se,g.TABLE_HEADER_CELL,[g.PARAGRAPH]),se),kn=[g.HEADING_1,g.HEADING_2,g.HEADING_3,g.HEADING_4,g.HEADING_5,g.HEADING_6],zl=[g.PARAGRAPH].concat(Hl(kn)),Kl=[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,K.HYPERLINK,K.ENTRY_HYPERLINK,K.ASSET_HYPERLINK,K.EMBEDDED_ENTRY,"text"],Vl=[ot.BOLD,ot.CODE,ot.ITALIC,ot.UNDERLINE],Jl={nodeType:g.DOCUMENT,data:{},content:[{nodeType:g.PARAGRAPH,data:{},content:[{nodeType:"text",value:"",marks:[],data:{}}]}]};function Yl(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ql(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},s=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(s=s.concat(Object.getOwnPropertySymbols(t).filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),s.forEach(function(n){Yl(r,n,t[n])})}return r}function Zl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);t.push.apply(t,s)}return t}function Xl(r,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):Zl(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}),r}function ec(r){"@swc/helpers - typeof";return r&&typeof Symbol<"u"&&r.constructor===Symbol?"symbol":typeof r}function Sn(r,e){var t=!0,s=!1,n=void 0;try{for(var i=Object.keys(r)[Symbol.iterator](),o;!(t=(o=i.next()).done);t=!0){var l=o.value;if(e===r[l])return!0}}catch(d){s=!0,n=d}finally{try{!t&&i.return!=null&&i.return()}finally{if(s)throw n}}return!1}function tc(r){return Sn(K,r.nodeType)}function rc(r){return Sn(g,r.nodeType)}function sc(r){return r.nodeType==="text"}function En(r){if(r.nodeType!==g.PARAGRAPH||r.content.length!==1)return!1;var e=r.content[0];return e.nodeType==="text"&&e.value===""}function nc(r){return r!=null&&(typeof r>"u"?"undefined":ec(r))==="object"&&"content"in r&&Array.isArray(r.content)}var ac=2;function ic(r){if(!nc(r)||r.content.length<ac)return r;var e=r.content[r.content.length-1];return En(e)?Xl(Ql({},r),{content:r.content.slice(0,-1)}):r}const oc=Object.freeze(Object.defineProperty({__proto__:null,isBlock:rc,isEmptyParagraph:En,isInline:tc,isText:sc,stripEmptyTrailingParagraphFromDocument:ic},Symbol.toStringTag,{value:"Module"}));var lc=r=>{if(Object.prototype.toString.call(r)!=="[object Object]")return!1;const e=Object.getPrototypeOf(r);return e===null||e===Object.prototype};const cc=Lt(lc),xe=r=>typeof r=="string",dc=r=>typeof r=="function",ws=new Map,Nn="en";function Wr(r){return[...Array.isArray(r)?r:[r],Nn]}function zr(r,e,t){const s=Wr(r);t||(t="default");let n;if(typeof t=="string")switch(n={day:"numeric",month:"short",year:"numeric"},t){case"full":n.weekday="long";case"long":n.month="long";break;case"short":n.month="numeric";break}else n=t;return Ct(()=>Rt("date",s,t),()=>new Intl.DateTimeFormat(s,n)).format(xe(e)?new Date(e):e)}function uc(r,e,t){let s;if(t||(t="default"),typeof t=="string")switch(s={second:"numeric",minute:"numeric",hour:"numeric"},t){case"full":case"long":s.timeZoneName="short";break;case"short":delete s.second}else s=t;return zr(r,e,s)}function Nr(r,e,t){const s=Wr(r);return Ct(()=>Rt("number",s,t),()=>new Intl.NumberFormat(s,t)).format(e)}function _s(r,e,t,{offset:s=0,...n}){const i=Wr(r),o=e?Ct(()=>Rt("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):Ct(()=>Rt("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return n[t]??n[o.select(t-s)]??n.other}function Ct(r,e){const t=r();let s=ws.get(t);return s||(s=e(),ws.set(t,s)),s}function Rt(r,e,t){const s=e.join("-");return`${r}-${s}-${JSON.stringify(t)}`}const Pn=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,An=r=>r.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(e,t,s)=>{if(t){const n=parseInt(t,16);return String.fromCharCode(n)}else{const n=parseInt(s,16);return String.fromCharCode(n)}}),On="%__lingui_octothorpe__%",hc=(r,e,t={})=>{const s=e||r,n=o=>typeof o=="object"?o:t[o],i=(o,l)=>{const d=Object.keys(t).length?n("number"):void 0,c=Nr(s,o,d);return l.replace(new RegExp(On,"g"),c)};return{plural:(o,l)=>{const{offset:d=0}=l,c=_s(s,!1,o,l);return i(o-d,c)},selectordinal:(o,l)=>{const{offset:d=0}=l,c=_s(s,!0,o,l);return i(o-d,c)},select:fc,number:(o,l)=>Nr(s,o,n(l)||{style:l}),date:(o,l)=>zr(s,o,n(l)||l),time:(o,l)=>uc(s,o,n(l)||l)}},fc=(r,e)=>e[r]??e.other;function mc(r,e,t){return(s={},n)=>{const i=hc(e,t,n),o=(d,c=!1)=>Array.isArray(d)?d.reduce((u,h)=>{if(h==="#"&&c)return u+On;if(xe(h))return u+h;const[f,m,b]=h;let v={};m==="plural"||m==="selectordinal"||m==="select"?Object.entries(b).forEach(([p,j])=>{v[p]=o(j,m==="plural"||m==="selectordinal")}):v=b;let x;if(m){const p=i[m];x=p(s[f],v)}else x=s[f];return x==null?u:u+x},""):d,l=o(r);return xe(l)&&Pn.test(l)?An(l):xe(l)?l:l?String(l):""}}var pc=Object.defineProperty,gc=(r,e,t)=>e in r?pc(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yc=(r,e,t)=>(gc(r,e+"",t),t);class bc{constructor(){yc(this,"_events",{})}on(e,t){var s;return(s=this._events)[e]??(s[e]=[]),this._events[e].push(t),()=>this.removeListener(e,t)}removeListener(e,t){const s=this._getListeners(e);if(!s)return;const n=s.indexOf(t);~n&&s.splice(n,1)}emit(e,...t){const s=this._getListeners(e);s&&s.map(n=>n.apply(this,t))}_getListeners(e){const t=this._events[e];return Array.isArray(t)?t:!1}}var xc=Object.defineProperty,vc=(r,e,t)=>e in r?xc(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ke=(r,e,t)=>(vc(r,typeof e!="symbol"?e+"":e,t),t);class wc extends bc{constructor(e){super(),ke(this,"_locale",""),ke(this,"_locales"),ke(this,"_localeData",{}),ke(this,"_messages",{}),ke(this,"_missing"),ke(this,"_messageCompiler"),ke(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate(e.locale??Nn,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(e,t){const s=this._localeData[e];s?Object.assign(s,t):this._localeData[e]=t}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,t){typeof e=="string"?this._loadLocaleData(e,t):Object.keys(e).forEach(s=>this._loadLocaleData(s,e[s])),this.emit("change")}_load(e,t){const s=this._messages[e];s?Object.assign(s,t):this._messages[e]=t}load(e,t){typeof e=="string"&&typeof t=="object"?this._load(e,t):Object.entries(e).forEach(([s,n])=>this._load(s,n)),this.emit("change")}loadAndActivate({locale:e,locales:t,messages:s}){this._locale=e,this._locales=t||void 0,this._messages[this._locale]=s,this.emit("change")}activate(e,t){this._locale=e,this._locales=t,this.emit("change")}_(e,t,s){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let n=s==null?void 0:s.message;e||(e=""),xe(e)||(t=e.values||t,n=e.message,e=e.id);const i=this.messages[e],o=i===void 0,l=this._missing;if(l&&o)return dc(l)?l(this._locale,e):l;o&&this.emit("missing",{id:e,locale:this._locale});let d=i||n||e;return xe(d)&&(this._messageCompiler?d=this._messageCompiler(d):console.warn(`Uncompiled message detected! Message:

> ${d}

That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
ICU features such as interpolation and plurals will not work properly for that message. 

Please compile your catalog first. 
`)),xe(d)&&Pn.test(d)?An(d):xe(d)?d:mc(d,this._locale,this._locales)(t,s==null?void 0:s.formats)}date(e,t){return zr(this._locales||this._locale,e,t)}number(e,t){return Nr(this._locales||this._locale,e,t)}}function _c(r={}){return new wc(r)}const Xe=_c();function Pr(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=r[t];return s}function jc(r){if(Array.isArray(r))return Pr(r)}function Tc(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function kc(){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 Sc(r){return jc(r)||Tc(r)||Ec(r)||kc()}function Ec(r,e){if(r){if(typeof r=="string")return Pr(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Pr(r,e)}}var jt=function(r){var e=r.path,t=r.property,s=r.typeName,n=r.value;return{details:Xe._({id:"RichText.RichTextTypes.Validator.TypeMismatchErrorMessage",message:'The type of "{property}" is incorrect, expected type: {typeName}',values:{property:t,typeName:s}}),name:"type",path:e.toArray(),type:s,value:n}},Nc=function(r){var e=r.min,t=r.value,s=r.path;return{name:"size",min:e,path:s.toArray(),details:Xe._({id:"RichText.RichTextTypes.Validator.MinSizeErrorMessage",message:"Size must be at least {min}",values:{min:e}}),value:t}},Pc=function(r){var e=r.max,t=r.value,s=r.path;return{name:"size",max:e,path:s.toArray(),details:Xe._({id:"RichText.RichTextTypes.Validator.MaxSizeErrorMessage",message:"Size must be at most {max}",values:{max:e}}),value:t}},Ac=function(r){var e=r.expected,t=r.value,s=r.path;return{details:Xe._({id:"RichText.RichTextTypes.Validator.EnumErrorMessage",message:"Value must be one of expected values"}),name:"in",expected:Sc(e).sort(),path:s.toArray(),value:t}},Oc=function(r){var e=r.property,t=r.path;return{details:Xe._({id:"RichText.RichTextTypes.Validator.UnknownPropertyErrorMessage",message:'The property "{property}" is not expected',values:{property:e}}),name:"unexpected",path:t.toArray()}},Ic=function(r){var e=r.property,t=r.path;return{details:Xe._({id:"RichText.RichTextTypes.Validator.RequiredPropertyErrorMessage",message:'The property "{property}" is required here',values:{property:e}}),name:"required",path:t.toArray()}};function Ar(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=r[t];return s}function Cc(r){if(Array.isArray(r))return Ar(r)}function Rc(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function $c(r,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(r,s.key,s)}}function Lc(r,e,t){return e&&$c(r.prototype,e),r}function G(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dc(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Uc(){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 js(r){return Cc(r)||Dc(r)||Mc(r)||Uc()}function Mc(r,e){if(r){if(typeof r=="string")return Ar(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ar(r,e)}}var ae=function(){function r(e,t){var s=this,n=this;Rc(this,r),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=t,this._errors=[],this.catch=function(){for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];var d;(d=n._errors).push.apply(d,js(o))},this.exists=function(i){return i in s.obj?!0:(s.catch(Ic({property:i,path:s.path.of(i)})),!1)},this.object=function(i){var o=i?s.obj[i]:s.obj;if(i&&!s.exists(i))return!1;if(cc(o))return!0;var l=i?s.path.of(i):s.path,d,c=(d=i??s.path.last())!==null&&d!==void 0?d:"value";return s.catch(jt({typeName:"Object",property:c,path:l,value:o})),!1},this.string=function(i){var o=s.obj[i];return i&&!s.exists(i)?!1:typeof o=="string"?!0:(s.catch(jt({typeName:"String",property:i,path:s.path.of(i),value:o})),!1)},this.number=function(i,o){var l=s.obj[i];return o&&!(i in s.obj)?!0:s.exists(i)?typeof l=="number"&&!Number.isNaN(l)?!0:(s.catch(jt({typeName:"Number",property:i,path:s.path.of(i),value:l})),!1):!1},this.array=function(i){var o=s.obj[i];return i&&!s.exists(i)?!1:Array.isArray(o)?!0:(s.catch(jt({typeName:"Array",property:i,path:s.path.of(i),value:o})),!1)},this.enum=function(i,o){var l=s.obj[i];return typeof l=="string"&&o.includes(l)?!0:(s.catch(Ac({expected:o,value:l,path:s.path.of(i)})),!1)},this.empty=function(i){if(!s.array(i))return!1;var o=s.obj[i];return o.length===0?!0:(s.catch(Pc({max:0,value:o,path:s.path.of(i)})),!1)},this.minLength=function(i,o){if(!s.array(i))return!1;var l=s.obj[i];return l.length>=o?!0:(s.catch(Nc({min:o,value:l,path:s.path.of(i)})),!1)},this.noAdditionalProperties=function(i){var o=Object.keys(s.obj).sort().filter(function(l){return!i.includes(l)});return o.forEach(function(l){return s.catch(Oc({property:l,path:s.path.of(l)}))}),o.length===0},this.each=function(i,o){if(s.array(i)){var l=s.obj[i],d=!1;l.forEach(function(c,u){if(!d){var h=o(c,s.path.of(i).of(u));h.length>0&&(d=!0),s.catch.apply(s,js(h))}})}}}return Lc(r,[{key:"errors",get:function(){var t=this,s=function(n){return JSON.stringify({details:n.details,path:n.path})};return this._errors.filter(function(n,i){return t._errors.findIndex(function(o){return s(n)===s(o)})===i})}}]),r}();function Or(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=r[t];return s}function Bc(r){if(Array.isArray(r))return Or(r)}function Kr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function In(r,e,t){return e=$t(e),Wc(r,$n()?Reflect.construct(e,t||[],$t(r).constructor):e.apply(r,t))}function Vr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Fc(r,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(r,s.key,s)}}function Hc(r,e,t){return e&&Fc(r.prototype,e),r}function ze(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $t(r){return $t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$t(r)}function Cn(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&Ir(r,e)}function qc(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Gc(){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 Wc(r,e){return e&&(zc(e)==="object"||typeof e=="function")?e:Kr(r)}function Ir(r,e){return Ir=Object.setPrototypeOf||function(s,n){return s.__proto__=n,s},Ir(r,e)}function Rn(r){return Bc(r)||qc(r)||Kc(r)||Gc()}function zc(r){"@swc/helpers - typeof";return r&&typeof Symbol<"u"&&r.constructor===Symbol?"symbol":typeof r}function Kc(r,e){if(r){if(typeof r=="string")return Or(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Or(r,e)}}function $n(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($n=function(){return!!r})()}var lt=[],Jr=function(){function r(e,t){Vr(this,r),ze(this,"contentRule",void 0),ze(this,"validateData",void 0),this.contentRule=e,this.validateData=t}return Hc(r,[{key:"assert",value:function(t,s){var n=new ae(t,s);if(!n.object())return n.errors;n.noAdditionalProperties(["nodeType","data","content"]);var i=Array.isArray(this.contentRule)?{nodeTypes:this.contentRule}:this.contentRule(t,s),o=i.nodeTypes,l=i.min,d=l===void 0?0:l;if(o.length===0&&d>0)throw new Error("Invalid content rule. Cannot have enforce a 'min' of ".concat(d," with no nodeTypes"));if(n.minLength("content",d),o.length===0?n.empty("content"):n.each("content",function(b,v){var x=new ae(b,v);return x.object()&&x.enum("nodeType",o),x.errors}),n.object("data")){var c,u,h,f,m=(f=(u=(h=this).validateData)===null||u===void 0?void 0:u.call(h,t.data,s.of("data")))!==null&&f!==void 0?f:[];(c=n).catch.apply(c,Rn(m))}return n.errors}}]),r}(),Vc=function(r){Cn(e,r);function e(t,s){Vr(this,e);var n;return n=In(this,e,[s,function(i,o){return Kr(n).assertLink(i,o)}]),ze(n,"linkType",void 0),ze(n,"type",void 0),ze(n,"assertLink",void 0),n.linkType=t,n.assertLink=function(i,o){var l=new ae(i,o);if(l.object("target")){var d,c=new ae(i.target.sys,o.of("target").of("sys"));c.object()&&(c.enum("type",[n.type]),c.enum("linkType",[n.linkType]),n.type==="Link"?(c.string("id"),c.noAdditionalProperties(["type","linkType","id"])):n.type==="ResourceLink"&&(c.string("urn"),c.noAdditionalProperties(["type","linkType","urn"]))),(d=l).catch.apply(d,Rn(c.errors))}return l.noAdditionalProperties(["target"]),l.errors},n.type=n.linkType.startsWith("Contentful:")?"ResourceLink":"Link",n}return e}(Jr),Jc=function(r){Cn(e,r);function e(){Vr(this,e);var t;return t=In(this,e,[["text"],function(s,n){return Kr(t).assertLink(s,n)}]),ze(t,"assertLink",function(s,n){var i=new ae(s,n);return i.string("uri"),i.noAdditionalProperties(["uri"]),i.errors}),t}return e}(Jr),ce=function(r,e){return new Jr(r,e)},Ne=function(r,e){return new Vc(r,e)};function Cr(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=r[t];return s}function Yc(r){if(Array.isArray(r))return Cr(r)}function Qc(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function at(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zc(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Xc(){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 ed(r){return Yc(r)||Zc(r)||td(r)||Xc()}function td(r,e){if(r){if(typeof r=="string")return Cr(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Cr(r,e)}}var rd=function r(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];Qc(this,r),at(this,"path",void 0),at(this,"of",void 0),at(this,"isRoot",void 0),at(this,"last",void 0),at(this,"toArray",void 0),this.path=t,this.of=function(s){return new r(ed(e.path).concat([s]))},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 sd(r,e){var t=new ae(r,e);return t.object()&&(t.noAdditionalProperties(["nodeType","data","value","marks"]),t.object("data"),t.each("marks",function(s,n){var i=new ae(s,n);return i.object()&&i.string("type"),i.errors}),t.string("value")),t.errors}function Rr(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=r[t];return s}function nd(r){if(Array.isArray(r))return Rr(r)}function U(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ad(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function id(){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 Ln(r){return nd(r)||ad(r)||od(r)||id()}function od(r,e){if(r){if(typeof r=="string")return Rr(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Rr(r,e)}}var Se=ce(Ln(Object.values(K)).concat(["text"]).sort()),Ts=ce([g.LIST_ITEM]),ks=Ne("Entry",lt),Ss=ce(function(){return{nodeTypes:[g.PARAGRAPH],min:1}},function(r,e){var t=new ae(r,e);return t.noAdditionalProperties(["colspan","rowspan"]),t.number("colspan",!0),t.number("rowspan",!0),t.errors}),$,ld=($={},U($,g.DOCUMENT,ce(jn)),U($,g.PARAGRAPH,Se),U($,g.HEADING_1,Se),U($,g.HEADING_2,Se),U($,g.HEADING_3,Se),U($,g.HEADING_4,Se),U($,g.HEADING_5,Se),U($,g.HEADING_6,Se),U($,g.QUOTE,ce(Tn[g.QUOTE])),U($,g.EMBEDDED_ENTRY,ks),U($,g.EMBEDDED_ASSET,Ne("Asset",lt)),U($,g.EMBEDDED_RESOURCE,Ne("Contentful:Entry",lt)),U($,g.HR,ce(lt)),U($,g.OL_LIST,Ts),U($,g.UL_LIST,Ts),U($,g.LIST_ITEM,ce(Ln(Gr).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,Ss),U($,g.TABLE_HEADER_CELL,Ss),U($,K.HYPERLINK,new Jc),U($,K.EMBEDDED_ENTRY,ks),U($,K.EMBEDDED_RESOURCE,Ne("Contentful:Entry",lt)),U($,K.ENTRY_HYPERLINK,Ne("Entry",["text"])),U($,K.ASSET_HYPERLINK,Ne("Asset",["text"])),U($,K.RESOURCE_HYPERLINK,Ne("Contentful:Entry",["text"])),$);function Dn(r,e){if(r.nodeType==="text")return sd(r,e);var t=ld[r.nodeType].assert(r,e);if(t.length>0)return t;var s=new ae(r,e);return s.each("content",function(n,i){return Dn(n,i)}),s.errors}var cd=function(r){var e=new rd,t=new ae(r,e);return t.object()&&t.enum("nodeType",[g.DOCUMENT]),t.errors.length>0?t.errors:Dn(r,e)};const dd=Object.freeze(Object.defineProperty({__proto__:null,BLOCKS:g,CONTAINERS:Tn,EMPTY_DOCUMENT:Jl,HEADINGS:kn,INLINES:K,LIST_ITEM_BLOCKS:Gr,MARKS:ot,TABLE_BLOCKS:Gl,TEXT_CONTAINERS:zl,TOP_LEVEL_BLOCKS:jn,V1_MARKS:Vl,V1_NODE_TYPES:Kl,VOID_BLOCKS:Wl,helpers:oc,validateRichTextDocument:cd},Symbol.toStringTag,{value:"Module"})),ud=Ps(dd);var C=y,A=ud;function hd(r,e){return C.isValidElement(r)&&r.key===null?C.cloneElement(r,{key:e}):r}function fd(r,e){return r.map((t,s)=>hd(Un(t,e),s))}function Un(r,e){const{renderNode:t,renderMark:s,renderText:n,preserveWhitespace:i}=e;if(A.helpers.isText(r)){let o=n?n(r.value):r.value;if(i&&!n){o=o.replace(/ {2,}/g,c=>" ".repeat(c.length));const l=o.split(`
`),d=[];l.forEach((c,u)=>{d.push(c),u!==l.length-1&&d.push(C.createElement("br",null))}),o=d}return r.marks.reduce((l,d)=>s[d.type]?s[d.type](l):l,o)}else{const o=fd(r.content,e);return!r.nodeType||!t[r.nodeType]?C.createElement(C.Fragment,null,o):t[r.nodeType](r,o)}}const md={[A.BLOCKS.DOCUMENT]:(r,e)=>e,[A.BLOCKS.PARAGRAPH]:(r,e)=>C.createElement("p",null,e),[A.BLOCKS.HEADING_1]:(r,e)=>C.createElement("h1",null,e),[A.BLOCKS.HEADING_2]:(r,e)=>C.createElement("h2",null,e),[A.BLOCKS.HEADING_3]:(r,e)=>C.createElement("h3",null,e),[A.BLOCKS.HEADING_4]:(r,e)=>C.createElement("h4",null,e),[A.BLOCKS.HEADING_5]:(r,e)=>C.createElement("h5",null,e),[A.BLOCKS.HEADING_6]:(r,e)=>C.createElement("h6",null,e),[A.BLOCKS.EMBEDDED_ENTRY]:(r,e)=>C.createElement("div",null,e),[A.BLOCKS.EMBEDDED_RESOURCE]:(r,e)=>C.createElement("div",null,e),[A.BLOCKS.UL_LIST]:(r,e)=>C.createElement("ul",null,e),[A.BLOCKS.OL_LIST]:(r,e)=>C.createElement("ol",null,e),[A.BLOCKS.LIST_ITEM]:(r,e)=>C.createElement("li",null,e),[A.BLOCKS.QUOTE]:(r,e)=>C.createElement("blockquote",null,e),[A.BLOCKS.HR]:()=>C.createElement("hr",null),[A.BLOCKS.TABLE]:(r,e)=>C.createElement("table",null,C.createElement("tbody",null,e)),[A.BLOCKS.TABLE_ROW]:(r,e)=>C.createElement("tr",null,e),[A.BLOCKS.TABLE_HEADER_CELL]:(r,e)=>C.createElement("th",null,e),[A.BLOCKS.TABLE_CELL]:(r,e)=>C.createElement("td",null,e),[A.INLINES.ASSET_HYPERLINK]:r=>or(A.INLINES.ASSET_HYPERLINK,r),[A.INLINES.ENTRY_HYPERLINK]:r=>or(A.INLINES.ENTRY_HYPERLINK,r),[A.INLINES.RESOURCE_HYPERLINK]:r=>Es(A.INLINES.RESOURCE_HYPERLINK,r),[A.INLINES.EMBEDDED_ENTRY]:r=>or(A.INLINES.EMBEDDED_ENTRY,r),[A.INLINES.EMBEDDED_RESOURCE]:(r,e)=>Es(A.INLINES.EMBEDDED_RESOURCE,r),[A.INLINES.HYPERLINK]:(r,e)=>C.createElement("a",{href:r.data.uri},e)},pd={[A.MARKS.BOLD]:r=>C.createElement("b",null,r),[A.MARKS.ITALIC]:r=>C.createElement("i",null,r),[A.MARKS.UNDERLINE]:r=>C.createElement("u",null,r),[A.MARKS.CODE]:r=>C.createElement("code",null,r),[A.MARKS.SUPERSCRIPT]:r=>C.createElement("sup",null,r),[A.MARKS.SUBSCRIPT]:r=>C.createElement("sub",null,r),[A.MARKS.STRIKETHROUGH]:r=>C.createElement("s",null,r)};function or(r,e){return C.createElement("span",{key:e.data.target.sys.id},"type: ",e.nodeType," id: ",e.data.target.sys.id)}function Es(r,e){return C.createElement("span",{key:e.data.target.sys.urn},"type: ",e.nodeType," urn: ",e.data.target.sys.urn)}function gd(r,e={}){if(!r)return null;let t=r;return e.stripEmptyTrailingParagraph&&(t=A.helpers.stripEmptyTrailingParagraphFromDocument(r)),Un(t,{renderNode:{...md,...e.renderNode},renderMark:{...pd,...e.renderMark},renderText:e.renderText,preserveWhitespace:e.preserveWhitespace})}var yd=gd;function bd(){var u,h;const{category:r,slug:e}=Ut(),t=Hr,s=t.find(f=>f.slug===e),n=s?t.filter(f=>f.category===s.category&&f.slug!==e).slice(0,2):[];function i(f){return new Date(f).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function o(f){return f.startsWith("//")?`https:${f}`:f}const l={renderNode:{[g.PARAGRAPH]:(f,m)=>a.jsx("p",{className:"mb-6 text-gray-700 leading-relaxed",children:m}),[g.HEADING_1]:(f,m)=>a.jsx("h1",{className:"text-3xl font-bold mb-6 text-gray-900",children:m}),[g.HEADING_2]:(f,m)=>a.jsx("h2",{className:"text-2xl font-semibold mb-4 text-gray-900",children:m}),[g.HEADING_3]:(f,m)=>a.jsx("h3",{className:"text-xl font-semibold mb-3 text-gray-900",children:m}),[g.UL_LIST]:(f,m)=>a.jsx("ul",{className:"list-disc pl-6 mb-6 space-y-2",children:m}),[g.OL_LIST]:(f,m)=>a.jsx("ol",{className:"list-decimal pl-6 mb-6 space-y-2",children:m}),[g.LIST_ITEM]:(f,m)=>a.jsx("li",{className:"text-gray-700 leading-relaxed",children:m}),[g.QUOTE]:(f,m)=>a.jsx("blockquote",{className:"border-l-4 border-green-600 pl-4 italic my-6 text-gray-600",children:m}),[g.EMBEDDED_ASSET]:f=>{var v,x;if(!((x=(v=f.data.target)==null?void 0:v.fields)!=null&&x.file))return null;const{file:m,title:b}=f.data.target.fields;return a.jsx("img",{src:o(m.url),alt:b||"",className:"w-full rounded-lg my-6"})},[K.HYPERLINK]:(f,m)=>a.jsx("a",{href:f.data.uri,target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-700 underline",children:m})}};if(!s)return a.jsxs("div",{className:"min-h-screen flex flex-col justify-center items-center",children:[a.jsx("p",{className:"text-red-600 mb-4",children:"Post not found"}),a.jsx(I,{to:"/blog",className:"text-green-600 hover:text-green-700",children:"Back to Blog"})]});const d=(u=s.featuredImage)!=null&&u.url?o(s.featuredImage.url):void 0,c=[{"@context":"https://schema.org","@type":"BlogPosting",headline:s.title,description:s.excerpt||"",image:d||"https://ftwlzdhkzqfuosdorgjt.supabase.co/storage/v1/object/public/playlistpartner%20public/playlistpartner%20og%20image.png",datePublished:s.publishDate||s.createdAt,dateModified:s.updatedAt||s.publishDate||s.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:s.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:s.title,item:window.location.href}]}];return a.jsxs(a.Fragment,{children:[a.jsx(ie,{title:`${s.title} | PlaylistPartner`,description:s.excerpt||`Read ${s.title} on the PlaylistPartner blog`,image:d,type:"article",article:{publishedTime:s.publishDate||s.createdAt,modifiedTime:s.updatedAt||s.publishDate||s.createdAt,author:"Playlist Partner",section:s.category||"News"},structuredData:c}),a.jsxs("article",{className:"bg-white",children:[a.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[a.jsxs(I,{to:"/blog",className:"inline-flex items-center gap-2 text-green-600 hover:text-green-700 mb-8",children:[a.jsx(ue,{className:"w-4 h-4"}),"Back to Blog"]}),((h=s.featuredImage)==null?void 0:h.url)&&a.jsx("img",{src:o(s.featuredImage.url),alt:s.featuredImage.title||s.title,className:"w-full aspect-[3/2] object-cover rounded-lg mb-8"}),a.jsxs("header",{className:"mb-8",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 mb-4",children:s.title}),a.jsxs("div",{className:"flex flex-wrap items-center gap-6 text-gray-600",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Fr,{className:"w-5 h-5"}),a.jsx("span",{children:i(s.publishDate||s.createdAt)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Wt,{className:"w-5 h-5"}),a.jsxs("span",{children:["By ",a.jsx(I,{to:"/",className:"hover:text-green-600 transition-colors",children:"Playlist Partner"})]})]}),s.category&&a.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:[a.jsx(Tr,{className:"w-3 h-3"}),s.category]})]})]}),a.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:s.body?yd(s.body,l):a.jsx("div",{className:"bg-gray-50 p-6 rounded-lg",children:a.jsx("p",{className:"text-gray-600",children:"No content available for this post."})})}),a.jsx("div",{className:"mt-12 pt-8 border-t border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[a.jsx("span",{children:"Filed under:"}),a.jsxs("div",{className:"inline-flex items-center gap-1 px-3 py-1 bg-gray-100 rounded-full",children:[a.jsx(Tr,{className:"w-3 h-3"}),s.category||"News"]})]})})]}),n.length>0&&a.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 mt-8",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[a.jsx(Yo,{className:"w-6 h-6 text-gray-700"}),a.jsx("h2",{className:"text-2xl font-semibold text-gray-900",children:"Related News & Guides"})]}),a.jsx("div",{className:"grid md:grid-cols-2 gap-6 mb-16",children:n.map(f=>{var m,b;return a.jsxs(I,{to:`/blog/${((m=f.category)==null?void 0:m.toLowerCase())||"news"}/${f.slug}`,className:"bg-white border border-gray-200 rounded-lg shadow-sm hover:shadow-md transition-shadow overflow-hidden group",children:[((b=f.featuredImage)==null?void 0:b.url)&&a.jsx("div",{className:"aspect-[3/2] overflow-hidden",children:a.jsx("img",{src:o(f.featuredImage.url),alt:f.featuredImage.title||f.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),a.jsxs("div",{className:"p-6",children:[a.jsx("h3",{className:"font-semibold text-gray-900 group-hover:text-green-600 transition-colors line-clamp-2",children:f.title}),f.excerpt&&a.jsx("p",{className:"text-sm text-gray-600 mt-2 line-clamp-2",children:f.excerpt})]})]},f.id)})})]}),a.jsx("section",{className:"bg-gradient-to-r from-green-600 to-green-700 py-12",children:a.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center",children:[a.jsx("h2",{className:"text-3xl font-bold text-white mb-2",children:"Ready to Submit Your Music?"}),a.jsx("p",{className:"text-xl text-green-100 mb-8",children:"Browse 10,000+ curated playlists"}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[a.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"}),a.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",a.jsx(mt,{className:"w-5 h-5 ml-2"})]})]})]})})]})]})}function xd(){return a.jsx(mn,{children:a.jsx("div",{className:"min-h-screen flex flex-col",children:a.jsxs(Fn,{children:[a.jsx(V,{path:"/",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(ol,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/playlists",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(El,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/submit",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(Nl,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/submit/genre",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(Pl,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/playlist/:slug/*",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(kl,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/genres",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx($l,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/genre/:genre",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(Il,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/genre/:genre/:subGenre",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(Rl,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/about",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(Ll,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/for-curators",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(Dl,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/blog",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(Ul,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"/blog/:category/:slug",element:a.jsxs(a.Fragment,{children:[a.jsx(J,{}),a.jsx(bd,{}),a.jsx(Y,{})]})}),a.jsx(V,{path:"*",element:a.jsx(Hn,{to:"/",replace:!0})})]})})})}const vd={};Os(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(Us,{context:vd,children:a.jsx(qn,{children:a.jsx(Uo,{children:a.jsx(mn,{children:a.jsx(xd,{})})})})})}));export{Oe as L,qr as P,Ze as S,yt as T,Al as u};
//# sourceMappingURL=index-BieUh1rP.js.map