1import{r as i,j as p,R as V}from"./react-vendor-n58YcWca.js";import{P as e,u as C}from"./useMixpanelEvent-CwzNdz1P.js";import{C as Y}from"./useAnnotationTracking-DrBXe9JK.js";import{q as v,A as E}from"./styled-components.browser.esm-bLCX9LcF.js";import{u as O}from"./useIsMobile-llXUX10l.js";import{S as P,r as I}from"./SelectInput-CayI5ibb.js";import{d as k,a as L,c as T}from"./Field-7_89C2Bv.js";import{u as $}from"./useCurrentUser-BB1IhaAC.js";const W=t=>{const a=typeof t=="function",l=i.useRef(t);i.useEffect(()=>{l.current=t}),i.useEffect(()=>{if(a){const r=n=>{const s=l.current(n);if(typeof s=="string")return n.preventDefault(),n.returnValue=s;if(n.defaultPrevented)return n.returnValue=""};return window.addEventListener("beforeunload",r),()=>{window.removeEventListener("beforeunload",r)}}},[a])},q=(t,a)=>t?new Date(a||new Date().getFullYear(),t,0).getDate():31,d=({onChange:t,disabled:a=!1,month:l=null,day:r=null,year:n=null,clearable:s=!0,minimumYear:c=0,className:f,customStyles:m,customLabels:g})=>{const h=new Date().getFullYear()+1,{t:u}=C(),b=O(),x=g||{month:u("date_input.month"),day:u("date_input.day"),year:u("date_input.year")},_=i.useCallback(o=>u(`date_input.months.${o}`),[u]),w=i.useMemo(()=>q(Number(l),n),[l,n]),D=I(1,13).map(o=>({label:_(o),value:o})),R=I(1,w+1).map(o=>({label:o,value:o})),j=I(h,c,-1).map(o=>({label:o,value:o})),M=i.useCallback(o=>{t({month:l,day:o?.value??null,year:n})},[l,n,t]),S=i.useCallback(o=>{t({month:o?.value??null,day:r,year:n})},[r,n,t]),N=i.useCallback(o=>{t({month:l,day:r,year:o?.value??null})},[l,r,t]);return p.jsxs(d.Root,{isMobile:b,className:f,children:[p.jsx(d.SelectInput,{isClearable:s,placeholder:u("date_input.month"),selectProps:{"aria-label":x.month},isMobile:b,options:D,controlledValue:l===null?null:D[l-1],onChange:S,disabled:a,customStyles:m}),p.jsx(d.SelectInput,{isClearable:s,placeholder:u("date_input.day"),selectProps:{"aria-label":x.day},isMobile:b,options:R,controlledValue:r?R[r-1]:null,onChange:M,disabled:a,customStyles:m}),p.jsx(d.SelectInput,{isClearable:s,placeholder:u("date_input.year"),selectProps:{"aria-label":x.year},isMobile:b,options:j,controlledValue:n?j[h-n]:null,onChange:N,disabled:a,customStyles:m})]})};d.propTypes={onChange:e.func.isRequired,disabled:e.bool,month:e.number,day:e.number,year:e.number,clearable:e.bool,minimumYear:e.number,className:e.string,customStyles:e.object,customLabels:e.shape({month:e.string,day:e.string,year:e.string})};d.displayName="DateInput";const A=V.memo(d);d.Root=v.div.withConfig({displayName:"DateInput__Root",componentId:"sc-6feb7f29-0"})(["",""],t=>!t.isMobile&&E(["display:flex;flex-direction:row;align-items:center;"]));d.SelectInput=v(P).withConfig({displayName:"DateInput__SelectInput",componentId:"sc-6feb7f29-1"})(["flex:1;"," &:not(:last-child){","}",""],t=>t.isMobile?"width: 100%;
1":"",t=>t.isMobile?`margin-bottom: ${t.theme.space.half};`:`margin-right: ${t.theme.space.full};`,t=>t.disabled&&`&:last-of-type { 2 margin-right: 0; 3 }`);const F=({name:t,label:a,defaultValue:l={month:null,day:null,year:null},disabled:r=!1,clearable:n=!0,minimumYear:s=0,className:c,customStyles:f,customLabels:m,rules:g={}})=>p.jsx(Y,{name:t,defaultValue:l,rules:g,render:({field:{value:y,onChange:h,ref:u},fieldState:b})=>p.jsxs(k,{as:"fieldset",ref:u,tabIndex:-1,children:[a&&p.jsx(L,{as:"legend",children:a}),p.jsx(A,{month:y?.month??null,day:y?.day??null,year:y?.year??null,onChange:h,disabled:r,clearable:n,minimumYear:s,customStyles:f,customLabels:m,className:c}),b.error&&p.jsx(T,{children:b.error.message})]})});F.propTypes={name:e.string.isRequired,label:e.string,defaultValue:e.shape({month:e.number,day:e.number,year:e.number}),disabled:e.bool,clearable:e.bool,minimumYear:e.number,className:e.string,customStyles:e.object,customLabels:e.shape({month:e.string,day:e.string,year:e.string}),rules:e.object};F.displayName="DateField";const X=()=>{const{t}=C(),a=$(),l=i.useMemo(()=>{const s=[...a?.rolesForRestrictVisibilityOfSong||[]],c=s.findIndex(([f])=>f===a.roleForDisplay);return c>0&&s.unshift(...s.splice(c,1)),s},[a.roleForDisplay,a.rolesForRestrictVisibilityOfSong]),r=i.useMemo(()=>l.map(([s,c])=>({value:c,label:t(`role.types.${s}.other`)})),[l,t]),n=i.useCallback(s=>l.find(([f,m])=>m===s)?.[0],[l]);return{roles:l,options:r,getRoleNameById:n}};export{F as D,A as a,W as l,X as u}; 4//# sourceMappingURL=useAvailableRoles-DzAOXxRP.js.map
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.