1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9146],{79005:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/auth/update",function(){return n(77358)}])},96822:function(e,t,n){"use strict";n.d(t,{Ct:function(){return d},Ni:function(){return m},Eg:function(){return p},UO:function(){return c},Sc:function(){return _},oQ:function(){return g},gt:function(){return f},fj:function(){return h},NC:function(){return v}});var r=n(9669),a=n.n(r),i=n(80567);n(67421);var s=n(80325),o=a().create({baseURL:"/global_api",headers:{"Content-Type":"application/json","Accept-Language":i.Gd.language}}),u=a().create({baseURL:"https://api.royanews.tv/api",headers:{"Content-Type":"application/json","Accept-Language":i.Gd.language},withCredentials:!0}),l=a().create({baseURL:"/backend_api",headers:{"Content-Type":"application/json","Accept-Language":i.Gd.language},withCredentials:!0});o.interceptors.request.use(function(e){return e},function(e){return Promise.reject(e)}),o.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)}),l.interceptors.request.use(function(e){var t=(0,s.r_)().token;return t&&(e.headers.Authorization="Bearer ".concat(t)),e},function(e){return Promise.reject(e)}),l.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)}),u.interceptors.request.use(function(e){var t=e.headers.req,n=(0,s._z)(t);return n&&(e.headers.Authorization="Bearer ".concat(n)),e},function(e){return Promise.reject(e)}),u.interceptors.response.use(function(e){return e},function(e){return Promise.reject(e)});var c=function(e){return o.post("login",e)},d=function(e){return o.post("checkemail",{email:e})},p=function(e){return o.post("checkphone",{phone:e})},f=function(e){return o.post("send-verification-code",{email:e})},m=function(e,t){return o.post("verification",{email:e,code:t})},_=function(e){return o.post("".concat("https://global.royatv.com/api/v4","/register"),e,{headers:{"Content-Type":"multipart/form-data"}})},h=function(e){return o.post("login/social",e)},g=function(e){return o.post("forget-password",e)},v=function(e,t){return o.post("".concat("https://global.royatv.com/api/v4","/user/update"),e,{headers:{Authorization:"Bearer ".concat(t),"Content-Type":"multipart/form-data"}})}},14760:function(e,t,n){"use strict";var r=n(85893),a=n(99603),i=n(59417),s=function(e){var t;return(0,r.jsx)("button",{className:"common-button common-button-secondary",type:e.buttonType,disabled:e.disabledBtn,onClick:e.onClick,style:null!==(t=null==e?void 0:e.style)&&void 0!==t?t:{},children:e.isLoading?(0,r.jsx)(a.G,{icon:i.LM3}):(0,r.jsx)("span",{className:"common-button-text",children:e.children})})};t.Z=s},56061:function(e,t,n){"use strict";n.d(t,{G:function(){return r}});var r={successMsg:"Ø´ÙØ±Ø§ ÙØªÙاصÙÙ Ù
Ø¹ÙØ§, Ø³ÙØªÙ
Ø§ÙØªÙاص٠Ù
Ø¹Ù Ø¨Ø£ÙØ±Ø¨ ÙÙØª",failedMsg:"ÙØ¹ØªØ°Ø±, ÙØ±Ø¬Ù اÙÙ
ØØ§ÙÙØ© ÙÙ ÙÙØª ÙØ§ØÙ "}},77358:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return x}});var r=n(85893),a=n(47568),i=n(14924),s=n(82670),o=n(26042),u=n(69396),l=n(97582),c=n(67294),d=n(2664);n(9669);var p=n(60543),f=n(96822),m=n(9198),_=n.n(m);n(39828);var h=n(99603),g=n(59417),v=n(18871),N=n(33107),b=n(56061),j=n(14760),x=function(){var e,t,n=(0,d.v9)(function(e){return e.auth}),m=(n.isLoggedIn,n.user),x=n.token,y=(0,d.I0)(),w=(0,c.useRef)(null),k=(0,c.useState)({username:"",email:"",phone:"",firstName:"",lastName:"",birthDate:"",gender:"",password:"",confirmPassword:""}),C=k[0],D=k[1],Z=(0,c.useState)({}),P=Z[0],L=Z[1],S=(0,c.useState)(!1),T=S[0],A=S[1],M=(0,c.useState)(!1),B=M[0],E=M[1];(0,c.useEffect)(function(){E(!0)},[]);var U=(null==m?void 0:m.image)||(null==m?void 0:m.profile_image),G=B&&C.profilePicture?URL.createObjectURL(C.profilePicture):B&&U?U.startsWith("http")?U:"".concat(v.Z.globalApiUrl.replace("/api/v4","")).concat(U.startsWith("/")?"":"/").concat(U):"/assets/icons/profile-avatar.svg";(0,c.useEffect)(function(){if(m){var e=m.full_name&&""!==m.full_name.trim()?m.full_name.trim().split(/\s+/):[],t=e[0]||"",n=e.slice(1).join(" ")||"";D(function(e){return(0,u.Z)((0,o.Z)({},e),{username:m.full_name&&""!==m.full_name.trim()?m.full_name:m.email?m.email.split("@")[0]:"",email:m.email||"",phone:m.phone||"",firstName:m.first_name&&""!==m.first_name.trim()?m.first_name:t,lastName:m.last_name&&""!==m.last_name.trim()?m.last_name:n,birthDate:m.date_of_birth?new Date(m.date_of_birth):null,gender:m.gender||"",profilePicture:null})})}},[m]);var R,F=function(e){var t=e.target.files[0];t&&D(function(e){return(0,u.Z)((0,o.Z)({},e),{profilePicture:t})})},O=function(e){D(function(t){return(0,u.Z)((0,o.Z)({},t),{birthDate:e})})},q=function(e){var t=e.target,n=t.name,r=t.value;D(function(e){return(0,u.Z)((0,o.Z)({},e),(0,i.Z)({},n,r))}),P[n]&&L(function(e){return(0,u.Z)((0,o.Z)({},e),(0,i.Z)({},n,""))})},z=function(e,t){if(!e&&!t)return!0;
1if(!e||!t)return!1;var n=new Date(e),r=new Date(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()},I=(R=(0,a.Z)(function(e){var t,n,r,a,i;return(0,l.__generator)(this,function(u){switch(u.label){case 0:if(e.preventDefault(),t={},C.firstName&&""!==C.firstName.trim()||(t.firstName="ÙØ°Ø§ Ø§ÙØÙÙ Ù
Ø·ÙÙØ¨"),C.lastName&&""!==C.lastName.trim()||(t.lastName="ÙØ°Ø§ Ø§ÙØÙÙ Ù
Ø·ÙÙØ¨"),Object.keys(t).length>0)return L(t),[2];A(!0),u.label=1;case 1:return u.trys.push([1,3,4,5]),n=(0,s.Z)(C.birthDate,Date)?"".concat(C.birthDate.getFullYear(),"-").concat(String(C.birthDate.getMonth()+1).padStart(2,"0"),"-").concat(String(C.birthDate.getDate()).padStart(2,"0")):C.birthDate,(r=new FormData).append("_method","PATCH"),r.append("first_name",C.firstName),r.append("last_name",C.lastName),r.append("full_name","".concat(C.firstName," ").concat(C.lastName)),r.append("email",C.email),r.append("date_of_birth",n),r.append("gender",C.gender),C.profilePicture&&r.append("profile_image",C.profilePicture),[4,(0,f.NC)(r,x)];case 2:return a=u.sent(),console.log("Profile updated successfully:",a.data),(0,N.o)("تÙ
Ø§ÙØªØ¹Ø¯ÙÙ Ø¨ÙØ¬Ø§Ø",""),a.data.success&&y((0,p.he)({token:a.data.data.access_token||x,user:(0,o.Z)({},m,a.data.data.user)})),[3,5];case 3:return i=u.sent(),console.error("Error updating profile:",i),(0,N.U)("ÙÙØ§Ù خطأ Ù
ا!",b.G.failedMsg),[3,5];case 4:return A(!1),[7];case 5:return[2]}})}),function(e){return R.apply(this,arguments)});return(0,r.jsx)("div",{className:"auth",children:(0,r.jsxs)("div",{className:"auth__wrapper",children:[(0,r.jsx)("div",{className:"auth__label",children:(0,r.jsx)("h1",{children:"تعدÙ٠اÙÙ
ÙÙ Ø§ÙØ´Ø®ØµÙ"})}),(0,r.jsxs)("form",{className:"update_form",onSubmit:I,children:[(0,r.jsxs)("div",{className:"update_profile_pic",children:[(0,r.jsx)("div",{className:"update_profile_pic_icon",onClick:function(){return w.current.click()},children:(0,r.jsxs)("svg",{viewBox:"0 0 24 24",width:"24",height:"24",strokeWidth:1.5,stroke:"#ffffff",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 0 1 5.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 0 0-1.134-.175 2.31 2.31 0 0 1-1.64-1.055l-.822-1.316a2.192 2.192 0 0 0-1.736-1.039 48.774 48.774 0 0 0-5.232 0 2.192 2.192 0 0 0-1.736 1.039l-.821 1.316Z"}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0ZM18.75 10.5h.008v.008h-.008V10.5Z"})]})}),(0,r.jsxs)("div",{className:"update_profile_pic_label",children:[(0,r.jsx)("img",{src:G,alt:"Profile",onClick:function(){return w.current.click()}}),(0,r.jsx)("input",{type:"file",ref:w,name:"profilePicture",accept:"image/*",onChange:F,style:{display:"none"}})]})]}),(0,r.jsxs)("div",{className:"full_name",children:[(0,r.jsxs)("div",{className:"update_form_group_input_half update_form_group_input",children:[(0,r.jsxs)("div",{className:"update_field_label",children:["Ø§ÙØ£Ø³Ù
Ø§ÙØ£ÙÙ ",(0,r.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,r.jsx)("input",{className:"form-control auth__form__group-input_update ".concat(P.firstName?"auth__form-input__error":""),type:"text",name:"firstName",id:"firstname",value:C.firstName,onChange:q,"aria-label":"First Name"}),P.firstName&&(0,r.jsx)("span",{className:"auth__form-input__error-msg",children:P.firstName})]}),(0,r.jsxs)("div",{className:"update_form_group_input_half update_form_group_input",children:[(0,r.jsxs)("div",{className:"update_field_label",children:["اسÙ
Ø§ÙØ¹Ø§Ø¦ÙØ© ",(0,r.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,r.jsx)("input",{className:"form-control auth__form__group-input_update ".concat(P.lastName?"auth__form-input__error":""),type:"text",name:"lastName",id:"lastname",value:C.lastName,onChange:q,"aria-label":"Last Name"}),P.lastName&&(0,r.jsx)("span",{className:"auth__form-input__error-msg",children:P.lastName})]})]}),(null==C?void 0:null===(e=C.email)||void 0===e?void 0:e.length)>1&&(0,r.jsxs)("div",{className:"form-group update_form_group_input update_form_group_input_full_width",children:[(0,r.jsx)("div",{className:"update_field_label",children:"Ø§ÙØ¨Ø±Ùد Ø§ÙØ§ÙÙØªØ±ÙÙÙ"}),(0,r.jsx)("input",{className:"form-control auth__form__group-input",type:"email",name:"email",id:"email",value:C.email,onChange:q,"aria-label":"Email Name",disabled:!0})]}),(null==C?void 0:null===(t=C.phone)||void 0===t?void 0:t.length)>1&&(0,r.jsxs)("div",{className:"form-group update_form_group_input update_form_group_input_full_width",children:[(0,r.jsx)("div",{className:"update_field_label",children:"رÙÙ
اÙÙØ§ØªÙ"}),(0,r.jsx)("input",{className:"form-control auth__form__group-input",type:"tel",name:"phone",id:"phone",value:C.phone,onChange:q,"aria-label":"Phone Number",disabled:!0,style:{direction:"ltr",textAlign:"right"}})]}),(0,r.jsxs)("div",{className:"form-update_form_group_input update_form_group_input_half update_form_group_input",children:[(0,r.jsx)("div",{className:"update_field_label",children:"Ø§ÙØ¬Ùس"}),(0,r.jsxs)("select",{className:"select_box_update",id:"gender",name:"gender",value:C.gender,onCh
1ange:q,"aria-label":"Gender",children:[(0,r.jsx)("option",{value:"",disabled:!0,children:"اختر Ø§ÙØ¬Ùس"}),(0,r.jsx)("option",{value:"1",children:"Ø°ÙØ±"}),(0,r.jsx)("option",{value:"2",children:"Ø§ÙØ«Ù"})]})]}),(0,r.jsxs)("div",{className:"form-update_form_group_input update_form_group_input_half update_form_group_input date_picker_calender",children:[(0,r.jsx)("div",{className:"update_field_label",children:"ØªØ§Ø±ÙØ® اÙÙ
ÙÙØ§Ø¯"}),(0,r.jsx)("div",{className:"date_picker_calender_icon",children:(0,r.jsx)(h.G,{icon:g.WRo})}),(0,r.jsx)(_(),{className:"select_box_update",id:"birthDate",selected:C.birthDate,onChange:O,dateFormat:"yyyy/M/d",placeholderText:"Birth Date","aria-label":"Birth Date"})]}),(0,r.jsx)(j.Z,{style:{marginTop:"0px"},buttonType:"submit",isLoading:T,disabledBtn:T||!function(){if(!m)return!1;var e=m.full_name&&""!==m.full_name.trim()?m.full_name.trim().split(/\s+/):[],t=e[0]||"",n=e.slice(1).join(" ")||"",r=m.first_name&&""!==m.first_name.trim()?m.first_name:t,a=m.last_name&&""!==m.last_name.trim()?m.last_name:n,i=m.date_of_birth?new Date(m.date_of_birth):null,s=m.gender||"",o=C.firstName!==r,u=C.lastName!==a,l=String(C.gender||"")!==String(s),c=!z(C.birthDate,i),d=!!C.profilePicture;return o||u||l||c||d}(),children:"تعدÙÙ"})]})]})})}},33107:function(e,t,n){"use strict";n.d(t,{U:function(){return i},o:function(){return s}});var r=n(86455),a=n.n(r),i=function(e,t){return a().fire({icon:"error",title:e,text:t,confirmButtonText:"Ø§ØºÙØ§Ù"})},s=function(e,t){return a().fire({icon:"success",title:e,text:t,confirmButtonText:"Ø§ØºÙØ§Ù"})}},82670:function(e,t,n){"use strict";function r(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}n.d(t,{Z:function(){return r}})}},function(e){e.O(0,[8166,9669,4544,9774,2888,179],function(){return e(e.s=79005)}),_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.