PageSourceSearch

https://chloeting.com/_next/static/chunks/pages/c/[slug]/[post_slug]/edit-8dfc57bdb6c51617.js

js chloeting.com collected 2026-10-02 03:53:02 UTC 17,073 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[43014],{29517:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/c/[slug]/[post_slug]/edit",function(){return t(77721)}])},77721:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return W},default:function(){return Q}});var i,o=t(85893),r=t(67294),l=t(15313),a=t(47568),d=t(26042),u=t(69396),s=t(20414),c=t(95496),v=t(5152),g=t.n(v),h=t(11163),m=t(87536),f=t(99501),T=t(66937),S=t(87407),E=t(33928),x=t(31571),p=t(80378),I=t(70589),P=t(32017),b=t(74092),_=t(3437),O=t(17746),j=t(11833),Z=t(88283),k=t(624),C=t(71247),y=t(21420),D=t(5224),N=t(52542),M=g()((function(){return t.e(28223).then(t.bind(t,28223))}),{loadableGenerated:{webpack:function(){return[28223]}}});!function(e){e.PHOTO_STEP="PHOTO_STEP",e.DESCRIPTION_STEP="DESCRIPTION_STEP"}(i||(i={}));var R=function(e){var n,t,i,v,g,R,w,V,H,q,A,L,U=e.channel,B=e.post,F=(0,r.useState)(B),G=F[0],X=F[1],Y=(0,j.Z)(null,!0),z=(0,h.useRouter)(),$=(0,f.Z)("(max-width: ".concat(y.u.size1024-1,"px)"),!1),J=(0,l.v9)(Z.Z.getCurrentUser),K=!!(null===J||void 0===J||null===(n=J.communityModerator)||void 0===n?void 0:n.assignedAt)&&!(null===J||void 0===J||null===(t=J.communityModerator)||void 0===t?void 0:t.disableAt),W=!!(null===G||void 0===G||null===(i=G.edited)||void 0===i?void 0:i.editedBy)&&(null===G||void 0===G||null===(v=G.edited)||void 0===v?void 0:v.editedBy)!==(null===G||void 0===G||null===(g=G.author)||void 0===g?void 0:g.id),Q=(null===J||void 0===J?void 0:J.id)===(null===G||void 0===G||null===(R=G.author)||void 0===R?void 0:R.id),ee=N.Z.object(K?{title:N.Z.string().required().matches(O._6,"Field must contain a letter"),beforeImage:N.Z.string().required(),beforeImageDateTaken:N.Z.string().required(),afterImage:N.Z.string().required(),afterImageDateTaken:N.Z.string().required(),additionalPhotos:N.Z.array().of(N.Z.string()).max(5,"Max 5 images")}:{title:N.Z.string().required().matches(O._6,"Field must contain a letter").max(O.D0,"Title is too long. Max character is ".concat(O.D0)),beforeImage:N.Z.string().required(),beforeImageDateTaken:N.Z.string().required(),afterImage:N.Z.string().required(),afterImageDateTaken:N.Z.string().required(),additionalPhotos:N.Z.array().of(N.Z.string()).max(5,"Max 5 images")}).required(),ne=N.Z.object(K?{tag:N.Z.string(),mediaLink:N.Z.string().matches(O.x,{message:"Invalid embed link",excludeEmptyString:!0}).nullable().test("validate-youtube-video","Invalid embed link",(function(e){return(0,D.mw)(e)}))}:{content:N.Z.string().required().max(O.RZ),tag:N.Z.string(),mediaLink:N.Z.string().matches(O.x,{message:"Invalid embed link",excludeEmptyString:!0}).nullable().test("validate-youtube-video","Invalid embed link",(function(e){return(0,D.mw)(e)}))}).required(),te=(0,m.cI)({defaultValues:{title:(null===G||void 0===G?void 0:G.title)||"",beforeImage:(null===G||void 0===G||null===(w=G.beforeImage)||void 0===w?void 0:w.imageUrl)||"",beforeImageDateTaken:(null===G||void 0===G||null===(V=G.beforeImage)||void 0===V?void 0:V.dateTaken)||"",afterImage:(null===G||void 0===G||null===(H=G.afterImage)||void 0===H?void 0:H.imageUrl)||"",afterImageDateTaken:(null===G||void 0===G||null===(q=G.afterImage)||void 0===q?void 0:q.dateTaken)||"",additionalPhotos:(null===G||void 0===G?void 0:G.additionalPhotos)||[]},mode:"onChange",reValidateMode:"onChange",criteriaMode:"all",shouldFocusError:!1,resolver:(0,c.X)(ee)}),ie=te.control,oe=te.formState,re=oe.isValid,le=oe.isSubmitted,ae=oe.isDirty,de=te.getValues,ue=te.setValue,se=te.handleSubmit,ce=te.reset,ve=te.trigger,ge=(0,m.cI)({defaultValues:{content:(null===G||void 0===G?void 0:G.content)||"",tag:(null===G||void 0===G||null===(A=G.tag)||void 0===A?void 0:A.id)||"",mediaLink:(null===G||void 0===G?void 0:G.mediaLink)||"",programs:(null===G||void 0===G||null===(L=G.programs)||void 0===L?void 0:L.map((function(e){return e.id})))||[]},mode:"onBlur",reValidateMode:"onChange",criteriaMode:"all",shouldFocusError:!1,resolver:(0,c.X)(ne)}),he=ge.control,me=ge.setValue,fe=ge.getValues,Te=ge.handleSubmit,Se=ge.reset,Ee=ge.formState,xe=Ee.isValid,pe=Ee.isSubmitted,Ie=Ee.isDirty,Pe=(0,r.useState)(!1),be=Pe[0],_e=Pe[1],Oe=(0,r.useState)("PHOTO_STEP"),je=Oe[0],Ze=Oe[1],ke=(0,r.useMemo)((function(){return le?re?P.k6.VERIFIED:P.k6.ERROR:P.k6.INITIAL}),[re,le]),Ce=(0,r.useMemo)((function(){return pe?xe?P.k6.VERIFIED:P.k6.ERROR:P.k6.INITIAL}),[xe,pe]),ye=(0,r.useState)(!1),De=ye[0],Ne=ye[1],Me="/c/".concat(null===U||void 0===U?void 0:U.slug,"/").concat(null===B||void 0===B?void 0:B.slug);(0,r.useEffect)((function(){(null===B||void 0===B?void 0:B.slug)&&J&&(!K&&(W||Q&&((null===B||void 0===B?void 0:B.hidden)||(null===B||void 0===B?void 0:B.locked))||(null===G||void 0===G?void 0:G.approvalStatus)===D.Kb.REJECTED)?z.push(Me):Ve(B.slug))}),[J]);var Re=function(){z.push(Me)},we=function(){"PHOTO_STEP"===je?se((function(){return Ze("DESCRIPTION_STEP")}))():Te((function(){(null===U||void 0===U?void 0:U.id)&&!be&&(null===G||void 0===G?void 0:G.id)&&(ae||Ie)&&_e(!0)}))()},Ve=function(){var e=(0,a.Z)((function(e){var n,t,i,o,r,l,a,d;return(0,s.__generator)(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,T.Z.getPostBySlug(e,!0)];case 1:return a=u.sent(),X(a),ce({title:(null===a||void 0===a?void 0:a.title)||"",beforeImage:(null===a||void 0===a||null===(n=a.beforeImage)||void 0===n?void 0:n.imageUrl)||"",beforeImageDateTaken:(null===a||void 0===a||null===(t=a.beforeImage)||void 0===t?void 0:t.dateTaken)||"",afterImage:(null===a||void 0===a||null===(i=a.afterImage)||void 0===i?void 0:i.imageUrl)||"",afterImageDateTaken:(null===a||void 0===a||null===(o=a.afterImage)||void 0===o?void 0:o.dateTaken)||"",additionalPhotos:(null===a||void 0===a?void 0:a.additionalPhotos)||[]}),Se({content:(null===a||void 0===a?void 0:a.content)||"",tag:(null===a||void 0===a||null===(r=a.tag)||void 0===r?void 0:r.id)||"",mediaLink:(null===a||void 0===a?void 0:a.mediaLink)||"",programs:(null===a||void 0===a||null===(l=a.programs)||void 0===l?void 0:l.map((function(e){return e.id})))||[]}),[3,3];case 2:return d=u.sent(),console.error(d),Y.error("Sorry, an error has occured. Please try again later."),z.push(Me),[3,3];case 3:return[2]}}
1))}));return function(n){return e.apply(this,arguments)}}(),He=function(){var e=(0,a.Z)((function(){var e,n,t,i,o,r,l;return(0,s.__generator)(this,(function(a){switch(a.label){case 0:e=null===G||void 0===G?void 0:G.id,n=fe().tag,a.label=1;case 1:return a.trys.push([1,3,4,5]),t=(0,u.Z)((0,d.Z)({},de(),fe()),{tag:n||null,channel:(null===U||void 0===U?void 0:U.id)||""}),[4,T.Z.updatePostText(e,t)];case 2:return(i=a.sent())&&(z.back(),Y.info("".concat((null===G||void 0===G||null===(o=G.author)||void 0===o?void 0:o.id)===(null===J||void 0===J?void 0:J.id)?"Your":"This","  ").concat((null===(r=i.edited)||void 0===r?void 0:r.editDraft)?"post has been edited, pending review":"post has been updated"))),[3,5];case 3:return l=a.sent(),console.error(l),function(e){[b.g.COMMUNITY_USER_BANNED,b.g.COMMUNITY_USER_EXCEED_POST_RATE_LIMIT,b.g.COMMUNITY_MOD_EDITED_POST].includes(null===e||void 0===e?void 0:e.code)&&Y.error(D.l[null===e||void 0===e?void 0:e.code])}(l),[3,5];case 4:return _e(!1),[7];case 5:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),qe=function(){"DESCRIPTION_STEP"===je?Ze("PHOTO_STEP"):ae||Ie?Ne(!0):Re()},Ae=function(){se((function(){return Ze("DESCRIPTION_STEP")}))()},Le=function(){"PHOTO_STEP"!==je?Ze("PHOTO_STEP"):(se((function(){return null}))(),Ze("DESCRIPTION_STEP"))},Ue=function(){"PHOTO_STEP"===je?(se((function(){return null}))(),Ze("DESCRIPTION_STEP")):"DESCRIPTION_STEP"===je?(Te((function(){return null}))(),Ze(void 0)):Ze("DESCRIPTION_STEP")};return(0,o.jsxs)(C.C1,{children:[(0,o.jsx)(C.pU,{greaterThanOrEqual:"md",children:(0,o.jsxs)(x._z,{children:[(0,o.jsxs)(x.Xq,{onClick:Re,children:[(0,o.jsx)(p.Z,{icon:"pack_variants",size:24,color:"#7c7b7b"}),(0,o.jsx)("span",{children:"Back"})]}),(0,o.jsx)(x.uo,{children:(0,o.jsxs)(x.yo,{children:[(0,o.jsx)(x.PM,{children:(0,o.jsx)(x.v0,{children:"Edit Post"})}),(0,o.jsx)(E.Z,{control:ie,isToggle:"PHOTO_STEP"===je,onToggle:Le,formStatus:ke,setValue:ue,getValues:de,trigger:ve,isSaving:be,onSubmit:He}),(0,o.jsx)(S.Z,{channel:U,control:he,isToggle:"DESCRIPTION_STEP"===je,onToggle:Ue,formStatus:Ce,setValue:me,getValues:fe}),(0,o.jsx)(x.uR,{children:(0,o.jsxs)(x.A8,{children:[(0,o.jsx)(I.Z,{type:_.L.GHOST,className:"m__r--8",onClick:qe,children:"PHOTO_STEP"===je?"Cancel":"Back"}),(0,o.jsx)(I.Z,{loading:be,disabled:!xe||!re||be||"DESCRIPTION_STEP"===je&&!ae&&!Ie,onClick:function(e){e.preventDefault(),"PHOTO_STEP"===je?Ae():we()},children:"PHOTO_STEP"===je?"Next":"Save Changes"})]})})]})})]})}),$&&(0,o.jsx)(x.O8,{visible:!0,footer:null,className:"post-creation-modal",centered:!0,closable:!1,fullScreenForTablet:!0,children:(0,o.jsx)(x.uo,{children:(0,o.jsxs)(x.yo,{children:[(0,o.jsxs)(x.oj,{children:[(0,o.jsx)(x.Lw,{type:_.L.GHOST,onClick:qe,children:"PHOTO_STEP"===je?"Cancel":"Back"}),(0,o.jsx)(x.xA,{children:(0,o.jsx)("p",{children:"Edit post"})}),(0,o.jsx)(x.k$,{type:_.L.GHOST,$disabled:!xe||!re||be||"DESCRIPTION_STEP"===je&&!ae&&!Ie,onClick:function(e){e.preventDefault(),"PHOTO_STEP"===je?Ae():we()},children:"PHOTO_STEP"===je?"Next":"Save Changes"})]}),(0,o.jsx)(x.Zl,{children:(0,o.jsxs)(x.dI,{children:[(0,o.jsx)(E.Z,{control:ie,isToggle:"PHOTO_STEP"===je,onToggle:Le,formStatus:ke,setValue:ue,getValues:de,trigger:ve,isSaving:be,onSubmit:He}),(0,o.jsx)(S.Z,{channel:U,control:he,isToggle:"DESCRIPTION_STEP"===je,onToggle:Ue,formStatus:Ce,setValue:me,getValues:fe})]})})]})})}),(0,o.jsx)(M,{visible:De,onCancel:function(){return Ne(!1)},isEdit:!0,onOk:function(){Ne(!1),Re()}}),(0,o.jsx)(x.Pq,{}),(0,o.jsx)(k.hG,{}),(0,o.jsx)(k.Z0,{})]})},w=t(94829),V=t(14378),H=t(35081),q=t(7297),A=t(87379);function L(){var e=(0,q.Z)(["\n  justify-content: flex-end !important;\n  border-top: none !important;\n  padding: 0 !important;\n"]);return L=function(){return e},e}function U(){var e=(0,q.Z)(["\n  width: 130px;\n\n  ","\n"]);return U=function(){return e},e}var B=(0,A.ZP)(x.vv).withConfig({componentId:"sc-8713cdf5-0"})(L()),F=(0,A.ZP)(I.Z).withConfig({componentId:"sc-8713cdf5-1"})(U(),(function(e){return e.$disabled&&"\n    && {\n      background-color: #c4c4c4;\n      color: var(--color-white);\n    }\n\n    &&:focus,\n    &&:hover {\n      background-color: #c4c4c4;\n      color: var(--color-white);\n      border: transparent;\n    }\n  "})),G=g()((function(){return t.e(28223).then(t.bind(t,28223))}),{loadableGenerated:{webpack:function(){return[28223]}}}),X=g()((function(){return t.e(50147).then(t.bind(t,50147))}),{loadableGenerated:{webpack:function(){return[50147]}}}),Y=function(e){var n,t,i=e.channel,d=e.post,u=(0,r.useState)(d),v=u[0],g=u[1],f=(0,r.useState)(!1),S=f[0],E=f[1],P=(0,r.useState)(!1),j=P[0],k=P[1],C=(0,w.Z)("(max-width: ".concat(H.u.size1024-1,"px)"),!1),y=(0,l.v9)(Z.Z.getCurrentUser),M=(0,V.lm)(null,!0),R=(0,h.useRouter)(),q=v.slug,A=v.title,L=v.content,U=v.tag,Y=v.attachedImages,z=v.author,$=v.hidden,J=v.locked,K=v.approvalStatus,W=!!(null===y||void 0===y||null===(n=y.communityModerator)||void 0===n?void 0:n.assignedAt)&&!(null===y||void 0===y||null===(t=y.communityModerator)||void 0===t?void 0:t.disableAt),Q=(null===y||void 0===y?void 0:y.id)===(null===z||void 0===z?void 0:z.id),ee=(null===i||void 0===i?void 0:i.type)===D.An.ANNOUNCEMENT,ne=(Q&&!J||W)&&K!==D.Kb.REJECTED&&!$,te="/c/".concat(null===i||void 0===i?void 0:i.slug,"/").concat(q),ie=N.Z.object(W?{title:N.Z.string().required("Title is required").matches(O._6,"Field must contain a letter"),tag:N.Z.string(),attachedImages:N.Z.array().of(N.Z.string()).max(5,"Max 5 images")}:{title:N.Z.string().required("Title is required").matches(O._6,"Field must contain a letter").max(O.D0,"Title is too long. Max character is ".concat(O.D0)),content:N.Z.string().required().max(O.RZ),tag:N.Z.string(),attachedImages:N.Z.array().of(N.Z.string()).max(5,"Max 5 images")}).required(),oe=(0,m.cI)({defaultValues:{title:A||"",content:L||"",tag:(null===U||void 0===U?void 0:U.id)||"",attachedImages:Y||[]},mode:"onChange",reValidateMode:"onChange",criteriaMode:"all",resolver:(0,c.X)(ie)}),re=oe.control,le=oe.handleSubmit,ae=oe.formState,de=ae.isSubmitted,ue=ae.isValid,se=ae.isDirty,ce=oe.reset,ve=oe.getValues,ge=oe.setError,he=oe.clearErrors;(0,r.useEffect)((function(){q&&void 0!==y&&(ne&&!ee?me(q):R.push(te))}),[y]);var me=function(){var e=(0,a.Z)((function(e){var n,t,o;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,T.Z.getPostBySlug(e,!0)];case 1:return t=r.sent(),g(t),ce({title:(null===t||void 0===t?void 0:t.t
1itle)||"",content:(null===t||void 0===t?void 0:t.content)||"",tag:(null===t||void 0===t||null===(n=t.tag)||void 0===n?void 0:n.id)||"",attachedImages:(null===t||void 0===t?void 0:t.attachedImages)||[]}),[3,3];case 2:return o=r.sent(),console.error(o),M.error("Sorry, an error has occured. Please try again later."),R.push("/c/".concat(null===i||void 0===i?void 0:i.slug,"/").concat(null===d||void 0===d?void 0:d.slug)),[3,3];case 3:return[2]}}))}));return function(n){return e.apply(this,arguments)}}(),fe=function(){var e=(0,a.Z)((function(){var e,n,t,o,r,l,a,d,u,c;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:e=null===v||void 0===v?void 0:v.id,n=ve(),t=n.title,o=n.content,r=n.tag,l=n.attachedImages,s.label=1;case 1:return s.trys.push([1,3,4,5]),a={title:t,content:o,tag:r||null,attachedImages:l,channel:(null===i||void 0===i?void 0:i.id)||""},[4,T.Z.updatePostText(e,a)];case 2:return(d=s.sent())&&(R.back(),M.info("".concat((null===z||void 0===z?void 0:z.id)===(null===y||void 0===y?void 0:y.id)?"Your":"This"," ").concat((null===(u=d.edited)||void 0===u?void 0:u.editDraft)?"post has been edited, pending review":"post has been updated"))),[3,5];case 3:return c=s.sent(),console.error(c),function(e){[b.g.COMMUNITY_USER_BANNED,b.g.COMMUNITY_MOD_EDITED_POST,b.g.COMMUNITY_USER_EDIT_REJECTED_POST].includes(null===e||void 0===e?void 0:e.code)&&M.error(D.l[null===e||void 0===e?void 0:e.code])}(c),[3,5];case 4:return E(!1),[7];case 5:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),Te=function(){se?k(!0):R.push(te)},Se=function(){return(0,o.jsx)(B,{children:!C&&(0,o.jsxs)(x.uR,{children:[(0,o.jsxs)(x.A8,{children:[(0,o.jsx)(I.Z,{type:_.L.GHOST,className:"m__r--8",onClick:Te,children:"Cancel"}),(0,o.jsx)(F,{loading:S,htmlType:"submit",$disabled:!ue||!se||S,children:"Save Changes"})]}),!ue&&de&&se&&(0,o.jsx)(x.y,{children:"Please complete all fields to proceed"})]})})},Ee=function(){return(0,o.jsxs)(x.oj,{children:[(0,o.jsx)(x.Lw,{type:_.L.GHOST,onClick:Te,children:"Cancel"}),(0,o.jsx)(x.xA,{children:(0,o.jsx)("p",{children:"Edit post"})}),(0,o.jsx)(x.k$,{type:_.L.GHOST,htmlType:"submit",$disabled:!ue||!se||S,children:"Save Changes"})]})};return(0,o.jsxs)(o.Fragment,{children:[!C&&(0,o.jsxs)(x._z,{children:[(0,o.jsxs)(x.Xq,{onClick:Te,children:[(0,o.jsx)(p.Z,{icon:"pack_variants",size:24,color:"#7c7b7b"}),(0,o.jsx)("span",{children:"Back"})]}),(0,o.jsx)(x.uo,{onSubmit:le((function(){(null===i||void 0===i?void 0:i.id)&&!S&&(null===v||void 0===v?void 0:v.id)&&se&&E(!0)})),children:(0,o.jsxs)(x.yo,{children:[(0,o.jsxs)(x.PM,{children:[(0,o.jsx)(x.v0,{children:"Edit Post"}),(0,o.jsx)(p.Z,{icon:"close",size:14,onClick:Te})]}),(0,o.jsx)(X,{channel:i,control:re,editingPostSlug:q,setError:function(e){return e?ge("attachedImages",{type:"custom",message:"Max 5 images"}):he("attachedImages")},isSaving:S,onSubmit:fe}),Se()]})})]}),(0,o.jsx)(x.O8,{visible:C,footer:null,className:"post-creation-modal",centered:!0,closable:!1,fullScreenForTablet:!0,children:(0,o.jsx)(x.uo,{onSubmit:le((function(){(null===i||void 0===i?void 0:i.id)&&!S&&(null===v||void 0===v?void 0:v.id)&&se&&E(!0)})),children:(0,o.jsxs)(x.yo,{children:[Ee(),(0,o.jsxs)(x.Zl,{children:[(0,o.jsx)(X,{channel:i,control:re,setError:function(e){return e?ge("attachedImages",{type:"custom",message:"Max 5 images"}):he("attachedImages")},isSaving:S,onSubmit:fe}),Se()]})]})})}),(0,o.jsx)(G,{visible:j,onCancel:function(){return k(!1)},isEdit:!0,onOk:function(){k(!1),R.push(te)}})]})},z=t(59552),$=t(58877),J=t(50542),K=function(e){var n=e.channels,t=e.selectedChannel,i=e.post,a=(0,l.v9)(J.getSidebarChannels),d=(0,r.useState)(a.length?a:n)[0];return(0,o.jsx)(z.Z,{showChannelTopBar:!1,channels:d,selectedChannel:t,showCreatePostButton:!1,channelContent:(null===t||void 0===t?void 0:t.type)===D.An.PHOTO_TRANSFORMATION?(0,o.jsx)(R,{channel:t,post:i}):(0,o.jsx)(Y,{channel:t,post:i}),isShowBackToTopBtn:!1})},W=!0,Q=K;K.getLayout=function(e){return(0,o.jsx)($.Z,{isFullWidth:!0,bgColor:"var(--color-background-primary)",footerAd:!1,isFullWidthHeader:!0,isSettingPage:!0,showVerifyEmailAnnouncement:!1,children:e})}}},function(e){e.O(0,[15443,41664,91033,11540,94199,31929,80173,95306,50361,94055,25675,85077,77602,41749,84551,19497,74964,32214,97910,84960,94967,25070,20006,62631,96174,59552,91945,49774,92888,40179],(function(){return n=29517,e(e.s=n);var n}));var n=e.O();_N_E=n}]);

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.