PageSourceSearch

https://jindoo.ma/static/js/2815.9282c4fa.chunk.js

js jindoo.ma collected 2026-10-08 20:25:41 UTC 138,346 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkJindoo=self.webpackChunkJindoo||[]).push([[2815],{43384:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Ct});var o=r(89379),n=r(57528),a=r(65043),i=r(91688),s=r(79722),l=r(47503),c=(r(92342),r(83290)),d=r(71061),p=r(21989),x=r(95716),u=r(34688),h=r(31590),g=r(87417),b=r(88992),m=r(6691),f=r(72858),y=r(23867),j=r(49530),S=r(85369),v=r(58147),z=r(5399),w=r(52863),C=r(91003),A=r(85539),U=r(12571),k=r(1183),E=r(35946),L=r(82597),I=r(25560),P=r(73919),R=r(65459),_=r(69893),W=r(52536),O=r(82185),D=r(29581),N=r(14145),M=r(60047),T=r(70579);const F=e=>(e=>"string"===typeof e&&""!==e.trim())(e)?e:e instanceof File||e instanceof Blob?URL.createObjectURL(e):null,B=e=>{let{files:t,setFiles:r,handleDelete:o,handleFileChange:n,maxImages:i=6}=e;const s=(0,A.d)(),l=(0,g.A)({base:!0,md:!1}),c=(0,g.A)({base:"full",md:"xl"}),b=(0,d.dU)("white","navy.800"),f=(0,d.dU)("gray.200","whiteAlpha.200"),y=(0,d.dU)("brand.500","purple.300"),S=(0,d.dU)("gray.700","white"),v=(0,d.dU)("gray.500","gray.400"),z=(0,d.dU)("gray.50","whiteAlpha.50"),w=(0,d.dU)("gray.200","whiteAlpha.200"),B=(0,d.dU)("purple.300","purple.500"),q=(0,d.dU)("purple.50","whiteAlpha.100"),H=(0,d.dU)("purple.400","purple.400"),V=(0,d.dU)("0 2px 8px rgba(128, 90, 213, 0.15)","0 2px 8px rgba(128, 90, 213, 0.3)"),Y=(0,d.dU)("purple.500","purple.400"),Z=(0,d.dU)("gray.100","whiteAlpha.100"),J=(0,d.dU)("purple.50","whiteAlpha.50"),K=(0,d.dU)("purple.100","whiteAlpha.100"),$=(0,d.dU)("purple.600","purple.300"),[G,Q]=(0,a.useState)(null),[X,ee]=(0,a.useState)(!1),[te,re]=(0,a.useState)(null),[oe,ne]=(0,a.useState)(null),[ae,ie]=(0,a.useState)({x:0,y:0}),[se]=(0,a.useState)(2.5),[le,ce]=(0,a.useState)(!1),de=(0,a.useRef)(null),{isOpen:pe,onOpen:xe,onClose:ue}=(0,U.j)(),he=t.filter((e=>null!==e)).length,ge=()=>re(null),be=()=>{ee(!1),re(null)},me=e=>{if(!de.current)return;const{left:t,top:r,width:o,height:n}=de.current.getBoundingClientRect(),a=e.clientX||(e.touches&&e.touches[0]?e.touches[0].clientX:0),i=e.clientY||(e.touches&&e.touches[0]?e.touches[0].clientY:0);ie({x:(a-t)/o*100,y:(i-r)/n*100})},fe=e=>{const a=0===e,i=null!==t[e]&&void 0!==t[e],c=te===e,d=G===e&&X,g=i?F(t[e]):null;return(0,T.jsx)(h.az,{draggable:i,onDragStart:r=>((e,r)=>{if(!t[r])return;Q(r),ee(!0);const o=document.createElement("div");o.style.width="80px",o.style.height="80px";const n=F(t[r]);n&&(o.style.backgroundImage="url(".concat(n,")")),o.style.backgroundSize="cover",o.style.borderRadius="8px",o.style.position="absolute",o.style.top="-1000px",document.body.appendChild(o),e.dataTransfer&&(e.dataTransfer.setDragImage(o,40,40),e.dataTransfer.setData("text/plain",r)),setTimeout((()=>document.body.removeChild(o)),0)})(r,e),onDragOver:r=>((e,r)=>{e.preventDefault(),null===t[r]&&r===G||re(r)})(r,e),onDragLeave:ge,onDrop:o=>((e,o)=>{e.preventDefault();const n=parseInt(e.dataTransfer?e.dataTransfer.getData("text/plain"):G);if(n===o||void 0===n||null===t[n])return ee(!1),void re(null);const a=[...t],i=a[n];null!==a[o]?(a[n]=a[o],a[o]=i):(a[n]=null,a[o]=i),r(a),ee(!1),re(null),s({title:(0,C.t)("Images r\xe9organis\xe9es"),description:0===o?(0,C.t)("L'image a \xe9t\xe9 d\xe9finie comme image principale"):(0,C.t)("L'ordre des images a \xe9t\xe9 modifi\xe9"),status:"info",duration:2e3,isClosable:!0,position:l?"bottom":"bottom-right"})})(o,e),onDragEnd:be,cursor:i?"grab":"default",position:"relative",borderRadius:"12px",border:a?"2px solid":"1.5px solid",borderStyle:c?"dashed":"solid",borderColor:c?Y:a?H:w,bg:i?"transparent":z,overflow:"hidden",transition:"all 0.2s ease",opacity:d?.4:1,boxShadow:a&&i?V:"none",_hover:{borderColor:B,bg:i?void 0:q,transform:i?"translateY(-1px)":"none",boxShadow:i?"md":"none"},h:a?{base:"180px",md:"188px"}:{base:"90px",md:"90px"},children:i&&g?(0,T.jsxs)(h.az,{position:"relative",h:"100%",w:"100%",children:[(0,T.jsx)(k._,{src:g,alt:"Image ".concat(e+1),w:"100%",h:"100%",objectFit:"cover"}),(0,T.jsx)(h.az,{position:"absolute",top:"6px",left:"6px",zIndex:3,children:a?(0,T.jsxs)(E.z,{spacing:1,px:"6px",py:"2px",borderRadius:"full",bg:"rgba(0,0,0,0.6)",children:[(0,T.jsx)(x.I,{as:j.SeC,boxSize:"10px",color:"yellow.300"}),(0,T.jsx)(u.E,{fontSize:"9px",fontWeight:"700",color:"white",children:(0,C.t)("Principal")})]}):(0,T.jsx)(p.s,{align:"center",justify:"center",w:"18px",h:"18px",borderRadius:"full",bg:"rgba(0,0,0,0.6)",children:(0,T.jsx)(u.E,{fontSize:"9px",fontWeight:"700",color:"white",children:e+1})})}),(0,T.jsx)(h.az,{position:"absolute",top:"6px",right:"6px",zIndex:3,children:(0,T.jsx)(h.az,{bg:"rgba(0,0,0,0.5)",borderRadius:"full",p:"3px",cursor:"grab",children:(0,T.jsx)(x.I,{as:j.LUV,boxSize:"14px",color:"white"})})}),(0,T.jsx)(h.az,{position:"absolute",inset:"0",bg:"rgba(0,0,0,0.5)",opacity:"0",transition:"opacity 0.2s",_hover:{opacity:1},display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"inherit",children:(0,T.jsxs)(E.z,{spacing:a?4:2,children:[(0,T.jsx)(h.az,{onClick:t=>{t.stopPropagation(),(e=>{ne(e),xe()})(e)},cursor:"pointer",borderRadius:"full",p:a?"8px":"5px",bg:"whiteAlpha.200",transition:"all 0.15s",_hover:{bg:"whiteAlpha.300",transform:"scale(1.1)"},children:(0,T.jsx)(x.I,{as:j.U3x,color:"white",boxSize:a?"18px":"14px"})}),(0,T.jsx)(h.az,{onClick:t=>{t.stopPropagation(),o(e)},cursor:"pointer",borderRadius:"full",p:a?"8px":"5px",bg:"whiteAlpha.200",transition:"all 0.15s",_hover:{bg:"red.500",transform:"scale(1.1)"}
1,children:(0,T.jsx)(x.I,{as:j.b6i,color:"white",boxSize:a?"18px":"14px"})})]})})]}):(0,T.jsxs)(p.s,{as:"label",htmlFor:"imageInput-".concat(e),direction:"column",align:"center",justify:"center",h:"100%",w:"100%",cursor:"pointer",gap:a?2:1,children:[(0,T.jsx)(x.I,{as:a?j.uPF:j.JKf,boxSize:a?"28px":"18px",color:a?y:v}),(0,T.jsx)(u.E,{fontSize:a?"12px":"10px",fontWeight:a?"600":"500",color:a?y:v,textAlign:"center",px:1,children:a?(0,C.t)("Photo principale"):"".concat(e+1)}),(0,T.jsx)(L.p,{id:"imageInput-".concat(e),type:"file",accept:"image/*",multiple:!0,onChange:t=>n(t,e),display:"none"})]})},e)};return(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1px solid",borderColor:f,overflow:"visible",bg:b,boxShadow:"sm",children:[(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,children:[(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:2,children:[(0,T.jsxs)(p.s,{align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:y}),(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:S,children:(0,C.t)("Photos du produit")})]}),(0,T.jsx)(E.z,{spacing:2,children:(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:he>0&&he>=i?"green.50":Z,border:"1px solid",borderColor:he>=i?"green.200":f,children:(0,T.jsxs)(E.z,{spacing:1,children:[he>0&&he>=i&&(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:"green.500"}),(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:he>=i?"green.600":v,children:[he,"/",i]})]})})})]}),(0,T.jsxs)(p.s,{align:"center",gap:2,px:2,py:"5px",mb:2,borderRadius:"8px",bg:J,border:"1px solid",borderColor:K,children:[(0,T.jsx)(x.I,{as:j.MJW,boxSize:"13px",color:$,flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"10px",color:$,fontWeight:"500",children:(0,C.t)("La 1\xe8re image sera la couverture. Glissez pour r\xe9organiser.")})]})]}),(0,T.jsx)(h.az,{px:{base:3,md:4},pb:{base:3,md:4},children:(0,T.jsxs)(p.s,{gap:3,direction:{base:"column",md:"row"},align:"stretch",children:[(0,T.jsx)(h.az,{w:{base:"100%",md:"38%"},flexShrink:0,h:{md:"188px"},children:fe(0)}),(0,T.jsx)(h.az,{flex:1,children:(0,T.jsx)(I.x,{templateColumns:{base:"repeat(3, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)"},templateRows:{base:"repeat(2, 1fr)",md:"repeat(2, 1fr)"},gap:2,h:"100%",children:[1,2,3,4,5].map((e=>(0,T.jsx)(P.E,{children:e<i?fe(e):null},e)))})})]})}),(0,T.jsxs)(R.aF,{isOpen:pe,onClose:ue,size:c,isCentered:!l,motionPreset:"slideInBottom",children:[(0,T.jsx)(_.m,{}),(0,T.jsxs)(W.$,{borderTopRadius:l?0:"md",children:[(0,T.jsx)(O.r,{fontSize:l?"sm":"md",children:(0,C.t)("Aper\xe7u de l'image")}),(0,T.jsx)(D.s,{}),(0,T.jsx)(N.c,{position:"relative",pb:0,children:null!==oe&&t[oe]&&(0,T.jsxs)(h.az,{position:"relative",cursor:"zoom-in",onMouseMove:me,onTouchStart:e=>{ce(!0),me(e)},onTouchMove:me,onTouchEnd:()=>ce(!1),children:[(0,T.jsx)(h.az,{position:"absolute",top:"10px",right:"10px",bg:"rgba(0,0,0,0.5)",color:"white",borderRadius:"full",p:"2",zIndex:3,children:(0,T.jsx)(j.gff,{size:l?18:24})}),(0,T.jsx)(k._,{ref:de,src:F(t[oe]),alt:"Preview",maxW:"100%",maxH:l?"50vh":"70vh",mx:"auto"}),(0,T.jsx)(h.az,{position:"absolute",top:"0",left:"0",right:"0",bottom:"0",overflow:"hidden",zIndex:2,pointerEvents:"none",children:(0,T.jsx)(h.az,{position:"absolute",width:l?"120px":"150px",height:l?"120px":"150px",borderRadius:"full",border:"2px solid white",overflow:"hidden",left:"calc(".concat(ae.x,"% - ").concat(l?"60px":"75px",")"),top:"calc(".concat(ae.y,"% - ").concat(l?"60px":"75px",")"),boxShadow:"0 0 10px rgba(0,0,0,0.5)",opacity:le?1:0,transition:"opacity 0.2s ease",children:(0,T.jsx)(h.az,{position:"absolute",width:"".concat(100*se,"%"),height:"".concat(100*se,"%"),left:"".concat(-ae.x*se+50,"%"),top:"".concat(-ae.y*se+50,"%"),backgroundImage:"url(".concat(F(t[oe]),")"),backgroundPosition:"center",backgroundSize:"cover"})})})]})}),(0,T.jsxs)(M.j,{children:[(0,T.jsx)(u.E,{fontSize:l?"2xs":"sm",color:"gray.500",mr:2,children:l?(0,C.t)("Touchez l'image pour zoomer"):(0,C.t)("Passez le curseur pour zoomer")}),(0,T.jsx)(m.$,{variant:"ghost",onClick:ue,size:l?"sm":"md",children:(0,C.t)("Fermer")})]})]})]})]})};var q,H=r(93750),V=r.n(H),Y=r(73903),Z=r(36138),J=r(59512),K=r(20293),$=r(90426),G=r(21431),Q=r(98800),X=r(37875),ee=r(41137);
1const te=(0,c.i7)(q||(q=(0,n.A)(["\n  0% { background-position: -400px 0; }\n  100% { background-position: 400px 0; }\n"]))),re=e=>e?e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[-_]/g," "):"",oe=e=>{let{isDark:t}=e;const r=t?"rgba(255,255,255,0.02)":"#fcfcfc",o=t?"rgba(255,255,255,0.05)":"#f0f0f0",n=t?"rgba(255,255,255,0.05)":"#f4f4f4",a=t?"rgba(255,255,255,0.05)":"#f0f0f0",i=t?"rgba(255,255,255,0.03)":"#f5f5f5",s={backgroundImage:t?"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 75%)":"linear-gradient(90deg, #f7f7f7 25%, #f0f0f0 50%, #f7f7f7 75%)",backgroundSize:"800px 100%",animation:"".concat(te," 1.6s infinite linear")};return(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1.5px solid",borderColor:o,bg:r,overflow:"hidden",position:"relative",children:[(0,T.jsx)(h.az,{position:"absolute",top:"0",left:"0",right:"0",h:"3px",bg:a,borderTopRadius:"16px"}),(0,T.jsxs)(p.s,{direction:"column",align:"center",justify:"center",px:"10px",pt:"14px",pb:"10px",minH:{base:"90px",md:"100px"},gap:"8px",children:[(0,T.jsx)(h.az,{w:"46px",h:"46px",borderRadius:"12px",bg:n,sx:s,flexShrink:0}),(0,T.jsx)(h.az,{w:"64px",h:"10px",borderRadius:"6px",bg:a,sx:s}),(0,T.jsx)(h.az,{w:"44px",h:"8px",borderRadius:"6px",bg:i,sx:s})]})]})},ne=()=>{const e=(0,d.dU)(!1,!0);return(0,T.jsx)(h.az,{display:"grid",gridTemplateColumns:{base:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(4, 1fr)"},gap:"10px",children:Array.from({length:8}).map(((t,r)=>(0,T.jsx)(oe,{isDark:e},r)))})},ae=a.memo((e=>{let{animationKey:t,isActive:r}=e;const o=(0,a.useRef)(null),n=(0,a.useRef)(!1),i=(0,a.useRef)(1),s=(0,X.mh)(t,!0),l=(0,a.useCallback)((()=>{!n.current&&o.current&&(n.current=!0,i.current=1,o.current.setDirection(1),o.current.setSpeed(.7),o.current.play())}),[]),c=(0,a.useCallback)((()=>{o.current&&(1===i.current?(i.current=-1,o.current.setDirection(-1),o.current.play()):(o.current.stop(),i.current=1))}),[]);return(0,a.useEffect)((()=>{r&&o.current&&(i.current=1,o.current.setDirection(1),o.current.setSpeed(.7),o.current.play())}),[r]),s?(0,T.jsx)(V(),{lottieRef:o,animationData:s,loop:!1,autoplay:!1,onDOMLoaded:l,onComplete:c,style:{width:32,height:32}}):null})),ie=a.memo((e=>{let{group:t,isSelected:r,onClick:o,language:n}=e;const i=(0,d.dU)("white","navy.800"),s=(0,d.dU)("gray.700","white"),l=(0,d.dU)("gray.100","whiteAlpha.100"),[c,x]=(0,a.useState)(!1);return(0,T.jsxs)(h.az,{bg:r?t.colorLight:i,borderRadius:"16px",border:"1.5px solid",borderColor:r?t.color:l,overflow:"hidden",cursor:"pointer",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),onClick:o,_hover:{transform:"translateY(-2px)",boxShadow:"0 6px 20px -4px ".concat(t.colorMid),borderColor:t.color},position:"relative",role:"group",children:[(0,T.jsx)(h.az,{position:"absolute",top:"0",left:"0",right:"0",h:"3px",bg:r?t.color:"transparent",borderTopRadius:"16px",transition:"all 0.3s ease",_groupHover:{bg:t.color}}),(0,T.jsxs)(p.s,{direction:"column",align:"center",justify:"center",px:"10px",pt:"14px",pb:"10px",minH:{base:"90px",md:"100px"},children:[(0,T.jsx)(h.az,{w:"46px",h:"46px",borderRadius:"12px",bg:t.colorLight,display:"flex",alignItems:"center",justifyContent:"center",mb:"6px",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",transform:r||c?"scale(1.08)":"scale(1)",children:(0,T.jsx)(ae,{animationKey:t.animationKey,isActive:r||c})}),(0,T.jsx)(u.E,{fontSize:{base:"11px",md:"12px"},fontWeight:r?"700":"600",color:r?t.color:s,textAlign:"center",lineHeight:"1.3",noOfLines:2,children:(0,X.Y9)(t,n)}),r&&(0,T.jsx)(h.az,{w:"6px",h:"6px",borderRadius:"full",bg:t.color,mt:"4px"})]})]})})),se=a.memo((e=>{let{cat:t,groupColor:r,groupColorLight:o,isSelected:n,onClick:a,categoryCount:i}=e;const s=(0,d.dU)("gray.700","white"),l=(0,d.dU)("gray.100","whiteAlpha.200");return(0,T.jsxs)(p.s,{align:"center",py:"10px",px:"12px",borderRadius:"10px",cursor:"pointer",transition:"all 0.2s ease",bg:n?o:"transparent",border:"1.5px solid",borderColor:n?r:"transparent",_hover:{bg:o},onClick:a,children:[(0,T.jsx)(x.I,{as:n?j.mU9:(0,$.N7)(t.name).icon,w:"18px",h:"18px",color:r,mr:"10px",flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"13px",fontWeight:n?"700":"500",color:n?r:s,noOfLines:1,flex:1,children:(0,Q.xY)(t.name,t.label,C.t)}),null!==i&&void 0!==i&&(0,T.jsx)(Y.E,{fontSize:"9px",px:"6px",py:"1px",borderRadius:"full",bg:l,color:r,fontWeight:"600",ml:"6px",flexShrink:0,children:i}),(0,T.jsx)(x.I,{as:j.xVu,w:"16px",h:"16px",color:r,opacity:.5,ml:"4px",flexShrink:0})]})})),le=a.memo((e=>{let{sub:t,groupColor:r,groupColorLight:o,isSelected:n,onClick:i,parentCategoryName:s}=e;const l=(0,d.dU)("gray.600","gray.300"),c=(0,a.useMemo)((()=>(0,G.c)(t.name,t.label)),[t.name,t.label]);return(0,T.jsxs)(p.s,{align:"center",py:"8px",px:"12px",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s ease",bg:n?o:"transparent",border:"1.5px solid",borderColor:n?r:"transparent",_hover:{bg:o},onClick:i,children:[n?(0,T.jsx)(x.I,{as:j.mU9,w:"15px",h:"15px",color:r,mr:"10px",flexShrink:0}):(0,T.jsx)(h.az,{as:c,width:"15px",height:"15px",color:r,opacity:.7,mr:"10px",flexShrink:0,style:{minWidth:"15px"}}),(0,T.jsx)(u.E,{fontSize:"12.5px",fontWeight:n?"600":"400",color:n?r:l,noOfLines:1,flex:1,children:(0,Q.hI)(t.name,t.label,C.t,s)})]})})),ce=a.memo((e=>{let{item:t,isSelected:r,onClick:o}=e;const n=(0,d.dU)("gray.700","white"),i=(0,d.dU)("gray.400","gray.500"),s=(0,a.useMemo)((()=>"subcategory"===t.type?(0,G.c)(t.subName||"",t.displayName):(0,$.N7)(t.catName||"").icon||j.xVu),[t]);return(0,T.jsxs)(p.s,{align:"center",py:"8px",px:"12px",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s ease",bg:r?t.colorLight:"transparent",border:"1.5px solid",borderColor:r?t.color:"transparent",_hover:{bg:t.colorLight},onClick:o,mb:"2px",children:[r?(0,T.jsx)(x.I,{as:j.mU9,w:"16px",h:"16px",color:t.color,mr:"10px",flexShrink:0}):"subcategory"===t.type?(0,T.jsx)(h.az,{mr:"10px",children:(0,T.jsx)(h.az,{as:s,width:"16px",height:"16px",color:t.color,opacity:.75,flexShrink:0,style:{minWidth:"16px"}})}):(0,T.jsx)(x.I,{as:s,w:"16px",h:"16px",color:t.color,mr:"10px",flexShrink:0}),(0,T.jsxs)(h.az,{flex:1,minW:0,children:[(0,T.jsx)(u.E,{fontSize:"13px",fontWeight:r?"700":"500",color:r?t.color:n,noOfLines:1,children:t.displayName}),t.breadcrumb&&(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"400",color:i,noOfLines:1,mt:"1px",children:t.breadcrumb})]}),(0,T.jsx)(Y.E,{fontSize:"9px",px:"5px",py:"1px",borderRadius:"full",bg:"".concat(t.color,"18"),color:t.color,fontWeight:"600",ml:"8px",flexShrink:0,textTransform:"none",children:"subcategory"===t.type?(0,C.t)("Sous-cat\xe9gorie"):(0,C.t)("Cat\xe9gorie")})]})})),de=e=>{var t;let{categories:r,selectedCategory:o,selectedCategoryId:n,selectedCategoryLabel:i,selectedSubcategory:l,selectedSubcategoryLabel:c,onCategorySelect:b,onSubcategorySelect:m,onClearCategory:S,onClearSubcategory:v}=e;const{i18n:z}=(0,ee.Bd)(),w=(null===(t=z.language)||void 0===t?void 0:t.substring(0,2))||"fr",[A,U]=((0,g.A)({base:!0,md:!1}),(0,a.useState)("groups")),[k,I]=(0,a.useState)(null),[P,R]=(0,a.useState)(null),[_,W]=(0,a.useState)([]),[O,D]=(0,a.useState)(!1),[N,M]=(0,a.useState)(""),[F,B]=(0,a.useState)({}),[q,H]=(0,a.useState)(!1),V=(0,a.useRef)(!1),Y=(0,a.useRef)(!1),$=(0,a.useRef)(null),G=(0,d.dU)("white","navy.800"),te=(0,d.dU)("gray.200","whiteAlpha.200"),oe=(0,d.dU)("gray.800","white"),ae=(0,d.dU)("gray.500","gray.400"),de=(0,d.dU)("white","navy.700"),pe=(0,d.dU)("gray.200","whiteAlpha.200"),xe=(0,d.dU)("brand.500","purple.300"),ue=(0,d.dU)("green.50","green.900"),he=(0,d.dU)("green.300","green.600"),ge=(0,d.dU)("green.700","green.200"),be=(0,d.dU)("gray.100","whiteAlpha.100"),me=(0,d.dU)("gray.200","whiteAlpha.200"),fe=(0,d.dU)("brand.500","purple.300"),ye=(0,d.dU)("red.500","red.400"),je=(0,d.dU)("gray.100","whiteAlpha.100"),Se=!r||0===r.length,ve=(0,a.useMemo)((()=>r&&0!==r.length?(0,X.$q)(r,X.rV):[]),[r]);(0,a.useEffect)((()=>
1{if(Y.current)return;if(0===ve.length)return;if(!o)return;Y.current=!0;const e=r.find((e=>e.name===o));if(!e)return;const t=ve.find((t=>t.categories.some((t=>t.name===e.name))));t&&(I(t),R(e),l?(U("subcategories"),D(!0),s.A.get("".concat("https://api.jindoo.ma/api/v1","/subcategories/").concat(e._id)).then((e=>W(e.data||[]))).catch((()=>W([]))).finally((()=>D(!1)))):U("categories"))}),[ve,r,o,l]),(0,a.useEffect)((()=>{if(!V.current&&r.length>0&&N.trim().length>0){V.current=!0;(async()=>{H(!0);const e={},t=r.map((e=>e._id)).filter(Boolean);await Promise.all(t.map((async t=>{try{const r=await s.A.get("".concat("https://api.jindoo.ma/api/v1","/subcategories/").concat(t));e[t]=r.data||[]}catch(r){e[t]=[]}}))),B(e),H(!1)})()}}),[N,r]);const ze=(0,a.useCallback)((async e=>{D(!0);try{const t=await s.A.get("".concat("https://api.jindoo.ma/api/v1","/subcategories/").concat(e));W(t.data||[])}catch(t){W([])}finally{D(!1)}}),[]),we=(0,a.useCallback)((e=>{k&&k.id===e.id&&"categories"===A?(I(null),U("groups")):(I(e),U("categories")),R(null),W([])}),[k,A]),Ce=(0,a.useCallback)((e=>{R(e),U("subcategories"),ze(e._id),b({name:e.name,_id:e._id,label:e.label})}),[ze,b]),Ae=(0,a.useCallback)((e=>{m({name:e.name,label:e.label})}),[m]),Ue=(0,a.useCallback)((e=>{if("category"===e.type){const t=r.find((t=>t._id===e.catId));if(t){const e=ve.find((e=>e.categories.some((e=>e.name===t.name))));e&&I(e),Ce(t)}M("")}else if("subcategory"===e.type){const t=r.find((t=>t._id===e.catId));if(t){const r=ve.find((e=>e.categories.some((e=>e.name===t.name))));r&&I(r),R(t),ze(t._id),U("subcategories"),b({name:t.name,_id:t._id,label:t.label}),m({name:e.subName,label:e.subLabel})}M("")}}),[r,ve,Ce,b,m]),ke=(0,a.useCallback)((()=>{"subcategories"===A?(U("categories"),R(null),W([]),v&&v()):"categories"===A&&(U("groups"),I(null),S&&S())}),[A,v,S]),Ee=(0,a.useCallback)((()=>{Y.current=!0,U("groups"),I(null),R(null),W([]),M(""),S&&S(),v&&v()}),[S,v]),Le=(0,a.useMemo)((()=>{const e=N.trim();if(!e)return null;const t=re(e),r=[];return ve.forEach((e=>{e.categories.forEach((o=>{const n=re((0,Q.xY)(o.name,o.label,C.t)),a=re(o.name),i=re(o.label);(a.includes(t)||i.includes(t)||n.includes(t))&&r.push({type:"category",catId:o._id,catName:o.name,displayName:(0,Q.xY)(o.name,o.label,C.t),breadcrumb:(0,X.Y9)(e,w),color:e.color,colorLight:e.colorLight});(F[o._id]||[]).forEach((n=>{const a=re((0,Q.hI)(n.name,n.label,C.t)),i=re(n.name),s=re(n.label);(i.includes(t)||s.includes(t)||a.includes(t))&&r.push({type:"subcategory",catId:o._id,catName:o.name,subName:n.name,subLabel:n.label,displayName:(0,Q.hI)(n.name,n.label,C.t),breadcrumb:(0,X.Y9)(e,w)+" \u2192 "+(0,Q.xY)(o.name,o.label,C.t),color:e.color,colorLight:e.colorLight})}))}))})),r}),[N,ve,F,w]),Ie=N.trim().length>0,Pe=(0,a.useMemo)((()=>{const e=[];return k&&e.push({label:(0,X.Y9)(k,w),color:k.color}),i&&e.push({label:(0,Q.xY)(o,i,C.t),color:k?k.color:"gray.500"}),c&&e.push({label:(0,Q.hI)(l,c,C.t,o),color:k?k.color:"gray.500"}),e}),[k,o,i,l,c,w]),Re=o&&l,_e=o&&!l;return(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1px solid",borderColor:te,overflow:"hidden",bg:G,boxShadow:"sm",children:[(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,children:[(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:3,children:[(0,T.jsxs)(p.s,{align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:fe}),(0,T.jsxs)(E.z,{spacing:1,children:[(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:oe,children:(0,C.t)("Cat\xe9gorie & Sous-cat\xe9gorie")}),(0,T.jsx)(u.E,{fontSize:"12px",color:ye,children:"*"})]})]}),(0,T.jsxs)(E.z,{spacing:2,children:[Re&&(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:"green.50",border:"1px solid",borderColor:"green.200",children:(0,T.jsxs)(E.z,{spacing:1,children:[(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:"green.500"}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"600",color:"green.600",children:(0,C.t)("Complet")})]})}),_e&&(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:je,border:"1px solid",borderColor:te,children:(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"600",color:ae,children:"1/2"})})]})]}),(0,T.jsxs)(Z.M,{size:"sm",mb:2,children:[(0,T.jsx)(J.W,{pointerEvents:"none",h:"36px",children:(0,T.jsx)(x.I,{as:j.gZ7,w:"16px",h:"16px",color:ae})}),(0,T.jsx)(L.p,{ref:$,value:N,onChange:e=>M(e.target.value),placeholder:(0,C.t)("Rechercher une cat\xe9gorie ou sous-cat\xe9gorie..."),h:"36px",bg:de,border:"1.5px solid",borderColor:pe,borderRadius:"10px",fontSize:"13px",fontWeight:"400",color:oe,isDisabled:Se,_placeholder:{color:ae,fontSize:"12px"},_focus:{borderColor:xe,boxShadow:"0 0 0 1px ".concat(xe)},_hover:{borderColor:xe}}),N&&(0,T.jsx)(J.t,{h:"36px",children:(0,T.jsx)(K.J,{size:"sm",onClick:()=>{var e;M(""),null===(e=$.current)||void 0===e||e.focus()}})})]}),("groups"!==A||Pe.length>0)&&!Ie&&!Se&&(0,T.jsxs)(p.s,{align:"center",gap:1,flexWrap:"wrap",py:1,px:1,children:["groups"!==A&&(0,T.jsx)(h.az,{as:"button",display:"flex",alignItems:"center",justifyContent:"center",w:"24px",h:"24px",borderRadius:"6px",bg:be,cursor:"pointer",transition:"all 0.2s ease",_hover:{bg:me},onClick:ke,flexShrink:0,mr:1,children:(0,T.jsx)(x.I,{as:j.l7J,w:"16px",h:"16px",color:ae})}),Pe.map(((e,t)=>(0,T.jsxs)(a.Fragment,{children:[t>0&&(0,T.jsx)(x.I,{as:j.xVu,w:"12px",h:"12px",color:ae,mx:"2px",flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"11px",fontWeight:"600",color:e.color,noOfLines:1,children:e.label})]},t)))]})]}),o&&l&&!Ie&&!Se&&(0,T.jsx)(h.az,{px:{base:3,md:4},pb:2,children:(0,T.jsxs)(p.s,{align:"center",bg:ue,borderRadius:"10px",px:3,py:2,border:"1px solid",borderColor:he,children:[(0,T.jsx)(x.I,{as:j.mU9,w:"16px",h:"16px",color:ge,mr:2,flexShrink:0}),(0,T.jsx)(h.az,{flex:1,minW:0,children:(0,T.jsxs)(u.E,{fontSize:"12px",fontWeight:"600",color:ge,noOfLines:1,children:[(0,Q.xY)(o,i,C.t)," \u2192 ",(0,Q.hI)(l,c,C.t,o)]})}),(0,T.jsx)(h.az,{as:"button",fontSize:"11px",fontWeight:"500",color:ae,ml:2,cursor:"pointer",_hover:{color:"red.400"},onClick:Ee,flexShrink:0,children:(0,T.jsx)(x.I,{as:j.m6K,w:"14px",h:"14px"})})]})}),(0,T.jsx)(h.az,{px:{base:3,md:4},pb:{base:3,md:4},maxH:"380px",overflowY:"auto",css:{"&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.12)",borderRadius:"10px"}},children:Se?(0,T.jsx)(ne,{}):Ie?(0,T.jsx)(h.az,{children:q?(0,T.jsxs)(p.s,{justify:"center",align:"center",py:"30px",direction:"column",children:[(0,T.jsx)(y.y,{size:"sm",color:"purple.400",mb:"8px"}),(0,T.jsx)(u.E,{fontSize:"12px",color:ae,children:(0,C.t)("Chargement...")})]}):Le&&Le.length>0?(0,T.jsxs)(f.T,{align:"stretch",spacing:0,children:[(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:ae,mb:2,px:1,children:[Le.length," ",Le.length>1?(0,C.t)("r\xe9sultats"):(0,C.t)("r\xe9sultat")]}),Le.map(((e,t)=>(0,T.jsx)(ce,{item:e,isSelected:"subcategory"===e.type?l===e.subName:o===e.catName&&!l,onClick:()=>Ue(e)},"".concat(e.type,"-").concat(e.catId,"-").concat(e.subName||t)))
1)]}):(0,T.jsxs)(p.s,{direction:"column",align:"center",justify:"center",py:"30px",children:[(0,T.jsx)(x.I,{as:j.gZ7,w:"28px",h:"28px",color:ae,mb:"8px",opacity:.4}),(0,T.jsxs)(u.E,{fontSize:"12px",fontWeight:"500",color:ae,textAlign:"center",children:[(0,C.t)("Aucun r\xe9sultat pour"),' "',N,'"']})]})}):"groups"===A?(0,T.jsx)(h.az,{display:"grid",gridTemplateColumns:{base:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(4, 1fr)"},gap:"10px",children:ve.map((e=>(0,T.jsx)(ie,{group:e,isSelected:k&&k.id===e.id,onClick:()=>we(e),language:w},e.id)))}):"categories"===A&&k?(0,T.jsx)(f.T,{align:"stretch",spacing:1,children:k.categories.map((e=>(0,T.jsx)(se,{cat:e,groupColor:k.color,groupColorLight:k.colorLight,isSelected:o===e.name,onClick:()=>Ce(e)},e._id)))}):"subcategories"===A&&P?(0,T.jsx)(h.az,{children:O?(0,T.jsx)(p.s,{justify:"center",py:"24px",children:(0,T.jsx)(y.y,{size:"sm",color:k?k.color:"purple.400"})}):_.length>0?(0,T.jsx)(f.T,{align:"stretch",spacing:1,children:_.map((e=>(0,T.jsx)(le,{sub:e,groupColor:k?k.color:"purple.500",groupColorLight:k?k.colorLight:"purple.50",isSelected:l===e.name,onClick:()=>Ae(e),parentCategoryName:P.name},e._id)))}):(0,T.jsx)(p.s,{direction:"column",align:"center",justify:"center",py:"20px",children:(0,T.jsx)(u.E,{fontSize:"12px",color:ae,children:(0,C.t)("Aucune sous-cat\xe9gorie")})})}):null})]})};var pe=r(33281),xe=r(39941),ue=r(82508),he=r(3369),ge=r(77911),be=r(92070),me=r(67743),fe=r(91262),ye=r(22728),je=r(1009),Se=r(94719),ve=r(12733),ze=r(72515);const we=e=>{let{options:t=[],value:r,onChange:o,placeholder:n,onSelect:i,displayKey:s="label",valueKey:l="name",searchKey:c="label"}=e;const[g,b]=(0,a.useState)(!1),[m,y]=(0,a.useState)(""),[j,S]=(0,a.useState)(t),v=(0,a.useRef)(null),z=(0,a.useRef)(null),w=(0,d.dU)("gray.800","gray.100"),A=(0,d.dU)("gray.50","gray.700"),U=(0,d.dU)("gray.800","gray.100"),k=(0,d.dU)("gray.500","gray.300"),I=(0,d.dU)("gray.200","gray.500"),P=(0,d.dU)("brand.500","purple.300"),R=(0,d.dU)("white","gray.700"),_=(0,d.dU)("gray.600","gray.300"),W=(0,d.dU)("gray.50","gray.600"),O=(0,d.dU)("gray.600","gray.300");(0,a.useEffect)((()=>{if(""===m.trim())S(t);else{const e=t.filter((e=>{var t;return null===(t=e[c])||void 0===t?void 0:t.toLowerCase().includes(m.toLowerCase())}));S(e)}}),[m,t,c]),(0,a.useEffect)((()=>{g&&z.current&&setTimeout((()=>{var e;null===(e=z.current)||void 0===e||e.focus()}),100)}),[g]),(0,a.useEffect)((()=>{const e=e=>{v.current&&!v.current.contains(e.target)&&(b(!1),y(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]);return(0,T.jsxs)(h.az,{position:"relative",ref:v,w:"100%",zIndex:g?1:0,children:[(0,T.jsxs)(Z.M,{children:[(0,T.jsx)(L.p,{placeholder:n,value:(()=>{if(!r)return"";const e=t.find((e=>e[l]===r));return e?e[s]:r})(),readOnly:!0,cursor:"pointer",onClick:()=>b(!g),bg:A,color:U,_placeholder:{color:k,fontSize:"sm"},borderRadius:"md",border:"1px solid",borderColor:g?P:I,_hover:{borderColor:P},_focus:{borderColor:P,boxShadow:"0 0 0 1px ".concat(P)},size:"lg",variant:"auth",fontSize:"sm"}),(0,T.jsx)(J.t,{height:"48px",children:(0,T.jsx)(x.I,{as:je.fK4,color:_,transform:g?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"})})]}),g&&(0,T.jsxs)(h.az,{position:"absolute",top:"100%",left:0,right:0,mt:1,zIndex:1,bg:R,borderRadius:"md",boxShadow:"lg",border:"1px solid",borderColor:I,maxH:"300px",overflow:"hidden",children:[(0,T.jsx)(h.az,{p:3,borderBottom:"1px solid",borderColor:I,children:(0,T.jsxs)(Z.M,{size:"sm",children:[(0,T.jsx)(J.W,{pointerEvents:"none",height:"32px",children:(0,T.jsx)(ve.W,{color:_,boxSize:3})}),(0,T.jsx)(L.p,{ref:z,placeholder:(0,C.t)("Rechercher..."),value:m,onChange:e=>y(e.target.value),bg:A,color:U,_placeholder:{color:k},borderRadius:"md",border:"1px solid",borderColor:I,_focus:{borderColor:P,boxShadow:"none"},height:"32px",pl:8,autoComplete:"off"}),m&&(0,T.jsx)(J.t,{height:"32px",children:(0,T.jsx)(K.J,{size:"sm",onClick:e=>{var t;e.stopPropagation(),y(""),null===(t=z.current)||void 0===t||t.focus()}})})]})}),(0,T.jsx)(h.az,{maxH:"240px",overflowY:"auto",p:2,children:0===j.length?(0,T.jsxs)(p.s,{direction:"column",align:"center",justify:"center",p:6,children:[(0,T.jsx)(x.I,{as:je.CKj,boxSize:6,color:O,mb:2}),(0,T.jsx)(u.E,{fontSize:"sm",color:O,textAlign:"center",children:0===t.length?(0,C.t)("Aucune option disponible"):(0,C.t)("Aucun r\xe9sultat trouv\xe9")})]}):(0,T.jsx)(f.T,{align:"stretch",spacing:1,children:j.map(((e,t)=>(0,T.jsx)(h.az,{p:3,borderRadius:"md",cursor:"pointer",transition:"all 0.2s",bg:r===e[l]?W:"transparent",_hover:{bg:W},onClick:()=>(e=>{const t=e[l];o(t),i&&i(e),b(!1),y("")})(e),children:(0,T.jsxs)(E.z,{justify:"space-between",children:[(0,T.jsx)(u.E,{fontSize:"sm",color:w,children:e[s]}),r===e[l]&&(0,T.jsx)(x.I,{as:ze.S,color:P,boxSize:3})]})},e._id||e.id||t)))})})]})]})},Ce=e=>
1{let{isSelected:t,label:r,description:o,color:n,icon:a,onClick:i}=e;const s=(0,d.dU)("white","navy.800"),l=(0,d.dU)("gray.200","whiteAlpha.200"),c=(0,d.dU)("gray.700","white"),g=(0,d.dU)("gray.500","gray.400"),b=(0,d.dU)("gray.100","whiteAlpha.100"),m=(0,d.dU)("gray.400","gray.500"),f=(0,d.dU)("".concat(n,".50"),"".concat(n,".900")),y=(0,d.dU)("".concat(n,".100"),"".concat(n,".800")),S=(0,d.dU)("".concat(n,".700"),"".concat(n,".200")),v=(0,d.dU)("".concat(n,".600"),"".concat(n,".300")),z=(0,d.dU)("".concat(n,".500"),"".concat(n,".300"));return(0,T.jsx)(h.az,{flex:1,minW:0,p:{base:3,md:4},borderRadius:"14px",border:"1.5px solid",borderColor:t?"".concat(n,".400"):l,bg:t?f:s,cursor:"pointer",transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)",onClick:i,_hover:{borderColor:"".concat(n,".300"),transform:"translateY(-1px)",boxShadow:"md"},position:"relative",overflow:"hidden",children:(0,T.jsxs)(p.s,{direction:"row",align:"center",justify:"space-between",textAlign:"left",gap:0,children:[(0,T.jsxs)(E.z,{spacing:{base:0,md:3},direction:{base:"column",md:"row"},flexWrap:"wrap",justify:"center",children:[(0,T.jsx)(h.az,{w:"40px",h:"40px",borderRadius:"12px",bg:t?y:b,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s",mb:{base:1,md:0},children:(0,T.jsx)(x.I,{as:a,boxSize:5,color:t?"".concat(n,".500"):m})}),(0,T.jsxs)(h.az,{children:[(0,T.jsx)(u.E,{fontWeight:"700",fontSize:"sm",color:t?S:c,children:r}),(0,T.jsx)(u.E,{fontSize:"xs",color:t?v:g,display:{base:"none",sm:"block"},children:o})]})]}),t&&(0,T.jsx)(x.I,{as:j.mU9,boxSize:5,color:z,flexShrink:0,display:{base:"none",sm:"block"}})]})})},Ae=e=>{let{field:t,currentValue:r,options:o,onChange:n}=e;const[i,s]=(0,a.useState)(!1),l=(0,a.useRef)(null),c=(0,d.dU)("white","navy.700"),p=(0,d.dU)("gray.800","gray.100"),g=(0,d.dU)("gray.400","gray.500"),b=(0,d.dU)("gray.200","whiteAlpha.200"),m=(0,d.dU)("brand.500","purple.300"),y=(0,d.dU)("white","navy.700"),j=(0,d.dU)("gray.400","gray.500"),S=(0,d.dU)("gray.50","navy.600"),v=Array.isArray(r)?r:[];return(0,a.useEffect)((()=>{const e=e=>{l.current&&!l.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)}),[]),(0,T.jsxs)(h.az,{position:"relative",ref:l,children:[(0,T.jsxs)(Z.M,{children:[(0,T.jsx)(L.p,{placeholder:(0,C.t)("Select options"),value:v.map((e=>(0,Se.pv)(e,C.t))).join(", ")||"",readOnly:!0,cursor:"pointer",onClick:()=>s(!i),bg:c,color:p,_placeholder:{color:g,fontSize:"13px"},borderRadius:"10px",border:"1.5px solid",borderColor:i?m:b,_hover:{borderColor:m},_focus:{borderColor:m,boxShadow:"none"},h:"42px",fontSize:"13px",fontWeight:"500"}),(0,T.jsx)(J.t,{h:"42px",children:(0,T.jsx)(x.I,{as:je.fK4,color:j,transform:i?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",boxSize:"16px"})})]}),i&&(0,T.jsx)(h.az,{position:"absolute",top:"100%",left:0,right:0,mt:"4px",zIndex:10,bg:y,borderRadius:"12px",boxShadow:"0 8px 30px rgba(0,0,0,0.12)",border:"1px solid",borderColor:b,maxH:"240px",overflowY:"auto",p:"6px",css:{"&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.12)",borderRadius:"10px"}},children:(0,T.jsx)(pe.$,{colorScheme:"purple",value:v,onChange:n,children:(0,T.jsx)(f.T,{align:"stretch",spacing:"2px",children:o.map((e=>(0,T.jsx)(h.az,{py:"6px",px:"10px",borderRadius:"8px",_hover:{bg:S},transition:"all 0.15s",children:(0,T.jsx)(xe.S,{value:e,size:"sm",children:(0,T.jsx)(u.E,{fontSize:"13px",color:p,children:(0,Se.pv)(e,C.t)})})},e)))})})})]})},Ue=e=>{let{options:t,currentValue:r,onChange:o,accentColor:n,accentLight:a}=e;const i=(0,d.dU)("gray.700","white"),s=(0,d.dU)("gray.200","whiteAlpha.200");return(0,T.jsx)(ue.B,{spacing:2,children:t.map((e=>{const t=r===e;return(0,T.jsx)(ue.Q,{children:(0,T.jsx)(h.az,{px:3,py:"6px",borderRadius:"full",border:"1.5px solid",borderColor:t?n:s,bg:t?a:"transparent",cursor:"pointer",transition:"all 0.2s",_hover:{borderColor:n,bg:a},onClick:()=>o(e),children:(0,T.jsxs)(E.z,{spacing:1.5,children:[t&&(0,T.jsx)(x.I,{as:j.mU9,boxSize:"12px",color:n}),(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:t?"600":"400",color:t?n:i,children:(0,Se.pv)(e,C.t)}
1)]})})},e)}))})},ke=e=>{let{title:t,accentColor:r}=e;const o=(0,d.dU)("gray.700","white");return(0,T.jsxs)(p.s,{mb:3,align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:r||"brand.500"}),(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:o,children:t})]})},Ee=e=>{var t,r;let{field:n,currentValue:a,onTextChange:i,onRadioChange:s,onSelectChange:l,onMultiChange:c,onNumberChange:p,accentColor:x,accentLight:u}=e;const g=(0,d.dU)("gray.700","white"),b=(0,d.dU)("white","navy.700"),m=(0,d.dU)("gray.200","whiteAlpha.200"),f=(0,d.dU)("brand.500","purple.300"),y=(0,d.dU)("gray.400","gray.500"),j={bg:b,color:g,_placeholder:{color:y,fontSize:"13px"},borderRadius:"10px",border:"1.5px solid",borderColor:m,_hover:{borderColor:f},_focus:{borderColor:f,boxShadow:"none"},h:"42px",fontSize:"13px",fontWeight:"500"};return(0,T.jsxs)(h.az,{children:[(0,T.jsx)(he.l,{fontSize:"12px",fontWeight:"600",color:g,mb:"6px",children:(0,Se.Az)(n.name,C.t)}),"text"===n.type&&(0,T.jsx)(L.p,(0,o.A)({name:n.name,placeholder:(0,C.t)("Enter text"),value:a||"",onChange:i},j)),"textarea"===n.type&&(0,T.jsx)(ge.T,{name:n.name,placeholder:(0,C.t)("Enter text"),value:a||"",onChange:i,bg:b,color:g,_placeholder:{color:y,fontSize:"13px"},borderRadius:"10px",border:"1.5px solid",borderColor:m,_hover:{borderColor:f},_focus:{borderColor:f,boxShadow:"none"},fontSize:"13px",minH:"80px"}),"radio"===n.type&&(0,T.jsx)(Ue,{options:n.options||[],currentValue:a||"",onChange:s,accentColor:x,accentLight:u}),"select"===n.type&&(0,T.jsx)(we,{options:(n.options||[]).map((e=>({value:e,label:(0,Se.pv)(e,C.t),name:e}))),value:a||"",placeholder:0===(null!==(t=null===(r=n.options)||void 0===r?void 0:r.length)&&void 0!==t?t:0)?(0,C.t)("No model available"):(0,C.t)("Select option"),displayKey:"label",valueKey:"value",searchKey:"label",onSelect:l,onChange:()=>{}}),"multi"===n.type&&(0,T.jsx)(Ae,{field:n,currentValue:a,options:n.options||[],onChange:c}),"number"===n.type&&(0,T.jsx)(L.p,(0,o.A)({name:n.name,type:"number",placeholder:(0,C.t)("Entrer la valeur"),value:a||"",onChange:p},j))]})},Le=e=>{let{selectedCategoryLabel:t,selectedType:r,onTypeChange:o,typeRef:n,typeError:i,selectedSubcategory:s,selectedCategory:l,tableFields:c,tableFieldsCat:x,tableSubFieldsByFieldId:g,fieldsValues:b,subFieldsValues:m,onFieldsChange:f,onSubFieldsChange:y}=e;const j=(0,d.dU)("white","navy.800"),S=(0,d.dU)("gray.200","whiteAlpha.200"),v=(0,d.dU)("gray.100","whiteAlpha.100"),z=(0,d.dU)("brand.500","purple.300"),w=(0,d.dU)("purple.50","purple.900"),A=(0,d.dU)("purple.200","purple.700"),U=!("Demande d'emploi et stages"===t||"Offres d'emploi et stages"===t)&&(l||t),k=s&&c&&c.length>0,E=l&&x&&x.length>0,L=e=>{const t=b.find((t=>t.field_id===e));return t?t.value:void 0},I=e=>{const t=m.find((t=>t.field_id===e));return t?t.value:void 0},P=(e,t,r)=>{f(e._id,t,r)},R=(e,t,r,o)=>{switch(r){case"text":case"multi":f(e._id,e.type,o);break;case"textarea":case"select":y(e._id,e.type,o);break;case"radio":y(e._id,e.type,{target:{value:o,name:e.name}});break;case"number":f(t._id,t.type,o);break;default:f(e._id,r,o)}};return U||k||E?(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1px solid",borderColor:S,overflow:"visible",bg:j,boxShadow:"sm",children:[U&&(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,ref:n,children:[(0,T.jsx)(ke,{title:(0,C.t)("Choisissez le type de votre annonce"),accentColor:z}),(0,T.jsxs)(p.s,{gap:3,direction:{base:"column",md:"row"},mb:1,children:[(0,T.jsx)(Ce,{isSelected:"offre"===r,label:(0,C.t)("Offre"),description:(0,C.t)("Je vends ou propose"),color:"blue",icon:fe.L,onClick:()=>o("offre")}),(0,T.jsx)(Ce,{isSelected:"demande"===r,label:(0,C.t)("Demande"),description:(0,C.t)("Je recherche"),color:"blue",icon:ye.k,onClick:()=>o("demande")})]}),i&&(0,T.jsx)(u.E,{color:"red.500",fontSize:"xs",mt:1,children:i})]}),U&&(k||E)&&(0,T.jsx)(h.az,{px:{base:3,md:4},children:(0,T.jsx)(be.c,{borderColor:v})}),k&&(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:3,pb:2,children:[(0,T.jsx)(ke,{title:(0,C.t)("D\xe9tails sp\xe9cifiques"),accentColor:z}),(0,T.jsx)(me.r,{columns:{base:1,md:2},gap:4,children:c.map((e=>(0,T.jsxs)(a.Fragment,{children:[(0,T.jsx)(Ee,{field:e,currentValue:L(e._id
1),accentColor:z,accentLight:w,onTextChange:t=>P(e,e.type,t),onRadioChange:t=>P(e,"radio",t),onSelectChange:t=>P(e,e.type,{target:{value:t.value,name:e.name}}),onMultiChange:t=>P(e,"multi",t),onNumberChange:t=>P(e,e.type,t)}),(g[e._id]||[]).map((t=>(0,T.jsx)(h.az,{pl:2,borderLeft:"2px solid",borderColor:A,children:(0,T.jsx)(Ee,{field:t,currentValue:I(t._id),accentColor:z,accentLight:w,onTextChange:r=>R(t,e,"text",r),onRadioChange:r=>R(t,e,"radio",r),onSelectChange:r=>R(t,e,"select",{target:{value:r.value,name:t.name}}),onMultiChange:r=>R(t,e,"multi",r),onNumberChange:r=>R(t,e,"number",r)})},t._id)))]},e._id)))})]}),k&&E&&(0,T.jsx)(h.az,{px:{base:3,md:4},children:(0,T.jsx)(be.c,{borderColor:v})}),E&&(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:3,pb:{base:3,md:4},children:[(0,T.jsx)(ke,{title:(0,C.t)("Informations compl\xe9mentaires"),accentColor:z}),(0,T.jsx)(me.r,{columns:{base:1,md:2},gap:4,children:x.map((e=>(0,T.jsx)(Ee,{field:e,currentValue:L(e._id),accentColor:z,accentLight:w,onTextChange:t=>P(e,e.type,t),onRadioChange:t=>P(e,"radio",t),onSelectChange:t=>P(e,e.type,{target:{value:t.value,name:e.name}}),onMultiChange:t=>P(e,"multi",t),onNumberChange:t=>P(e,e.type,t)},e._id)))})]}),!k&&!E&&U&&(0,T.jsx)(h.az,{pb:2})]}):null};var Ie=r(93139),Pe=r(99852),Re=r(42531);const _e=e=>{let{isAnimating:t,children:r,borderRadius:o="10px"}=e;return t?(0,T.jsxs)(h.az,{position:"relative",p:"2px",children:[(0,T.jsx)(h.az,{position:"absolute",inset:"0",borderRadius:o,bgGradient:"linear(135deg, brand.500, purple.400, purple.300, brand.500)",backgroundSize:"300% 300%",sx:{animation:"borderSpin 2s ease infinite","@keyframes borderSpin":{"0%":{backgroundPosition:"0% 50%"},"50%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0% 50%"}}}}),(0,T.jsx)(h.az,{position:"absolute",inset:"0",borderRadius:o,bgGradient:"linear(135deg, brand.500, purple.400, purple.300, brand.500)",backgroundSize:"300% 300%",filter:"blur(6px)",opacity:.35,sx:{animation:"borderSpin 2s ease infinite","@keyframes borderSpin":{"0%":{backgroundPosition:"0% 50%"},"50%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0% 50%"}}}}),(0,T.jsx)(h.az,{position:"relative",borderRadius:o,overflow:"hidden",children:r})]}):r},We=e=>{var t;let{ad:r,onNameChange:o,onPriceChange:n,onPriceFocus:a,onPriceBlur:i,onPaste:s,nameError:l,priceError:c,sanitizedHintName:g,isImprovingTitle:b,onAIStart:m,onAIImprove:f,onAIError:y,nameRef:S,formatPrice:v}=e;const z=(0,d.dU)("white","navy.800"),w=(0,d.dU)("gray.200","whiteAlpha.200"),A=(0,d.dU)("brand.500","purple.300"),U=(0,d.dU)("gray.700","white"),k=(0,d.dU)("gray.500","gray.400"),I=(0,d.dU)("white","navy.700"),P=(0,d.dU)("gray.200","whiteAlpha.200"),R=(0,d.dU)("brand.500","purple.300"),_=(0,d.dU)("gray.400","gray.500"),W=((0,d.dU)("purple.50","whiteAlpha.50"),(0,d.dU)("purple.100","whiteAlpha.100"),(0,d.dU)("purple.600","purple.300"),(0,d.dU)("gray.100","whiteAlpha.100")),O=(0,d.dU)("orange.500","orange.300"),D=(0,d.dU)("red.500","red.400"),N=(0,d.dU)("gray.50","whiteAlpha.50"),M=(0,d.dU)("gray.200","whiteAlpha.100"),F=(0,d.dU)("purple.600","purple.300"),B=((0,d.dU)("gray.50","whiteAlpha.50"),(null===(t=r.name)||void 0===t?void 0:t.length)||0),q=B>50;return(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1px solid",borderColor:w,overflow:"visible",bg:z,boxShadow:"sm",children:[(0,T.jsx)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,children:(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:2,children:[(0,T.jsxs)(p.s,{align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:A}),(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:U,children:(0,C.t)("Titre & Prix de l'annonce")})]}),(0,T.jsx)(E.z,{spacing:2,children:B>0&&!q&&(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:"green.50",border:"1px solid",borderColor:"green.200",children:(0,T.jsxs)(E.z,{spacing:1,children:[(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:"green.500"}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"600",color:"green.600",children:(0,C.t)("Titre renseign\xe9")})]})})})]})}),(0,T.jsx)(h.az,{px:{base:3,md:4},pb:{base:3,md:4},children:(0,T.jsxs)(p.s,{direction:{base:"column",md:"row"},gap:3,children:[(0,T.jsx)(h.az,{flex:{md:3},ref:S,children:(0,T.jsxs)(Ie.MJ,{isInvalid:!!l,children:[(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:"
16px",children:[(0,T.jsxs)(E.z,{spacing:1,children:[(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"600",color:U,children:(0,C.t)("Nom de l'annonce")}),(0,T.jsx)(u.E,{fontSize:"12px",color:D,children:"*"})]}),(0,T.jsx)(h.az,{px:"6px",py:"1px",borderRadius:"full",bg:q?"red.50":W,border:"1px solid",borderColor:q?"red.200":w,children:(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:q?D:k,children:[B,"/50"]})})]}),(0,T.jsx)(_e,{isAnimating:b,children:(0,T.jsxs)(Z.M,{children:[(0,T.jsx)(L.p,{id:"name",name:"name",type:"text",placeholder:(0,C.t)("Entrez le nom de l'annonce"),value:r.name,maxLength:50,onChange:o,onPaste:s,isDisabled:b,bg:I,color:U,_placeholder:{color:_,fontSize:"13px"},borderRadius:"10px",border:"1.5px solid",borderColor:l?D:b?"transparent":P,_hover:{borderColor:b?"transparent":R},_focus:{borderColor:l?D:R,boxShadow:l?"0 0 0 1px ".concat(D):"none"},_disabled:{opacity:.85,cursor:"not-allowed"},h:"42px",fontSize:"13px",fontWeight:"500",pr:"44px"}),(0,T.jsx)(J.t,{h:"42px",w:"40px",children:(0,T.jsx)(Re.A,{text:r.name,type:"title",onStart:m,onImprove:f,onError:y,isDisabled:b||!r.name||!r.name.trim()})})]})}),g&&(0,T.jsxs)(p.s,{align:"center",gap:1,mt:"4px",children:[(0,T.jsx)(h.az,{w:"4px",h:"4px",borderRadius:"full",bg:O}),(0,T.jsx)(u.E,{fontSize:"10px",color:O,fontWeight:"500",children:(0,C.t)("Certaines informations de contact ou liens ont \xe9t\xe9 supprim\xe9s.")})]}),(0,T.jsx)(Pe.Wt,{fontSize:"11px",mt:"4px",children:l})]})}),(0,T.jsx)(h.az,{flex:{md:2},children:(0,T.jsxs)(Ie.MJ,{isInvalid:!!c,children:[(0,T.jsx)(p.s,{align:"center",justify:"space-between",mb:"6px",children:(0,T.jsx)(E.z,{spacing:1,children:(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"600",color:U,children:(0,C.t)("priceInMAD")})})}),(0,T.jsxs)(Z.M,{children:[(0,T.jsx)(L.p,{name:"price",placeholder:(0,C.t)("Entrez le prix en MAD"),value:void 0!==r.priceDisplay?r.priceDisplay:r.price,onChange:n,onFocus:a,onBlur:i,bg:I,color:U,_placeholder:{color:_,fontSize:"13px"},borderRadius:"10px",border:"1.5px solid",borderColor:c?D:P,_hover:{borderColor:R},_focus:{borderColor:c?D:R,boxShadow:c?"0 0 0 1px ".concat(D):"none"},h:"42px",fontSize:"13px",fontWeight:"500",pr:"60px"}),(0,T.jsx)(J.t,{h:"42px",w:"52px",pr:"6px",children:(0,T.jsx)(p.s,{align:"center",justify:"center",h:"28px",px:"8px",borderRadius:"6px",bg:N,border:"1px solid",borderColor:M,children:(0,T.jsx)(u.E,{fontSize:"11px",fontWeight:"700",color:F,children:"MAD"})})})]}),c&&(0,T.jsx)(u.E,{fontSize:"11px",color:D,mt:"4px",children:c})]})})]})})]})},Oe=e=>{let{isAnimating:t,children:r,borderRadius:o="10px"}=e;return t?(0,T.jsxs)(h.az,{position:"relative",p:"2px",children:[(0,T.jsx)(h.az,{position:"absolute",inset:"0",borderRadius:o,bgGradient:"linear(135deg, brand.500, purple.400, purple.300, brand.500)",backgroundSize:"300% 300%",sx:{animation:"borderSpinDesc 2s ease infinite","@keyframes borderSpinDesc":{"0%":{backgroundPosition:"0% 50%"},"50%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0% 50%"}}}}),(0,T.jsx)(h.az,{position:"absolute",inset:"0",borderRadius:o,bgGradient:"linear(135deg, brand.500, purple.400, purple.300, brand.500)",backgroundSize:"300% 300%",filter:"blur(6px)",opacity:.35,sx:{animation:"borderSpinDesc 2s ease infinite","@keyframes borderSpinDesc":{"0%":{backgroundPosition:"0% 50%"},"50%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0% 50%"}}}}),(0,T.jsx)(h.az,{position:"relative",borderRadius:o,overflow:"hidden",children:r})]}):r},De=e=>{var t;let{ad:r,onDescriptionChange:o,onPaste:n,descriptionError:a,sanitizedHintDescription:i,isImprovingDescription:s,onAIStart:l,onAIImprove:c,onAIError:g,descriptionRef:b}=e;const m=(0,d.dU)("white","navy.800"),f=(0,d.dU)("gray.200","whiteAlpha.200"),y=(0,d.dU)("brand.500","purple.300"),S=(0,d.dU)("gray.700","white"),v=(0,d.dU)("gray.500","gray.400"),z=(0,d.dU)("white","navy.700"),w=(0,d.dU)("gray.200","whiteAlpha.200"),A=(0,d.dU)("brand.500","purple.300"),U=(0,d.dU)("gray.400","gray.500"),k=((0,d.dU)("purple.50","whiteAlpha.50"),(0,d.dU)("purple.100","whiteAlpha.100"),(0,d.dU)("purple.600","purple.300"),(0,d.dU)("gray.100","whiteAlpha.100")),L=(0,d.dU)("orange.500","orange.300"),I=(0,d.dU)("red.500","red.400"),P=(null===(t=r.description)||void 0===t?void 0:t.length)||0,R=P>500,_=P>=10&&P<=500,W=0===P?null:P<10?{icon:j.Wux,text:(0,C.t)("Minimum 10 caract\xe8res requis"),
1color:L}:_?{icon:j.mU9,text:(0,C.t)("Bonne description"),color:"green.500"}:R?{icon:j.Wux,text:(0,C.t)("Limite de 500 caract\xe8res d\xe9pass\xe9e"),color:I}:null;return(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1px solid",borderColor:f,overflow:"visible",bg:m,boxShadow:"sm",children:[(0,T.jsx)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,children:(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:2,children:[(0,T.jsxs)(p.s,{align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:y}),(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:S,children:(0,C.t)("Description de l'annonce")})]}),(0,T.jsx)(E.z,{spacing:2,children:(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:_?"green.50":R?"red.50":k,border:"1px solid",borderColor:_?"green.200":R?"red.200":f,children:(0,T.jsxs)(E.z,{spacing:1,children:[_&&(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:"green.500"}),(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:_?"green.600":R?I:v,children:[P,"/500"]})]})})})]})}),(0,T.jsx)(h.az,{px:{base:3,md:4},pb:{base:3,md:4},children:(0,T.jsxs)(Ie.MJ,{isInvalid:!!a,ref:b,children:[(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:"6px",children:[(0,T.jsxs)(E.z,{spacing:1,children:[(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"600",color:S,children:(0,C.t)("adDescription")}),(0,T.jsx)(u.E,{fontSize:"12px",color:I,children:"*"})]}),W&&(0,T.jsxs)(E.z,{spacing:1,children:[(0,T.jsx)(x.I,{as:W.icon,boxSize:"12px",color:W.color}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"500",color:W.color,children:W.text})]})]}),(0,T.jsx)(Oe,{isAnimating:s,children:(0,T.jsxs)(h.az,{position:"relative",children:[(0,T.jsx)(ge.T,{id:"description",name:"description",placeholder:(0,C.t)("enterAdDescription"),value:r.description,onChange:o,onPaste:n,isDisabled:s,bg:z,color:S,_placeholder:{color:U,fontSize:"13px"},borderRadius:"10px",border:"1.5px solid",borderColor:a?I:s?"transparent":w,_hover:{borderColor:s?"transparent":A},_focus:{borderColor:a?I:A,boxShadow:a?"0 0 0 1px ".concat(I):"none"},_disabled:{opacity:.85,cursor:"not-allowed"},fontSize:"13px",fontWeight:"400",lineHeight:"1.6",minH:"130px",resize:"vertical",pr:"44px",pb:"30px"}),(0,T.jsx)(h.az,{position:"absolute",top:"8px",right:"8px",zIndex:2,children:(0,T.jsx)(Re.A,{text:r.description,type:"description",onStart:l,onImprove:c,onError:g,isDisabled:s||!r.description||!r.description.trim()})})]})}),i&&(0,T.jsxs)(p.s,{align:"center",gap:1,mt:"4px",children:[(0,T.jsx)(h.az,{w:"4px",h:"4px",borderRadius:"full",bg:L}),(0,T.jsx)(u.E,{fontSize:"10px",color:L,fontWeight:"500",children:(0,C.t)("Certaines informations de contact ou liens ont \xe9t\xe9 supprim\xe9s.")})]}),(0,T.jsx)(Pe.Wt,{fontSize:"11px",mt:"4px",children:a})]})})]})};var Ne=r(79523),Me=r(99287),Te=r(1606);const Fe=e=>{let{isActive:t,title:r,description:o,icon:n,accentColor:a,accentLight:i,accentDark:s,onToggle:l}=e;(0,d.dU)("white","navy.800");const c=(0,d.dU)("gray.200","whiteAlpha.200"),g=(0,d.dU)("gray.700","white"),b=(0,d.dU)("gray.500","gray.400"),m=(0,d.dU)("gray.100","whiteAlpha.100"),f=(0,d.dU)("gray.400","gray.500"),y=(0,d.dU)(i,"".concat(s)),S=(0,d.dU)("".concat(a,".300"),"".concat(a,".600")),v=(0,d.dU)("".concat(a,".100"),"".concat(a,".800")),z=(0,d.dU)("".concat(a,".600"),"".concat(a,".300")),w=(0,d.dU)("".concat(a,".700"),"".concat(a,".200")),A=(0,d.dU)("".concat(a,".600"),"".concat(a,".300")),U=(0,d.dU)("".concat(a,".50"),"whiteAlpha.200"),k=(0,d.dU)("".concat(a,".200"),"whiteAlpha.200"),L=(0,d.dU)("".concat(a,".700"),"".concat(a,".200")),I=(0,d.dU)("0 4px 16px rgba(0,0,0,0.06)","0 4px 16px rgba(0,0,0,0.3)");return(0,T.jsxs)(p.s,{justify:"space-between",align:"center",py:"10px",px:"12px",borderRadius:"12px",border:"1.5px solid",borderColor:t?S:c,bg:t?y:"transparent",transition:"all 0.2s ease",_hover:{transform:"translateY(-1px)",boxShadow:I},cursor:"pointer",onClick:l,gap:3,children:[(0,T.jsxs)(E.z,{spacing:3,flex:"1",minW:0,children:[(0,T.jsx)(h.az,{w:"38px",h:"38px",borderRadius:"10px",bg:t?v:m,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s",children:(0,T.jsx)(x.I,{as:n,weight:"fill",boxSize:"18px",color:t?z:f})}),(0,T.jsxs)(h.az,{minW:0,flex:1,children:[(0,T.jsxs)(E.z,{spacing:2,mb:"1px",flexWrap:"wrap",children:[(0,T.jsx)(u.E,{fontSize:"13px",fontWeight:"700",color:t?w:g,noOfLines:1,children:r}),t&&(0,T.jsxs)(E.z,{spacing:1,px:"6px",py:"1px",borderRadius:"full",bg:U,border:"1px solid",borderColor:k,children:[(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:L}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"700",color:L,children:(0,C.t)("Active")}
1)]})]}),(0,T.jsx)(u.E,{fontSize:"11px",color:t?A:b,noOfLines:1,children:o})]})]}),(0,T.jsx)(Ne.d,{size:"md",colorScheme:a,isChecked:t,onChange:e=>{e.stopPropagation(),l()},onClick:e=>e.stopPropagation()})]})},Be=e=>{let{contactOptions:t,onToggle:r}=e;const o=(0,d.dU)("white","navy.800"),n=(0,d.dU)("gray.200","whiteAlpha.200"),a=(0,d.dU)("brand.500","purple.300"),i=(0,d.dU)("gray.700","white"),s=(0,d.dU)("gray.500","gray.400"),l=(0,d.dU)("gray.100","whiteAlpha.100"),c=[null===t||void 0===t?void 0:t.whatsapp,null===t||void 0===t?void 0:t.call].filter(Boolean).length;return(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1px solid",borderColor:n,overflow:"visible",bg:o,boxShadow:"sm",children:[(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,children:[(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:3,children:[(0,T.jsxs)(p.s,{align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:a}),(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:i,children:(0,C.t)("Contact Options")})]}),(0,T.jsx)(E.z,{spacing:2,children:(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:l,border:"1px solid",borderColor:n,children:(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:s,children:[c,"/2 ",(0,C.t)("active")]})})})]}),(0,T.jsx)(u.E,{fontSize:"11px",color:s,mb:3,children:(0,C.t)("Choose how people reach you")})]}),(0,T.jsx)(h.az,{px:{base:3,md:4},pb:{base:3,md:4},children:(0,T.jsxs)(f.T,{spacing:2,align:"stretch",children:[(0,T.jsx)(Fe,{isActive:!(null===t||void 0===t||!t.whatsapp),title:"WhatsApp",description:(0,C.t)("Allow users to contact you via WhatsApp"),icon:Me.A,accentColor:"green",accentLight:"green.50",accentDark:"whiteAlpha.100",onToggle:()=>r("whatsapp")}),(0,T.jsx)(Fe,{isActive:!(null===t||void 0===t||!t.call),title:(0,C.t)("Phone Call"),description:(0,C.t)("Allow users to call you directly"),icon:Te.A,accentColor:"purple",accentLight:"purple.50",accentDark:"whiteAlpha.100",onToggle:()=>r("call")})]})})]})};var qe=r(9896),He=r(99419),Ve=r(12023),Ye=r(76036),Ze=r(80228),Je=r.n(Ze),Ke=(r(66433),r(93950)),$e=r.n(Ke),Ge=r(10763);delete Je().Icon.Default.prototype._getIconUrl,Je().Icon.Default.mergeOptions({iconRetinaUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon-2x.png",iconUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-shadow.png"});const Qe=e=>e?e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[-_]/g," "):"";function Xe(e){let{onLocationSelect:t,initialLocation:r,isVisible:o}=e;const n=(0,qe.Po)({click(e){const{lat:r,lng:o}=e.latlng;t({latitude:r,longitude:o})}});return(0,a.useEffect)((()=>{if(r)try{n.setView([r.latitude,r.longitude],15)}catch(e){}}),[r,n]),(0,a.useEffect)((()=>{o&&setTimeout((()=>{try{n&&n.getContainer()&&n.invalidateSize()}catch(e){}}),300)}),[o,n]),null}function et(){const e=(0,qe.ko)();return(0,a.useEffect)((()=>{const t=()=>{try{e&&e.getContainer()&&e.invalidateSize()}catch(t){}},r=[setTimeout(t,200),setTimeout(t,500),setTimeout(t,1e3)];return()=>{r.forEach((e=>clearTimeout(e)))}}),[e]),null}const tt=a.memo((e=>{let{city:t,sectorCount:r,isSelected:o,accentColor:n,accentBg:a,onClick:i}=e;const s=(0,d.dU)("gray.700","white"),l=(0,d.dU)("gray.100","whiteAlpha.200");return(0,T.jsxs)(p.s,{align:"center",py:"10px",px:"12px",borderRadius:"10px",cursor:"pointer",transition:"all 0.2s ease",bg:o?a:"transparent",border:"1.5px solid",borderColor:o?n:"transparent",_hover:{bg:a},onClick:i,children:[(0,T.jsx)(x.I,{as:o?j.mU9:j.qod,w:"18px",h:"18px",color:n,mr:"10px",flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"13px",fontWeight:o?"700":"500",color:o?n:s,noOfLines:1,flex:1,children:t.name}),r>0&&(0,T.jsx)(Y.E,{fontSize:"9px",px:"6px",py:"1px",borderRadius:"full",bg:l,color:n,fontWeight:"600",ml:"6px",flexShrink:0,children:r}),(0,T.jsx)(x.I,{as:j.xVu,w:"16px",h:"16px",color:n,opacity:.5,ml:"4px",flexShrink:0})]})})),rt=a.memo((e=>{let{sector:t,isSelected:r,accentColor:o,accentBg:n,onClick:a}=e;const i=(0,d.dU)("gray.600","gray.300");return(0,T.jsxs)(p.s,{align:"center",py:"8px",px:"12px",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s ease",bg:r?n:"transparent",border:"1.5px solid",borderColor:r?o:"transparent",_hover:{bg:n},onClick:a,children:[(0,T.jsx)(x.I,{as:r?j.mU9:j.gwi,w:"15px",h:"15px",color:o,opacity:r?1:.7,mr:"10px",flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"12.5px",fontWeight:r?"600":"400",color:r?o:i,noOfLines:1,flex:1,children:t.name})]})})),ot=a.memo((e=>{let{item:t,isSelected:r,accentColor:o,accentBg:n,onClick:a}=e;const i=(0,d.dU)("gray.700","white"),s=(0,d.dU)("gray.400","gray.500");return(0,T.jsxs)(p.s,{align:"center",py:"8px",px:"12px",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s ease",bg:r?n:"transparent",border:"1.5px solid",borderColor:r?o:"transparent",_hover:{bg:n},onClick:a,mb:"2px",children:[(0,T.jsx)(x.I,{as:r?j.mU9:"sector"===t.type?j.gwi:j.qod,w:"16px",h:"16px",color:o,mr:"10px",flexShrink:0}),(0,T.jsxs)(h.az,{flex:1,minW:0,children:[(0,T.jsx)(u.E,{fontSize:"13px",fontWeight:r?"700":"500",color:r?o:i,noOfLines:1,children:t.name}),t.breadcrumb&&(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"400",color:s,noOfLines:1,mt:"1px",children:t.breadcrumb})]}),(0,T.jsx)(Y.E,{fontSize:"9px",px:"5px",py:"1px",borderRadius:"full",bg:"".concat(o,"18"),color:o,fontWeight:"600",ml:"8px",flexShrink:0,textTransform:"none",children:"sector"===t.type?(0,C.t)("Secteur"):(0,C.t)("Ville")})]})})),nt=e=>{let{selectedCity:t="",selectedSector:r="",onCitySelect:o,onSectorSelect:n,cityError:i,cityRef:l,locationValue:c=null,onLocationChange:g,defaultLocation:b=null,showDefaultOption:S=!1,defaultOptionLabel:v=null,onUseDefault:z=null,onLocationGeocode:w=null}=e;const[A,U]=(0,a.useState)("cities"),[k,I]=(0,a.useState)(null),[P,R]=(0,a.useState)(""),[_,W]=(0,a.useState)([]),[O,D]=(0,a.useState)([]),[N,M]=(0,a.useState)(!1),F=(0,a.useRef)(null),B=(0,a.useRef)(!1),[q,H]=(0,a.useState)(!!c),[V,Y]=(0,a.useState)(c||b),[$,G]=(0,a.useState)(!1),[Q,X]=(0,a.useState)(!1),[ee,te]=(0,a.useState)(0),[re,oe]=(0,a.useState)(!1),[ne,ae]=(0,a.useState)(""),[ie,se]=(0,a.useState)(""),le=(0,d.dU)("white","navy.800"),ce=(0,d.dU)("gray.200","whiteAlpha.200"),de=(0,d.dU)("blue.500","blue.300"),pe=(0,d.dU)("blue.50","whiteAlpha.100"),xe=(0,d.dU)("brand.500","purple.300"),ue=(0,d.dU)("gray.800","white"),he=(0,d.dU)("gray.500","gray.400"),ge=(0,d.dU)("white","navy.700"),be=(0,d.dU)("gray.200","whiteAlpha.200"),me=(0,d.dU)("brand.500","purple.300"),fe=(0,d.dU)("teal.50","rgba(56, 178, 172, 0.06)"),ye=(0,d.dU)("teal.200","teal.800"),je=(0,d.dU)("gray.100","whiteAlpha.100"),Se=(0,d.dU)("green.50","green.900"),ve=(0,d.dU)("green.300","green.600"),ze=(0,d.dU)("green.700","green.200"),we=(0,d.dU)("gray.100","whiteAlpha.100"),Ce=(0,d.dU)("gray.200","whiteAlpha.200"),Ae=(0,d.dU)("red.500","red.400"),Ue=(0,d.dU)("teal.500","teal.300"),ke=(0,d.dU)("teal.50","whiteAlpha.50"),Ee=(0,d.dU)("teal.700","teal.200"),Le=(0,d.dU)("gray.300","whiteAlpha.200"),Ie=(0,d.dU)("blue.50","whiteAlpha.100"),Pe=(0,d.dU)("blue.200","whiteAlpha.200"),Re=(0,d.dU)("blue.600","blue.300"),_e=(0,d.dU)("white","navy.700"),We=(0,d.dU)("teal.300","teal.600"),Oe=(0,d.dU)("teal.600","teal.300"),De=(0,d.dU)("teal.50","whiteAlpha.100"),Me=(0,d.dU)("gray.50","whiteAlpha.50"),Te=(0,d.dU)("gray.200","whiteAlpha.200"),Fe=(0,d.dU)("teal.50","rgba(56, 178, 172, 0.1
1)"),Be=(0,d.dU)("teal.300","teal.600"),qe=(0,d.dU)("white","navy.700"),Ze=(0,d.dU)("gray.200","whiteAlpha.200"),Je=(0,d.dU)("teal.50","rgba(56, 178, 172, 0.1)"),Ke=(0,d.dU)("teal.200","teal.700"),nt=(0,d.dU)("teal.700","teal.200"),at=(0,d.dU)("whiteAlpha.800","blackAlpha.600"),it=(0,a.useCallback)($e()((async e=>{try{M(!0);const t=await s.A.get("".concat("https://api.jindoo.ma/api/v1","/cities/search"),{params:e.trim()?{query:e}:{}});W(t.data||[])}catch(t){console.error("Error searching cities:",t),W([])}finally{M(!1)}}),300),[]);(0,a.useEffect)((()=>{B.current||(B.current=!0,it(""))}),[it]),(0,a.useEffect)((()=>{it(P)}),[P,it]),(0,a.useEffect)((()=>{if(t&&_.length>0){const e=_.find((e=>e.city.name===t));e&&"cities"===A&&(I(e),D(e.sectors||[]),U("sectors"))}}),[t,_]),(0,a.useEffect)((()=>{c?(Y(c),H(!0)):null!==c||b||(Y(null),H(!1))}),[c]),(0,a.useEffect)((()=>{b&&!c&&Y(b)}),[b,c]),(0,a.useEffect)((()=>{if(q){oe(!1);const e=setTimeout((()=>{oe(!0)}),150);return()=>clearTimeout(e)}oe(!1)}),[q,ee]);const st=(0,a.useCallback)((e=>{I(e),D(e.sectors||[]),U("sectors"),o(e.city.name),n("")}),[o,n]),lt=(0,a.useCallback)(((e,a)=>{r===e.name?n(""):(n(e.name),t!==a&&o(a))}),[t,r,o,n]),ct=(0,a.useCallback)((e=>{if("city"===e.type){const t=_.find((t=>t.city.name===e.name));t&&st(t),R("")}else if("sector"===e.type){const t=_.find((t=>t.city.name===e.cityName));t&&(I(t),D(t.sectors||[]),U("sectors"),o(e.cityName),n(e.name)),R("")}}),[_,st,o,n]),dt=(0,a.useCallback)((()=>{U("cities"),I(null),D([]),o(""),n("")}),[o,n]),pt=(0,a.useCallback)((()=>{U("cities"),I(null),D([]),R(""),o(""),n("")}),[o,n]),xt=async e=>{if(w){X(!0);try{const t=await(0,Ge.Rt)(e.latitude,e.longitude);ae(t.city||""),se(t.secteur||""),w({location:e,city:t.city,secteur:t.secteur,address:t.address,fullAddress:t.fullAddress})}catch(t){console.error("Error reverse geocoding:",t),ae(""),se(""),w({location:e,city:null,secteur:null,error:t.message})}finally{X(!1)}}},ut=(0,a.useMemo)((()=>{const e=P.trim();if(!e)return null;const t=Qe(e),r=[];return _.forEach((e=>{var o;Qe(e.city.name).includes(t)&&r.push({type:"city",name:e.city.name,cityName:e.city.name,sectorCount:(null===(o=e.sectors)||void 0===o?void 0:o.length)||0});(e.sectors||[]).forEach((o=>{Qe(o.name).includes(t)&&r.push({type:"sector",name:o.name,cityName:e.city.name,breadcrumb:e.city.name})}))})),r}),[P,_]),ht=P.trim().length>0,gt=(0,a.useMemo)((()=>{const e=[];return k&&e.push({label:k.city.name,color:de}),r&&e.push({label:r,color:de}),e}),[k,r,de]),bt=t&&r,mt=t&&!r,ft=(0,a.useMemo)((()=>q&&V?"exact":bt?"complete":mt?"partial":"empty"),[bt,mt,q,V]),yt=V?[V.latitude,V.longitude]:[33.5731,-7.5898],jt=V?15:6,St=Math.max(2,Math.min(18,jt));return(0,T.jsxs)(h.az,{ref:l,borderRadius:"16px",border:"1px solid",borderColor:i?Ae:ce,overflow:"hidden",bg:le,boxShadow:i?"0 0 0 1px ".concat(Ae):"sm",transition:"border-color 0.2s, box-shadow 0.2s",children:[(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,children:[(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:2,children:[(0,T.jsxs)(p.s,{align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:xe}),(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:ue,children:(0,C.t)("Localisation")}),(0,T.jsx)(u.E,{fontSize:"12px",color:Ae,children:"*"})]}),(0,T.jsx)(E.z,{spacing:2,children:(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:"exact"===ft?"teal.50":"complete"===ft?"green.50":"partial"===ft?"blue.50":je,border:"1px solid",borderColor:"exact"===ft?"teal.200":"complete"===ft?"green.200":"partial"===ft?"blue.200":ce,children:(0,T.jsxs)(E.z,{spacing:1,children:[("complete"===ft||"exact"===ft)&&(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:"exact"===ft?"teal.500":"green.500"}),"partial"===ft&&(0,T.jsx)(x.I,{as:j.qod,boxSize:"10px",color:"blue.500"}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"600",color:"exact"===ft?"teal.600":"complete"===ft?"green.600":"partial"===ft?"blue.600":he,children:"exact"===ft?(0,C.t)("GPS actif"):"complete"===ft?(0,C.t)("Complet"):"partial"===ft?(0,C.t)("Ville choisie"):(0,C.t)("Non d\xe9fini")})]})})})]}),(0,T.jsxs)(p.s,{gap:2,direction:{base:"column",md:"row"},align:{base:"stretch",md:"center"},w:"100%",children:[(0,T.jsxs)(Z.M,{size:"sm",flex:1,children:[(0,T.jsx)(J.W,{pointerEvents:"none",h:"36px",children:(0,T.jsx)(x.I,{as:q?j.o8z
1:j.gZ7,w:"16px",h:"16px",color:q?Ue:he,transition:"color 0.2s"})}),(0,T.jsx)(L.p,{ref:F,value:q?"":P,onChange:e=>{q||R(e.target.value)},placeholder:q?(0,C.t)("D\xe9sactivez la position exacte pour rechercher"):(0,C.t)("Rechercher une ville ou un secteur..."),h:"36px",bg:q?fe:ge,border:"1.5px solid",borderColor:q?ye:be,borderRadius:"10px",fontSize:"13px",fontWeight:"400",color:ue,_placeholder:{color:q?Ue:he,fontSize:"12px",fontStyle:q?"italic":"normal"},_focus:{borderColor:q?ye:me,boxShadow:q?"none":"0 0 0 1px ".concat(me)},_hover:{borderColor:q?ye:me},isReadOnly:q,cursor:q?"not-allowed":"text",opacity:q?.65:1,transition:"all 0.25s ease"}),P&&!q&&(0,T.jsx)(J.t,{h:"36px",children:(0,T.jsx)(K.J,{size:"sm",onClick:()=>{var e;R(""),null===(e=F.current)||void 0===e||e.focus()}})})]}),(0,T.jsxs)(p.s,{as:"button",type:"button",align:"center",justify:"center",gap:"8px",h:"36px",px:"14px",borderRadius:"10px",border:"1.5px solid",borderColor:q?Be:Te,bg:q?Fe:Me,cursor:"pointer",transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)",onClick:()=>{return H(e=!q),e?b&&!V&&(Y(b),g(b)):(Y(null),g(null),ae(""),se("")),void te((e=>e+1));var e},_hover:{borderColor:q?Be:Ue,bg:q?Fe:ke,transform:"translateY(-1px)",boxShadow:"sm"},flexShrink:0,w:{base:"100%",md:"auto"},children:[(0,T.jsx)(x.I,{as:j.o8z,boxSize:"15px",color:q?Ue:he,transition:"color 0.2s"}),(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"600",color:q?Ee:he,whiteSpace:"nowrap",transition:"color 0.2s",children:(0,C.t)("Position exacte")}),(0,T.jsx)(Ne.d,{size:"sm",colorScheme:"teal",isChecked:q,pointerEvents:"none"})]})]}),!q&&("cities"!==A||gt.length>0)&&!ht&&(0,T.jsxs)(p.s,{align:"center",gap:1,flexWrap:"wrap",py:1,px:1,mt:2,children:["cities"!==A&&(0,T.jsx)(h.az,{as:"button",type:"button",display:"flex",alignItems:"center",justifyContent:"center",w:"24px",h:"24px",borderRadius:"6px",bg:we,cursor:"pointer",transition:"all 0.2s ease",_hover:{bg:Ce},onClick:dt,flexShrink:0,mr:1,children:(0,T.jsx)(x.I,{as:j.l7J,w:"16px",h:"16px",color:he})}),gt.map(((e,t)=>(0,T.jsxs)(a.Fragment,{children:[t>0&&(0,T.jsx)(x.I,{as:j.xVu,w:"12px",h:"12px",color:he,mx:"2px",flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"11px",fontWeight:"600",color:e.color,noOfLines:1,children:e.label})]},t)))]})]}),!q&&(bt||mt)&&!ht&&(0,T.jsx)(h.az,{px:{base:3,md:4},pb:2,children:(0,T.jsxs)(p.s,{align:"center",bg:Se,borderRadius:"10px",px:3,py:2,border:"1px solid",borderColor:ve,children:[(0,T.jsx)(x.I,{as:bt?j.mU9:j.qod,w:"16px",h:"16px",color:ze,mr:2,flexShrink:0}),(0,T.jsxs)(h.az,{flex:1,minW:0,children:[(0,T.jsxs)(u.E,{fontSize:"12px",fontWeight:"600",color:ze,noOfLines:1,children:[t,r&&" \u2192 ".concat(r)]}),!r&&(0,T.jsx)(u.E,{fontSize:"10px",color:he,mt:"1px",children:(0,C.t)("S\xe9lectionnez un secteur pour plus de pr\xe9cision")})]}),(0,T.jsx)(h.az,{as:"button",type:"button",fontSize:"11px",fontWeight:"500",color:he,ml:2,cursor:"pointer",_hover:{color:"red.400"},onClick:pt,flexShrink:0,children:(0,T.jsx)(x.I,{as:j.m6K,w:"14px",h:"14px"})})]})}),(0,T.jsxs)(h.az,{px:{base:3,md:4},pb:{base:3,md:4},position:"relative",overflow:"hidden",children:[(0,T.jsx)(h.az,{style:{opacity:q?0:1,maxHeight:q?"0px":"340px",overflow:q?"hidden":"auto",transition:"opacity 0.3s ease, max-height 0.35s ease"},css:{"&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.12)",borderRadius:"10px"}},children:ht?(0,T.jsx)(h.az,{children:N?(0,T.jsxs)(p.s,{justify:"center",align:"center",py:"30px",direction:"column",children:[(0,T.jsx)(y.y,{size:"sm",color:xe,mb:"8px"}),(0,T.jsx)(u.E,{fontSize:"12px",color:he,children:(0,C.t)("Recherche en cours...")})]}):ut&&ut.length>0?(0,T.jsxs)(f.T,{align:"stretch",spacing:0,children:[(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:he,mb:2,px:1,children:[ut.length," ",ut.length>1?(0,C.t)("r\xe9sultats"):(0,C.t)("r\xe9sultat")]}),ut.map(((e,o)=>(0,T.jsx)(ot,{item:e,isSelected:"sector"===e.type?r===e.name&&t===e.cityName:t===e.name&&!r,accentColor:de,accentBg:pe,onClick:()=>ct(e)},"".concat(e.type,"-").concat(e.cityName,"-").concat(e.name,"-").concat(o))))]}):(0,T.jsxs)(p.s,{direction:"column",align:"center",justify:"center",py:"30px",children:[(0,T.jsx)(x.I,{as:j.gZ7,w:"28px",h:"28px",color:he,mb:"8px",opacity:.4}),(0,T.jsxs)(u.E,{fontSize:"12px",fontWeight:"500",color:he,textAlign:"center",children:[(0,C.t)("Aucun r\xe9sultat pour"),' "',P,'"']})]})}):"cities"===A?(0,T.jsx)(h.az,{children:N&&0===_.length?(0,T.jsxs)(p.s,{justify:"center",align:"center",py:"30px",direction:"column",children:[(0,T.jsx)(y.y,{size:"sm",color:xe,mb:"8px"}),(0,T.jsx)(u.E,{fontSize:"12px",color:he,children:(0,C.t)("Chargement des villes...")})]}):_.length>0?(0,T.jsx)(f.T,{align:"stretch",spacing:1,children:_.map((e=>{var r;return(0,T.jsx)(tt,{city:e.city,sectorCount:(null===(r=e.sectors)||void 0===r?void 0:r.length)||0,isSelected:t===e.city.name,accentColor:de,accentBg:pe,onClick:()=>st(e)},e.city.id||e.city.name)}))}):(0,T.jsxs)(p.s,{direction:"column",align:"center",justify:"center",py:"30px",children:[(0,T.jsx)(x.I,{as:j.qod,w:"28px",h:"28px",color:he,mb:"8px",opacity:.4}),(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"500",color:he,textAlign:"center",children:(0,C.t)("Aucune ville disponible")})]})}):"sectors"===A&&k?(0,T.jsx)(h.az,{children:O.length>0?(0,T.jsxs)(f.T,{align:"stretch",spacing:1,children:[(0,T.jsxs)(p.s,{align:"center",py:"6px",px:"12px",borderRadius:"8px",bg:pe,mb:1,children:[(0,T.jsx)(x.I,{as:j.Cd7,w:"14px",h:"14px",color:de,mr:"8px"}),(0,T.jsxs)(u.E,{fontSize:"11px",fontWeight:"600",color:de,children:[O.length," ",O.length>1?(0,C.t)("secteurs disponibles"):(0,C.t)("secteur disponible")]})]}),O.map(((e,t)=>(0,T.jsx)(rt,{sector:e,isSelected:r===e.name,accentColor:de,accentBg:pe,onClick:()=>lt(e,k.city.name)},e.id||e._id||t)))]}):(0,T.jsxs)(p.s,{direction:"column",align:"center",justify:"center",py:"20px",children:[(0,T.jsx)(x.I,{as:j.gwi,w:"24px",h:"24px",color:he,mb:"6px",opacity:.4}),(0,T.jsx)(u.E,{fontSize:"12px",color:he,children:(0,C.t)("Aucun secteur disponible pour cette ville")}),(0,T.jsx)(u.E,{fontSize:"10px",color:he,mt:"2px",children:(0,C.t)("Votre annonce sera visible dans toute la ville")})]})}):null}),(0,T.jsx)(h.az,{style:{opacity:q?1:0,maxHeight:q?"700px":"0px",overflow:"hidden",transition:"opacity 0.3s ease 0.05s, max-height 0.35s ease"},children:q&&(0,T.jsxs)(f.T,{spacing:3,align:"stretch",children:[S&&b&&(0,T.jsxs)(p.s,{align:"center",gap:2,px:3,py:"8px",borderRadius:"10px",bg:Ie,border:"1px solid",borderColor:Pe,cursor:"pointer",transition:"all 0.2s",_hover:{transform:"translateY(-1px)",boxShadow:"sm"},onClick:async()=>{b&&z&&(Y(b),g(b),z(),te((e=>e+1)),await xt(b))},children:[(0,T.jsx)(x.I,{as:j.I6O,boxSize:"16px",color:Re,flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"11px",fontWeight:"600",color:Re,flex:1,children:v||(0,C.t)("Utiliser la position de la boutique")}),(0,T.jsx)(x.I,{as:j.xVu,boxSize:"14px",color:Re,opacity:.6})]}),V&&(ne||Q)&&(0,T.jsx)(p.s,{align:"center",px:3,py:"10px",borderRadius:"10px",bg:Je,border:"1px solid",borderColor:Ke,gap:2,children:Q?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(y.y,{size:"xs",color:Ue}),(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"500",color:nt,children:(0,C.t)("D\xe9tection de la ville...")})]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(x.I,{as:j.mU9,boxSize:"16px",color:Ue,flexShrink:0}),(0,T.jsxs)(h.az,{flex:1,minW:0,children:[(0,T.jsxs)(u.E,{fontSize:"12px",fontWeight:"700",color:nt,noOfLines:1,children:[ne,ie&&" \u2192 ".concat(ie)]}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"400",color:Ee,mt:"1px",children:(0,C.t)("Ville d\xe9tect\xe9e depuis votre position")})]})]})}),(0,T.jsxs)(h.az,{h:{base:"240px",md:"280px"},w:"100%",borderRadius:"12px",overflow:"hidden",border:"1.5px solid",borderColor:V?Ue:Le,position:"relative",bg:"gray.100",transition:"border-color 0.3s ease",children:[re?(0,T.jsxs)(He.W,{center:yt,zoom:St,minZoom:2,maxZoom:18,style:{height:"100%",width:"100%"},scrollWheelZoom:!0,whenReady:e=>{setTimeout((()=>{try{e.target&&e.target.getContainer()&&e.target.invalidateSize()}catch(t){}}),400)},worldCopyJump:!0,maxBounds:[[-90,-180],[90,180]],children:[(0,T.jsx)(Ve.e,{attribution:'\xa9 <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,T.jsx)(et,{}),(0,T.jsx)(Xe,{onLocationSelect:async e=>{Y(e),g(e),await xt(e)},initialLocation:V,isVisible:q}),V&&(0,T.jsx)(Ye.p,{position:[V.latitude,V.longitude]})]},"map-section-".concat(ee)):(0,T.jsxs)(p.s,{align:"center",justify:"center",h:"100%",direction:"column",gap:2,children:[(0,T.jsx)(y.y,{size:"sm",color:Ue}),(0,T.jsx)(u.E,{fontSize:"11px",color:he,fontWeight:"500",children:(0,C.t)("Chargement de la carte...")})]}),$&&(0,T.jsxs)(p.s,{position:"absolute",inset:"0",zIndex:1e3,align:"center",justify:"center",bg:at,borderRadius:"inherit",direction:"column",gap:2,children:[(0,T.jsx)(y.y,{size:"md",color:Ue,thickness:"3px"}),(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"600",color:Ee,children:(0,C.t)("D\xe9tection de votre position...")})]})]}),(0,T.jsxs)(f.T,{spacing:2,align:"stretch",children:[(0,T.jsx)(m.$,{size:"sm",h:"38px",px:4,borderRadius:"10px",bg:_e,border:"1.5px solid",borderColor:We,color:Oe,fontWeight:"600",fontSize:"12px",leftIcon:(0,T.jsx)(x.I,{as:j.HPi,boxSize:"15px"}),onClick:async()=>{G(!0),navigator.geolocation?navigator.geolocation.getCurrentPosition((async e=>{const t={latitude:e.coords.latitude,longitude:e.coords.longitude};Y(t),g(t),te((e=>e+1)),await xt(t),G(!1)}),(e=>{console.error("Error getting location:",e),G(!1)})):G(!1)},isLoading:$,loadingText:(0,C.t)("Localisation..."),_hover:{bg:De,transform:"translateY(-1px)",boxShadow:"sm"},transition:"all 0.2s",w:"100%",children:(0,C.t)("Ma position actuelle")}),V&&(0,T.jsxs)(p.s,{align:"center",justify:"center",gap:1,px:"10px",py:"6px",borderRadius:"8px",bg:qe,border:"1px solid",borderColor:Ze,w:"100%",children:[(0,T.jsx)(x.I,{as:j.g9Y,boxSize:"12px",color:Ue,flexShrink:0}),(0,T.jsxs)(u.E,{fontSize:"11px",fontWeight:"500",color:he,children:[V.latitude.toFixed(4),", ",V.longitude.toFixed(4)]}),Q&&(0,T.jsx)(y.y,{size:"xs",color:Ue,ml:1,flexShrink:0})]})]}),(0,T.jsx)(u.E,{fontSize:"10px",color:he,textAlign:"center",mt:1,children:(0,C.t)("Cliquez sur la carte ou utilisez le bouton GPS pour d\xe9finir votre position exacte.")})]})})]}),i&&(0,T.jsx)(h.az,{px:{base:3,md:4},pb:3,children:(0,T.jsx)(u.E,{fontSize:"11px",color:Ae,fontWeight:"500",children:i})})]})};var at=r(40225);const it={isOnSale:{icon:j.JL6,colorScheme:"orange",accentColor:"orange",accentLight:"orange.50",accentDark:"rgba(237, 137, 54, 0.08)"},isInLiquidation:{icon:j.UZT,colorScheme:"red",accentColor:"red",accentLight:"red.50",accentDark:"rgba(245, 101, 101, 0.08)"},isUrgent:{icon:j.vSZ,colorScheme:"yellow",accentColor:"yellow",accentLight:"yellow.50",accentDark:"rgba(236, 201, 75, 0.08)"},isOnlinePurchase:{icon:j.O7Q,colorScheme:"teal",accentColor:"teal",accentLight:"teal.50",accentDark:"rgba(56, 178, 172, 0.08)"}},st=e=>{const t={isUrgent:(0,C.t)("En urgence"),isInLiquidation:(0,C.t)("Fin de stock"),isOnlinePurchase:(0,C.t)("Achat en ligne"),isOnSale:(0,C.t)("En promotion")},r={isUrgent:(0,C.t)("Fait ressortir votre annonce comme n\xe9cessitant une attention imm\xe9diate"),isInLiquidation:(0,C.t)("Indique que le produit arrive en fin de stock"),isOnlinePurchase:(0,C.t)("Indique que le produit peut \xeatre achet\xe9 en ligne"),isOnSale:(0,C.t)("Permet d'afficher un prix barr\xe9 et un prix promotionnel")};return{name:t[e]||e,description:r[e]||""}},lt=e=>{if(!e&&0!==e)return"0,00";const t=parseFloat(e.toString().replace(/,/g,""));
1return isNaN(t)?"0,00":t.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:2})},ct=e=>{let{badgeKey:t,isSelected:r,isPurchased:o,isLocked:n,price:a,onToggle:i,onLockedClick:s,children:l}=e;const c=it[t],g=(0,d.dU)("gray.700","white"),b=(0,d.dU)("gray.500","gray.400"),m=(0,d.dU)("gray.200","whiteAlpha.200"),f=(0,d.dU)("gray.50","whiteAlpha.50"),y=(0,d.dU)("gray.200","whiteAlpha.100"),S=(0,d.dU)("gray.400","gray.500"),v=(0,d.dU)("gray.100","whiteAlpha.100"),z=(0,d.dU)("gray.400","gray.500"),w=(0,d.dU)("0 4px 16px rgba(0,0,0,0.06)","0 4px 16px rgba(0,0,0,0.3)"),A=(0,d.dU)(c.accentLight,c.accentDark),U=(0,d.dU)("".concat(c.accentColor,".300"),"".concat(c.accentColor,".600")),k=(0,d.dU)("".concat(c.accentColor,".100"),"".concat(c.accentColor,".800")),L=(0,d.dU)("".concat(c.accentColor,".600"),"".concat(c.accentColor,".300")),I=(0,d.dU)("".concat(c.accentColor,".700"),"".concat(c.accentColor,".200")),P=(0,d.dU)("".concat(c.accentColor,".600"),"".concat(c.accentColor,".300")),R=(0,d.dU)("".concat(c.accentColor,".50"),"whiteAlpha.200"),_=(0,d.dU)("".concat(c.accentColor,".200"),"whiteAlpha.200"),W=(0,d.dU)("".concat(c.accentColor,".700"),"".concat(c.accentColor,".200")),O=(0,d.dU)("gray.100","whiteAlpha.100"),D=(0,d.dU)("gray.600","gray.300"),N=(0,d.dU)("".concat(c.accentColor,".100"),"".concat(c.accentColor,".900")),M=(0,d.dU)("".concat(c.accentColor,".700"),"".concat(c.accentColor,".200")),F=(0,d.dU)("gray.500","gray.400"),B=(0,d.dU)("green.50","rgba(72,187,120,0.12)"),q=(0,d.dU)("green.300","green.600"),H=(0,d.dU)("green.700","green.200"),V=(0,d.dU)("green.500","green.300"),Z=(0,d.dU)("green.50","rgba(72,187,120,0.15)"),J=(0,d.dU)("green.200","green.700"),K=(0,d.dU)("green.700","green.200"),$=st(t);return(0,T.jsxs)(h.az,{children:[(0,T.jsxs)(p.s,{justify:"space-between",align:"center",py:"10px",px:"12px",borderRadius:"12px",border:"1.5px solid",borderColor:n?y:o&&r?q:r?U:m,bg:n?f:o&&r?B:r?A:"transparent",transition:"all 0.2s ease",_hover:n?{}:{transform:"translateY(-1px)",boxShadow:w},cursor:n?"not-allowed":"pointer",onClick:n?s:i,opacity:n?.65:1,gap:3,children:[(0,T.jsxs)(E.z,{spacing:3,flex:"1",minW:0,children:[(0,T.jsx)(h.az,{w:"38px",h:"38px",borderRadius:"10px",bg:n?v:o&&r?"green.100":r?k:v,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s",children:(0,T.jsx)(x.I,{as:n?j.nMq:o&&r?j.mU9:c.icon,boxSize:"18px",color:n?z:o&&r?"green.500":r?L:z})}),(0,T.jsxs)(h.az,{minW:0,flex:1,children:[(0,T.jsxs)(E.z,{spacing:2,mb:"1px",flexWrap:"wrap",children:[(0,T.jsx)(u.E,{fontSize:"13px",fontWeight:"700",color:n?S:o&&r?"green.700":r?I:g,noOfLines:1,children:$.name}),o&&r&&(0,T.jsxs)(E.z,{spacing:1,px:"6px",py:"1px",borderRadius:"full",bg:Z,border:"1px solid",borderColor:J,children:[(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:K}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"700",color:K,children:(0,C.t)("Activ\xe9")})]}),r&&!o&&!n&&(0,T.jsxs)(E.z,{spacing:1,px:"6px",py:"1px",borderRadius:"full",bg:R,border:"1px solid",borderColor:_,children:[(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:W}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"700",color:W,children:(0,C.t)("S\xe9lectionn\xe9")})]}),n&&(0,T.jsx)(Y.E,{fontSize:"9px",colorScheme:"yellow",variant:"solid",borderRadius:"full",px:"6px",children:"PRO"})]}),(0,T.jsx)(u.E,{fontSize:"11px",color:n?S:o&&r?"green.600":r?P:b,noOfLines:1,children:$.description})]})]}),o?(0,T.jsxs)(p.s,{align:"center",gap:"5px",px:"10px",py:"5px",borderRadius:"full",bg:B,border:"1.5px solid",borderColor:q,flexShrink:0,transition:"all 0.2s",children:[(0,T.jsx)(x.I,{as:j._IM,boxSize:"13px",color:V}),(0,T.jsx)(u.E,{fontSize:"11px",fontWeight:"700",color:H,whiteSpace:"nowrap",children:(0,C.t)("D\xe9j\xe0 pay\xe9")})]}):(0,T.jsxs)(h.az,{px:"10px",py:"4px",borderRadius:"full",bg:r?N:O,border:"1px solid",borderColor:r?"".concat(c.accentColor,".200"):m,flexShrink:0,transition:"all 0.2s",textAlign:"center",children:[(0,T.jsxs)(u.E,{fontSize:"11px",fontWeight:"700",color:r?M:D,whiteSpace:"nowrap",lineHeight:"1.2",children:[lt(a)," MAD"]}),(0,T.jsx)(u.E,{fontSize:"8px",fontWeight:"600",color:F,lineHeight:"1",children:(0,C.t)("HT")})]})]}),r&&l&&(0,T.jsx)(h.az,{mt:2,ml:{base:2,md:"54px"},mr:{base:0,md:2},children:l})]})},dt=e=>{let{ad:t,HandleChange:r}=e;const[o,n]=(0,a.useState)(""),i=(0,d.dU)("white","navy.700"),s=(0,d.dU)("gray.200","whiteAlpha.200"),l=(0,d.dU)("gray.700","white"),c=(0,d.dU)("gray.500","gray.400"),x=(0,d.dU)("orange.700","orange.200"),g=(0,d.dU)("orange.50","rgba(237,137,54,0.06)"),b=(0,d.dU)("orange.200","orange.800"),m=(0,d.dU)("red.50","rgba(245,101,101,0.06)"),f=(0,d.dU)("red.200","red.800"),y=(0,d.dU)("red.600","red.300"),j=(0,d.dU)("orange.400","orange.300");return(0,T.jsxs)(h.az,{p:3,borderRadius:"10px",border:"1px solid",borderColor:b,bg:g,children:[(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"700",color:x,mb:3,children:(0,C.t)("Param\xe8tres de promotion")}),(0,T.jsxs)(me.r,{columns:{base:1,md:2},spacing:3,children:[(0,T.jsxs)(Ie.MJ,{children:[(0,T.jsx)(he.l,{fontSize:"11px",fontWeight:"600",color:l,children:(0,C.t)("Prix original (MAD)")}),(0,T.jsx)(L.p,{size:"sm",h:"36px",value:lt(t.originalPrice||t.price),isReadOnly:!0,bg:i,border:"1.5px solid",borderColor:s,borderRadius:"8px",fontSize:"12px",fontWeight:"500",color:l}),(0,T.jsx)(Ie.eK,{fontSize:"10px",color:c,children:(0,C.t)("Prix avant r\xe9duction")})]}),(0,T.jsxs)(Ie.MJ,{children:[(0,T.jsxs)(he.l,{fontSize:"11px",fontWeight:"600",color:l,children:[(0,C.t)("Prix promotionnel (MAD)"),(0,T.jsx)(u.E,{as:"span",color:"red.500",ml:1,children:"*"})]}),(0,T.jsx)(L.p,{size:"sm",h:"36px",name:"salePrice",value:o,onChange:e=>{const t=e.target.value.replace(/[^\d.]/g,"");n(t),r({target:{name:"salePrice",value:t}})},onBlur:()=>n(lt(t.salePrice)),onFocus:()=>{var e;return n((null===(e=t.salePrice)||void 0===e?void 0:e.toString())||"")},placeholder:(0,C.t)("Prix apr\xe8s r\xe9duction"),bg:i,border:"1.5px solid",borderColor:s,borderRadius:"8px",fontSize:"12px",fontWeight:"500",color:l,_placeholder:{color:c,fontSize:"11px"},_focus:{borderColor:j,boxShadow:"none"}})]})]}),t.price&&t.salePrice&&parseFloat(t.salePrice)>0&&(0,T.jsxs)(p.s,{mt:3,px:3,py:"8px",borderRadius:"8px",bg:m,border:"1px solid",borderColor:f,justify:"space-between",align:"center",children:[(0,T.jsx)(u.E,{fontSize:"11px",fontWeight:"600",color:y,children:(0,C.t)("R\xe9duction calcul\xe9e")}),(0,T.jsxs)(Y.E,{colorScheme:"red",fontSize:"12px",px:3,py:"2px",borderRadius:"full",fontWeight:"800",children:["-",Math.round((t.price-t.salePrice)/t.price*100),"%"]})]})]})},pt=e=>{let{method:t,isActive:r,isDisabled:o,onSelect:n}=e;const a=(0,i.W6)(),s=(0,d.dU)("gray.700","white"),l=(0,d.dU)("gray.500","gray.400"),c=(0,d.dU)("gray.200","whiteAlpha.200"),g=(0,d.dU)("gray.100","whiteAlpha.100"),b=(0,d.dU)("gray.400","gray.500"),f=(0,d.dU)(t.accentLight,t.accentDark),y=(0,d.dU)(t.accentBorder,t.accentBorderDark),S=(0,d.dU)("".concat(t.colorScheme,".100"),"".concat(t.colorScheme,".800")),v=(0,d.dU)("".concat(t.colorScheme,".600"),"".concat(t.colorScheme,".300")),z=(0,d.dU)("".concat(t.colorScheme,".700"),"".concat(t.colorScheme,".200"));return(0,T.jsxs)(p.s,{align:"center",py:"10px",px:"12px",borderRadius:"10px",border:"1.5px solid",borderColor:o?c:r?y:c,bg:o?"transparent":r?f:"transparent",curs
1or:o?"not-allowed":"pointer",opacity:o?.55:1,transition:"all 0.2s ease",_hover:o?{}:{transform:"translateY(-1px)",boxShadow:"0 2px 8px rgba(0,0,0,0.06)"},onClick:()=>{o||n(t.value)},gap:3,children:[(0,T.jsx)(h.az,{w:"34px",h:"34px",borderRadius:"8px",bg:r?S:g,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s",children:(0,T.jsx)(x.I,{as:t.icon,boxSize:"15px",color:r?v:b})}),(0,T.jsxs)(h.az,{flex:1,minW:0,children:[(0,T.jsxs)(E.z,{spacing:2,mb:"1px",children:[(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"700",color:r?z:s,children:t.label}),r&&!o&&(0,T.jsx)(x.I,{as:j.mU9,boxSize:"13px",color:z}),"credits"===t.value&&!o&&(0,T.jsx)(Y.E,{fontSize:"8px",colorScheme:"green",variant:"subtle",borderRadius:"full",px:"5px",children:(0,C.t)("Instantan\xe9")})]}),t.subtitle&&(0,T.jsx)(u.E,{fontSize:"10px",color:l,noOfLines:1,children:t.subtitle})]}),o?(0,T.jsx)(m.$,{size:"xs",colorScheme:"yellow",variant:"solid",fontSize:"10px",fontWeight:"700",h:"26px",px:3,borderRadius:"full",onClick:e=>{e.stopPropagation(),a.push("/app/memberships")},flexShrink:0,children:(0,C.t)("S'abonner")}):(0,T.jsx)(at.s,{value:t.value,colorScheme:t.colorScheme,isChecked:r,onChange:()=>n(t.value),onClick:e=>e.stopPropagation(),size:"md",flexShrink:0})]})},xt=e=>{let{creditBalance:t,totalAmount:r}=e;const o=t>=r,n=(0,d.dU)("green.50","rgba(72,187,120,0.08)"),a=(0,d.dU)("orange.50","rgba(237,137,54,0.08)"),i=(0,d.dU)("green.200","green.700"),s=(0,d.dU)("orange.200","orange.700"),l=(0,d.dU)("green.500","green.300"),c=(0,d.dU)("orange.500","orange.300"),p=(0,d.dU)("green.700","green.200"),g=(0,d.dU)("orange.700","orange.200"),b=(0,d.dU)("green.600","green.300");return(0,T.jsx)(h.az,{px:3,py:"8px",borderRadius:"8px",bg:o?n:a,border:"1px solid",borderColor:o?i:s,children:(0,T.jsxs)(E.z,{spacing:2,align:"flex-start",children:[(0,T.jsx)(x.I,{as:o?j.mU9:j.MJW,boxSize:"14px",color:o?l:c,mt:"1px",flexShrink:0}),(0,T.jsxs)(h.az,{flex:1,minW:0,children:[(0,T.jsx)(u.E,{fontSize:"11px",fontWeight:"600",color:o?p:g,lineHeight:"1.5",children:o?"".concat((0,C.t)("Paiement disponible")," \u2014 ").concat((0,C.t)("Solde apr\xe8s achat"),": ").concat(lt(t-r)," ").concat((0,C.t)("cr\xe9dits")):"".concat((0,C.t)("Cr\xe9dits insuffisants")," \u2014 ").concat((0,C.t)("Solde"),": ").concat(lt(t)," | ").concat((0,C.t)("Requis"),": ").concat(lt(r))}),o&&(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"500",color:b,mt:"2px",lineHeight:"1.5",children:(0,C.t)("Le paiement sera d\xe9duit imm\xe9diatement de votre solde.")})]})]})})},ut=e=>{let{selectedMethod:t,onMethodChange:r,creditBalance:o,totalAmount:n,isPro:i}=e;const s=(0,a.useMemo)((()=>[{value:"paypal",label:"PayPal",icon:S.SnG,colorScheme:"blue",accentLight:"blue.50",accentDark:"whiteAlpha.100",accentBorder:"blue.300",accentBorderDark:"blue.600",available:!0},{value:"credits",label:(0,C.t)("Cr\xe9dits JINDOO"),icon:S.lcY,colorScheme:"green",accentLight:"green.50",accentDark:"whiteAlpha.100",accentBorder:"green.300",accentBorderDark:"green.600",available:!0,subtitle:"".concat((0,C.t)("Solde disponible"),": ").concat(lt(o||0)," ").concat((0,C.t)("cr\xe9dits"))}]),[o,i]);return(0,T.jsxs)(f.T,{spacing:2,align:"stretch",children:[s.map((e=>(0,T.jsx)(pt,{method:e,isActive:t===e.value,isDisabled:!e.available,onSelect:r},e.value))),"credits"===t&&i&&(0,T.jsx)(xt,{creditBalance:o,totalAmount:n})]})},ht=e=>{let{badge:t,badgePricing:r}=e;const o=it[t],n=st(t),a=(0,d.dU)("gray.700","white"),i=(0,d.dU)("".concat(o.accentColor,".500"),"".concat(o.accentColor,".300"));return(0,T.jsxs)(p.s,{justify:"space-between",align:"center",py:"3px",children:[(0,T.jsxs)(E.z,{spacing:2,children:[(0,T.jsx)(x.I,{as:o.icon,boxSize:"12px",color:i}),(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"500",color:a,children:n.name})]}),(0,T.jsxs)(u.E,{fontSize:"12px",fontWeight:"700",color:a,children:[lt(r[t])," MAD"]})]})},gt=e=>{let{ad:t,HandleChange:r,handleBadgeChange:n,initialBadgeState:s,onNewBadgeSelection:c,selectedPaymentMethod:g,setSelectedPaymentMethod:b,badgePricing:y,creditBalance:S}=e;const v=JSON.parse(localStorage.getItem("user-token")),z=(0,i.W6)(),[w,A]=(0,a.useState)({isUrgent:!1,isInLiquidation:!1,isOnlinePurchase:!1,isOnSale:!1}),[U,k]=(0,a.useState)({isUrgent:!1,isInLiquidation:!1,isOnlinePurchase:!1,isOnSale:!1}),[L,I]=(0,a.useState)(0),P=(0,d.dU)("white","navy.800"),R=(0,d.dU)("gray.200","whiteAlpha.200"),_=(0,d.dU)("brand.500","purple.300"),W=(0,d.dU)("gray.800","white"),O=(0,d.dU)("gray.500","gray.400"),D=(0,d.dU)("gray.100","whiteAlpha.100"),N=(0,d.dU)("purple.50","whiteAlpha.50"),M=(0,d.dU)("purple.100","whiteAlpha.100"),F=(0,d.dU)("purple.600","purple.300"),B=(0,d.dU)("gray.50","whiteAlpha.50"),q=(0,d.dU)("gray.200","whiteAlpha.200"),H=(0,d.dU)("purple.600","purple.300"),V=(0,d.dU)("yellow.50","rgba(236,201,75,0.06)"),Y=(0,d.dU)("yellow.200","yellow.700"),Z=(0,d.dU)("yellow.800","yellow.200"),J=(0,d.dU)("gray.200","whiteAlpha.200"),K=(0,d.dU)("purple.50","whiteAlpha.100"),$=(0,d.dU)("purple.200","purple.700"),G=(0,d.dU)("purple.600","purple.300");(0,a.useEffect)((()=>
1{if(s&&y&&t.paidBadges){const e={};Object.keys(y).forEach((r=>{e[r]=(t.paidBadges||[]).includes(r)})),A(e)}}),[s,y,t.paidBadges]),(0,a.useEffect)((()=>{let e=0;Object.keys(U).forEach((t=>{U[t]&&!w[t]&&(e+=y[t]||0)})),I(e)}),[U,w,y]),(0,a.useEffect)((()=>{c&&c({hasNewBadges:L>0,totalAmount:L,badges:U,paymentMethod:g})}),[L,g,U,c]);const Q=e=>"isOnlinePurchase"!==e||"pro"===(null===v||void 0===v?void 0:v.ProPart),X=e=>{Q(e)?w[e]?n({target:{name:e,checked:!t[e]}}):k((t=>(0,o.A)((0,o.A)({},t),{},{[e]:!t[e]}))):l.oR.info((0,C.t)("Le badge 'Achat en ligne' est r\xe9serv\xe9 aux membres Pro."),{position:"bottom-center",autoClose:5e3})},ee=e=>w[e]?!!t[e]:!!U[e],te=Object.keys(U).filter((e=>U[e]&&!w[e])),re=Object.keys(w).filter((e=>w[e]&&t[e])).length,oe=te.length+re;return(0,T.jsxs)(h.az,{borderRadius:"16px",border:"1px solid",borderColor:R,overflow:"visible",bg:P,boxShadow:"sm",children:[(0,T.jsxs)(h.az,{px:{base:3,md:4},pt:{base:3,md:4},pb:2,children:[(0,T.jsxs)(p.s,{align:"center",justify:"space-between",mb:2,children:[(0,T.jsxs)(p.s,{align:"center",gap:2,children:[(0,T.jsx)(h.az,{h:"18px",w:"3px",borderRadius:"full",bg:_}),(0,T.jsx)(u.E,{fontWeight:"600",fontSize:"13px",color:W,children:(0,C.t)("Badges Disponibles")})]}),(0,T.jsxs)(E.z,{spacing:2,children:[oe>0&&(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:K,border:"1px solid",borderColor:$,children:(0,T.jsxs)(E.z,{spacing:1,children:[(0,T.jsx)(x.I,{as:j.mU9,boxSize:"10px",color:G}),(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:G,children:[oe," ",(0,C.t)("s\xe9lectionn\xe9(s)")]})]})}),(0,T.jsx)(h.az,{px:"8px",py:"2px",borderRadius:"full",bg:D,border:"1px solid",borderColor:R,children:(0,T.jsxs)(u.E,{fontSize:"10px",fontWeight:"600",color:O,children:[oe,"/",Object.keys(it).length]})})]})]}),(0,T.jsxs)(p.s,{align:"center",gap:2,px:2,py:"5px",mb:2,borderRadius:"8px",bg:N,border:"1px solid",borderColor:M,children:[(0,T.jsx)(x.I,{as:j.MJW,boxSize:"13px",color:F,flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"10px",color:F,fontWeight:"500",children:(0,C.t)("Rendez votre annonce plus visible gr\xe2ce aux badges. Ils peuvent attirer jusqu'\xe0 50% plus de visiteurs.")})]})]}),(0,T.jsxs)(h.az,{px:{base:3,md:4},pb:{base:3,md:4},children:["pro"!==(null===v||void 0===v?void 0:v.ProPart)&&(0,T.jsxs)(p.s,{align:"center",gap:2,px:3,py:"8px",mb:3,borderRadius:"10px",bg:V,border:"1px solid",borderColor:Y,children:[(0,T.jsx)(x.I,{as:j.nMq,boxSize:"14px",color:Z,flexShrink:0}),(0,T.jsx)(u.E,{fontSize:"10px",fontWeight:"600",color:Z,flex:1,children:(0,C.t)("Le badge 'Achat en ligne' est exclusif aux membres Pro.")}),(0,T.jsx)(m.$,{size:"xs",colorScheme:"yellow",variant:"solid",fontSize:"10px",fontWeight:"700",h:"24px",px:3,borderRadius:"full",onClick:()=>z.push("/app/memberships"),flexShrink:0,children:(0,C.t)("Voir les plans")})]}),(0,T.jsxs)(f.T,{spacing:2,align:"stretch",children:[(0,T.jsx)(ct,{badgeKey:"isOnSale",isSelected:ee("isOnSale"),isPurchased:!!w.isOnSale,isLocked:!1,price:y.isOnSale,onToggle:()=>X("isOnSale"),children:(0,T.jsx)(dt,{ad:t,HandleChange:r})}),(0,T.jsx)(ct,{badgeKey:"isInLiquidation",isSelected:ee("isInLiquidation"),isPurchased:!!w.isInLiquidation,isLocked:!1,price:y.isInLiquidation,onToggle:()=>X("isInLiquidation")}),(0,T.jsx)(ct,{badgeKey:"isUrgent",isSelected:ee("isUrgent"),isPurchased:!!w.isUrgent,isLocked:!1,price:y.isUrgent,onToggle:()=>X("isUrgent")}),(0,T.jsx)(ct,{badgeKey:"isOnlinePurchase",isSelected:ee("isOnlinePurchase"),isPurchased:!!w.isOnlinePurchase,isLocked:!Q("isOnlinePurchase")&&!w.isOnlinePurchase,price:y.isOnlinePurchase,onToggle:()=>X("isOnlinePurchase"),onLockedClick:()=>{l.oR.info((0,C.t)("Le badge 'Achat en ligne' est r\xe9serv\xe9 aux membres Pro."),{position:"bottom-center",autoClose:5e3})}})]}),te.length>0&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(be.c,{my:4,borderColor:J}),(0,T.jsxs)(h.az,{p:3,borderRadius:"12px",border:"1px solid",borderColor:q,bg:B,children:[(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"700",color:W,mb:3,children:(0,C.t)("R\xe9capitulatif de paiement")}),(0,T.jsxs)(f.T,{align:"stretch",spacing:1,mb:3,children:[te.map((e=>(0,T.jsx)(ht,{badge:e,badgePricing:y},e))),(0,T.jsx)(be.c,{my:1,borderColor:J}),(0,T.jsxs)(p.s,{justify:"space-between",align:"center",pt:1,children:[(0,T.jsx)(u.E,{fontSize:"13px",fontWeight:"700",color:W,children:(0,C.t)("Total")}),(0,T.jsxs)(u.E,{fontSize:"15px",fontWeight:"800",color:H,children:[lt(L)," MAD"]})]})]}),(0,T.jsx)(be.c,{my:3,borderColor:J}),(0,T.jsx)(u.E,{fontSize:"12px",fontWeight:"700",color:W,mb:3,children:(0,C.t)("M\xe9thode de paiement")}),(0,T.jsx)(ut,{selectedMethod:g,onMethodChange:b,creditBalance:S,totalAmount:L,isPro:"pro"===(null===v||void 0===v?void 0:v.ProPart)})]})]})]})]})};var bt,mt;(0,c.i7)(bt||(bt=(0,n.A)(["\n  from { opacity: 0; transform: translateY(20px); }\n  to { opacity: 1; transform: translateY(0); }\n"])));
1const ft=(0,c.i7)(mt||(mt=(0,n.A)(["\n  from { opacity: 0; transform: translateY(12px); }\n  to { opacity: 1; transform: translateY(0); }\n"]))),yt=e=>{let{stepNumber:t,title:r,subtitle:o,isActive:n,isComplete:a,accentColor:i,isMobile:s}=e;const l=(0,d.dU)("gray.400","gray.500"),c=(0,d.dU)("gray.100","whiteAlpha.100"),g=(0,d.dU)("green.50","green.900"),b=(0,d.dU)("green.400","green.500"),m=(0,d.dU)("brand.50","whiteAlpha.100"),f=(0,d.dU)("brand.500","purple.400"),y=(0,d.dU)("gray.200","whiteAlpha.200"),S=s?"32px":"36px",v=s?"16px":"18px";return(0,T.jsxs)(p.s,{align:"center",gap:{base:2,md:3},flex:1,direction:{base:"column",md:"row"},textAlign:{base:"center",md:"left"},children:[(0,T.jsx)(p.s,{align:"center",justify:"center",w:S,h:S,borderRadius:"full",border:"2px solid",borderColor:a?b:n?f:y,bg:a?g:n?m:c,flexShrink:0,transition:"all 0.3s ease",children:a?(0,T.jsx)(x.I,{as:j.mU9,boxSize:v,color:"green.500"}):(0,T.jsx)(u.E,{fontSize:s?"12px":"13px",fontWeight:"700",color:n?i:l,children:t})}),(0,T.jsxs)(h.az,{minW:0,children:[(0,T.jsx)(u.E,{fontSize:{base:"10px",md:"12px"},fontWeight:"700",color:n?i:a?"green.500":l,noOfLines:1,children:r}),(0,T.jsx)(u.E,{fontSize:{base:"9px",md:"10px"},color:l,noOfLines:1,display:{base:"none",sm:"block"},children:o})]})]})},jt=e=>{let{isComplete:t}=e;const r=(0,d.dU)("gray.200","whiteAlpha.200"),o=(0,d.dU)("green.300","green.600");return(0,T.jsx)(h.az,{h:{base:"2px",md:"2px"},w:{base:"24px",md:"auto"},flex:{base:"none",md:1},bg:t?o:r,mx:{base:0,md:2},borderRadius:"full",transition:"background 0.3s ease"})},St=e=>{let{currentStep:t,steps:r,accentColor:o}=e;const n=(0,d.dU)("white","navy.800"),i=(0,d.dU)("gray.200","whiteAlpha.200"),s=(0,g.A)({base:!0,md:!1});return(0,T.jsx)(h.az,{bg:n,borderRadius:{base:"14px",md:"16px"},border:"1px solid",borderColor:i,px:{base:3,md:5},py:{base:3,md:4},mb:{base:4,md:6},boxShadow:"sm",children:(0,T.jsx)(p.s,{align:"center",justify:"center",gap:{base:2,md:0},children:r.map(((e,n)=>(0,T.jsxs)(a.Fragment,{children:[(0,T.jsx)(yt,{stepNumber:n+1,title:e.title,subtitle:e.description,isActive:t===n+1,isComplete:t>n+1,accentColor:o,isMobile:s}),n<r.length-1&&(0,T.jsx)(jt,{isComplete:t>n+1})]},n)))})})},vt=e=>{let{children:t,stepTitle:r,stepTooltip:o,animate:n=!0}=e;const a=(0,d.dU)("gray.800","white"),i=(0,d.dU)("white","navy.800"),s=(0,d.dU)("gray.200","whiteAlpha.200");return(0,T.jsxs)(h.az,{bg:i,borderRadius:{base:"16px",md:"20px"},border:"1px solid",borderColor:s,boxShadow:"sm",overflow:"hidden",css:n?{animation:"".concat(ft," 0.35s ease-out")}:void 0,children:[(0,T.jsx)(h.az,{px:{base:4,md:6},pt:{base:3,md:5},pb:{base:2,md:3},borderBottom:"1px solid",borderColor:s,children:(0,T.jsxs)(p.s,{align:"center",justify:"center",gap:2,children:[(0,T.jsx)(u.E,{fontSize:{base:"sm",md:"lg"},fontWeight:"700",color:a,textAlign:"center",children:r}),o&&(0,T.jsx)(b.m,{label:o,fontSize:"sm",hasArrow:!0,placement:"top",children:(0,T.jsx)(h.az,{children:(0,T.jsx)(x.I,{as:j.MJW,color:"brand.400",boxSize:{base:"14px",md:"16px"},cursor:"help"})})})]})}),(0,T.jsx)(h.az,{px:{base:3,md:6},py:{base:3,md:5},children:t})]})},zt=e=>{let{onPrev:t,onNext:r,isPrevDisabled:o,isNextDisabled:n,nextLabel:a,nextVariant:i="outline",nextColorScheme:s="purple",nextIcon:l,nextIsLoading:c,nextLoadingText:u,showPaymentButton:h,paymentProps:g}=e;const b=(0,d.dU)("gray.100","whiteAlpha.100"),f=(0,d.dU)("gray.200","whiteAlpha.200"),y=(0,d.dU)("gray.600","gray.300"),S=(0,d.dU)("gray.200","whiteAlpha.200"),v=(0,d.dU)("gray.100","whiteAlpha.100");return(0,T.jsxs)(p.s,{w:"100%",justify:"space-between",align:"center",pt:{base:4,md:5},mt:{base:1,md:2},borderTop:"1px solid",borderColor:v,gap:3,children:[(0,T.jsx)(m.$,{onClick:t,isDisabled:o,variant:"ghost",size:{base:"sm",md:"md"},h:{base:"40px",md:"44px"},px:{base:3,md:5},borderRadius:"12px",color:y,bg:b,border:"1px solid",borderColor:S,_hover:{bg:f},_disabled:{opacity:.4,cursor:"not-allowed"},leftIcon:(0,T.jsx)(x.I,{as:j.MGo,boxSize:{base:"14px",md:"16px"}}),fontWeight:"600",fontSize:{base:"12px",md:"13px"},flexShrink:0,children:(0,C.t)("Pr\xe9c\xe9dent")}),h?(0,T.jsx)(m.$,{colorScheme:g.colorScheme,variant:"solid",size:{base:"sm",md:"md"},h:{base:"40px",md:"44px"},px:{base:4,md:6},borderRadius:"12px",onClick:g.onClick,isLoading:g.isLoading,loadingText:g.loadingText,leftIcon:g.leftIcon,isDisabled:g.isDisabled,fontWeight:"600",fontSize:{base:"12px",md:"13px"},_hover:{transform:"translateY(-1px)",boxShadow:"md"},transition:"all 0.2s",flex:{base:1,md:"none"}
1,maxW:{base:"60%",md:"none"},children:g.label}):(0,T.jsx)(m.$,{onClick:r,isDisabled:n,colorScheme:s,variant:i,size:{base:"sm",md:"md"},h:{base:"40px",md:"44px"},px:{base:4,md:6},borderRadius:"12px",isLoading:c,loadingText:u,rightIcon:l||(0,T.jsx)(x.I,{as:j.a1M,boxSize:{base:"14px",md:"16px"}}),fontWeight:"600",fontSize:{base:"12px",md:"13px"},_hover:{transform:"translateY(-1px)",boxShadow:"md"},transition:"all 0.2s",children:a||(0,C.t)("Suivant")})]})},wt=()=>{const e=(0,d.dU)("linear(to-b, white, gray.50)","linear(to-b, navy.900, gray.900)");return(0,T.jsx)(p.s,{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",bgGradient:e,zIndex:"9999",direction:"column",align:"center",justify:"center",px:4,children:(0,T.jsxs)(f.T,{spacing:6,children:[(0,T.jsx)(y.y,{thickness:"3px",speed:"0.65s",emptyColor:"gray.200",color:"brand.500",size:"xl"}),(0,T.jsx)(u.E,{fontSize:{base:"md",md:"lg"},fontWeight:"600",color:"brand.500",textAlign:"center",children:(0,C.t)("Chargement de votre annonce...")})]})})},Ct=()=>{const e=(0,w.Ol)(),t=(0,i.W6)(),{id:r}=(0,i.g)(),n=((0,g.A)({base:!0,md:!1}),(0,d.dU)("brand.500","purple.300")),c=(0,d.dU)("red.500","red.400"),b=(0,d.dU)("red.600","red.300"),m=(0,d.dU)("red.50","rgba(254, 178, 178, 0.06)"),y=(0,d.dU)("red.200","red.800"),A=localStorage.getItem("user-token"),U=JSON.parse(A),[k,E]=(0,a.useState)(1),[L,I]=(0,a.useState)(!0),[P,R]=(0,a.useState)(!1),[_,W]=(0,a.useState)(!1),[O,D]=(0,a.useState)([]),[N,M]=(0,a.useState)([]),[F,q]=(0,a.useState)([]),[H,V]=(0,a.useState)([]),[Y,Z]=(0,a.useState)([]),[J,K]=(0,a.useState)(""),[$,G]=(0,a.useState)(""),[Q,X]=(0,a.useState)(""),[ee,te]=(0,a.useState)(""),[re,oe]=(0,a.useState)(""),[ne,ae]=(0,a.useState)(""),[ie,se]=(0,a.useState)(""),[le,ce]=(0,a.useState)(""),[pe,xe]=(0,a.useState)(""),[ue,he]=(0,a.useState)(""),[ge,be]=(0,a.useState)(null),[me,fe]=(0,a.useState)([]),[ye,je]=(0,a.useState)([]),[Se,ve]=(0,a.useState)({}),[ze,we]=(0,a.useState)([]),[Ce,Ae]=(0,a.useState)([]),[Ue,ke]=(0,a.useState)(Array(6).fill(null)),[Ee,Ie]=(0,a.useState)(null),[Pe,Re]=(0,a.useState)(null),[_e,Oe]=(0,a.useState)("paypal"),[Ne,Me]=(0,a.useState)({isUrgent:59,isInLiquidation:39,isOnlinePurchase:45,isOnSale:49}),[Te,Fe]=(0,a.useState)((()=>(null===U||void 0===U?void 0:U.credit)||0)),[qe,He]=(0,a.useState)(!1),[Ve,Ye]=(0,a.useState)(!1),[Ze,Je]=(0,a.useState)(""),[Ke,$e]=(0,a.useState)({}),[Ge,Qe]=(0,a.useState)({}),[Xe,et]=(0,a.useState)({}),[tt,rt]=(0,a.useState)({name:!1,description:!1}),ot=(0,a.useRef)(null),at=(0,a.useRef)(null),it=(0,a.useRef)(null),st=(0,a.useRef)(null),lt=(0,a.useRef)(null),ct=(0,a.useRef)(!1),[dt,pt]=(0,a.useState)({withDelivery:!1,isPremium:!1,isUrgent:!1,isInLiquidation:!1,isOnlinePurchase:!1,isOnSale:!1,originalPrice:0,salePrice:0,discountPercentage:0,contactOptions:{whatsapp:!0,call:!0,chat:!0}}),xt=e=>{if(!e&&0!==e)return"";const t=parseFloat(e.toString().replace(/,/g,""));return isNaN(t)?"":t.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:2})};(0,a.useEffect)((()=>{window.scrollTo({top:0,behavior:"smooth"})}),[k]),(0,a.useEffect)((()=>{(async()=>{try{const e=(await s.A.get("".concat("https://api.jindoo.ma/api/v1","/ads/ad/").concat(r))).data;pt((0,o.A)((0,o.A)({},e),{},{priceDisplay:xt(e.price),contactOptions:e.contactOptions||{whatsapp:!0,call:!0,chat:!0}})),Ie({isUrgent:e.isUrgent||!1,isInLiquidation:e.isInLiquidation||!1,isOnlinePurchase:e.isOnlinePurchase||!1,isOnSale:e.isOnSale||!1}),e.city&&se(e.city),e.secteur&&xe(e.secteur),e.region&&he(e.region),e.type&&ae(e.type),e.categoryName&&K(e.categoryName),e.categoryLabel&&G(e.categoryLabel),e.subcategoryName&&te(e.subcategoryName),e.subcategoryLabel&&oe(e.subcategoryLabel),e.latitude&&e.longitude&&be({latitude:e.latitude,longitude:e.longitude})}catch(e){console.error("Error fetching ad:",e),l.oR.error((0,C.t)("Erreur lors du chargement de l'annonce"))}finally{I(!1)}})()}),[r]),(0,a.useEffect)((()=>{s.A.get("".concat("https://api.jindoo.ma/api/v1","/categories")).then((e=>D(e.data))).catch((e=>console.error(e))),s.A.get("".concat("https://api.jindoo.ma/api/v1","/cities/")).then((e=>q(e.data))).catch((e=>console.error(e)))}),[]),(0,a.useEffect)((()=>{(async()=>{try{const e=await s.A.get("".concat("https://api.jindoo.ma/api/v1","/users/admin/all"),{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token")),"Content-Type":"application/json"}});Z(e.data)}catch(e){console.error(e)}})()}),[]),(0,a.useEffect)((()=>{(async()=>{try{const e=await s.A.get("".concat("https://api.jindoo.ma/api/v1","/badge-pricing"));if(e.data.success&&e.data.pricing){const t={};e.data.pricing.forEach((e=>{t[e.badgeType]=e.price})),Me(t)}}catch(e){console.error("Error fetching badge pricing:",e)}})()}),[]),(0,a.useEffect)((()=>{void 0!==(null===U||void 0===U?void 0:U.credit)&&Fe(U.credit)}),[null===U||void 0===U?void 0:U.credit]),(0,a.useEffect)((()=>
1{if(J&&O.length>0){const e=O.find((e=>e.name===J));null!==e&&void 0!==e&&e._id&&(X(e._id),s.A.get("".concat("https://api.jindoo.ma/api/v1","/subcategories/").concat(e._id)).then((e=>M(e.data))).catch((e=>console.error(e))),s.A.get("".concat("https://api.jindoo.ma/api/v1","/customFields/get/category/").concat(J)).then((e=>je(e.data))).catch((e=>console.error(e))))}}),[J,O]),(0,a.useEffect)((()=>{ee&&s.A.get("".concat("https://api.jindoo.ma/api/v1","/customFields/get/subcategory/").concat(ee)).then((e=>fe(Array.isArray(e.data)?e.data:[]))).catch((e=>console.error(e)))}),[ee]),(0,a.useEffect)((()=>{le&&s.A.get("".concat("https://api.jindoo.ma/api/v1","/secteurs/").concat(le)).then((e=>V(e.data))).catch((e=>console.error(e)))}),[le]),(0,a.useEffect)((()=>{(async()=>{try{const e=await s.A.get("".concat("https://api.jindoo.ma/api/v1","/customFieldsValues/get/ad/").concat(r));we(e.data||[])}catch(e){console.error(e)}})(),(async()=>{try{const e=await s.A.get("".concat("https://api.jindoo.ma/api/v1","/subCustomFieldsValues/get/ad/").concat(r));Ae(e.data||[])}catch(e){console.error(e)}})()}),[r]),(0,a.useEffect)((()=>{if(ct.current)return;if(0===me.length&&0===ye.length)return;if(0===ze.length&&0===Ce.length)return;const e=[...me,...ye],t=(e,t)=>t?"radio"===t.type||"select"===t.type?Array.isArray(e)?e[0]||"":e||"":"multi"===t.type?Array.isArray(e)?e:e?[e]:[]:e:e;we((r=>r.map((r=>{const n=e.find((e=>e._id===r.field_id));return n?(0,o.A)((0,o.A)({},r),{},{value:t(r.value,n)}):r}))));const r=Object.values(Se).flat();r.length>0&&Ae((e=>e.map((e=>{const n=r.find((t=>t._id===e.field_id));return n?(0,o.A)((0,o.A)({},e),{},{value:t(e.value,n)}):e})))),ct.current=!0}),[me,ye,Se,ze,Ce]),(0,a.useEffect)((()=>{ee&&null!==me&&void 0!==me&&me.length&&(ve({}),me.forEach((e=>{var t,r;const n=null!==(t=null!==(r=e.value)&&void 0!==r?r:e.name)&&void 0!==t?t:e._id;n&&s.A.get("".concat("https://api.jindoo.ma/api/v1","/subCustomFields/get/customField/value/").concat(encodeURIComponent(n),"/").concat(encodeURIComponent(ee))).then((t=>{ve((r=>(0,o.A)((0,o.A)({},r),{},{[e._id]:t.data||[]})))})).catch((e=>console.error(e)))})))}),[me,ee]),(0,a.useEffect)((()=>{if(dt.adPictures&&Array.isArray(dt.adPictures)){const e=Array(6).fill(null);dt.adPictures.filter((e=>"string"===typeof e&&""!==e.trim())).forEach(((t,r)=>{r<6&&(e[r]=t)})),ke(e)}}),[dt.adPictures]);const ut=(e,t)=>{if(!e)return"";let r=e.replace(/(?:https?:\/\/|www\.)[^\s]+/gi,"");return r=r.replace(/\+?\d[\d\s().-]{6,}\d/g,""),r=r.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/gi,""),t&&r.length>t&&(r=r.slice(0,t)),r},ht=e=>{const{name:t,value:r}=e.target;if("name"===t){const e=ut(r,50);return rt((t=>(0,o.A)((0,o.A)({},t),{},{name:e!==r}))),void pt((t=>(0,o.A)((0,o.A)({},t),{},{name:e})))}if("description"===t){const e=ut(r,500);return rt((t=>(0,o.A)((0,o.A)({},t),{},{description:e!==r}))),void pt((t=>(0,o.A)((0,o.A)({},t),{},{description:e})))}if("price"===t){const e=r.replace(/[^\d.]/g,"");return e&&!/^\d*\.?\d*$/.test(e)?void Je((0,C.t)("Le prix doit contenir uniquement des chiffres.")):(Je(""),void pt((t=>(0,o.A)((0,o.A)({},t),{},{price:e,priceDisplay:e}))))}if("salePrice"===t){if(r&&!/^\d*\.?\d*$/.test(r))return;const e=parseFloat(r),t=parseFloat(dt.originalPrice||dt.price);let n=0;return e>0&&t>0&&(n=Math.round((t-e)/t*100)),void pt((e=>(0,o.A)((0,o.A)({},e),{},{salePrice:r,discountPercentage:n})))}if(["isUrgent","isInLiquidation","isOnlinePurchase","isOnSale","isPremium","withDelivery"].includes(t))if("isOnSale"===t){const e=r;pt((t=>(0,o.A)((0,o.A)({},t),{},{isOnSale:e,originalPrice:e?t.originalPrice||t.price:t.originalPrice,price:e?t.price:t.originalPrice||t.price,priceDisplay:e?t.priceDisplay:xt(t.originalPrice||t.price)})))}else pt((e=>(0,o.A)((0,o.A)({},e),{},{[t]:r})));else pt((e=>(0,o.A)((0,o.A)({},e),{},{[t]:r})))},bt=(0,a.useCallback)((e=>{Re(e)}),[]),mt=async()=>{R(!0);try{const t=new FormData;t.append("userId",dt.userId),t.append("firstName",dt.firstName),t.append("lastName",dt.lastName),t.append("phone",dt.phone),t.append("name",dt.name),t.append("secteur",pe||dt.secteur||""),t.append("city",ie||dt.city||""),t.append("region",ue||dt.regi
1on||""),t.append("type",ne||dt.type||""),t.append("categoryName",J||dt.categoryName),t.append("categoryLabel",$||dt.categoryLabel),t.append("subcategoryName",ee||dt.subcategoryName||""),t.append("subcategoryLabel",re||dt.subcategoryLabel||""),t.append("description",dt.description),t.append("userProfilePicture",dt.userProfilePicture||""),t.append("status","En cours de Validation"),t.append("withDelivery",dt.withDelivery||!1),t.append("isPremium",dt.isPremium||!1),t.append("isUrgent",dt.isUrgent||!1),t.append("isInLiquidation",dt.isInLiquidation||!1),t.append("isOnlinePurchase",dt.isOnlinePurchase||!1),t.append("isOnSale",dt.isOnSale||!1),t.append("originalPrice",dt.originalPrice||dt.price||0),t.append("salePrice",dt.salePrice||0),t.append("discountPercentage",dt.discountPercentage||0),t.append("price",dt.isOnSale&&dt.salePrice?dt.salePrice:dt.price),t.append("contactOptions",JSON.stringify(dt.contactOptions||{whatsapp:!0,call:!0,chat:!0})),null!==ge&&void 0!==ge&&ge.latitude&&null!==ge&&void 0!==ge&&ge.longitude&&(t.append("latitude",ge.latitude),t.append("longitude",ge.longitude));const n=await(async()=>(await Promise.all(Ue.map((async e=>{if(e instanceof File)try{const t="".concat(e.name.split(".")[0],"_").concat(Date.now()),r=e.name.split(".").pop(),o="adPictures/".concat(dt.name,"/").concat(t,".").concat(r),n=(0,v.KR)(z.I,o);return await(0,v.D)(n,e),await(0,v.qk)(n)}catch(t){return console.error("Upload error:",t),null}else if("string"===typeof e&&""!==e.trim())return e;return null})))).filter((e=>null!==e)))();t.append("adPictureUrls",JSON.stringify(n));const a=(await(0,s.A)({method:"put",url:"".concat("https://api.jindoo.ma/api/v1","/ads/").concat(r),data:t,headers:{Authorization:"Bearer ".concat(localStorage.getItem("token")),"Content-Type":"multipart/form-data"}})).data,i={sender:"system",message:"".concat((0,C.t)("Annonce modifiee par")," ").concat(U.firstName," ").concat(U.lastName," ").concat((0,C.t)("et n\xe9cessitant une v\xe9rification.")),type:"newAddAdmin",adId:a._id};Y.forEach((async t=>{const r=(0,o.A)({recipient:t._id},i);e.emit("sendNotification",r);try{await s.A.post("".concat("https://api.jindoo.ma/api/v1","/notifications"),r,{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token"))}})}catch(n){console.error(n)}})),await Promise.all([s.A.delete("".concat("https://api.jindoo.ma/api/v1","/ads/").concat(dt._id,"/custom-field-values"),{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token"))}}),s.A.delete("".concat("https://api.jindoo.ma/api/v1","/ads/").concat(dt._id,"/sub-custom-field-values"),{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token"))}})]);const l=[...ye,...me].map((e=>{const t=ze.find((t=>t.field_id===e._id));if(!t)return null;const r=Array.isArray(t.value)||void 0!==t.value&&""!==t.value?t.value:null;return null===r||Array.isArray(r)&&0===r.length?null:{ad_id:dt._id,field_id:e._id,field_name:e.name,value:r}})).filter(Boolean),c=Object.values(Se).flat().map((e=>{const t=Ce.find((t=>t.field_id===e._id)),r=null===t||void 0===t?void 0:t.value;return void 0===r||""===r||Array.isArray(r)&&0===r.length?null:{ad_id:dt._id,field_id:e._id,field_name:e.name,value:r}})).filter(Boolean);return await Promise.all([...l.map((e=>s.A.post("".concat("https://api.jindoo.ma/api/v1","/customFieldsValues/add/new"),e,{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token"))}}))),...c.map((e=>s.A.post("".concat("https://api.jindoo.ma/api/v1","/subCustomFieldsValues/add/new"),e,{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token"))}})))]).catch((e=>console.error("Error saving field values:",e))),a}catch(t){throw console.error("Error in update function:",t),t}finally{R(!1)}},ft=(e,t)=>{let r=0;return e.isUrgent&&(r+=t.isUrgent||0),e.isInLiquidation&&(r+=t.isInLiquidation||0),e.isOnlinePurchase&&(r+=t.isOnlinePurchase||0),e.isOnSale&&(r+=t.isOnSale||0),r},yt=()=>null!==ie&&void 0!==ie&&ie.trim()?(et({}),!0):(et({city:(0,C.t)("Veuillez s\xe9lectionner une ville pour votre annonce")}),l.oR.error((0,C.t)("Veuillez corriger les champs obligatoires."),{position:"bottom-center",autoClose:3e3,theme:"colored"}),!1),jt=[{title:(0,C.t)("Classification"),description:(0,C.t)("Cat\xe9gorie & type")},{title:(0,C.t)("Identification"),description:(0,C.t)("Photos, titre & prix")},{title:(0,C.t)("Localisation"),description:(0,C.t)("Ville & badges")}],Ct=(0,g.A)({base:"12px",md:"20px"}),At=!(null===Pe||void 0===Pe||!Pe.hasNewBadges);return L?(0,T.jsx)(wt,{}):(0,T.jsxs)(h.az,{mt:{base:"70px",md:"10px"},maxW:"900px",mx:"auto",px:{base:"10px",sm:3,md:4},pb:{base:6,md:10},children:[(0,T.jsx)(l.N9,{position:"top-center",autoClose:5e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light",style:{zIndex:99999}}),(0,T.jsx)(St,{currentStep:k,steps:jt,accentColor:n}),1===k&&(0,T.jsxs)(vt,{stepTitle:(0,C.t)("Classification de votre annonce"),stepTooltip:(0,C.t)("S\xe9lectionnez la cat\xe9gorie principale, puis une sous-cat\xe9gorie sp\xe9cifique, et remplissez les champs requis pour mieux d\xe9crire votre annonce."),children:[(0,T.jsxs)(f.T,{spacing:Ct,align:"stretch",children:[(0,T.jsxs)(h.az,{ref:ot,children:[(0,T.jsx)(de,{categories:O,selectedCategory:J,selectedCategoryId:Q,selectedCategoryLabel:$,selectedSubcategory:ee,selectedSubcategoryLabel:re,onCategorySelect:e=>{te(""),oe(""),K(e.name),X(e._id),G(e.label),$e((e=>(0,o.A)((0,o.A)({},e),{},{category:void 0})))},onSubcategorySelect:e=>{te(e.name),oe(e.label),$e((e=>(0,o.A)((0,o.A)({},e),{},{subcategory:void 0})))},onClearCategory:()=>{K(""),X(""),G(""),te(""),oe(""),fe([]),je([])},onClearSubcategory:()=>{te(""),oe("")}}),(Ke.category||Ke.subcategory)&&(0,T.jsx)(u.E,{color:c,fontSize:"sm",mt:2,children:Ke.category||Ke.subcategory})]}),(0,T.jsx)(Le,{selectedCategoryLabel:$,selectedType:ne,onTypeChange:e=>{ae(e),$e((e=>(0,o.A)((0,o.A)({},e),{},{type:void 0})))},typeRef:at,typeError:Ke.type,selectedSubcategory:ee,selectedCategory:J,tableFields:me,tableFieldsCat:ye,tableSubFieldsByFieldId:Se,fieldsValues:ze,subFieldsValues:Ce,onFieldsChange:(e,t,r)=>{let n;if("radio"===t)n=r||"";else if("multi"===t)n=Array.from(r||[]);else if("select"===t){var a,i,s;n=null!==(a=null!==(i=null===r||void 0===r||null===(s=r.target)||void 0===s?void 0:s.value)&&void 0!==i?i:r)&&void 0!==a?a:""}else{var l,c;n=null!==(l=null===r||void 0===r||null===(c=r.target)||void 0===c?void 0:c.value)&&void 0!==l?l:""}we((t=>{var a;const i=[...t],s=i.findIndex((t=>t.field_id===e));return s>=0?i[s]=(0,o.A)((0,o.A)({},i[s]),{},{value:n}):i.push({ad_id:dt._id,field_id:e,field_name:(null===r||void 0===r||null===(a=r.target)||void 0===a?void 0:a.name)||"",value:n}),i}))},onSubFieldsChange:(e,t,r)=>{let n;var a,i,s;if("radio"===t||"select"===t)n=null!==(a=null!==(i=null===r||void 0===r||null===(s=r.target)||void 0===s?void 0:s.value)&&void 0!==i?i:r)&&void 0!==a?a:"";else if("multi"===t)n=Array.from(r||[]);else{var l,c;n=null!==(l=null===r||void 0===r||null===(c=r.target)||void 0===c?void 0:c.value)&&void 0!==l?l:""}Ae((t=>{var a;const i=[...t],s=i.findIndex((t=>t.field_id===e));return s>=0?i[s]=(0,o.A)((0,o.A)({},i[s]),{},{value:n}):i.push({ad_id:dt._id,field_id:e,field_name:(null===r||void 0===r||null===(a=r.target)||void 0===a?void 0:a.name)||"",value:n}),i}))}}),(0,T.jsx)(Be,{contactOptions:dt.contactOptions,onToggle:e=>{pt((t=>(0,o.A)((0,o.A)({},t),{},{contactOptions:(0,o.A)((0,o.A)({},t.contactOptions),{},{[e]:!t.contactOptions[e]})})))}})]}),(0,T.jsx)(zt,{onPrev:()=>t.goBack(),onNext:()=>{(()=>{const e={};return J.trim()||(e.category=(0,C.t)("Attribuez une cat\xe9gorie \xe0 votre annonce")),ee.trim()||(e.subcategory=(0,C.t)("Veuillez s\xe9lectionner une sous-cat\xe9gorie")),"Demande d'emploi et stages"===$||"Offres d'emploi et stages"===$||ne||(e.type=(0,C.t)("Entrez le type de votre annonce")),Object.keys(e).length>0?($e(e),l.oR.error((0,C.t)("Veuillez corriger les champs obligatoires."),{position:"bottom-center",autoClose:3e3,theme:"colored"}),!1):($e({}),!0)})()&&E(2)},isPrevDisabled:!1,nextLabel:(0,C.t)("Suivant")})]}),2===k&&(0,T.jsxs)(vt,{stepTitle:(0,C.t)("Identification de votre annonce"),stepTooltip:(0,C.t)("Ajoutez des photos, donnez un nom et une description \xe0 votre annonce, puis d\xe9finissez le prix pour compl\xe9ter cette \xe9tape."),children:[(0,T.jsxs)(f.T,{spacing:Ct,align:"stretch",children:[(0,T.jsx)(B,{files:Ue,setFiles:ke,handleDelete:e=>{const t=[...Ue];t[e]=null,ke(t)},handleFileChange:(e,t)=>
1{const r=Array.from(e.target.files);if(0===r.length)return;const o=[...Ue],n=Ue.length;let a=0,i=t;for(let s=0;s<r.length;s++){for(;i<n&&null!==o[i];)i++;if(!(i<n)){l.oR.error((0,C.t)("Limite atteinte. ".concat(r.length-a," image(s) non ajout\xe9e(s).")),{position:"bottom-center",autoClose:3e3,theme:"colored"});break}o[i]=r[s],a++,i++}ke(o),a>1&&l.oR.success((0,C.t)("".concat(a," images ajout\xe9es avec succ\xe8s")),{position:"bottom-center",autoClose:2e3,theme:"colored"}),e.target.value=""},maxImages:6}),(0,T.jsx)(We,{ad:dt,onNameChange:e=>{ht(e),Qe((e=>(0,o.A)((0,o.A)({},e),{},{name:void 0})))},onPriceChange:ht,onPriceFocus:()=>{pt((e=>{var t;return(0,o.A)((0,o.A)({},e),{},{priceDisplay:(null===(t=e.price)||void 0===t?void 0:t.toString())||""})}))},onPriceBlur:()=>{const e=parseFloat(dt.price);pt((t=>(0,o.A)((0,o.A)({},t),{},{price:isNaN(e)?0:e,priceDisplay:xt(e)})))},onPaste:e=>{const t=e.clipboardData.getData("text"),r=ut(t);e.preventDefault();const n=(0,o.A)((0,o.A)({},e),{},{target:(0,o.A)((0,o.A)({},e.target),{},{value:(dt[e.target.name]||"")+" "+r,name:e.target.name})});ht(n)},nameError:Ge.name,priceError:Ze||Ge.price,sanitizedHintName:tt.name,isImprovingTitle:qe,onAIStart:()=>He(!0),onAIImprove:e=>{pt((t=>(0,o.A)((0,o.A)({},t),{},{name:e}))),He(!1)},onAIError:()=>He(!1),nameRef:it,formatPrice:xt}),(0,T.jsx)(De,{ad:dt,onDescriptionChange:e=>{ht(e),Qe((e=>(0,o.A)((0,o.A)({},e),{},{description:void 0})))},onPaste:e=>{const t=e.clipboardData.getData("text"),r=ut(t);e.preventDefault();const n=(0,o.A)((0,o.A)({},e),{},{target:(0,o.A)((0,o.A)({},e.target),{},{value:(dt[e.target.name]||"")+" "+r,name:e.target.name})});ht(n)},descriptionError:Ge.description,sanitizedHintDescription:tt.description,isImprovingDescription:Ve,onAIStart:()=>Ye(!0),onAIImprove:e=>{pt((t=>(0,o.A)((0,o.A)({},t),{},{description:e}))),Ye(!1)},onAIError:()=>Ye(!1),descriptionRef:st})]}),(0,T.jsx)(zt,{onPrev:()=>E(1),onNext:()=>{(()=>{var e,t;const r={};return null!==(e=dt.name)&&void 0!==e&&e.trim()?dt.name.length>50&&(r.name=(0,C.t)("Le nom ne doit pas d\xe9passer 50 caract\xe8res")):r.name=(0,C.t)("Nommez votre annonce"),null!==(t=dt.description)&&void 0!==t&&t.trim()?dt.description.length<10&&(r.description=(0,C.t)("La description doit comporter au moins 10 caract\xe8res")):r.description=(0,C.t)("D\xe9crivez votre annonce"),Object.keys(r).length>0?(Qe(r),l.oR.error((0,C.t)("Veuillez corriger les champs obligatoires."),{position:"bottom-center",autoClose:3e3,theme:"colored"}),!1):(Qe({}),!0)})()&&E(3)},isPrevDisabled:!1,nextLabel:(0,C.t)("Suivant")})]}),3===k&&(0,T.jsxs)(vt,{stepTitle:(0,C.t)("Localisation & Badges"),stepTooltip:(0,C.t)("S\xe9lectionnez la ville et les badges \xe0 appliquer \xe0 votre annonce."),children:[(0,T.jsxs)(f.T,{spacing:Ct,align:"stretch",children:[(0,T.jsx)(nt,{selectedCity:ie,selectedSector:pe,onCitySelect:e=>{se(e);const t=F.find((t=>t.name===e));ce(t?t.id||t._id:""),et((e=>(0,o.A)((0,o.A)({},e),{},{city:void 0})))},onSectorSelect:e=>xe(e),cityError:Xe.city,cityRef:lt,locationValue:ge,onLocationChange:be,onLocationGeocode:()=>{}}),(0,T.jsx)(gt,{ad:dt,HandleChange:ht,handleBadgeChange:e=>{const{name:t,checked:r}=e.target;pt("isOnSale"===t?e=>(0,o.A)((0,o.A)({},e),{},{[t]:r,originalPrice:r?e.originalPrice||e.price:e.originalPrice,price:r?e.price:e.originalPrice||e.price,priceDisplay:r?e.priceDisplay:xt(e.originalPrice||e.price)}):e=>(0,o.A)((0,o.A)({},e),{},{[t]:r}))},initialBadgeState:Ee,onNewBadgeSelection:bt,selectedPaymentMethod:_e,setSelectedPaymentMethod:Oe,badgePricing:Ne,creditBalance:Te}),(0,T.jsx)(h.az,{borderRadius:"12px",border:"1px solid",borderColor:y,bg:m,px:{base:3,md:4},py:{base:2,md:3},children:(0,T.jsxs)(p.s,{align:"flex-start",gap:2,children:[(0,T.jsx)(x.I,{as:j.MJW,boxSize:{base:"14px",md:"16px"},color:c,mt:"2px",flexShrink:0}),(0,T.jsx)(u.E,{fontSize:{base:"11px",md:"12px"},color:b,lineHeight:"1.6",children:(0,C.t)("Pour modifier votre annonce, veuillez noter que les contenus \xe0 caract\xe8re sexuel, promotionnels de produits ill\xe9gaux ou dangereux, ou tout autre contenu consid\xe9r\xe9 comme inappropri\xe9 ne seront pas accept\xe9s. Nous nous r\xe9servons le droit de refuser ou de retirer toute annonce qui ne respecte pas nos r\xe8gles de publication. Merci de votre compr\xe9hension.")})]})})]}),(0,T.jsx)(zt,{onPrev:()=>E(2),onNext:async()=>
1{if(yt())try{const e=l.oR.info((0,C.t)("Traitement de votre annonce..."),{position:"top-center",autoClose:!1});await mt(),l.oR.dismiss(e),l.oR.success((0,C.t)("Votre annonce a \xe9t\xe9 mise \xe0 jour avec succ\xe8s et envoy\xe9e pour validation"),{position:"top-center",autoClose:3e3,theme:"colored"}),setTimeout((()=>t.push("/")),2e3)}catch(e){console.error("Error submitting form:",e),l.oR.error((0,C.t)("Une erreur est survenue lors de la mise \xe0 jour de l'annonce"))}},isPrevDisabled:!1,nextLabel:At?void 0:(0,C.t)("Mettre \xe0 jour l'annonce"),nextVariant:At?"outline":"solid",nextColorScheme:"purple",nextIcon:At?void 0:(0,T.jsx)(x.I,{as:j.ro0,boxSize:{base:"14px",md:"16px"}}),nextIsLoading:!At&&P,nextLoadingText:(0,C.t)("Traitement en cours..."),showPaymentButton:At,paymentProps:At?{colorScheme:"paypal"===_e?"blue":"credits"===_e?"green":"purple",onClick:()=>{yt()&&("paypal"===_e?(async()=>{try{W(!0);const e={isUrgent:Pe.badges.isUrgent||!1,isInLiquidation:Pe.badges.isInLiquidation||!1,isOnlinePurchase:Pe.badges.isOnlinePurchase||!1,isOnSale:Pe.badges.isOnSale||!1,originalPrice:Pe.badges.isOnSale?dt.originalPrice||dt.price:0,salePrice:Pe.badges.isOnSale&&dt.salePrice||0,discountPercentage:Pe.badges.isOnSale&&dt.discountPercentage||0},t=ft(e,Ne),o=await s.A.post("".concat("https://api.jindoo.ma/api/v1","/badges/paypal/update/create"),{adId:r,userId:U._id,badges:e,totalAmount:t},{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token")),"Content-Type":"application/json"}});if(!o.data.success||!o.data.approvalUrl)throw new Error("Failed to get PayPal approval URL");
1window.location.href=o.data.approvalUrl}catch(e){console.error("Error initiating PayPal payment:",e),W(!1),l.oR.error((0,C.t)("Erreur lors de l'initiation du paiement"))}})():"credits"===_e&&(async()=>{try{W(!0);const e={isUrgent:Pe.badges.isUrgent||!1,isInLiquidation:Pe.badges.isInLiquidation||!1,isOnlinePurchase:Pe.badges.isOnlinePurchase||!1,isOnSale:Pe.badges.isOnSale||!1,originalPrice:Pe.badges.isOnSale?dt.originalPrice||dt.price:0,salePrice:Pe.badges.isOnSale&&dt.salePrice||0,discountPercentage:Pe.badges.isOnSale&&dt.discountPercentage||0},n=ft(e,Ne);if(Te<n)return l.oR.error((0,C.t)("Cr\xe9dits insuffisants. Solde: ")+Te+(0,C.t)(" cr\xe9dits requis: ")+n),void W(!1);const a=await s.A.post("".concat("https://api.jindoo.ma/api/v1","/badges/payment/update/credit"),{adId:r,userId:U._id,badges:e,totalAmount:n},{headers:{Authorization:"Bearer ".concat(localStorage.getItem("token")),"Content-Type":"application/json"}});if(!a.data.success)throw new Error(a.data.message||"Credit payment failed");{const e=a.data.remainingCredits;Fe(e);const i=(0,o.A)((0,o.A)({},U),{},{credit:e});localStorage.setItem("user-token",JSON.stringify(i)),window.dispatchEvent(new CustomEvent("creditBalanceUpdated",{detail:{newBalance:e,transactionAmount:-n,transactionType:"badge_update",adId:r,timestamp:(new Date).toISOString()}})),l.oR.success((0,C.t)("Badges achet\xe9s avec succ\xe8s!")),setTimeout((()=>{t.push("/ad/updateAd/".concat(r)),window.location.reload()}),2e3)}}catch(e){console.error("Error processing credit payment:",e),l.oR.error((0,C.t)("Erreur lors du paiement par cr\xe9dits"))}finally{W(!1)}})())},isLoading:_,loadingText:(0,C.t)("Traitement..."),leftIcon:"paypal"===_e?(0,T.jsx)(S.SnG,{}):"credits"===_e?(0,T.jsx)(S.lcY,{}):(0,T.jsx)(S.x1c,{}),isDisabled:"credits"===_e&&"pro"===(null===U||void 0===U?void 0:U.ProPart)&&Te<((null===Pe||void 0===Pe?void 0:Pe.totalAmount)||0),label:"credits"===_e?(0,C.t)("Payer avec Cr\xe9dits et Mettre \xe0 j
1our"):(0,C.t)("Payer et Mettre \xe0 jour")}:void 0})]})]})}},1606:(e,t,r)=>{r.d(t,{A:()=>c});var o=r(65043),n=r(96391),a=r(10850),i=new Map;i.set("bold",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M92.5,124.8a83.6,83.6,0,0,0,39,38.9,8,8,0,0,0,7.9-.6l25-16.7a7.9,7.9,0,0,1,7.6-.7l46.8,20.1a7.9,7.9,0,0,1,4.8,8.3A48,48,0,0,1,176,216,136,136,0,0,1,40,80,48,48,0,0,1,81.9,32.4a7.9,7.9,0,0,1,8.3,4.8l20.1,46.9a8,8,0,0,1-.6,7.5L93,117A8,8,0,0,0,92.5,124.8Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"24"}))})),i.set("duotone",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M92.5,124.8a83.6,83.6,0,0,0,39,38.9,8,8,0,0,0,7.9-.6l25-16.7a7.9,7.9,0,0,1,7.6-.7l46.8,20.1a7.9,7.9,0,0,1,4.8,8.3A48,48,0,0,1,176,216,136,136,0,0,1,40,80,48,48,0,0,1,81.9,32.4a7.9,7.9,0,0,1,8.3,4.8l20.1,46.9a8,8,0,0,1-.6,7.5L93,117A8,8,0,0,0,92.5,124.8Z",opacity:"0.2"}),o.createElement("path",{d:"M92.5,124.8a83.6,83.6,0,0,0,39,38.9,8,8,0,0,0,7.9-.6l25-16.7a7.9,7.9,0,0,1,7.6-.7l46.8,20.1a7.9,7.9,0,0,1,4.8,8.3A48,48,0,0,1,176,216,136,136,0,0,1,40,80,48,48,0,0,1,81.9,32.4a7.9,7.9,0,0,1,8.3,4.8l20.1,46.9a8,8,0,0,1-.6,7.5L93,117A8,8,0,0,0,92.5,124.8Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}))})),i.set("fill",(function(){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M222,158.4l-46.9-20a15.6,15.6,0,0,0-15.1,1.3l-25.1,16.7a76.5,76.5,0,0,1-35.2-35h0L116.3,96a15.9,15.9,0,0,0,1.4-15.1L97.6,34a16.3,16.3,0,0,0-16.7-9.6A56.2,56.2,0,0,0,32,80c0,79.4,64.6,144,144,144a56.2,56.2,0,0,0,55.6-48.9A16.3,16.3,0,0,0,222,158.4Z"}))})),i.set("light",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M92.5,124.8a83.6,83.6,0,0,0,39,38.9,8,8,0,0,0,7.9-.6l25-16.7a7.9,7.9,0,0,1,7.6-.7l46.8,20.1a7.9,7.9,0,0,1,4.8,8.3A48,48,0,0,1,176,216,136,136,0,0,1,40,80,48,48,0,0,1,81.9,32.4a7.9,7.9,0,0,1,8.3,4.8l20.1,46.9a8,8,0,0,1-.6,7.5L93,117A8,8,0,0,0,92.5,124.8Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"12"}))})),i.set("thin",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M92.5,124.8a83.6,83.6,0,0,0,39,38.9,8,8,0,0,0,7.9-.6l25-16.7a7.9,7.9,0,0,1,7.6-.7l46.8,20.1a7.9,7.9,0,0,1,4.8,8.3A48,48,0,0,1,176,216,136,136,0,0,1,40,80,48,48,0,0,1,81.9,32.4a7.9,7.9,0,0,1,8.3,4.8l20.1,46.9a8,8,0,0,1-.6,7.5L93,117A8,8,0,0,0,92.5,124.8Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"8"}))})),i.set("regular",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M92.5,124.8a83.6,83.6,0,0,0,39,38.9,8,8,0,0,0,7.9-.6l25-16.7a7.9,7.9,0,0,1,7.6-.7l46.8,20.1a7.9,7.9,0,0,1,4.8,8.3A48,48,0,0,1,176,216,136,136,0,0,1,40,80,48,48,0,0,1,81.9,32.4a7.9,7.9,0,0,1,8.3,4.8l20.1,46.9a8,8,0,0,1-.6,7.5L93,117A8,8,0,0,0,92.5,124.8Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}))}));var s=function(e,t){return(0,n.$)(e,t,i)},l=(0,o.forwardRef)((function(e,t){return o.createElement(a.A,Object.assign({ref:t},e,{renderPath:s}))}));l.displayName="Phone";const c=l},99287:(e,t,r)=>{r.d(t,{A:()=>c});var o=r(65043),n=r(96391),a=r(10850),i=new Map;i.set("bold",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M45.4,177A95.9,95.9,0,1,1,79,210.6h0L45.8,220a7.9,7.9,0,0,1-9.8-9.8L45.4,177Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"24"}),o.createElement("path",{d:"M80,103.5A23.9,23.9,0,0,1,104,80h3.5a7.9,7.9,0,0,1,6.8,3.9l7.4,12.3a7.8,7.8,0,0,1,.3,7.7l-4.7,9.6h0a36,36,0,0,0,25.2,25.2h0l9.6-4.7a7.8,7.8,0,0,1,7.7.3l12.3,7.4a7.9,7.9,0,0,1,3.9,6.8V152a23.9,23.9,0,0,1-23.5,24A71.9,71.9,0,0,1,80,103.5Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"24"}))})),i.set("duotone",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M128,32A96.1,96.1,0,0,0,45.4,177h0L36,210.2a7.9,7.9,0,0,0,9.8,9.8L79,210.6h0A96,96,0,1,0,128,32Zm24.1,152A79.9,79.9,0,0,1,72,103.9,28,28,0,0,1,100,76h0a6.8,6.8,0,0,1,6,3.5l11.7,20.4a8.1,8.1,0,0,1-.1,8.1l-9.4,15.7h0a48,48,0,0,0,24.1,24.1h0l15.7-9.4a8.1,8.1,0,0,1,8.1-.1L176.5,150a6.8,6.8,0,0,1,3.5,6A28.1,28.1,0,0,1,152.1,184Z",opacity:"0.2"}),o.createElement("path",{d:"M45.4,177A95.9,95.9,0,1,1,79,210.6h0L45.8,220a7.9,7.9,0,0,1-9.8-9.8L45.4,177Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),o.createElement("path",{d:"M152.1,184A79.9,79.9,0,0,1,72,103.9,28,28,0,0,1,100,76h0a6.8,6.8,0,0,1,6,3.5l11.7,20.4a8.1,8.1,0,0,1-.1,8.1l-9.4,15.7h0a48,48,0,0,0,24.1,24.1h0l15.7-9.4a8.1,8.1,0,0,1,8.1-.1L176.5,150a6.8,6.8,0,0,1,3.5,6h0A28.1,28.1,0,0,1,152.1,184Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}))})),i.set("fill",(function(){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M128,24A104,104,0,0,0,36.8,178l-8.5,30A15.9,15.9,0,0,0,48,227.7l30-8.5A104,104,0,1,0,128,24Zm24.1,168H152a88.1,88.1,0,0,1-88-88.1A36,36,0,0,1,100,68a14.9,14.9,0,0,1,12.9,7.5L124.6,96a15.8,15.8,0,0,1-.2,16.1L117.3,124A41.4,41.4,0,0,0,132,138.7l11.9-7.1a15.8,15.8,0,0,1,16.1-.2l20.5,11.7A14.9,14.9,0,0,1,188,156,36,36,0,0,1,152.1,192Z"}),o.createElement("path",{d:"M136.5,154.7a8.1,8.1,0,0,1-7.4.4,55.4,55.4,0,0,1-28.2-28.2,8.1,8.1,0,0,1,.4-7.4l9.4-15.6L99.4,84A19.9,19.9,0,0,0,80,103.9,72,72,0,0,0,152,176h.1A19.9,19.9,0,0,0,172,156.6l-19.9-11.3Z"}))})),i.set("light",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M45.4,177A95.9,95.9,0,1,1,79,210.6h0L45.8,220a7.9,7.9,0,0,1-9.8-9.8L45.4,177Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"12"}),o.createElement("path",{d:"M152.1,184A79.9,79.9,0,0,1,72,103.9,28,28,0,0,1,100,76h0a6.8,6.8,0,0,1,6,3.5l11.7,20.4a8.1,8.1,0,0,1-.1,8.1l-9.4,15.7h0a48,48,0,0,0,24.1,24.1h0l15.7-9.4a8.1,8.1,0,0,1,8.1-.1L176.5,150a6.8,6.8,0,0,1,3.5,6h0A28.1,28.1,0,0,1,152.1,184Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"12"}))})),i.set("thin",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M45.4,177A95.9,95.9,0,1,1,79,210.6h0L45.8,220a7.9,7.9,0,0,1-9.8-9.8L45.4,177Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"8"}),o.createElement("path",{d:"M152.1,184A79.9,79.9,0,0,1,72,103.9,28,28,0,0,1,100,76h0a6.8,6.8,0,0,1,6,3.5l11.7,20.4a8.1,8.1,0,0,1-.1,8.1l-9.4,15.7h0a48,48,0,0,0,24.1,24.1h0l15.7-9.4a8.1,8.1,0,0,1,8.1-.1L176.5,150a6.8,6.8,0,0,1,3.5,6h0A28.1,28.1,0,0,1,152.1,184Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"8"}))})),i.set("regular",(function(e){return o.createElement(o.Fragment,null,o.createElement("path",{d:"M45.4,177A95.9,95.9,0,1,1,79,210.6h0L45.8,220a7.9,7.9,0,0,1-9.8-9.8L45.4,177Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),o.createElement("path",{d:"M152.1,184A79.9,79.9,0,0,1,72,103.9,28,28,0,0,1,100,76h0a6.8,6.8,0,0,1,6,3.5l11.7,20.4a8.1,8.1,0,0,1-.1,8.1l-9.4,15.7h0a48,48,0,0,0,24.1,24.1h0l15.7-9.4a8.1,8.1,0,0,1,8.1-.1L176.5,150a6.8,6.8,0,0,1,3.5,6h0A28.1,28.1,0,0,1,152.1,184Z",fill:"none",stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}))}));var s=function(e,t){return(0,n.$)(e,t,i)},l=(0,o.forwardRef)((function(e,t){return o.createElement(a.A,Object.assign({ref:t},e,{renderPath:s}))}));l.displayName="WhatsappLogo";const c=l},75454:(e,t,r)=>{r.d(t,{L:()=>a,a:()=>n});var o=r(67852),[n,a]=(0,o.q)({name:"CheckboxGroupContext",strict:!1})},12733:(e,t,r)=>{r.d(t,{W:()=>o});const o=(0,r(96670).w)({d:"M23.384,21.619,16.855,15.09a9.284,9.284,0,1,0-1.768,1.768l6.529,6.529a1.266,1.266,0,0,0,1.768,0A1.251,1.251,0,0,0,23.384,21.619ZM2.75,9.5a6.75,6.75,0,1,1,6.75,6.75A6.758,6.758,0,0,1,2.75,9.5Z",displayName:"SearchIcon"})},40230:(e,t,r)=>{r.d(t,{r:()=>l});var o=r(89379),n=r(80045),a=r(74449),i=r(70579);const s=["htmlWidth","htmlHeight","alt"];var l=(0,a.R)((function(e,t){const{htmlWidth:r,htmlHeight:a,alt:l}=e,c=(0,n.A)(e,s);return(0,i.jsx)("img",(0,o.A)({width:r,height:a,ref:t,alt:l},c))}
1));l.displayName="NativeImage"},1183:(e,t,r)=>{r.d(t,{_:()=>p});var o=r(89379),n=r(80045),a=r(40230),i=r(80648),s=r(74449),l=r(64872),c=r(70579);const d=["fallbackSrc","fallback","src","srcSet","align","fit","loading","ignoreFallback","crossOrigin","fallbackStrategy","referrerPolicy"];var p=(0,s.R)((function(e,t){const{fallbackSrc:r,fallback:s,src:p,srcSet:x,align:u,fit:h,loading:g,ignoreFallback:b,crossOrigin:m,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:y}=e,j=(0,n.A)(e,d),S=null!=g||b||!(void 0!==r||void 0!==s),v=(0,i.l)((0,o.A)((0,o.A)({},e),{},{crossOrigin:m,ignoreFallback:S})),z=(0,i.m)(v,f),w=(0,o.A)({ref:t,objectFit:h,objectPosition:u},S?j:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=Object.assign({},e);for(const o of t)o in r&&delete r[o];return r}(j,["onError","onLoad"]));return z?s||(0,c.jsx)(l.B.img,(0,o.A)({as:a.r,className:"chakra-image__placeholder",src:r},w)):(0,c.jsx)(l.B.img,(0,o.A)({as:a.r,src:p,srcSet:x,crossOrigin:m,loading:g,referrerPolicy:y,className:"chakra-image"},w))}));p.displayName="Image"},67634:(e,t,r)=>{r.d(t,{z:()=>g});var o=r(89379),n=r(80045),a=r(1777),i=r(60711),s=r(65459),l=r(89254),c=r(64872),d=r(74449),p=r(20754),x=r(70579);const u=["className","children","motionProps","containerProps"];var h=(0,c.B)(p.q),g=(0,d.R)(((e,t)=>{const{className:r,children:d,motionProps:p,containerProps:g}=e,b=(0,n.A)(e,u),{getDialogProps:m,getDialogContainerProps:f,isOpen:y}=(0,s.k3)(),j=m(b,t),S=f(g),v=(0,l.cx)("chakra-modal__content",r),z=(0,s.x5)(),w=(0,o.A)({display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0},z.dialog),C=(0,o.A)({display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0},z.dialogContainer),{placement:A}=(0,a.g)();return(0,x.jsx)(i.u,{children:(0,x.jsx)(c.B.div,(0,o.A)((0,o.A)({},S),{},{className:"chakra-modal__content-container",__css:C,children:(0,x.jsx)(h,(0,o.A)((0,o.A)({motionProps:p,direction:A,in:y,className:v},j),{},{__css:w,children:d}))}))})}));g.displayName="DrawerContent"},1777:(e,t,r)=>{r.d(t,{_:()=>u,g:()=>p});var o=r(89379),n=r(80045),a=r(65459),i=r(67852),s=r(58426),l=r(70579);const c=["isOpen","onClose","placement","children"];var[d,p]=(0,i.q)(),x={start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}};function u(e){var t;const{isOpen:r,onClose:i,placement:p="right",children:u}=e,h=(0,n.A)(e,c),g=(0,s.D)(),b=null==(t=g.components)?void 0:t.Drawer,m=function(e,t){var r,o;if(e)return null!=(o=null==(r=x[e])?void 0:r[t])?o:e}(p,g.direction);return(0,l.jsx)(d,{value:{placement:m},children:(0,l.jsx)(a.aF,(0,o.A)((0,o.A)({isOpen:r,onClose:i,styleConfig:b},h),{},{children:u}))})}},82185:(e,t,r)=>{r.d(t,{r:()=>x});var o=r(89379),n=r(80045),a=r(65459),i=r(89254),s=r(74449),l=r(64872),c=r(65043),d=r(70579);const p=["className"];var x=(0,s.R)(((e,t)=>{const{className:r}=e,s=(0,n.A)(e,p),{headerId:x,setHeaderMounted:u}=(0,a.k3)();(0,c.useEffect)((()=>(u(!0),()=>u(!1))),[u]);const h=(0,i.cx)("chakra-modal__header",r),g=(0,a.x5)(),b=(0,o.A)({flex:0},g.header);return(0,d.jsx)(l.B.header,(0,o.A)((0,o.A)({ref:t,className:h,id:x},s),{},{__css:b}))}));x.displayName="ModalHeader"},60047:(e,t,r)=>{r.d(t,{j:()=>p});var o=r(89379),n=r(80045),a=r(65459),i=r(89254),s=r(74449),l=r(64872),c=r(70579);const d=["className"];var p=(0,s.R)(((e,t)=>{const{className:r}=e,s=(0,n.A)(e,d),p=(0,i.cx)("chakra-modal__footer",r),x=(0,a.x5)(),u=(0,o.A)({display:"flex",alignItems:"center",justifyContent:"flex-end"},x.footer);return(0,c.jsx)(l.B.footer,(0,o.A)((0,o.A)({ref:t},s),{},{__css:u,className:p}))}));p.displayName="ModalFooter"},79523:(e,t,r)=>{r.d(t,{d:()=>h});var o=r(89379),n=r(80045),a=r(39805),i=r(74449),s=r(27566),l=r(45089),c=r(64872),d=r(89254),p=r(65043),x=r(70579);const u=["spacing","children"];var h=(0,i.R)((function(e,t){const r=(0,s.o5)("Switch",e),i=(0,l.MN)(e),{spacing:h="0.5rem",children:g}=i,b=(0,n.A)(i,u),{state:m,getInputProps:f,getCheckboxProps:y,getRootProps:j,getLabelProps:S}=(0,a.v)(b),v=(0,p.useMemo)((()=>(0,o.A)({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0},r.container)),[r.container]),z=(0,p.useMemo)((()=>
1(0,o.A)({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer"},r.track)),[r.track]),w=(0,p.useMemo)((()=>(0,o.A)({userSelect:"none",marginStart:h},r.label)),[h,r.label]);return(0,x.jsxs)(c.B.label,(0,o.A)((0,o.A)({},j()),{},{className:(0,d.cx)("chakra-switch",e.className),__css:v,children:[(0,x.jsx)("input",(0,o.A)({className:"chakra-switch__input"},f({},t))),(0,x.jsx)(c.B.span,(0,o.A)((0,o.A)({},y()),{},{className:"chakra-switch__track",__css:z,children:(0,x.jsx)(c.B.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":(0,d.sE)(m.isChecked),"data-hover":(0,d.sE)(m.isHovered)})})),g&&(0,x.jsx)(c.B.span,(0,o.A)((0,o.A)({className:"chakra-switch__label"},S()),{},{__css:w,children:g}))]}))}));h.displayName="Switch"},20754:(e,t,r)=>{r.d(t,{q:()=>h});var o=r(80045),n=r(89379),a=r(25750),i=r(89254),s=r(82752),l=r(69066),c=r(65043),d=r(70579);const p=["direction","style","unmountOnExit","in","className","transition","transitionEnd","delay","motionProps"];var x={exit:{duration:.15,ease:a.xf.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},u={exit:e=>{let{direction:t,transition:r,transitionEnd:o,delay:i}=e;var s;const{exit:l}=(0,a.Jv)({direction:t});return(0,n.A)((0,n.A)({},l),{},{transition:null!=(s=null==r?void 0:r.exit)?s:a.yA.exit(x.exit,i),transitionEnd:null==o?void 0:o.exit})},enter:e=>{let{direction:t,transitionEnd:r,transition:o,delay:i}=e;var s;const{enter:l}=(0,a.Jv)({direction:t});return(0,n.A)((0,n.A)({},l),{},{transition:null!=(s=null==o?void 0:o.enter)?s:a.yA.enter(x.enter,i),transitionEnd:null==r?void 0:r.enter})}},h=(0,c.forwardRef)((function(e,t){const{direction:r="right",style:c,unmountOnExit:x,in:h,className:g,transition:b,transitionEnd:m,delay:f,motionProps:y}=e,j=(0,o.A)(e,p),S=(0,a.Jv)({direction:r}),v=Object.assign({position:"fixed"},S.position,c),z=!x||h&&x,w=h||x?"enter":"exit",C={transitionEnd:m,transition:b,direction:r,delay:f};return(0,d.jsx)(s.N,{custom:C,children:z&&(0,d.jsx)(l.P.div,(0,n.A)((0,n.A)({},j),{},{ref:t,initial:"exit",className:(0,i.cx)("chakra-slide",g),animate:w,exit:"exit",custom:C,variants:u,style:v},y))})}));h.displayName="Slide"},36575:(e,t,r)=>{r.d(t,{S:()=>h});var o=r(80045),n=r(89379),a=r(25750),i=r(89254),s=r(82752),l=r(69066),c=r(65043),d=r(70579);const p=["in","unmountOnExit","animateOpacity","startingHeight","endingHeight","style","className","transition","transitionEnd"];var x={exit:{height:{duration:.2,ease:a.xf.ease},opacity:{duration:.3,ease:a.xf.ease}},enter:{height:{duration:.3,ease:a.xf.ease},opacity:{duration:.4,ease:a.xf.ease}}},u={exit:e=>{let{animateOpacity:t,startingHeight:r,transition:o,transitionEnd:i,delay:s}=e;var l,c;return(0,n.A)((0,n.A)({},t&&{opacity:(c=r,null!=c&&parseInt(c.toString(),10)>0?1:0)}),{},{height:r,transitionEnd:null==i?void 0:i.exit,transition:null!=(l=null==o?void 0:o.exit)?l:a.yA.exit(x.exit,s)})},enter:e=>{let{animateOpacity:t,endingHeight:r,transition:o,transitionEnd:i,delay:s}=e;var l;return(0,n.A)((0,n.A)({},t&&{opacity:1}),{},{height:r,transitionEnd:null==i?void 0:i.enter,transition:null!=(l=null==o?void 0:o.enter)?l:a.yA.enter(x.enter,s)})}},h=(0,c.forwardRef)(((e,t)=>{const{in:r,unmountOnExit:a,animateOpacity:x=!0,startingHeight:h=0,endingHeight:g="auto",style:b,className:m,transition:f,transitionEnd:y}=e,j=(0,o.A)(e,p),[S,v]=(0,c.useState)(!1);(0,c.useEffect)((()=>{const e=setTimeout((()=>{v(!0)}));return()=>clearTimeout(e)}),[]),(0,i.R8)({condition:Number(h)>0&&!!a,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const z=parseFloat(h.toString())>0,w={startingHeight:h,endingHeight:g,animateOpacity:x,transition:S?f:{enter:{duration:0}},transitionEnd:{enter:null==y?void 0:y.enter,exit:a?null==y?void 0:y.exit:(0,n.A)((0,n.A)({},null==y?void 0:y.exit),{},{display:z?"block":"none"})}},C=!a||r,A=r||a?"enter":"exit";return(0,d.jsx)(s.N,{initial:!1,custom:w,children:C&&(0,d.jsx)(l.P.div,(0,n.A)((0,n.A)({ref:t},j),{},{className:(0,i.cx)("chakra-collapse",m),style:(0,n.A)({overflow:"hidden",display:"block"},b),custom:w,variants:u,initial:!!a&&"exit",animate:A,exit:"exit"}))})}));h.displayName="Collapse"}}]);
2//# sourceMappingURL=2815.9282c4fa.chunk.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.