@cloudparse/up-miniapps-sdk 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -853,7 +853,7 @@ Error generating stack: `+f.message+`
853
853
  .no-scrollbar::-webkit-scrollbar {
854
854
  display: none;
855
855
  }
856
- `}),(0,Ft.jsx)("div",{className:`absolute inset-0 bg-black/45 backdrop-blur-[1px] transition-opacity duration-300 z-30 ${Kt}`,onClick:()=>u("closed")}),f==="left"?(0,Ft.jsxs)(Ft.Fragment,{children:[i==="closed"&&(0,Ft.jsx)(Na,{className:"absolute top-4 left-4 z-40 w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer hover:bg-zinc-900 hover:text-white p-0!",onClick:()=>u("full"),variant:"ghost",children:(0,Ft.jsxs)("svg",{fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,Ft.jsx)("line",{x1:"4",x2:"20",y1:"12",y2:"12"}),(0,Ft.jsx)("line",{x1:"4",x2:"20",y1:"6",y2:"6"}),(0,Ft.jsx)("line",{x1:"4",x2:"20",y1:"18",y2:"18"})]})}),(0,Ft.jsx)(j5,{onOpenChange:yt=>u(yt?"full":"closed"),open:i!=="closed",children:(0,Ft.jsxs)(cv,{className:"w-80 bg-zinc-950/85 backdrop-blur-md border-r border-y border-white/10 rounded-r-2xl shadow-2xl p-4 text-white flex flex-col h-full overflow-hidden",portal:!1,side:"left",children:[(0,Ft.jsx)(dv,{className:"pb-3 border-b border-white/10 mb-2 text-left",children:(0,Ft.jsx)(fv,{className:"text-sm font-bold tracking-wider text-zinc-400 uppercase",children:"Menu"})}),(0,Ft.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar pr-2",onScroll:Ue,ref:H,children:he||(0,Ft.jsx)("div",{className:"flex flex-col gap-1.5",children:a.map(yt=>(0,Ft.jsxs)(Na,{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${yt.disabled?"opacity-45 cursor-not-allowed pointer-events-none":""}`,disabled:yt.disabled,onClick:()=>{yt.disabled||(yt.onPress(),u("closed"))},variant:"ghost",children:[(0,Ft.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[yt.icon,yt.badge!==void 0&&(0,Ft.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:yt.badge})]}),(0,Ft.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:yt.label})]},yt.id))})}),_e&&tt&&(0,Ft.jsx)(Na,{className:"absolute bottom-6 right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black hover:text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer p-0!",onClick:()=>{H.current?.scrollTo({behavior:"smooth",top:0})},variant:"ghost",children:(0,Ft.jsx)("svg",{fill:"none",height:"20",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Ft.jsx)("polyline",{points:"18 15 12 9 6 15"})})})]})})]}):(0,Ft.jsxs)("div",{className:`absolute w-full bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-t-2xl shadow-2xl flex flex-col z-40 select-none ${Q?"transition-none":"transition-transform duration-300 ease-out"}`,ref:oe,style:{bottom:"0px",height:`${i==="auto"?Math.max(qt,ao):qt}px`,marginBottom:i==="closed"?`${Re.bottom}px`:"0px",transform:Or(),transition:Q?"none":"transform 300ms ease-out, height 300ms ease-out, margin-bottom 250ms ease-in-out"},children:[ee&&(0,Ft.jsx)("div",{className:"w-full h-8 flex flex-col items-center justify-center cursor-pointer hover:bg-white/5 rounded-t-2xl transition-colors border-b border-white/5",onClick:()=>{at.current||$e()},ref:ge,children:(0,Ft.jsx)("div",{className:"w-12 h-1 bg-white/25 rounded-full"})}),(0,Ft.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden px-4 pb-4 pt-2 transition-[margin-top] duration-250 ease-in-out relative",ref:De,style:{marginTop:i==="closed"?`${Re.bottom}px`:"0px"},children:[(0,Ft.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar",onScroll:Ue,ref:H,style:{paddingBottom:i==="peek"?`${$r}px`:"0px"},children:he||(0,Ft.jsx)("div",{className:"flex flex-col gap-1",children:a.map(yt=>(0,Ft.jsxs)(Na,{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${yt.disabled?"opacity-45 cursor-not-allowed pointer-events-none":""}`,disabled:yt.disabled,onClick:()=>{yt.disabled||(yt.onPress(),u("closed"))},variant:"ghost",children:[(0,Ft.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[yt.icon,yt.badge!==void 0&&(0,Ft.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:yt.badge})]}),(0,Ft.jsx)("span",{className:"text-sm font-medium tracking-wide",children:yt.label})]},yt.id))})}),_e&&tt&&(0,Ft.jsx)(Na,{className:"absolute right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black hover:text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer p-0!",onClick:()=>{H.current?.scrollTo({behavior:"smooth",top:0})},style:{bottom:i==="peek"?`calc(${24+$r}px + var(--drag-offset, 0px))`:"calc(24px + var(--drag-offset, 0px))"},variant:"ghost",children:(0,Ft.jsx)("svg",{fill:"none",height:"20",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Ft.jsx)("polyline",{points:"18 15 12 9 6 15"})})})]})]})]})});var fc=Be(ut(),1),hc=Be(It(),1),Y0=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("rounded-lg border bg-card text-card-foreground shadow-sm",a),ref:u,...i}));Y0.displayName="Card";var AD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("flex flex-col space-y-1.5 p-6",a),ref:u,...i}));AD.displayName="CardHeader";var PD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("text-2xl font-semibold leading-none tracking-tight",a),ref:u,...i}));PD.displayName="CardTitle";var RD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("text-sm text-muted-foreground",a),ref:u,...i}));RD.displayName="CardDescription";var K0=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("p-6 pt-0",a),ref:u,...i}));K0.displayName="CardContent";var DD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("flex items-center p-6 pt-0",a),ref:u,...i}));DD.displayName="CardFooter";var pt=Be(It(),1),Z5=({etaData:a,layoutMode:i,onHeaderClick:u,style:f,isDragging:m=!1})=>i==="closed-banner"?(0,pt.jsxs)("div",{className:"w-full h-10 flex items-center justify-between px-4 pb-2 pt-1 border-b border-white/5 bg-zinc-950/15 relative overflow-hidden",children:[(0,pt.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer flex-1",onClick:u,children:[(0,pt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,pt.jsxs)("span",{className:"text-xs font-bold text-emerald-400",children:[a.etaMins," min (",a.distanceRemainingKm.toFixed(1)," km)"]})]}),a.onAbort&&(0,pt.jsx)(Na,{className:"px-1 py-1 text-[10px] font-black bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/25 active:scale-95 rounded-md transition-all cursor-pointer pointer-events-auto h-auto p-0!",onClick:s=>{s.stopPropagation(),a.onAbort?.()},variant:"ghost",children:(0,pt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,pt.jsx)("path",{d:"M18 6 6 18"}),(0,pt.jsx)("path",{d:"m6 6 12 12"})]})}),a.progress!==void 0&&(0,pt.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-white/5",children:(0,pt.jsx)("div",{className:"h-full bg-cyan-400",style:{width:`${a.progress}%`}})})]}):i==="open-card"?(0,pt.jsxs)(Y0,{className:"mx-4 mt-2 p-4 bg-white/5 border border-white/10 rounded-xl flex flex-col text-card-foreground",children:[(0,pt.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,pt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,pt.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:a.label||"Journey Active"})]}),a.onAbort&&(0,pt.jsx)(Na,{className:"px-1 py-1 text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer pointer-events-auto h-auto p-0!",onClick:a.onAbort,variant:"ghost",children:(0,pt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,pt.jsx)("path",{d:"M18 6 6 18"}),(0,pt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,pt.jsxs)(K0,{className:"p-0 flex flex-col",children:[(0,pt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-1.5 mb-2.5",children:[(0,pt.jsxs)("div",{className:"text-center",children:[(0,pt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[a.etaMins,(0,pt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" min"})]}),(0,pt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Time Remaining"})]}),(0,pt.jsxs)("div",{className:"text-center",children:[(0,pt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[a.distanceRemainingKm.toFixed(1),(0,pt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" km"})]}),(0,pt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Distance Remaining"})]})]}),a.progress!==void 0&&(0,pt.jsxs)("div",{className:"mb-3",children:[(0,pt.jsxs)("div",{className:"flex justify-between text-[9px] font-bold text-zinc-400 mb-1",children:[(0,pt.jsx)("span",{children:"Progress"}),(0,pt.jsxs)("span",{children:[Math.round(a.progress),"%"]})]}),(0,pt.jsx)("div",{className:"h-1 bg-white/10 rounded-full overflow-hidden",children:(0,pt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${a.progress}%`}})})]}),a.mode==="preview"&&a.onStart&&(0,pt.jsx)(Na,{className:"w-full py-2.5 text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 hover:text-black active:scale-95 rounded-lg transition-all cursor-pointer h-auto",onClick:a.onStart,variant:"ghost",children:"Start Guidance"})]})]}):(0,pt.jsxs)(Y0,{className:`absolute left-1/2 -translate-x-1/2 z-40 w-[calc(100%-2rem)] max-w-[320px] sm:max-w-[380px] bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-2xl shadow-2xl p-3 sm:p-4 flex flex-col pointer-events-auto select-none text-card-foreground ${m?"transition-none":"transition-all duration-300 ease-out"}`,style:f,children:[(0,pt.jsxs)("div",{className:"flex items-center justify-between mb-2 sm:mb-3",children:[(0,pt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pt.jsx)("span",{className:"w-1.5 h-1.5 sm:w-2 sm:h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,pt.jsx)("span",{className:"text-[9px] sm:text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:a.label||"Guidance Active"})]}),a.onAbort&&(0,pt.jsx)(Na,{className:"px-1 py-1 text-[10px] sm:text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer h-auto p-0!",onClick:a.onAbort,variant:"ghost",children:(0,pt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,pt.jsx)("path",{d:"M18 6 6 18"}),(0,pt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,pt.jsxs)(K0,{className:"p-0 flex flex-col",children:[(0,pt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-0.5 sm:py-1 mb-2 sm:mb-3",children:[(0,pt.jsx)("div",{className:"text-center",children:(0,pt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[a.etaMins,(0,pt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","min"]})]})}),(0,pt.jsx)("div",{className:"text-center",children:(0,pt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[a.distanceRemainingKm.toFixed(1),(0,pt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","km"]})]})})]}),a.progress!==void 0&&(0,pt.jsxs)("div",{children:[(0,pt.jsxs)("div",{className:"flex justify-between text-[8px] sm:text-[9px] font-bold text-zinc-400 mb-1",children:[(0,pt.jsx)("span",{children:"Progress"}),(0,pt.jsxs)("span",{children:[Math.round(a.progress),"%"]})]}),(0,pt.jsx)("div",{className:"h-1 sm:h-1.5 bg-white/10 rounded-full overflow-hidden",children:(0,pt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${a.progress}%`}})})]}),a.mode==="preview"&&a.onStart&&(0,pt.jsx)(Na,{className:"mt-2.5 sm:mt-3 py-1.5 sm:py-2 text-[11px] sm:text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 hover:text-black active:scale-95 rounded-lg transition-all cursor-pointer h-auto",onClick:a.onStart,variant:"ghost",children:"Start Guidance"})]})]});var Jt=Be(It(),1),X5=({customControls:a=[],etaBarHeight:i,onRecenter:u,isMapCentered:f,mapBearing:m,mapPitch:s,onResetBearing:I,initialViewState:D,drawerState:U,side:V,etaData:Q,isDragging:K,clampedDragOffset:te,customRecenterButton:$,customCompassButton:Ce,drawerPeekHeight:ye,insets:he={bottom:0,left:0,right:0,top:0},bottomOffset:le=0})=>{let ee=a.filter(ge=>ge.position==="above-recenter"),de=a.filter(ge=>ge.position==="below-recenter"),_e=Math.abs(m)>=.5||Math.abs(s)>=.5,Ae="32px",Re=Q?i:U==="closed"?he.bottom:0,Z=typeof ye=="number"?`${ye}px`:ye||"15%",H=V==="bottom"?U==="closed"?`calc(${Ae} + 1rem + ${Re}px + ${le}px - var(--drag-offset, 0px))`:`calc(${Z} + 1rem + ${Q?i:0}px + ${le}px - var(--drag-offset, 0px))`:`calc(1rem + ${he.bottom}px + ${le}px)`;return(0,Jt.jsxs)("div",{className:`absolute right-4 z-30 flex flex-col items-center gap-3 select-none pointer-events-none ${K?"transition-none":"transition-all duration-300 ease-out"} ${V!=="bottom"||U!=="full"?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-75 pointer-events-none"}`,style:{bottom:H},children:[ee.length>0&&(0,Jt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:ee.map(ge=>(0,Jt.jsxs)("div",{className:"relative group flex items-center",children:[ge.tooltip&&(0,Jt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ge.tooltip}),(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer p-0! hover:bg-zinc-900 hover:text-white ${ge.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":""}`,onClick:ge.onPress,variant:"ghost",children:ge.icon})]},ge.id))}),_e&&(Ce?(0,Jt.jsx)("div",{className:"pointer-events-auto",children:Ce}):(0,Jt.jsx)("div",{className:"pointer-events-auto",children:(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all duration-300 p-0! hover:bg-zinc-900 hover:text-white ${_e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none h-0 w-0 border-none m-0 p-0 overflow-hidden"}`,onClick:()=>I({pitch:D?.pitch??0}),style:{transform:_e?"scale(1) rotate(0deg)":"scale(0.7) rotate(0deg)"},title:"Reset bearing to North",variant:"ghost",children:(0,Jt.jsxs)("svg",{className:"w-7 h-7 transition-transform duration-75 ease-out",fill:"none",style:{transform:`rotate(${-m}deg)`},viewBox:"0 0 24 24",children:[(0,Jt.jsx)("circle",{cx:"12",cy:"12",r:"9.5",stroke:"white",strokeOpacity:"0.2",strokeWidth:"1"}),(0,Jt.jsx)("path",{d:"M12 4.5L15 12H9L12 4.5Z",fill:"#ef4444"}),(0,Jt.jsx)("path",{d:"M12 19.5L9 12H15L12 19.5Z",fill:"#f4f4f5"}),(0,Jt.jsx)("circle",{cx:"12",cy:"12",fill:"#18181b",r:"1.5"})]})})})),$?(0,Jt.jsx)("div",{className:"pointer-events-auto",children:$}):(0,Jt.jsx)("div",{className:"pointer-events-auto",children:(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer p-0! hover:bg-zinc-900 hover:text-white ${f?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":""}`,onClick:()=>u(),title:"Recenter Map",variant:"ghost",children:f?(0,Jt.jsxs)("svg",{className:"w-6 h-6 text-cyan-400",fill:"none",stroke:"currentColor",strokeWidth:"2.2",viewBox:"0 0 24 24",children:[(0,Jt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,Jt.jsx)("circle",{cx:"12",cy:"12",fill:"currentColor",r:"3"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,Jt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,Jt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]}):(0,Jt.jsxs)("svg",{className:"w-6 h-6 text-zinc-300",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,Jt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,Jt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,Jt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]})})}),de.length>0&&(0,Jt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:de.map(ge=>(0,Jt.jsxs)("div",{className:"relative group flex items-center",children:[ge.tooltip&&(0,Jt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ge.tooltip}),(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer p-0! hover:bg-zinc-900 hover:text-white ${ge.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":""}`,onClick:ge.onPress,variant:"ghost",children:ge.icon})]},ge.id))})]})};var ra=Be(ut(),1),W5=Be(It(),1),$n=(0,ra.createContext)(null),pv=({children:a})=>{let[i,u]=(0,ra.useState)(!0),[f,m]=(0,ra.useState)(0),[s,I]=(0,ra.useState)(0),[D,U]=(0,ra.useState)("closed"),V=(0,ra.useRef)(null),Q=(0,ra.useCallback)(He=>{U(He)},[]),[K,te]=(0,ra.useState)(!0),$=(0,ra.useCallback)(He=>{te(Oe=>Oe===He?Oe:He)},[]),[Ce,ye]=(0,ra.useState)(!1),he=(0,ra.useCallback)(He=>{ye(Oe=>Oe===He?Oe:He)},[]),[le,ee]=(0,ra.useState)(void 0),de=(0,ra.useCallback)(He=>{ee(Oe=>!Oe&&!He?Oe:!Oe||!He?He:Oe.etaMins===He.etaMins&&Oe.distanceRemainingKm===He.distanceRemainingKm&&Oe.label===He.label&&Oe.progress===He.progress&&Oe.mode===He.mode&&Oe.isCalculating===He.isCalculating&&Oe.error===He.error?Oe:He)},[]),[_e,Ae]=(0,ra.useState)({bottom:0,left:0,right:0,top:0}),Re=(0,ra.useCallback)(He=>{Ae(Oe=>({...Oe,...He}))},[]),Z=(0,ra.useRef)(null),H=(0,ra.useRef)(null),oe=(0,ra.useRef)(null),ge=(0,ra.useCallback)(He=>{Z.current&&Z.current(He)},[]),De=(0,ra.useCallback)(He=>{H.current&&H.current(He)},[]),$e=(0,ra.useCallback)((He,Oe)=>{oe.current&&oe.current(He,Oe)},[]),Ve=(0,ra.useCallback)(He=>{Z.current=He},[]),rt=(0,ra.useCallback)(He=>{H.current=He},[]),je=(0,ra.useCallback)(He=>{oe.current=He},[]),tt=(0,ra.useCallback)(He=>{m(He)},[]),ze=(0,ra.useCallback)(He=>{I(He)},[]),Ue=(0,ra.useMemo)(()=>({_registerCenterCallback:Ve,_registerFlyToCallback:je,_registerResetBearingCallback:rt,bearing:f,centerOnUser:ge,drawerContentRef:V,drawerHandleVisible:K,drawerState:D,etaData:le,flyTo:$e,hasControls:Ce,insets:_e,isFollowing:i,pitch:s,resetBearing:De,setBearing:tt,setDrawerHandleVisible:$,setDrawerState:Q,setEtaData:de,setHasControls:he,setInsets:Re,setIsFollowing:u,setPitch:ze}),[Ve,je,rt,f,ge,K,D,le,$e,Ce,i,s,De,tt,$,Q,de,he,ze,_e,Re]);return(0,W5.jsx)($n.Provider,{value:Ue,children:a})},kD=()=>{let a=(0,ra.useContext)($n);if(!a)throw new Error("useMapControls must be used within a MapControlsProvider");return a};var Hr=Be(ut(),1),Os=Be(It(),1),mv=(a,i)=>typeof a=="number"?a:a.endsWith("%")?parseFloat(a)/100*i:parseFloat(a),gv=({menuItems:a=[],drawerSide:i,customControls:u=[],etaBarHeight:f=100,onRecenter:m,isMapCentered:s,mapBearing:I,onResetBearing:D,etaData:U,customRecenterButton:V,defaultState:Q,initialViewState:K,customCompassButton:te,drawerPeekHeight:$,drawerFullHeight:Ce,drawerAutoMaxHeight:ye,drawerContentRef:he,menuContent:le,children:ee,enableTouchDrag:de=!1,showScrollToTopButton:_e=!0,scrollToTopThreshold:Ae=300,controlsBottomOffset:Re=0,isInternal:Z=!1})=>{let H=(0,Hr.useContext)($n),oe=H?.drawerContentRef,ge=(0,Hr.useCallback)(At=>{he&&(typeof he=="function"?he(At):he.current=At),oe&&(oe.current=At)},[he,oe]),[De,$e]=(0,Hr.useState)(Q??"closed"),Ve=H?H.drawerState:De,rt=(0,Hr.useCallback)(At=>{H?H.setDrawerState(At):$e(At)},[H]);(0,Hr.useEffect)(()=>{Q&&H&&H.setDrawerState(Q)},[]);let[je,tt]=(0,Hr.useState)("left"),ze=(0,Hr.useRef)(null),[Ue,He]=(0,Hr.useState)(600);(0,Hr.useEffect)(()=>{let At=ze.current?.parentElement;if(!At)return;let hr=()=>{He(At.getBoundingClientRect().height)};hr();let Yr=new ResizeObserver(hr);return Yr.observe(At),()=>{Yr.disconnect()}},[]);let Oe=H?.setHasControls;(0,Hr.useEffect)(()=>{if(Oe&&!Z)return Oe(!0),()=>Oe(!1)},[Oe,Z]);let Wt=s!==void 0?s:H?H.isFollowing:!0,ca=I!==void 0?I:H?H.bearing:0,at=At=>{m?m(At):H&&H.centerOnUser(At)},ot=At=>{D?D(At):H&&H.resetBearing(At)},Ye=H?H.pitch:0,it=U!==void 0?U:H?.etaData,[mt,ia]=(0,Hr.useState)(null),[gt,Rt]=(0,Hr.useState)(null),[st,Kt]=(0,Hr.useState)(0);(0,Hr.useEffect)(()=>{if(typeof window>"u")return;let At=()=>{i?tt(i):window.innerWidth<768?tt("bottom"):tt("left")};return At(),window.addEventListener("resize",At),()=>window.removeEventListener("resize",At)},[i]);let Gt=mt!==null&&gt!==null,qt=Gt?gt-mt:0,Bt=mv(Ce||"85%",Ue),ma=mv($||"15%",Ue),$r=mv(ye||"100%",Ue),ao=Math.min($r,st),Ui=H?.insets.bottom||0,Or=H?H.drawerHandleVisible:!0,yt=(Or?32:0)+(Ve==="closed"?Ui:0),ga=qt;Ve==="full"?ga=Math.max(0,Math.min(Bt-yt,qt)):Ve==="peek"?ga=Math.max(-(Bt-ma),Math.min(ma-yt,qt)):Ve==="closed"?ga=Math.min(0,Math.max(-(Bt-yt),qt)):Ve==="auto"&&(ga=Math.max(0,qt));let Ya=Or?32:0;Ve==="peek"?Ya=ma:Ve==="full"?Ya=Bt:Ve==="auto"&&(Ya=ao);let dr=Ya-ga,rr=ma+20,fr=ma+(Bt-ma)*.35,oa=1,Vt="1rem";return je==="bottom"?(dr<=rr?oa=1:dr>=fr?oa=0:oa=1-(dr-rr)/(fr-rr),Vt=`calc(${Ya+(Ve==="closed"?Ui:0)+16}px - var(--drag-offset, 0px))`):(oa=Ve==="full"?0:1,Vt=`calc(1rem + ${Ui}px)`),(0,Os.jsxs)(Os.Fragment,{children:[(0,Os.jsx)("div",{ref:ze,style:{display:"none"}}),(0,Os.jsx)(H5,{clampedDragOffset:ga,containerHeight:Ue,currentTouchY:gt,drawerAutoMaxHeight:ye,drawerFullHeight:Ce,drawerPeekHeight:$,enableTouchDrag:de,etaBarHeight:f,etaData:it,handleVisible:Or,isDragging:Gt,menuContent:ee||le,menuItems:a,onAutoContentHeightChange:Kt,onChangeState:rt,ref:ge,safeAreaInsets:H?.insets,scrollToTopThreshold:Ae,setCurrentTouchY:Rt,setTouchStartY:ia,showScrollToTopButton:_e,side:je,state:Ve,touchStartY:mt}),(0,Os.jsx)(X5,{bottomOffset:Re,clampedDragOffset:ga,customCompassButton:te,customControls:u,customRecenterButton:V,drawerPeekHeight:$,drawerState:Ve,etaBarHeight:f+(Ve==="closed"?Ui:0),etaData:it,initialViewState:K,insets:H?.insets,isDragging:Gt,isMapCentered:Wt,mapBearing:ca,mapPitch:Ye,onRecenter:()=>at(),onResetBearing:ot,side:je}),it&&(0,Os.jsx)(Z5,{etaData:it,isDragging:Gt,layoutMode:"floating-card",style:{bottom:Vt,opacity:oa,pointerEvents:oa>.1?"auto":"none",transition:Gt?"none":"bottom 250ms ease-in-out, opacity 300ms ease-out"}})]})};var $5=Be(ut(),1),In=Be(It(),1),zp=({children:a})=>(0,In.jsx)("div",{className:"flex flex-col gap-1.5",children:a}),Q0=({id:a,label:i,icon:u,onPress:f,badge:m,disabled:s=!1,children:I})=>{let D=(0,$5.useContext)($n);return(0,In.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${s?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:s,onClick:V=>{s||(f&&f(),D&&D.setDrawerState&&D.setDrawerState("closed"))},type:"button",children:[u&&(0,In.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[u,m!==void 0&&(0,In.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:m})]}),(0,In.jsxs)("div",{className:"flex-1 flex flex-col justify-center",children:[(0,In.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:i}),I]})]})};zp.displayName="MapMenu";Q0.displayName="MapMenuItem";var J0=({children:a,showDivider:i=!0,className:u=""})=>(0,In.jsx)("div",{className:`flex items-center justify-between pb-3 first:mt-0 px-3.5 ${u} ${i?"border-b border-white/10 mb-2 mt-4":""}`,children:a});J0.displayName="MapMenuTitle";var e1=({className:a=""})=>(0,In.jsx)("div",{className:`h-[1px] bg-white/10 my-3 mx-3.5 ${a}`});e1.displayName="MapMenuDivider";var t1=({children:a,className:i=""})=>(0,In.jsx)("div",{className:`mt-auto pt-4 border-t border-white/10 px-3.5 text-xs text-zinc-500 font-medium ${i}`,children:a});t1.displayName="MapMenuFooter";var Y5=(f=>(f.TOP_SCROLL_MORE="TOP_SCROLL_MORE",f.BOTTOM_SCROLL_MORE="BOTTOM_SCROLL_MORE",f.BACK_GESTURE="BACK_GESTURE",f))(Y5||{}),Bp=(u=>(u.LOCATION_UPDATE="LOCATION_UPDATE",u.LOCATION_STREAM_UPDATE="LOCATION_STREAM_UPDATE",u))(Bp||{}),K5=(i=>(i.UPDATE_CONTEXT="UPDATE_CONTEXT",i))(K5||{});var Fs=Be(ut(),1),yv=.12,Op=()=>{let[a,i]=(0,Fs.useState)({accuracy:null,coords:null,heading:null}),u=(0,Fs.useRef)({accuracy:null,coords:null,heading:null}),f=(0,Fs.useRef)({accuracy:null,coords:null,heading:null}),m=(0,Fs.useCallback)(s=>{let I=s.location?.coords||s.coords,D=s.heading||s.coords,U=I?[I.longitude,I.latitude]:null,V=null;return D?.trueHeading!==void 0&&D.trueHeading>=0?V=D.trueHeading:D?.magneticHeading!==void 0&&D.magneticHeading>=0?V=D.magneticHeading:D?.heading!==null&&D.heading>=0&&(V=D.heading),{accuracy:I?.accuracy||null,coords:U,heading:V}},[]);return(0,Fs.useEffect)(()=>{let s,I=()=>{let V=!1;if(u.current.coords)if(!f.current.coords)f.current.coords=[...u.current.coords],V=!0;else{let[Q,K]=u.current.coords,[te,$]=f.current.coords,Ce=te+(Q-te)*yv,ye=$+(K-$)*yv;(Math.abs(Ce-te)>1e-7||Math.abs(ye-$)>1e-7)&&(f.current.coords=[Ce,ye],V=!0)}if(u.current.heading!==null)if(f.current.heading===null)f.current.heading=u.current.heading,V=!0;else{let Q=u.current.heading,K=f.current.heading,te=Q-K;te>180&&(te-=360),te<-180&&(te+=360);let Ce=((K+te*yv)%360+360)%360;Math.abs(te)>.1&&(f.current.heading=Ce,V=!0)}V&&i({accuracy:u.current.accuracy,coords:f.current.coords?[...f.current.coords]:null,heading:f.current.heading}),s=requestAnimationFrame(I)};s=requestAnimationFrame(I),er.location.getCurrentPosition().then(V=>{let Q=m(V);u.current=Q}).catch(V=>console.warn("Initial location fetch failed",V));let D=er.on("LOCATION_STREAM_UPDATE",V=>{u.current=m(V)}),U=er.on("LOCATION_UPDATE",V=>{u.current=m(V)});return er.location.startStream({distanceFilter:1,headingThreshold:2}).catch(V=>console.warn("Failed to start location stream",V)),()=>{cancelAnimationFrame(s),D(),U(),er.location.stopStream().catch(()=>{})}},[m]),a};var cr=Be(ut(),1),_v=({origin:a,destination:i,profile:u="driving",recalculateThreshold:f=50,enabled:m=!0,initialMode:s="preview"})=>{let[I,D]=(0,cr.useState)(null),[U,V]=(0,cr.useState)(null),[Q,K]=(0,cr.useState)(!1),[te,$]=(0,cr.useState)(null),[Ce,ye]=(0,cr.useState)(s),he=Op(),le=a||he.coords,ee=he.coords||a,de=(0,cr.useRef)(null),_e=(0,cr.useRef)(null),Ae=(0,cr.useRef)(!1),Re=(0,cr.useRef)(null),Z=(0,cr.useCallback)((ge,De)=>{let Ve=ge[1]*Math.PI/180,rt=De[1]*Math.PI/180,je=(De[1]-ge[1])*Math.PI/180,tt=(De[0]-ge[0])*Math.PI/180,ze=Math.sin(je/2)*Math.sin(je/2)+Math.cos(Ve)*Math.cos(rt)*Math.sin(tt/2)*Math.sin(tt/2);return 6371e3*(2*Math.atan2(Math.sqrt(ze),Math.sqrt(1-ze)))},[]),H=(0,cr.useMemo)(()=>{if(!ee||!I||I.geometry.coordinates.length<2)return ee&&i?Z(ee,i):null;let ge=I.geometry.coordinates,De=1/0,$e=0,Ve=(ze,Ue)=>(ze[0]-Ue[0])**2+(ze[1]-Ue[1])**2;for(let ze=0;ze<ge.length;ze++){let Ue=Ve(ee,ge[ze]);Ue<De&&(De=Ue,$e=ze)}let rt=ge.slice($e+1),je=0,tt=ee;for(let ze of rt)je+=Z(tt,ze),tt=ze;return je},[ee,I,i,Z]),oe=(0,cr.useCallback)(async(ge,De,$e)=>{if(!Ae.current){Ae.current=!0,K(!0);try{let Ve=await er.routing.getRoute({destination:De,origin:ge,profile:u});if(D(Ve),$(null),$e){let rt=Ve.geometry.coordinates,je=0;for(let tt=0;tt<rt.length-1;tt++)je+=Z(rt[tt],rt[tt+1]);V(je)}de.current=ge,_e.current=De}catch(Ve){$(Ve.message||"Failed to fetch route")}finally{K(!1),Ae.current=!1}}},[u,Z]);return(0,cr.useEffect)(()=>{s==="navigation"&&ye("navigation")},[s]),(0,cr.useEffect)(()=>{if(!m||!i||!le){(!m||!i)&&(D(null),V(null),de.current=null,_e.current=null,Re.current=null,ye(s));return}let ge=!_e.current||_e.current[0]!==i[0]||_e.current[1]!==i[1],De=`${i[0]},${i[1]}`;if(Re.current!==De&&(Re.current=De,ye(s)),ge)oe(le,i,!0);else if(de.current){let $e=ee||le;Z($e,de.current)>f&&oe($e,i,!1)}else oe(le,i,!0)},[le,ee,i,m,s,f,oe,Z]),{currentDistanceMeters:H,error:te,isCalculating:Q,mode:Ce,recalculate:()=>le&&i&&oe(le,i,!1),route:I,start:()=>ye("navigation"),totalDistance:U}},zD=(a,i,u="driving")=>{let[f,m]=(0,cr.useState)(null),[s,I]=(0,cr.useState)(!1),[D,U]=(0,cr.useState)(null);return(0,cr.useEffect)(()=>{if(!a||!i){m(null);return}(async()=>{I(!0);try{let Q=await er.routing.getRoute({destination:i,origin:a,profile:u});m(Q),U(null)}catch(Q){U(Q.message||"Failed to fetch route")}finally{I(!1)}})()},[a,i,u]),{error:D,isCalculating:s,route:f}};var Mo=Be(ut(),1),xv=(a={})=>{let{navigation:i,onAbort:u,onModeChange:f}=a,[m,s]=(0,Mo.useState)(null),[I,D]=(0,Mo.useState)(!1);(0,Mo.useEffect)(()=>{let Z=er.on("SDK_NAVIGATION_CREATE",ge=>{D(!1),s(ge)}),H=er.on("SDK_NAVIGATION_START",()=>{D(!1),s(ge=>ge?{...ge,mode:"navigation"}:null)}),oe=er.on("SDK_NAVIGATION_ABORT",()=>{D(!0),s(null)});return()=>{Z(),H(),oe()}},[]);let U=m||i,V=_v({destination:U?.destination||null,enabled:!I&&!!U?.destination,initialMode:U?.mode||"preview",origin:U?.origin,profile:U?.profile||"driving",recalculateThreshold:U?.recalculateThreshold||50}),Q=(0,Mo.useRef)(null),K=U?.destination;(0,Mo.useEffect)(()=>{K&&(!Q.current||Q.current[0]!==K[0]||Q.current[1]!==K[1])&&D(!1),Q.current=K},[K]);let te=(0,Mo.useRef)(f);te.current=f,(0,Mo.useEffect)(()=>{te.current?.(V.mode)},[V.mode]);let $=!I&&!!U?.destination,Ce=$?V.currentDistanceMeters:null,ye=$?V.totalDistance:null,he=V.route?.durationSeconds??null,le=Ce??0,ee=le/1e3,de=(()=>{if(!he||!ye||!Ce)return 0;let Z=Ce/ye;return Math.ceil(he*Z/60)})(),_e=ye&&ye>0?Math.min(100,Math.max(0,(ye-le)/ye*100)):0,Ae=(0,Mo.useCallback)(()=>{D(!0),s(null),er.navigation.abort(),u&&u()},[u]),Re=(0,Mo.useCallback)(()=>{er.navigation.start(),V.start()},[V.start]);return{cancel:Ae,distanceRemainingKm:ee,distanceRemainingMeters:Ce,error:$?V.error:null,etaMinutes:de,isActive:$,isCalculating:$?V.isCalculating:!1,mode:$?V.mode:"preview",progress:_e,recalculate:V.recalculate,route:$?V.route:null,start:Re,totalDistanceMeters:ye}};var Q5=Be(ut(),1),vv=(a,i)=>(0,Q5.useMemo)(()=>{if(!a||!i||a.coordinates.length<2)return a;let u=a.coordinates,f=1/0,m=0,s=(D,U)=>(D[0]-U[0])**2+(D[1]-U[1])**2;for(let D=0;D<u.length;D++){let U=s(i,u[D]);U<f&&(f=U,m=D)}let I=u.slice(m+1);return{coordinates:[i,...I],type:"LineString"}},[a,i]);var Gl=Be(ut(),1),Ao=Be(ut(),1);var a1=Be(ut(),1),Yn=Be(ut(),1);var r1=a1.createContext(null),bv=a=>{let[i,u]=(0,Yn.useState)({}),f=(0,Yn.useCallback)((s,I="default")=>{u(D=>{if(I==="current")throw new Error("'current' cannot be used as map id");if(D[I])throw new Error(`Multiple maps with the same id: ${I}`);return{...D,[I]:s}})},[]),m=(0,Yn.useCallback)((s="default")=>{u(I=>{if(I[s]){let D={...I};return delete D[s],D}return I})},[]);return a1.createElement(r1.Provider,{value:{maps:i,onMapMount:f,onMapUnmount:m}},a.children)};function wv(){let a=(0,Yn.useContext)(r1)?.maps,i=(0,Yn.useContext)(Eo);return(0,Yn.useMemo)(()=>({...a,current:i?.map}),[a,i])}function J5(a,i){let u=Array.isArray(a)?a[0]:a?a.x:0,f=Array.isArray(a)?a[1]:a?a.y:0,m=Array.isArray(i)?i[0]:i?i.x:0,s=Array.isArray(i)?i[1]:i?i.y:0;return u===m&&f===s}function Zr(a,i){if(a===i)return!0;if(!a||!i)return!1;if(Array.isArray(a)){if(!Array.isArray(i)||a.length!==i.length)return!1;for(let u=0;u<a.length;u++)if(!Zr(a[u],i[u]))return!1;return!0}else if(Array.isArray(i))return!1;if(typeof a=="object"&&typeof i=="object"){let u=Object.keys(a),f=Object.keys(i);if(u.length!==f.length)return!1;for(let m of u)if(!i.hasOwnProperty(m)||!Zr(a[m],i[m]))return!1;return!0}return!1}function Sv(a){return{longitude:a.center.lng,latitude:a.center.lat,zoom:a.zoom,pitch:a.pitch,bearing:a.bearing,padding:a.padding}}function Cv(a,i){let u=i.viewState||i,f={};if("longitude"in u&&"latitude"in u&&(u.longitude!==a.center.lng||u.latitude!==a.center.lat)){let m=a.center.constructor;f.center=new m(u.longitude,u.latitude)}return"zoom"in u&&u.zoom!==a.zoom&&(f.zoom=u.zoom),"bearing"in u&&u.bearing!==a.bearing&&(f.bearing=u.bearing),"pitch"in u&&u.pitch!==a.pitch&&(f.pitch=u.pitch),u.padding&&a.padding&&!Zr(u.padding,a.padding)&&(f.padding=u.padding),f}var BD=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Tv(a){if(!a)return null;if(typeof a=="string"||("toJS"in a&&(a=a.toJS()),!a.layers))return a;let i={};for(let f of a.layers)i[f.id]=f;let u=a.layers.map(f=>{let m=null;"interactive"in f&&(m=Object.assign({},f),delete m.interactive);let s=i[f.ref];if(s){m=m||Object.assign({},f),delete m.ref;for(let I of BD)I in s&&(m[I]=s[I])}return m||f});return{...a,layers:u}}var eT={version:8,sources:{},layers:[]},OD={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:"mercator",renderWorldCopies:!0},tT={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},aT={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},rT={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},FD=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],ND=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"],i1=class a{constructor(i,u,f){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=m=>{let s=this.props[rT[m.type]];s?s(m):m.type==="error"&&console.error(m.error)},this._onCameraEvent=m=>{if(this._internalUpdate)return;m.viewState=this._propsedCameraUpdate||Sv(this._map.transform);let s=this.props[aT[m.type]];s&&s(m)},this._onCameraUpdate=m=>this._internalUpdate?m:(this._propsedCameraUpdate=Sv(m),Cv(m,this.props)),this._onPointerEvent=m=>{(m.type==="mousemove"||m.type==="mouseout")&&this._updateHover(m);let s=this.props[tT[m.type]];s&&(this.props.interactiveLayerIds&&m.type!=="mouseover"&&m.type!=="mouseout"&&(m.features=this._hoveredFeatures||this._queryRenderedFeatures(m.point)),s(m),delete m.features)},this._MapClass=i,this.props=u,this._initialize(f)}get map(){return this._map}setProps(i){let u=this.props;this.props=i;let f=this._updateSettings(i,u),m=this._updateSize(i),s=this._updateViewState(i);this._updateStyle(i,u),this._updateStyleComponents(i),this._updateHandlers(i,u),(f||m||s&&!this._map.isMoving())&&this.redraw()}static reuse(i,u){let f=a.savedMaps.pop();if(!f)return null;let m=f.map,s=m.getContainer();for(u.className=s.className;s.childNodes.length>0;)u.appendChild(s.childNodes[0]);m._container=u;let I=m._resizeObserver;I&&(I.disconnect(),I.observe(u)),f.setProps({...i,styleDiffing:!1}),m.resize();let{initialViewState:D}=i;return D&&(D.bounds?m.fitBounds(D.bounds,{...D.fitBoundsOptions,duration:0}):f._updateViewState(D)),m.isStyleLoaded()?m.fire("load"):m.once("style.load",()=>m.fire("load")),m._update(),f}_initialize(i){let{props:u}=this,{mapStyle:f=eT}=u,m={...u,...u.initialViewState,container:i,style:Tv(f)},s=m.initialViewState||m.viewState||m;if(Object.assign(m,{center:[s.longitude||0,s.latitude||0],zoom:s.zoom||0,pitch:s.pitch||0,bearing:s.bearing||0}),u.gl){let D=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=D,u.gl)}let I=new this._MapClass(m);s.padding&&I.setPadding(s.padding),u.cursor&&(I.getCanvas().style.cursor=u.cursor),I.transformCameraUpdate=this._onCameraUpdate,I.on("style.load",()=>{this._styleComponents={light:I.getLight(),sky:I.getSky(),projection:I.getProjection?.(),terrain:I.getTerrain()},this._updateStyleComponents(this.props)}),I.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(let D in tT)I.on(D,this._onPointerEvent);for(let D in aT)I.on(D,this._onCameraEvent);for(let D in rT)I.on(D,this._onEvent);this._map=I}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),a.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let i=this._map;i.style&&(i._frame&&(i._frame.cancel(),i._frame=null),i._render())}_updateSize(i){let{viewState:u}=i;if(u){let f=this._map;if(u.width!==f.transform.width||u.height!==f.transform.height)return f.resize(),!0}return!1}_updateViewState(i){let u=this._map,f=u.transform;if(!u.isMoving()){let s=Cv(f,i);if(Object.keys(s).length>0)return this._internalUpdate=!0,u.jumpTo(s),this._internalUpdate=!1,!0}return!1}_updateSettings(i,u){let f=this._map,m=!1;for(let s of FD)if((s in i||s in u)&&!Zr(i[s],u[s])){m=!0;let D=s in i?i[s]:OD[s];f[`set${s[0].toUpperCase()}${s.slice(1)}`]?.call(f,D)}return m}_updateStyle(i,u){if(i.cursor!==u.cursor&&(this._map.getCanvas().style.cursor=i.cursor||""),i.mapStyle!==u.mapStyle){let{mapStyle:f=eT,styleDiffing:m=!0}=i,s={diff:m};"localIdeographFontFamily"in i&&(s.localIdeographFontFamily=i.localIdeographFontFamily),this._map.setStyle(Tv(f),s)}}_updateStyleComponents({light:i,projection:u,sky:f,terrain:m}){let s=this._map,I=this._styleComponents;s.style?._loaded&&(i&&!Zr(i,I.light)&&(I.light=i,s.setLight(i)),u&&!Zr(u,I.projection)&&u!==I.projection?.type&&(I.projection=typeof u=="string"?{type:u}:u,s.setProjection?.(I.projection)),f&&!Zr(f,I.sky)&&(I.sky=f,s.setSky(f)),m!==void 0&&!Zr(m,I.terrain)&&(!m||s.getSource(m.source))&&(I.terrain=m,s.setTerrain(m)))}_updateHandlers(i,u){let f=this._map;for(let m of ND){let s=i[m]??!0,I=u[m]??!0;Zr(s,I)||(s?f[m].enable(s):f[m].disable())}}_queryRenderedFeatures(i){let u=this._map,{interactiveLayerIds:f=[]}=this.props;try{return u.queryRenderedFeatures(i,{layers:f.filter(u.getLayer.bind(u))})}catch{return[]}}_updateHover(i){let{props:u}=this;if(u.interactiveLayerIds&&(u.onMouseMove||u.onMouseEnter||u.onMouseLeave)){let m=i.type,s=this._hoveredFeatures?.length>0,I=this._queryRenderedFeatures(i.point),D=I.length>0;!D&&s&&(i.type="mouseleave",this._onPointerEvent(i)),this._hoveredFeatures=I,D&&!s&&(i.type="mouseenter",this._onPointerEvent(i)),i.type=m}else this._hoveredFeatures=null}};i1.savedMaps=[];var Lv=i1;var UD=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Iv(a){if(!a)return null;let i=a.map,u={getMap:()=>i};for(let f of qD(i))!(f in u)&&!UD.includes(f)&&(u[f]=i[f].bind(i));return u}function qD(a){let i=new Set,u=a;for(;u;){for(let f of Object.getOwnPropertyNames(u))f[0]!=="_"&&typeof a[f]=="function"&&f!=="fire"&&f!=="setEventedParent"&&i.add(f);u=Object.getPrototypeOf(u)}return Array.from(i)}var o1=Be(ut(),1),VD=typeof document<"u"?o1.useLayoutEffect:o1.useEffect,iT=VD;function Mv(a,i){let{RTLTextPlugin:u,maxParallelImageRequests:f,workerCount:m,workerUrl:s}=i;if(u&&a.getRTLTextPluginStatus&&a.getRTLTextPluginStatus()==="unavailable"){let{pluginUrl:I,lazy:D=!0}=typeof u=="string"?{pluginUrl:u}:u;a.setRTLTextPlugin(I,U=>{U&&console.error(U)},D)}f!==void 0&&a.setMaxParallelImageRequests(f),m!==void 0&&a.setWorkerCount(m),s!==void 0&&a.setWorkerUrl(s)}var Eo=Gl.createContext(null);function jD(a,i){let u=(0,Ao.useContext)(r1),[f,m]=(0,Ao.useState)(null),s=(0,Ao.useRef)(),{current:I}=(0,Ao.useRef)({mapLib:null,map:null});(0,Ao.useEffect)(()=>{let V=a.mapLib,Q=!0,K;return Promise.resolve(V||Promise.resolve().then(()=>Be(nT(),1))).then(te=>{if(!Q)return;if(!te)throw new Error("Invalid mapLib");let $="Map"in te?te:te.default;if(!$.Map)throw new Error("Invalid mapLib");Mv($,a),a.reuseMaps&&(K=Lv.reuse(a,s.current)),K||(K=new Lv($.Map,a,s.current)),I.map=Iv(K),I.mapLib=$,m(K),u?.onMapMount(I.map,a.id)}).catch(te=>{let{onError:$}=a;$?$({type:"error",target:null,originalEvent:null,error:te}):console.error(te)}),()=>{Q=!1,K&&(u?.onMapUnmount(a.id),a.reuseMaps?K.recycle():K.destroy())}},[]),iT(()=>{f&&f.setProps(a)}),(0,Ao.useImperativeHandle)(i,()=>I.map,[f]);let D=(0,Ao.useMemo)(()=>({position:"relative",width:"100%",height:"100%",...a.style}),[a.style]),U={height:"100%"};return Gl.createElement("div",{id:a.id,ref:s,style:D},f&&Gl.createElement(Eo.Provider,{value:I},Gl.createElement("div",{"mapboxgl-children":"",style:U},a.children)))}var Pv=Gl.forwardRef(jD);var lT=Be(ut(),1),uT=Be(af(),1),Qi=Be(ut(),1);var GD=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function si(a,i){if(!a||!i)return;let u=a.style;for(let f in i){let m=i[f];Number.isFinite(m)&&!GD.test(f)?u[f]=`${m}px`:u[f]=m}}function n1(a,i){if(a===i)return null;let u=sT(a),f=sT(i),m=[];for(let s of f)u.has(s)||m.push(s);for(let s of u)f.has(s)||m.push(s);return m.length===0?null:m}function sT(a){return new Set(a?a.trim().split(/\s+/):[])}var Fp=(0,Qi.memo)((0,Qi.forwardRef)((a,i)=>{let{map:u,mapLib:f}=(0,Qi.useContext)(Eo),m=(0,Qi.useRef)({props:a}),s=(0,Qi.useMemo)(()=>{let le=!1;lT.Children.forEach(a.children,_e=>{_e&&(le=!0)});let ee={...a,element:le?document.createElement("div"):void 0},de=new f.Marker(ee);return de.setLngLat([a.longitude,a.latitude]),de.getElement().addEventListener("click",_e=>{m.current.props.onClick?.({type:"click",target:de,originalEvent:_e})}),de.on("dragstart",_e=>{let Ae=_e;Ae.lngLat=s.getLngLat(),m.current.props.onDragStart?.(Ae)}),de.on("drag",_e=>{let Ae=_e;Ae.lngLat=s.getLngLat(),m.current.props.onDrag?.(Ae)}),de.on("dragend",_e=>{let Ae=_e;Ae.lngLat=s.getLngLat(),m.current.props.onDragEnd?.(Ae)}),de},[]);(0,Qi.useEffect)(()=>(s.addTo(u.getMap()),()=>{s.remove()}),[]);let{longitude:I,latitude:D,offset:U,style:V,draggable:Q=!1,popup:K=null,rotation:te=0,rotationAlignment:$="auto",pitchAlignment:Ce="auto"}=a;(0,Qi.useEffect)(()=>{si(s.getElement(),V)},[V]),(0,Qi.useImperativeHandle)(i,()=>s,[]);let ye=m.current.props;(s.getLngLat().lng!==I||s.getLngLat().lat!==D)&&s.setLngLat([I,D]),U&&!J5(s.getOffset(),U)&&s.setOffset(U),s.isDraggable()!==Q&&s.setDraggable(Q),s.getRotation()!==te&&s.setRotation(te),s.getRotationAlignment()!==$&&s.setRotationAlignment($),s.getPitchAlignment()!==Ce&&s.setPitchAlignment(Ce),s.getPopup()!==K&&s.setPopup(K);let he=n1(ye.className,a.className);if(he)for(let le of he)s.toggleClassName(le);return m.current.props=a,(0,uT.createPortal)(a.children,s.getElement())}));var cT=Be(af(),1),Fi=Be(ut(),1);var HD=(0,Fi.memo)((0,Fi.forwardRef)((a,i)=>{let{map:u,mapLib:f}=(0,Fi.useContext)(Eo),m=(0,Fi.useMemo)(()=>document.createElement("div"),[]),s=(0,Fi.useRef)({props:a}),I=(0,Fi.useMemo)(()=>{let D={...a},U=new f.Popup(D);return U.setLngLat([a.longitude,a.latitude]),U.once("open",V=>{s.current.props.onOpen?.(V)}),U},[]);if((0,Fi.useEffect)(()=>{let D=U=>{s.current.props.onClose?.(U)};return I.on("close",D),I.setDOMContent(m).addTo(u.getMap()),()=>{I.off("close",D),I.isOpen()&&I.remove()}},[]),(0,Fi.useEffect)(()=>{si(I.getElement(),a.style)},[a.style]),(0,Fi.useImperativeHandle)(i,()=>I,[]),I.isOpen()){let D=s.current.props;(I.getLngLat().lng!==a.longitude||I.getLngLat().lat!==a.latitude)&&I.setLngLat([a.longitude,a.latitude]),a.offset&&!Zr(D.offset,a.offset)&&I.setOffset(a.offset),(D.anchor!==a.anchor||D.maxWidth!==a.maxWidth)&&(I.options.anchor=a.anchor,I.setMaxWidth(a.maxWidth));let U=n1(D.className,a.className);if(U)for(let V of U)I.toggleClassName(V);s.current.props=a}return(0,cT.createPortal)(a.children,m)}));var s1=Be(ut(),1);var hf=Be(ut(),1);function Ji(a,i,u,f){let m=(0,hf.useContext)(Eo),s=(0,hf.useMemo)(()=>a(m),[]);return(0,hf.useEffect)(()=>{let I=f||u||i,D=typeof i=="function"&&typeof u=="function"?i:null,U=typeof u=="function"?u:typeof i=="function"?i:null,{map:V}=m;return V.hasControl(s)||(V.addControl(s,I?.position),D&&D(m)),()=>{U&&U(m),V.hasControl(s)&&V.removeControl(s)}},[]),s}function ZD(a){let i=Ji(({mapLib:u})=>new u.AttributionControl(a),{position:a.position});return(0,s1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var XD=(0,s1.memo)(ZD);var l1=Be(ut(),1);function WD(a){let i=Ji(({mapLib:u})=>new u.FullscreenControl({container:a.containerId&&document.getElementById(a.containerId)}),{position:a.position});return(0,l1.useEffect)(()=>{si(i._controlContainer,a.style)},[a.style]),null}var $D=(0,l1.memo)(WD);var Kn=Be(ut(),1);function YD(a,i){let u=(0,Kn.useRef)({props:a}),f=Ji(({mapLib:m})=>{let s=new m.GeolocateControl(a),I=s._setupUI;return s._setupUI=()=>{s._container.hasChildNodes()||I()},s.on("geolocate",D=>{u.current.props.onGeolocate?.(D)}),s.on("error",D=>{u.current.props.onError?.(D)}),s.on("outofmaxbounds",D=>{u.current.props.onOutOfMaxBounds?.(D)}),s.on("trackuserlocationstart",D=>{u.current.props.onTrackUserLocationStart?.(D)}),s.on("trackuserlocationend",D=>{u.current.props.onTrackUserLocationEnd?.(D)}),s},{position:a.position});return u.current.props=a,(0,Kn.useImperativeHandle)(i,()=>f,[]),(0,Kn.useEffect)(()=>{si(f._container,a.style)},[a.style]),null}var KD=(0,Kn.memo)((0,Kn.forwardRef)(YD));var u1=Be(ut(),1);function QD(a){let i=Ji(({mapLib:u})=>new u.NavigationControl(a),{position:a.position});return(0,u1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var JD=(0,u1.memo)(QD);var pf=Be(ut(),1);function ek(a){let i=Ji(({mapLib:s})=>new s.ScaleControl(a),{position:a.position}),u=(0,pf.useRef)(a),f=u.current;u.current=a;let{style:m}=a;return a.maxWidth!==void 0&&a.maxWidth!==f.maxWidth&&(i.options.maxWidth=a.maxWidth),a.unit!==void 0&&a.unit!==f.unit&&i.setUnit(a.unit),(0,pf.useEffect)(()=>{si(i._container,m)},[m]),null}var tk=(0,pf.memo)(ek);var c1=Be(ut(),1);function ak(a){let i=Ji(({mapLib:u})=>new u.TerrainControl(a),{position:a.position});return(0,c1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var rk=(0,c1.memo)(ak);var d1=Be(ut(),1);function ik(a){let i=Ji(({mapLib:u})=>new u.LogoControl(a),{position:a.position});return(0,d1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var ok=(0,d1.memo)(ik);var dT=Be(ut(),1),Ko=Be(ut(),1);function pc(a,i){if(!a)throw new Error(i)}var nk=0;function sk(a,i,u){if(a.style&&a.style._loaded){let f={...u};return delete f.id,delete f.children,a.addSource(i,f),a.getSource(i)}return null}function lk(a,i,u){pc(i.id===u.id,"source id changed"),pc(i.type===u.type,"source type changed");let f="",m=0;for(let I in i)I!=="children"&&I!=="id"&&!Zr(u[I],i[I])&&(f=I,m++);if(!m)return;let s=i.type;if(s==="geojson")a.setData(i.data);else if(s==="image")a.updateImage({url:i.url,coordinates:i.coordinates});else switch(f){case"coordinates":a.setCoordinates?.(i.coordinates);break;case"url":a.setUrl?.(i.url);break;case"tiles":a.setTiles?.(i.tiles);break;default:console.warn(`Unable to update <Source> prop: ${f}`)}}function mc(a){let i=(0,Ko.useContext)(Eo).map.getMap(),u=(0,Ko.useRef)(a),[,f]=(0,Ko.useState)(0),m=(0,Ko.useMemo)(()=>a.id||`jsx-source-${nk++}`,[]);(0,Ko.useEffect)(()=>{if(i){let I=()=>setTimeout(()=>f(D=>D+1),0);return i.on("styledata",I),I(),()=>{if(i.off("styledata",I),i.style&&i.style._loaded&&i.getSource(m)){let D=i.getStyle()?.layers;if(D)for(let U of D)U.source===m&&i.removeLayer(U.id);i.removeSource(m)}}}},[i]);let s=i&&i.style&&i.getSource(m);return s?lk(s,a,u.current):s=sk(i,m,a),u.current=a,s&&dT.Children.map(a.children,I=>I&&(0,Ko.cloneElement)(I,{source:m}))||null}var Qn=Be(ut(),1);function uk(a,i,u,f){if(pc(u.id===f.id,"layer id changed"),pc(u.type===f.type,"layer type changed"),u.type==="custom"||f.type==="custom")return;let{layout:m={},paint:s={},filter:I,minzoom:D,maxzoom:U,beforeId:V}=u;if(V!==f.beforeId&&a.moveLayer(i,V),m!==f.layout){let Q=f.layout||{};for(let K in m)Zr(m[K],Q[K])||a.setLayoutProperty(i,K,m[K]);for(let K in Q)m.hasOwnProperty(K)||a.setLayoutProperty(i,K,void 0)}if(s!==f.paint){let Q=f.paint||{};for(let K in s)Zr(s[K],Q[K])||a.setPaintProperty(i,K,s[K]);for(let K in Q)s.hasOwnProperty(K)||a.setPaintProperty(i,K,void 0)}Zr(I,f.filter)||a.setFilter(i,I),(D!==f.minzoom||U!==f.maxzoom)&&a.setLayerZoomRange(i,D,U)}function ck(a,i,u){if(a.style&&a.style._loaded&&(!("source"in u)||a.getSource(u.source))){let f={...u,id:i};delete f.beforeId,a.addLayer(f,u.beforeId)}}var dk=0;function Ns(a){let i=(0,Qn.useContext)(Eo).map.getMap(),u=(0,Qn.useRef)(a),[,f]=(0,Qn.useState)(0),m=(0,Qn.useMemo)(()=>a.id||`jsx-layer-${dk++}`,[]);if((0,Qn.useEffect)(()=>{if(i){let I=()=>f(D=>D+1);return i.on("styledata",I),I(),()=>{i.off("styledata",I),i.style&&i.style._loaded&&i.getLayer(m)&&i.removeLayer(m)}}},[i]),i&&i.style&&i.getLayer(m))try{uk(i,m,a,u.current)}catch(I){console.warn(I)}else ck(i,m,a);return u.current=a,null}var Np=Be(It(),1),Rv=({geometry:a,color:i="#3b82f6",width:u=5,opacity:f=.8})=>a?(0,Np.jsxs)(mc,{data:{geometry:a,properties:{},type:"Feature"},id:"sdk-route-source",type:"geojson",children:[(0,Np.jsx)(Ns,{id:"sdk-route-layer-casing",paint:{"line-blur":1,"line-color":"#ffffff","line-opacity":f,"line-width":u+2},type:"line"}),(0,Np.jsx)(Ns,{id:"sdk-route-layer",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":i,"line-opacity":f,"line-width":u},type:"line"})]}):null;var $t=Be(ut(),1);var fT=(a,i,u=64)=>{let[f,m]=a,s=m*Math.PI/180,I=[];for(let D=0;D<=u;D++){let U=D/u*2*Math.PI,V=i*Math.cos(U)/6371e3*(180/Math.PI),Q=i*Math.sin(U)/(6371e3*Math.cos(s))*(180/Math.PI);I.push([f+Q,m+V])}return{geometry:{coordinates:[I],type:"Polygon"},properties:{},type:"Feature"}};var hT=Be(ut(),1),Up=Be(It(),1),pT=({center:a,radiusMeters:i,color:u="#39ff88"})=>{let f=(0,hT.useMemo)(()=>fT(a,i),[a,i]);return(0,Up.jsxs)(mc,{data:f,id:"sdk-mock-radius-source",type:"geojson",children:[(0,Up.jsx)(Ns,{id:"sdk-mock-radius-fill",paint:{"fill-color":u,"fill-opacity":.12},type:"fill"}),(0,Up.jsx)(Ns,{id:"sdk-mock-radius-outline",paint:{"line-color":u,"line-dasharray":[2,2],"line-width":2},type:"line"})]})};var gc=Be(ut(),1),Dv=Be(It(),1);function mT(a,i=64){let u=document.createElement("canvas");u.width=i,u.height=i;let f=u.getContext("2d");return f.font=`${i*.75}px serif`,f.textAlign="center",f.textBaseline="middle",f.fillText(a,i/2,i/2),f.getImageData(0,0,i,i)}var gT=({pois:a})=>{let[i,u]=(0,gc.useState)(0),{current:f}=wv(),m=(0,gc.useMemo)(()=>a.filter(I=>!I.displayMode||I.displayMode==="gl"),[a]);(0,gc.useEffect)(()=>{if(!f)return;let I=f.getMap();[{emoji:"\u{1F37A}",name:"sdk-default-bar"},{emoji:"\u{1F37D}\uFE0F",name:"sdk-default-restaurant"},{emoji:"\u{1F4CD}",name:"sdk-default-poi"}].forEach(V=>{I.hasImage(V.name)||I.addImage(V.name,mT(V.emoji),{pixelRatio:2})});let U=0;m.forEach(V=>{if(V.imageUrl){let Q=`custom-url-${V.id}`;I.hasImage(Q)||I.loadImage(V.imageUrl,(K,te)=>{!K&&te&&(I.hasImage(Q)||(I.addImage(Q,te),u($=>$+1)))})}if(V.emoji){let Q=`custom-emoji-${V.emoji}`;I.hasImage(Q)||(I.addImage(Q,mT(V.emoji),{pixelRatio:2}),U++)}}),U>0&&u(V=>V+U)},[f,m]);let s=(0,gc.useMemo)(()=>({features:m.map(I=>({geometry:{coordinates:[I.longitude,I.latitude],type:"Point"},properties:{...I,"sdk-icon":I.imageUrl?`custom-url-${I.id}`:I.spriteName?I.spriteName:I.emoji?`custom-emoji-${I.emoji}`:I.type==="bar"?"sdk-default-bar":I.type==="restaurant"?"sdk-default-restaurant":"sdk-default-poi"},type:"Feature"})),type:"FeatureCollection"}),[m]);return(0,Dv.jsx)(mc,{data:s,id:"sdk-pois",type:"geojson",children:(0,Dv.jsx)(Ns,{id:"sdk-poi-layer",layout:{"icon-allow-overlap":!0,"icon-image":["get","sdk-icon"],"icon-size":1,"text-anchor":"top","text-field":["step",["zoom"],"",14,["get","name"]],"text-font":["Open Sans Bold"],"text-offset":[0,1.5],"text-optional":!0,"text-size":11},paint:{"icon-opacity":["interpolate",["linear"],["zoom"],11,0,12,1],"text-color":"#ffffff","text-halo-color":"#000000","text-halo-width":1,"text-opacity":["interpolate",["linear"],["zoom"],13.5,0,14,1]},type:"symbol"})})};var Mn=Be(It(),1),yT=({pois:a,onClick:i})=>{let u=a.filter(f=>f.displayMode==="marker");return u.length===0?null:(0,Mn.jsx)(Mn.Fragment,{children:u.map(f=>(0,Mn.jsx)(Fp,{anchor:"bottom",latitude:f.latitude,longitude:f.longitude,onClick:m=>{m.originalEvent.stopPropagation(),i&&i(f)},children:f.markerComponent?f.markerComponent:(0,Mn.jsxs)("div",{style:{cursor:"pointer",filter:"drop-shadow(0 4px 6px rgba(0,0,0,0.1))",transform:"transition-transform duration-200 hover:scale-110"},children:[(0,Mn.jsx)("div",{style:{alignItems:"center",backgroundColor:f.type==="bar"?"#f97316":"#10b981",border:"2px solid white",borderRadius:"50%",display:"flex",height:"32px",justifyContent:"center",width:"32px"},children:f.emoji?(0,Mn.jsx)("span",{style:{fontSize:"16px"},children:f.emoji}):(0,Mn.jsx)("div",{style:{backgroundColor:"white",borderRadius:"50%",height:"8px",width:"8px"}})}),(0,Mn.jsx)("div",{style:{borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`8px solid ${f.type==="bar"?"#f97316":"#10b981"}`,height:0,margin:"-2px auto 0",width:0}})]})},f.id))})};var eo=Be(It(),1),_T=({forcedLocation:a,heading:i})=>a?(0,eo.jsx)(Fp,{anchor:"center",latitude:a[1],longitude:a[0],children:(0,eo.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"center",position:"relative"},children:[(0,eo.jsx)("div",{style:{animation:"pulse 2s infinite",backgroundColor:"rgba(59, 130, 246, 0.4)",borderRadius:"50%",height:"40px",position:"absolute",width:"40px"}}),i!=null&&(0,eo.jsx)("div",{style:{height:"60px",position:"absolute",transform:`rotate(${i}deg)`,width:"60px",zIndex:0},children:(0,eo.jsxs)("svg",{style:{height:"100%",width:"100%"},viewBox:"0 0 100 100",children:[(0,eo.jsx)("defs",{children:(0,eo.jsxs)("radialGradient",{cx:"50%",cy:"50%",fx:"50%",fy:"50%",id:"grad1",r:"50%",children:[(0,eo.jsx)("stop",{offset:"0%",style:{stopColor:"rgba(37, 99, 235, 0.6)",stopOpacity:1}}),(0,eo.jsx)("stop",{offset:"100%",style:{stopColor:"rgba(37, 99, 235, 0)",stopOpacity:0}})]})}),(0,eo.jsx)("path",{d:"M 50 50 L 35 0 A 50 50 0 0 1 65 0 Z",fill:"url(#grad1)"})]})}),(0,eo.jsx)("div",{style:{alignItems:"center",backgroundColor:"white",borderRadius:"50%",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(37, 99, 235, 0.2)",display:"flex",height:"20px",justifyContent:"center",width:"20px",zIndex:1},children:(0,eo.jsx)("div",{style:{backgroundColor:"#2563eb",border:"2px solid white",borderRadius:"50%",height:"12px",width:"12px"}})}),(0,eo.jsx)("style",{children:"@keyframes pulse { 0% { transform: scale(0.95); opacity: 0.7; } 70% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(0.95); opacity: 0; } }"})]})}):null;var Rr=Be(It(),1),fk=({initialViewState:a={latitude:45.90583599233422,longitude:6.12589018919138,zoom:12},style:i={},mapStyle:u="https://tiles.cloudparse.fr/style/up_dark_matter",className:f="",maxBounds:m,children:s,onClick:I,onMapClickMiss:D,onContextMenu:U,interactiveLayerIds:V=[],onLoad:Q,showUserLocation:K=!0,followUser:te=!1,lockToUser:$=!1,showUserLocationButton:Ce=!0,renderUserLocation:ye,pois:he=[],onPoiClick:le,route:ee,showNavigationUI:de,navigationData:_e,onNavigationAbort:Ae,onNavigationModeChange:Re,navigation:Z,showControls:H=!0,menuItems:oe,menuContent:ge,drawerState:De,drawerContentRef:$e,controlProps:Ve={},enableTouchDrag:rt=!1})=>{let je=(0,$t.useContext)($n),tt=(0,$t.useContext)(tf),ze=(0,$t.useRef)(null),Ue=Op(),He=xv({navigation:Z,onModeChange:Z?Re:void 0}),Oe=He.isActive,Wt=Oe?{currentDistanceMeters:He.distanceRemainingMeters,mode:He.mode,route:He.route,start:He.start,totalDistance:He.totalDistanceMeters}:_e,ca=Oe?He.route?.geometry:ee,at=Oe?de!==!1&&Z?.showUI!==!1:de,ot=Wt?.mode||"preview",Ye=je?je.isFollowing:te,it=(0,$t.useRef)(Ye),mt=(0,$t.useRef)(!1),ia=(0,$t.useRef)(0),gt=(0,$t.useCallback)(()=>(mt.current=!0,++ia.current),[]),Rt=(0,$t.useCallback)(vt=>{ia.current===vt&&(mt.current=!1)},[]),[st,Kt]=(0,$t.useState)(Ye),Gt=je?je.isFollowing:st,qt=je?.setIsFollowing,Bt=(0,$t.useCallback)(vt=>{it.current=vt,Kt(vt),qt&&qt(vt)},[qt]);(0,$t.useEffect)(()=>{je&&je.isFollowing!==it.current&&(it.current=je.isFollowing)},[je?.isFollowing,je]);let ma=[...V];he.length>0&&!ma.includes("sdk-poi-layer")&&ma.push("sdk-poi-layer");let $r=(0,$t.useRef)(te);(0,$t.useEffect)(()=>{if(te!==$r.current&&(Bt(te),$r.current=te,te&&Ue.coords&&ze.current)){let vt=gt();ze.current.flyTo({center:Ue.coords,duration:1e3,essential:!0,zoom:Math.max(ze.current.getZoom(),16)}),setTimeout(()=>{Rt(vt)},1050)}},[te,Bt,Ue.coords,gt,Rt]);let ao=(0,$t.useRef)(null),Ui=(0,$t.useRef)(null);(0,$t.useEffect)(()=>{if(!ca||!ze.current){ca||(ao.current=null);return}let vt=ca!==ao.current,Ot=Ui.current!==ot;if(ot==="navigation"){if((Ot||vt)&&Bt(!0),(Ot||vt)&&Ue.coords&&ze.current){let na=gt();ze.current.flyTo({center:Ue.coords,duration:1e3,essential:!0,zoom:17}),setTimeout(()=>{Rt(na)},1050)}}else if(ot==="preview"&&vt){Bt(!1);let na=ca.coordinates;if(na.length>0){let we=na.reduce((Aa,Fr)=>[[Math.min(Aa[0][0],Fr[0]),Math.min(Aa[0][1],Fr[1])],[Math.max(Aa[1][0],Fr[0]),Math.max(Aa[1][1],Fr[1])]],[[na[0][0],na[0][1]],[na[0][0],na[0][1]]]);ze.current.fitBounds([we[0][0],we[0][1],we[1][0],we[1][1]],{padding:100,speed:1.2})}}ao.current=ca,Ui.current=ot},[ca,ot,Bt,Ue.coords,gt,Rt]),(0,$t.useEffect)(()=>{it.current&&!mt.current&&Ue.coords&&ze.current&&ze.current.easeTo({center:Ue.coords,duration:50,easing:vt=>vt,essential:!0})},[Ue.coords]);let Or=vv(ca,K?Ue.coords:null),yt=Wt?.currentDistanceMeters??null,ga=Wt?.totalDistance??null,Ya=Wt?.route?.durationSeconds??null,dr=yt??0,rr=(()=>{if(!Ya||!ga||!yt)return 0;let vt=yt/ga;return Math.ceil(Ya*vt/60)})(),fr=dr/1e3,oa=ga&&ga>0?Math.min(100,Math.max(0,(ga-dr)/ga*100)):0,Vt=at&&Wt&&ca?{distanceRemainingKm:fr,etaMins:rr,label:ot==="navigation"?"Walking Guidance Active":"Route Preview",mode:ot,onAbort:()=>{He.cancel(),Ae&&Ae()},onStart:Wt.start,progress:oa}:void 0,At=je?.setEtaData;(0,$t.useEffect)(()=>{At&&At(Vt)},[Vt,At]);let hr=je?.setDrawerState;(0,$t.useEffect)(()=>{hr&&De!==void 0&&hr(De)},[De,hr]);let Yr=oe??[],{mapLibreChildren:pr,menuContentFromChildren:Ea}=(0,$t.useMemo)(()=>{let vt=[],Ot=[];$t.default.Children.forEach(s,we=>{if($t.default.isValidElement(we)){let Aa=we.type,Fr=Aa?.displayName||Aa?.name,Dt=Aa===zp||Fr==="MapMenu",Qr=Dt||Aa===Q0||Aa===J0||Aa===e1||Aa===t1||["MapMenuItem","MapMenuTitle","MapMenuDivider","MapMenuFooter"].includes(Fr);Dt?$t.default.Children.forEach(we.props.children,qo=>{qo&&Ot.push(qo)}):Qr?Ot.push(we):vt.push(we)}else vt.push(we)});let na=Ot.length>0?(0,Rr.jsx)(zp,{children:Ot}):null;return{mapLibreChildren:vt,menuContentFromChildren:na}},[s]),Mi=vt=>{if(tt?.isPlacingLocation){tt.placeLocation([vt.lngLat.lng,vt.lngLat.lat]);return}let Ot=vt.features||[];if(le){let we=Ot.find(Aa=>Aa.layer.id==="sdk-poi-layer");if(we){le(we.properties);return}}Ot.some(we=>ma.includes(we.layer.id))||D&&D(vt),I&&I(vt)},Ei=(0,$t.useCallback)(vt=>{if(Ue.coords&&ze.current){Bt(!0);let Ot=gt();ze.current.flyTo({center:Ue.coords,duration:1e3,essential:!0,pitch:vt?.pitch||0,zoom:Math.max(ze.current.getZoom(),16),...vt?.bearing!==void 0?{bearing:vt.bearing}:{}}),setTimeout(()=>{Rt(Ot)},1050)}},[Ue.coords,Bt,gt,Rt]),Kr=(0,$t.useCallback)((vt,Ot)=>{let na=ze.current;if(!na)return;Bt(!1);let we=gt();na.flyTo({center:vt,essential:!0,pitch:Ot?.pitch??0,zoom:Ot?.zoom??na.getZoom(),...Ot?.duration!==void 0?{duration:Ot.duration}:{},...Ot?.bearing!==void 0?{bearing:Ot.bearing}:{}}),na.once("moveend",()=>Rt(we))},[Bt,gt,Rt]),ir=(0,$t.useCallback)(vt=>{ze.current&&ze.current.easeTo({bearing:0,duration:500,essential:!0,pitch:vt?.pitch??0})},[]);(0,$t.useEffect)(()=>{je&&(je._registerCenterCallback(Ei),je._registerResetBearingCallback(ir),je._registerFlyToCallback(Kr))},[je,Ei,ir,Kr]);let di=(0,$t.useCallback)(()=>{ze.current&&je&&(je.setBearing(ze.current.getBearing()),je.setPitch(ze.current.getPitch()))},[je]),Cr=()=>{$||it.current&&(Bt(!1),ze.current&&ze.current.stop())};return(0,Rr.jsxs)("div",{className:`w-full h-full overflow-hidden relative ${tt?.isPlacingLocation?"cursor-crosshair":""} ${f}`,style:i,children:[(0,Rr.jsxs)(Pv,{attributionControl:!1,initialViewState:a,interactiveLayerIds:ma,mapStyle:u,maxBounds:m,onClick:Mi,onContextMenu:U,onDragStart:Cr,onLoad:vt=>{Q&&Q(vt),te&&Ue.coords&&ze.current&&ze.current.jumpTo({center:Ue.coords,zoom:16})},onMouseDown:Cr,onMove:di,onRotateStart:Cr,onTouchStart:Cr,onWheel:Cr,ref:ze,children:[K&&Ue.coords&&(ye?ye({coords:Ue.coords,heading:Ue.heading}):(0,Rr.jsx)(_T,{forcedLocation:Ue.coords,heading:Ue.heading})),tt&&tt.radiusMeters>0&&Ue.coords&&(0,Rr.jsx)(pT,{center:Ue.coords,radiusMeters:tt.radiusMeters}),Or&&(0,Rr.jsx)(Rv,{geometry:Or}),he.length>0&&(0,Rr.jsxs)(Rr.Fragment,{children:[(0,Rr.jsx)(gT,{pois:he}),(0,Rr.jsx)(yT,{onClick:le,pois:he})]}),pr]}),H&&je&&!je.hasControls&&(0,Rr.jsx)(gv,{drawerContentRef:$e,enableTouchDrag:rt,etaData:Vt,initialViewState:a,isInternal:!0,menuContent:ge||Ea,menuItems:Yr,...Ve})]})},hk=({children:a})=>(0,$t.useContext)($n)?(0,Rr.jsx)(Rr.Fragment,{children:a}):(0,Rr.jsx)(pv,{children:a}),kv=a=>(0,Rr.jsx)(hk,{children:(0,Rr.jsx)(bv,{children:(0,Rr.jsx)(fk,{...a})})});var Z4=Be(ut(),1),X4=Be(H4(),1);function hw(a,i={}){let u=document.getElementById(a);if(!u)throw new Error(`Container with id "${a}" not found.`);let f=(0,X4.createRoot)(u);return f.render(Z4.default.createElement(kv,i)),f}var Uy={createErrorResponse(a,i,u){return{error:{code:i,message:u},requestId:a.requestId,sdkVersion:a.sdkVersion,success:!1,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},decodePolyline(a,i){let u=0,f=0,m=0,s=[],I=10**i;for(;u<a.length;){let D,U=0,V=0;do D=a.charCodeAt(u++)-63,V|=(D&31)<<U,U+=5;while(D>=32);let Q=V&1?~(V>>1):V>>1;f+=Q,U=0,V=0;do D=a.charCodeAt(u++)-63,V|=(D&31)<<U,U+=5;while(D>=32);let K=V&1?~(V>>1):V>>1;m+=K,s.push([m/I,f/I])}return s},async fetchOSRMRoute(a,i,u,f){let m=i.map(K=>`${K[0]},${K[1]}`).join(";"),I=`${f}/route/v1/${u==="walking"?"foot":u==="driving"?"car":"bike"}/${m}?overview=full&geometries=geojson&steps=true`,D=await fetch(I);if(!D.ok)throw new Error(`OSRM Error: ${D.statusText}`);let U=await D.json();if(U.code!=="Ok"||!U.routes||U.routes.length===0)throw new Error("NO_ROUTE");let V=U.routes[0],Q=V.legs?.flatMap(K=>K.steps?.map(te=>({distance:te.distance,duration:te.duration,instruction:te.maneuver?.instruction||"Continue"})))||[];return{data:{distanceMeters:V.distance,durationSeconds:V.duration,geometry:V.geometry,steps:Q},requestId:a.requestId,sdkVersion:a.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},async fetchRoute(a,i){let{origin:u,destination:f,waypoints:m,profile:s,language:I}=a.payload;if(!this.isValidCoordinate(u)||!this.isValidCoordinate(f))return this.createErrorResponse(a,"INVALID_INPUT","Origin or destination coordinates are invalid.");if(m&&!m.every(this.isValidCoordinate))return this.createErrorResponse(a,"INVALID_INPUT","One or more waypoints are invalid.");let D=[u,...m||[],f];try{return i.backend==="osrm"?await this.fetchOSRMRoute(a,D,s,i.baseUrl):await this.fetchValhallaRoute(a,D,s,I,i.baseUrl)}catch(U){return U instanceof Error&&U.message.includes("NO_ROUTE")?this.createErrorResponse(a,"NO_ROUTE","No route could be found for the given points."):U instanceof TypeError?this.createErrorResponse(a,"NETWORK_ERROR","Failed to connect to the routing backend."):this.createErrorResponse(a,"BACKEND_ERROR",`Routing backend error: ${U instanceof Error?U.message:"Unknown error"}`)}},async fetchValhallaRoute(a,i,u,f,m){let I={costing:u==="driving"?"auto":u==="walking"?"pedestrian":"bicycle",directions_options:{language:f||"en-US"},locations:i.map(te=>({lat:te[1],lon:te[0]}))},D=await fetch(`${m}/route`,{body:JSON.stringify(I),headers:{"Content-Type":"application/json"},method:"POST"});if(!D.ok)throw new Error(`Valhalla Error: ${D.statusText}`);let U=await D.json();if(!U.trip||!U.trip.legs||U.trip.legs.length===0)throw new Error("NO_ROUTE");let V=U.trip,Q=this.decodePolyline(V.legs[0].shape,6),K=V.legs.flatMap(te=>te.maneuvers?.map($=>({distance:$.length*1e3,duration:$.time,instruction:$.instruction||"Continue"})))||[];return{data:{distanceMeters:V.summary.length*1e3,durationSeconds:V.summary.time,geometry:{coordinates:Q,type:"LineString"},steps:K},requestId:a.requestId,sdkVersion:a.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},isValidCoordinate(a){let[i,u]=a;return i>=-180&&i<=180&&u>=-90&&u<=90}};var qm="0.5.3";function W4(a){let i=Object.getOwnPropertyNames(a);for(let u of i){let f=a[u];f&&typeof f=="object"&&!Object.isFrozen(f)&&!(f instanceof Lp)&&W4(f)}return Object.freeze(a)}var pw=null,Vm=class{maps=Object.freeze({render:hw});bridge;storage=Object.freeze({get:i=>this.bridge.send("STORAGE_GET",{key:i}),getAll:()=>this.bridge.send("STORAGE_GET_ALL"),set:(i,u)=>this.bridge.send("STORAGE_SET",{key:i,value:u})});secureStore=Object.freeze({get:i=>this.bridge.send("SECURE_GET",{key:i}),set:(i,u)=>this.bridge.send("SECURE_SET",{key:i,value:u})});database=Object.freeze({getUserData:()=>this.bridge.send("DATABASE_GET_USER_DATA"),setUserData:i=>this.bridge.send("DATABASE_SET_USER_DATA",{data:i})});location=Object.freeze({getCurrentPosition:()=>this.bridge.send("GET_CURRENT_POSITION"),startStream:i=>this.bridge.send("START_LOCATION_STREAM",i),stopStream:()=>this.bridge.send("STOP_LOCATION_STREAM")});user=Object.freeze({getProfile:i=>this.bridge.send("GET_USER_PROFILE",{fields:i}),getProfilePicture:(i=>this.bridge.send("GET_PROFILE_PICTURE",{uuids:i||[]}))});permission=Object.freeze({request:((i,u)=>this.bridge.send("REQUEST_PERMISSION",{fields:u,type:i}))});payment=Object.freeze({request:i=>this.bridge.send("PAYMENT_REQUEST",i)});activity=Object.freeze({start:(i,u,f)=>this.bridge.send("START_ACTIVITY",{id:i,status:f,title:u})});haptic=Object.freeze({trigger:i=>this.bridge.send("TRIGGER_HAPTIC",{style:i})});network=Object.freeze({request:async i=>this.bridge.send("NETWORK_REQUEST",i)});navigation=Object.freeze({abort:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_ABORT",type:"EVENT"})},createJourney:i=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_CREATE",payload:{...i,mode:"preview"},type:"EVENT"})},start:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_START",type:"EVENT"})}});fidelity=Object.freeze({getFidelityBalance:()=>this.bridge.send("GET_FIDELITY_BALANCE"),getFidelityHistory:i=>this.bridge.send("GET_FIDELITY_HISTORY",i),showHistory:i=>this.bridge.send("SHOW_FIDELITY_HISTORY",i),spendFPoints:i=>this.bridge.send("SPEND_FPOINTS",{intentUuid:i})});ui=Object.freeze({exit:()=>this.bridge.send("EXIT"),setScrollConfig:i=>this.bridge.send("SET_SCROLL_CONFIG",i)});debug=Object.freeze({log:(...i)=>this.bridge.send("DEBUG_LOG",{message:i})});routing=Object.freeze({clearRoute:()=>{let i=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_CLEARROUTE",{requestId:i,sdkVersion:qm})},drawRoute:i=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_DRAWROUTE",{payload:{routeData:i},requestId:u,sdkVersion:qm})},getRoute:async i=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2),f={payload:i,requestId:u,sdkVersion:qm,type:"SDK_ROUTING_GETROUTE"};if(pw){let m=await Uy.fetchRoute(f,pw);if(m.success&&m.data)return m.data;throw new Error(m.error?.message||"Routing failed")}return this.bridge.send("SDK_ROUTING_GETROUTE",{payload:i,requestId:u,sdkVersion:qm})}});constructor(){this.bridge=new Lp,this.initialize=this.initialize.bind(this),this.on=this.on.bind(this),this.off=this.off.bind(this)}config(i){i.routingBackend&&(pw=i.routingBackend)}updateContext(i){return this.bridge.send("UPDATE_CONTEXT",i)}initialize(i){return this.bridge.send("INITIALIZE",i)}on(i,u){return this.bridge.on(i,u)}off(i,u){this.bridge.off(i,u)}},er=W4(new Vm);var Ma=Be(ut(),1),bt=Be(It(),1),q8=(a,i)=>{let u=a[1]*Math.PI/180,f=i[1]*Math.PI/180,m=(i[0]-a[0])*Math.PI/180,s=Math.sin(m)*Math.cos(f),I=Math.cos(u)*Math.sin(f)-Math.sin(u)*Math.cos(f)*Math.cos(m);return(Math.atan2(s,I)*180/Math.PI+360)%360},mw=({appId:a,initialLocation:i=[6.1258,45.9058],isMoving:u=!1,simulationPath:f,simulationSpeed:m=1,mockJWTToken:s,children:I})=>{let[D,U]=(0,Ma.useState)(u),[V,Q]=(0,Ma.useState)(i),[K,te]=(0,Ma.useState)(0),[$,Ce]=(0,Ma.useState)(m),[ye,he]=(0,Ma.useState)(!1),[le,ee]=(0,Ma.useState)(!0),[de,_e]=(0,Ma.useState)(0),[Ae,Re]=(0,Ma.useState)("m"),[Z,H]=(0,Ma.useState)(!1),oe=(0,Ma.useRef)(null),ge=(0,Ma.useRef)(0),De=(0,Ma.useRef)(null),$e=(0,Ma.useRef)({autoMove:D,heading:K,location:V,mockJWTToken:s,pushLocationUpdate:()=>{},setHeading:te,setLocation:Q,simulationPath:f,speedMultiplier:$}),Ve=(0,Ma.useCallback)((Ue,He)=>{let Oe=$e.current,Wt={accelerometer:null,heading:{accuracy:3,magneticHeading:He,trueHeading:He},location:{coords:{accuracy:10,altitude:0,altitudeAccuracy:null,heading:He,latitude:Ue[1],longitude:Ue[0],speed:Oe.autoMove?1.5*Oe.speedMultiplier:0},timestamp:Date.now()},timestamp:Date.now()};window.__MiniAppBridge?.onNativeMessage({eventName:"LOCATION_STREAM_UPDATE",payload:Wt,type:"EVENT"})},[]),rt=(0,Ma.useCallback)(()=>{let Ue=$e.current;Ve(Ue.location,Ue.heading)},[Ve]),je=(0,Ma.useCallback)(Ue=>{Q(Ue),H(!1),Ve(Ue,$e.current.heading)},[Ve]);(0,Ma.useEffect)(()=>{$e.current={autoMove:D,heading:K,location:V,mockJWTToken:s,pushLocationUpdate:rt,setHeading:te,setLocation:Q,simulationPath:f,speedMultiplier:$}},[V,K,D,rt,f,$,s]),(0,Ma.useEffect)(()=>{U(u)},[u]),(0,Ma.useEffect)(()=>{Ce(m)},[m]),(0,Ma.useEffect)(()=>{f&&f.length>0&&(ge.current=0,Q(f[0]))},[f]),(0,Ma.useEffect)(()=>{oe.current&&De.current&&er.bridge.send("START_LOCATION_STREAM",De.current)},[$]),(0,Ma.useEffect)(()=>{let Ue=er.bridge,He=Ue.send.bind(Ue),Oe=()=>{oe.current&&(clearInterval(oe.current),oe.current=null),De.current=null},Wt=at=>{Oe(),De.current=at||{};let ot=at?.interval||500,Ye=Math.max(10,ot/$e.current.speedMultiplier);oe.current=setInterval(()=>{let it=$e.current;if(it.autoMove)if(it.simulationPath&&it.simulationPath.length>0)if(ge.current<it.simulationPath.length-1){let mt=it.simulationPath[ge.current],ia=it.simulationPath[ge.current+1];ge.current+=1;let gt=q8(mt,ia);it.setHeading(gt),it.setLocation(ia)}else it.setLocation(it.simulationPath[it.simulationPath.length-1]);else it.setLocation(mt=>[mt[0]+(Math.random()-.5)*1e-4,mt[1]+(Math.random()-.5)*1e-4]);it.pushLocationUpdate()},Ye)},ca=async at=>{let{url:ot,method:Ye="GET",headers:it={},body:mt}=at,ia=$e.current,gt=new Headers(it);ia.mockJWTToken&&gt.set("Authorization",`Bearer ${ia.mockJWTToken.replace("Bearer ","")}`),mt&&typeof mt=="object"&&!gt.has("Content-Type")&&gt.set("Content-Type","application/json");try{let Rt=await fetch(ot,{body:mt?typeof mt=="string"?mt:JSON.stringify(mt):void 0,headers:gt,method:Ye}),st=Rt.headers.get("content-type"),Kt;st?.includes("application/json")?Kt=await Rt.json():Kt=await Rt.text();let Gt={};return Rt.headers.forEach((qt,Bt)=>{Gt[Bt]=qt}),{data:Kt,headers:Gt,status:Rt.status,statusText:Rt.statusText}}catch(Rt){throw{error:Rt.message||"Network request failed",status:0}}};return Ue.send=async(at,ot)=>{if(at==="INITIALIZE")return Promise.resolve({appId:a,context:{theme:"dark"},description:"Mocked for Dev",env:{},insets:{bottom:0,left:0,right:0,top:0},name:"Vite Dev (Mock)",params:{},profile:{admin:!0,countryCode:"FR",createdAt:new Date().toISOString(),email:"caveman@up.app",firstName:"Smart",fullName:"Smart Caveman",lastName:"Caveman",localNumber:"0600000000",ups:100,username:"smart_caveman",uuid:"mock-user-42",xp:500},success:!0,userData:{},uuid:a||"mock-app-id",version:"1.0.0"});if(at==="GET_CURRENT_POSITION"){let Ye=$e.current;return Promise.resolve({coords:{accuracy:10,altitude:0,altitudeAccuracy:0,heading:Ye.heading,latitude:Ye.location[1],longitude:Ye.location[0],speed:Ye.autoMove?1.5*Ye.speedMultiplier:0},timestamp:Date.now()})}if(at==="START_LOCATION_STREAM")return Wt(ot),Promise.resolve();if(at==="STOP_LOCATION_STREAM")return Oe(),Promise.resolve();if(at==="NETWORK_REQUEST")return ca(ot);if(at==="STORAGE_GET"||at==="SECURE_GET")return Promise.resolve(localStorage.getItem(`mock_sdk_${ot.key}`));if(at==="STORAGE_SET"||at==="SECURE_SET")return localStorage.setItem(`mock_sdk_${ot.key}`,ot.value),Promise.resolve();if(at==="GET_USER_PROFILE")return Promise.resolve({admin:!0,countryCode:"FR",createdAt:new Date().toISOString(),email:"caveman@up.app",firstName:"Smart",fullName:"Smart Caveman",lastName:"Caveman",localNumber:"0600000000",ups:100,username:"smart_caveman",uuid:"mock-user-42",xp:500});if(at==="GET_PROFILE_PICTURE"){let Ye=ot?.uuids||[];if(Ye.length===0)return Promise.resolve("https://api.dicebear.com/9.x/rings/png?seed=dummy");let it={};for(let mt of Ye)it[mt]=`https://api.dicebear.com/9.x/rings/png?seed=${mt}`;return Promise.resolve(it)}return at==="GET_FIDELITY_BALANCE"?Promise.resolve({balance:1337,currency:"FPoints"}):at==="PAYMENT_REQUEST"?Promise.resolve({success:!0,transactionId:`tx_${Math.random().toString(36).slice(2)}`}):at==="TRIGGER_HAPTIC"||at==="EXIT"||at==="UPDATE_CONTEXT"?Promise.resolve({success:!0}):He(at,ot)},he(!0),()=>{Oe(),Ue.send=He}},[a]);let tt=Ae==="km"?de*1e3:de,ze=(0,Ma.useMemo)(()=>({isPlacingLocation:Z,placeLocation:je,radiusMeters:tt}),[Z,je,tt]);return ye?(0,bt.jsxs)("div",{className:"relative w-full h-full",children:[(0,bt.jsx)("div",{className:"w-full h-full",children:(0,bt.jsx)(tf.Provider,{value:ze,children:I})}),le?(0,bt.jsx)(Na,{className:"fixed bottom-4 right-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-blue-400 hover:bg-slate-900/80 z-[9999] transition-all shadow-lg group p-0!",onClick:()=>ee(!1),title:"Open Simulation Controls",type:"button",variant:"ghost",children:(0,bt.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,bt.jsx)("path",{d:"M21 4H3"}),(0,bt.jsx)("path",{d:"M10 8H3"}),(0,bt.jsx)("path",{d:"M21 12H3"}),(0,bt.jsx)("path",{d:"M10 16H3"}),(0,bt.jsx)("path",{d:"M21 20H3"}),(0,bt.jsx)("circle",{cx:"14",cy:"8",r:"2"}),(0,bt.jsx)("circle",{cx:"14",cy:"16",r:"2"})]})}):(0,bt.jsxs)("div",{className:"fixed bottom-4 right-4 bg-slate-900 text-slate-300 font-mono text-xs rounded-xl shadow-2xl border border-slate-700 pointer-events-auto flex flex-col w-80 overflow-hidden animate-in slide-in-from-right duration-300",style:{zIndex:9998},children:[(0,bt.jsxs)("div",{className:"flex justify-between items-center p-3 border-b border-slate-800 cursor-pointer bg-slate-800/50 hover:bg-slate-800 transition-colors",onClick:()=>ee(!0),children:[(0,bt.jsxs)("span",{className:"font-bold text-slate-100 flex items-center gap-2",children:[(0,bt.jsx)("span",{className:"text-lg",children:"\u{1F6E0}\uFE0F"})," Simulation Controls"]}),(0,bt.jsx)(Na,{className:"text-slate-500 hover:text-white p-0 h-auto hover:bg-transparent cursor-pointer",type:"button",variant:"ghost",children:"\u25BC"})]}),(0,bt.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,bt.jsxs)("div",{className:"flex justify-between items-center",children:[(0,bt.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,bt.jsx)("input",{checked:D,className:"accent-blue-500 w-4 h-4",onChange:Ue=>U(Ue.target.checked),type:"checkbox"}),(0,bt.jsxs)("span",{className:"text-slate-200 font-bold",children:["Auto-Move ",f?"(Path)":"(Random)"]})]}),(0,bt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),(0,bt.jsx)("select",{className:"bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white focus:outline-none focus:border-blue-500 text-[10px]",onChange:Ue=>Ce(Number(Ue.target.value)),value:$,children:[1,2,5,10,50,100,250].map(Ue=>(0,bt.jsxs)("option",{value:Ue,children:[Ue,"x"]},Ue))})]})]}),(0,bt.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,bt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lng"}),(0,bt.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Ue=>{let He=parseFloat(Ue.target.value)||0;Q([He,V[1]]),rt()},step:"0.001",type:"number",value:V[0]})]}),(0,bt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lat"}),(0,bt.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Ue=>{let He=parseFloat(Ue.target.value)||0;Q([V[0],He]),rt()},step:"0.001",type:"number",value:V[1]})]}),(0,bt.jsxs)("div",{className:"flex flex-col gap-1 col-span-2",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Heading (Degrees)"}),(0,bt.jsx)("input",{className:"w-full accent-blue-500",max:"360",min:"0",onChange:Ue=>{te(parseInt(Ue.target.value,10)),rt()},type:"range",value:K}),(0,bt.jsxs)("div",{className:"text-right text-slate-400",children:[K,"\xB0"]})]})]}),(0,bt.jsx)(Na,{className:`w-full rounded px-2 py-1.5 text-[10px] font-bold border cursor-pointer ${Z?"bg-blue-500/20 border-blue-500 text-blue-300":"bg-slate-800 border-slate-700 text-slate-200 hover:bg-slate-700"}`,onClick:()=>H(Ue=>!Ue),type:"button",variant:"ghost",children:Z?"\u{1F4CD} Click the map to drop location\u2026":"\u{1F4CD} Drop location on map"}),(0,bt.jsxs)("div",{className:"flex flex-col gap-1 border-t border-slate-800 pt-3",children:[(0,bt.jsxs)("div",{className:"flex justify-between items-center",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Scan Radius"}),(0,bt.jsxs)("div",{className:"flex items-center gap-1",children:[(0,bt.jsx)("input",{className:"w-16 bg-slate-800 border border-slate-700 rounded px-1.5 py-0.5 text-white text-[10px] focus:outline-none focus:border-blue-500",min:"0",onChange:Ue=>_e(Math.max(0,Number(Ue.target.value)||0)),type:"number",value:de}),(0,bt.jsxs)("select",{className:"bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white text-[10px] focus:outline-none focus:border-blue-500",onChange:Ue=>Re(Ue.target.value),value:Ae,children:[(0,bt.jsx)("option",{value:"m",children:"m"}),(0,bt.jsx)("option",{value:"km",children:"km"})]})]})]}),(0,bt.jsx)("input",{className:"w-full accent-blue-500",max:Ae==="km"?10:500,min:"0",onChange:Ue=>_e(Number(Ue.target.value)),step:Ae==="km"?.1:5,type:"range",value:de}),(0,bt.jsx)("div",{className:"text-right text-slate-400",children:de===0?"hidden":`${de}${Ae} radius around user`})]})]})]})]}):null};var ns=Be(ut(),1),Ca=Be(It(),1),gw=({isOpen:a=!1,onClose:i})=>{let[u,f]=(0,ns.useState)(a),[m,s]=(0,ns.useState)([]),I=(0,ns.useRef)(null);(0,ns.useEffect)(()=>{f(a)},[a]);let D=()=>s([]),U=(0,ns.useCallback)((V,Q)=>{if(V.includes("LOCATION_STREAM_UPDATE"))return;let K={content:typeof Q=="string"?Q:JSON.stringify(Q,null,2),id:Math.random().toString(36).slice(2),label:V,time:new Date().toLocaleTimeString()};s(te=>[K,...te].slice(0,100))},[]);return(0,ns.useEffect)(()=>{if(typeof window>"u")return;let V=er.bridge,Q=V.send.bind(V);V.send=async(te,$)=>(U(`OUT: ${te}`,$),Q(te,$));let K=V.handleNativeMessage.bind(V);return V.handleNativeMessage=te=>{let $=te.eventName||te.event||te.type||"MSG";typeof $=="string"&&(U(`IN: ${$}`,te.payload||te.value||te),K(te))},()=>{V.send=Q,V.handleNativeMessage=K}},[U]),u?(0,Ca.jsxs)("div",{className:"fixed inset-x-0 bottom-0 w-full bg-[#0a080f] border-t border-slate-800 z-[9998] p-4 shadow-2xl flex flex-col animate-in slide-in-from-bottom duration-300",children:[(0,Ca.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,Ca.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-400 flex items-center gap-2",children:[(0,Ca.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),"UP SDK Debug Console"]}),(0,Ca.jsxs)("div",{className:"flex gap-4",children:[(0,Ca.jsx)(Na,{className:"text-[10px] text-slate-500 font-bold uppercase hover:text-slate-300 hover:bg-transparent transition-colors p-0 h-auto cursor-pointer",onClick:D,type:"button",variant:"ghost",children:"Clear"}),(0,Ca.jsx)(Na,{className:"text-[10px] text-pink-500 font-bold uppercase hover:text-pink-400 hover:bg-transparent transition-colors p-0 h-auto cursor-pointer",onClick:()=>{f(!1),i&&i()},type:"button",variant:"ghost",children:"Close"})]})]}),(0,Ca.jsx)("div",{className:"bg-black/80 rounded-xl p-3 font-mono text-[10px] text-emerald-400 min-h-[120px] max-h-[240px] overflow-y-auto border border-slate-900 custom-scrollbar",ref:I,children:m.length===0?(0,Ca.jsx)("div",{className:"text-slate-600 italic text-center py-8",children:"No logs yet. Interacting with the SDK will show events here."}):m.map(V=>(0,Ca.jsxs)("div",{className:"mb-3 pb-3 border-b border-slate-900/50 last:border-0 last:mb-0 last:pb-0",children:[(0,Ca.jsxs)("div",{className:"flex gap-2 text-slate-500 mb-1 items-center",children:[(0,Ca.jsx)("span",{className:"text-[8px]",children:V.time}),(0,Ca.jsx)("span",{className:"font-bold text-white uppercase text-[8px] bg-slate-800 px-1.5 py-0.5 rounded leading-none",children:V.label})]}),(0,Ca.jsx)("pre",{className:"whitespace-pre-wrap break-all opacity-90",children:V.content})]},V.id))})]}):(0,Ca.jsx)(Na,{className:"fixed bottom-4 left-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-emerald-400 hover:bg-slate-900/80 transition-all z-[9998] shadow-lg group p-0!",onClick:()=>f(!0),title:"Open Debug Console",type:"button",variant:"ghost",children:(0,Ca.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,Ca.jsx)("path",{d:"m8 2 1.88 1.88"}),(0,Ca.jsx)("path",{d:"M14.12 3.88 16 2"}),(0,Ca.jsx)("path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"}),(0,Ca.jsx)("path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"}),(0,Ca.jsx)("path",{d:"M12 20v-9"}),(0,Ca.jsx)("path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5"}),(0,Ca.jsx)("path",{d:"M6 13H2"}),(0,Ca.jsx)("path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4"}),(0,Ca.jsx)("path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4"}),(0,Ca.jsx)("path",{d:"M22 13h-4"}),(0,Ca.jsx)("path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4"})]})})};var oh=Be(ut(),1);var nl=Be(It(),1),yw=(0,oh.createContext)({isMocked:!1}),V8=()=>(0,oh.useContext)(yw).isMocked,j8=({children:a,debug:i=!1,...u})=>{let f=typeof window<"u"&&!(window.__UP_REACT_NATIVE_APP__===!0||window.ReactNativeWebView),m=(0,oh.useMemo)(()=>({isMocked:f}),[f]),s=(0,nl.jsxs)(nl.Fragment,{children:[a,(i||f)&&(0,nl.jsx)(gw,{})]});return f?(0,nl.jsx)(yw.Provider,{value:m,children:(0,nl.jsx)(mw,{...u,children:s})}):(0,nl.jsx)(yw.Provider,{value:m,children:s})};var Ii=Be(ut(),1),qy=Be(It(),1),$4=8,G8=40,H8=.4,Z8=.35,X8="cubic-bezier(0.16, 1, 0.3, 1)",W8=300,$8=15,Y8=200,K8=.5,Q8=2,J8=1,e7="[data-swipe-scroll-root]",Y4=`transform ${W8}ms ${X8}`,t7=({items:a,activeId:i,onActiveChange:u,peek:f=1.1,gap:m=10,className:s,itemClassName:I,axisPriority:D="horizontal",verticalDrag:U,overscan:V=Q8,visibleOverscan:Q=J8})=>{let K=(0,Ii.useRef)(null),[te,$]=(0,Ii.useState)(0),[Ce,ye]=(0,Ii.useState)(0),[he,le]=(0,Ii.useState)(0),[ee,de]=(0,Ii.useState)(!1),[_e,Ae]=(0,Ii.useState)(!1),Re=(0,Ii.useRef)(null),[Z,H]=(0,Ii.useState)(()=>Math.max(0,a.findIndex(at=>at.id===i))),oe=(0,Ii.useRef)(i),[ge,De]=(0,Ii.useState)(!0);(0,Ii.useEffect)(()=>{let at=setTimeout(()=>{De(!1)},1e3);return()=>clearTimeout(at)},[]),(0,Ii.useEffect)(()=>{if(i!==oe.current){let at=a.findIndex(ot=>ot.id===i);at!==-1&&H(at),oe.current=i}},[i,a]);let $e=Math.min(Math.max(Z,0),Math.max(a.length-1,0));(0,Ii.useLayoutEffect)(()=>{let at=K.current;if(!at)return;let ot=()=>$(at.clientWidth);ot();let Ye=new ResizeObserver(ot);return Ye.observe(at),()=>Ye.disconnect()},[]);let Ve=te/f,rt=Ve+m,tt=(te-Ve)/2-$e*rt+Ce,ze=at=>{H(at);let ot=a[at];ot&&ot.id!==i&&u(ot.id)},Ue=at=>{let ot=at.targetTouches[0];if(!ot)return;let Ye=!1;if(U){let it=U.scrollRootSelector??e7,mt=at.target.closest(it);Ye=!mt||mt.scrollTop<=2}Re.current={lastT:at.timeStamp,lastX:ot.clientX,lastY:ot.clientY,lockedAxis:null,startX:ot.clientX,startY:ot.clientY,velocityX:0,velocityY:0,verticalAllowed:Ye}},He=at=>{let ot=at.targetTouches[0],Ye=Re.current;if(!ot||!Ye)return;let it=ot.clientX-Ye.startX,mt=ot.clientY-Ye.startY;if(!Ye.lockedAxis){if(Math.abs(it)<$4&&Math.abs(mt)<$4)return;Math.abs(it)>Math.abs(mt)||Math.abs(it)===Math.abs(mt)&&D==="horizontal"?Ye.lockedAxis="x":U&&Ye.verticalAllowed?Ye.lockedAxis="y":Ye.lockedAxis="passthrough"}if(Ye.lockedAxis==="passthrough")return;let ia=at.timeStamp-Ye.lastT;if(ia>0&&(Ye.velocityX=(ot.clientX-Ye.lastX)/ia,Ye.velocityY=(ot.clientY-Ye.lastY)/ia),Ye.lastX=ot.clientX,Ye.lastY=ot.clientY,Ye.lastT=at.timeStamp,Ye.lockedAxis==="x"){ee||de(!0);let gt=$e===0&&it>0,Rt=$e===a.length-1&&it<0;ye(gt||Rt?it*Z8:it)}else if(U){let gt=U.direction??"down",Rt=mt;gt==="down"&&(Rt=Math.max(0,mt)),gt==="up"&&(Rt=Math.min(0,mt));let st=Math.sign(Rt)*Math.max(0,Math.abs(Rt)-$8);_e||Ae(!0),le(st),U.onDragChange?.(st,!0)}at.cancelable&&at.preventDefault()},Oe=()=>{let at=Re.current;if(Re.current=null,de(!1),Ae(!1),!at){ye(0),le(0);return}if(at.lockedAxis==="x"){if(Math.abs(Ce)>G8||Math.abs(at.velocityX)>H8){let Ye=Ce<0?Math.min(a.length-1,$e+1):Math.max(0,$e-1);ze(Ye)}}else if(at.lockedAxis==="y"){let ot=U?.dismissThreshold??Y8,Ye=U?.dismissVelocity??K8,it=U?.direction??"down",mt=it==="down"?Math.max(0,at.velocityY):it==="up"?Math.max(0,-at.velocityY):Math.abs(at.velocityY);(Math.abs(he)>ot||mt>Ye)&&U?.onDismiss?.()}ye(0),le(0),U?.onDragChange?.(0,!1)},Wt=Math.max(0,$e-V),ca=Math.min(a.length-1,$e+V);return(0,qy.jsx)("div",{className:`relative overflow-hidden touch-pan-y ${s??""}`,onTouchCancel:Oe,onTouchEnd:Oe,onTouchMove:He,onTouchStart:Ue,ref:K,children:(0,qy.jsx)("div",{className:"relative h-full",style:{transform:`translateX(${tt}px)`,transition:ee||ge?"none":Y4,willChange:"transform"},children:a.map((at,ot)=>{if(ot<Wt||ot>ca)return null;let Ye=ot===$e,it=Ye?he:0,mt=Math.abs(ot-$e),ia=mt<=Q;return(0,qy.jsx)("div",{className:`absolute top-0 left-0 h-full shrink-0 ${I??""} ${at.className??""}`,style:{opacity:ia?1:0,pointerEvents:ia?void 0:"none",transform:`translateX(${ot*rt}px) translateY(${it}px)`,transition:Ye&&_e||ge?"none":Y4,width:`${Ve}px`,zIndex:V+1-mt},children:at.content},at.id)})})})};async function a7(a,i){return Uy.fetchRoute(a,i)}function r7(a,i,u){let f=`sdk-route-${i}`,m=`sdk-route-casing-${i}`,s=`sdk-route-line-${i}`,I={features:[{geometry:u.payload.routeData.geometry,properties:{},type:"Feature"}],type:"FeatureCollection"},D=a.getSource(f);D?D.setData(I):(a.addSource(f,{data:I,type:"geojson"}),a.addLayer({id:m,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#111111","line-opacity":.8,"line-width":8},source:f,type:"line"}),a.addLayer({id:s,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":4},source:f,type:"line"}))}function i7(a,i){let u=`sdk-route-${i}`,f=`sdk-route-casing-${i}`,m=`sdk-route-line-${i}`;a.getLayer(m)&&a.removeLayer(m),a.getLayer(f)&&a.removeLayer(f),a.getSource(u)&&a.removeSource(u)}var o7=er;return K6(n7);})();
856
+ `}),(0,Ft.jsx)("div",{className:`absolute inset-0 bg-black/45 backdrop-blur-[1px] transition-opacity duration-300 z-30 ${Kt}`,onClick:()=>u("closed")}),f==="left"?(0,Ft.jsxs)(Ft.Fragment,{children:[i==="closed"&&(0,Ft.jsx)(Na,{className:"absolute top-4 left-4 z-40 w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer hover:bg-zinc-900 hover:text-white p-0!",onClick:()=>u("full"),variant:"ghost",children:(0,Ft.jsxs)("svg",{fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,Ft.jsx)("line",{x1:"4",x2:"20",y1:"12",y2:"12"}),(0,Ft.jsx)("line",{x1:"4",x2:"20",y1:"6",y2:"6"}),(0,Ft.jsx)("line",{x1:"4",x2:"20",y1:"18",y2:"18"})]})}),(0,Ft.jsx)(j5,{onOpenChange:yt=>u(yt?"full":"closed"),open:i!=="closed",children:(0,Ft.jsxs)(cv,{className:"w-80 bg-zinc-950/85 backdrop-blur-md border-r border-y border-white/10 rounded-r-2xl shadow-2xl p-4 text-white flex flex-col h-full overflow-hidden",portal:!1,side:"left",children:[(0,Ft.jsx)(dv,{className:"pb-3 border-b border-white/10 mb-2 text-left",children:(0,Ft.jsx)(fv,{className:"text-sm font-bold tracking-wider text-zinc-400 uppercase",children:"Menu"})}),(0,Ft.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar pr-2",onScroll:Ue,ref:H,children:he||(0,Ft.jsx)("div",{className:"flex flex-col gap-1.5",children:a.map(yt=>(0,Ft.jsxs)(Na,{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${yt.disabled?"opacity-45 cursor-not-allowed pointer-events-none":""}`,disabled:yt.disabled,onClick:()=>{yt.disabled||(yt.onPress(),u("closed"))},variant:"ghost",children:[(0,Ft.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[yt.icon,yt.badge!==void 0&&(0,Ft.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:yt.badge})]}),(0,Ft.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:yt.label})]},yt.id))})}),_e&&tt&&(0,Ft.jsx)(Na,{className:"absolute bottom-6 right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black hover:text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer p-0!",onClick:()=>{H.current?.scrollTo({behavior:"smooth",top:0})},variant:"ghost",children:(0,Ft.jsx)("svg",{fill:"none",height:"20",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Ft.jsx)("polyline",{points:"18 15 12 9 6 15"})})})]})})]}):(0,Ft.jsxs)("div",{className:`absolute w-full bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-t-2xl shadow-2xl flex flex-col z-40 select-none ${Q?"transition-none":"transition-transform duration-300 ease-out"}`,ref:oe,style:{bottom:"0px",height:`${i==="auto"?Math.max(qt,ao):qt}px`,marginBottom:i==="closed"?`${Re.bottom}px`:"0px",transform:Or(),transition:Q?"none":"transform 300ms ease-out, height 300ms ease-out, margin-bottom 250ms ease-in-out"},children:[ee&&(0,Ft.jsx)("div",{className:"w-full h-8 flex flex-col items-center justify-center cursor-pointer hover:bg-white/5 rounded-t-2xl transition-colors border-b border-white/5",onClick:()=>{at.current||$e()},ref:ge,children:(0,Ft.jsx)("div",{className:"w-12 h-1 bg-white/25 rounded-full"})}),(0,Ft.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden px-4 pb-4 pt-2 transition-[margin-top] duration-250 ease-in-out relative",ref:De,style:{marginTop:i==="closed"?`${Re.bottom}px`:"0px"},children:[(0,Ft.jsx)("div",{className:"flex-1 overflow-y-auto no-scrollbar",onScroll:Ue,ref:H,style:{paddingBottom:i==="peek"?`${$r}px`:"0px"},children:he||(0,Ft.jsx)("div",{className:"flex flex-col gap-1",children:a.map(yt=>(0,Ft.jsxs)(Na,{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 justify-start hover:bg-white/5 hover:text-white active:bg-white/10 text-white ${yt.disabled?"opacity-45 cursor-not-allowed pointer-events-none":""}`,disabled:yt.disabled,onClick:()=>{yt.disabled||(yt.onPress(),u("closed"))},variant:"ghost",children:[(0,Ft.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[yt.icon,yt.badge!==void 0&&(0,Ft.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:yt.badge})]}),(0,Ft.jsx)("span",{className:"text-sm font-medium tracking-wide",children:yt.label})]},yt.id))})}),_e&&tt&&(0,Ft.jsx)(Na,{className:"absolute right-6 z-50 flex items-center justify-center w-10 h-10 rounded-full bg-cyan-500 hover:bg-cyan-400 active:scale-95 text-black hover:text-black shadow-lg shadow-cyan-500/25 transition-all duration-200 cursor-pointer p-0!",onClick:()=>{H.current?.scrollTo({behavior:"smooth",top:0})},style:{bottom:i==="peek"?`calc(${24+$r}px + var(--drag-offset, 0px))`:"calc(24px + var(--drag-offset, 0px))"},variant:"ghost",children:(0,Ft.jsx)("svg",{fill:"none",height:"20",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"20",xmlns:"http://www.w3.org/2000/svg",children:(0,Ft.jsx)("polyline",{points:"18 15 12 9 6 15"})})})]})]})]})});var fc=Be(ut(),1),hc=Be(It(),1),Y0=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("rounded-lg border bg-card text-card-foreground shadow-sm",a),ref:u,...i}));Y0.displayName="Card";var AD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("flex flex-col space-y-1.5 p-6",a),ref:u,...i}));AD.displayName="CardHeader";var PD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("text-2xl font-semibold leading-none tracking-tight",a),ref:u,...i}));PD.displayName="CardTitle";var RD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("text-sm text-muted-foreground",a),ref:u,...i}));RD.displayName="CardDescription";var K0=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("p-6 pt-0",a),ref:u,...i}));K0.displayName="CardContent";var DD=fc.forwardRef(({className:a,...i},u)=>(0,hc.jsx)("div",{className:zi("flex items-center p-6 pt-0",a),ref:u,...i}));DD.displayName="CardFooter";var pt=Be(It(),1),Z5=({etaData:a,layoutMode:i,onHeaderClick:u,style:f,isDragging:m=!1})=>i==="closed-banner"?(0,pt.jsxs)("div",{className:"w-full h-10 flex items-center justify-between px-4 pb-2 pt-1 border-b border-white/5 bg-zinc-950/15 relative overflow-hidden",children:[(0,pt.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer flex-1",onClick:u,children:[(0,pt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,pt.jsxs)("span",{className:"text-xs font-bold text-emerald-400",children:[a.etaMins," min (",a.distanceRemainingKm.toFixed(1)," km)"]})]}),a.onAbort&&(0,pt.jsx)(Na,{className:"px-1 py-1 text-[10px] font-black bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/25 active:scale-95 rounded-md transition-all cursor-pointer pointer-events-auto h-auto p-0!",onClick:s=>{s.stopPropagation(),a.onAbort?.()},variant:"ghost",children:(0,pt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,pt.jsx)("path",{d:"M18 6 6 18"}),(0,pt.jsx)("path",{d:"m6 6 12 12"})]})}),a.progress!==void 0&&(0,pt.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-white/5",children:(0,pt.jsx)("div",{className:"h-full bg-cyan-400",style:{width:`${a.progress}%`}})})]}):i==="open-card"?(0,pt.jsxs)(Y0,{className:"mx-4 mt-2 p-4 bg-white/5 border border-white/10 rounded-xl flex flex-col text-card-foreground",children:[(0,pt.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,pt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pt.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,pt.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:a.label||"Journey Active"})]}),a.onAbort&&(0,pt.jsx)(Na,{className:"px-1 py-1 text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer pointer-events-auto h-auto p-0!",onClick:a.onAbort,variant:"ghost",children:(0,pt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,pt.jsx)("path",{d:"M18 6 6 18"}),(0,pt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,pt.jsxs)(K0,{className:"p-0 flex flex-col",children:[(0,pt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-1.5 mb-2.5",children:[(0,pt.jsxs)("div",{className:"text-center",children:[(0,pt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[a.etaMins,(0,pt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" min"})]}),(0,pt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Time Remaining"})]}),(0,pt.jsxs)("div",{className:"text-center",children:[(0,pt.jsxs)("div",{className:"text-xl font-black text-white leading-none",children:[a.distanceRemainingKm.toFixed(1),(0,pt.jsx)("span",{className:"text-xs text-zinc-400 font-normal",children:" km"})]}),(0,pt.jsx)("div",{className:"text-[8px] text-zinc-500 font-bold uppercase tracking-wider mt-1",children:"Distance Remaining"})]})]}),a.progress!==void 0&&(0,pt.jsxs)("div",{className:"mb-3",children:[(0,pt.jsxs)("div",{className:"flex justify-between text-[9px] font-bold text-zinc-400 mb-1",children:[(0,pt.jsx)("span",{children:"Progress"}),(0,pt.jsxs)("span",{children:[Math.round(a.progress),"%"]})]}),(0,pt.jsx)("div",{className:"h-1 bg-white/10 rounded-full overflow-hidden",children:(0,pt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${a.progress}%`}})})]}),a.mode==="preview"&&a.onStart&&(0,pt.jsx)(Na,{className:"w-full py-2.5 text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 hover:text-black active:scale-95 rounded-lg transition-all cursor-pointer h-auto",onClick:a.onStart,variant:"ghost",children:"Start Guidance"})]})]}):(0,pt.jsxs)(Y0,{className:`absolute left-1/2 -translate-x-1/2 z-40 w-[calc(100%-2rem)] max-w-[320px] sm:max-w-[380px] bg-zinc-950/85 backdrop-blur-md border border-white/10 rounded-2xl shadow-2xl p-3 sm:p-4 flex flex-col pointer-events-auto select-none text-card-foreground ${m?"transition-none":"transition-all duration-300 ease-out"}`,style:f,children:[(0,pt.jsxs)("div",{className:"flex items-center justify-between mb-2 sm:mb-3",children:[(0,pt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pt.jsx)("span",{className:"w-1.5 h-1.5 sm:w-2 sm:h-2 rounded-full bg-emerald-500 animate-pulse"}),(0,pt.jsx)("span",{className:"text-[9px] sm:text-[10px] font-bold text-emerald-400 uppercase tracking-wider",children:a.label||"Guidance Active"})]}),a.onAbort&&(0,pt.jsx)(Na,{className:"px-1 py-1 text-[10px] sm:text-xs font-bold bg-red-500/20 text-red-400 hover:bg-red-500/30 border border-red-500/30 active:scale-95 rounded-lg transition-all cursor-pointer h-auto p-0!",onClick:a.onAbort,variant:"ghost",children:(0,pt.jsxs)("svg",{className:"lucide lucide-x",fill:"none",height:"18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",viewBox:"0 0 24 24",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[(0,pt.jsx)("path",{d:"M18 6 6 18"}),(0,pt.jsx)("path",{d:"m6 6 12 12"})]})})]}),(0,pt.jsxs)(K0,{className:"p-0 flex flex-col",children:[(0,pt.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-white/10 py-0.5 sm:py-1 mb-2 sm:mb-3",children:[(0,pt.jsx)("div",{className:"text-center",children:(0,pt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[a.etaMins,(0,pt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","min"]})]})}),(0,pt.jsx)("div",{className:"text-center",children:(0,pt.jsxs)("div",{className:"text-base sm:text-lg font-black text-white leading-none",children:[a.distanceRemainingKm.toFixed(1),(0,pt.jsxs)("span",{className:"text-[10px] sm:text-xs text-zinc-400 font-normal",children:[" ","km"]})]})})]}),a.progress!==void 0&&(0,pt.jsxs)("div",{children:[(0,pt.jsxs)("div",{className:"flex justify-between text-[8px] sm:text-[9px] font-bold text-zinc-400 mb-1",children:[(0,pt.jsx)("span",{children:"Progress"}),(0,pt.jsxs)("span",{children:[Math.round(a.progress),"%"]})]}),(0,pt.jsx)("div",{className:"h-1 sm:h-1.5 bg-white/10 rounded-full overflow-hidden",children:(0,pt.jsx)("div",{className:"h-full bg-cyan-400 rounded-full",style:{width:`${a.progress}%`}})})]}),a.mode==="preview"&&a.onStart&&(0,pt.jsx)(Na,{className:"mt-2.5 sm:mt-3 py-1.5 sm:py-2 text-[11px] sm:text-xs font-bold bg-cyan-500 text-black hover:bg-cyan-400 hover:text-black active:scale-95 rounded-lg transition-all cursor-pointer h-auto",onClick:a.onStart,variant:"ghost",children:"Start Guidance"})]})]});var Jt=Be(It(),1),X5=({customControls:a=[],etaBarHeight:i,onRecenter:u,isMapCentered:f,mapBearing:m,mapPitch:s,onResetBearing:I,initialViewState:D,drawerState:U,side:V,etaData:Q,isDragging:K,clampedDragOffset:te,customRecenterButton:$,customCompassButton:Ce,drawerPeekHeight:ye,insets:he={bottom:0,left:0,right:0,top:0},bottomOffset:le=0})=>{let ee=a.filter(ge=>ge.position==="above-recenter"),de=a.filter(ge=>ge.position==="below-recenter"),_e=Math.abs(m)>=.5||Math.abs(s)>=.5,Ae="32px",Re=Q?i:U==="closed"?he.bottom:0,Z=typeof ye=="number"?`${ye}px`:ye||"15%",H=V==="bottom"?U==="closed"?`calc(${Ae} + 1rem + ${Re}px + ${le}px - var(--drag-offset, 0px))`:`calc(${Z} + 1rem + ${Q?i:0}px + ${le}px - var(--drag-offset, 0px))`:`calc(1rem + ${he.bottom}px + ${le}px)`;return(0,Jt.jsxs)("div",{className:`absolute right-4 z-30 flex flex-col items-center gap-3 select-none pointer-events-none ${K?"transition-none":"transition-all duration-300 ease-out"} ${V!=="bottom"||U!=="full"?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-75 pointer-events-none"}`,style:{bottom:H},children:[ee.length>0&&(0,Jt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:ee.map(ge=>(0,Jt.jsxs)("div",{className:"relative group flex items-center",children:[ge.tooltip&&(0,Jt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ge.tooltip}),(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer p-0! hover:bg-zinc-900 hover:text-white ${ge.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":""}`,onClick:ge.onPress,variant:"ghost",children:ge.icon})]},ge.id))}),_e&&(Ce?(0,Jt.jsx)("div",{className:"pointer-events-auto",children:Ce}):(0,Jt.jsx)("div",{className:"pointer-events-auto",children:(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all duration-300 p-0! hover:bg-zinc-900 hover:text-white ${_e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none h-0 w-0 border-none m-0 p-0 overflow-hidden"}`,onClick:()=>I({pitch:D?.pitch??0}),style:{transform:_e?"scale(1) rotate(0deg)":"scale(0.7) rotate(0deg)"},title:"Reset bearing to North",variant:"ghost",children:(0,Jt.jsxs)("svg",{className:"w-7 h-7 transition-transform duration-75 ease-out",fill:"none",style:{transform:`rotate(${-m}deg)`},viewBox:"0 0 24 24",children:[(0,Jt.jsx)("circle",{cx:"12",cy:"12",r:"9.5",stroke:"white",strokeOpacity:"0.2",strokeWidth:"1"}),(0,Jt.jsx)("path",{d:"M12 4.5L15 12H9L12 4.5Z",fill:"#ef4444"}),(0,Jt.jsx)("path",{d:"M12 19.5L9 12H15L12 19.5Z",fill:"#f4f4f5"}),(0,Jt.jsx)("circle",{cx:"12",cy:"12",fill:"#18181b",r:"1.5"})]})})})),$?(0,Jt.jsx)("div",{className:"pointer-events-auto",children:$}):(0,Jt.jsx)("div",{className:"pointer-events-auto",children:(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer p-0! hover:bg-zinc-900 hover:text-white ${f?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":""}`,onClick:()=>u(),title:"Recenter Map",variant:"ghost",children:f?(0,Jt.jsxs)("svg",{className:"w-6 h-6 text-cyan-400",fill:"none",stroke:"currentColor",strokeWidth:"2.2",viewBox:"0 0 24 24",children:[(0,Jt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,Jt.jsx)("circle",{cx:"12",cy:"12",fill:"currentColor",r:"3"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,Jt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,Jt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]}):(0,Jt.jsxs)("svg",{className:"w-6 h-6 text-zinc-300",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,Jt.jsx)("circle",{cx:"12",cy:"12",r:"8"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"2",y2:"4"}),(0,Jt.jsx)("line",{x1:"12",x2:"12",y1:"20",y2:"22"}),(0,Jt.jsx)("line",{x1:"2",x2:"4",y1:"12",y2:"12"}),(0,Jt.jsx)("line",{x1:"20",x2:"22",y1:"12",y2:"12"})]})})}),de.length>0&&(0,Jt.jsx)("div",{className:"flex flex-col gap-2 pointer-events-auto",children:de.map(ge=>(0,Jt.jsxs)("div",{className:"relative group flex items-center",children:[ge.tooltip&&(0,Jt.jsx)("div",{className:"absolute right-14 pointer-events-none opacity-0 scale-95 origin-right group-hover:opacity-100 group-hover:scale-100 transition-all duration-150 bg-zinc-900/95 border border-white/10 text-white text-xs px-2.5 py-1.5 rounded-lg shadow-xl whitespace-nowrap",children:ge.tooltip}),(0,Jt.jsx)(Na,{className:`w-12 h-12 rounded-full bg-zinc-950/80 backdrop-blur-md border border-white/10 shadow-lg flex items-center justify-center text-white active:scale-95 transition-all cursor-pointer p-0! hover:bg-zinc-900 hover:text-white ${ge.activeState?"ring-2 ring-cyan-400 ring-offset-2 ring-offset-zinc-950":""}`,onClick:ge.onPress,variant:"ghost",children:ge.icon})]},ge.id))})]})};var ra=Be(ut(),1),W5=Be(It(),1),$n=(0,ra.createContext)(null),pv=({children:a})=>{let[i,u]=(0,ra.useState)(!0),[f,m]=(0,ra.useState)(0),[s,I]=(0,ra.useState)(0),[D,U]=(0,ra.useState)("closed"),V=(0,ra.useRef)(null),Q=(0,ra.useCallback)(He=>{U(He)},[]),[K,te]=(0,ra.useState)(!0),$=(0,ra.useCallback)(He=>{te(Oe=>Oe===He?Oe:He)},[]),[Ce,ye]=(0,ra.useState)(!1),he=(0,ra.useCallback)(He=>{ye(Oe=>Oe===He?Oe:He)},[]),[le,ee]=(0,ra.useState)(void 0),de=(0,ra.useCallback)(He=>{ee(Oe=>!Oe&&!He?Oe:!Oe||!He?He:Oe.etaMins===He.etaMins&&Oe.distanceRemainingKm===He.distanceRemainingKm&&Oe.label===He.label&&Oe.progress===He.progress&&Oe.mode===He.mode&&Oe.isCalculating===He.isCalculating&&Oe.error===He.error?Oe:He)},[]),[_e,Ae]=(0,ra.useState)({bottom:0,left:0,right:0,top:0}),Re=(0,ra.useCallback)(He=>{Ae(Oe=>({...Oe,...He}))},[]),Z=(0,ra.useRef)(null),H=(0,ra.useRef)(null),oe=(0,ra.useRef)(null),ge=(0,ra.useCallback)(He=>{Z.current&&Z.current(He)},[]),De=(0,ra.useCallback)(He=>{H.current&&H.current(He)},[]),$e=(0,ra.useCallback)((He,Oe)=>{oe.current&&oe.current(He,Oe)},[]),Ve=(0,ra.useCallback)(He=>{Z.current=He},[]),rt=(0,ra.useCallback)(He=>{H.current=He},[]),je=(0,ra.useCallback)(He=>{oe.current=He},[]),tt=(0,ra.useCallback)(He=>{m(He)},[]),ze=(0,ra.useCallback)(He=>{I(He)},[]),Ue=(0,ra.useMemo)(()=>({_registerCenterCallback:Ve,_registerFlyToCallback:je,_registerResetBearingCallback:rt,bearing:f,centerOnUser:ge,drawerContentRef:V,drawerHandleVisible:K,drawerState:D,etaData:le,flyTo:$e,hasControls:Ce,insets:_e,isFollowing:i,pitch:s,resetBearing:De,setBearing:tt,setDrawerHandleVisible:$,setDrawerState:Q,setEtaData:de,setHasControls:he,setInsets:Re,setIsFollowing:u,setPitch:ze}),[Ve,je,rt,f,ge,K,D,le,$e,Ce,i,s,De,tt,$,Q,de,he,ze,_e,Re]);return(0,W5.jsx)($n.Provider,{value:Ue,children:a})},kD=()=>{let a=(0,ra.useContext)($n);if(!a)throw new Error("useMapControls must be used within a MapControlsProvider");return a};var Hr=Be(ut(),1),Os=Be(It(),1),mv=(a,i)=>typeof a=="number"?a:a.endsWith("%")?parseFloat(a)/100*i:parseFloat(a),gv=({menuItems:a=[],drawerSide:i,customControls:u=[],etaBarHeight:f=100,onRecenter:m,isMapCentered:s,mapBearing:I,onResetBearing:D,etaData:U,customRecenterButton:V,defaultState:Q,initialViewState:K,customCompassButton:te,drawerPeekHeight:$,drawerFullHeight:Ce,drawerAutoMaxHeight:ye,drawerContentRef:he,menuContent:le,children:ee,enableTouchDrag:de=!1,showScrollToTopButton:_e=!0,scrollToTopThreshold:Ae=300,controlsBottomOffset:Re=0,isInternal:Z=!1})=>{let H=(0,Hr.useContext)($n),oe=H?.drawerContentRef,ge=(0,Hr.useCallback)(At=>{he&&(typeof he=="function"?he(At):he.current=At),oe&&(oe.current=At)},[he,oe]),[De,$e]=(0,Hr.useState)(Q??"closed"),Ve=H?H.drawerState:De,rt=(0,Hr.useCallback)(At=>{H?H.setDrawerState(At):$e(At)},[H]);(0,Hr.useEffect)(()=>{Q&&H&&H.setDrawerState(Q)},[]);let[je,tt]=(0,Hr.useState)("left"),ze=(0,Hr.useRef)(null),[Ue,He]=(0,Hr.useState)(600);(0,Hr.useEffect)(()=>{let At=ze.current?.parentElement;if(!At)return;let hr=()=>{He(At.getBoundingClientRect().height)};hr();let Yr=new ResizeObserver(hr);return Yr.observe(At),()=>{Yr.disconnect()}},[]);let Oe=H?.setHasControls;(0,Hr.useEffect)(()=>{if(Oe&&!Z)return Oe(!0),()=>Oe(!1)},[Oe,Z]);let Wt=s!==void 0?s:H?H.isFollowing:!0,ca=I!==void 0?I:H?H.bearing:0,at=At=>{m?m(At):H&&H.centerOnUser(At)},ot=At=>{D?D(At):H&&H.resetBearing(At)},Ye=H?H.pitch:0,it=U!==void 0?U:H?.etaData,[mt,ia]=(0,Hr.useState)(null),[gt,Rt]=(0,Hr.useState)(null),[st,Kt]=(0,Hr.useState)(0);(0,Hr.useEffect)(()=>{if(typeof window>"u")return;let At=()=>{i?tt(i):window.innerWidth<768?tt("bottom"):tt("left")};return At(),window.addEventListener("resize",At),()=>window.removeEventListener("resize",At)},[i]);let Gt=mt!==null&&gt!==null,qt=Gt?gt-mt:0,Bt=mv(Ce||"85%",Ue),ma=mv($||"15%",Ue),$r=mv(ye||"100%",Ue),ao=Math.min($r,st),Ui=H?.insets.bottom||0,Or=H?H.drawerHandleVisible:!0,yt=(Or?32:0)+(Ve==="closed"?Ui:0),ga=qt;Ve==="full"?ga=Math.max(0,Math.min(Bt-yt,qt)):Ve==="peek"?ga=Math.max(-(Bt-ma),Math.min(ma-yt,qt)):Ve==="closed"?ga=Math.min(0,Math.max(-(Bt-yt),qt)):Ve==="auto"&&(ga=Math.max(0,qt));let Ya=Or?32:0;Ve==="peek"?Ya=ma:Ve==="full"?Ya=Bt:Ve==="auto"&&(Ya=ao);let dr=Ya-ga,rr=ma+20,fr=ma+(Bt-ma)*.35,oa=1,Vt="1rem";return je==="bottom"?(dr<=rr?oa=1:dr>=fr?oa=0:oa=1-(dr-rr)/(fr-rr),Vt=`calc(${Ya+(Ve==="closed"?Ui:0)+16}px - var(--drag-offset, 0px))`):(oa=Ve==="full"?0:1,Vt=`calc(1rem + ${Ui}px)`),(0,Os.jsxs)(Os.Fragment,{children:[(0,Os.jsx)("div",{ref:ze,style:{display:"none"}}),(0,Os.jsx)(H5,{clampedDragOffset:ga,containerHeight:Ue,currentTouchY:gt,drawerAutoMaxHeight:ye,drawerFullHeight:Ce,drawerPeekHeight:$,enableTouchDrag:de,etaBarHeight:f,etaData:it,handleVisible:Or,isDragging:Gt,menuContent:ee||le,menuItems:a,onAutoContentHeightChange:Kt,onChangeState:rt,ref:ge,safeAreaInsets:H?.insets,scrollToTopThreshold:Ae,setCurrentTouchY:Rt,setTouchStartY:ia,showScrollToTopButton:_e,side:je,state:Ve,touchStartY:mt}),(0,Os.jsx)(X5,{bottomOffset:Re,clampedDragOffset:ga,customCompassButton:te,customControls:u,customRecenterButton:V,drawerPeekHeight:$,drawerState:Ve,etaBarHeight:f+(Ve==="closed"?Ui:0),etaData:it,initialViewState:K,insets:H?.insets,isDragging:Gt,isMapCentered:Wt,mapBearing:ca,mapPitch:Ye,onRecenter:()=>at(),onResetBearing:ot,side:je}),it&&(0,Os.jsx)(Z5,{etaData:it,isDragging:Gt,layoutMode:"floating-card",style:{bottom:Vt,opacity:oa,pointerEvents:oa>.1?"auto":"none",transition:Gt?"none":"bottom 250ms ease-in-out, opacity 300ms ease-out"}})]})};var $5=Be(ut(),1),In=Be(It(),1),zp=({children:a})=>(0,In.jsx)("div",{className:"flex flex-col gap-1.5",children:a}),Q0=({id:a,label:i,icon:u,onPress:f,badge:m,disabled:s=!1,children:I})=>{let D=(0,$5.useContext)($n);return(0,In.jsxs)("button",{className:`flex items-center gap-3 w-full py-3 px-3.5 rounded-xl text-left cursor-pointer transition-all duration-150 ${s?"opacity-45 cursor-not-allowed pointer-events-none":"hover:bg-white/5 active:bg-white/10 text-white"}`,disabled:s,onClick:V=>{s||(f&&f(),D&&D.setDrawerState&&D.setDrawerState("closed"))},type:"button",children:[u&&(0,In.jsxs)("div",{className:"relative flex items-center justify-center w-8 h-8 rounded-lg bg-white/5 text-zinc-300",children:[u,m!==void 0&&(0,In.jsx)("span",{className:"absolute -top-1 -right-1 bg-cyan-500 text-black text-[9px] font-extrabold min-w-[15px] h-3.5 rounded-full flex items-center justify-center px-1 border border-zinc-950 shadow",children:m})]}),(0,In.jsxs)("div",{className:"flex-1 flex flex-col justify-center",children:[(0,In.jsx)("span",{className:"text-sm font-medium tracking-wide flex-1",children:i}),I]})]})};zp.displayName="MapMenu";Q0.displayName="MapMenuItem";var J0=({children:a,showDivider:i=!0,className:u=""})=>(0,In.jsx)("div",{className:`flex items-center justify-between pb-3 first:mt-0 px-3.5 ${u} ${i?"border-b border-white/10 mb-2 mt-4":""}`,children:a});J0.displayName="MapMenuTitle";var e1=({className:a=""})=>(0,In.jsx)("div",{className:`h-[1px] bg-white/10 my-3 mx-3.5 ${a}`});e1.displayName="MapMenuDivider";var t1=({children:a,className:i=""})=>(0,In.jsx)("div",{className:`mt-auto pt-4 border-t border-white/10 px-3.5 text-xs text-zinc-500 font-medium ${i}`,children:a});t1.displayName="MapMenuFooter";var Y5=(f=>(f.TOP_SCROLL_MORE="TOP_SCROLL_MORE",f.BOTTOM_SCROLL_MORE="BOTTOM_SCROLL_MORE",f.BACK_GESTURE="BACK_GESTURE",f))(Y5||{}),Bp=(u=>(u.LOCATION_UPDATE="LOCATION_UPDATE",u.LOCATION_STREAM_UPDATE="LOCATION_STREAM_UPDATE",u))(Bp||{}),K5=(i=>(i.UPDATE_CONTEXT="UPDATE_CONTEXT",i))(K5||{});var Fs=Be(ut(),1),yv=.12,Op=()=>{let[a,i]=(0,Fs.useState)({accuracy:null,coords:null,heading:null}),u=(0,Fs.useRef)({accuracy:null,coords:null,heading:null}),f=(0,Fs.useRef)({accuracy:null,coords:null,heading:null}),m=(0,Fs.useCallback)(s=>{let I=s.location?.coords||s.coords,D=s.heading||s.coords,U=I?[I.longitude,I.latitude]:null,V=null;return D?.trueHeading!==void 0&&D.trueHeading>=0?V=D.trueHeading:D?.magneticHeading!==void 0&&D.magneticHeading>=0?V=D.magneticHeading:D?.heading!==null&&D.heading>=0&&(V=D.heading),{accuracy:I?.accuracy||null,coords:U,heading:V}},[]);return(0,Fs.useEffect)(()=>{let s,I=()=>{let V=!1;if(u.current.coords)if(!f.current.coords)f.current.coords=[...u.current.coords],V=!0;else{let[Q,K]=u.current.coords,[te,$]=f.current.coords,Ce=te+(Q-te)*yv,ye=$+(K-$)*yv;(Math.abs(Ce-te)>1e-7||Math.abs(ye-$)>1e-7)&&(f.current.coords=[Ce,ye],V=!0)}if(u.current.heading!==null)if(f.current.heading===null)f.current.heading=u.current.heading,V=!0;else{let Q=u.current.heading,K=f.current.heading,te=Q-K;te>180&&(te-=360),te<-180&&(te+=360);let Ce=((K+te*yv)%360+360)%360;Math.abs(te)>.1&&(f.current.heading=Ce,V=!0)}V&&i({accuracy:u.current.accuracy,coords:f.current.coords?[...f.current.coords]:null,heading:f.current.heading}),s=requestAnimationFrame(I)};s=requestAnimationFrame(I),er.location.getCurrentPosition().then(V=>{let Q=m(V);u.current=Q}).catch(V=>console.warn("Initial location fetch failed",V));let D=er.on("LOCATION_STREAM_UPDATE",V=>{u.current=m(V)}),U=er.on("LOCATION_UPDATE",V=>{u.current=m(V)});return er.location.startStream({distanceFilter:1,headingThreshold:2}).catch(V=>console.warn("Failed to start location stream",V)),()=>{cancelAnimationFrame(s),D(),U(),er.location.stopStream().catch(()=>{})}},[m]),a};var cr=Be(ut(),1),_v=({origin:a,destination:i,profile:u="driving",recalculateThreshold:f=50,enabled:m=!0,initialMode:s="preview"})=>{let[I,D]=(0,cr.useState)(null),[U,V]=(0,cr.useState)(null),[Q,K]=(0,cr.useState)(!1),[te,$]=(0,cr.useState)(null),[Ce,ye]=(0,cr.useState)(s),he=Op(),le=a||he.coords,ee=he.coords||a,de=(0,cr.useRef)(null),_e=(0,cr.useRef)(null),Ae=(0,cr.useRef)(!1),Re=(0,cr.useRef)(null),Z=(0,cr.useCallback)((ge,De)=>{let Ve=ge[1]*Math.PI/180,rt=De[1]*Math.PI/180,je=(De[1]-ge[1])*Math.PI/180,tt=(De[0]-ge[0])*Math.PI/180,ze=Math.sin(je/2)*Math.sin(je/2)+Math.cos(Ve)*Math.cos(rt)*Math.sin(tt/2)*Math.sin(tt/2);return 6371e3*(2*Math.atan2(Math.sqrt(ze),Math.sqrt(1-ze)))},[]),H=(0,cr.useMemo)(()=>{if(!ee||!I||I.geometry.coordinates.length<2)return ee&&i?Z(ee,i):null;let ge=I.geometry.coordinates,De=1/0,$e=0,Ve=(ze,Ue)=>(ze[0]-Ue[0])**2+(ze[1]-Ue[1])**2;for(let ze=0;ze<ge.length;ze++){let Ue=Ve(ee,ge[ze]);Ue<De&&(De=Ue,$e=ze)}let rt=ge.slice($e+1),je=0,tt=ee;for(let ze of rt)je+=Z(tt,ze),tt=ze;return je},[ee,I,i,Z]),oe=(0,cr.useCallback)(async(ge,De,$e)=>{if(!Ae.current){Ae.current=!0,K(!0);try{let Ve=await er.routing.getRoute({destination:De,origin:ge,profile:u});if(D(Ve),$(null),$e){let rt=Ve.geometry.coordinates,je=0;for(let tt=0;tt<rt.length-1;tt++)je+=Z(rt[tt],rt[tt+1]);V(je)}de.current=ge,_e.current=De}catch(Ve){$(Ve.message||"Failed to fetch route")}finally{K(!1),Ae.current=!1}}},[u,Z]);return(0,cr.useEffect)(()=>{s==="navigation"&&ye("navigation")},[s]),(0,cr.useEffect)(()=>{if(!m||!i||!le){(!m||!i)&&(D(null),V(null),de.current=null,_e.current=null,Re.current=null,ye(s));return}let ge=!_e.current||_e.current[0]!==i[0]||_e.current[1]!==i[1],De=`${i[0]},${i[1]}`;if(Re.current!==De&&(Re.current=De,ye(s)),ge)oe(le,i,!0);else if(de.current){let $e=ee||le;Z($e,de.current)>f&&oe($e,i,!1)}else oe(le,i,!0)},[le,ee,i,m,s,f,oe,Z]),{currentDistanceMeters:H,error:te,isCalculating:Q,mode:Ce,recalculate:()=>le&&i&&oe(le,i,!1),route:I,start:()=>ye("navigation"),totalDistance:U}},zD=(a,i,u="driving")=>{let[f,m]=(0,cr.useState)(null),[s,I]=(0,cr.useState)(!1),[D,U]=(0,cr.useState)(null);return(0,cr.useEffect)(()=>{if(!a||!i){m(null);return}(async()=>{I(!0);try{let Q=await er.routing.getRoute({destination:i,origin:a,profile:u});m(Q),U(null)}catch(Q){U(Q.message||"Failed to fetch route")}finally{I(!1)}})()},[a,i,u]),{error:D,isCalculating:s,route:f}};var Mo=Be(ut(),1),xv=(a={})=>{let{navigation:i,onAbort:u,onModeChange:f}=a,[m,s]=(0,Mo.useState)(null),[I,D]=(0,Mo.useState)(!1);(0,Mo.useEffect)(()=>{let Z=er.on("SDK_NAVIGATION_CREATE",ge=>{D(!1),s(ge)}),H=er.on("SDK_NAVIGATION_START",()=>{D(!1),s(ge=>ge?{...ge,mode:"navigation"}:null)}),oe=er.on("SDK_NAVIGATION_ABORT",()=>{D(!0),s(null)});return()=>{Z(),H(),oe()}},[]);let U=m||i,V=_v({destination:U?.destination||null,enabled:!I&&!!U?.destination,initialMode:U?.mode||"preview",origin:U?.origin,profile:U?.profile||"driving",recalculateThreshold:U?.recalculateThreshold||50}),Q=(0,Mo.useRef)(null),K=U?.destination;(0,Mo.useEffect)(()=>{K&&(!Q.current||Q.current[0]!==K[0]||Q.current[1]!==K[1])&&D(!1),Q.current=K},[K]);let te=(0,Mo.useRef)(f);te.current=f,(0,Mo.useEffect)(()=>{te.current?.(V.mode)},[V.mode]);let $=!I&&!!U?.destination,Ce=$?V.currentDistanceMeters:null,ye=$?V.totalDistance:null,he=V.route?.durationSeconds??null,le=Ce??0,ee=le/1e3,de=(()=>{if(!he||!ye||!Ce)return 0;let Z=Ce/ye;return Math.ceil(he*Z/60)})(),_e=ye&&ye>0?Math.min(100,Math.max(0,(ye-le)/ye*100)):0,Ae=(0,Mo.useCallback)(()=>{D(!0),s(null),er.navigation.abort(),u&&u()},[u]),Re=(0,Mo.useCallback)(()=>{er.navigation.start(),V.start()},[V.start]);return{cancel:Ae,distanceRemainingKm:ee,distanceRemainingMeters:Ce,error:$?V.error:null,etaMinutes:de,isActive:$,isCalculating:$?V.isCalculating:!1,mode:$?V.mode:"preview",progress:_e,recalculate:V.recalculate,route:$?V.route:null,start:Re,totalDistanceMeters:ye}};var Q5=Be(ut(),1),vv=(a,i)=>(0,Q5.useMemo)(()=>{if(!a||!i||a.coordinates.length<2)return a;let u=a.coordinates,f=1/0,m=0,s=(D,U)=>(D[0]-U[0])**2+(D[1]-U[1])**2;for(let D=0;D<u.length;D++){let U=s(i,u[D]);U<f&&(f=U,m=D)}let I=u.slice(m+1);return{coordinates:[i,...I],type:"LineString"}},[a,i]);var Gl=Be(ut(),1),Ao=Be(ut(),1);var a1=Be(ut(),1),Yn=Be(ut(),1);var r1=a1.createContext(null),bv=a=>{let[i,u]=(0,Yn.useState)({}),f=(0,Yn.useCallback)((s,I="default")=>{u(D=>{if(I==="current")throw new Error("'current' cannot be used as map id");if(D[I])throw new Error(`Multiple maps with the same id: ${I}`);return{...D,[I]:s}})},[]),m=(0,Yn.useCallback)((s="default")=>{u(I=>{if(I[s]){let D={...I};return delete D[s],D}return I})},[]);return a1.createElement(r1.Provider,{value:{maps:i,onMapMount:f,onMapUnmount:m}},a.children)};function wv(){let a=(0,Yn.useContext)(r1)?.maps,i=(0,Yn.useContext)(Eo);return(0,Yn.useMemo)(()=>({...a,current:i?.map}),[a,i])}function J5(a,i){let u=Array.isArray(a)?a[0]:a?a.x:0,f=Array.isArray(a)?a[1]:a?a.y:0,m=Array.isArray(i)?i[0]:i?i.x:0,s=Array.isArray(i)?i[1]:i?i.y:0;return u===m&&f===s}function Zr(a,i){if(a===i)return!0;if(!a||!i)return!1;if(Array.isArray(a)){if(!Array.isArray(i)||a.length!==i.length)return!1;for(let u=0;u<a.length;u++)if(!Zr(a[u],i[u]))return!1;return!0}else if(Array.isArray(i))return!1;if(typeof a=="object"&&typeof i=="object"){let u=Object.keys(a),f=Object.keys(i);if(u.length!==f.length)return!1;for(let m of u)if(!i.hasOwnProperty(m)||!Zr(a[m],i[m]))return!1;return!0}return!1}function Sv(a){return{longitude:a.center.lng,latitude:a.center.lat,zoom:a.zoom,pitch:a.pitch,bearing:a.bearing,padding:a.padding}}function Cv(a,i){let u=i.viewState||i,f={};if("longitude"in u&&"latitude"in u&&(u.longitude!==a.center.lng||u.latitude!==a.center.lat)){let m=a.center.constructor;f.center=new m(u.longitude,u.latitude)}return"zoom"in u&&u.zoom!==a.zoom&&(f.zoom=u.zoom),"bearing"in u&&u.bearing!==a.bearing&&(f.bearing=u.bearing),"pitch"in u&&u.pitch!==a.pitch&&(f.pitch=u.pitch),u.padding&&a.padding&&!Zr(u.padding,a.padding)&&(f.padding=u.padding),f}var BD=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Tv(a){if(!a)return null;if(typeof a=="string"||("toJS"in a&&(a=a.toJS()),!a.layers))return a;let i={};for(let f of a.layers)i[f.id]=f;let u=a.layers.map(f=>{let m=null;"interactive"in f&&(m=Object.assign({},f),delete m.interactive);let s=i[f.ref];if(s){m=m||Object.assign({},f),delete m.ref;for(let I of BD)I in s&&(m[I]=s[I])}return m||f});return{...a,layers:u}}var eT={version:8,sources:{},layers:[]},OD={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:"mercator",renderWorldCopies:!0},tT={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},aT={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},rT={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},FD=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],ND=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"],i1=class a{constructor(i,u,f){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=m=>{let s=this.props[rT[m.type]];s?s(m):m.type==="error"&&console.error(m.error)},this._onCameraEvent=m=>{if(this._internalUpdate)return;m.viewState=this._propsedCameraUpdate||Sv(this._map.transform);let s=this.props[aT[m.type]];s&&s(m)},this._onCameraUpdate=m=>this._internalUpdate?m:(this._propsedCameraUpdate=Sv(m),Cv(m,this.props)),this._onPointerEvent=m=>{(m.type==="mousemove"||m.type==="mouseout")&&this._updateHover(m);let s=this.props[tT[m.type]];s&&(this.props.interactiveLayerIds&&m.type!=="mouseover"&&m.type!=="mouseout"&&(m.features=this._hoveredFeatures||this._queryRenderedFeatures(m.point)),s(m),delete m.features)},this._MapClass=i,this.props=u,this._initialize(f)}get map(){return this._map}setProps(i){let u=this.props;this.props=i;let f=this._updateSettings(i,u),m=this._updateSize(i),s=this._updateViewState(i);this._updateStyle(i,u),this._updateStyleComponents(i),this._updateHandlers(i,u),(f||m||s&&!this._map.isMoving())&&this.redraw()}static reuse(i,u){let f=a.savedMaps.pop();if(!f)return null;let m=f.map,s=m.getContainer();for(u.className=s.className;s.childNodes.length>0;)u.appendChild(s.childNodes[0]);m._container=u;let I=m._resizeObserver;I&&(I.disconnect(),I.observe(u)),f.setProps({...i,styleDiffing:!1}),m.resize();let{initialViewState:D}=i;return D&&(D.bounds?m.fitBounds(D.bounds,{...D.fitBoundsOptions,duration:0}):f._updateViewState(D)),m.isStyleLoaded()?m.fire("load"):m.once("style.load",()=>m.fire("load")),m._update(),f}_initialize(i){let{props:u}=this,{mapStyle:f=eT}=u,m={...u,...u.initialViewState,container:i,style:Tv(f)},s=m.initialViewState||m.viewState||m;if(Object.assign(m,{center:[s.longitude||0,s.latitude||0],zoom:s.zoom||0,pitch:s.pitch||0,bearing:s.bearing||0}),u.gl){let D=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=D,u.gl)}let I=new this._MapClass(m);s.padding&&I.setPadding(s.padding),u.cursor&&(I.getCanvas().style.cursor=u.cursor),I.transformCameraUpdate=this._onCameraUpdate,I.on("style.load",()=>{this._styleComponents={light:I.getLight(),sky:I.getSky(),projection:I.getProjection?.(),terrain:I.getTerrain()},this._updateStyleComponents(this.props)}),I.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(let D in tT)I.on(D,this._onPointerEvent);for(let D in aT)I.on(D,this._onCameraEvent);for(let D in rT)I.on(D,this._onEvent);this._map=I}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),a.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let i=this._map;i.style&&(i._frame&&(i._frame.cancel(),i._frame=null),i._render())}_updateSize(i){let{viewState:u}=i;if(u){let f=this._map;if(u.width!==f.transform.width||u.height!==f.transform.height)return f.resize(),!0}return!1}_updateViewState(i){let u=this._map,f=u.transform;if(!u.isMoving()){let s=Cv(f,i);if(Object.keys(s).length>0)return this._internalUpdate=!0,u.jumpTo(s),this._internalUpdate=!1,!0}return!1}_updateSettings(i,u){let f=this._map,m=!1;for(let s of FD)if((s in i||s in u)&&!Zr(i[s],u[s])){m=!0;let D=s in i?i[s]:OD[s];f[`set${s[0].toUpperCase()}${s.slice(1)}`]?.call(f,D)}return m}_updateStyle(i,u){if(i.cursor!==u.cursor&&(this._map.getCanvas().style.cursor=i.cursor||""),i.mapStyle!==u.mapStyle){let{mapStyle:f=eT,styleDiffing:m=!0}=i,s={diff:m};"localIdeographFontFamily"in i&&(s.localIdeographFontFamily=i.localIdeographFontFamily),this._map.setStyle(Tv(f),s)}}_updateStyleComponents({light:i,projection:u,sky:f,terrain:m}){let s=this._map,I=this._styleComponents;s.style?._loaded&&(i&&!Zr(i,I.light)&&(I.light=i,s.setLight(i)),u&&!Zr(u,I.projection)&&u!==I.projection?.type&&(I.projection=typeof u=="string"?{type:u}:u,s.setProjection?.(I.projection)),f&&!Zr(f,I.sky)&&(I.sky=f,s.setSky(f)),m!==void 0&&!Zr(m,I.terrain)&&(!m||s.getSource(m.source))&&(I.terrain=m,s.setTerrain(m)))}_updateHandlers(i,u){let f=this._map;for(let m of ND){let s=i[m]??!0,I=u[m]??!0;Zr(s,I)||(s?f[m].enable(s):f[m].disable())}}_queryRenderedFeatures(i){let u=this._map,{interactiveLayerIds:f=[]}=this.props;try{return u.queryRenderedFeatures(i,{layers:f.filter(u.getLayer.bind(u))})}catch{return[]}}_updateHover(i){let{props:u}=this;if(u.interactiveLayerIds&&(u.onMouseMove||u.onMouseEnter||u.onMouseLeave)){let m=i.type,s=this._hoveredFeatures?.length>0,I=this._queryRenderedFeatures(i.point),D=I.length>0;!D&&s&&(i.type="mouseleave",this._onPointerEvent(i)),this._hoveredFeatures=I,D&&!s&&(i.type="mouseenter",this._onPointerEvent(i)),i.type=m}else this._hoveredFeatures=null}};i1.savedMaps=[];var Lv=i1;var UD=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function Iv(a){if(!a)return null;let i=a.map,u={getMap:()=>i};for(let f of qD(i))!(f in u)&&!UD.includes(f)&&(u[f]=i[f].bind(i));return u}function qD(a){let i=new Set,u=a;for(;u;){for(let f of Object.getOwnPropertyNames(u))f[0]!=="_"&&typeof a[f]=="function"&&f!=="fire"&&f!=="setEventedParent"&&i.add(f);u=Object.getPrototypeOf(u)}return Array.from(i)}var o1=Be(ut(),1),VD=typeof document<"u"?o1.useLayoutEffect:o1.useEffect,iT=VD;function Mv(a,i){let{RTLTextPlugin:u,maxParallelImageRequests:f,workerCount:m,workerUrl:s}=i;if(u&&a.getRTLTextPluginStatus&&a.getRTLTextPluginStatus()==="unavailable"){let{pluginUrl:I,lazy:D=!0}=typeof u=="string"?{pluginUrl:u}:u;a.setRTLTextPlugin(I,U=>{U&&console.error(U)},D)}f!==void 0&&a.setMaxParallelImageRequests(f),m!==void 0&&a.setWorkerCount(m),s!==void 0&&a.setWorkerUrl(s)}var Eo=Gl.createContext(null);function jD(a,i){let u=(0,Ao.useContext)(r1),[f,m]=(0,Ao.useState)(null),s=(0,Ao.useRef)(),{current:I}=(0,Ao.useRef)({mapLib:null,map:null});(0,Ao.useEffect)(()=>{let V=a.mapLib,Q=!0,K;return Promise.resolve(V||Promise.resolve().then(()=>Be(nT(),1))).then(te=>{if(!Q)return;if(!te)throw new Error("Invalid mapLib");let $="Map"in te?te:te.default;if(!$.Map)throw new Error("Invalid mapLib");Mv($,a),a.reuseMaps&&(K=Lv.reuse(a,s.current)),K||(K=new Lv($.Map,a,s.current)),I.map=Iv(K),I.mapLib=$,m(K),u?.onMapMount(I.map,a.id)}).catch(te=>{let{onError:$}=a;$?$({type:"error",target:null,originalEvent:null,error:te}):console.error(te)}),()=>{Q=!1,K&&(u?.onMapUnmount(a.id),a.reuseMaps?K.recycle():K.destroy())}},[]),iT(()=>{f&&f.setProps(a)}),(0,Ao.useImperativeHandle)(i,()=>I.map,[f]);let D=(0,Ao.useMemo)(()=>({position:"relative",width:"100%",height:"100%",...a.style}),[a.style]),U={height:"100%"};return Gl.createElement("div",{id:a.id,ref:s,style:D},f&&Gl.createElement(Eo.Provider,{value:I},Gl.createElement("div",{"mapboxgl-children":"",style:U},a.children)))}var Pv=Gl.forwardRef(jD);var lT=Be(ut(),1),uT=Be(af(),1),Qi=Be(ut(),1);var GD=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function si(a,i){if(!a||!i)return;let u=a.style;for(let f in i){let m=i[f];Number.isFinite(m)&&!GD.test(f)?u[f]=`${m}px`:u[f]=m}}function n1(a,i){if(a===i)return null;let u=sT(a),f=sT(i),m=[];for(let s of f)u.has(s)||m.push(s);for(let s of u)f.has(s)||m.push(s);return m.length===0?null:m}function sT(a){return new Set(a?a.trim().split(/\s+/):[])}var Fp=(0,Qi.memo)((0,Qi.forwardRef)((a,i)=>{let{map:u,mapLib:f}=(0,Qi.useContext)(Eo),m=(0,Qi.useRef)({props:a}),s=(0,Qi.useMemo)(()=>{let le=!1;lT.Children.forEach(a.children,_e=>{_e&&(le=!0)});let ee={...a,element:le?document.createElement("div"):void 0},de=new f.Marker(ee);return de.setLngLat([a.longitude,a.latitude]),de.getElement().addEventListener("click",_e=>{m.current.props.onClick?.({type:"click",target:de,originalEvent:_e})}),de.on("dragstart",_e=>{let Ae=_e;Ae.lngLat=s.getLngLat(),m.current.props.onDragStart?.(Ae)}),de.on("drag",_e=>{let Ae=_e;Ae.lngLat=s.getLngLat(),m.current.props.onDrag?.(Ae)}),de.on("dragend",_e=>{let Ae=_e;Ae.lngLat=s.getLngLat(),m.current.props.onDragEnd?.(Ae)}),de},[]);(0,Qi.useEffect)(()=>(s.addTo(u.getMap()),()=>{s.remove()}),[]);let{longitude:I,latitude:D,offset:U,style:V,draggable:Q=!1,popup:K=null,rotation:te=0,rotationAlignment:$="auto",pitchAlignment:Ce="auto"}=a;(0,Qi.useEffect)(()=>{si(s.getElement(),V)},[V]),(0,Qi.useImperativeHandle)(i,()=>s,[]);let ye=m.current.props;(s.getLngLat().lng!==I||s.getLngLat().lat!==D)&&s.setLngLat([I,D]),U&&!J5(s.getOffset(),U)&&s.setOffset(U),s.isDraggable()!==Q&&s.setDraggable(Q),s.getRotation()!==te&&s.setRotation(te),s.getRotationAlignment()!==$&&s.setRotationAlignment($),s.getPitchAlignment()!==Ce&&s.setPitchAlignment(Ce),s.getPopup()!==K&&s.setPopup(K);let he=n1(ye.className,a.className);if(he)for(let le of he)s.toggleClassName(le);return m.current.props=a,(0,uT.createPortal)(a.children,s.getElement())}));var cT=Be(af(),1),Fi=Be(ut(),1);var HD=(0,Fi.memo)((0,Fi.forwardRef)((a,i)=>{let{map:u,mapLib:f}=(0,Fi.useContext)(Eo),m=(0,Fi.useMemo)(()=>document.createElement("div"),[]),s=(0,Fi.useRef)({props:a}),I=(0,Fi.useMemo)(()=>{let D={...a},U=new f.Popup(D);return U.setLngLat([a.longitude,a.latitude]),U.once("open",V=>{s.current.props.onOpen?.(V)}),U},[]);if((0,Fi.useEffect)(()=>{let D=U=>{s.current.props.onClose?.(U)};return I.on("close",D),I.setDOMContent(m).addTo(u.getMap()),()=>{I.off("close",D),I.isOpen()&&I.remove()}},[]),(0,Fi.useEffect)(()=>{si(I.getElement(),a.style)},[a.style]),(0,Fi.useImperativeHandle)(i,()=>I,[]),I.isOpen()){let D=s.current.props;(I.getLngLat().lng!==a.longitude||I.getLngLat().lat!==a.latitude)&&I.setLngLat([a.longitude,a.latitude]),a.offset&&!Zr(D.offset,a.offset)&&I.setOffset(a.offset),(D.anchor!==a.anchor||D.maxWidth!==a.maxWidth)&&(I.options.anchor=a.anchor,I.setMaxWidth(a.maxWidth));let U=n1(D.className,a.className);if(U)for(let V of U)I.toggleClassName(V);s.current.props=a}return(0,cT.createPortal)(a.children,m)}));var s1=Be(ut(),1);var hf=Be(ut(),1);function Ji(a,i,u,f){let m=(0,hf.useContext)(Eo),s=(0,hf.useMemo)(()=>a(m),[]);return(0,hf.useEffect)(()=>{let I=f||u||i,D=typeof i=="function"&&typeof u=="function"?i:null,U=typeof u=="function"?u:typeof i=="function"?i:null,{map:V}=m;return V.hasControl(s)||(V.addControl(s,I?.position),D&&D(m)),()=>{U&&U(m),V.hasControl(s)&&V.removeControl(s)}},[]),s}function ZD(a){let i=Ji(({mapLib:u})=>new u.AttributionControl(a),{position:a.position});return(0,s1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var XD=(0,s1.memo)(ZD);var l1=Be(ut(),1);function WD(a){let i=Ji(({mapLib:u})=>new u.FullscreenControl({container:a.containerId&&document.getElementById(a.containerId)}),{position:a.position});return(0,l1.useEffect)(()=>{si(i._controlContainer,a.style)},[a.style]),null}var $D=(0,l1.memo)(WD);var Kn=Be(ut(),1);function YD(a,i){let u=(0,Kn.useRef)({props:a}),f=Ji(({mapLib:m})=>{let s=new m.GeolocateControl(a),I=s._setupUI;return s._setupUI=()=>{s._container.hasChildNodes()||I()},s.on("geolocate",D=>{u.current.props.onGeolocate?.(D)}),s.on("error",D=>{u.current.props.onError?.(D)}),s.on("outofmaxbounds",D=>{u.current.props.onOutOfMaxBounds?.(D)}),s.on("trackuserlocationstart",D=>{u.current.props.onTrackUserLocationStart?.(D)}),s.on("trackuserlocationend",D=>{u.current.props.onTrackUserLocationEnd?.(D)}),s},{position:a.position});return u.current.props=a,(0,Kn.useImperativeHandle)(i,()=>f,[]),(0,Kn.useEffect)(()=>{si(f._container,a.style)},[a.style]),null}var KD=(0,Kn.memo)((0,Kn.forwardRef)(YD));var u1=Be(ut(),1);function QD(a){let i=Ji(({mapLib:u})=>new u.NavigationControl(a),{position:a.position});return(0,u1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var JD=(0,u1.memo)(QD);var pf=Be(ut(),1);function ek(a){let i=Ji(({mapLib:s})=>new s.ScaleControl(a),{position:a.position}),u=(0,pf.useRef)(a),f=u.current;u.current=a;let{style:m}=a;return a.maxWidth!==void 0&&a.maxWidth!==f.maxWidth&&(i.options.maxWidth=a.maxWidth),a.unit!==void 0&&a.unit!==f.unit&&i.setUnit(a.unit),(0,pf.useEffect)(()=>{si(i._container,m)},[m]),null}var tk=(0,pf.memo)(ek);var c1=Be(ut(),1);function ak(a){let i=Ji(({mapLib:u})=>new u.TerrainControl(a),{position:a.position});return(0,c1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var rk=(0,c1.memo)(ak);var d1=Be(ut(),1);function ik(a){let i=Ji(({mapLib:u})=>new u.LogoControl(a),{position:a.position});return(0,d1.useEffect)(()=>{si(i._container,a.style)},[a.style]),null}var ok=(0,d1.memo)(ik);var dT=Be(ut(),1),Ko=Be(ut(),1);function pc(a,i){if(!a)throw new Error(i)}var nk=0;function sk(a,i,u){if(a.style&&a.style._loaded){let f={...u};return delete f.id,delete f.children,a.addSource(i,f),a.getSource(i)}return null}function lk(a,i,u){pc(i.id===u.id,"source id changed"),pc(i.type===u.type,"source type changed");let f="",m=0;for(let I in i)I!=="children"&&I!=="id"&&!Zr(u[I],i[I])&&(f=I,m++);if(!m)return;let s=i.type;if(s==="geojson")a.setData(i.data);else if(s==="image")a.updateImage({url:i.url,coordinates:i.coordinates});else switch(f){case"coordinates":a.setCoordinates?.(i.coordinates);break;case"url":a.setUrl?.(i.url);break;case"tiles":a.setTiles?.(i.tiles);break;default:console.warn(`Unable to update <Source> prop: ${f}`)}}function mc(a){let i=(0,Ko.useContext)(Eo).map.getMap(),u=(0,Ko.useRef)(a),[,f]=(0,Ko.useState)(0),m=(0,Ko.useMemo)(()=>a.id||`jsx-source-${nk++}`,[]);(0,Ko.useEffect)(()=>{if(i){let I=()=>setTimeout(()=>f(D=>D+1),0);return i.on("styledata",I),I(),()=>{if(i.off("styledata",I),i.style&&i.style._loaded&&i.getSource(m)){let D=i.getStyle()?.layers;if(D)for(let U of D)U.source===m&&i.removeLayer(U.id);i.removeSource(m)}}}},[i]);let s=i&&i.style&&i.getSource(m);return s?lk(s,a,u.current):s=sk(i,m,a),u.current=a,s&&dT.Children.map(a.children,I=>I&&(0,Ko.cloneElement)(I,{source:m}))||null}var Qn=Be(ut(),1);function uk(a,i,u,f){if(pc(u.id===f.id,"layer id changed"),pc(u.type===f.type,"layer type changed"),u.type==="custom"||f.type==="custom")return;let{layout:m={},paint:s={},filter:I,minzoom:D,maxzoom:U,beforeId:V}=u;if(V!==f.beforeId&&a.moveLayer(i,V),m!==f.layout){let Q=f.layout||{};for(let K in m)Zr(m[K],Q[K])||a.setLayoutProperty(i,K,m[K]);for(let K in Q)m.hasOwnProperty(K)||a.setLayoutProperty(i,K,void 0)}if(s!==f.paint){let Q=f.paint||{};for(let K in s)Zr(s[K],Q[K])||a.setPaintProperty(i,K,s[K]);for(let K in Q)s.hasOwnProperty(K)||a.setPaintProperty(i,K,void 0)}Zr(I,f.filter)||a.setFilter(i,I),(D!==f.minzoom||U!==f.maxzoom)&&a.setLayerZoomRange(i,D,U)}function ck(a,i,u){if(a.style&&a.style._loaded&&(!("source"in u)||a.getSource(u.source))){let f={...u,id:i};delete f.beforeId,a.addLayer(f,u.beforeId)}}var dk=0;function Ns(a){let i=(0,Qn.useContext)(Eo).map.getMap(),u=(0,Qn.useRef)(a),[,f]=(0,Qn.useState)(0),m=(0,Qn.useMemo)(()=>a.id||`jsx-layer-${dk++}`,[]);if((0,Qn.useEffect)(()=>{if(i){let I=()=>f(D=>D+1);return i.on("styledata",I),I(),()=>{i.off("styledata",I),i.style&&i.style._loaded&&i.getLayer(m)&&i.removeLayer(m)}}},[i]),i&&i.style&&i.getLayer(m))try{uk(i,m,a,u.current)}catch(I){console.warn(I)}else ck(i,m,a);return u.current=a,null}var Np=Be(It(),1),Rv=({geometry:a,color:i="#3b82f6",width:u=5,opacity:f=.8})=>a?(0,Np.jsxs)(mc,{data:{geometry:a,properties:{},type:"Feature"},id:"sdk-route-source",type:"geojson",children:[(0,Np.jsx)(Ns,{id:"sdk-route-layer-casing",paint:{"line-blur":1,"line-color":"#ffffff","line-opacity":f,"line-width":u+2},type:"line"}),(0,Np.jsx)(Ns,{id:"sdk-route-layer",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":i,"line-opacity":f,"line-width":u},type:"line"})]}):null;var $t=Be(ut(),1);var fT=(a,i,u=64)=>{let[f,m]=a,s=m*Math.PI/180,I=[];for(let D=0;D<=u;D++){let U=D/u*2*Math.PI,V=i*Math.cos(U)/6371e3*(180/Math.PI),Q=i*Math.sin(U)/(6371e3*Math.cos(s))*(180/Math.PI);I.push([f+Q,m+V])}return{geometry:{coordinates:[I],type:"Polygon"},properties:{},type:"Feature"}};var hT=Be(ut(),1),Up=Be(It(),1),pT=({center:a,radiusMeters:i,color:u="#39ff88"})=>{let f=(0,hT.useMemo)(()=>fT(a,i),[a,i]);return(0,Up.jsxs)(mc,{data:f,id:"sdk-mock-radius-source",type:"geojson",children:[(0,Up.jsx)(Ns,{id:"sdk-mock-radius-fill",paint:{"fill-color":u,"fill-opacity":.12},type:"fill"}),(0,Up.jsx)(Ns,{id:"sdk-mock-radius-outline",paint:{"line-color":u,"line-dasharray":[2,2],"line-width":2},type:"line"})]})};var gc=Be(ut(),1),Dv=Be(It(),1);function mT(a,i=64){let u=document.createElement("canvas");u.width=i,u.height=i;let f=u.getContext("2d");return f.font=`${i*.75}px serif`,f.textAlign="center",f.textBaseline="middle",f.fillText(a,i/2,i/2),f.getImageData(0,0,i,i)}var gT=({pois:a})=>{let[i,u]=(0,gc.useState)(0),{current:f}=wv(),m=(0,gc.useMemo)(()=>a.filter(I=>!I.displayMode||I.displayMode==="gl"),[a]);(0,gc.useEffect)(()=>{if(!f)return;let I=f.getMap();[{emoji:"\u{1F37A}",name:"sdk-default-bar"},{emoji:"\u{1F37D}\uFE0F",name:"sdk-default-restaurant"},{emoji:"\u{1F4CD}",name:"sdk-default-poi"}].forEach(V=>{I.hasImage(V.name)||I.addImage(V.name,mT(V.emoji),{pixelRatio:2})});let U=0;m.forEach(V=>{if(V.imageUrl){let Q=`custom-url-${V.id}`;I.hasImage(Q)||I.loadImage(V.imageUrl,(K,te)=>{!K&&te&&(I.hasImage(Q)||(I.addImage(Q,te),u($=>$+1)))})}if(V.emoji){let Q=`custom-emoji-${V.emoji}`;I.hasImage(Q)||(I.addImage(Q,mT(V.emoji),{pixelRatio:2}),U++)}}),U>0&&u(V=>V+U)},[f,m]);let s=(0,gc.useMemo)(()=>({features:m.map(I=>({geometry:{coordinates:[I.longitude,I.latitude],type:"Point"},properties:{...I,"sdk-icon":I.imageUrl?`custom-url-${I.id}`:I.spriteName?I.spriteName:I.emoji?`custom-emoji-${I.emoji}`:I.type==="bar"?"sdk-default-bar":I.type==="restaurant"?"sdk-default-restaurant":"sdk-default-poi"},type:"Feature"})),type:"FeatureCollection"}),[m]);return(0,Dv.jsx)(mc,{data:s,id:"sdk-pois",type:"geojson",children:(0,Dv.jsx)(Ns,{id:"sdk-poi-layer",layout:{"icon-allow-overlap":!0,"icon-image":["get","sdk-icon"],"icon-size":1,"text-anchor":"top","text-field":["step",["zoom"],"",14,["get","name"]],"text-font":["Open Sans Bold"],"text-offset":[0,1.5],"text-optional":!0,"text-size":11},paint:{"icon-opacity":["interpolate",["linear"],["zoom"],11,0,12,1],"text-color":"#ffffff","text-halo-color":"#000000","text-halo-width":1,"text-opacity":["interpolate",["linear"],["zoom"],13.5,0,14,1]},type:"symbol"})})};var Mn=Be(It(),1),yT=({pois:a,onClick:i})=>{let u=a.filter(f=>f.displayMode==="marker");return u.length===0?null:(0,Mn.jsx)(Mn.Fragment,{children:u.map(f=>(0,Mn.jsx)(Fp,{anchor:"bottom",latitude:f.latitude,longitude:f.longitude,onClick:m=>{m.originalEvent.stopPropagation(),i&&i(f)},children:f.markerComponent?f.markerComponent:(0,Mn.jsxs)("div",{style:{cursor:"pointer",filter:"drop-shadow(0 4px 6px rgba(0,0,0,0.1))",transform:"transition-transform duration-200 hover:scale-110"},children:[(0,Mn.jsx)("div",{style:{alignItems:"center",backgroundColor:f.type==="bar"?"#f97316":"#10b981",border:"2px solid white",borderRadius:"50%",display:"flex",height:"32px",justifyContent:"center",width:"32px"},children:f.emoji?(0,Mn.jsx)("span",{style:{fontSize:"16px"},children:f.emoji}):(0,Mn.jsx)("div",{style:{backgroundColor:"white",borderRadius:"50%",height:"8px",width:"8px"}})}),(0,Mn.jsx)("div",{style:{borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`8px solid ${f.type==="bar"?"#f97316":"#10b981"}`,height:0,margin:"-2px auto 0",width:0}})]})},f.id))})};var eo=Be(It(),1),_T=({forcedLocation:a,heading:i})=>a?(0,eo.jsx)(Fp,{anchor:"center",latitude:a[1],longitude:a[0],children:(0,eo.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"center",position:"relative"},children:[(0,eo.jsx)("div",{style:{animation:"pulse 2s infinite",backgroundColor:"rgba(59, 130, 246, 0.4)",borderRadius:"50%",height:"40px",position:"absolute",width:"40px"}}),i!=null&&(0,eo.jsx)("div",{style:{height:"60px",position:"absolute",transform:`rotate(${i}deg)`,width:"60px",zIndex:0},children:(0,eo.jsxs)("svg",{style:{height:"100%",width:"100%"},viewBox:"0 0 100 100",children:[(0,eo.jsx)("defs",{children:(0,eo.jsxs)("radialGradient",{cx:"50%",cy:"50%",fx:"50%",fy:"50%",id:"grad1",r:"50%",children:[(0,eo.jsx)("stop",{offset:"0%",style:{stopColor:"rgba(37, 99, 235, 0.6)",stopOpacity:1}}),(0,eo.jsx)("stop",{offset:"100%",style:{stopColor:"rgba(37, 99, 235, 0)",stopOpacity:0}})]})}),(0,eo.jsx)("path",{d:"M 50 50 L 35 0 A 50 50 0 0 1 65 0 Z",fill:"url(#grad1)"})]})}),(0,eo.jsx)("div",{style:{alignItems:"center",backgroundColor:"white",borderRadius:"50%",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(37, 99, 235, 0.2)",display:"flex",height:"20px",justifyContent:"center",width:"20px",zIndex:1},children:(0,eo.jsx)("div",{style:{backgroundColor:"#2563eb",border:"2px solid white",borderRadius:"50%",height:"12px",width:"12px"}})}),(0,eo.jsx)("style",{children:"@keyframes pulse { 0% { transform: scale(0.95); opacity: 0.7; } 70% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(0.95); opacity: 0; } }"})]})}):null;var Rr=Be(It(),1),fk=({initialViewState:a={latitude:45.90583599233422,longitude:6.12589018919138,zoom:12},style:i={},mapStyle:u="https://tiles.cloudparse.fr/style/up_dark_matter",className:f="",maxBounds:m,children:s,onClick:I,onMapClickMiss:D,onContextMenu:U,interactiveLayerIds:V=[],onLoad:Q,showUserLocation:K=!0,followUser:te=!1,lockToUser:$=!1,showUserLocationButton:Ce=!0,renderUserLocation:ye,pois:he=[],onPoiClick:le,route:ee,showNavigationUI:de,navigationData:_e,onNavigationAbort:Ae,onNavigationModeChange:Re,navigation:Z,showControls:H=!0,menuItems:oe,menuContent:ge,drawerState:De,drawerContentRef:$e,controlProps:Ve={},enableTouchDrag:rt=!1})=>{let je=(0,$t.useContext)($n),tt=(0,$t.useContext)(tf),ze=(0,$t.useRef)(null),Ue=Op(),He=xv({navigation:Z,onModeChange:Z?Re:void 0}),Oe=He.isActive,Wt=Oe?{currentDistanceMeters:He.distanceRemainingMeters,mode:He.mode,route:He.route,start:He.start,totalDistance:He.totalDistanceMeters}:_e,ca=Oe?He.route?.geometry:ee,at=Oe?de!==!1&&Z?.showUI!==!1:de,ot=Wt?.mode||"preview",Ye=je?je.isFollowing:te,it=(0,$t.useRef)(Ye),mt=(0,$t.useRef)(!1),ia=(0,$t.useRef)(0),gt=(0,$t.useCallback)(()=>(mt.current=!0,++ia.current),[]),Rt=(0,$t.useCallback)(vt=>{ia.current===vt&&(mt.current=!1)},[]),[st,Kt]=(0,$t.useState)(Ye),Gt=je?je.isFollowing:st,qt=je?.setIsFollowing,Bt=(0,$t.useCallback)(vt=>{it.current=vt,Kt(vt),qt&&qt(vt)},[qt]);(0,$t.useEffect)(()=>{je&&je.isFollowing!==it.current&&(it.current=je.isFollowing)},[je?.isFollowing,je]);let ma=[...V];he.length>0&&!ma.includes("sdk-poi-layer")&&ma.push("sdk-poi-layer");let $r=(0,$t.useRef)(te);(0,$t.useEffect)(()=>{if(te!==$r.current&&(Bt(te),$r.current=te,te&&Ue.coords&&ze.current)){let vt=gt();ze.current.flyTo({center:Ue.coords,duration:1e3,essential:!0,zoom:Math.max(ze.current.getZoom(),16)}),setTimeout(()=>{Rt(vt)},1050)}},[te,Bt,Ue.coords,gt,Rt]);let ao=(0,$t.useRef)(null),Ui=(0,$t.useRef)(null);(0,$t.useEffect)(()=>{if(!ca||!ze.current){ca||(ao.current=null);return}let vt=ca!==ao.current,Ot=Ui.current!==ot;if(ot==="navigation"){if((Ot||vt)&&Bt(!0),(Ot||vt)&&Ue.coords&&ze.current){let na=gt();ze.current.flyTo({center:Ue.coords,duration:1e3,essential:!0,zoom:17}),setTimeout(()=>{Rt(na)},1050)}}else if(ot==="preview"&&vt){Bt(!1);let na=ca.coordinates;if(na.length>0){let we=na.reduce((Aa,Fr)=>[[Math.min(Aa[0][0],Fr[0]),Math.min(Aa[0][1],Fr[1])],[Math.max(Aa[1][0],Fr[0]),Math.max(Aa[1][1],Fr[1])]],[[na[0][0],na[0][1]],[na[0][0],na[0][1]]]);ze.current.fitBounds([we[0][0],we[0][1],we[1][0],we[1][1]],{padding:100,speed:1.2})}}ao.current=ca,Ui.current=ot},[ca,ot,Bt,Ue.coords,gt,Rt]),(0,$t.useEffect)(()=>{it.current&&!mt.current&&Ue.coords&&ze.current&&ze.current.easeTo({center:Ue.coords,duration:50,easing:vt=>vt,essential:!0})},[Ue.coords]);let Or=vv(ca,K?Ue.coords:null),yt=Wt?.currentDistanceMeters??null,ga=Wt?.totalDistance??null,Ya=Wt?.route?.durationSeconds??null,dr=yt??0,rr=(()=>{if(!Ya||!ga||!yt)return 0;let vt=yt/ga;return Math.ceil(Ya*vt/60)})(),fr=dr/1e3,oa=ga&&ga>0?Math.min(100,Math.max(0,(ga-dr)/ga*100)):0,Vt=at&&Wt&&ca?{distanceRemainingKm:fr,etaMins:rr,label:ot==="navigation"?"Walking Guidance Active":"Route Preview",mode:ot,onAbort:()=>{He.cancel(),Ae&&Ae()},onStart:Wt.start,progress:oa}:void 0,At=je?.setEtaData;(0,$t.useEffect)(()=>{At&&At(Vt)},[Vt,At]);let hr=je?.setDrawerState;(0,$t.useEffect)(()=>{hr&&De!==void 0&&hr(De)},[De,hr]);let Yr=oe??[],{mapLibreChildren:pr,menuContentFromChildren:Ea}=(0,$t.useMemo)(()=>{let vt=[],Ot=[];$t.default.Children.forEach(s,we=>{if($t.default.isValidElement(we)){let Aa=we.type,Fr=Aa?.displayName||Aa?.name,Dt=Aa===zp||Fr==="MapMenu",Qr=Dt||Aa===Q0||Aa===J0||Aa===e1||Aa===t1||["MapMenuItem","MapMenuTitle","MapMenuDivider","MapMenuFooter"].includes(Fr);Dt?$t.default.Children.forEach(we.props.children,qo=>{qo&&Ot.push(qo)}):Qr?Ot.push(we):vt.push(we)}else vt.push(we)});let na=Ot.length>0?(0,Rr.jsx)(zp,{children:Ot}):null;return{mapLibreChildren:vt,menuContentFromChildren:na}},[s]),Mi=vt=>{if(tt?.isPlacingLocation){tt.placeLocation([vt.lngLat.lng,vt.lngLat.lat]);return}let Ot=vt.features||[];if(le){let we=Ot.find(Aa=>Aa.layer.id==="sdk-poi-layer");if(we){le(we.properties);return}}Ot.some(we=>ma.includes(we.layer.id))||D&&D(vt),I&&I(vt)},Ei=(0,$t.useCallback)(vt=>{if(Ue.coords&&ze.current){Bt(!0);let Ot=gt();ze.current.flyTo({center:Ue.coords,duration:1e3,essential:!0,pitch:vt?.pitch||0,zoom:Math.max(ze.current.getZoom(),16),...vt?.bearing!==void 0?{bearing:vt.bearing}:{}}),setTimeout(()=>{Rt(Ot)},1050)}},[Ue.coords,Bt,gt,Rt]),Kr=(0,$t.useCallback)((vt,Ot)=>{let na=ze.current;if(!na)return;Bt(!1);let we=gt();na.flyTo({center:vt,essential:!0,pitch:Ot?.pitch??0,zoom:Ot?.zoom??na.getZoom(),...Ot?.duration!==void 0?{duration:Ot.duration}:{},...Ot?.bearing!==void 0?{bearing:Ot.bearing}:{}}),na.once("moveend",()=>Rt(we))},[Bt,gt,Rt]),ir=(0,$t.useCallback)(vt=>{ze.current&&ze.current.easeTo({bearing:0,duration:500,essential:!0,pitch:vt?.pitch??0})},[]);(0,$t.useEffect)(()=>{je&&(je._registerCenterCallback(Ei),je._registerResetBearingCallback(ir),je._registerFlyToCallback(Kr))},[je,Ei,ir,Kr]);let di=(0,$t.useCallback)(()=>{ze.current&&je&&(je.setBearing(ze.current.getBearing()),je.setPitch(ze.current.getPitch()))},[je]),Cr=()=>{$||it.current&&(Bt(!1),ze.current&&ze.current.stop())};return(0,Rr.jsxs)("div",{className:`w-full h-full overflow-hidden relative ${tt?.isPlacingLocation?"cursor-crosshair":""} ${f}`,style:i,children:[(0,Rr.jsxs)(Pv,{attributionControl:!1,initialViewState:a,interactiveLayerIds:ma,mapStyle:u,maxBounds:m,onClick:Mi,onContextMenu:U,onDragStart:Cr,onLoad:vt=>{Q&&Q(vt),te&&Ue.coords&&ze.current&&ze.current.jumpTo({center:Ue.coords,zoom:16})},onMouseDown:Cr,onMove:di,onRotateStart:Cr,onTouchStart:Cr,onWheel:Cr,ref:ze,children:[K&&Ue.coords&&(ye?ye({coords:Ue.coords,heading:Ue.heading}):(0,Rr.jsx)(_T,{forcedLocation:Ue.coords,heading:Ue.heading})),tt&&tt.radiusMeters>0&&Ue.coords&&(0,Rr.jsx)(pT,{center:Ue.coords,radiusMeters:tt.radiusMeters}),Or&&(0,Rr.jsx)(Rv,{geometry:Or}),he.length>0&&(0,Rr.jsxs)(Rr.Fragment,{children:[(0,Rr.jsx)(gT,{pois:he}),(0,Rr.jsx)(yT,{onClick:le,pois:he})]}),pr]}),H&&je&&!je.hasControls&&(0,Rr.jsx)(gv,{drawerContentRef:$e,enableTouchDrag:rt,etaData:Vt,initialViewState:a,isInternal:!0,menuContent:ge||Ea,menuItems:Yr,...Ve})]})},hk=({children:a})=>(0,$t.useContext)($n)?(0,Rr.jsx)(Rr.Fragment,{children:a}):(0,Rr.jsx)(pv,{children:a}),kv=a=>(0,Rr.jsx)(hk,{children:(0,Rr.jsx)(bv,{children:(0,Rr.jsx)(fk,{...a})})});var Z4=Be(ut(),1),X4=Be(H4(),1);function hw(a,i={}){let u=document.getElementById(a);if(!u)throw new Error(`Container with id "${a}" not found.`);let f=(0,X4.createRoot)(u);return f.render(Z4.default.createElement(kv,i)),f}var Uy={createErrorResponse(a,i,u){return{error:{code:i,message:u},requestId:a.requestId,sdkVersion:a.sdkVersion,success:!1,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},decodePolyline(a,i){let u=0,f=0,m=0,s=[],I=10**i;for(;u<a.length;){let D,U=0,V=0;do D=a.charCodeAt(u++)-63,V|=(D&31)<<U,U+=5;while(D>=32);let Q=V&1?~(V>>1):V>>1;f+=Q,U=0,V=0;do D=a.charCodeAt(u++)-63,V|=(D&31)<<U,U+=5;while(D>=32);let K=V&1?~(V>>1):V>>1;m+=K,s.push([m/I,f/I])}return s},async fetchOSRMRoute(a,i,u,f){let m=i.map(K=>`${K[0]},${K[1]}`).join(";"),I=`${f}/route/v1/${u==="walking"?"foot":u==="driving"?"car":"bike"}/${m}?overview=full&geometries=geojson&steps=true`,D=await fetch(I);if(!D.ok)throw new Error(`OSRM Error: ${D.statusText}`);let U=await D.json();if(U.code!=="Ok"||!U.routes||U.routes.length===0)throw new Error("NO_ROUTE");let V=U.routes[0],Q=V.legs?.flatMap(K=>K.steps?.map(te=>({distance:te.distance,duration:te.duration,instruction:te.maneuver?.instruction||"Continue"})))||[];return{data:{distanceMeters:V.distance,durationSeconds:V.duration,geometry:V.geometry,steps:Q},requestId:a.requestId,sdkVersion:a.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},async fetchRoute(a,i){let{origin:u,destination:f,waypoints:m,profile:s,language:I}=a.payload;if(!this.isValidCoordinate(u)||!this.isValidCoordinate(f))return this.createErrorResponse(a,"INVALID_INPUT","Origin or destination coordinates are invalid.");if(m&&!m.every(this.isValidCoordinate))return this.createErrorResponse(a,"INVALID_INPUT","One or more waypoints are invalid.");let D=[u,...m||[],f];try{return i.backend==="osrm"?await this.fetchOSRMRoute(a,D,s,i.baseUrl):await this.fetchValhallaRoute(a,D,s,I,i.baseUrl)}catch(U){return U instanceof Error&&U.message.includes("NO_ROUTE")?this.createErrorResponse(a,"NO_ROUTE","No route could be found for the given points."):U instanceof TypeError?this.createErrorResponse(a,"NETWORK_ERROR","Failed to connect to the routing backend."):this.createErrorResponse(a,"BACKEND_ERROR",`Routing backend error: ${U instanceof Error?U.message:"Unknown error"}`)}},async fetchValhallaRoute(a,i,u,f,m){let I={costing:u==="driving"?"auto":u==="walking"?"pedestrian":"bicycle",directions_options:{language:f||"en-US"},locations:i.map(te=>({lat:te[1],lon:te[0]}))},D=await fetch(`${m}/route`,{body:JSON.stringify(I),headers:{"Content-Type":"application/json"},method:"POST"});if(!D.ok)throw new Error(`Valhalla Error: ${D.statusText}`);let U=await D.json();if(!U.trip||!U.trip.legs||U.trip.legs.length===0)throw new Error("NO_ROUTE");let V=U.trip,Q=this.decodePolyline(V.legs[0].shape,6),K=V.legs.flatMap(te=>te.maneuvers?.map($=>({distance:$.length*1e3,duration:$.time,instruction:$.instruction||"Continue"})))||[];return{data:{distanceMeters:V.summary.length*1e3,durationSeconds:V.summary.time,geometry:{coordinates:Q,type:"LineString"},steps:K},requestId:a.requestId,sdkVersion:a.sdkVersion,success:!0,type:"SDK_ROUTING_GETROUTE_RESPONSE"}},isValidCoordinate(a){let[i,u]=a;return i>=-180&&i<=180&&u>=-90&&u<=90}};var qm="0.5.4";function W4(a){let i=Object.getOwnPropertyNames(a);for(let u of i){let f=a[u];f&&typeof f=="object"&&!Object.isFrozen(f)&&!(f instanceof Lp)&&W4(f)}return Object.freeze(a)}var pw=null,Vm=class{maps=Object.freeze({render:hw});bridge;storage=Object.freeze({get:i=>this.bridge.send("STORAGE_GET",{key:i}),getAll:()=>this.bridge.send("STORAGE_GET_ALL"),set:(i,u)=>this.bridge.send("STORAGE_SET",{key:i,value:u})});secureStore=Object.freeze({get:i=>this.bridge.send("SECURE_GET",{key:i}),set:(i,u)=>this.bridge.send("SECURE_SET",{key:i,value:u})});database=Object.freeze({getUserData:()=>this.bridge.send("DATABASE_GET_USER_DATA"),setUserData:i=>this.bridge.send("DATABASE_SET_USER_DATA",{data:i})});location=Object.freeze({getCurrentPosition:()=>this.bridge.send("GET_CURRENT_POSITION"),startStream:i=>this.bridge.send("START_LOCATION_STREAM",i),stopStream:()=>this.bridge.send("STOP_LOCATION_STREAM")});user=Object.freeze({getProfile:i=>this.bridge.send("GET_USER_PROFILE",{fields:i}),getProfilePicture:(i=>this.bridge.send("GET_PROFILE_PICTURE",{uuids:i||[]}))});permission=Object.freeze({request:((i,u)=>this.bridge.send("REQUEST_PERMISSION",{fields:u,type:i}))});media=Object.freeze({saveImage:(i,u)=>this.bridge.send("SAVE_IMAGE",{base64:i,filename:u})});payment=Object.freeze({request:i=>this.bridge.send("PAYMENT_REQUEST",i)});activity=Object.freeze({start:(i,u,f)=>this.bridge.send("START_ACTIVITY",{id:i,status:f,title:u})});haptic=Object.freeze({trigger:i=>this.bridge.send("TRIGGER_HAPTIC",{style:i})});network=Object.freeze({request:async i=>this.bridge.send("NETWORK_REQUEST",i)});navigation=Object.freeze({abort:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_ABORT",type:"EVENT"})},createJourney:i=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_CREATE",payload:{...i,mode:"preview"},type:"EVENT"})},start:()=>{this.bridge.handleNativeMessage({eventName:"SDK_NAVIGATION_START",type:"EVENT"})}});fidelity=Object.freeze({getFidelityBalance:()=>this.bridge.send("GET_FIDELITY_BALANCE"),getFidelityHistory:i=>this.bridge.send("GET_FIDELITY_HISTORY",i),showHistory:i=>this.bridge.send("SHOW_FIDELITY_HISTORY",i),spendFPoints:i=>this.bridge.send("SPEND_FPOINTS",{intentUuid:i})});ui=Object.freeze({exit:()=>this.bridge.send("EXIT"),setScrollConfig:i=>this.bridge.send("SET_SCROLL_CONFIG",i)});debug=Object.freeze({log:(...i)=>this.bridge.send("DEBUG_LOG",{message:i})});routing=Object.freeze({clearRoute:()=>{let i=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_CLEARROUTE",{requestId:i,sdkVersion:qm})},drawRoute:i=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2);return this.bridge.send("SDK_ROUTING_DRAWROUTE",{payload:{routeData:i},requestId:u,sdkVersion:qm})},getRoute:async i=>{let u=crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).substring(2),f={payload:i,requestId:u,sdkVersion:qm,type:"SDK_ROUTING_GETROUTE"};if(pw){let m=await Uy.fetchRoute(f,pw);if(m.success&&m.data)return m.data;throw new Error(m.error?.message||"Routing failed")}return this.bridge.send("SDK_ROUTING_GETROUTE",{payload:i,requestId:u,sdkVersion:qm})}});constructor(){this.bridge=new Lp,this.initialize=this.initialize.bind(this),this.on=this.on.bind(this),this.off=this.off.bind(this)}config(i){i.routingBackend&&(pw=i.routingBackend)}updateContext(i){return this.bridge.send("UPDATE_CONTEXT",i)}initialize(i){return this.bridge.send("INITIALIZE",i)}on(i,u){return this.bridge.on(i,u)}off(i,u){this.bridge.off(i,u)}},er=W4(new Vm);var Ma=Be(ut(),1),bt=Be(It(),1),q8=(a,i)=>{let u=a[1]*Math.PI/180,f=i[1]*Math.PI/180,m=(i[0]-a[0])*Math.PI/180,s=Math.sin(m)*Math.cos(f),I=Math.cos(u)*Math.sin(f)-Math.sin(u)*Math.cos(f)*Math.cos(m);return(Math.atan2(s,I)*180/Math.PI+360)%360},mw=({appId:a,initialLocation:i=[6.1258,45.9058],isMoving:u=!1,simulationPath:f,simulationSpeed:m=1,mockJWTToken:s,children:I})=>{let[D,U]=(0,Ma.useState)(u),[V,Q]=(0,Ma.useState)(i),[K,te]=(0,Ma.useState)(0),[$,Ce]=(0,Ma.useState)(m),[ye,he]=(0,Ma.useState)(!1),[le,ee]=(0,Ma.useState)(!0),[de,_e]=(0,Ma.useState)(0),[Ae,Re]=(0,Ma.useState)("m"),[Z,H]=(0,Ma.useState)(!1),oe=(0,Ma.useRef)(null),ge=(0,Ma.useRef)(0),De=(0,Ma.useRef)(null),$e=(0,Ma.useRef)({autoMove:D,heading:K,location:V,mockJWTToken:s,pushLocationUpdate:()=>{},setHeading:te,setLocation:Q,simulationPath:f,speedMultiplier:$}),Ve=(0,Ma.useCallback)((Ue,He)=>{let Oe=$e.current,Wt={accelerometer:null,heading:{accuracy:3,magneticHeading:He,trueHeading:He},location:{coords:{accuracy:10,altitude:0,altitudeAccuracy:null,heading:He,latitude:Ue[1],longitude:Ue[0],speed:Oe.autoMove?1.5*Oe.speedMultiplier:0},timestamp:Date.now()},timestamp:Date.now()};window.__MiniAppBridge?.onNativeMessage({eventName:"LOCATION_STREAM_UPDATE",payload:Wt,type:"EVENT"})},[]),rt=(0,Ma.useCallback)(()=>{let Ue=$e.current;Ve(Ue.location,Ue.heading)},[Ve]),je=(0,Ma.useCallback)(Ue=>{Q(Ue),H(!1),Ve(Ue,$e.current.heading)},[Ve]);(0,Ma.useEffect)(()=>{$e.current={autoMove:D,heading:K,location:V,mockJWTToken:s,pushLocationUpdate:rt,setHeading:te,setLocation:Q,simulationPath:f,speedMultiplier:$}},[V,K,D,rt,f,$,s]),(0,Ma.useEffect)(()=>{U(u)},[u]),(0,Ma.useEffect)(()=>{Ce(m)},[m]),(0,Ma.useEffect)(()=>{f&&f.length>0&&(ge.current=0,Q(f[0]))},[f]),(0,Ma.useEffect)(()=>{oe.current&&De.current&&er.bridge.send("START_LOCATION_STREAM",De.current)},[$]),(0,Ma.useEffect)(()=>{let Ue=er.bridge,He=Ue.send.bind(Ue),Oe=()=>{oe.current&&(clearInterval(oe.current),oe.current=null),De.current=null},Wt=at=>{Oe(),De.current=at||{};let ot=at?.interval||500,Ye=Math.max(10,ot/$e.current.speedMultiplier);oe.current=setInterval(()=>{let it=$e.current;if(it.autoMove)if(it.simulationPath&&it.simulationPath.length>0)if(ge.current<it.simulationPath.length-1){let mt=it.simulationPath[ge.current],ia=it.simulationPath[ge.current+1];ge.current+=1;let gt=q8(mt,ia);it.setHeading(gt),it.setLocation(ia)}else it.setLocation(it.simulationPath[it.simulationPath.length-1]);else it.setLocation(mt=>[mt[0]+(Math.random()-.5)*1e-4,mt[1]+(Math.random()-.5)*1e-4]);it.pushLocationUpdate()},Ye)},ca=async at=>{let{url:ot,method:Ye="GET",headers:it={},body:mt}=at,ia=$e.current,gt=new Headers(it);ia.mockJWTToken&&gt.set("Authorization",`Bearer ${ia.mockJWTToken.replace("Bearer ","")}`),mt&&typeof mt=="object"&&!gt.has("Content-Type")&&gt.set("Content-Type","application/json");try{let Rt=await fetch(ot,{body:mt?typeof mt=="string"?mt:JSON.stringify(mt):void 0,headers:gt,method:Ye}),st=Rt.headers.get("content-type"),Kt;st?.includes("application/json")?Kt=await Rt.json():Kt=await Rt.text();let Gt={};return Rt.headers.forEach((qt,Bt)=>{Gt[Bt]=qt}),{data:Kt,headers:Gt,status:Rt.status,statusText:Rt.statusText}}catch(Rt){throw{error:Rt.message||"Network request failed",status:0}}};return Ue.send=async(at,ot)=>{if(at==="INITIALIZE")return Promise.resolve({appId:a,context:{theme:"dark"},description:"Mocked for Dev",env:{},insets:{bottom:0,left:0,right:0,top:0},name:"Vite Dev (Mock)",params:{},profile:{admin:!0,countryCode:"FR",createdAt:new Date().toISOString(),email:"caveman@up.app",firstName:"Smart",fullName:"Smart Caveman",lastName:"Caveman",localNumber:"0600000000",ups:100,username:"smart_caveman",uuid:"mock-user-42",xp:500},success:!0,userData:{},uuid:a||"mock-app-id",version:"1.0.0"});if(at==="GET_CURRENT_POSITION"){let Ye=$e.current;return Promise.resolve({coords:{accuracy:10,altitude:0,altitudeAccuracy:0,heading:Ye.heading,latitude:Ye.location[1],longitude:Ye.location[0],speed:Ye.autoMove?1.5*Ye.speedMultiplier:0},timestamp:Date.now()})}if(at==="START_LOCATION_STREAM")return Wt(ot),Promise.resolve();if(at==="STOP_LOCATION_STREAM")return Oe(),Promise.resolve();if(at==="NETWORK_REQUEST")return ca(ot);if(at==="STORAGE_GET"||at==="SECURE_GET")return Promise.resolve(localStorage.getItem(`mock_sdk_${ot.key}`));if(at==="STORAGE_SET"||at==="SECURE_SET")return localStorage.setItem(`mock_sdk_${ot.key}`,ot.value),Promise.resolve();if(at==="GET_USER_PROFILE")return Promise.resolve({admin:!0,countryCode:"FR",createdAt:new Date().toISOString(),email:"caveman@up.app",firstName:"Smart",fullName:"Smart Caveman",lastName:"Caveman",localNumber:"0600000000",ups:100,username:"smart_caveman",uuid:"mock-user-42",xp:500});if(at==="GET_PROFILE_PICTURE"){let Ye=ot?.uuids||[];if(Ye.length===0)return Promise.resolve("https://api.dicebear.com/9.x/rings/png?seed=dummy");let it={};for(let mt of Ye)it[mt]=`https://api.dicebear.com/9.x/rings/png?seed=${mt}`;return Promise.resolve(it)}return at==="GET_FIDELITY_BALANCE"?Promise.resolve({balance:1337,currency:"FPoints"}):at==="PAYMENT_REQUEST"?Promise.resolve({success:!0,transactionId:`tx_${Math.random().toString(36).slice(2)}`}):at==="TRIGGER_HAPTIC"||at==="EXIT"||at==="UPDATE_CONTEXT"?Promise.resolve({success:!0}):He(at,ot)},he(!0),()=>{Oe(),Ue.send=He}},[a]);let tt=Ae==="km"?de*1e3:de,ze=(0,Ma.useMemo)(()=>({isPlacingLocation:Z,placeLocation:je,radiusMeters:tt}),[Z,je,tt]);return ye?(0,bt.jsxs)("div",{className:"relative w-full h-full",children:[(0,bt.jsx)("div",{className:"w-full h-full",children:(0,bt.jsx)(tf.Provider,{value:ze,children:I})}),le?(0,bt.jsx)(Na,{className:"fixed bottom-4 right-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-blue-400 hover:bg-slate-900/80 z-[9999] transition-all shadow-lg group p-0!",onClick:()=>ee(!1),title:"Open Simulation Controls",type:"button",variant:"ghost",children:(0,bt.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,bt.jsx)("path",{d:"M21 4H3"}),(0,bt.jsx)("path",{d:"M10 8H3"}),(0,bt.jsx)("path",{d:"M21 12H3"}),(0,bt.jsx)("path",{d:"M10 16H3"}),(0,bt.jsx)("path",{d:"M21 20H3"}),(0,bt.jsx)("circle",{cx:"14",cy:"8",r:"2"}),(0,bt.jsx)("circle",{cx:"14",cy:"16",r:"2"})]})}):(0,bt.jsxs)("div",{className:"fixed bottom-4 right-4 bg-slate-900 text-slate-300 font-mono text-xs rounded-xl shadow-2xl border border-slate-700 pointer-events-auto flex flex-col w-80 overflow-hidden animate-in slide-in-from-right duration-300",style:{zIndex:9998},children:[(0,bt.jsxs)("div",{className:"flex justify-between items-center p-3 border-b border-slate-800 cursor-pointer bg-slate-800/50 hover:bg-slate-800 transition-colors",onClick:()=>ee(!0),children:[(0,bt.jsxs)("span",{className:"font-bold text-slate-100 flex items-center gap-2",children:[(0,bt.jsx)("span",{className:"text-lg",children:"\u{1F6E0}\uFE0F"})," Simulation Controls"]}),(0,bt.jsx)(Na,{className:"text-slate-500 hover:text-white p-0 h-auto hover:bg-transparent cursor-pointer",type:"button",variant:"ghost",children:"\u25BC"})]}),(0,bt.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,bt.jsxs)("div",{className:"flex justify-between items-center",children:[(0,bt.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,bt.jsx)("input",{checked:D,className:"accent-blue-500 w-4 h-4",onChange:Ue=>U(Ue.target.checked),type:"checkbox"}),(0,bt.jsxs)("span",{className:"text-slate-200 font-bold",children:["Auto-Move ",f?"(Path)":"(Random)"]})]}),(0,bt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Speed:"}),(0,bt.jsx)("select",{className:"bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white focus:outline-none focus:border-blue-500 text-[10px]",onChange:Ue=>Ce(Number(Ue.target.value)),value:$,children:[1,2,5,10,50,100,250].map(Ue=>(0,bt.jsxs)("option",{value:Ue,children:[Ue,"x"]},Ue))})]})]}),(0,bt.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,bt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lng"}),(0,bt.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Ue=>{let He=parseFloat(Ue.target.value)||0;Q([He,V[1]]),rt()},step:"0.001",type:"number",value:V[0]})]}),(0,bt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500 text-left",children:"Lat"}),(0,bt.jsx)("input",{className:"bg-slate-800 border border-slate-700 rounded px-2 py-1 text-white focus:outline-none focus:border-blue-500",onChange:Ue=>{let He=parseFloat(Ue.target.value)||0;Q([V[0],He]),rt()},step:"0.001",type:"number",value:V[1]})]}),(0,bt.jsxs)("div",{className:"flex flex-col gap-1 col-span-2",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Heading (Degrees)"}),(0,bt.jsx)("input",{className:"w-full accent-blue-500",max:"360",min:"0",onChange:Ue=>{te(parseInt(Ue.target.value,10)),rt()},type:"range",value:K}),(0,bt.jsxs)("div",{className:"text-right text-slate-400",children:[K,"\xB0"]})]})]}),(0,bt.jsx)(Na,{className:`w-full rounded px-2 py-1.5 text-[10px] font-bold border cursor-pointer ${Z?"bg-blue-500/20 border-blue-500 text-blue-300":"bg-slate-800 border-slate-700 text-slate-200 hover:bg-slate-700"}`,onClick:()=>H(Ue=>!Ue),type:"button",variant:"ghost",children:Z?"\u{1F4CD} Click the map to drop location\u2026":"\u{1F4CD} Drop location on map"}),(0,bt.jsxs)("div",{className:"flex flex-col gap-1 border-t border-slate-800 pt-3",children:[(0,bt.jsxs)("div",{className:"flex justify-between items-center",children:[(0,bt.jsx)("span",{className:"text-[10px] text-slate-500",children:"Scan Radius"}),(0,bt.jsxs)("div",{className:"flex items-center gap-1",children:[(0,bt.jsx)("input",{className:"w-16 bg-slate-800 border border-slate-700 rounded px-1.5 py-0.5 text-white text-[10px] focus:outline-none focus:border-blue-500",min:"0",onChange:Ue=>_e(Math.max(0,Number(Ue.target.value)||0)),type:"number",value:de}),(0,bt.jsxs)("select",{className:"bg-slate-800 border border-slate-700 rounded px-1 py-0.5 text-white text-[10px] focus:outline-none focus:border-blue-500",onChange:Ue=>Re(Ue.target.value),value:Ae,children:[(0,bt.jsx)("option",{value:"m",children:"m"}),(0,bt.jsx)("option",{value:"km",children:"km"})]})]})]}),(0,bt.jsx)("input",{className:"w-full accent-blue-500",max:Ae==="km"?10:500,min:"0",onChange:Ue=>_e(Number(Ue.target.value)),step:Ae==="km"?.1:5,type:"range",value:de}),(0,bt.jsx)("div",{className:"text-right text-slate-400",children:de===0?"hidden":`${de}${Ae} radius around user`})]})]})]})]}):null};var ns=Be(ut(),1),Ca=Be(It(),1),gw=({isOpen:a=!1,onClose:i})=>{let[u,f]=(0,ns.useState)(a),[m,s]=(0,ns.useState)([]),I=(0,ns.useRef)(null);(0,ns.useEffect)(()=>{f(a)},[a]);let D=()=>s([]),U=(0,ns.useCallback)((V,Q)=>{if(V.includes("LOCATION_STREAM_UPDATE"))return;let K={content:typeof Q=="string"?Q:JSON.stringify(Q,null,2),id:Math.random().toString(36).slice(2),label:V,time:new Date().toLocaleTimeString()};s(te=>[K,...te].slice(0,100))},[]);return(0,ns.useEffect)(()=>{if(typeof window>"u")return;let V=er.bridge,Q=V.send.bind(V);V.send=async(te,$)=>(U(`OUT: ${te}`,$),Q(te,$));let K=V.handleNativeMessage.bind(V);return V.handleNativeMessage=te=>{let $=te.eventName||te.event||te.type||"MSG";typeof $=="string"&&(U(`IN: ${$}`,te.payload||te.value||te),K(te))},()=>{V.send=Q,V.handleNativeMessage=K}},[U]),u?(0,Ca.jsxs)("div",{className:"fixed inset-x-0 bottom-0 w-full bg-[#0a080f] border-t border-slate-800 z-[9998] p-4 shadow-2xl flex flex-col animate-in slide-in-from-bottom duration-300",children:[(0,Ca.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,Ca.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-slate-400 flex items-center gap-2",children:[(0,Ca.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),"UP SDK Debug Console"]}),(0,Ca.jsxs)("div",{className:"flex gap-4",children:[(0,Ca.jsx)(Na,{className:"text-[10px] text-slate-500 font-bold uppercase hover:text-slate-300 hover:bg-transparent transition-colors p-0 h-auto cursor-pointer",onClick:D,type:"button",variant:"ghost",children:"Clear"}),(0,Ca.jsx)(Na,{className:"text-[10px] text-pink-500 font-bold uppercase hover:text-pink-400 hover:bg-transparent transition-colors p-0 h-auto cursor-pointer",onClick:()=>{f(!1),i&&i()},type:"button",variant:"ghost",children:"Close"})]})]}),(0,Ca.jsx)("div",{className:"bg-black/80 rounded-xl p-3 font-mono text-[10px] text-emerald-400 min-h-[120px] max-h-[240px] overflow-y-auto border border-slate-900 custom-scrollbar",ref:I,children:m.length===0?(0,Ca.jsx)("div",{className:"text-slate-600 italic text-center py-8",children:"No logs yet. Interacting with the SDK will show events here."}):m.map(V=>(0,Ca.jsxs)("div",{className:"mb-3 pb-3 border-b border-slate-900/50 last:border-0 last:mb-0 last:pb-0",children:[(0,Ca.jsxs)("div",{className:"flex gap-2 text-slate-500 mb-1 items-center",children:[(0,Ca.jsx)("span",{className:"text-[8px]",children:V.time}),(0,Ca.jsx)("span",{className:"font-bold text-white uppercase text-[8px] bg-slate-800 px-1.5 py-0.5 rounded leading-none",children:V.label})]}),(0,Ca.jsx)("pre",{className:"whitespace-pre-wrap break-all opacity-90",children:V.content})]},V.id))})]}):(0,Ca.jsx)(Na,{className:"fixed bottom-4 left-4 w-8 h-8 rounded-full bg-slate-900/60 backdrop-blur-sm border border-slate-700/50 flex items-center justify-center text-slate-400 hover:text-emerald-400 hover:bg-slate-900/80 transition-all z-[9998] shadow-lg group p-0!",onClick:()=>f(!0),title:"Open Debug Console",type:"button",variant:"ghost",children:(0,Ca.jsxs)("svg",{className:"group-hover:scale-110 transition-transform",fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"14",xmlns:"http://www.w3.org/2000/svg",children:[(0,Ca.jsx)("path",{d:"m8 2 1.88 1.88"}),(0,Ca.jsx)("path",{d:"M14.12 3.88 16 2"}),(0,Ca.jsx)("path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"}),(0,Ca.jsx)("path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"}),(0,Ca.jsx)("path",{d:"M12 20v-9"}),(0,Ca.jsx)("path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5"}),(0,Ca.jsx)("path",{d:"M6 13H2"}),(0,Ca.jsx)("path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4"}),(0,Ca.jsx)("path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4"}),(0,Ca.jsx)("path",{d:"M22 13h-4"}),(0,Ca.jsx)("path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4"})]})})};var oh=Be(ut(),1);var nl=Be(It(),1),yw=(0,oh.createContext)({isMocked:!1}),V8=()=>(0,oh.useContext)(yw).isMocked,j8=({children:a,debug:i=!1,...u})=>{let f=typeof window<"u"&&!(window.__UP_REACT_NATIVE_APP__===!0||window.ReactNativeWebView),m=(0,oh.useMemo)(()=>({isMocked:f}),[f]),s=(0,nl.jsxs)(nl.Fragment,{children:[a,(i||f)&&(0,nl.jsx)(gw,{})]});return f?(0,nl.jsx)(yw.Provider,{value:m,children:(0,nl.jsx)(mw,{...u,children:s})}):(0,nl.jsx)(yw.Provider,{value:m,children:s})};var Ii=Be(ut(),1),qy=Be(It(),1),$4=8,G8=40,H8=.4,Z8=.35,X8="cubic-bezier(0.16, 1, 0.3, 1)",W8=300,$8=15,Y8=200,K8=.5,Q8=2,J8=1,e7="[data-swipe-scroll-root]",Y4=`transform ${W8}ms ${X8}`,t7=({items:a,activeId:i,onActiveChange:u,peek:f=1.1,gap:m=10,className:s,itemClassName:I,axisPriority:D="horizontal",verticalDrag:U,overscan:V=Q8,visibleOverscan:Q=J8})=>{let K=(0,Ii.useRef)(null),[te,$]=(0,Ii.useState)(0),[Ce,ye]=(0,Ii.useState)(0),[he,le]=(0,Ii.useState)(0),[ee,de]=(0,Ii.useState)(!1),[_e,Ae]=(0,Ii.useState)(!1),Re=(0,Ii.useRef)(null),[Z,H]=(0,Ii.useState)(()=>Math.max(0,a.findIndex(at=>at.id===i))),oe=(0,Ii.useRef)(i),[ge,De]=(0,Ii.useState)(!0);(0,Ii.useEffect)(()=>{let at=setTimeout(()=>{De(!1)},1e3);return()=>clearTimeout(at)},[]),(0,Ii.useEffect)(()=>{if(i!==oe.current){let at=a.findIndex(ot=>ot.id===i);at!==-1&&H(at),oe.current=i}},[i,a]);let $e=Math.min(Math.max(Z,0),Math.max(a.length-1,0));(0,Ii.useLayoutEffect)(()=>{let at=K.current;if(!at)return;let ot=()=>$(at.clientWidth);ot();let Ye=new ResizeObserver(ot);return Ye.observe(at),()=>Ye.disconnect()},[]);let Ve=te/f,rt=Ve+m,tt=(te-Ve)/2-$e*rt+Ce,ze=at=>{H(at);let ot=a[at];ot&&ot.id!==i&&u(ot.id)},Ue=at=>{let ot=at.targetTouches[0];if(!ot)return;let Ye=!1;if(U){let it=U.scrollRootSelector??e7,mt=at.target.closest(it);Ye=!mt||mt.scrollTop<=2}Re.current={lastT:at.timeStamp,lastX:ot.clientX,lastY:ot.clientY,lockedAxis:null,startX:ot.clientX,startY:ot.clientY,velocityX:0,velocityY:0,verticalAllowed:Ye}},He=at=>{let ot=at.targetTouches[0],Ye=Re.current;if(!ot||!Ye)return;let it=ot.clientX-Ye.startX,mt=ot.clientY-Ye.startY;if(!Ye.lockedAxis){if(Math.abs(it)<$4&&Math.abs(mt)<$4)return;Math.abs(it)>Math.abs(mt)||Math.abs(it)===Math.abs(mt)&&D==="horizontal"?Ye.lockedAxis="x":U&&Ye.verticalAllowed?Ye.lockedAxis="y":Ye.lockedAxis="passthrough"}if(Ye.lockedAxis==="passthrough")return;let ia=at.timeStamp-Ye.lastT;if(ia>0&&(Ye.velocityX=(ot.clientX-Ye.lastX)/ia,Ye.velocityY=(ot.clientY-Ye.lastY)/ia),Ye.lastX=ot.clientX,Ye.lastY=ot.clientY,Ye.lastT=at.timeStamp,Ye.lockedAxis==="x"){ee||de(!0);let gt=$e===0&&it>0,Rt=$e===a.length-1&&it<0;ye(gt||Rt?it*Z8:it)}else if(U){let gt=U.direction??"down",Rt=mt;gt==="down"&&(Rt=Math.max(0,mt)),gt==="up"&&(Rt=Math.min(0,mt));let st=Math.sign(Rt)*Math.max(0,Math.abs(Rt)-$8);_e||Ae(!0),le(st),U.onDragChange?.(st,!0)}at.cancelable&&at.preventDefault()},Oe=()=>{let at=Re.current;if(Re.current=null,de(!1),Ae(!1),!at){ye(0),le(0);return}if(at.lockedAxis==="x"){if(Math.abs(Ce)>G8||Math.abs(at.velocityX)>H8){let Ye=Ce<0?Math.min(a.length-1,$e+1):Math.max(0,$e-1);ze(Ye)}}else if(at.lockedAxis==="y"){let ot=U?.dismissThreshold??Y8,Ye=U?.dismissVelocity??K8,it=U?.direction??"down",mt=it==="down"?Math.max(0,at.velocityY):it==="up"?Math.max(0,-at.velocityY):Math.abs(at.velocityY);(Math.abs(he)>ot||mt>Ye)&&U?.onDismiss?.()}ye(0),le(0),U?.onDragChange?.(0,!1)},Wt=Math.max(0,$e-V),ca=Math.min(a.length-1,$e+V);return(0,qy.jsx)("div",{className:`relative overflow-hidden touch-pan-y ${s??""}`,onTouchCancel:Oe,onTouchEnd:Oe,onTouchMove:He,onTouchStart:Ue,ref:K,children:(0,qy.jsx)("div",{className:"relative h-full",style:{transform:`translateX(${tt}px)`,transition:ee||ge?"none":Y4,willChange:"transform"},children:a.map((at,ot)=>{if(ot<Wt||ot>ca)return null;let Ye=ot===$e,it=Ye?he:0,mt=Math.abs(ot-$e),ia=mt<=Q;return(0,qy.jsx)("div",{className:`absolute top-0 left-0 h-full shrink-0 ${I??""} ${at.className??""}`,style:{opacity:ia?1:0,pointerEvents:ia?void 0:"none",transform:`translateX(${ot*rt}px) translateY(${it}px)`,transition:Ye&&_e||ge?"none":Y4,width:`${Ve}px`,zIndex:V+1-mt},children:at.content},at.id)})})})};async function a7(a,i){return Uy.fetchRoute(a,i)}function r7(a,i,u){let f=`sdk-route-${i}`,m=`sdk-route-casing-${i}`,s=`sdk-route-line-${i}`,I={features:[{geometry:u.payload.routeData.geometry,properties:{},type:"Feature"}],type:"FeatureCollection"},D=a.getSource(f);D?D.setData(I):(a.addSource(f,{data:I,type:"geojson"}),a.addLayer({id:m,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#111111","line-opacity":.8,"line-width":8},source:f,type:"line"}),a.addLayer({id:s,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":4},source:f,type:"line"}))}function i7(a,i){let u=`sdk-route-${i}`,f=`sdk-route-casing-${i}`,m=`sdk-route-line-${i}`;a.getLayer(m)&&a.removeLayer(m),a.getLayer(f)&&a.removeLayer(f),a.getSource(u)&&a.removeSource(u)}var o7=er;return K6(n7);})();
857
857
  /*! Bundled license information:
858
858
 
859
859
  react/cjs/react.production.js: