1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6988],{6124:(e,t,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/register/[auditionId]",function(){return i(93599)}])},33638:(e,t,i)=>{"use strict";i.d(t,{r:()=>n});let n=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t}).format(e)},40111:(e,t,i)=>{"use strict";i.d(t,{Ds:()=>r,IN:()=>a,K_:()=>d,MY:()=>c,TE:()=>s,YO:()=>n,_D:()=>l,pL:()=>o,t5:()=>u});let n="AuditionLocationCounts",s="AuditionPromotion",r="SetAuditionPromotion",a="AuditionUploads",o="DecisionEmail",l="SaveDecisionEmailTemplate",u="SendDecisionEmail",d="Template",c="Waiver"},43014:(e,t,i)=>{"use strict";i.d(t,{AL:()=>I,C0:()=>x,Cg:()=>_,D:()=>T,S7:()=>b,Vq:()=>O,XX:()=>S,Zr:()=>E,bu:()=>A,gO:()=>w,mg:()=>v,rF:()=>j});var n=i(14232),s=i(2491),r=i(27148),a=i(67768),o=i(40097),l=i(83597),u=i(84764),d=i(58407),c=i(32044),m=i(23737);let p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e?.status??"all_status",i=e?.isDecisionCompleted===void 0?"all_decision":e?.isDecisionCompleted,n=e?.filterLocations?.sort()||"all_locations",s=e?.filterLocationType||"all_location_type",r=e?.filterPrograms?.sort()||"all_programs",a=e?.filterDecisions?.sort()||"all_decisions",o=e?.filterScholarships?.sort()||"all_scholarships";return[t,i,n,s,r,a,o,e?.filterGenders?.sort()||"all_genders","boolean"==typeof e?.emailSent?e?.emailSent:"all_email_sent"]},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e?.status??"all_status";return[t,e?.isDecisionCompleted===void 0?"all_decision":e?.isDecisionCompleted,e?.startTime?.toISOString()||"all_start_time"]},h=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{limit:t,currentPage:i}=e?.pagination||{limit:"all_record",currentPage:"all_record"};return[{limit:t,currentPage:i}]},f={all:["Submission"],submission:e=>[...f.all,e],lists:()=>[...f.all,"List"],submissionsByUserId:e=>[...f.lists(),"ByUserId",e],submissionsByAuditionId:(e,t)=>[...f.lists(),"ByAuditionId",e,...p(t),...h(t)],submissionsCountByAuditionId:(e,t)=>[...f.lists(),"ByAuditionId",e,"count",...p(t)],submissionsCountByOrgId:(e,t)=>{let[i,n,s]=y(t);return[...f.lists(),"CountByOrganizationId",e,i,n,s]},submissionsByOrgId:(e,t)=>{let[i]=p(t);return[...f.lists(),"CountByOrganizationId",e,i]}},g=(e,t)=>({queryKey:f.submission(e),queryFn:async()=>t.getSubmission(e),enabled:!!e}),x=e=>{let t=(0,n.useContext)(u.ZJ);return(0,s.I)(g(e,t))},S=e=>{let t=(0,n.useContext)(u.ZJ);return(0,r.E)({queries:e.map(e=>g(e,t))})},I=e=>{let t=(0,n.useContext)(u.ZJ),{uid:i}=(0,n.useContext)(d.l),r=e&&i?(0,m.m)(e,i):"";return(0,s.I)({queryKey:f.submission(r),queryFn:async()=>t.getSubmission(r),enabled:!!r})},j=e=>{let t=(0,a.jE)(),{uid:i}=(0,n.useContext)(d.l),s=e&&i?(0,m.m)(e,i):"";return async()=>{await t.invalidateQueries({queryKey:f.submission(s)})}},b=()=>{let e=(0,a.jE)();return async()=>{await e.invalidateQueries({queryKey:f.lists()})}},T=()=>{let e=(0,n.useContext)(u.ZJ),t=(0,n.useContext)(d.l).uid??"",{data:i}=(0,s.I)({queryKey:f.submissionsByUserId(t),queryFn:async()=>e.submissionsByUserId(t),enabled:!!t});return i},C=(e,t,i)=>({queryKey:f.submissionsCountByAuditionId(t,i),queryFn:async()=>e.submissionsCountByAuditionId(t,i),enabled:!!t}),v=(e,t)=>{let i=(0,n.useContext)(u.ZJ);return(0,s.I)(C(i,e,t))},w=e=>{let t=(0,n.useContext)(u.ZJ),i=e.flatMap(e=>((e,t)=>t.locations.reduce((e,t)=>(e.includes(t.locationType)||e.push(t.locationType),e),[]).map(i=>C(e,t.id,{status:c.zS.SUBMITTED,filterLocationType:i})))(t,e)),s=(0,r.E)({queries:i}),a=l.yU6(i,s).map(e=>{let[t,i]=e;return{auditionId:t.queryKey[3],locationType:t.queryKey[8],...i}});return e.reduce((e,t)=>{let i=a.filter(e=>{let{auditionId:i}=e;return i===t.id});return e[t.id]=i.reduce((e,t)=>(t.isSuccess&&(e[t.locationType]=t.data),e),{}),e},{})},A=(e,t)=>{let i=(0,n.useContext)(u.ZJ);return(0,s.I)({queryKey:f.submissionsByOrgId(e,t),queryFn:async()=>i.submissionsByOrgId(e,t),enabled:!!e})},O=(e,t)=>{let i=(0,n.useContext)(u.ZJ);return(0,s.I)({queryKey:f.submissionsCountByOrgId(e,t),queryFn:async()=>i.submissionsCountByOrgId(e,t),enabled:!!e})},_=()=>{let e=(0,n.useContext)(u.ZJ),t=(0,a.jE)();return(0,o.n)({mutationFn:async t=>{let{isCreating:i,...n}=t;if(n.id!==(0,m.m)(n.auditionId,n.uid))throw ReferenceError("Invalid submission ID!");return i?await e.createSubmission(n):await e.createOrUpdateSubmission(n),n},onSuccess:e=>{let i=f.submission(e.id);t.setQueryData(i,e),t.invalidateQueries({queryKey:i,refetchType:"none"}),t.setQueriesData({queryKey:f.lists()},t=>{let i=!1,n=[];return Array.isArray(t)?(t.forEach(t=>{t.id===e.id?(n.push(e),i=!0):n.push(t)}),i)?n:[...n,e]:t}),t.invalidateQueries({queryKey:f.lists(),refetchType:"none"})}})},E=()=>{let e=(0,n.useContext)(u.ZJ),t=(0,a.jE)();return(0,o.n)({mutationFn:async t=>(await e.deleteSubmission(t),t),onSuccess:e=>{let i=f.submission(e);t.setQueryData(i,void 0),t.invalidateQueries({queryKey:i,refetchType:"none"}),t.setQueriesData({queryKey:f.lists()},t=>{let i=[];return t?.forEach(t=>{t.id!==e&&i.push(t)}),i}),t.invalidateQueries({queryKey:f.lists(),refetchType:"none"})}})}},45261:(e,t,i)=>{"use strict";i.d(t,{RW:()=>d,Yt:()=>p,hv:()=>m});var n=i(14232),s=i(2491),r=i(27148),a=i(38545),o=i(40111),l=i(84764);let u={all:["Audition"],audition:e=>[...u.all,e]},d=e=>{let t=(0,n.useContext)(l.ZJ),{data:i}=(0,s.I)({queryKey:u.audition(e),queryFn:()=>t.getAudition(e),enabled:!!e}),r=i?.templateId,{data:d}=(0,s.I)({queryKey:[o.K_,r],queryFn:async()=>t.getTemplate(r),enabled:!!r}),c=i?.auditionUploadsId,{data:m}=(0,s.I)({queryKey:[o.IN,c],queryFn:async()=>t.getTemplate(c,a.eW),enabled:!!c}),p=i?.waiverId,{data:y}=(0,s.I)({queryKey:[o.MY,p],queryFn:async()=>t.getTemplate(p,a.e3),enabled:!!p});return{audition:i,additionalQuestionsTemplate:d,auditionUploadsTemplate:m,waiverTemplate:y}},c=(e,t)=>({queryKey:u.audition(e),queryFn:()=>t.getAudition(e),enabled:!!e}),m=e=>{let t=(0,n.useContext)(l.ZJ);return(0,s.I)(c(e,t))}
1,p=e=>{let t=(0,n.useContext)(l.ZJ);return(0,r.E)({queries:e.map(e=>c(e,t))})}},50029:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n,s=i(14232);function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(null,arguments)}let a=e=>s.createElement("svg",r({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 12 12"},e),n||(n=s.createElement("path",{fill:"#000",d:"m6.814 2.185 3 3L3.3 11.701l-2.675.295a.563.563 0 0 1-.62-.621L.3 8.698zm4.856-.447L10.262.33a1.126 1.126 0 0 0-1.592 0L7.345 1.655l3 3L11.67 3.33c.44-.44.44-1.152 0-1.592"})))},57379:(e,t,i)=>{"use strict";i.d(t,{k:()=>r});var n=i(37876),s=i(2031);let r=()=>(0,n.jsx)(s.y,{thickness:"4px",speed:"0.65s",emptyColor:"gray.200",color:"brand.500",size:"xl"})},85509:(e,t,i)=>{"use strict";i.d(t,{DW:()=>h,EG:()=>d,Te:()=>u,WE:()=>p,_4:()=>l,fy:()=>f,pA:()=>c,vt:()=>y,wI:()=>m});var n=i(89614),s=i(31065),r=i(22838),a=i(96720),o=i(85641);let l=e=>{switch(e.locationType){case s.C.IN_PERSON:return"In Person";case s.C.PHOTO_SUBMISSION:return"Photo Submission";case s.C.VIDEO_SUBMISSION:return"Video Submission";case s.C.VIRTUAL:return"Virtual";default:return"Unknown Location Type"}},u=e=>[...e].sort((e,t)=>{let i=[s.C.IN_PERSON,s.C.VIRTUAL,s.C.PHOTO_SUBMISSION,s.C.VIDEO_SUBMISSION];return i.indexOf(e.locationType)-i.indexOf(t.locationType)}),d=e=>{if(!e||e.locationType===s.C.PHOTO_SUBMISSION||e.locationType===s.C.VIDEO_SUBMISSION)return"-";let t=e.dateTime?.toDate();if(!t)return"-";let i=e.timezone?.utc??r.G.utc;return(0,n.qD)(t,i,"MMM dd, yyyy")},c=e=>e&&e.locationType!==s.C.PHOTO_SUBMISSION&&e.locationType!==s.C.VIDEO_SUBMISSION&&e.dateTime&&e.timezone?.utc?(0,n.qD)(e.dateTime.toDate(),e.timezone.utc,"hh:mm aaa (zzz)"):"",m=e=>e.locationType===s.C.PHOTO_SUBMISSION?"Photo":e.locationType===s.C.VIDEO_SUBMISSION?"Video":`${d(e)}`,p=e=>{if(!e)return"";let t=y(e);return(0,o.K1)(e)?`${y(e)} (${(0,o.K1)(e)})`:t},y=e=>{if(!e)return"-";if(e.locationType!==s.C.IN_PERSON)return l(e);let{address:t}=e,{city:i,state:n,country:r}=t||{};return(0,a.XH)(i||"",n,r||"")},h=(e,t)=>void 0!==t.maxApplicants&&e>=t.maxApplicants,f=(e,t)=>e?.submitted[t.uuid]?.count??0},85641:(e,t,i)=>{"use strict";i.d(t,{K1:()=>g,NI:()=>c,NW:()=>h,Qr:()=>u,TZ:()=>m,V4:()=>p,Wc:()=>f,Zx:()=>y,kg:()=>d});var n=i(89584),s=i(78603),r=i(78664),a=i(89614),o=i(31065),l=i(22838);let u=e=>void 0!==e&&"Invalid Date"!=`${new Date(e)}`&&!Number.isNaN(new Date(e)),d=(e,t,i)=>e&&u(e)?(0,a.uk)(e,t||l.G.utc).toISOString():i?e:"",c=(e,t,i)=>{try{let s=((e,t)=>e&&u(e)?(0,a.L_)(e,t||l.G.utc):"")(e,t);return s?(0,n.GP)(s,i||"MMM dd, yyyy"):""}catch{return""}},m=(e,t)=>c(e,t,"yyyy-MM-dd"),p=e=>(0,n.GP)(e,"yyyy-MM-dd"),y=(e,t,i)=>{let n=new Date,r=0,o=()=>(0,a.uk)(new Date(e+Math.floor((t+r)/12),(t+r)%12,1),i),l=new Map;for(;(0,s.Y)(o(),n);){let e=(0,a.L_)(o(),i),t=e.getFullYear(),n=e.getMonth();l.has(t)||l.set(t,[]),l.get(t).push(n),r+=1}return l.forEach(e=>{e.sort((e,t)=>t-e)}),new Map([...l.entries()].sort((e,t)=>t[0]-e[0]))},h=e=>{let t=new Date,i=t.getMonth()-e,n=t.getFullYear()+Math.floor(i/12);return t.setFullYear(n),t.setMonth((i%12+12)%12),t},f=e=>{if(e<0||e>11)return"Invalid Month";let t=new Date(2e3,e);return(0,n.GP)(t,"MMMM")},g=e=>{if(!e||e.locationType===o.C.PHOTO_SUBMISSION||e.locationType===o.C.VIDEO_SUBMISSION||!e.dateTime||!e.timezone?.utc)return"";let t=e.dateTime.toDate(),i=e.timezone.utc;return(0,a.qD)(t,i,"M/dd/yyyy hh:mm aa z",{locale:r.c})}},86891:(e,t,i)=>{"use strict";i.d(t,{Xv:()=>g,qX:()=>x,q_:()=>S,ZJ:()=>I,YD:()=>j});var n=i(14232),s=i(15298),r=i(2491),a=i(27148),o=i(67768),l=i(40097),u=i(79052),d=i.n(u),c=i(84764);let m=e=>e instanceof FileList;var p=i(95454);let{logger:y}=s.yf,h={all:["DownloadURL"],url:e=>[...h.all,e]},f=(e,t)=>({queryKey:h.url(e),queryFn:async()=>e?.startsWith("gs://")?t.getDownloadURL(e):e,enabled:!!e}),g=e=>{let t=(0,n.useContext)(c.ZJ);return(0,r.I)(f(e,t))},x=e=>{let t=(0,n.useContext)(c.ZJ);return(0,a.E)({queries:e.map(e=>f(e,t))})},S=e=>{let t=(0,o.jE)();return async()=>{await t.invalidateQueries({predicate:t=>t.queryKey[0]===h.all[0]&&"string"==typeof t.queryKey[1]&&t.queryKey[1].includes(`profiles/${e}`)})}},I=(e,t)=>{let i=(0,o.jE)();return async()=>{await i.invalidateQueries({predicate:i=>i.queryKey[0]===h.all[0]&&"string"==typeof i.queryKey[1]&&i.queryKey[1].includes(`submissions/${e}/${t}`)})}},j=()=>{let e=(0,n.useContext)(c.ZJ),t=(0,o.jE)();return(0,l.n)({mutationFn:async t=>{let{rootPath:i,template:n}=t,r=[];for(let t of n.sections)for(let n of t.subsections)for(let t of n.fields)if("image"===t.fieldType||"file"===t.fieldType){if(m(t.value))if(t.value.length>0){let n=t.value[0],s="image"===t.fieldType?t.id:n.name,a=d().join(i,s);r.push(e.uploadFileToStorage(a,n).then(e=>{let{ref:{bucket:i,fullPath:n}}=e;return t.value=`gs://${i}/${n}`,t.value}).catch(e=>(y.error("[useUploadFiles] File upload failed",{rootPath:i},e),t.value="",t.value)))}else{if("image"===t.fieldType){let n=t.id,s=d().join(i,n);r.push(e.deleteFile(s).then(()=>"").catch(()=>""))}t.value=""}else if("string"==typeof t.value)if(t.value)(0,p.Z)(t.value).fileDir!==i&&r.push(fetch("/api/copy-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fromPath:t.value,toDirectoryPath:i})}).then(e=>e.json()).then(e=>{let{copiedPath:n,success:r}=e;return r?(t.value=n,n):(s.yf.logger.error("[Upload Files] File Copy Error.",{fromPath:t.value,toDirectoryPath:i}),"")}));else{if("image"===t.fieldType){let n=t.id,s=d().join(i,n);r.push(e.deleteFile(s).then(()=>"").catch(()=>""))}t.value=""}}return Promise.allSettled(r).then(e=>e.map(e=>
1"fulfilled"===e.status?e.value:"").filter(Boolean))},onSuccess:e=>{e.forEach(e=>{t.invalidateQueries({queryKey:h.url(e)})})}})}},93599:(e,t,i)=>{"use strict";i.r(t),i.d(t,{__N_SSP:()=>ek,default:()=>eV});var n,s=i(37876),r=i(14232),a=i(70856),o=i(96653),l=i(54043),u=i(80700),d=i(3732),c=i(80322),m=i(15298),p=i(16031),y=i(85278),h=i(89099),f=i(88992),g=i(9270);let x=(0,g.eU)(""),S=(0,g.eU)(""),I=(0,g.eU)(void 0);var j=i(56346),b=i(29193),T=i(47878),C=i(5617),v=i(57379),w=i(67768),A=i(9811),O=i(2123),_=i(84764),E=i(58407),M=i(12981),N=i(23737),P=i(2491);let D={all:["PaymentIntent"],paymentIntent:(e,t,i,n)=>[...D.all,e,t,i,n]},R={full:"This location filled up before your payment went through, and you weren't charged. Please choose another location.","location-removed":"This location is no longer available, and you weren't charged. Please choose another location.","payment-failed":"Your payment could not be completed, and you weren't charged. Please try again."},q=e=>{let{paymentStepIndex:t}=e,i=(e=>{let t=(0,r.useContext)(_.ZJ),{uid:i}=(0,r.useContext)(E.l),[n,s]=(0,r.useState)(!1),[a,o]=(0,r.useState)(),[l,u]=(0,r.useState)(!1),[d,c]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{let e=setTimeout(()=>u(!0),2e4);return()=>clearTimeout(e)},[]),(0,r.useEffect)(()=>{if(!e||!i)return;let n=(0,N.m)(e,i),r=()=>c(!0),a=(0,O.aQ)(t.submissionRef(n),e=>s(e.data()?.status===M.zS.SUBMITTED),r),l=(0,O.aQ)(t.submissionPaymentIntentRef(n),e=>o(e.data()),r);return()=>{a(),l()}},[e,t,i]),n)?{status:"registered"}:a?.rejectionReason?{status:"rejected",reason:a.rejectionReason,...a.rejectedPaymentMethodType&&{paymentMethodType:a.rejectedPaymentMethodType}}:d?{status:"unreachable"}:{status:l?"slow":"waiting"}})((0,y.md)(x)),n=(0,y.Xr)(b.s),s=(0,y.Xr)(b.r),a=(0,y.Xr)(j._U),o=(0,y.Xr)(j.qM),l=(0,w.jE)(),u=(0,h.useRouter)();return(0,r.useEffect)(()=>{switch(i.status){case"waiting":n("CONFIRMING_REGISTRATION");break;case"slow":n("CONFIRMING_REGISTRATION_SLOW");break;case"unreachable":n("CONFIRMING_REGISTRATION_UNREACHABLE");break;case"registered":n("COMPLETE"),u.push(A.fK);break;case"rejected":a(((e,t)=>"afterpay_clearpay"===t?`${R[e]} Any Afterpay installment will be refunded.`:R[e])(i.reason,i.paymentMethodType)),n("NONE"),s(!1),o(t),l.invalidateQueries({queryKey:D.all})}},[i.status]),null};var F=i(22796),z=i(74975),U=i(54822),B=i(44731),L=i(61946),K=i(55900),k=i(80117),V=i(37770),Z=i(93262),G=i(78541),J=i(68533),X=i(29631),W=i(93150),Y=i(97352),Q=i(35578),$=i(61902);function H(){return(H=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(null,arguments)}let ee=e=>r.createElement("svg",H({xmlns:"http://www.w3.org/2000/svg",width:54,height:24,fill:"none"},e),n||(n=r.createElement("path",{fill:"currentColor",d:"m13.916 2.612-3.654.776-.017 12.017c0 2.22 1.67 3.654 3.89 3.654 1.232 0 2.135-.228 2.633-.498V15.71c-.481.194-2.844.886-2.844-1.325V9.051h2.844V5.86h-2.844zm7.519 4.355-.228-1.106h-3.24v12.928h3.738v-8.7c.886-1.165 2.38-.937 2.86-.785V5.861c-.506-.177-2.253-.506-3.13 1.106M29.224.864l-3.764.802v3.055l3.764-.802zM3.78 9.667c0-.582.489-.81 1.274-.819 1.14 0 2.59.346 3.73.962V6.283c-1.24-.49-2.481-.684-3.722-.684C2.025 5.6 0 7.186 0 9.836c0 4.152 5.696 3.476 5.696 5.265 0 .692-.599.92-1.434.92-1.24 0-2.844-.514-4.102-1.198v3.376c1.393.599 2.802.852 4.093.852 3.114 0 5.258-1.333 5.258-4.034 0-4.464-5.73-3.662-5.73-5.35M54 12.477c0-3.84-1.856-6.87-5.418-6.87-3.56 0-5.73 3.03-5.73 6.845 0 4.515 2.557 6.599 6.203 6.599 1.789 0 3.13-.405 4.152-.97v-2.82c-1.021.516-2.194.828-3.68.828-1.46 0-2.742-.515-2.911-2.27h7.333c.017-.194.051-.98.051-1.342m-7.418-1.418c0-1.687 1.038-2.396 1.975-2.396.92 0 1.899.709 1.899 2.396zm-9.527-5.451c-1.468 0-2.414.692-2.937 1.173l-.194-.928h-3.3v17.282l3.747-.793.009-4.236c.54.396 1.341.945 2.65.945 2.683 0 5.13-1.958 5.13-6.717.009-4.355-2.472-6.726-5.105-6.726m-.895 10.337c-.877 0-1.4-.32-1.763-.709l-.026-5.57c.389-.43.929-.742 1.79-.742 1.366 0 2.312 1.536 2.312 3.494.008 2.017-.92 3.527-2.313 3.527M25.468 18.79h3.764V5.861h-3.764z"})));var et=i(36361),ei=i(28463),en=i(29316);let es=(0,i(4241).c)("pk_live_51LtHRlJygzfC1H1m8DjxbfTRiAbm2VppJbZGi6c4VwNBQBHm5pG0TLxqJTIJvMQdx42wkrU757Fwx0CpjXKszq1C00SDmc2f3v"),{logger:er}=m.yf,ea=()=>{let e=(0,$.useStripe)(),t=(0,$.useElements)(),[i,n]=(0,r.useState)(""),[a,o]=(0,r.useState)(!1),{isOrganization:l,uid:u}=(0,r.useContext)(E.l),{onSubmit:d}=(0,r.useContext)(en.R),c=(0,y.Xr)(b.s),m=(0,y.Xr)(b.r),p=(0,y.md)(x),h=(0,y.md)(S),g=(0,y.md)(I),[T,C]=(0,y.fp)(j._U),{formState:{isValid:v}}=(0,f.xW)(),w=!v;(0,r.useEffect)(()=>{l?n("Organization users may not register for auditions."):w?n("Please check that all mandatory fields are filled out correctly."):n("")},[w,l]);let O=(0,r.useCallback)(async()=>
1{if(!e||!t)return;m(!0),c("PAYMENT_PROCESSING"),C(void 0);let i=new URL(A.eY.replace(":auditionId",p),window.location.origin);h&&g?.success&&i.searchParams.set("promotionCode",h);let{paymentIntent:s,error:r}=await e.confirmPayment({elements:t,redirect:"if_required",confirmParams:{return_url:i.toString()}});r?(c("PAYMENT_ERROR"),"card_error"===r.type||"validation_error"===r.type?n(r.message):n("An unexpected payment error occurred."),setTimeout(()=>{m(!1)},2e3)):s?(c("CONFIRMING_REGISTRATION"),er.info("[Audition Register] Payment authorized.",{submissionId:(0,N.m)(p,u),isDraftSubmission:!1})):(c("PAYMENT_ERROR"),n("Payment has failed, but no errors were returned."),setTimeout(()=>{m(!1)},2e3)),o(!1)},[e,t,m,c,C,p,h,g,u]);return(0,s.jsx)("form",{id:"payment-form",translate:"no",style:{width:"100%"},children:(0,s.jsxs)(Z.T,{spacing:6,width:"100%",children:[(0,s.jsx)($.PaymentElement,{id:"stripe-payment-element"}),(0,s.jsxs)(W.$n,{bgColor:"rgb(99,91,255)",colorScheme:"purple",isDisabled:a||w||!e||!t||l,id:"submit",onClick:async e=>{e.preventDefault(),o(!0),await d("",O),o(!1)},isLoading:a,loadingText:"Submission Processing...",width:"100%",children:["Pay with",(0,s.jsx)(Q.az,{width:"8px"}),(0,s.jsx)(ee,{})]}),T&&(0,s.jsx)(W.xF,{color:et.a,children:T}),i&&(0,s.jsx)(W.xF,{color:et.a,children:i})]})})},eo=()=>(0,s.jsxs)(l.z,{children:[(0,s.jsx)(v.k,{}),(0,s.jsx)("span",{children:"Loading the "}),(0,s.jsx)("div",{style:{color:"#635BFF"},children:(0,s.jsx)(ee,{})}),(0,s.jsx)("span",{children:" payment system..."})]}),el=()=>(0,s.jsxs)(W.xF,{color:et.a,children:["A payment for this registration is already being processed. Check your email for a receipt â if one does not arrive within a few minutes, contact"," ",ei.Kg.email,"."]}),eu=e=>{let{clientSecret:t,paymentInProgress:i}=e,n=(0,r.useMemo)(()=>({clientSecret:t??void 0,appearance:{theme:"stripe"}}),[t]),a=(0,y.Xr)(b.r),o=(0,y.Xr)(b.s);return((0,r.useEffect)(()=>{i&&(a(!0),o("CONFIRMING_REGISTRATION"))},[i,a,o]),i)?(0,s.jsx)(el,{}):t?(0,s.jsx)($.Elements,{options:n,stripe:es,children:(0,s.jsx)(ea,{})},t):(0,s.jsx)(eo,{})};var ed=i(47663),ec=i(33638),em=i(74485);let ep=e=>{let{itemName:t,itemAmount:i,currency:n,largeFormat:r=!1}=e;return(0,s.jsx)(l.z,{justifyContent:"space-between",width:"100%",children:r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(em.nn,{fontWeight:700,children:t}),(0,s.jsx)(em.nn,{fontWeight:600,children:(0,ec.r)(i,n)})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(em.xF,{children:t}),(0,s.jsx)(em.xF,{children:(0,ec.r)(i,n)})]})})},ey=e=>{let{auditionFeeAmount:t,promotionDiscountAmount:i,currency:n}=e;return(0,s.jsxs)(Z.T,{...ed.bf,paddingX:"31px",paddingY:"20px",spacing:8,width:"100%",children:[(0,s.jsx)(em.nn,{fontWeight:700,children:"Payment Summary"}),(0,s.jsxs)(Z.T,{spacing:1.5,width:"100%",children:[(0,s.jsx)(ep,{itemName:"Submission Fee",itemAmount:t,currency:n}),i&&(0,s.jsx)(ep,{itemName:"Promotion Code",itemAmount:-i,currency:n})]}),(0,s.jsxs)(Z.T,{spacing:1.5,width:"100%",children:[(0,s.jsx)(G.c,{}),(0,s.jsx)(ep,{itemName:"Order Total",itemAmount:i?t-i:t,currency:n,largeFormat:!0})]})]})};var eh=i(49815),ef=i(59624);let eg=e=>{let{...t}=e;return(0,s.jsx)(ef.A,{...t,colorScheme:"gray",size:"sm",variant:"outline",children:"Apply"})},ex=e=>{let{...t}=e;return(0,s.jsx)(ef.A,{...t,color:et.a,fontWeight:400,notResponsive:!0,size:"sm",textDecoration:"underline",variant:"link",children:"Remove"})},eS=()=>{let[e,t]=(0,y.fp)(S),i=(0,y.md)(I),[n,a]=(0,r.useState)(!1),[o,u]=(0,r.useState)(e),[d,c]=(0,r.useState)(""),m=(0,r.useCallback)(()=>{t(o)},[o,t]),p=(0,r.useCallback)(()=>{u(""),t("")},[t]);return(0,r.useEffect)(()=>{a(i?.success??!1),c(i?.message??"")},[i]),(0,s.jsxs)(Z.T,{align:"start",spacing:"10px",children:[(0,s.jsx)(em.xF,{fontWeight:700,children:"Promotion Code"}),(0,s.jsxs)(l.z,{spacing:"10px",children:[(0,s.jsx)(eh.p,{disabled:n,onChange:e=>u(e.target.value.toUpperCase()),value:o,width:"275px"}),n?(0,s.jsx)(ex,{onClick:()=>p()}):(0,s.jsx)(eg,{onClick:()=>m()})]}),d&&(0,s.jsx)(em.Se,{color:n?"green.500":et.a,children:d})]})};var eI=i(5807),ej=i(25758),eb=i(45261),eT=i(86891),eC=i(66062),ev=i(85295);let ew=e=>{let{children:t,...i}=e;return(0,s.jsx)(W.xF,{fontWeight:700,...i,children:t})},eA=e=>{let{children:t,...i}=e;return(0,s.jsx)(W.xF,{fontWeight:400,...i,children:t})},eO={spacing:1.5,width:"100%"},{logger:e_}=m.yf,eE=()=>{let{isMobileSize:e}=(0,ej.d)(),t=(0,h.useRouter)(),i=(0,y.md)(x),{isOrganization:n,uid:a}=(0,r.useContext)(E.l),o=(0,y.Xr)(b.s),{audition:u}=(0,eb.RW)(i),d=(0,eT.Xv)(u?.organizationLogoImg??""),c="success"===d.status?d.data:"",m=(0,y.md)(S),p=(0,y.Xr)(I),{getValues:g,formState:{isValid:j}}=(0,f.xW)(),T=g(),C=T[eI.mL],v=T[eI.ad],w=T[ed.ep.LOCATION_AND_TIME],O=(0,r.useMemo)(()=>T[ed.ep.PROGRAMS]??[],[T]),_=(0,r.useMemo)(()=>u?.programs.filter(e=>(0,eC.oL)(e,O)).map(e=>e.name),[u?.programs,O]),{data:{clientSecret:M,paymentInProgress:R,promotionCodeResult:q}={clientSecret:null}}=((e,t)=>{let{uid:i,email:n}=(0,r.useContext)(E.l);return(0,P.I)({queryKey:D.paymentIntent(e,i,n,t),queryFn:()=>fetch("/api/create-payment-intent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({auditionId:e,...t&&{promotionCodeString:t},userEmail:n,userId:i})}).then(e=>e.json()),enabled:!!e&&!!i&&!!n,staleTime:0,gcTime:0})})(i,m);(0,r.useEffect)(()=>{p(q)},[q,p]);let{onSubmit:F}=(0,r.useContext)(en.R),z=!j,[U,B]=(0,r.useState)(!1),L=(0,r.useCallback)(async e=>{e.preventDefault(),B(!0),await F("free-submission",async()=>{o("COMPLETE"),e_.info("[Audition Register] Save Submission Complete.",{submissionId:(0,N.m)(i,a),isDraftSubmission:!1}),await t.push({pathname:A.fK})}),B(!1)},[i,F,t,o,a]),[K,k]=(0,r.useState)("");(0,r.useEffect)(()=>{n?k("Organization users may not register for auditions."):z?k("Please check that all mandatory fields are filled out correctly."):k("")},[z,n]);let V=q?.discountAmount!==void 0?q.discountAmount:0;return(0,s.jsxs)(Z.T,{...ed.bf,children:[(0,s.jsxs)(Z.T,{align:"start",spacing:"15px",width:"100%",children:[(0,s.jsx)(W._F,{children:"Payment Summary"}),(0,s.jsx)(G.c,{})]}),u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Z.T,{align:"start",spacing:{base:4,sm:6},paddingTop:{sm:4},width:"100%",children:[(0,s.jsxs)(l.z,{spacing:4,children:[(0,s.jsx)(Y.N,{logoUrl:c,size:e?"78px":"68px"}),(0,s.jsx)(W._F,{children:u.organizationName})]}),(0,s.jsx)(J.B,{...eO,children:w?(0,s.jsx)(ev.Y,{auditionLocation:w,fontSize:e?"12px":"14px"}):(0,s.jsx)(eA,{color:et.a,children:"No location was selected!"})}),(0,s.jsxs)(J.B,{...eO,children:[(0,s.jsx)(ew,{children:"Applicant"}),(0,s.jsx)(eA,{children:C||v?`${C} ${v}`:"-"})]}),(0,s.jsxs)(J.B,{...eO,children:[(0,s.jsx)(ew,{children:"School Program"}),_?.length?_.map(e=>(0,s.jsx)(eA,{children:e},e)):(0,s.jsx)(eA,{color:et.a,children:"No programs were selected!"})]}),(0,s.jsxs)(J.B,{...eO,children:[(0,s.jsx)(ew,{children:"Submission Fee"}),(0,s.jsx)(eA,{children:(0,ec.r)(u.detail.fee,u.detail.feeCurrency)})]})]}),u.detail.fee>0&&(0,s.jsx)(eS,{}),(0,s.jsx)(X.h,{}),(0,s.jsx)(ey,{auditionFeeAmount:u.detail.fee,promotionDiscountAmount:V,currency:u.detail.feeCurrency}),u.detail.fee-V>0?(0,s.jsx)(eu,{clientSecret:M,paymentInProgress:R}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(W.$n,{isDisabled:U||z||n,id:"submit",isLoading:U,loadingText:"Submitting...",onClick:e=>L(e),width:"100%",children:"Submit"}),K&&(0,s.jsx)(W.xF,{color:et.a,children:K})]})]})]})};var eM=i(41091),eN=i(95067),eP=i(93321),eD=i(91109);let eR={all:["Profile"],profile:e=>[...eR.all,e]};var eq=i(43014),eF=i(32044),ez=i(41482),eU=i(43406),eB=i(69087);i(89218);let{logger:eL}=m.yf,eK=e=>{let{auditionId:t}=e,{isMobileSize:i}=(0,ej.d)(),n=(0,f.mN)(),{control:m,getValues:g}=n,{audition:x,additionalQuestionsTemplate:I,auditionUploadsTemplate:C,waiverTemplate:O}=(0,eb.RW)(t),{data:M}=(0,eD.Z)(x?x.organizationId:""),{data:D}=(()=>{let e=(0,r.useContext)(_.ZJ),{uid:t}=(0,r.useContext)(E.l);return(0,P.I)({queryKey:eR.profile(t),queryFn:async()=>e.getOrCreateProfile()??{}})})(),R=(0,eT.Xv)(M?.logoImg??""),Z=(0,y.md)(S),G=(0,y.md)(j.qM),J=(0,y.Xr)(j.qM),X=(()=>{let e=(0,h.useRouter)(),t=(0,y.Xr)(j._U),i=(0,y.Xr)(S),[n,s]=(0,r.useState)("pending"),a=(0,r.useRef)(!1),o=e.query.payment_intent_client_secret;return(0,r.useEffect)(()=>
1{if(!e.isReady||a.current)return;if(a.current=!0,"string"!=typeof o)return void s("none");let n=(n,r)=>{let{payment_intent:a,payment_intent_client_secret:o,redirect_status:l,promotionCode:u,...d}=e.query;"string"==typeof u&&i(u),t(r),s(n),e.replace({pathname:e.pathname,query:d},void 0,{shallow:!0})};es.then(e=>e?.retrievePaymentIntent(o)).then(t=>{let i=t?.paymentIntent?.status;"succeeded"===i||"processing"===i?(s("succeeded"),e.replace(A.fK)):"requires_capture"===i?n("authorized"):"requires_payment_method"===i?n("failed","Your payment was not successful, please try again."):n("failed","Something went wrong.")}).catch(()=>n("failed","Something went wrong."))},[o,e,t,i]),n})(),W=(0,h.useRouter)(),{data:Y,status:Q}=(0,eq.AL)(t),$="success"===Q,H=(0,y.md)(j.G2),ee=(0,r.useMemo)(()=>C?(0,ez.kl)(C,H):void 0,[C,H]),et=(0,ez.gn)(C),ei=(0,r.useRef)(!1);(0,r.useEffect)(()=>{$&&"none"===X&&!ei.current&&(ei.current=!0,Y?.status===eF.zS.SUBMITTED&&W.push(`${A.On}?id=${Y?.id}`))},[Y?.id,Y?.status,Q,$,X,W]);let{isOrganization:er,uid:ea}=(0,r.useContext)(E.l),eo="success"===R.status&&R.data,el=(()=>{let e=(0,w.jE)(),{uid:t}=(0,r.useContext)(E.l);return async()=>{await e.invalidateQueries({queryKey:eR.profile(t)})}})(),eu=(0,eT.q_)(ea),ec=(0,eq.rF)(t),em=(0,eT.ZJ)(ea,t),ep=(0,eq.S7)(),[ey,eh]=(0,y.fp)(b.r),[ef,eg]=(0,r.useState)(!1),[ex,eS]=(0,r.useState)(void 0),[eI]=(0,r.useState)(Date.now()),[eC,ew]=(0,y.fp)(b.s),eA=(0,r.useCallback)(async(e,t,i)=>{if(!ea||!x)return!1;let n=(0,N.m)(x.id,ea);if(!n)return!1;let s=e===eF.zS.DRAFT,r=await (0,p.xI)().currentUser?.getIdToken();if(!r)return!1;ew("SAVING_SUBMISSION_TO_DB"),eL.info("[Audition Register] Save Submission in Progress.",{submissionId:n,isDraftSubmission:s}),eS(void 0),eh(!0),eg(s);let a=await fetch("/api/save-submission",{method:"POST",headers:{Authorization:r,auditionId:x.id,...i&&{paymentId:i},...Z&&{promotionCodeString:Z},submissionStatus:e},body:(e=>{let t=new FormData;return Object.entries(e).forEach(e=>{let[i,n]=e;void 0!==n&&(n instanceof FileList?Array.from(n).forEach(e=>{t.append(i,e,e.name)}):t.append(i,JSON.stringify(n)))}),t})(t)});if(!a.ok){let e;ew("ERROR");let i=a.headers.get("content-type");return eS(e=i&&i.includes("application/json")?(await a.json()).error??"Undefined error":await a.text()),eL.error("[Audition Register] Error received from save submission API.",{submissionId:n,isDraftSubmission:s,pageDurationSeconds:(Date.now()-eI)/1e3,token:r,values:t,error:e}),!1}return await el(),await eu(),await ec(),await em(),await ep(),!0},[x,el,eu,ec,em,ep,eI,Z,eh,ew,ea]),eO=(0,r.useCallback)(async e=>{let t=g();await eA(eF.zS.DRAFT,t,e)&&(ew("COMPLETE"),eL.info("[Audition Register] Save Submission Complete.",{submissionId:(0,N.m)(x.id,ea),isDraftSubmission:!0}),W.push({pathname:e}))},[x,g,W,eA,ew,ea]),e_=(0,r.useCallback)(async(e,t)=>{let i=g();await eA(eF.zS.SUBMITTED,i,e)&&await t()},[g,eA]),eK=(0,r.useMemo)(()=>({onSubmit:e_,saveDraft:eO}),[e_,eO]),ek=g()?.[ed.ep.LOCATION_AND_TIME],eV=g(),eZ=(0,eB.s0)(eV,x?.organizationType||eF.CB.BALLET_SCHOOL,I),eG=(0,eB.YN)(eV,x?.organizationCountry||"United States of America"),eJ=(0,eB.ZY)(eV,H,ee),eX=(0,eB.Us)(eV,O),eW=(0,r.useMemo)(()=>({sectionGroups:[{sections:[{title:ed.uA.APPLICATION_GUIDELINES,isValid:!0,page:(0,s.jsx)(L.A,{audition:x})},{title:ed.uA.LOCATION_AND_TIME,isValid:!!ek,page:(0,s.jsx)(V.A,{audition:x,submission:Y,checkDeadline:!0,checkCapacity:!0})},{title:ed.uA.APPLICATION,isValid:eZ,page:(0,s.jsx)(B.A,{audition:x,customTemplate:I,submission:Y,profile:D})},{title:ed.uA.DEMOGRAPHICS,isValid:eG,page:(0,s.jsx)(k.A,{organizationCountry:x?.organizationCountry,submission:Y,profile:D})},{title:ed.uA.AUDITION_UPLOADS,isValid:eJ,page:(0,s.jsx)(K.A,{submission:Y,profile:D,template:ee}),hide:!et},{title:ed.uA.WAIVERS,isValid:eX,page:(0,s.jsx)(eN.f,{submission:Y,template:O}),hide:!O},{title:ed.uA.REVIEW_APPLICATION,isValid:!0,page:(0,s.jsx)(eM.A,{audition:x,auditionUploadsTemplate:ee,customTemplate:I})},{title:ed.uA.PAYMENT_SUMMARY,isValid:!0,page:(0,s.jsx)(eE,{})}]}]}),[x,ek,Y,eZ,I,D,eG,eJ,ee,et,eX,O]),eY=(0,eU.x)(eW).findIndex(e=>e.title===ed.uA.PAYMENT_SUMMARY),eQ=G===eY,e$=(0,r.useRef)();return((0,r.useEffect)(()=>{"failed"!==X&&"authorized"!==X||eY<0||(void 0===e$.current||G===e$.current)&&(e$.current=eY,J(eY))},[X,eY,G,J]),$&&"pending"!==X&&"succeeded"!==X)?(0,s.jsxs)(en.R.Provider,{value:eK,children:[(0,s.jsx)(f.Op,{...n,children:(0,s.jsx)("form",{noValidate:!0,style:{width:"100%",maxWidth:"1200px"},children:(0,s.jsxs)(a.x,{templateColumns:{base:"1fr",sm:"1fr 2fr"},paddingX:{base:5,sm:0},paddingBottom:"100px",gap:{base:5,sm:6},children:[!(i&&eQ)&&(0,s.jsx)(o.E,{colSpan:{base:1,sm:2},children:(0,s.jsxs)(l.z,{gap:{base:2.5,sm:4},paddingTop:{base:0,sm:6},children:[eo&&(0,s.jsx)(u._,{width:{base:"72px",sm:"96px"},height:{base:"72px",sm:"96px"},src:eo,alt:M?.name??"organization logo image"}),(0,s.jsx)(d.E,{fontSize:{base:"16px",sm:"30px"},fontWeight:700,children:x?.organizationName})]})}),(0,s.jsx)(z.A,{layout:eW,isActionButtonShown:!1===er,isActionButtonDisabled:ey,actionButtonText:"Save Draft",onActionButtonClick:async()=>{await eO(A.Lu)}}),(0,s.jsx)(c.L,{above:"sm",children:ek&&!eQ&&(0,s.jsx)(o.E,{children:(0,s.jsx)(ev.Y,{auditionLocation:ek,containerProps:{spacing:2.5},fontSize:"12px"})})}),(0,s.jsx)(F.A,{layout:eW})]})})}),(0,eP.Qx)(eC)&&(0,s.jsx)(q,{paymentStepIndex:eY}),(0,s.jsx)(U.Z,{isOpen:ey,setIsOpen:eh,isSaveDraft:ef,publishState:eC,errorMessage:ex}),T.A&&(0,s.jsx)(T.A,{control:m})]}):(0,s.jsx)(a.x,{placeItems:"center",children:(0,s.jsx)(v.k,{})})};var ek=!0;let eV=e=>{let{auditionId:t}=e;return(0,s.jsx)(y.Kq,{children:(0,s.jsx)(C.i,{initialValues:[[x,t],[S,""],[I,void 0],[j.qM,0],[j._U,void 0],[j.G2,!1]],children:(0,s.jsx)(eK,{auditionId:t})})})}},95454:(e,t,i)=>{"use strict";i.d(t,{Z:()=>n});let n=e=>{let[,t,i]=e.match(/gs:\/\/([^/]+)\/(.*)/)??[,,,].fill(""),[,n,s]=i.match(/(.*)\/(?!\/)(.*)/)??[,,,].fill("");return{bucket:t,filePath:i,fileDir:n,fileName:s}}},96720:(e,t,i)=>{"use strict";i.d(t,{XH:()=>a,bh:()=>r,nR:()=>s});let n=e=>{if(!e)return!1;let{street:t,city:i,state:n,country:s,zip:r}=e;return"United States of America"===s?!!(t&&i&&n&&s&&r):!!(t&&i&&s&&r)},s=e=>{if(!n(e))return"";let{street:t,streetAdditional:i,city:s,state:r,country:a,zip:o}=e;return[t,i,s,r,a,o].filter(e=>e&&""!==e).join(", ")},r=e=>n(e)?encodeURIComponent(s(e)).replaceAll("%20","+"):"",a=(e,t,i)=>"United States of America"===i?[e,t].filter(e=>e&&""!==e).join(", "):[e,i].filter(e=>e&&""!==e).join(", ")},97352:(e,t,i)=>{"use strict";i.d(t,{N:()=>S});var n=i(37876),s=i(14232),r=i(17754),a=i(49815),o=i(68827),l=i.n(o),u=i(79052),d=i.n(u),c=i(43078),m=i(50029),p=i(84764),y=i(91109),h=i(43544),f=i(44895);let g=c.Ay.div.withConfig({componentId:"sc-9dcce828-0"})(["display:flex;align-items:center;border:1px solid #e2e8f0;position:relative;max-height:",";max-width:",";height:",";width:",";border-radius:6px;img{border-radius:6px;align-self:center;padding:",";}"],e=>e.size,e=>e.size,e=>e.size,e=>e.size,e=>e.hasImage?"6px !important":"0px !important"),x=c.Ay.div.withConfig({componentId:"sc-9dcce828-1"})(["border:1px solid #e2e8f0;width:28px;height:28px;position:absolute;background:white;border-radius:100%;bottom:-10%;right:-15%;display:flex;justify-content:center;align-items:center;cursor:pointer;"]),S=e=>{let{logoUrl:t,size:i,editable:r,organizationId:a}
1=e,[o,u]=(0,s.useState)(""),d="/assets/img/default_org_image.png";return r&&o?d=o:t&&(d=t),(0,n.jsxs)(g,{hasImage:!!t,size:i??"96px",children:[(0,n.jsx)(l(),{src:d,alt:"",layout:"fill",objectFit:"cover"}),r&&a&&(0,n.jsx)(I,{organizationId:a,setUploadedLogo:u})]})},I=(0,p.MN)(e=>{let{firebase:t,organizationId:i,setUploadedLogo:s}=e,o=(0,y.k)(i);return(0,n.jsx)(r.l,{children:(0,n.jsxs)(x,{children:[(0,n.jsx)(m.A,{height:"12",width:"12"}),(0,n.jsx)(a.p,{accept:"image/*",type:"file",hidden:!0,onChange:e=>{let n=e.target.files?.[0];n&&(0,h.C2)(n).then(e=>{let{data:r}=e;if("string"!=typeof r)return;let a=d().join((0,f.QM)(i),"logo");t.uploadFileToStorage(a,n).then(e=>{let{ref:{bucket:t,fullPath:i}}=e;return`gs://${t}/${i}`}).then(async e=>{await t.updateOrganizationById(i,{logoImg:e}),await o(),s(r)})})}})]})})})}},e=>{e.O(0,[956,810,2499,7050,5581,5565,2211,9811,4694,6265,636,6593,8792],()=>e(e.s=6124)),_N_E=e.O()}]);
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.