1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-ZJIFMD3b.js","assets/index-BXEFfDgc.js","assets/index-ZOcYuG73.css"])))=>i.map(i=>d[i]); 2import{x as le,am as xe,r as p,j as e,D as H,d as _,F as Pe,m as Lt,l as z,p as Ot,aQ as $t,g as K,X as te,aw as Yt,v as Ut,K as fe,N as ye,S as Vt,b2 as qt,E as Xe,O as Ge,Q as Qe,a6 as jt,q as ie,T as se,k as Ht,J as Xt,G as Gt,a7 as Qt,b6 as Zt,au as Ze,az as wt,b7 as St,aB as Me,aF as Je,as as Jt,at as vt,c as ge,M as Kt,U as es}from"./index-BXEFfDgc.js";import{B}from"./button-mPweo0jW.js";import{I as J}from"./input-CEeAXjY4.js";import"./label-DYsaP1SC.js";import{S as kt}from"./switch-BaDxyMlM.js";import{T as ts,a as ss,b as Se,c as ve}from"./tabs-4fAihhem.js";import{S as Ct,a as Ft,b as _t,d as At,e as Ie}from"./select-juilArA2.js";import{f as ns}from"./formatDuration-CXJzqVCb.js";import{R as rs}from"./refresh-cw-DkYiSSWZ.js";import{D as be}from"./download-xM5w7FN1.js";import{b as as}from"./fixQueue-DNEP1IHU.js";import{b as is}from"./registrationModel-DhvWcEeg.js";import{g as os,b as ls,e as cs,F as st,c as ds}from"./SongEntryForm-BDF30718.js";import{S as us,C as ps,G as nt,F as hs}from"./SoundExchangeExportModal-dVEmvITk.js";import{P as Nt}from"./pencil-ezW9OLdy.js";import{S as oe}from"./shield-check-BQUuSjOj.js";import{B as gs,C as ms}from"./circle-CEdPp6hh.js";import{P as Ke}from"./plus-BMG1hm7n.js";import{A as xs}from"./ArtistSearchStep-B52QubwI.js";import{C as q}from"./circle-alert-BmEYkPR3.js";import{S as Ye}from"./sparkles-C4qy6Uta.js";import{E as It}from"./external-link-BNHX0uhB.js";import{u as ze}from"./index-D0QUG8Et.js";import{T as fs}from"./tag-CCPsSA8o.js";import{T as Ue}from"./trash-2-D3YKcAYo.js";import{A as Ve}from"./index-f-Jyv9us.js";import{U as ne}from"./upload-0XEy29Yt.js";import{M as rt}from"./music-2-BxYdHUdo.js";import{L as ys}from"./list-music-T596orGm.js";import{C as bs}from"./chevron-up-Oq-3zpL0.js";import{C as Pt}from"./chevron-down-D1-nO6kk.js";import{C as Te}from"./circle-x-DIgo5-z6.js";import{C as qe}from"./clock-BhNPS44Y.js";import{B as js}from"./BulkImportModal-DRTWK1da.js";import{F as et}from"./file-spreadsheet-CPdoje7U.js";import{U as ws}
2from"./users-COl_uh9J.js";import{G as Ss}from"./globe-DveutXZs.js";import"./index-DQaL21jl.js";import"./index-CFzElpHS.js";import"./index-BQtLpF4R.js";import"./index-BO9vtmLu.js";import"./collapseTracksByISRC-CfGIl5sU.js";import"./user-BZuMUIT9.js";import"./checkbox-C3h3YvfD.js";import"./chevron-right-BI_xym7O.js";import"./file-text-Cysd_s7C.js";/** 3 * @license lucide-react v0.475.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const vs=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]],ks=le("FileSearch",vs);/** 8 * @license lucide-react v0.475.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const Cs=[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]],Re=le("FolderArchive",Cs);/** 13 * @license lucide-react v0.475.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const Fs=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],_s=le("FolderOpen",Fs);/** 18 * @license lucide-react v0.475.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const As=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]],Ns=le("Headphones",As);/** 23 * @license lucide-react v0.475.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const Is=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Ps=le("Lightbulb",Is);/** 28 * @license lucide-react v0.475.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const Ms=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Rs=le("Package",Ms),at=t=>{if(t==null)return"";const s=String(t);return s.includes(",")||s.includes('"')||s.includes(` 33`)?`"${s.replace(/"/g,'""')}"`:s},Ds=t=>ns(t,""),ue=t=>{if(!t)return"";const s=new Date(t);return isNaN(s.getTime())?"":s.toISOString().split("T")[0]},it=["Title","ISRC","UPC","Release Title","Release Date","Duration","Track Number","BPM","Primary Artist","Featured Artists","Label","Genre","Genres","Moods","Language","Version Type","Explicit","Source","Spotify ID","Apple Music ID","Spotify Popularity","Spotify Streams","Spotify Monthly Listeners","Spotify Playlists Count","Spotify Saves","SC Total Streams Spotify","SC Annual Streams Spotify","SC Monthly Streams Spotify","SC Total Views YouTube","SC Annual Views YouTube","SC Monthly Views YouTube","SC Total Shazams","SC Annual Shazams","SC Monthly Shazams","SC Total Streams Deezer","SC Annual Streams Deezer","SC Total Views TikTok","SC Annual Views TikTok","SC Playlist Count","BMI Title Number","BMI ISWC","BMI Registration Date","BMI Songview Status","BMI Participant","BMI Share","BMI IP Number","BMI Current Affiliation","BMI Registration Origin","SX Status","SX SXID","SX Owner","SX Registration Date","SX Basis of Claim","SX Copyright Owner","SX Percentage Claimed","SX Territories","SX P-Line","SX ISWC","SX Composers","SX Publishers","MLC Status","MLC Song Code","MLC ISWC","MLC Confidence","MLC Writers","MLC Publishers","MLC Registration Gap","Composition ID","Composition ISWC","Producers","Engineers","Performers","Recording Year","Country of Recording","Country of Release","Cover Art URL","Audio File URL","Track ID","Created Date","Updated Date"];function Ts({className:t}){const{paid:s}=xe(),[r,n]=p.useState(!1),[i,a]=p.useState(!1),c=async()=>
33{if(!s)return;n(!0),a(!1);const[d,x,u]=await Promise.all([_.entities.Track.list("-created_date",1e4),_.entities.SoundchartsData.list("-created_date",1e4),_.entities.Composition.list("-created_date",5e3)]),h={};for(const o of x)h[o.track_id]=o;const l={};for(const o of u)l[o.id]=o;const g=o=>!o||!Array.isArray(o)?"":o.map(v=>typeof v=="object"?v.name||JSON.stringify(v):v).join("; "),m=d.map(o=>{var U,O,W;const v=h[o.id]||{},A=o.composition_id?l[o.composition_id]:null,N=((O=(U=o.artists)==null?void 0:U[0])==null?void 0:O.name)||"",M=((W=o.artists)==null?void 0:W.filter(k=>k.role==="featured").map(k=>k.name).join("; "))||"";return{Title:o.title||"",ISRC:(o.isrc||"").toUpperCase(),UPC:o.upc||"","Release Title":o.release_title||"","Release Date":ue(o.release_date),Duration:Ds(o.duration_ms),"Track Number":o.track_number||"",BPM:o.bpm||"","Primary Artist":N,"Featured Artists":M,Label:o.label||"",Genre:o.genre||"",Genres:g(o.genres),Moods:g(o.moods),Language:o.language||"","Version Type":o.version_type||"",Explicit:o.explicit?"Yes":"No",Source:o.source||"","Spotify ID":o.spotify_id||"","Apple Music ID":o.apple_music_id||"","Spotify Popularity":o.spotify_popularity||"","Spotify Streams":o.spotify_streams||"","Spotify Monthly Listeners":o.spotify_monthly_listeners||"","Spotify Playlists Count":o.spotify_playlists_count||"","Spotify Saves":o.spotify_saves||"","SC Total Streams Spotify":v.total_streams_spotify||"","SC Annual Streams Spotify":v.annual_streams_spotify||"","SC Monthly Streams Spotify":v.monthly_streams_spotify||"","SC Total Views YouTube":v.total_views_youtube||"","SC Annual Views YouTube":v.annual_views_youtube||"","SC Monthly Views YouTube":v.monthly_views_youtube||"","SC Total Shazams":v.total_shazams||"","SC Annual Shazams":v.annual_shazams||"","SC Monthly Shazams":v.monthly_shazams||"","SC Total Streams Deezer":v.total_streams_deezer||"","SC Annual Streams Deezer":v.annual_streams_deezer||"","SC Total Views TikTok":v.total_views_tiktok||"","SC Annual Views TikTok":v.annual_views_tiktok||"","SC Playlist Count":v.playlist_count||"","BMI Title Number":o.bmi_title_number||"","BMI ISWC":o.bmi_iswc||"","BMI Registration Date":ue(o.bmi_registration_date),"BMI Songview Status":o.bmi_songview_status||"","BMI Participant":o.bmi_participant||"","BMI Share":o.bmi_share||"","BMI IP Number":o.bmi_ip_number||"","BMI Current Affiliation":o.bmi_current_affiliation||"","BMI Registration Origin":o.bmi_registration_origin||"","SX Status":o.soundexchange_status||"","SX SXID":o.sx_sxid||"","SX Owner":o.sx_owner||"","SX Registration Date":ue(o.sx_registration_date),"SX Basis of Claim":o.sx_basis_of_claim||"","SX Copyright Owner":o.sx_copyright_owner_name||"","SX Percentage Claimed":o.sx_percentage_claimed||"","SX Territories":g(o.sx_territories),"SX P-Line":o.sx_p_line||"","SX ISWC":o.sx_iswc||"","SX Composers":g(o.sx_composers),"SX Publishers":g(o.sx_publishers),"MLC Status":o.mlc_status||"","MLC Song Code":o.mlc_song_code||"","MLC ISWC":o.mlc_iswc||"","MLC Confidence":o.mlc_confidence||"","MLC Writers":o.mlc_writers?o.mlc_writers.map(k=>`${k.name} (${k.share||0}%)`).join("; "):"","MLC Publishers":o.mlc_publishers?o.mlc_publishers.map(k=>`${k.name} (${k.share||0}%)`).join("; "):"","MLC Registration Gap":o.mlc_registration_gap||"","Composition ID":o.composition_id||"","Composition ISWC":(A==null?void 0:A.iswc)||"",Producers:o.producers?o.producers.map(k=>`${k.name} (${k.role||""})`).join("; "):"",Engineers:o.engineers?o.engineers.map(k=>`${k.name} (${k.role||""})`).join("; "):"",Performers:o.performers?o.performers.map(k=>`${k.name} (${k.role||""})`).join("; "):"","Recording Year":o.recording_year||"","Country of Recording":o.country_of_recording||"","Country of Release":o.country_of_release||"","Cover Art URL":o.cover_art_url||"","Audio File URL":o.audio_file_url||"","Track ID":o.id||"","Created Date":ue(o.created_date),"Updated Date":ue(o.updated_date)}}),f=it.map(at).join(","),y=m.map(o=>it.map(v=>at(o[v])).join(",")),C="\uFEFF"+[f,...y].join(` 34`),w=new Blob([C],{type:"text/csv;charset=utf-8"}),j=URL.createObjectURL(w),b=document.createElement("a");b.href=j,b.download=`RoyaltyCoPilot_Full_Catalog_${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(j),n(!1),a(!0),setTimeout(()=>a(!1),3e3)};return e.jsx(B,{onClick:c,disabled:r,className:t||"text-white shadow-lg",style:{background:"#7C3AED",boxShadow:"0 4px 14px rgba(124,58,237,0.20)"},children:r?e.jsxs(e.Fragment,{children:[e.jsx(rs,{className:"w-4 h-4 mr-2 animate-spin"}),"Exporting..."]}):i?e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),"Downloaded!"]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"w-4 h-4 mr-2"}),"Export Full Catalog CSV"]})})}function Es({className:t}){const{paid:s}=xe(),[r,n]=p.useState("idle"),i=async()=>{var d,x;if(s){n("working");try{const[u,h,l,g,m,f]=await Promise.all([_.auth.me().catch(()=>null),_.entities.Track.list("-created_date",1e4),_.entities.Work.list("-created_date",5e3).catch(()=>[]),_.entities.Composition.list("-created_date",5e3).catch(()=>[]),_.entities.Writer.list("-created_date",5e3).catch(()=>
34[]),_.entities.Publisher.list("-created_date",2e3).catch(()=>[])]),y=is(u),{queue:C}=as(h,g,l,m,y,{allowPerformance:(u==null?void 0:u.role)==="admin"}),w=C.filter(A=>(A.issues||[]).includes("us_mechanicals"));if(w.length===0){n("empty"),setTimeout(()=>n("idle"),3e3);return}const j=w.map(A=>{var M,U;const N=((M=A.tracks)==null?void 0:M[0])||{};return{...cs(),title:A.title||N.title||"",isrc:N.isrc||"",iswc:((U=A.work)==null?void 0:U.iswc)||N.mlc_iswc||N.sx_iswc||"",upc:N.upc||"",writers:ls(N,A.work||null,m,f),recordingLabel:os(N),trackId:N.id||null,artistName:(N.artists||[]).map(O=>O==null?void 0:O.name).filter(Boolean).join(", "),issues:A.issues,excluded_rights:[]}}),b=await _.functions.invoke("mlcBulkExport",{songs:j}),o=new Date().toISOString().split("T")[0],v=(d=b==null?void 0:b.data)==null?void 0:d.xlsx;if(v){const A=atob(v),N=new Uint8Array(A.length);for(let M=0;M<A.length;M++)N[M]=A.charCodeAt(M);a(new Blob([N],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),`mlc_registration_${o}.xlsx`)}else if((x=b==null?void 0:b.data)!=null&&x.csv)a(new Blob([b.data.csv],{type:"text/csv"}),`mlc_registration_${o}.csv`);else{n("error"),setTimeout(()=>n("idle"),3e3);return}n("done"),setTimeout(()=>n("idle"),3e3)}catch{n("error"),setTimeout(()=>n("idle"),3e3)}}},a=(d,x)=>{const u=URL.createObjectURL(d),h=document.createElement("a");h.href=u,h.download=x,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(u)},c={working:"Generatingâ¦",done:"Downloaded",empty:"Nothing to register",error:"Try again",idle:"Export MLC file"}[r];return e.jsxs(B,{className:t,onClick:i,disabled:r==="working",style:{background:"#7C3AED",boxShadow:"0 4px 14px rgba(124,58,237,0.20)"},children:[e.jsx(be,{style:{width:16,height:16}})," ",c]})}function Bs({className:t}){const[s,r]=p.useState(!1),{paid:n}=xe(),{data:i=[]}=Pe({queryKey:["sx-export-tracks"],queryFn:()=>_.entities.Track.list("-created_date",1e4),enabled:s}),{data:a=[]}=Pe({queryKey:["sx-export-releases"],queryFn:async()=>{try{return await _.entities.Release.list("-created_date",5e3)}catch{return[]}},enabled:s});return e.jsxs(e.Fragment,{children:[e.jsxs(B,{className:t,onClick:()=>{n&&r(!0)},style:{background:"#7C3AED",boxShadow:"0 4px 14px rgba(124,58,237,0.20)"},children:[e.jsx(be,{style:{width:16,height:16}})," Export SoundExchange file"]}),e.jsx(us,{isOpen:s&&n,onClose:()=>r(!1),tracks:i,releases:a,initialScope:"catalog"})]})}function zs({className:t}){const{paid:s}=xe(),[r,n]=p.useState("idle"),[i,a]=p.useState(0),c=(u,h)=>{const l=URL.createObjectURL(u),g=document.createElement("a");g.href=l,g.download=h,document.body.appendChild(g),g.click(),document.body.removeChild(g),URL.revokeObjectURL(l)},d=async()=>{var u,h;if(s){n("working"),a(0);try{const l=await _.functions.invoke("musicReportsBulkExport",{}),g=(u=l==null?void 0:l.data)==null?void 0:u.csv;if(!g){n("empty"),setTimeout(()=>n("idle"),3e3);return}const m=((h=l==null?void 0:l.data)==null?void 0:h.needsAttention)||[];a(m.length),m.length&&console.warn("[MusicReports export] songs needing attention:",m);const f=new Date().toISOString().split("T")[0];c(new Blob([g],{type:"text/csv;charset=utf-8"}),`music_reports_catalog_${f}.csv`),n("done"),setTimeout(()=>n("idle"),4e3)}catch{n("error"),setTimeout(()=>n("idle"),3e3)}}},x={working:"Generatingâ¦",done:i?`Downloaded (${i} need data)`:"Downloaded",empty:"Nothing to export",error:"Try again",idle:"Export Music Reports file"}[r];return e.jsxs(B,{className:t,onClick:d,disabled:r==="working",style:{background:"#7C3AED",boxShadow:"0 4px 14px rgba(124,58,237,0.20)"},children:[e.jsx(be,{style:{width:16,height:16}})," ",x]})}function Ws({exportName:t="export"}){const[s,r]=p.useState(!1),[n,i]=p.useState(""),a=async()=>{if(s)return;i(""),r(!0),Ot("paywall_unlock_clicked",{page:"SettingsExports",export:t,cycle:"monthly"});const c=await $t("monthly");c!=null&&c.error&&(i(c.error),r(!1))};return e.jsxs("div",{className:"shrink-0 w-[220px]",style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"#8b8b90"},children:[e.jsx(Lt,{style:{width:12,height:12}})," Exports are part of the Artist plan"]}),e.jsxs("button",{type:"button",onClick:a,disabled:s,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,width:"100%",padding:"8px 14px",borderRadius:10,border:"none",cursor:s?"default":"pointer",background:"linear-gradient(135deg,#7C3AED,#9333EA)",color:"#FFFFFF",fontWeight:600,fontSize:13},children:[s&&e.jsx(z,{style:{width:14,height:14},className:"animate-spin"}),"Unlock for $12/month"]}),n&&e.jsx("span",{role:"alert",style:{fontSize:11.5,color:"#F87171"},children:n})]})}function He(t){return(t||"").replace(/[^0-9]/g,"")}function ot(t){const s=Array.isArray(t==null?void 0:t.publisher_ipis)?t.publisher_ipis.filter(
34Boolean):[],r=t!=null&&t.publisher_ipi_names&&typeof t.publisher_ipi_names=="object"?t.publisher_ipi_names:{},n=s.map(i=>({ipi:String(i),name:r[String(i)]||""}));return n.length?n:[{ipi:"",name:""}]}function lt({publisherName:t,rows:s}){const r=[],n={};for(const i of s||[]){const a=He(i.ipi);if(a&&!r.includes(a)){r.push(a);const c=(i.name||"").trim();c&&(n[a]=c)}}return{publisher_name:(t||"").trim(),publisher_ipis:r,publisher_ipi_names:n}}function Ls({user:t,onUpdate:s,embedded:r=!1,label:n=""}){var W;const[i,a]=p.useState(!1),[c,d]=p.useState((t==null?void 0:t.publisher_name)||""),[x,u]=p.useState(()=>ot(t)),[h,l]=p.useState(!1),g=p.useRef(null),m=p.useRef(null);p.useEffect(()=>{const k=(t==null?void 0:t.publisher_name)||"",R=ot(t);d(k),u(R),m.current=JSON.stringify(lt({publisherName:k,rows:R}))},[t==null?void 0:t.id]),p.useEffect(()=>{const k=lt({publisherName:c,rows:x}),R=JSON.stringify(k);if(!(m.current===null||R===m.current))return g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await _.auth.updateMe(k),m.current=R,l(!0),setTimeout(()=>l(!1),1500),s==null||s()}catch(T){console.error("Auto-save publisher identity error:",T)}},800),()=>{g.current&&clearTimeout(g.current)}},[c,x]);const f=(k,R,T)=>{u(F=>F.map((I,E)=>E===k?{...I,[R]:He(T)}:I))},y=()=>u(k=>[...k,{ipi:"",name:""}]),C=k=>u(R=>R.length>1?R.filter((T,F)=>F!==k):[{ipi:"",name:""}]),w={fontSize:12,fontWeight:600,color:"#888",display:"block",marginBottom:6},j={width:"100%",padding:"10px 12px",borderRadius:10,border:"1px solid rgba(255,255,255,0.08)",fontSize:13,color:"#FFFFFF",background:"#1A1A1A",boxSizing:"border-box",outline:"none"},b=t!=null&&t.publisher_ipi_sources&&typeof t.publisher_ipi_sources=="object"?t.publisher_ipi_sources:{},o=k=>String(k).replace(/^0+/,"")||String(k),v=[];{const k=new Set;for(const R of x){const T=He(R.ipi);if(!T||k.has(T))continue;k.add(T);const F=(R.name||"").trim(),I=b[T]||"";v.push({ipi:T,name:F,source:I,verified:!!I||!!F})}}const A={background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16},N={fontSize:12.5,fontWeight:600,color:"#8b8b90",margin:0},M={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:8,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.10)",color:"#e4e4e7",fontSize:12.5,fontWeight:500,cursor:"pointer"},U={display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:600,background:"rgba(74,222,128,0.10)",color:"#4ade80",padding:"3px 9px",borderRadius:7,flexShrink:0,textTransform:"capitalize"},O={display:"inline-flex",alignItems:"center",fontSize:11.5,fontWeight:600,background:"rgba(255,255,255,0.05)",color:"#8b8b90",padding:"3px 9px",borderRadius:7,flexShrink:0};return i?e.jsxs("div",{style:r?{padding:"4px 0"}:{...A,padding:"24px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:18},children:[e.jsxs("p",{style:{fontSize:13.5,fontWeight:600,color:"#F5F5F4",margin:0},children:["Edit ",n?n.toLowerCase():"publisher"," identity"]}),e.jsxs("button",{onClick:()=>a(!1),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 14px",borderRadius:8,background:"rgba(124,58,237,0.12)",border:"1px solid rgba(124,58,237,0.28)",color:"#A78BFA",fontSize:12.5,fontWeight:600,cursor:"pointer"},children:[e.jsx(K,{style:{width:13,height:13}})," Done"]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,marginBottom:20},children:[e.jsxs("div",{children:[e.jsxs("label",{style:w,children:[e.jsx(gs,{style:{width:12,height:12,color:"#A78BFA",display:"inline",verticalAlign:"-1px",marginRight:5}}),"Publisher Name"]}),e.jsx("input",{value:c,onChange:k=>d(k.target.value),placeholder:"Your publishing entity",style:j})]}),e.jsxs("div",{children:[e.jsxs("label",{style:w,children:[e.jsx(st,{style:{width:12,height:12,color:"#A78BFA",display:"inline",verticalAlign:"-1px",marginRight:5}}),"IPI Number"]}),e.jsx("input",{value:((W=x[0])==null?void 0:W.ipi)||"",onChange:k=>f(0,"ipi",k.target.value),inputMode:"numeric",placeholder:"01234567890",style:{...j,fontFamily:"monospace"}})]})]}),e.jsxs("div",{children:[x.length>1&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{style:w,children:[e.jsx(st,{style:{width:12,height:12,color:"#A78BFA",display:"inline",verticalAlign:"-1px",marginRight:5}}),"Additional IPI numbers"]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:x.slice(1).map((k,R)=>{const T=R+1;return e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{value:k.ipi,onChange:F=>f(T,"ipi",F.target.value),inputMode:"numeric",placeholder:"01234567890",style:{...j,flex:1,fontFamily:"monospace"}}),e.jsx("button",{onClick:()=>C(T),title:"Remove",style:{padding:"10px 12px",borderRadius:10,border:"1px solid rgba(255,255,255,0.08)",background:"#1A1A1A",color:"#888",cursor:"pointer",display:"flex",alignItems:"center"},children:e.jsx(te,{style:{width:14,height:14}})})]},T)})})]}),e.jsxs("button",{onClick:y,style:{marginTop:10,display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:10,border:"1px solid rgba(124,58,237,0.2)",background:"rgba(124,58,237,0.08)",color:"#A78BFA",fontSize:12,fontWeight:600,cursor:"pointer"},children:[e.jsx(Ke,{style:{width:14,height:14}})," Add another IPI"]})]}),h&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:600,color:"#10B981",marginTop:16},children:[e.jsx(K,{style:{width:12,height:12}})," Saved"]})]}):e.jsxs("div",{style:r?{padding:"4px 0"}:{...A,padding:"8px 20px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:n?"space-between":"flex-end",paddingTop:r?0:12,marginBottom:2},children:[n&&e.jsx("p",{style:N,children:n}),e.jsxs("button",{onClick:()=>a(!0),style:M,children:[e.jsx(Nt,{style:{width:13,height:13,color:"#A78BFA"}})," Edit"]})]}),v.length===0?e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"6px 0 14px"},children:[e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:14,fontWeight:600,color:"#F5F5F4",margin:0},children:"No publisher IPI yet"}),e.jsx("p",{style:{fontSize:12.5,color:"#8b8b90",margin:"2px 0 0"},children:"Add your publishing entity so we can match it across the rights orgs."})]}),e.jsx("button",{onClick:()=>a(!0),style:O,children:"Add IPI"})]}):e.jsx("div",{children:v.map((k,R)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"14px 0",borderTop:R>0?"1px solid rgba(255,255,255,0.06)":"none"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("p",{style:{fontSize:14,fontWeight:600,color:"#F5F5F4",margin:0},children:["IPI ",o(k.ipi)]}),e.jsx("p",{style:{fontSize:12.5,color:"#8b8b90",margin:"2px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.name||c||"Used to match your works across the rights orgs."})]}),k.verified?e.jsxs("span",{style:U,children:[e.jsx(oe,{style:{width:12,height:12}})," ",k.source?`Verified · ${k.source}`:"Verified"]}):e.jsx("span",{style:O,children:"Manual"})]},k.ipi))})]})}function Os({user:t,onUpdate:s}){const[r,n]=p.useState(!1),[i,a]=p.useState(!1),[c,d]=p.useState(""),[x,u]=p.useState(!1),h=p.useRef(null),l=t==null?void 0:t.profile_photo_url,g=(t==null?void 0:t.display_name)||(t==null?void 0:t.full_name)||"User",m=g.trim().split(/\s+/).filter(
34Boolean).slice(0,2).map(o=>o[0]).join("").toUpperCase()||"U",f=(t==null?void 0:t.company_name)||(t==null?void 0:t.publisher_name)||(t==null?void 0:t.company)||"",y=f?`${t.email} · ${f}`:t==null?void 0:t.email,C=async o=>{var N;const v=(N=o.target.files)==null?void 0:N[0];if(!v)return;n(!0);const{file_url:A}=await _.integrations.Core.UploadFile({file:v});await _.auth.updateMe({profile_photo_url:A}),s==null||s(),n(!1)},w=()=>{d((t==null?void 0:t.display_name)||(t==null?void 0:t.full_name)||""),a(!0)},j=async()=>{c.trim()&&(u(!0),await _.auth.updateMe({display_name:c.trim()}),s==null||s(),a(!1),u(!1))},b=()=>{a(!1)};return t?e.jsx("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"24px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[e.jsxs("div",{style:{position:"relative",flexShrink:0},className:"group",children:[e.jsx("div",{style:{width:52,height:52,borderRadius:26,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:l?void 0:"linear-gradient(135deg, #7C3AED, #9333EA)",boxShadow:"0 2px 12px rgba(0,0,0,0.3)"},children:l?e.jsx("img",{src:l,alt:"Profile",style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("span",{style:{fontSize:17,fontWeight:650,color:"#FFF"},children:m})}),e.jsx("button",{onClick:()=>{var o;return(o=h.current)==null?void 0:o.click()},disabled:r,className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{position:"absolute",inset:0,borderRadius:26,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)",cursor:"pointer",border:"none"},children:r?e.jsx(z,{className:"w-5 h-5 text-white animate-spin"}):e.jsx(ps,{className:"w-5 h-5 text-white"})}),e.jsx("input",{ref:h,type:"file",accept:"image/*",className:"hidden",onChange:C})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[i?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(J,{value:c,onChange:o=>d(o.target.value),onKeyDown:o=>{o.key==="Enter"&&j(),o.key==="Escape"&&b()},autoFocus:!0,className:"h-9 text-base font-semibold",style:{maxWidth:240}}),e.jsx("button",{onClick:j,disabled:x,style:{background:"#4ADE80",border:"none",borderRadius:8,padding:"6px 8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:x?e.jsx(z,{className:"w-4 h-4 text-black animate-spin"}):e.jsx(K,{className:"w-4 h-4 text-black"})}),e.jsx("button",{onClick:b,style:{background:"rgba(255,255,255,0.08)",border:"none",borderRadius:8,padding:"6px 8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(te,{className:"w-4 h-4",style:{color:"#666"}})})]}):e.jsx("p",{style:{fontSize:15,fontWeight:650,color:"#FFF",margin:0,letterSpacing:"-0.01em"},children:g}),e.jsx("p",{style:{color:"#8b8b90",fontSize:13,margin:"3px 0 0"},children:y})]}),!i&&e.jsxs("button",{onClick:w,style:{flexShrink:0,display:"inline-flex",alignItems:"center",gap:6,padding:"8px 15px",borderRadius:9,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.10)",color:"#e4e4e7",fontSize:13,fontWeight:500,cursor:"pointer"},children:[e.jsx(Nt,{className:"w-3.5 h-3.5",style:{color:"#A78BFA"}})," Edit"]})]})}):null}function $s({user:t,onUpdate:s}){const{isAdmin:r}=Yt(),n=(t==null?void 0:t.role)==="admin"||r,[i,a]=p.useState(!1),[c,d]=p.useState(!1),[x,u]=p.useState(!1),h=Array.isArray(t==null?void 0:t.watched_artists)&&t.watched_artists.length?t.watched_artists.filter(C=>C&&C.spotify_id):t!=null&&t.primary_artist_spotify_id?[{spotify_id:t.primary_artist_spotify_id,name:t.primary_artist_name||"",image:t.primary_artist_image_url||""}]:[],l=async C=>{var w,j,b;d(!0);try{await _.auth.updateMe({watched_artists:C,primary_artist_spotify_id:((w=C[0])==null?void 0:w.spotify_id)||"",primary_artist_name:((j=C[0])==null?void 0:j.name)||"",primary_artist_image_url:((b=C[0])==null?void 0:b.image)||""}),u(!0),setTimeout(()=>u(!1),2e3),s==null||s()}catch(o){console.error("Save artist error:",o)}d(!1)},g=async C=>{var j,b;a(!1);const w={spotify_id:C.id,name:C.name,image:((b=(j=C.images)==null?void 0:j[0])==null?void 0:b.url)||""};if(n){if(h.some(o=>o.spotify_id===w.spotify_id))return;await l([...h,w])}else await l([w])},m=async C=>{await l(h.filter(w=>w.spotify_id!==C))},f={background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"24px"},y={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 15px",borderRadius:9,border:"1px solid rgba(124,58,237,0.22)",background:"rgba(124,58,237,0.10)",color:"#A78BFA",fontSize:13,fontWeight:600,cursor:"pointer",opacity:c?.6:1,flexShrink:0};return e.jsxs("div",{style:f,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:16,flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:15,fontWeight:650,color:"#fff"},children:"Your artists"}),e.jsx("span",{style:{fontSize:11.5,fontWeight:600,color:"#8b8b90",background:"rgba(255,255,255,0.05)",padding:"3px 9px",borderRadius:7},children:"We watch these for new releases"}),x&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:12,fontWeight:600,color:"#4ADE80"},children:[e.jsx(K,{style:{width:12,height:12}})," Saved"]})]}),e.jsxs("button",{onClick:()=>a(!0),disabled:c,style:y,children:[c?e.jsx(z,{style:{width:14,height:14},className:"animate-spin"}):e.jsx(Ke,{style:{width:14,height:14}}),h.length===0||n?"Add artist":"Change artist"]})]}),h.length===0?e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:0},children:"Pick your Spotify artist so we can watch for new releases."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:h.map((C,w)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:22,overflow:"hidden",flexShrink:0,background:"#2a2a2e",display:"flex",alignItems:"center",justifyContent:"center"},children:C.image?e.jsx("img",{src:C.image,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx(Ut,{style:{width:18,height:18,color:"#666"}})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:15,fontWeight:600,color:"#FFF",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.name||"Unknown artist"}),e.jsx("p",{style:{fontSize:12,color:"#8b8b90",margin:"2px 0 0"},children:w===0?"We watch this artist for new releases.":"Also watched for new releases."})]}),n&&e.jsx("button",{onClick:()=>m(C.spotify_id),disabled:c,title:"Stop watching",style:{padding:"8px 10px",borderRadius:9,border:"1px solid rgba(255,255,255,0.10)",background:"rgba(255,255,255,0.04)",color:"#8b8b90",cursor:"pointer",display:"flex",alignItems:"center",flexShrink:0},children:e.jsx(te,{style:{width:14,height:14}})})]},C.spotify_id||w))}),e.jsx(fe,{open:i,onOpenChange:a,children:e.jsx(ye,{style:{maxWidth:640,padding:0,background:"transparent",border:"none",overflow:"hidden"},children:e.jsx(xs,{onSelect:g})})})]})}const Ys=["1-25","25-100","100-500","500+"],We={background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF",borderRadius:10,fontSize:13};function Us({user:t,accentColor:s}){const[r,n]=p.useState(void 0),[i,a]=p.useState(!1),[c,d]=p.useState((t==null?void 0:t.full_name)||""),[x,u]=p.useState(""),[h,l]=p.useState(""),[g,m]=p.useState(!1),[f,y]=p.useState("");p.useEffect(()=>{t!=null&&t.email&&_.entities.PubAdminApplication.filter({created_by:t.email}).then(w=>
34n((w==null?void 0:w[0])||null)).catch(()=>n(null))},[t==null?void 0:t.email]);const C=async()=>{if(!c.trim()){y("Please enter your name.");return}m(!0),y("");try{const w=await _.entities.PubAdminApplication.create({name:c.trim(),email:t.email,catalog_size:x||void 0,notes:h.trim()||void 0,status:"new"});n(w),a(!1)}catch{y("We could not save your application. Please try again.")}finally{m(!1)}};return r===void 0?e.jsx(B,{disabled:!0,style:{width:"100%",background:`${s}20`,color:s,fontWeight:700},children:"Loading..."}):r?e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:7,padding:"10px 0",borderRadius:8,background:`${s}20`,color:s,fontSize:13,fontWeight:700},children:[e.jsx(H,{style:{width:15,height:15}})," Application received"]}):i?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx(J,{value:c,onChange:w=>d(w.target.value),placeholder:"Your name",style:We}),e.jsxs("select",{value:x,onChange:w=>u(w.target.value),style:{...We,padding:"9px 12px",width:"100%"},children:[e.jsx("option",{value:"",children:"How many songs?"}),Ys.map(w=>e.jsx("option",{value:w,children:w},w))]}),e.jsx("textarea",{value:h,onChange:w=>l(w.target.value),placeholder:"Anything we should know (optional)",rows:3,style:{...We,padding:"9px 12px",width:"100%",resize:"vertical",fontFamily:"inherit"}}),f&&e.jsx("p",{style:{fontSize:12,color:"#F87171",margin:0},children:f}),e.jsx(B,{onClick:C,disabled:g,style:{width:"100%",background:s,color:"#FFF",fontWeight:700},children:g?e.jsx(z,{className:"animate-spin",style:{width:16,height:16}}):"Send application"})]}):e.jsx(B,{onClick:()=>a(!0),style:{width:"100%",background:s,color:"#FFF",fontWeight:700},children:"Apply"})}function Vs(){const[t,s]=p.useState(null);return p.useEffect(()=>{_.entities.PubAdminApplication.list("-created_date",200).then(s).catch(()=>s([]))},[]),e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:24},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:650,color:"#FFF",marginBottom:2},children:"Publishing Admin applications"}),e.jsx("p",{style:{fontSize:12,color:"#8b8b90",marginBottom:14},children:"Admin only. Everyone who applied for the 10% plan, newest first."}),t===null?e.jsx(z,{className:"animate-spin",style:{width:18,height:18,color:"#8b8b90"}}):t.length===0?e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:0},children:"No applications yet."}):e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[e.jsx("thead",{children:e.jsx("tr",{style:{color:"#55555a",fontSize:11,textTransform:"uppercase",letterSpacing:"0.08em",textAlign:"left"},children:["Name","Email","Songs","Notes","Status","Applied"].map(r=>e.jsx("th",{style:{padding:"6px 10px 8px",fontWeight:600},children:r},r))})}),e.jsx("tbody",{children:t.map(r=>e.jsxs("tr",{style:{borderTop:"1px solid rgba(255,255,255,0.06)",color:"#d4d4d8",verticalAlign:"top"},children:[e.jsx("td",{style:{padding:"9px 10px",whiteSpace:"nowrap"},children:r.name}),e.jsx("td",{style:{padding:"9px 10px",whiteSpace:"nowrap"},children:r.email}),e.jsx("td",{style:{padding:"9px 10px",whiteSpace:"nowrap"},children:r.catalog_size||""}),e.jsx("td",{style:{padding:"9px 10px",color:"#8b8b90",maxWidth:360},children:r.notes||""}),e.jsx("td",{style:{padding:"9px 10px",whiteSpace:"nowrap"},children:r.status||"new"}),e.jsx("td",{style:{padding:"9px 10px",whiteSpace:"nowrap",color:"#8b8b90"},children:r.created_date?new Date(r.created_date).toLocaleDateString():""})]},r.id))})]})})]})}function qs(){const[t,s]=p.useState(null),[r,n]=p.useState(null),[i,a]=p.useState(!0),[c,d]=p.useState(!1),[x,u]=p.useState(""),[h,l]=p.useState(!1),[g,m]=p.useState(""),[f,y]=p.useState(""),[C,w]=p.useState(""),[j,b]=p.useState("monthly");p.useEffect(()=>{o();const L=new URLSearchParams(window.location.search).get("status");L==="success"?(y("â
Subscription activated! Your plan is now active."),_.analytics.track({eventName:"user_plan_updated",properties:{payment_status:"success"}}),setTimeout(()=>y(""),5e3)):L==="cancel"&&(y("â Payment canceled."),setTimeout(()=>y(""),5e3))},[]);const o=async()=>{try{const S=await _.auth.me();s(S);const L=await _.functions.invoke("getPlanLimits",{});n(L.data)}catch(S){console.error("Error fetching data:",S)}finally{a(!1)}},v=async(S,L)=>{var de,je,we,tt;if(window.self!==window.top){alert("Checkout only works from a published app. Please publish your app first.");return}d(!0);try{let V;try{V=sessionStorage.getItem(qt)||void 0}catch{}const Be=await _.functions.invoke("stripeCheckout",{plan:S,billingCycle:L,referralCode:V});Be.data.url?window.location.href=Be.data.url:w(((de=Be.data)==null?void 0:de.error)||"We could not start checkout. Please try again.")}catch(V){console.error("Checkout error:",V),w(((we=(je=V==null?void 0:V.response)==null?void 0:je.data)==null?void 0:we.error)||((tt=V==null?void 0:V.data)==null?void 0:tt.error)||"We could not start checkout. Please try again, or email [email protected].")}finally{d(!1)}},A=async S=>{d(!0);try{const L=await _.functions.invoke("stripePortal",S?{flow:S}:{});L.data.url?window.location.href=L.data.url:alert("Failed to open subscription management")}catch(L){console.error("Portal error:",L),alert("Failed to open subscription management: "+L.message)}finally{d(!1)}},N=async()=>
34{if(!x.trim()){m("Please enter a promo code");return}l(!0),m("");try{const S=await _.functions.invoke("validatePromoCode",{code:x});S.data.valid?(m("â
"+S.data.message),u(""),_.analytics.track({eventName:"user_plan_updated",properties:{new_plan:"promo",payment_status:"promo_redeemed"}}),setTimeout(()=>o(),1e3)):m("â "+S.data.message)}catch(S){m("â Error validating code: "+S.message)}finally{l(!1)}};if(i)return e.jsx("div",{style:{textAlign:"center",padding:"40px 20px"},children:e.jsx(z,{className:"animate-spin",style:{width:24,height:24,margin:"0 auto"}})});const M=(t==null?void 0:t.plan)||"free_scan",O={free_scan:"Free Scan",copilot:"Artist",admin:"Publishing Admin",snapshot:"Free Scan",starter:"Artist",artist:"Artist",artist_unlimited:"Artist",management:"Publishing Admin",free:"Free Scan",pro:"Artist",pro_plus:"Artist",label:"Publishing Admin"}[M]||M,W=O==="Free Scan",k=O==="Publishing Admin",R=k?oe:W?Vt:Ye,T=k?"#4ADE80":W?"#8b8b90":"#A78BFA",F=k?"rgba(74,222,128,0.14)":W?"rgba(255,255,255,0.06)":"rgba(124,58,237,0.14)",I=t!=null&&t.subscription_renews_at?new Date(t.subscription_renews_at).toLocaleDateString():null,E=(t==null?void 0:t.subscription_status)==="past_due"?{label:"Past due",color:"#f87171",bg:"rgba(248,113,113,0.10)"}:W?{label:"Free",color:"#8b8b90",bg:"rgba(255,255,255,0.05)"}:{label:"Active",color:"#4ade80",bg:"rgba(74,222,128,0.10)"},D=W?"Free forever":I?`Renews ${I}`:"Active subscription",G={fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",marginBottom:12},ce=[{id:"free_scan",name:"Free Scan",price:"$0",period:"forever",description:"See what you are missing before you pay",features:["1 Royalty Profile","Connect sources","Run scan","Estimated missing total","Issue counts by category","No song-level detail","No fixes or registrations"],plan:null,accentColor:"#666666"},{id:"copilot",name:"Artist",price:j==="yearly"?"$120":"$12",period:j==="yearly"?"per year":"per month",description:"Self-serve royalty repair for 1 Royalty Profile",popular:!0,features:["Everything in Free Scan","Full issue detail for every song","Guided fixes & registrations","Monthly monitoring","Basic royalty dashboard",j==="yearly"?"Billed annually, about 2 months free":"Also available annually: $120/yr"],plan:"copilot",accentColor:"#7C3AED"},{id:"pub_admin",name:"Publishing Admin",price:"10%",period:"of what we collect",description:"We handle everything. By application.",features:["Everything in Artist","We register and claim for you","We collect and pay you out","10% only on money we actually collect","No monthly fee"],plan:null,apply:!0,accentColor:"#4ADE80"}],X=S=>M===S||["snapshot","free"].includes(M)&&S==="free_scan"||["starter","artist","artist_unlimited","pro","pro_plus"].includes(M)&&S==="copilot"||["admin","management","label"].includes(M)&&S==="pub_admin"?"CURRENT":null,$=S=>!!X(S);return e.jsxs("div",{className:"space-y-6",children:[f&&e.jsx("div",{style:{background:"rgba(16, 185, 129, 0.10)",border:"1px solid rgba(16, 185, 129, 0.25)",borderRadius:12,padding:"14px 16px",color:"#10B981",fontSize:14},children:f}),C&&e.jsxs("div",{style:{background:"rgba(239, 68, 68, 0.10)",border:"1px solid rgba(239, 68, 68, 0.25)",borderRadius:12,padding:"14px 16px",display:"flex",alignItems:"flex-start",gap:10},children:[e.jsx(q,{style:{width:18,height:18,color:"#EF4444",flexShrink:0,marginTop:1}}),e.jsx("p",{style:{fontSize:13.5,color:"#F87171",margin:0,flex:1},children:C}),e.jsx("button",{onClick:()=>w(""),style:{background:"transparent",border:0,color:"#F87171",cursor:"pointer",fontSize:18,lineHeight:1,padding:0},"aria-label":"Dismiss",children:"Ã"})]}),(t==null?void 0:t.subscription_status)==="past_due"&&e.jsxs("div",{style:{background:"rgba(239, 68, 68, 0.10)",border:"1px solid rgba(239, 68, 68, 0.25)",borderRadius:12,padding:"14px 16px",display:"flex",alignItems:"center",gap:10},children:[e.jsx(q,{style:{width:18,height:18,color:"#EF4444",flexShrink:0}}),e.jsxs("div",{style:{flex:1},children:[e.jsx("p",{style:{fontSize:14,color:"#EF4444",fontWeight:600,margin:0},children:"Payment Failed"}),e.jsx("p",{style:{fontSize:12,color:"#F87171",margin:"2px 0 0"},children:"Update your payment method to keep your plan active."})]}),e.jsx(B,{onClick:()=>A(),style:{background:"#EF4444",color:"#FFF",whiteSpace:"nowrap",flexShrink:0},size:"sm",children:"Update Payment"})]}),e.jsxs("div",{children:[e.jsx("p",{style:G,children:"Current plan"}),e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"20px 22px",display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:12,background:F,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(R,{style:{width:21,height:21,color:T}})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:16,fontWeight:650,color:"#f5f5f4"},children:O}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,fontWeight:600,background:E.bg,color:E.color,padding:"3px 9px",borderRadius:7},children:[e.jsx(H,{style:{width:12,height:12}})," ",E.label]})]}),e.jsx("div",{style:{fontSize:13,color:"#8b8b90",marginTop:3,fontVariantNumeric:"tabular-nums"},children:D})]})]}),(t==null?void 0:t.stripe_customer_id)&&e.jsxs("button",{onClick:()=>A(),disabled:c,style:{display:"inline-flex",alignItems:"center",gap:6,background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.10)",color:"#e4e4e7",fontSize:13,fontWeight:500,padding:"9px 15px",borderRadius:9,cursor:c?"default":"pointer",flexShrink:0},children:[e.jsx(It,{style:{width:14,height:14}})," ",c?"Loadingâ¦":"Manage"]})]})]}),(M==="free_scan"||M==="snapshot"||M==="free")&&!(t!=null&&t.promo_code_used)&&e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"24px"},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:650,letterSpacing:"-0.01em",color:"#FFFFFF",marginBottom:12},children:"Have a promo code?"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx(J,{type:"text",value:x,onChange:S=>u(S.target.value),placeholder:"Enter promo code",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",color:"#FFFFFF",borderRadius:10},disabled:h}),e.jsx(B,{onClick:N,disabled:h,style:{background:"#7C3AED",padding:"10px 20px",whiteSpace:"nowrap"},children:h?e.jsx(z,{className:"animate-spin",style:{width:16,height:16}}):"Redeem"})]}),g&&e.jsx("p",{style:{fontSize:12,color:g.startsWith("â
")?"#10B981":"#EF4444",marginTop:10},children:g})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16,flexWrap:"wrap",gap:12},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",margin:0},children:"All plans"}),e.jsxs("div",{style:{display:"inline-flex",borderRadius:999,background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.08)",padding:4},children:[e.jsx("button",{onClick:()=>b("monthly"),style:{padding:"6px 16px",borderRadius:999,border:"none",cursor:"pointer",fontSize:13,fontWeight:600,background:j==="monthly"?"#7C3AED":"transparent",color:j==="monthly"?"#FFF":"rgba(255,255,255,0.5)",transition:"all 0.2s"},children:"Monthly"}),e.jsxs("button",{onClick:()=>b("yearly"),style:{padding:"6px 16px",borderRadius:999,border:"none",cursor:"pointer",fontSize:13,fontWeight:600,background:j==="yearly"?"#7C3AED":"transparent",color:j==="yearly"?"#FFF":"rgba(255,255,255,0.5)",transition:"all 0.2s"},children:["Annual ",e.jsx("span",{style:{fontSize:10,opacity:.7},children:"Artist"})]})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:14},children:ce.map(S=>
34{const L=$(S.id),de=X(S.id);return e.jsxs("div",{style:{background:"#161618",border:L?`1.5px solid ${S.accentColor}`:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"20px 18px",position:"relative",display:"flex",flexDirection:"column"},children:[de&&e.jsx("div",{style:{position:"absolute",top:-12,right:16,background:S.accentColor,color:"#FFF",padding:"4px 12px",borderRadius:20,fontSize:10,fontWeight:700},children:de}),S.popular&&!L&&e.jsx("div",{style:{position:"absolute",top:-12,left:"50%",transform:"translateX(-50%)",background:"#7C3AED",color:"#FFF",padding:"4px 14px",borderRadius:20,fontSize:10,fontWeight:700,whiteSpace:"nowrap"},children:"Recommended"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:650,color:"#FFF",marginBottom:2},children:S.name}),e.jsx("p",{style:{fontSize:11.5,color:"#8b8b90",marginBottom:12},children:S.description}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("span",{style:{fontSize:24,fontWeight:700,letterSpacing:"-0.02em",color:"#FFF",fontVariantNumeric:"tabular-nums"},children:S.price}),e.jsxs("span",{style:{fontSize:11,color:"#B3B3B3",marginLeft:3},children:[S.period!=="forever"&&!S.apply&&"/",S.period]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:7,marginBottom:18},children:S.features.map((je,we)=>e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"flex-start"},children:[e.jsx(H,{style:{width:14,height:14,color:S.accentColor,marginTop:2,flexShrink:0}}),e.jsx("span",{style:{fontSize:12,color:"#B3B3B3",lineHeight:1.4},children:je})]},we))})]}),L?e.jsx(B,{disabled:!0,style:{width:"100%",background:`${S.accentColor}20`,color:S.accentColor,fontWeight:700},children:"Current Plan"}):S.apply?e.jsx(Us,{user:t,accentColor:S.accentColor}):e.jsx(B,{onClick:()=>v(S.plan,S.id==="copilot"?j:"monthly"),disabled:!S.plan||c,style:{width:"100%",background:S.plan?S.accentColor:`${S.accentColor}20`,color:S.plan?"#FFF":S.accentColor,fontWeight:700},children:S.plan?c?"Loading...":`Get ${S.name}`:"Free Forever"})]},S.id)})})]}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start",background:"rgba(124,58,237,0.06)",border:"1px solid rgba(124,58,237,0.16)",borderRadius:12,padding:"13px 15px",fontSize:12.5,color:"#c7b8f0",lineHeight:1.5},children:[e.jsx(q,{style:{width:16,height:16,color:"#A78BFA",flexShrink:0,marginTop:1}}),e.jsxs("div",{children:["Plans renew automatically. Cancel anytime from Manage, you keep access until the period ends. Publishing Admin has no monthly fee: 10% comes out of royalties we actually collect for you, nothing else.",e.jsxs("div",{style:{marginTop:6},children:["Managing a team or artist roster? Email ",e.jsx("a",{href:"mailto:[email protected]",style:{color:"#A78BFA",fontWeight:600,textDecoration:"underline"},children:"[email protected]"})," and we'll set you up."]})]})]})]})}const ct={starter:{bg:"rgba(59,130,246,0.12)",color:"#60A5FA",label:"Starter"},pro:{bg:"rgba(124,58,237,0.12)",color:"#A78BFA",label:"Pro"},label:{bg:"rgba(245,158,11,0.12)",color:"#FCD34D",label:"Label"}};function Hs(){const t=Xe(),[s,r]=p.useState(!1),[n,i]=p.useState({code:"",plan:"pro",description:"",max_uses:"",expires_at:""}),{data:a=[],isLoading:c}=Pe({queryKey:["promo-codes"],queryFn:()=>_.entities.PromoCode.list("-created_date",100)}),d=ze({mutationFn:l=>_.entities.PromoCode.create(l),onSuccess:()=>{t.invalidateQueries({queryKey:["promo-codes"]}),r(!1),i({code:"",plan:"pro",description:"",max_uses:"",expires_at:""})}}),x=ze({mutationFn:({id:l,is_active:g})=>_.entities.PromoCode.update(l,{is_active:g}),onSuccess:()=>t.invalidateQueries({queryKey:["promo-codes"]})}),u=ze({mutationFn:l=>_.entities.PromoCode.delete(l),onSuccess:()=>t.invalidateQueries({queryKey:["promo-codes"]})}),h=()=>{const l={code:n.code.trim().toUpperCase(),plan:n.plan,description:n.description.trim()||void 0,is_active:!0,uses_count:0,max_uses:n.max_uses?parseInt(n.max_uses):0,expires_at:n.expires_at||void 0};d.mutate(l)};return e.jsxs("div",{style:{background:"#161616",border:"1px solid rgba(255,255,255,0.08)",borderRadius:16,padding:"24px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(fs,{style:{width:18,height:18,color:"#A78BFA"}}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:16,fontWeight:700,color:"#FFF",margin:0},children:"Promo Codes"}),e.jsx("p",{style:{fontSize:12,color:"#666",margin:0}
34,children:"Admin-only â create one-off codes to gift plans"})]})]}),e.jsxs(B,{onClick:()=>r(!0),style:{background:"#7C3AED",color:"#FFF",display:"flex",alignItems:"center",gap:6,fontSize:13},size:"sm",children:[e.jsx(Ke,{style:{width:14,height:14}})," New Code"]})]}),c?e.jsx("div",{style:{textAlign:"center",padding:24},children:e.jsx(z,{className:"animate-spin",style:{width:20,height:20,margin:"0 auto",color:"#666"}})}):a.length===0?e.jsx("p",{style:{fontSize:13,color:"#444",textAlign:"center",padding:"24px 0"},children:"No promo codes yet. Create one above."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:a.map(l=>{const g=ct[l.plan]||ct.pro,m=l.expires_at&&new Date(l.expires_at)<new Date,f=l.max_uses>0&&l.uses_count>=l.max_uses;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",background:"#1A1A1A",borderRadius:10,border:"1px solid rgba(255,255,255,0.05)",opacity:!l.is_active||m||f?.6:1},children:[e.jsx("code",{style:{fontSize:14,fontWeight:700,color:"#FFF",fontFamily:"monospace",minWidth:100},children:l.code}),e.jsx("span",{style:{fontSize:11,fontWeight:700,padding:"2px 8px",borderRadius:999,background:g.bg,color:g.color},children:g.label}),l.description&&e.jsx("span",{style:{fontSize:12,color:"#666",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.description}),e.jsx("div",{style:{flex:1}}),e.jsxs("span",{style:{fontSize:12,color:"#555",whiteSpace:"nowrap"},children:[l.uses_count||0,l.max_uses>0?`/${l.max_uses}`:""," uses"]}),l.expires_at&&e.jsx("span",{style:{fontSize:11,color:m?"#EF4444":"#666",whiteSpace:"nowrap"},children:m?"Expired":`Exp ${new Date(l.expires_at).toLocaleDateString()}`}),e.jsx(kt,{checked:l.is_active,onCheckedChange:y=>x.mutate({id:l.id,is_active:y}),disabled:x.isPending}),e.jsx("button",{onClick:()=>u.mutate(l.id),style:{padding:6,borderRadius:6,background:"rgba(239,68,68,0.08)",border:"none",cursor:"pointer",color:"#EF4444",flexShrink:0},children:e.jsx(Ue,{style:{width:13,height:13}})})]},l.id)})}),e.jsx(fe,{open:s,onOpenChange:r,children:e.jsxs(ye,{style:{background:"#161616",border:"1px solid rgba(255,255,255,0.1)",borderRadius:16},children:[e.jsx(Ge,{children:e.jsx(Qe,{style:{color:"#FFF"},children:"Create Promo Code"})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14,paddingTop:4},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"#9CA3AF",display:"block",marginBottom:6},children:"Code *"}),e.jsx(J,{value:n.code,onChange:l=>i(g=>({...g,code:l.target.value.toUpperCase()})),placeholder:"e.g. LAUNCH2026",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF",fontFamily:"monospace",fontWeight:700}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"#9CA3AF",display:"block",marginBottom:6},children:"Plan *"}),e.jsxs(Ct,{value:n.plan,onValueChange:l=>i(g=>({...g,plan:l})),children:[e.jsx(Ft,{style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF"},children:e.jsx(_t,{})}),e.jsxs(At,{children:[e.jsx(Ie,{value:"starter",children:"Starter"}),e.jsx(Ie,{value:"pro",children:"Pro"}),e.jsx(Ie,{value:"label",children:"Label"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"#9CA3AF",display:"block",marginBottom:6},children:"Description (internal note)"}),e.jsx(J,{value:n.description,onChange:l=>i(g=>({...g,description:l.target.value})),placeholder:"e.g. For SXSW partner Jane Doe",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF"}})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"#9CA3AF",display:"block",marginBottom:6},children:"Max Uses (0 = unlimited)"}),e.jsx(J,{type:"number",min:"0",value:n.max_uses,onChange:l=>i(g=>({...g,max_uses:l.target.value})),placeholder:"0",style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"#9
34CA3AF",display:"block",marginBottom:6},children:"Expires At (optional)"}),e.jsx(J,{type:"date",value:n.expires_at,onChange:l=>i(g=>({...g,expires_at:l.target.value})),style:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF"}})]})]})]}),e.jsxs(jt,{style:{marginTop:8},children:[e.jsx(B,{variant:"ghost",onClick:()=>r(!1),style:{color:"#9CA3AF"},children:"Cancel"}),e.jsx(B,{onClick:h,disabled:!n.code||!n.plan||d.isPending,style:{background:"#7C3AED",color:"#FFF"},children:d.isPending?e.jsx(z,{className:"animate-spin",style:{width:14,height:14}}):"Create Code"})]})]})})]})}const Xs=[{value:"free_scan",label:"Free Scan"},{value:"copilot",label:"Artist"},{value:"admin",label:"Publishing Admin (10%)"}];function Gs(){const[t,s]=p.useState(""),[r,n]=p.useState("copilot"),[i,a]=p.useState(!1),[c,d]=p.useState(null),x=async()=>{var u,h;if(t.trim()){a(!0),d(null);try{const l=await _.functions.invoke("grantPlanAccess",{email:t.trim(),plan:r});d({ok:!0,msg:`${l.data.user.email} is now on the ${l.data.plan} plan.`}),s("")}catch(l){const g=((h=(u=l==null?void 0:l.response)==null?void 0:u.data)==null?void 0:h.error)||l.message||"Failed to grant access";d({ok:!1,msg:g})}a(!1)}};return e.jsxs("div",{className:"rc-card",style:{padding:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:4},children:[e.jsx(oe,{style:{width:18,height:18,color:"#A78BFA"}}),e.jsx("h3",{style:{fontSize:15,fontWeight:600,color:"#FFFFFF",margin:0},children:"Grant Plan Access"})]}),e.jsx("p",{style:{fontSize:13,color:"#666666",margin:"0 0 16px"},children:"Manually assign a plan to a user by email (after a payment that didn't sync, or to accept a Publishing Admin applicant)."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx(J,{placeholder:"[email protected]",value:t,onChange:u=>s(u.target.value),type:"email"}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsxs(Ct,{value:r,onValueChange:n,children:[e.jsx(Ft,{style:{flex:1},children:e.jsx(_t,{})}),e.jsx(At,{children:Xs.map(u=>e.jsx(Ie,{value:u.value,children:u.label},u.value))})]}),e.jsx("button",{className:"rc-btn-primary",onClick:x,disabled:i||!t.trim(),children:i?e.jsx(z,{style:{width:16,height:16},className:"animate-spin"}):"Grant"})]}),c&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderRadius:10,background:c.ok?"rgba(74,222,128,0.10)":"rgba(239,68,68,0.10)",color:c.ok?"#4ADE80":"#EF4444",fontSize:13},children:[c.ok?e.jsx(H,{style:{width:16,height:16,flexShrink:0}}):e.jsx(q,{style:{width:16,height:16,flexShrink:0}}),e.jsx("span",{children:c.msg})]})]})]})}const Qs=["instrumental","inst","clean","radio","radio edit","remix","live","acoustic","extended","acapella","alt"];function Zs(t){const s=["wav","mp3","aiff","flac"],r=[],n=[],i=new Set;for(const u of t){const h=u.split(".").pop().toLowerCase();if(!s.includes(h))continue;const l=u.split("/"),g=l[l.length-1];if(l.length>1){const y=l.slice(0,-1).filter(C=>C.trim()).pop();y&&i.add(y)}const m=g.replace(/\.[^/.]+$/,"").toLowerCase();let f=!1;for(const y of Qs)if(m.includes(y)){f=!0;break}f?n.push(g):r.push(g)}const a=/[A-Z]{2}[A-Z0-9]{3}\d{2}\d{5}/i,c=t.filter(u=>a.test(u)).length,d=r.length+n.length,x=d-c;return{totalTracks:d,uniqueTracks:r.length,alternateVersions:n.length,playlists:i.size,missingIsrc:Math.max(0,x),folderNames:Array.from(i)}}const Js=[{id:"upload",label:"Uploading files"},{id:"parse",label:"Parsing metadata"},{id:"group",label:"Grouping versions"},{id:"create",label:"Creating releases"},{id:"check",label:"Checking registrations"}];function dt({fileNames:t,phase:s,uploadProgress:r,summary:n,currentStep:i}){const[a,c]=p.useState(null),[d,x]=p.useState(!1),[u,h]=p.useState(!1);if(p.useEffect(()=>{if(t&&t.length>0){const f=Zs(t);c(f);const y=setTimeout(()=>x(!0),300);return()=>clearTimeout(y)}},[t]),p.useEffect(()=>{if(s==="processing"&&a){const f=setTimeout(()=>h(!0),3e3);return()=>clearTimeout(f)}},[s,a]),!a)return null;const l=s==="uploading"||s==="processing",g=s==="summary",m=s==="uploading"?0:i==="parse"?1:i==="group"?2:i==="create"?3:i==="check"?4:s==="processing"?1:g?5:0;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ve,{children:d&&!g&&e.jsxs(ie.div,{initial:{opacity:0,y:10}
34,animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.4},className:"rounded-2xl overflow-hidden",style:{background:"linear-gradient(135deg, rgba(124,58,237,0.08) 0%, rgba(79,70,229,0.04) 100%)",border:"1px solid rgba(124,58,237,0.15)"},children:[e.jsxs("div",{className:"px-5 py-4 flex items-center gap-3 border-b border-white/5",children:[e.jsx(ks,{className:"w-4 h-4 text-purple-400"}),e.jsx("span",{className:"text-sm font-semibold text-white",children:"Analyzing your catalogâ¦"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-px",style:{background:"rgba(255,255,255,0.03)"},children:[e.jsx(ke,{value:a.totalTracks,label:"tracks detected",color:"#A78BFA",delay:.1}),e.jsx(ke,{value:a.alternateVersions,label:"alternate versions",color:"#22D3EE",delay:.3}),e.jsx(ke,{value:a.missingIsrc,label:"tracks missing ISRC",color:"#F59E0B",delay:.5,warn:!0}),e.jsx(ke,{value:a.playlists,label:a.playlists===1?"playlist detected":"playlists detected",color:"#4ADE80",delay:.7})]})]})}),l&&e.jsxs(ie.div,{initial:{opacity:0},animate:{opacity:1},className:"rounded-xl p-4 space-y-2",style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("p",{className:"text-xs font-semibold text-zinc-500 uppercase tracking-wider mb-3",children:"Building your catalogâ¦"}),Js.map((f,y)=>{const C=y<m,w=y===m;return e.jsxs("div",{className:"flex items-center gap-3",children:[C?e.jsx(H,{className:"w-4 h-4 text-emerald-400 flex-shrink-0"}):w?e.jsxs("div",{className:"w-4 h-4 flex-shrink-0 relative",children:[e.jsx("div",{className:"absolute inset-0 rounded-full bg-purple-500/30 animate-ping"}),e.jsx("div",{className:"absolute inset-0.5 rounded-full bg-purple-500"})]}):e.jsx(ms,{className:"w-4 h-4 text-zinc-700 flex-shrink-0"}),e.jsxs("span",{className:`text-sm ${C?"text-zinc-400":w?"text-white font-medium":"text-zinc-600"}`,children:[f.label,w&&s==="uploading"&&y===0&&e.jsxs("span",{className:"text-purple-400 ml-2 text-xs",children:[r,"%"]})]})]},f.id)})]}),e.jsx(Ve,{children:u&&l&&a.missingIsrc>0&&e.jsx(ie.div,{initial:{opacity:0,y:10,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0},className:"rounded-xl p-4",style:{background:"rgba(245,158,11,0.06)",border:"1px solid rgba(245,158,11,0.15)"},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(se,{className:"w-4 h-4 text-amber-400 mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-amber-300",children:"We found something important"}),e.jsxs("p",{className:"text-sm text-amber-200/70 mt-1",children:[e.jsxs("span",{className:"font-bold text-amber-300",children:[a.missingIsrc," tracks"]})," appear to be missing ISRC codes â this could affect royalty collection."]})]})]})})})]})}function ke({value:t,label:s,color:r,delay:n,warn:i}){const[a,c]=p.useState(!1);return p.useEffect(()=>{const d=setTimeout(()=>c(!0),n*1e3);return()=>clearTimeout(d)},[n]),e.jsxs(ie.div,{initial:{opacity:0}
34,animate:{opacity:a?1:0},className:"p-4",style:{background:"rgba(0,0,0,0.2)"},children:[e.jsx(Ks,{value:t,color:r}),e.jsx("p",{className:`text-xs mt-0.5 ${i&&t>0?"text-amber-400/70":"text-zinc-500"}`,children:s})]})}function Ks({value:t,color:s}){const[r,n]=p.useState(0),i=p.useRef(null);return p.useEffect(()=>{const c=performance.now(),d=x=>{const u=Math.min((x-c)/600,1),h=1-Math.pow(1-u,3);n(Math.round(h*t)),u<1&&(i.current=requestAnimationFrame(d))};return i.current=requestAnimationFrame(d),()=>{i.current&&cancelAnimationFrame(i.current)}},[t]),e.jsx("span",{className:"text-2xl font-bold",style:{color:s},children:r})}const en=[".wav",".mp3",".aiff",".flac",".zip"],tn=".wav,.mp3,.aiff,.flac,.zip,audio/wav,audio/mpeg,audio/aiff,audio/flac,application/zip";function ut(t){return t<1024?t+" B":t<1048576?(t/1024).toFixed(1)+" KB":(t/1048576).toFixed(1)+" MB"}function Mt({open:t,onClose:s,onSuccess:r}){const[n,i]=p.useState([]),[a,c]=p.useState("select"),[d,x]=p.useState(0),[u,h]=p.useState(null),[l,g]=p.useState(null),[m,f]=p.useState(!1),[y,C]=p.useState([]),[w,j]=p.useState(null),b=p.useRef(null),o=p.useRef(null),v=p.useCallback(F=>{var I;F.preventDefault(),F.stopPropagation(),(I=o.current)==null||I.classList.add("border-purple-500","bg-purple-500/10")},[]),A=p.useCallback(F=>{var I;F.preventDefault(),F.stopPropagation(),(I=o.current)==null||I.classList.remove("border-purple-500","bg-purple-500/10")},[]),N=p.useCallback(F=>{var E;F.preventDefault(),F.stopPropagation(),(E=o.current)==null||E.classList.remove("border-purple-500","bg-purple-500/10");const I=Array.from(F.dataTransfer.files).filter(D=>{const G="."+D.name.split(".").pop().toLowerCase();return en.includes(G)});I.length>0&&i(D=>[...D,...I])},[]),M=F=>{const I=Array.from(F.target.files||[]);I.length>0&&i(E=>[...E,...I]),F.target.value=""},U=F=>{i(I=>I.filter((E,D)=>D!==F))},O=async()=>{var I,E;g(null),j(null),c("analyzing");const F=[];for(const D of n)if(D.name.toLowerCase().endsWith(".zip"))try{const G=(await Qt(async()=>{const{default:$}=await import("./jszip.min-ZJIFMD3b.js").then(S=>S.j);return{default:$}},__vite__mapDeps([0,1,2]))).default,ce=await D.arrayBuffer(),X=await G.loadAsync(ce);for(const $ of Object.keys(X.files))if(!X.files[$].dir){const S=$.split(".").pop().toLowerCase();["wav","mp3","aiff","flac"].includes(S)&&F.push($)}}catch{F.push(D.name)}else F.push(D.name);C(F),await new Promise(D=>setTimeout(D,1200)),c("uploading"),x(0);try{const D=[],G=[];for(let $=0;$<n.length;$++){x(Math.round($/n.length*100));try{const{file_url:S}=await _.integrations.Core.UploadFile({file:n[$]});D.push(S),G.push(n[$].name)}catch(S){console.error(`Failed to upload ${n[$].name}:`,S)}}if(x(100),D.length===0){g("All file uploads failed. Please check your files and try again."),c("select");return}c("processing"),j("parse");const ce=[setTimeout(()=>j("group"),3e3),setTimeout(()=>j("create"),6e3),setTimeout(()=>j("check"),9e3)],X=await _.functions.invoke("catalogOnboard",{action:"process",file_urls:D,file_names:G});ce.forEach(clearTimeout),(I=X.data)!=null&&I.success?(h(X.data.summary),c("summary")):(g(((E=X.data)==null?void 0:E.error)||"Processing failed. Please try again."),c("select"))}catch(D){console.error("Catalog onboard error:",D),g((D==null?void 0:D.message)||"An unexpected error occurred. Please try again."),c("select")}},W=()=>{a==="summary"&&(r==null||r()),i([]),c("select"),h(null),g(null),C([]),j(null),s()},k=n.reduce((F,I)=>F+I.size,0),R=n.filter(F=>F.name.toLowerCase().endsWith(".zip")).length,T=n.length-R;return t?e.jsx(Ve,{children:e.jsx(ie.div,{initial:{opacity:0}
34,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100] bg-black/80 backdrop-blur-sm flex items-center justify-center p-4",onClick:F=>F.target===F.currentTarget&&a!=="uploading"&&a!=="processing"&&a!=="analyzing"&&W(),children:e.jsxs(ie.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"w-full max-w-2xl max-h-[90vh] bg-[#0a0a0c] border border-white/10 rounded-3xl overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 border-b border-white/5 flex items-center justify-between flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-purple-600 to-indigo-600 flex items-center justify-center",children:e.jsx(Re,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white",children:"Catalog Onboard"}),e.jsx("p",{className:"text-sm text-zinc-500",children:"Upload audio files, folders, or ZIP archives"})]})]}),a!=="uploading"&&a!=="processing"&&a!=="analyzing"&&e.jsx("button",{onClick:W,className:"w-10 h-10 rounded-full bg-white/5 hover:bg-white/10 flex items-center justify-center transition-colors",children:e.jsx(te,{className:"w-5 h-5 text-zinc-400"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[a==="select"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:o,onDragOver:v,onDragLeave:A,onDrop:N,onClick:()=>{var F;return(F=b.current)==null?void 0:F.click()},className:"border-2 border-dashed border-white/20 rounded-2xl p-10 text-center cursor-pointer hover:border-purple-500/50 hover:bg-purple-500/5 transition-all",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-purple-500/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(ne,{className:"w-8 h-8 text-purple-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Drop files here or click to browse"}),e.jsx("p",{className:"text-sm text-zinc-500 mb-4",children:"WAV, MP3, AIFF, FLAC, or ZIP archives"}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:["WAV","MP3","ZIP","AIFF","FLAC"].map(F=>e.jsx("span",{className:"px-3 py-1 rounded-full bg-white/5 text-xs text-zinc-400",children:F},F))}),e.jsx("input",{ref:b,type:"file",accept:tn,multiple:!0,onChange:M,className:"hidden"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-xl bg-white/[0.03] border border-white/5 p-3 text-center",children:[e.jsx(_s,{className:"w-5 h-5 text-amber-400 mx-auto mb-1"}),e.jsx("p",{className:"text-[10px] text-zinc-500",children:"ZIP folders become playlists"})]}),e.jsxs("div",{className:"rounded-xl bg-white/[0.03] border border-white/5 p-3 text-center",children:[e.jsx(nt,{className:"w-5 h-5 text-cyan-400 mx-auto mb-1"}),e.jsx("p",{className:"text-[10px] text-zinc-500",children:"Auto-detects versions"})]}),e.jsxs("div",{className:"rounded-xl bg-white/[0.03] border border-white/5 p-3 text-center",children:[e.jsx(rt,{className:"w-5 h-5 text-emerald-400 mx-auto mb-1"}),e.jsx("p",{className:"text-[10px] text-zinc-500",children:"Reads MP3, FLAC & AIFF tags"})]})]}),n.length>0&&e.jsxs("div",{className:"mt-6 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("p",{className:"text-sm text-zinc-400",children:[n.length," file",n.length!==1?"s":""," · ",ut(k),R>0&&e.jsxs("span",{className:"text-amber-400 ml-2",children:[R," ZIP"]}),T>0&&e.jsxs("span",{className:"text-purple-400 ml-2",children:[T," audio"]})]}),e.jsx("button",{onClick:F=>{var I;F.stopPropagation(),(I=b.current)==null||I.click()},className:"text-xs text-purple-400 hover:text-purple-300",children:"+ Add more"})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1 pr-1",children:n.map((F,I)=>{const E=F.name.toLowerCase().endsWith(".zip");return e.jsxs("div",{className:"flex items-center gap-3 p-2.5 rounded-lg bg-white/[0.02] border border-white/5 group",children:[e.jsx("div",{className:Ht("w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",E?"bg-amber-500/15":"bg-purple-500/15"),children:E?e.
34jsx(Re,{className:"w-4 h-4 text-amber-400"}):e.jsx(hs,{className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-white truncate",children:F.name}),e.jsx("p",{className:"text-[10px] text-zinc-600",children:ut(F.size)})]}),e.jsx("button",{onClick:()=>U(I),className:"opacity-0 group-hover:opacity-100 text-zinc-500 hover:text-red-400 transition-all p-1",children:e.jsx(te,{className:"w-3.5 h-3.5"})})]},I)})})]}),l&&e.jsxs("div",{className:"mt-4 p-3 bg-red-500/10 border border-red-500/20 rounded-xl text-red-400 text-sm flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 flex-shrink-0"})," ",l]})]}),(a==="analyzing"||a==="uploading"||a==="processing")&&e.jsx("div",{className:"space-y-4",children:e.jsx(dt,{fileNames:y,phase:a,uploadProgress:d,summary:u,currentStep:w})}),a==="summary"&&u&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-2xl bg-gradient-to-br from-emerald-500/10 to-emerald-600/5 border border-emerald-500/20 p-6 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-500/20 flex items-center justify-center mx-auto mb-4",children:e.jsx(K,{className:"w-8 h-8 text-emerald-400"})}),e.jsx("h3",{className:"text-xl font-bold text-white mb-1",children:"Catalog Imported"}),e.jsx("p",{className:"text-sm text-zinc-400",children:"Your files have been processed and added to your catalog"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(Ce,{icon:e.jsx(rt,{className:"w-5 h-5 text-purple-400"}),value:u.recordings_created,label:"Recordings created"}),e.jsx(Ce,{icon:e.jsx(ys,{className:"w-5 h-5 text-amber-400"}),value:u.playlists_detected,label:"Playlists detected"}),e.jsx(Ce,{icon:e.jsx(nt,{className:"w-5 h-5 text-cyan-400"}),value:u.versions_grouped,label:"Versions grouped"}),e.jsx(Ce,{icon:e.jsx(Xt,{className:"w-5 h-5 text-blue-400"}),value:u.releases_detected,label:"Releases created"})]}),e.jsx(dt,{fileNames:y,phase:a,uploadProgress:100,summary:u,currentStep:null}),u.duplicates_skipped>0&&e.jsxs("div",{className:"rounded-xl bg-blue-500/5 border border-blue-500/15 p-4 flex items-center gap-3",children:[e.jsx(Gt,{className:"w-4 h-4 text-blue-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-blue-400",children:[e.jsx("span",{className:"font-bold",children:u.duplicates_skipped})," duplicate",u.duplicates_skipped!==1?"s":""," skipped (already in catalog)"]})]}),u.file_errors>0&&e.jsxs("div",{className:"rounded-xl bg-red-500/5 border border-red-500/15 p-4 flex items-center gap-3",children:[e.jsx(q,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-red-400",children:[e.jsx("span",{className:"font-bold",children:u.file_errors})," file",u.file_errors!==1?"s":""," had errors and were skipped"]})]}),(u.issues.missing_isrc>0||u.issues.missing_writer>0||u.issues.missing_publisher>0)&&e.jsxs("div",{className:"rounded-xl bg-amber-500/5 border border-amber-500/15 overflow-hidden",children:[e.jsxs("button",{onClick:()=>f(!m),className:"w-full flex items-center justify-between p-4 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"w-4 h-4 text-amber-400"}),e.jsx("span",{className:"text-sm font-medium text-amber-400",children:"Metadata gaps detected"})]}),m?e.jsx(bs,{className:"w-4 h-4 text-amber-400"}):e.jsx(Pt,{className:"w-4 h-4 text-amber-400"})]}),m&&e.jsxs("div",{className:"px-4 pb-4 space-y-2",children:[u.issues.missing_isrc>0&&e.jsx(Le,{count:u.issues.missing_isrc,label:"recordings missing ISRC"}),u.issues.missing_writer>0&&e.jsx(Le,{count:u.issues.missing_writer,label:"recordings missing writer data"}),u.issues.missing_publisher>0&&e.jsx(Le,{count:u.issues.missing_publisher,label:"recordings missing publisher data"})]})]})]})]}),(a==="select"||a==="summary")&&e.jsxs("div",{className:"p-6 border-t border-white/5 flex items-center justify-end gap-3 flex-shrink-0",children:[a==="select"&&e.jsxs(e.Fragment,{children:[e.jsx(B,{onClick:W,className:"bg-white/10 border border-white/20 hover:bg-white/20 text-zinc-300",children:"Cancel"}),e.jsxs(B,{onClick:O,disabled:n.length===0,className:"bg-gradient-to-r from-purple-500 to-indigo-500 hover:from-purple-600 hover:to-indigo-600 text-white disabled:opacity-40",children:[e.jsx(ne,{className:"w-4 h-4 mr-2"}),"Import ",n.length," file",n.length!==1?"s":""]})]}),a==="summary"&&e.jsxs(B,{onClick:W,className:"bg-gradient-to-r from-emerald-500 to-teal-500 hover:from-emerald-600 hover:to-teal-600 text-white",children:[e.jsx(K,{className:"w-4 h-4 mr-2"}),"Done â Go to Catalog"]})]})]})})}):null}function Ce({icon:t,value:s,label:r}){return e.jsxs("div",{className:"rounded-xl border p-4 flex items-center gap-3",style:{background:"rgba(255,255,255,0.02)",borderColor:"rgba(255,255,255,0.06)"},children:[e.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{background:"rgba(255,255,255,0.05)"},children:t}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-white",children:s}),e.jsx("p",{className:"text-[11px] text-zinc-500",children:r})]})]})}function Le({count:t,label:s}){return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-amber-400 font-bold",children:t}),e.jsx("span",{className:"text-zinc-400",children:s})]})}function sn({open:t,onClose:s,onSuccess:r}){const[n,i]=p.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(fe,{open:t,onOpenChange:s,children:e.jsxs(ye,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:0},children:[e.jsx("div",{style:{padding:"28px 28px 0"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,marginBottom:20},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:12,background:"#7C3AED",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Re,{style:{width:24,height:24,color:"white"}})}),e.jsxs("div",{children:[e.jsx("h2",{style:{fontWeight:650,fontSize:20,letterSpacing:"-0.02em",color:"#FFFFFF",margin:0},children:"Catalog Onboard"}),e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:"2px 0 0"},children:"Import audio files, ZIP archives, or playlist exports"})]})]})}),e.jsxs("div",{style:{padding:"0 28px 28px",display:"flex",flexDirection:"column",gap:24},children:[e.jsxs("div",{style:{background:"rgba(124,58,237,0.06)",border:"1px solid rgba(124,58,237,0.15)",borderRadius:14,padding:"20px"},children:[e.jsxs("h3",{style:{fontWeight:650,fontSize:15,color:"#A78BFA",margin:"0 0 12px",display:"flex",alignItems:"center",gap:8},children:[e.jsx(Re,{style:{width:16,height:16}}),"Importing a Playlist Export (Example: DISCO)"]}),e.jsx("p",{style:{fontSize:13,color:"#B3B3B3",margin:"0 0 14px",lineHeight:1.6},children:"If you manage your catalog in a platform like DISCO, you can quickly move your tracks into RCP by exporting your playlist files and uploading them here."})]}),e.jsx(Oe,{number:"1",title:"Download Your Playlist Files",children:e.jsxs("ol",{style:{margin:0,paddingLeft:18,display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("li",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6},children:["Log into your DISCO account:"," ",e.jsxs("a",{href:"https://disco.ac",target:"_blank",rel:"noopener noreferrer",style:{color:"#A78BFA",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:3},children:["disco.ac ",e.jsx(It,{style:{width:11,height:11}})]})]}),e.jsx("li",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6},children:"Open the playlist you want to export."}),e.jsx("li",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6},children:"Select all tracks in the playlist."}),e.jsxs("li",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6},children:["Click ",e.jsx("strong",{style:{color:"#FFFFFF"},children:"Download"}),"."]}),e.jsx("li",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6},children:"DISCO will generate a ZIP archive containing the audio files from that playlist."})]})}),e.jsxs(Oe,{number:"2",title:"Include Both WAV and MP3 Versions",children:[e.jsx("p",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6,margin:"0 0 12px"},children:"If your playlist contains both WAV and MP3 versions, download them together in the same export."}),e.jsxs("div",{style:{background:"rgba(0,0,0,0.3)",borderRadius:10,padding:"14px 16px",fontFamily:"monospace",fontSize:12,color:"#9
34CA3AF",lineHeight:1.8},children:[e.jsx("div",{style:{color:"#F59E0B",marginBottom:4},children:"PlaylistName.zip"}),e.jsx("div",{style:{paddingLeft:16},children:"SongTitle.wav"}),e.jsx("div",{style:{paddingLeft:16},children:"SongTitle.mp3"}),e.jsx("div",{style:{paddingLeft:16},children:"SongTitle_Instrumental.wav"}),e.jsx("div",{style:{paddingLeft:16},children:"SongTitle_Clean.wav"})]}),e.jsxs("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:6},children:[e.jsx(Q,{text:"Pair WAV + MP3 versions of the same song"}),e.jsx(Q,{text:"Detect alternate versions (instrumental, clean, remix, etc.)"}),e.jsx(Q,{text:"Create recording groups and playlists"})]})]}),e.jsxs(Oe,{number:"3",title:"Upload the ZIP File to RCP",children:[e.jsx("p",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6,margin:"0 0 14px"},children:"Upload the exported ZIP archive directly using the button below."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx(Q,{text:"Extract the audio files"}),e.jsx(Q,{text:"Read embedded MP3 metadata"}),e.jsx(Q,{text:"Create recordings and releases"}),e.jsx(Q,{text:"Organize alternate versions"}),e.jsx(Q,{text:"Build a playlist matching your export"})]})]}),e.jsxs("div",{style:{background:"rgba(59,130,246,0.06)",border:"1px solid rgba(59,130,246,0.15)",borderRadius:14,padding:"18px 20px"},children:[e.jsxs("h4",{style:{fontWeight:650,fontSize:14,color:"#60A5FA",margin:"0 0 10px",display:"flex",alignItems:"center",gap:8},children:[e.jsx(q,{style:{width:15,height:15}}),"What Happens Next"]}),e.jsx("p",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6,margin:"0 0 10px"},children:"After import, RCP will analyze your catalog and identify:"}),e.jsx("ul",{style:{margin:0,paddingLeft:16,display:"flex",flexDirection:"column",gap:5},children:["Missing ISRCs","Missing compositions","Registration gaps (MLC, PRO, SoundExchange)","Metadata issues that may affect royalties"].map(a=>e.jsx("li",{style:{fontSize:13,color:"#9CA3AF",lineHeight:1.5},children:a},a))}),e.jsxs("p",{style:{fontSize:13,color:"#B3B3B3",margin:"10px 0 0",lineHeight:1.6},children:["These will appear in your ",e.jsx("strong",{style:{color:"#FFFFFF"},children:"Notifications and Issues"})," panel."]})]}),e.jsxs("div",{style:{background:"rgba(245,158,11,0.06)",border:"1px solid rgba(245,158,11,0.15)",borderRadius:14,padding:"16px 20px",display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsx(Ps,{style:{width:18,height:18,color:"#F59E0B",flexShrink:0,marginTop:1}}),e.jsx("p",{style:{fontSize:13,color:"#B3B3B3",lineHeight:1.6,margin:0},children:"If your MP3 files contain metadata (Title, Artist, Album, Composer, etc.), RCP will automatically populate your catalog using those fields."})]}),e.jsxs("button",{onClick:()=>{s(!1),i(!0)},style:{width:"100%",height:48,borderRadius:12,display:"flex",alignItems:"center",justifyContent:"center",gap:10,fontSize:14,fontWeight:650,background:"#7C3AED",color:"white",border:"none",cursor:"pointer",transition:"background 0.15s"},onMouseEnter:a=>{a.currentTarget.style.background="#8B4EF0"},onMouseLeave:a=>{a.currentTarget.style.background="#7C3AED"},children:[e.jsx(ne,{style:{width:17,height:17}}),"Upload ZIP / Audio Files"]})]})]})}),e.jsx(Mt,{open:n,onClose:()=>i(!1),onSuccess:()=>{i(!1),r&&r()}})]})}function Oe({number:t,title:s,children:r}){return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:12},children:[e.jsx("div",{style:{width:28,height:28,borderRadius:8,background:"rgba(124,58,237,0.15)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("span",{style:{fontSize:13,fontWeight:650,color:"#A78BFA"},children:t})}),e.jsx("h4",{style:{fontWeight:650,fontSize:15,color:"#FFFFFF",margin:0},children:s})]}),r]})}function Q({text:t}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(H,{style:{width:14,height:14,color:"#4ADE80",flexShrink:0}}),e.jsx("span",{style:{fontSize:13,color:"#B3B3B3"},children:t})]})}function Y(t){const s=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&s==="[object Date]"?new t.constructor(+t):typeof t=="number"||s==="[object Number]"||typeof t=="string"||s==="[object String]"?new Date(t):new Date(NaN)}function re(t,s){return t instanceof Date?new t.constructor(s):new Date(s)}const Rt=6048e5,nn=864e5;let rn={};function Ee(){return rn}function me(t,s){var d,x,u,h;const r=Ee(),n=(s==null?void 0:s.weekStartsOn)??((x=(d=s==null?void 0:s.locale)==null?void 0:d.options)==null?void 0:x.weekStartsOn)??r.weekStartsOn??((h=(u=r.locale)==null?void 0:u.options)==null?void 0:h.weekStartsOn)??0,i=Y(t),a=i.getDay(),c=(a<n?7:0)+a-n;return i.setDate(i.getDate()-c),i.setHours(0,0,0,0),i}function De(t){return me(t,{weekStartsOn:1}
vendor: 19,055 bytes, line 34
34)}function Dt(t){const s=Y(t),r=s.getFullYear(),n=re(t,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const i=De(n),a=re(t,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const c=De(a);return s.getTime()>=i.getTime()?r+1:s.getTime()>=c.getTime()?r:r-1}function pt(t){const s=Y(t);return s.setHours(0,0,0,0),s}function ht(t){const s=Y(t),r=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return r.setUTCFullYear(s.getFullYear()),+t-+r}function an(t,s){const r=pt(t),n=pt(s),i=+r-ht(r),a=+n-ht(n);return Math.round((i-a)/nn)}function on(t){const s=Dt(t),r=re(t,0);return r.setFullYear(s,0,4),r.setHours(0,0,0,0),De(r)}function ln(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function cn(t){if(!ln(t)&&typeof t!="number")return!1;const s=Y(t);return!isNaN(Number(s))}function dn(t){const s=Y(t),r=re(t,0);return r.setFullYear(s.getFullYear(),0,1),r.setHours(0,0,0,0),r}const un={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},pn=(t,s,r)=>{let n;const i=un[t];return typeof i=="string"?n=i:s===1?n=i.one:n=i.other.replace("{{count}}",s.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function $e(t){return(s={})=>{const r=s.width?String(s.width):t.defaultWidth;return t.formats[r]||t.formats[t.defaultWidth]}}const hn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},gn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},mn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},xn={date:$e({formats:hn,defaultWidth:"full"}),time:$e({formats:gn,defaultWidth:"full"}),dateTime:$e({formats:mn,defaultWidth:"full"})},fn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},yn=(t,s,r,n)=>fn[t];function pe(t){return(s,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let i;if(n==="formatting"&&t.formattingValues){const c=t.defaultFormattingWidth||t.defaultWidth,d=r!=null&&r.width?String(r.width):c;i=t.formattingValues[d]||t.formattingValues[c]}else{const c=t.defaultWidth,d=r!=null&&r.width?String(r.width):t.defaultWidth;i=t.values[d]||t.values[c]}const a=t.argumentCallback?t.argumentCallback(s):s;return i[a]}}const bn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},jn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wn={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Sn={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},vn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},kn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Cn=(t,s)=>{const r=Number(t),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Fn={ordinalNumber:Cn,era:pe({values:bn,defaultWidth:"wide"}),quarter:pe({values:jn,defaultWidth:"wide",argumentCallback:t=>t-1}),month:pe({values:wn,defaultWidth:"wide"}),day:pe({values:Sn,defaultWidth:"wide"}),dayPeriod:pe({values:vn,defaultWidth:"wide",formattingValues:kn,defaultFormattingWidth:"wide"})};function he(t){return(s,r={})=>{const n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],a=s.match(i);if(!a)return null;const c=a[0],d=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],x=Array.isArray(d)?An(d,l=>l.test(c)):_n(d,l=>l.test(c));let u;u=t.valueCallback?t.valueCallback(x):x,u=r.valueCallback?r.valueCallback(u):u;const h=s.slice(c.length);return{value:u,rest:h}}}function _n(t,s){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&s(t[r]))return r}function An(t,s){for(let r=0;r<t.length;r++)if(s(t[r]))return r}function Nn(t){return(s,r={})=>{const n=s.match(t.matchPattern);if(!n)return null;const i=n[0],a=s.match(t.parsePattern);if(!a)return null;let c=t.valueCallback?t.valueCallback(a[0]):a[0];c=r.valueCallback?r.valueCallback(c):c;const d=s.slice(i.length);return{value:c,rest:d}}}const In=/^(\d+)(th|st|nd|rd)?/i,Pn=/\d+/i,Mn={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Rn={any:[/^b/i,/^(a|c)/i]},Dn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Tn={any:[/1/i,/2/i,/3/i,/4/i]},En={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Bn={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zn={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Wn={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ln={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},On={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},$n={ordinalNumber:Nn({matchPattern:In,parsePattern:Pn,valueCallback:t=>parseInt(t,10)}),era:he({matchPatterns:Mn,defaultMatchWidth:"wide",parsePatterns:Rn,defaultParseWidth:"any"}),quarter:he({matchPatterns:Dn,defaultMatchWidth:"wide",parsePatterns:Tn,defaultParseWidth:"any",valueCallback:t=>t+1}),month:he({matchPatterns:En,defaultMatchWidth:"wide",parsePatterns:Bn,defaultParseWidth:"any"}),day:he({matchPatterns:zn,defaultMatchWidth:"wide",parsePatterns:Wn,defaultParseWidth:"any"}),dayPeriod:he({matchPatterns:Ln,defaultMatchWidth:"any",parsePatterns:On,defaultParseWidth:"any"})},Yn={code:"en-US",formatDistance:pn,formatLong:xn,formatRelative:yn,localize:Fn,match:$n,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Un(t){const s=Y(t);return an(s,dn(s))+1}function Vn(t){const s=Y(t),r=+De(s)-+on(s);return Math.round(r/Rt)+1}function Tt(t,s){var h,l,g,m;const r=Y(t),n=r.getFullYear(),i=Ee(),a=(s==null?void 0:s.firstWeekContainsDate)??((l=(h=s==null?void 0:s.locale)==null?void 0:h.options)==null?void 0:l.firstWeekContainsDate)??i.firstWeekContainsDate??((m=(g=i.locale)==null?void 0:g.options)==null?void 0:m.firstWeekContainsDate)??1,c=re(t,0);c.setFullYear(n+1,0,a),c.setHours(0,0,0,0);const d=me(c,s),x=re(t,0);x.setFullYear(n,0,a),x.setHours(0,0,0,0);const u=me(x,s);return r.getTime()>=d.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function qn(t,s){var d,x,u,h;const r=Ee(),n=(s==null?void 0:s.firstWeekContainsDate)??((x=(d=s==null?void 0:s.locale)==null?void 0:d.options)==null?void 0:x.firstWeekContainsDate)??r.firstWeekContainsDate??((h=(u=r.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??1,i=Tt(t,s),a=re(t,0);return a.setFullYear(i,0,n),a.setHours(0,0,0,0),me(a,s)}function Hn(t,s){const r=Y(t),n=+me(r,s)-+qn(r,s);return Math.round(n/Rt)+1}function P(t,s){const r=t<0?"-":"",n=Math.abs(t).toString().padStart(s,"0");return r+n}const Z={y(t,s){const r=t.getFullYear(),n=r>0?r:1-r;return P(s==="yy"?n%100:n,s.length)},M(t,s){const r=t.getMonth();return s==="M"?String(r+1):P(r+1,2)},d(t,s){return P(t.getDate(),s.length)},a(t,s){const r=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(t,s){return P(t.getHours()%12||12,s.length)},H(t,s){return P(t.getHours(),s.length)},m(t,s){return P(t.getMinutes(),s.length)},s(t,s){return P(t.getSeconds(),s.length)},S(t,s){const r=s.length,n=t.getMilliseconds(),i=Math.trunc(n*Math.pow(10,r-3));return P(i,s.length)}},ae={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gt={G:function(t,s,r){const n=t.getFullYear()>0?1:0;switch(s){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(t,s,r){if(s==="yo"){const n=t.getFullYear(),i=n>0?n:1-n;return r.ordinalNumber(i,{unit:"year"})}return Z.y(t,s)},Y:function(t,s,r,n){const i=Tt(t,n),a=i>0?i:1-i;if(s==="YY"){const c=a%100;return P(c,2)}return s==="Yo"?r.ordinalNumber(a,{unit:"year"}):P(a,s.length)},R:function(t,s){const r=Dt(t);return P(r,s.length)},u:function(t,s){const r=t.getFullYear();return P(r,s.length)},Q:function(t,s,r){const n=Math.ceil((t.getMonth()+1)/3);switch(s){case"Q":return String(n);case"QQ":return P(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,s,r){const n=Math.ceil((t.getMonth()+1)/3);switch(s){case"q":return String(n);case"qq":return P(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,s,r){const n=t.getMonth();switch(s){case"M":case"MM":return Z.M(t,s);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(t,s,r){const n=t.getMonth();switch(s){case"L":return String(n+1);case"LL":return P(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(t,s,r,n){const i=Hn(t,n);return s==="wo"?r.ordinalNumber(i,{unit:"week"}):P(i,s.length)},I:function(t,s,r){const n=Vn(t);return s==="Io"?r.ordinalNumber(n,{unit:"week"}):P(n,s.length)},d:function(t,s,r){return s==="do"?r.ordinalNumber(t.getDate(),{unit:"date"}):Z.d(t,s)},D:function(t,s,r){const n=Un(t);return s==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):P(n,s.length)},E:function(t,s,r){const n=t.getDay();switch(s){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(t,s,r,n){const i=t.getDay(),a=(i-n.weekStartsOn+8)%7||7;switch(s){case"e":return String(a);case"ee":return P(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,s,r,n){const i=t.getDay(),a=(i-n.weekStartsOn+8)%7||7;switch(s){case"c":return String(a);case"cc":return P(a,s.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,s,r){const n=t.getDay(),i=n===0?7:n;switch(s){case"i":return String(i);case"ii":return P(i,s.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(t,s,r){const i=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,s,r){const n=t.getHours();let i;switch(n===12?i=ae.noon:n===0?i=ae.midnight:i=n/12>=1?"pm":"am",s){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,s,r){const n=t.getHours();let i;switch(n>=17?i=ae.evening:n>=12?i=ae.afternoon:n>=4?i=ae.morning:i=ae.night,s){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,s,r){if(s==="ho"){let n=t.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Z.h(t,s)},H:function(t,s,r){return s==="Ho"?r.ordinalNumber(t.getHours(),{unit:"hour"}):Z.H(t,s)},K:function(t,s,r){const n=t.getHours()%12;return s==="Ko"?r.ordinalNumber(n,{unit:"hour"}):P(n,s.length)},k:function(t,s,r){let n=t.getHours();return n===0&&(n=24),s==="ko"?r.ordinalNumber(n,{unit:"hour"}):P(n,s.length)},m:function(t,s,r){return s==="mo"?r.ordinalNumber(t.getMinutes(),{unit:"minute"}):Z.m(t,s)},s:function(t,s,r){return s==="so"?r.ordinalNumber(t.getSeconds(),{unit:"second"}):Z.s(t,s)},S:function(t,s){return Z.S(t,s)},X:function(t,s,r){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(s){case"X":return xt(n);case"XXXX":case"XX":return ee(n);case"XXXXX":case"XXX":default:return ee(n,":")}},x:function(t,s,r){const n=t.getTimezoneOffset();switch(s){case"x":return xt(n);case"xxxx":case"xx":return ee(n);case"xxxxx":case"xxx":default:return ee(n,":")}},O:function(t,s,r){const n=t.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+mt(n,":");case"OOOO":default:return"GMT"+ee(n,":")}},z:function(t,s,r){const n=t.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+mt(n,":");case"zzzz":default:return"GMT"+ee(n,":")}},t:function(t,s,r){const n=Math.trunc(t.getTime()/1e3);return P(n,s.length)},T:function(t,s,r){const n=t.getTime();return P(n,s.length)}};function mt(t,s=""){const r=t>0?"-":"+",n=Math.abs(t),i=Math.trunc(n/60),a=n%60;return a===0?r+String(i):r+String(i)+s+P(a,2)}function xt(t,s){return t%60===0?(t>0?"-":"+")+P(Math.abs(t)/60,2):ee(t,s)}function ee(t,s=""){const r=t>0?"-":"+",n=Math.abs(t),i=P(Math.trunc(n/60),2),a=P(n%60,2);return r+i+s+a}const ft=(t,s)=>{switch(t){case"P":return s.date({width:"short"});case"PP":return s.date({width:"medium"});case"PPP":return s.date({width:"long"});case"PPPP":default:return s.date({width:"full"})}},Et=(t,s)=>{switch(t){case"p":return s.time({width:"short"});case"pp":return s.time({width:"medium"});case"ppp":return s.time({width:"long"});case"pppp":default:return s.time({width:"full"})}},Xn=(t,s)=>{const r=t.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return ft(t,s);let a;switch(n){case"P":a=s.dateTime({width:"short"});break;case"PP":a=s.dateTime({width:"medium"});break;case"PPP":a=s.dateTime({width:"long"});break;case"PPPP":default:a=s.dateTime({width:"full"});break}return a.replace("{{date}}",ft(n,s)).replace("{{time}}",Et(i,s))},Gn={p:Et,P:Xn},Qn=/^D+$/,Zn=/^Y+$/,Jn=["D","DD","YY","YYYY"];function Kn(t){return Qn.test(t)}function er(t){return Zn.test(t)}function tr(t,s,r){const n=sr(t,s,r);if(console.warn(n),Jn.includes(t))throw new RangeError(n)}function sr(t,s,r){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${s}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const nr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,rr=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ar=/^'([^]*?)'?$/,ir=/''/g,or=/[a-zA-Z]/;function Bt(t,s,r){var h,l,g,m;const n=Ee(),i=n.locale??Yn,a=n.firstWeekContainsDate??((l=(h=n.locale)==null?void 0:h.options)==null?void 0:l.firstWeekContainsDate)??1,c=n.weekStartsOn??((m=(g=n.locale)==null?void 0:g.options)==null?void 0:m.weekStartsOn)??0,d=Y(t);if(!cn(d))throw new RangeError("Invalid time value");let x=s.match(rr).map(f=>{const y=f[0];if(y==="p"||y==="P"){const C=Gn[y];return C(f,i.formatLong)}return f}).join("").match(nr).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const y=f[0];if(y==="'")return{isToken:!1,value:lr(f)};if(gt[y])return{isToken:!0,value:f};
34if(y.match(or))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:f}});i.localize.preprocessor&&(x=i.localize.preprocessor(d,x));const u={firstWeekContainsDate:a,weekStartsOn:c,locale:i};return x.map(f=>{if(!f.isToken)return f.value;const y=f.value;(er(y)||Kn(y))&&tr(y,s,String(t));const C=gt[y[0]];return C(d,y,i.localize,u)}).join("")}function lr(t){const s=t.match(ar);return s?s[1].replace(ir,"'"):t}const cr={spotify:"Spotify",apple_music:"Apple Music",manual:"Manual Upload",youtube:"YouTube",bmi:"BMI",mlc:"MLC",soundexchange:"SoundExchange",musicreports:"Music Reports",contacts:"Contacts",catalog_onboard:"Catalog Onboard"},yt={running:{label:"In Progress",icon:z,color:"#A78BFA",bg:"rgba(167,139,250,0.1)",spin:!0},success:{label:"Completed",icon:H,color:"#4ADE80",bg:"rgba(74,222,128,0.1)"},partial:{label:"Completed with Issues",icon:se,color:"#F59E0B",bg:"rgba(245,158,11,0.1)"},failed:{label:"Failed",icon:Te,color:"#EF4444",bg:"rgba(239,68,68,0.1)"}};function Fe({label:t,status:s,details:r}){if(!s)return null;const n=s==="done"||s==="skipped",i=s==="error",a=i?"#EF4444":n?"#4ADE80":"#A78BFA",c=i?Te:n?H:z;return e.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg",style:{background:"rgba(255,255,255,0.03)"},children:[e.jsx(c,{className:`w-4 h-4 flex-shrink-0 mt-0.5 ${s==="running"?"animate-spin":""}`,style:{color:a}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold text-white",children:t}),r&&e.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:r})]})]})}function dr({run:t,isOpen:s,onClose:r}){var u,h,l,g,m,f,y,C,w,j;if(!t)return null;const n=yt[t.status]||yt.success,i=n.icon,a=t.pipeline||{},c=t.started_at||t.created_date,d=t.completed_at;let x="";if(c&&d){const b=Math.round((new Date(d)-new Date(c))/1e3);x=b<60?`${b}s`:`${Math.floor(b/60)}m ${b%60}s`}return e.jsx(fe,{open:s,onOpenChange:r,children:e.jsxs(ye,{className:"bg-[#12121a] border-white/10 max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsx(Ge,{children:e.jsx(Qe,{className:"text-white text-base",children:"Import Details"})}),e.jsxs("div",{className:"rounded-xl p-4 space-y-2",style:{background:n.bg,border:`1px solid ${n.color}30`},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{className:`w-5 h-5 ${n.spin?"animate-spin":""}`,style:{color:n.color}}),e.jsx("span",{className:"text-sm font-semibold",style:{color:n.color},children:n.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-y-1.5 text-xs text-zinc-400",children:[e.jsx("span",{children:"Source"}),e.jsx("span",{className:"text-white font-medium",children:cr[t.source]||t.source}),t.search_query&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Query"}),e.jsx("span",{className:"text-white font-medium truncate",children:t.search_query})]}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Started"}),e.jsx("span",{className:"text-white",children:Bt(new Date(c),"MMM d, yyyy h:mm a")})]}),x&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Duration"}),e.jsx("span",{className:"text-white",children:x})]})]})]}),t.total_tracks>0&&e.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("p",{className:"text-[10px] font-bold text-zinc-500 uppercase tracking-wider mb-2",children:"Import Summary"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(_e,{value:t.total_tracks,label:"Total Tracks",color:"#A78BFA"}),e.jsx(_e,{value:t.new_tracks||0,label:"New",color:"#4ADE80"}),e.jsx(_e,{value:t.existing_tracks||0,label:"Already Existed",color:"#3B82F6"})]}),t.failed_tracks>0&&e.jsx("div",{className:"mt-2",children:e.jsx(_e,{value:t.failed_tracks,label:"Failed",color:"#EF4444"})})]}),Object.keys(a).length>0&&e.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("p",{className:"text-[10px] font-bold text-zinc-500 uppercase tracking-wider mb-2",children:"Enrichment Pipeline"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Fe,{label:"MLC Check",status:(u=a.mlc)==null?void 0:u.status,details:(h=a.mlc)!=null&&h.status?`${a.mlc.registered||0} registered · ${a.mlc.partial||0} partial · ${a.mlc.missing||0} missing${a.mlc.failed?` · ${a.mlc.failed} failed`:""}`:null}),e.jsx(Fe,{label:"Credits Enrichment",status:(l=a.credits)==null?void 0:l.status,details:(g=a.credits)!=null&&g.status?`${a.credits.enriched||0} enriched${a.credits.not_found?` · ${a.credits.not_found} not found`:""}${a.credits.failed?` · ${a.credits.failed} failed`:""}`:null}),e.jsx(Fe,{label:"BPM",status:(m=a.bpm)==null?void 0:m.status,details:(f=a.bpm)!=null&&f.status?`${a.bpm.updated||0} of ${a.bpm.total||0}
34 tracks enriched`:null}),e.jsx(Fe,{label:"Lyrics",status:(y=a.lyrics)==null?void 0:y.status,details:(C=a.lyrics)!=null&&C.status?`${a.lyrics.found||0} found of ${a.lyrics.total||0}`:null})]})]}),((w=t.warnings)==null?void 0:w.length)>0&&e.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(245,158,11,0.06)",border:"1px solid rgba(245,158,11,0.15)"},children:[e.jsx("p",{className:"text-[10px] font-bold text-amber-500 uppercase tracking-wider mb-2",children:"Warnings"}),e.jsx("div",{className:"space-y-1",children:t.warnings.map((b,o)=>e.jsxs("p",{className:"text-xs text-amber-300 flex items-start gap-1.5",children:[e.jsx(se,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),b]},o))})]}),((j=t.errors)==null?void 0:j.length)>0&&e.jsxs("div",{className:"rounded-xl p-4",style:{background:"rgba(239,68,68,0.06)",border:"1px solid rgba(239,68,68,0.15)"},children:[e.jsx("p",{className:"text-[10px] font-bold text-red-500 uppercase tracking-wider mb-2",children:"Errors"}),e.jsx("div",{className:"space-y-1",children:t.errors.map((b,o)=>e.jsxs("p",{className:"text-xs text-red-300 flex items-start gap-1.5",children:[e.jsx(Te,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),b]},o))})]})]})})}function _e({value:t,label:s,color:r}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-bold",style:{color:r},children:t}),e.jsx("p",{className:"text-[10px] text-zinc-500",children:s})]})}const zt={spotify:{label:"Spotify Import",icon:"ðµ",color:"#1DB954"},apple_music:{label:"Apple Music Import",icon:"ð",color:"#FC3C44"},manual:{label:"Manual Upload",icon:"ð§",color:"#A78BFA"},youtube:{label:"YouTube Import",icon:"ðº",color:"#FF0000"},bmi:{label:"BMI Import",icon:"ð",color:"#3B82F6"},mlc:{label:"MLC Import",icon:"â
",color:"#4ADE80"},soundexchange:{label:"SoundExchange Import",icon:"ð»",color:"#F59E0B"},musicreports:{label:"Music Reports Import",icon:"ð",color:"#7C3AED"},contacts:{label:"Contacts Import",icon:"ð¥",color:"#EC4899"},catalog_onboard:{label:"Catalog Onboard",icon:"ð¦",color:"#7C3AED"}},bt={running:{label:"In Progress",icon:z,color:"#A78BFA",spin:!0},success:{label:"Completed",icon:H,color:"#4ADE80"},partial:{label:"Completed with Issues",icon:se,color:"#F59E0B"},failed:{label:"Failed",icon:Te,color:"#EF4444"},stalled:{label:"Stalled",icon:se,color:"#8b8b90"}},ur=1800*1e3;function Wt(t){if(t.status==="running"){const s=t.started_at||t.created_date;if(s&&Date.now()-new Date(s).getTime()>ur)return"stalled"}return t.status}function pr(){const[t,s]=p.useState(null),[r,n]=p.useState("all"),[i,a]=p.useState("all"),c=Xe(),d=p.useRef(!1),{data:x=[],isLoading:u}=Pe({queryKey:["import-runs"],queryFn:()=>_.entities.ImportRun.list("-created_date",100),refetchInterval:1e4});p.useEffect(()=>{d.current||(d.current=!0,Zt().then(l=>{l&&c.invalidateQueries({queryKey:["import-runs"]})}).catch(()=>{}))},[c]);const h=x.filter(l=>!(r!=="all"&&l.source!==r||i!=="all"&&Wt(l)!==i));return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("select",{value:r,onChange:l=>n(l.target.value),className:"text-sm rounded-lg px-3 py-2",style:{background:"#1A1A1A",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF"},children:[e.jsx("option",{value:"all",children:"All Sources"}),Object.entries(zt).map(([l,g])=>e.jsx("option",{value:l,children:g.label},l))]}),e.jsxs("select",{value:i,onChange:l=>a(l.target.value),className:"text-sm rounded-lg px-3 py-2",style:{background:"#1A1A1A",border:"1px solid rgba(255,255,255,0.1)",color:"#FFF"},children:[e.jsx("option",{value:"all",children:"All Statuses"}),e.jsx("option",{value:"success",children:"Completed"}),e.jsx("option",{value:"partial",children:"Issues"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"running",children:"In Progress"}),e.jsx("option",{value:"stalled",children:"Stalled"})]}),e.jsxs("span",{className:"text-xs text-zinc-500 ml-auto",children:[h.length," import",h.length!==1?"s":""]})]}),u&&e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(z,{className:"w-5 h-5 animate-spin text-purple-400"})}),!u&&h.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(qe,{className:"w-8 h-8 text-zinc-600 mx-auto mb-3"}),e.jsx("p",{className:"text-zinc-500 text-sm",children:"No import history yet"}),e.jsx("p",{className:"text-zinc-600 text-xs mt-1",children:"Import logs will appear here after your next import"})]}),e.jsx("div",{className:"space-y-2",children:h.map(l=>e.jsx(hr,{run:l,onClick:()=>s(l)},l.id))}),t&&e.jsx(dr,{run:t,isOpen:!!t,onClose:()=>s(null)})]})}function hr({run:t,onClick:s}){var h,l,g,m,f;const r=zt[t.source]||{label:t.source,icon:"ð"},n=bt[Wt(t)]||bt.success,i=n.icon,a=t.started_at||t.created_date,c=a?Bt(new Date(a),"MMM d, yyyy â h:mm a"):"",d=t.pipeline||{},x=[];if((h=d.mlc)!=null&&h.status){const y=d.mlc;x.push(`MLC: ${y.registered||0} reg, ${y.partial||0} partial, ${y.missing||0} missing`)}(l=d.credits)!=null&&l.status&&x.push(`Credits: ${d.credits.enriched||0} enriched`),(g=d.bpm)!=null&&g.status&&x.push(`BPM: ${d.bpm.updated||0}/${d.bpm.total||0}
34`),(m=d.lyrics)!=null&&m.status&&x.push(`Lyrics: ${d.lyrics.found||0}/${d.lyrics.total||0}`);const u=((f=t.errors)==null?void 0:f.length)>0;return e.jsx("button",{onClick:s,className:"w-full text-left rounded-xl transition-all hover:border-white/15",style:{background:"#161616",border:"1px solid rgba(255,255,255,0.08)",padding:"14px 16px",cursor:"pointer"},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-xl flex-shrink-0 mt-0.5",children:r.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-semibold text-white",children:r.label}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(i,{className:`w-3.5 h-3.5 ${n.spin?"animate-spin":""}`,style:{color:n.color}}),e.jsx("span",{className:"text-[11px] font-medium",style:{color:n.color},children:n.label})]})]}),t.search_query&&e.jsx("p",{className:"text-xs text-zinc-500 mt-0.5 truncate",children:t.search_query}),e.jsxs("div",{className:"flex items-center gap-3 mt-1.5 flex-wrap",children:[c&&e.jsx("span",{className:"text-[11px] text-zinc-600",children:c}),t.total_tracks>0&&e.jsxs("span",{className:"text-[11px] text-zinc-500",children:[t.new_tracks||0," new · ",t.existing_tracks||0," existing",t.failed_tracks>0&&e.jsxs("span",{className:"text-red-400",children:[" · ",t.failed_tracks," failed"]})]})]}),x.length>0&&e.jsx("p",{className:"text-[11px] text-zinc-500 mt-1.5",children:x.join(" · ")}),u&&e.jsx("div",{className:"mt-1.5",children:e.jsxs("span",{className:"text-[10px] text-red-400 font-medium",children:[t.errors.length," error",t.errors.length>1?"s":""]})})]}),e.jsx(Pt,{className:"w-4 h-4 text-zinc-600 flex-shrink-0 mt-1 -rotate-90"})]})})}function gr({open:t,onClose:s,onSuccess:r}){var w,j;const[n,i]=p.useState(null),[a,c]=p.useState("select"),[d,x]=p.useState(null),[u,h]=p.useState(null),l=p.useRef(null);if(!t)return null;const g=b=>{var v;const o=(v=b.target.files)==null?void 0:v[0];o&&(i(o),h(null)),b.target.value=""},m=async()=>{if(!n)return;h(null),c("working");const b=await wt({source:"mlc",searchQuery:n.name}).catch(()=>null);try{const{file_url:o}=await _.integrations.Core.UploadFile({file:n}),v=await _.functions.invoke("mlcImport",{file_url:o,file_name:n.name}),A=v==null?void 0:v.data;if(!(A!=null&&A.success))throw new Error((A==null?void 0:A.error)||"Import failed.");b!=null&&b.id&&(await St(b.id,{total_tracks:A.works||0,new_tracks:A.compositions_created||0,existing_tracks:A.compositions_enriched||0}),await Me(b.id,{status:"success"})),x(A),c("done")}catch(o){b!=null&&b.id&&await Me(b.id,{status:"failed",errors:[o.message]}),h(o.message),c("select")}},f=()=>{a==="done"&&(r==null||r()),i(null),c("select"),x(null),h(null),s()},y=d==null?void 0:d.identity_applied,C=y?(((w=y.writer_ipis)==null?void 0:w.length)||0)+(((j=y.publisher_ipis)==null?void 0:j.length)||0):0;return e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.8)",backdropFilter:"blur(4px)"},onClick:b=>b.target===b.currentTarget&&a!=="working"&&f(),children:e.jsxs("div",{style:{width:"100%",maxWidth:480,background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"20px 24px",borderBottom:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:10,background:"#FFF",padding:2,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Ze,{fill:!0})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{fontSize:16,fontWeight:650,color:"#fff",margin:0},children:"Import MLC Work Report"}),e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:"2px 0 0"},children:"Catalog, splits, and your writer/publisher identity, from one export."})]}),a!=="working"&&e.jsx("button",{onClick:f,style:{width:32,height:32,borderRadius:8,background:"rgba(255,255,255,0.05)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(te,{style:{width:16,height:16,color:"#8b8b90"}})})]}),e.jsxs("div",{style:{padding:24},children:[a==="select"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{var b;return(b=l.current)==null?void 0:b.click()},style:{width:"100%",padding:"28px 16px",borderRadius:12,background:"rgba(255,255,255,0.02)",border:"1.5px dashed rgba(255,255,255,0.14)",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",gap:10},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:"rgba(124,58,237,0.14)",display:"flex",alignItems:"center",justifyContent:"center"},children:n?e.jsx(et,{style:{width:22,height:22,color:"#A78BFA"}}):e.jsx(ne,{style:{width:22,height:22,color:"#A78BFA"}})}),e.jsx("p",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0},children:n?n.name:"Choose your MLC work report"}),e.jsx("p",{style:{fontSize:12,color:"#666",margin:0},children:n?"Click to replace":"CSV or Excel from the MLC portal"}),e.jsx("input",{ref:l,type:"file",accept:".csv,.xlsx,.xls",onChange:g,style:{display:"none"}})]}),e.jsxs("div",{style:{marginTop:14,display:"flex",gap:8,fontSize:12,color:"#8b8b90",lineHeight:1.5},children:[e.jsx(oe,{style:{width:15,height:15,color:"#4ADE80",flexShrink:0,marginTop:1}}),e.jsxs("span",{children:["In the MLC portal, open ",e.jsx("b",{style:{color:"#c9c9ce"},children:"Works â Export"})," and download the Work Report. Nothing is sent to MLC, this only reads your file."]})]}),u&&e.jsxs("div",{style:{marginTop:14,padding:"10px 12px",borderRadius:10,background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",color:"#f87171",fontSize:13,display:"flex",gap:8,alignItems:"flex-start"},children:[e.jsx(q,{style:{width:15,height:15,flexShrink:0,marginTop:1}})," ",u]}),e.jsxs("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end",gap:10},children:[e.jsx("button",{onClick:f,className:"rc-btn-secondary",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:!n,className:"rc-btn-primary",style:{opacity:n?1:.4,cursor:n?"pointer":"not-allowed"},children:"Import"})]})]}),a==="working"&&e.jsxs("div",{style:{padding:"24px 0",textAlign:"center"},children:[e.jsx("div",{style:{width:40,height:40,margin:"0 auto 16px",borderRadius:"50%",border:"3px solid rgba(124,58,237,0.2)",borderTopColor:"#7C3AED",animation:"spin 0.8s linear infinite"}}),e.jsx("p",{style:{fontSize:14,color:"#c9c9ce",margin:0},children:"Reading your work reportâ¦"}),e.jsx("style",{children:"@keyframes spin{to{transform:rotate(360deg)}}"})]}),a==="done"&&d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{textAlign:"center",padding:"8px 0 20px"},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"rgba(74,222,128,0.15)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 12px"},children:e.jsx(K,{style:{width:24,height:24,color:"#4ADE80"}})}),e.jsx("h3",{style:{fontSize:17,fontWeight:650,color:"#fff",margin:0},children:"Work report imported"}),e.jsxs("p",{style:{fontSize:13,color:"#8b8b90",margin:"4px 0 0"},children:[d.works," work",d.works!==1?"s":""," read from your file."]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10}
34,children:[e.jsx(Ae,{value:d.compositions_created,label:"New works added"}),e.jsx(Ae,{value:d.compositions_enriched,label:"Works enriched"}),e.jsx(Ae,{value:d.writers_created,label:"Writers added"}),e.jsx(Ae,{value:d.publishers_created,label:"Publishers added"})]}),C>0&&e.jsxs("div",{style:{marginTop:12,padding:"12px 14px",borderRadius:10,background:"rgba(74,222,128,0.08)",border:"1px solid rgba(74,222,128,0.2)",display:"flex",gap:10,alignItems:"center"},children:[e.jsx(oe,{style:{width:18,height:18,color:"#4ADE80",flexShrink:0}}),e.jsxs("span",{style:{fontSize:13,color:"#a7f3c0"},children:["Your Writer / Publisher Identity was updated from this file (",C," IPI",C!==1?"s":"",")."]})]}),e.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:e.jsx("button",{onClick:f,className:"rc-btn-primary",children:"Done"})})]})]})]})})}function Ae({value:t,label:s}){return e.jsxs("div",{style:{padding:"14px 16px",borderRadius:10,background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.07)"},children:[e.jsx("p",{style:{fontSize:24,fontWeight:700,color:"#f5f5f4",margin:0,letterSpacing:"-0.03em",fontVariantNumeric:"tabular-nums"},children:t??0}),e.jsx("p",{style:{fontSize:11,color:"#8b8b90",margin:"2px 0 0"},children:s})]})}function mr({open:t,onClose:s,onSuccess:r}){const[n,i]=p.useState(null),[a,c]=p.useState("select"),[d,x]=p.useState(null),[u,h]=p.useState(null),l=p.useRef(null);if(!t)return null;const g=j=>{var o;const b=(o=j.target.files)==null?void 0:o[0];b&&(i(b),h(null)),j.target.value=""},m=async()=>{var b,o;if(!n)return;h(null),c("working");const j=await wt({source:"musicreports",searchQuery:n.name}).catch(()=>null);try{const{file_url:v}=await _.integrations.Core.UploadFile({file:n}),A=await _.functions.invoke("musicReportsStatementImport",{file_url:v,file_name:n.name}),N=A==null?void 0:A.data;if(!(N!=null&&N.success))throw new Error((N==null?void 0:N.error)||"Import failed.");j!=null&&j.id&&(await St(j.id,{total_tracks:((b=N.result)==null?void 0:b.created)||0,new_tracks:((o=N.result)==null?void 0:o.created)||0,existing_tracks:0}),await Me(j.id,{status:"success"})),x(N),c("done")}catch(v){j!=null&&j.id&&await Me(j.id,{status:"failed",errors:[v.message]}),h(v.message),c("select")}},f=()=>{a==="done"&&(r==null||r()),i(null),c("select"),x(null),h(null),s()},y=(d==null?void 0:d.result)||{},C=(d==null?void 0:d.duplicate)===!0,w=j=>`$${Number(j||0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`;return e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.8)",backdropFilter:"blur(4px)"},onClick:j=>j.target===j.currentTarget&&a!=="working"&&f(),children:e.jsxs("div",{style:{width:"100%",maxWidth:480,background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"20px 24px",borderBottom:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:10,background:"#FFF",padding:2,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Je,{fill:!0})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{fontSize:16,fontWeight:650,color:"#fff",margin:0},children:"Import Music Reports Statement"}),e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:"2px 0 0"},children:"Add a Songdex / MRI royalty statement to your Royalty Intelligence."})]}),a!=="working"&&e.jsx("button",{onClick:f,style:{width:32,height:32,borderRadius:8,background:"rgba(255,255,255,0.05)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(te,{style:{width:16,height:16,color:"#8b8b90"}})})]}),e.jsxs("div",{style:{padding:24},children:[a==="select"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{var j;return(j=l.current)==null?void 0:j.click()},style:{width:"100%",padding:"28px 16px",borderRadius:12,background:"rgba(255,255,255,0.02)",border:"1.5px dashed rgba(255,255,255,0.14)",cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"center",gap:10},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:"rgba(124,58,237,0.14)",display:"flex",alignItems:"center",justifyContent:"center"},children:n?e.jsx(et,{style:{width:22,height:22,color:"#A78BFA"}}):e.jsx(ne,{style:{width:22,height:22,color:"#A78BFA"}})}),e.jsx("p",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0},children:n?n.name:"Choose your Music Reports statement"}),e.jsx("p",{style:{fontSize:12,color:"#666",margin:0},children:n?"Click to replace":"The .zip (or the .xls inside it) from Music Reports"}),e.jsx("input",{ref:l,type:"file",accept:".zip,.xls,.xlsx",onChange:g,style:{display:"none"}})]}),e.jsxs("div",{style:{marginTop:14,display:"flex",gap:8,fontSize:12,color:"#8b8b90",lineHeight:1.5},children:[e.jsx(oe,{style:{width:15,height:15,color:"#4ADE80",flexShrink:0,marginTop:1}}),e.jsx("span",{children:'Download the statement from your Music Reports portal and upload it here. We read the "Detail" sheet only. Nothing is sent to Music Reports.'})]}),u&&e.jsxs("div",{style:{marginTop:14,padding:"10px 12px",borderRadius:10,background:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)",color:"#f87171",fontSize:13,display:"flex",gap:8,alignItems:"flex-start"},children:[e.jsx(q,{style:{width:15,height:15,flexShrink:0,marginTop:1}})," ",u]}),e.jsxs("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end",gap:10},children:[e.jsx("button",{onClick:f,className:"rc-btn-secondary",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:!n,className:"rc-btn-primary",style:{opacity:n?1:.4,cursor:n?"pointer":"not-allowed"},children:"Import"})]})]}),a==="working"&&e.jsxs("div",{style:{padding:"24px 0",textAlign:"center"},children:[e.jsx("div",{style:{width:40,height:40,margin:"0 auto 16px",borderRadius:"50%",border:"3px solid rgba(124,58,237,0.2)",borderTopColor:"#7C3AED",animation:"spin 0.8s linear infinite"}}),e.jsx("p",{style:{fontSize:14,color:"#c9c9ce",margin:0},children:"Reading your statementâ¦"}),e.jsx("style",{children:"@keyframes spin{to{transform:rotate(360deg)}}"})]}),a==="done"&&d&&e.jsxs(e.Fragment,{children:[C?e.jsxs("div",{style:{textAlign:"center",padding:"8px 0 20px"},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"rgba(245,158,11,0.15)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 12px"},children:e.jsx(q,{style:{width:24,height:24,color:"#F59E0B"}})}),e.jsx("h3",{style:{fontSize:17,fontWeight:650,color:"#fff",margin:0},children:"Already imported"}),e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:"4px 0 0"},children:y.message||"This statement was already imported."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{textAlign:"center",padding:"8px 0 20px"},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"rgba(74,222,128,0.15)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 12px"},children:e.jsx(K,{style:{width:24,height:24,color:"#4ADE80"}})}),e.jsx("h3",{style:{fontSize:17,fontWeight:650,color:"#fff",margin:0},children:"Statement imported"}),e.jsxs("p",{style:{fontSize:13,color:"#8b8b90",margin:"4px 0 0"},children:[y.service||"Music Reports",y.period?` · ${y.period}`:""]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(Ne,{value:y.created??0,label:"Lines added"}),e.jsx(Ne,{value:w(y.total_amount),label:"Statement total"}),e.jsx(Ne,{value:y.distinct_titles??0,label:"Songs"}
34),e.jsx(Ne,{value:Number(y.total_plays||0).toLocaleString("en-US"),label:"Plays reported"})]})]}),e.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:e.jsx("button",{onClick:f,className:"rc-btn-primary",children:"Done"})})]})]})]})})}function Ne({value:t,label:s}){return e.jsxs("div",{style:{padding:"14px 16px",borderRadius:10,background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.07)"},children:[e.jsx("p",{style:{fontSize:22,fontWeight:700,color:"#f5f5f4",margin:0,letterSpacing:"-0.03em",fontVariantNumeric:"tabular-nums"},children:t??0}),e.jsx("p",{style:{fontSize:11,color:"#8b8b90",margin:"2px 0 0"},children:s})]})}const xr=[{label:"BMI Data",desc:"Upload your BMI repertoire export (CSV or Excel)",page:"BMIData",color:"#7C3AED",Logo:Jt,logoFill:!0,logoBg:"#0063A8"},{label:"SoundExchange",desc:"Upload SoundExchange registration or statement files",page:"SoundExchangeData",color:"#F59E0B",Logo:vt,logoFill:!0,logoBg:"#FFF"},{label:"MLC Data",desc:"Upload your MLC work report (CSV or Excel)",action:"mlc",color:"#4ADE80",Logo:Ze,logoFill:!0,logoBg:"#FFF"},{label:"Music Reports",desc:"Upload a Music Reports (Songdex / MRI) royalty statement",action:"musicReports",color:"#7C3AED",Logo:Je,logoFill:!0,logoBg:"#FFF"},{label:"Catalog Onboard",desc:"Upload ZIP archives, folders, or bulk audio files",action:"catalogGuide",color:"#7C3AED",Icon:Rs,iconTint:"#A78BFA",iconBg:"rgba(124,58,237,0.14)"},{label:"Bulk Audio",desc:"Upload WAV, MP3, or other audio in bulk",action:"bulkAudio",color:"#A78BFA",Icon:Ns,iconTint:"#c4b5fd",iconBg:"rgba(167,139,250,0.14)"},{label:"Contacts CSV",desc:"Upload contacts in bulk from a spreadsheet",action:"contactsCsv",color:"#EC4899",Icon:ws,iconTint:"#f472b6",iconBg:"rgba(236,72,153,0.14)"}];function fr({setCatalogGuideOpen:t,defaultSubView:s="center"}){const[r,n]=p.useState(s),[i,a]=p.useState(!1),[c,d]=p.useState(!1),[x,u]=p.useState(!1),[h,l]=p.useState(!1),g=m=>{if(m.action==="catalogGuide")return t(!0);if(m.action==="contactsCsv")return a(!0);if(m.action==="bulkAudio")return d(!0);if(m.action==="mlc")return u(!0);if(m.action==="musicReports")return l(!0);window.location.href=ge(m.page)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{style:{display:"flex",gap:4,padding:4,borderRadius:12,background:"#161616",border:"1px solid rgba(255,255,255,0.08)",width:"fit-content"},children:[e.jsxs("button",{onClick:()=>n("center"),style:{padding:"8px 20px",borderRadius:9,border:"none",cursor:"pointer",fontWeight:600,fontSize:13,display:"flex",alignItems:"center",gap:7,background:r==="center"?"#7C3AED":"transparent",color:r==="center"?"#FFFFFF":"#9CA3AF",transition:"all 0.2s"},children:[e.jsx(ne,{style:{width:14,height:14}}),"Bulk Import"]}),e.jsxs("button",{onClick:()=>n("history"),style:{padding:"8px 20px",borderRadius:9,border:"none",cursor:"pointer",fontWeight:600,fontSize:13,display:"flex",alignItems:"center",gap:7,background:r==="history"?"#F59E0B":"transparent",color:r==="history"?"#000000":"#9CA3AF",transition:"all 0.2s"},children:[e.jsx(qe,{style:{width:14,height:14}}),"History"]})]}),r==="center"&&e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"28px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,marginBottom:20},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:12,background:"#7C3AED",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(ne,{style:{width:22,height:22,color:"white"}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h3",{style:{fontWeight:650,fontSize:16,letterSpacing:"-0.01em",color:"#FFFFFF",margin:0},children:"Bulk Import"}),e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:"2px 0 0"},children:"Already have your data as files? Upload exports, archives, and CSVs in bulk."})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:xr.map(m=>e.jsxs("button",{onClick:()=>g(m),style:{display:"flex",alignItems:"center",gap:14,padding:"16px 18px",borderRadius:12,background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",cursor:"pointer",textAlign:"left",transition:"all 0.2s"},onMouseEnter:f=>{f.currentTarget.style.borderColor=`${m.color}40`,f.currentTarget.style.background=`${m.color}08`},onMouseLeave:f=>{f.currentTarget.style.borderColor="rgba(255,255,255,0.08)",f.currentTarget.style.background="rgba(255,255,255,0.03)"},children:[m.Logo?e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:m.logoBg||"#FFF",overflow:"hidden",padding:m.logoFill?2:0,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:m.logoFill?e.jsx(m.Logo,{fill:!0}):e.jsx(m.Logo,{size:26})}):m.Icon?e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:m.iconBg,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(m.Icon,{style:{width:22,height:22,color:m.iconTint}})}):e.jsx("span",{style:{fontSize:24},children:m.icon}),e.jsxs("div",{children:[e.jsx("p",{style:{fontWeight:600,fontSize:14,color:"#FFFFFF",margin:0},children:m.label}),e.jsx("p",{style:{fontSize:12,color:"#666",margin:"2px 0 0"},children:m.desc})]})]},m.label))})]}),r==="history"&&e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"28px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,marginBottom:20},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:12,background:"#F59E0B",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(qe,{style:{width:22,height:22,color:"white"}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h3",{style:{fontWeight:650,fontSize:16,letterSpacing:"-0.01em",color:"#FFFFFF",margin:0},children:"Import History"}),e.jsx("p",{style:{fontSize:13,color:"#B3B3B3",margin:"2px 0 0"},children:"All past imports with pipeline results, errors, and enrichment details"})]})]}),e.jsx(pr,{})]}),e.jsx(js,{isOpen:i,onClose:()=>a(!1),onImport:async m=>{m.length>0&&await _.entities.Writer.bulkCreate(m)}}),e.jsx(Mt,{open:c,onClose:()=>d(!1),onSuccess:()=>d(!1)}),e.jsx(gr,{open:x,onClose:()=>u(!1),onSuccess:()=>u(!1)}),e.jsx(mr,{open:h,onClose:()=>l(!1),onSuccess:()=>l(!1)})]})}function da(){const[t,s]=p.useState(null),r=Xe(),[n,i]=p.useState(!0),[a,c]=p.useState("purple"),[d,x]=p.useState(!1),[u,h]=p.useState(!1),[l,g]=p.useState(!1),{paid:m}=xe(),f=()=>{_.auth.me().then(s).catch(()=>{})};p.useEffect(()=>{f()},[]);const y=async()=>{x(!0),_.analytics.track({eventName:"catalog_data_cleared",properties:{}});try{await _.functions.invoke("cleanupDemoData",{action:"deleteMyData"}),r.invalidateQueries(),alert("All data cleared successfully"),window.location.reload()}catch(o){console.error("Delete failed:",o),alert("Failed to clear data: "+o.message)}x(!1),h(!1)},w=new URLSearchParams(window.location.search).get("tab")||"account",j=w==="history"?"import":w,b=w==="history"?"history":"center";return e.jsxs("div",{style:{width:"100%"},className:"space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg sm:text-2xl md:text-[26px]",style:{fontFamily:"'Inter',-apple-system,sans-serif",fontWeight:650,letterSpacing:"-0.025em",color:"#FFFFFF",margin:"2px 0 2px",lineHeight:1.15},children:"Settings"}),e.jsx("p",{style:{fontSize:13.5,color:"#8b8b90",margin:"4px 0 0"},children:"Your profile, your artists, and how your catalog is managed."})]}),e.jsxs(ts,{defaultValue:j,className:"space-y-8",children:[e.jsxs(ss,{className:"w-full flex justify-start bg-transparent p-0 h-auto rounded-none",style:{gap:24,borderBottom:"1px solid rgba(255,255,255,0.07)"},children:[e.jsx(Se,{value:"account",className:"bg-transparent data-[state=active]:bg-transparent data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-white text-[#8b8b90] data-[state=active]:text-white h-auto",style:{fontSize:13.5,fontWeight:500,padding:"0 2px 10px",marginBottom:-1},children:"Account"}),e.jsx(Se,{value:"exports",className:"bg-transparent data-[state=active]:bg-transparent data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-white text-[#8b8b90] data-[state=active]:text-white h-auto",style:{fontSize:13.5,fontWeight:500,padding:"0 2px 10px",marginBottom:-1},children:"Exports"}),e.jsx(Se,{value:"import",className:"bg-transparent data-[state=active]:bg-transparent data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-white text-[#8b8b90] data-[state=active]:text-white h-auto",style:{fontSize:13.5,fontWeight:500,padding:"0 2px 10px",marginBottom:-1},children:"Bulk Import"}),e.jsx(Se,{value:"billing",className:"bg-transparent data-[state=active]:bg-transparent data-[state=active]:shadow-none rounded-none border-b-2 border-transparent data-[state=active]:border-white text-[#8b8b90] data-[state=active]:text-white h-auto",style:{fontSize:13.5,fontWeight:500,padding:"0 2px 10px",marginBottom:-1},children:"Billing"})]}),e.jsx(ve,{value:"exports",className:"space-y-6",children:e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"28px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,marginBottom:20},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:12,background:"#7C3AED",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(be,{style:{width:22,height:22,color:"white"}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h3",{style:{fontWeight:650,fontSize:16,letterSpacing:"-0.01em",color:"#FFFFFF",margin:0},children:"Export Center"}),e.jsx("p",{style:{fontSize:13,color:"#8b8b90",margin:"2px 0 0"},children:"Download your catalog and registration files."})]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[{Icon:et,iconTint:"#A78BFA",iconBg:"rgba(124,58,237,0.14)",color:"#7C3AED",label:"Full Catalog",desc:"Your entire catalog as a CSV file.",Btn:Ts,btnClass:"rc-btn-primary"},{Logo:Je,color:"#2563EB",label:"Music Reports Catalog",desc:"Your catalog in the Music Reports (Songdex) 27-column upload format.",note:"You upload this file at Music Reports.",Btn:zs,btnClass:"rc-btn-secondary"},{Logo:Ze,color:"#4ADE80",label:"MLC Registration File",desc:"Works still missing an MLC registration.",n
34ote:"Registration is automatic now, so this is a fallback.",Btn:Es,btnClass:"rc-btn-secondary"},{Logo:vt,color:"#F59E0B",label:"SoundExchange File",desc:"Your recordings in the SoundExchange ISRC Ingest format.",note:"Log in to SoundExchange, choose Bulk Import, and upload this file.",Btn:Bs,btnClass:"rc-btn-secondary"}].map(o=>e.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:14,padding:"16px 18px",borderRadius:12,background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",transition:"all 0.2s"},onMouseEnter:v=>{v.currentTarget.style.borderColor=`${o.color}40`,v.currentTarget.style.background=`${o.color}08`},onMouseLeave:v=>{v.currentTarget.style.borderColor="rgba(255,255,255,0.08)",v.currentTarget.style.background="rgba(255,255,255,0.03)"},children:[o.Logo?e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:"#FFF",overflow:"hidden",padding:2,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(o.Logo,{fill:!0})}):e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:o.iconBg,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(o.Icon,{style:{width:22,height:22,color:o.iconTint}})}),e.jsxs("div",{style:{flex:1,minWidth:200},children:[e.jsx("p",{style:{fontWeight:600,fontSize:14,color:"#FFFFFF",margin:0},children:o.label}),e.jsxs("p",{style:{fontSize:12,color:"#8b8b90",margin:"2px 0 0"},children:[o.desc,o.note&&e.jsxs("span",{style:{color:"#55555a"},children:[" ",o.note]})]})]}),m?e.jsx(o.Btn,{className:`${o.btnClass} text-sm px-4 py-2 flex items-center justify-center gap-2 shrink-0 w-[220px]`}):e.jsx(Ws,{exportName:o.label})]},o.label))})]})}),e.jsx(ve,{value:"import",className:"space-y-6",children:e.jsx(fr,{setCatalogGuideOpen:g,defaultSubView:b})}),e.jsxs(ve,{value:"billing",className:"space-y-6",children:[e.jsx(qs,{}),(t==null?void 0:t.role)==="admin"&&e.jsx(Vs,{}),(t==null?void 0:t.role)==="admin"&&e.jsx(Gs,{}),(t==null?void 0:t.role)==="admin"&&e.jsx(Hs,{})]}),e.jsxs(ve,{value:"account",className:"space-y-0",children:[e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",marginBottom:12,paddingLeft:2},children:"Profile"}),e.jsx(Os,{user:t,onUpdate:f}),e.jsx("div",{style:{marginTop:12},children:e.jsx($s,{user:t,onUpdate:f})})]}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",marginBottom:12,paddingLeft:2},children:"Writer / Publisher Identity"}),e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"8px 20px"},children:[e.jsx(ds,{user:t,onUpdate:f,embedded:!0,label:"Writer"}),e.jsx("div",{style:{height:1,background:"rgba(255,255,255,0.06)",margin:"4px 0"}}),e.jsx(Ls,{user:t,onUpdate:f,embedded:!0,label:"Publisher"})]})]}),(t==null?void 0:t.role)==="admin"&&e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",marginBottom:12,paddingLeft:2},children:"Public Catalog"}),e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"18px 20px",display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:"rgba(74,222,128,0.12)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Ss,{style:{width:22,height:22,color:"#4ADE80"}})}),e.jsxs("div",{style:{flex:1,minWidth:220},children:[e.jsx("p",{style:{fontWeight:600,fontSize:14,color:"#FFFFFF",margin:0},children:"Share a public page of your songs"}),e.jsx("p",{style:{fontSize:12,color:"#8b8b90",margin:"2px 0 0"},children:"Pick which songs show, add your links, and send one page to anyone."})]}),e.jsx("a",{href:ge("PublicCatalog"),style:{textDecoration:"none"},children:e.jsx("button",{className:"rc-btn-primary",style:{background:"linear-gradient(135deg, #7C3AED, #9333EA)",border:"none",borderRadius:10,fontWeight:600,fontSize:13,padding:"10px 18px",color:"#FFF",cursor:"pointer",whiteSpace:"nowrap"},children:"Set up"})})]})]}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",marginBottom:12,paddingLeft:2},children:"Emails"}),e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"18px 20px",display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:"rgba(96,165,250,0.14)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Kt,{style:{width:22,height:22,color:"#60A5FA"}})}),e.jsxs("div",{style:{flex:1,minWidth:220},children:[e.jsx("p",{style:{fontWeight:600,fontSize:14,color:"#FFFFFF",margin:0},children:"Email me about my account"}),e.jsx("p",{style:{fontSize:12,color:"#8b8b90",margin:"2px 0 0"},children:"Songs we claimed for you, claim results, finished syncs, and a weekly summary."})]}),e.jsx(kt,{checked:(t==null?void 0:t.email_notifications)!==!1,onCheckedChange:async o=>{s(v=>v&&{...v,email_notifications:o});try{await _.auth.updateMe({email_notifications:o})}catch(v){console.error("Failed to save email preference:",v),f()}},className:"data-[state=checked]:bg-emerald-500"})]})]}),e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",marginBottom:12,paddingLeft:2},children:"AI Access"}),e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:16,padding:"18px 20px",display:"flex",alignItems:"center",gap:14,flexWrap:"wrap"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:"rgba(124,58,237,0.14)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Ye,{style:{width:22,height:22,color:"#A78BFA"}})}),e.jsxs("div",{style:{flex:1,minWidth:220},children:[e.jsx("p",{style:{fontWeight:600,fontSize:14,color:"#FFFFFF",margin:0},children:"Ask Claude or ChatGPT about your royalties"}),e.jsxs("p",{style:{fontSize:12,color:"#8b8b90",margin:"2px 0 0"},children:["Connect your account to an AI assistant and ask about earnings, gaps, and
34your catalog."," ",e.jsx("a",{href:ge("MCPPrompts"),style:{color:"#A78BFA",textDecoration:"none"},children:"See example prompts"})]})]}),e.jsx("a",{href:ge("MCP"),style:{textDecoration:"none"},children:e.jsx("button",{className:"rc-btn-primary",style:{background:"linear-gradient(135deg, #7C3AED, #9333EA)",border:"none",borderRadius:10,fontWeight:600,fontSize:13,padding:"10px 18px",color:"#FFF",cursor:"pointer",whiteSpace:"nowrap"},children:"Set up"})})]})]}),(t==null?void 0:t.role)==="admin"&&e.jsxs("div",{style:{marginBottom:32},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#55555a",marginBottom:12,paddingLeft:2},children:"Quick Actions"}),e.jsx("div",{style:{background:"#161618",border:"1px solid rgba(255,255,255,0.07)",borderRadius:14,overflow:"hidden"},children:e.jsxs("button",{onClick:async()=>{await _.auth.updateMe({onboarding_completed:!1}),window.location.href=ge("Onboarding")},style:{width:"100%",display:"flex",alignItems:"center",gap:14,padding:"16px 20px",background:"transparent",border:"none",color:"#A78BFA",fontWeight:500,fontSize:14,cursor:"pointer",transition:"background 0.15s",textAlign:"left"},onMouseEnter:o=>{o.currentTarget.style.background="rgba(255,255,255,0.03)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent"},children:[e.jsx(Ye,{style:{width:17,height:17,flexShrink:0}}),e.jsx("span",{style:{flex:1},children:"Restart Onboarding"}),e.jsx("span",{style:{color:"#333",fontSize:18},children:"âº"})]})})]}),e.jsxs("div",{style:{marginBottom:8},children:[e.jsx("p",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.09em",textTransform:"uppercase",color:"#EF4444",marginBottom:12,paddingLeft:2},children:"Danger Zone"}),e.jsxs("div",{style:{background:"#161618",border:"1px solid rgba(239,68,68,0.12)",borderRadius:14,padding:"24px"},children:[e.jsx("p",{style:{fontSize:13,color:"#888",marginBottom:16,lineHeight:1.6},children:"Clear all your catalog data including tracks, works, writers, releases, and split sheets. This action cannot be undone."}),e.jsxs("button",{onClick:()=>h(!0),disabled:d,style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 20px",borderRadius:10,background:"transparent",border:"1.5px solid rgba(239,68,68,0.25)",color:"#EF4444",fontWeight:600,fontSize:13,cursor:"pointer",opacity:d?.6:1,transition:"all 0.15s"},onMouseEnter:o=>{o.currentTarget.style.background="#EF4444",o.currentTarget.style.color="white",o.currentTarget.style.borderColor="#EF4444"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="#EF4444",o.currentTarget.style.borderColor="rgba(239,68,68,0.25)"},children:[d?e.jsx(z,{style:{width:15,height:15},className:"animate-spin"}):e.jsx(Ue,{style:{width:15,height:15}}),"Clear All Catalog Data"]})]})]})]})]}),e.jsx(sn,{open:l,onClose:()=>g(!1),onSuccess:()=>{g(!1),window.location.reload()}}),e.jsx(fe,{open:u,onOpenChange:h,children:e.jsxs(ye,{children:[e.jsxs(Ge,{children:[e.jsxs(Qe,{style:{color:"#DC2626",display:"flex",alignItems:"center",gap:8},children:[e.jsx(se,{style:{width:18,height:18}})," Clear All Data?"]}),e.jsxs(es,{style:{color:"#4B5563"},children:["This will permanently delete all your catalog data including tracks, works, writers, releases, split sheets, playlists, folders, and tags. ",e.jsx("strong",{style:{color:"#DC2626"},children:"This action cannot be undone."})]})]}),e.jsxs(jt,{children:[e.jsx("button",{onClick:()=>h(!1),style:{padding:"10px 20px",borderRadius:10,background:"rgba(255,255,255,0.06)",border:"1px solid rgba(255,255,255,0.1)",color:"#9CA3AF",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Cancel"}),e.jsxs("button",{onClick:y,disabled:d,style:{padding:"10px 20px",borderRadius:10,background:"rgba(239,68,68,0.12)",border:"1px solid rgba(239,68,68,0.25)",color:"#EF4444",fontWeight:700,fontSize:13,cursor:"pointer",display:"flex",alignItems:"center",gap:7,opacity:d?.6:1},children:[d?e.jsx(z,{style:{width:14,height:14},className:"animate-spin"}):e.jsx(Ue,{style:{width:14,height:14}}),"Yes, Delete Everything"]})]})]})})]})}export{da as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.