import{j as t,Z as d,T as e,N as j,ag as h,q as v,M as C,r as N}from"./main-D6SjkSWq.js";import{u as A,A as P}from"./use-create-album-DiV3HOq0.js";import{g as I}from"./album-link-C4KAB_gW.js";import{C as k}from"./crupdate-resource-layout-IY4TseVy.js";import{u as F}from"./normalized-model-field-BnOhtjjx.js";import{F as S,u as B}from"./file-upload-provider-C966C2x1.js";import{B as c,a as i}from"./breadcrumb-Pvuej4Ko.js";import{u as w}from"./use-current-date-time-jPIHAlBp.js";import"./FileUpload-UbHUpO6u.js";import"./Add-DqbkGfuM.js";import"./DragHandle-BRI8g7Dj.js";import"./Edit-Cysuqwzc.js";import"./track-form-BXwKM7r0.js";import"./paginated-resources-C0CNliR6.js";import"./external-ids-fields-CaZSeG7G.js";import"./image-selector-CCexW8Lt.js";import"./use-active-upload-DElCZe_0.js";import"./open-upload-window-DxsWEG58.js";import"./uploaded-file-Dt7HVOVK.js";import"./extension-from-filename-O0XMuZye.js";import"./AddAPhoto-BPK-B3uy.js";import"./file-input-config-DrcTpI3-.js";import"./pretty-bytes-bO14ePu9.js";import"./generate-waveform-data-BFwf5N3g.js";import"./form-chip-field-CRtNtvyR.js";import"./input-CalT3wzl.js";import"./chip-list-CvrJkGlz.js";import"./chevron-down-BqXy_cI5.js";import"./genre-B_3ZyEC1.js";import"./form-normalized-model-chip-field-D_4zoyut.js";import"./use-normalized-models-D9FqQyBj.js";import"./formatted-duration-DCG54VKZ.js";import"./use-update-track-form-Bu6Z0muA.js";import"./dialog-footer-es-AfbvV.js";import"./confirmation-dialog-E4zsogCz.js";import"./music-Bh2SQVZ2.js";import"./use-create-track-form-YB1VLkNn.js";import"./drag-preview-CXPJ-ndi.js";import"./use-sortable-DcRWGT7A.js";import"./getScrollParent--OCc5gFh.js";import"./useGlobalListeners-DfpyJoKy.js";import"./date-picker-Da-XW59V.js";import"./use-date-formatter-DZ85Tkvk.js";import"./DateFormatter-Dix9bfnP.js";import"./use-base-date-picker-state-CdtiH2H_.js";import"./KeyboardArrowRight-Cz-JHdeb.js";import"./datatable-page-with-header-layout-BuTOEIJh.js";import"./dashboard-layout-context-C1ErlVWg.js";import"./select-BkmhiFLy.js";import"./combobox-end-adornment-Btuckat_.js";import"./skeleton-3NNrk_-o.js";import"./traditional-GTMgz7Xu.js";import"./useEffectEvent-Bb2YhEEQ.js";import"./ChevronRight-BN6UJOeQ.js";import"./MoreHoriz-Bms6kOtf.js";function z({breadcrumbs:r,navbar:m}){return t.jsx(S,{children:t.jsx(E,{breadcrumbs:r,navbar:m})})}function E({breadcrumbs:r,navbar:m}){const x=!!B(n=>n.activeUploadsCount),b=w(),a=h(),{pathname:g}=v(),[l]=d(),{data:p}=F(`normalized-models/artist/${l.get("artistId")}`,void 0,{enabled:!!l.get("artistId")}),s=p==null?void 0:p.model,o=C({defaultValues:{release_date:b.toAbsoluteString()}}),u=A(o);return N.useEffect(()=>{s&&o.reset({artists:[s]})},[s,o]),t.jsx(k,{form:o,onSubmit:n=>{u.mutate(n,{onSuccess:f=>{g.includes("admin")?a(s?`/admin/artists/${s.id}/edit`:"/admin/albums"):a(I(f.album))}})},title:r??t.jsxs(c,{size:"xl",children:[t.jsx(i,{to:"/admin/albums",children:t.jsx(e,{message:"Albums"})}),t.jsx(i,{children:t.jsx(e,{message:"New"})})]}),isLoading:u.isPending||x,disableSaveWhenNotDirty:!0,navbar:m,children:t.jsx(P,{showExternalIdFields:!0})})}function Mt(){const[r]=d();return t.jsx("div",{className:"h-screen",children:t.jsx(z,{navbar:t.jsx(j,{className:"flex-shrink-0",color:"bg",darkModeColor:"bg"}),breadcrumbs:t.jsxs(c,{size:"xl",children:[t.jsx(i,{to:`/backstage/artists/${r.get("artistId")}/edit`,children:t.jsx(e,{message:"Backstage"})}),t.jsx(i,{children:t.jsx(e,{message:"New album"})})]})})})}export{Mt as BackstageCreateAlbumPage,z as Component};
