PageSourceSearch

https://flashradio.live/assets/CarMode-DpctNsjz.js

js flashradio.live collected 2026-10-06 10:54:09 UTC 16,189 bytes, 1 lines download raw bytes

1import{r as x,j as e}from"./vendor-react-nOabHAJa.js";import{u as Q,a as J,R as X}from"./index-CS1zPDfI.js";import{R as K,y as Y,f as y,M as G,X as Z,aQ as ee,H as te,aU as ae,P as se,a as re,aV as ie,aW as ne,aX as le,a1 as oe,aY as ce,a7 as de,A as xe,J as me,K as he,O as fe,Q as ue,U as pe}from"./vendor-ui-BFyh83Dh.js";import"./vendor-state-2O6DsXXc.js";import"./vendor-router-CmsszfIo.js";function Ne(){const{locale:u,t:s,dir:A}=Q(),p=u==="ar",{currentStation:h,isPlaying:n,togglePlay:P,playStation:j,favorites:N,toggleFavorite:R,isCarModeOpen:f,setIsCarModeOpen:T,volume:l,setVolume:k}=J(),[E,V]=x.useState(""),[be,W]=x.useState(null),[$,F]=x.useState(()=>{try{const t=localStorage.getItem("flashradio_cockpit_theme");if(t==="day"||t==="night")return t}catch{}return"night"}),U=()=>{const t=$==="night"?"day":"night";F(t);try{localStorage.setItem("flashradio_cockpit_theme",t)}catch{}},[d,D]=x.useState(null),[O,C]=x.useState(!0);if(x.useEffect(()=>{const t=()=>{const m=new Date,i=u==="ar"?"ar-TN":u==="en"?"en-US":"fr-FR";V(m.toLocaleTimeString(i,{hour:"2-digit",minute:"2-digit"}))};t();const r=setInterval(t,1e3);return()=>clearInterval(r)},[u]),x.useEffect(()=>{if(!f)return;let t=!0;const r=async()=>{C(!0);try{const i=localStorage.getItem("flashradio_weather_city")||"Tunis",g=localStorage.getItem("flashradio_weather_lat"),L=localStorage.getItem("flashradio_weather_lon"),w=new URLSearchParams;g&&L&&(w.append("lat",g),w.append("lon",L)),w.append("city",i);const z=await fetch(`/api/weather?${w.toString()}`);if(z.ok&&t){const v=await z.json();D({city:v.city||i,temperature:Math.round(v.temperature),condition:v.condition,icon:v.icon})}}catch(i){console.warn("[CarMode] Weather fetch error:",i)}finally{t&&C(!1)}};r();const m=setInterval(r,900*1e3);return()=>{t=!1,clearInterval(m)}},[f]),x.useEffect(()=>{if(!f)return;let t=null;return"wakeLock"in navigator&&navigator.wakeLock.request("screen").then(r=>{t=r,W(r)}).catch(r=>console.warn("[CarMode] WakeLock failed:",r)),()=>{t&&t.release().catch(()=>{})}},[f]),!f)return null;const c=X,_=h?c.findIndex(t=>t.id===h.id):0,S=()=>{const t=(_-1+c.length)%c.length;j(c[t])},I=()=>{const t=(_+1)%c.length;j(c[t])},b=h?N.includes(h.id):!1,q=(()=>{const t=c.filter(i=>N.includes(i.id));if(t.length>=4)return t.slice(0,4);const r=c.filter(i=>["mosaique","jawhara","shems","ifm"].includes(i.id));return[...t,...r.filter(i=>!t.some(g=>g.id===i.id))].slice(0,4)})(),o=h||c[0],B=(t,r=20)=>{switch(t){case"sun":return e.jsx(y,{size:r,className:"text-amber-500"});case"sun-cloud":return e.jsx(pe,{size:r,className:"text-amber-400"});case"cloud":return e.jsx(ue,{size:r,className:"text-sky-400"});case"rain":return e.jsx(fe,{size:r,className:"text-blue-500"});case"storm":return e.jsx(he,{size:r,className:"text-yellow-500"});case"snow":return e.jsx(me,{size:r,className:"text-cyan-400"});case"cloud-fog":return e.jsx(xe,{size:r,className:"text-slate-400"});default:return e.jsx(y,{size:r,className:"text-amber-500"})}},H=(t,r)=>{switch(r){case"sun":return s("weather.cond_clear",t||"Ciel dégagé");case"sun-cloud":return s("weather.cond_partly",t||"Éclaircies");case"cloud":return s("weather.cond_cloudy",t||"Nuageux");case"cloud-fog":return s("weather.cond_fog",t||"Brumeux");case"rain":return s("weather.cond_rain",t||"Pluvieux");case"snow":return s("weather.cond_snow",t||"Neige");case"storm":return s("weather.cond_storm",t||"Orages");default:return t}},M=t=>{const r=Math.max(0,Math.min(1,Math.round((l+t)*100)/100));k(r)},a=$==="night";return e.jsxs("div",{className:`fixed inset-0 z-[9999] flex flex-col justify-between p-3 sm:p-6 md:p-8 select-none touch-manipulation overflow-y-auto animate-in fade-in duration-300 ${a?"bg-[#06070a] text-white":"bg-[#f1f5f9] text-[#0f172a]"}`,style:{fontFamily:p?'"Noto Sans Arabic", "Inter", sans-serif':'"Inter", sans-serif'},dir:A,children:[e.jsx("div",{className:`absolute inset-0 pointer-events-none transition-opacity duration-700 ${a?"opacity-30":"opacity-15"}`,style:{backgroundImage:a?"radial-gradient(circle at 50% 20%, rgba(255, 78, 0, 0.15) 0%, transparent 60%), linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px)":"radial-gradient(circle at 50% 20%, rgba(234, 88, 12, 0.08) 0%, transparent 60%)",backgroundSize:"100% 100%, 32px 32px, 32px 32px"}}),e.jsxs("div",{className:`relative z-10 flex items-center justify-between gap-3 pb-3 sm:pb-4 border-b transition-colors ${a?"border-white/10":"border-slate-300/80"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 sm:gap-4",children:[e.jsx("span",{className:"text-3xl sm:text-4xl md:text-5xl font-black tracking-tighter text-primary font-mono drop-shadow-sm",children:E}),e.jsx("div",{className:"hidden sm:flex items-center gap-2",children:e.jsxs("span",{className:`px-3 py-1.5 rounded-xl text-xs font-black uppercase tracking-wider flex items-center gap-1.5 border transition-all ${a?"bg-white/10 text-white/90 border-white/15":"bg-[#ffffff] text-[#0f172a] border-slate-300 shadow-xs"}`,children:[e.jsx(K,{size:14,className:"text-primary animate-pulse"}),e.jsx("span",{children:s("car.title","Mode Voiture")})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[O&&!d?e.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 rounded-2xl border ${a?"bg-white/10 border-white/15":"bg-[#ffffff] border-slate-300 shadow-xs"}`,children:[e.jsx(Y,{size:16,className:`animate-spin ${a?"text-white/60":"text-[#64748b]"}`}),e.jsx("span",{className:`text-xs font-black ${a?"text-white/60":"text-[#64748b]"}`,children:"···"})]}):d?e.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 rounded-2xl border transition-all ${a?"bg-white/10 border-white/15 text-white/90":"bg-[#ffffff] border-slate-300 text-[#0f172a] shadow-xs"}`,title:`${d.city}
1 • ${H(d.condition,d.icon)}`,children:[B(d.icon,20),e.jsxs("div",{className:"flex flex-col leading-tight",children:[e.jsxs("span",{className:`text-xs sm:text-sm font-black tracking-tight ${a?"text-white":"text-[#0f172a]"}`,children:[d.temperature,"°C"]}),e.jsx("span",{className:`text-[9px] sm:text-[10px] font-bold uppercase tracking-wider truncate max-w-[80px] ${a?"text-white/60":"text-[#64748b]"}`,children:d.city})]})]}):null,e.jsx("button",{onClick:U,className:`w-11 h-11 sm:w-12 sm:h-12 rounded-2xl flex items-center justify-center border transition-all active:scale-90 cursor-pointer ${a?"bg-white/10 hover:bg-white/20 border-white/20 text-amber-400":"bg-[#ffffff] hover:bg-slate-100 border-slate-300 text-[#0f172a] shadow-sm"}`,"aria-label":a?s("car.day_mode","Mode Jour"):s("car.night_mode","Mode Nuit"),title:a?s("car.day_mode","Basculer en Mode Jour (Anti-reflet)"):s("car.night_mode","Basculer en Mode Nuit (OLED Carbone)"),children:a?e.jsx(y,{size:20}):e.jsx(G,{size:20,className:"text-[#0f172a]"})}),e.jsx("button",{onClick:()=>T(!1),className:`w-12 h-12 sm:w-14 sm:h-14 rounded-2xl flex items-center justify-center border transition-all active:scale-90 cursor-pointer ${a?"bg-white/15 hover:bg-white/25 border-white/30 text-white shadow-lg shadow-black/40":"bg-[#ffffff] hover:bg-slate-100 border-slate-300 text-[#0f172a] shadow-md"}`,"aria-label":s("car.close","Quitter le mode voiture"),title:s("car.close","Quitter le mode voiture"),children:e.jsx(Z,{size:28,className:a?"text-white":"text-[#0f172a]"})})]})]}),e.jsxs("div",{className:"relative z-10 flex-1 flex flex-col items-center justify-center my-3 sm:my-6 text-center max-w-3xl mx-auto w-full",children:[e.jsxs("div",{className:"relative group mb-3 sm:mb-5",children:[e.jsx("div",{className:`w-28 h-28 sm:w-40 sm:h-40 md:w-48 md:h-48 rounded-3xl overflow-hidden p-3 flex items-center justify-center transition-all duration-500 border-2 ${a?"bg-black/60 border-white/25 shadow-[0_10px_40px_rgba(0,0,0,0.8)]":"bg-[#ffffff] border-slate-300 shadow-2xl"}`,children:e.jsx("img",{src:o.logoUrl,alt:o.name,className:"w-full h-full object-contain filter drop-shadow-lg transition-transform duration-300 group-hover:scale-105"})}),n&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute -inset-2 rounded-3xl border-2 border-primary animate-ping opacity-40 pointer-events-none"}),e.jsx("div",{className:"absolute -inset-4 rounded-3xl border border-primary/30 animate-pulse pointer-events-none"})]}),e.jsxs("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-0.5 rounded-full bg-red-600 text-white text-[10px] font-black uppercase tracking-widest shadow-lg shadow-red-600/40 border border-white/20",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-white animate-ping"}),e.jsx("span",{children:"LIVE"})]})]}),e.jsx("h1",{className:`text-2xl sm:text-4xl md:text-5xl font-black mt-3 tracking-tight truncate max-w-full px-2 leading-tight ${a?"text-white drop-shadow-[0_2px_12px_rgba(0,0,0,0.8)]":"text-[#0f172a]"}`,children:o.name}),e.jsxs("p",{className:`text-sm sm:text-lg font-extrabold mt-1 tracking-wider uppercase flex items-center justify-center gap-2 ${a?"text-white/70":"text-[#475569]"}`,children:[e.jsx("span",{children:o.frequency||o.category}),o.location&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:o.location})]})]}),e.jsxs("div",{className:"w-full max-w-md mt-4 sm:mt-6 px-4",children:[e.jsx("div",{className:"flex items-end justify-center gap-1 sm:gap-1.5 h-10 sm:h-12 overflow-hidden px-2",children:[35,75,45,90,60,100,70,85,40,95,65,80,50,90,70,100,55,85,40,75,60,95,45,80].map((t,r)=>{const m=n?`${Math.max(15,t*(r%3+1)%100)}%`:"6px";return e.jsx("div",{className:`w-1.5 sm:w-2 rounded-full transition-all duration-150 ${a?"bg-gradient-to-t from-primary via-amber-400 to-rose-500 shadow-[0_0_8px_rgba(255,78,0,0.4)]":"bg-gradient-to-t from-primary to-amber-500 shadow-xs"}`,style:{height:m,animation:n?`visualizer-bounce 0.8s ease-in-out infinite alternate ${r*45}ms`:"none",opacity:n?.9:.25}},r)})}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] font-mono uppercase tracking-widest mt-1.5 px-2",children:[e.jsxs("span",{className:`font-bold flex items-center gap-1 ${a?"text-white/40":"text-[#64748b]"}`,children:[e.jsx(ee,{size:11,className:"text-primary"})," HD 320 KBPS"]}),e.jsx("span",{className:`font-bold ${n?"text-emerald-500 font-black":a?"text-white/40":"text-[#94a3b8]"}`,children:n?"● AUDIO ACTIVE":"PAUSED"})]})]})]}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-3 my-2 sm:my-4",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 sm:gap-6 md:gap-8",children:[e.jsx("button",{onClick:()=>o&&R(o.id),className:`w-13 h-13 sm:w-16 sm:h-16 rounded-full flex items-center justify-center border transition-all active:scale-90 curs
1or-pointer ${b?"bg-rose-600/30 border-rose-500 text-rose-500 shadow-lg shadow-rose-600/30":a?"bg-white/10 hover:bg-white/20 border-white/20 text-white/70 hover:text-white":"bg-[#ffffff] hover:bg-slate-100 border-slate-300 text-[#334155] shadow-md"}`,"aria-label":b?s("car.fav_remove","Retirer des favoris"):s("car.fav_add","Ajouter aux favoris"),title:b?s("car.fav_remove","Retirer des favoris"):s("car.fav_add","Ajouter aux favoris"),children:e.jsx(te,{size:26,fill:b?"currentColor":"none"})}),e.jsx("button",{onClick:p?I:S,className:`w-15 h-15 sm:w-18 sm:h-18 rounded-full border flex items-center justify-center active:scale-90 transition-all cursor-pointer ${a?"bg-white/10 hover:bg-white/20 border-white/25 text-white shadow-md":"bg-[#ffffff] hover:bg-slate-100 border-slate-300 text-[#0f172a] shadow-md"}`,"aria-label":s("car.prev","Station précédente"),title:s("car.prev","Station précédente"),children:e.jsx(ae,{size:34,fill:"currentColor",className:a?"text-white":"text-[#0f172a]"})}),e.jsxs("button",{onClick:P,className:`w-22 h-22 sm:w-26 sm:h-26 md:w-28 md:h-28 rounded-full bg-primary hover:bg-primary/90 text-white flex items-center justify-center shadow-2xl shadow-primary/60 border-4 active:scale-95 transition-all cursor-pointer relative group ${a?"border-white/30":"border-[#ffffff]"}`,"aria-label":n?s("car.pause","Pause"):s("car.play","Lecture"),title:n?s("car.pause","Pause"):s("car.play","Lecture"),children:[n&&e.jsx("span",{className:"absolute -inset-2 rounded-full border-2 border-primary/50 animate-ping opacity-50 pointer-events-none"}),n?e.jsx(se,{size:46,fill:"currentColor",className:"text-white"}):e.jsx(re,{size:46,fill:"currentColor",className:"ml-1 text-white"})]}),e.jsx("button",{onClick:p?S:I,className:`w-15 h-15 sm:w-18 sm:h-18 rounded-full border flex items-center justify-center active:scale-90 transition-all cursor-pointer ${a?"bg-white/10 hover:bg-white/20 border-white/25 text-white shadow-md":"bg-[#ffffff] hover:bg-slate-100 border-slate-300 text-[#0f172a] shadow-md"}`,"aria-label":s("car.next","Station suivante"),title:s("car.next","Station suivante"),children:e.jsx(ie,{size:34,fill:"currentColor",className:a?"text-white":"text-[#0f172a]"})}),e.jsx("button",{onClick:()=>k(l>0?0:.8),className:`w-13 h-13 sm:w-16 sm:h-16 rounded-full flex items-center justify-center border transition-all active:scale-90 cursor-pointer ${l===0?"bg-red-500/20 border-red-500 text-red-400 shadow-lg shadow-red-500/30":a?"bg-white/10 hover:bg-white/20 border-white/20 text-white/80":"bg-[#ffffff] hover:bg-slate-100 border-slate-300 text-[#0f172a] shadow-md"}`,"aria-label":l===0?s("car.unmute","Activer le son"):s("car.mute","Couper le son"),title:l===0?s("car.unmute","Activer le son"):s("car.mute","Couper le son"),children:l===0?e.jsx(ne,{size:26,className:a?"text-red-400":"text-red-500"}):l<.5?e.jsx(le,{size:26,className:a?"text-white":"text-[#0f172a]"}):e.jsx(oe,{size:26,className:a?"text-white":"text-[#0f172a]"})})]}),e.jsxs("div",{className:`flex items-center gap-3 px-4 py-1.5 rounded-full border transition-all ${a?"bg-white/5 border-white/10 text-white/80":"bg-[#ffffff] border-slate-300 text-[#0f172a] shadow-sm"}`,children:[e.jsx("button",{onClick:()=>M(-.1),disabled:l<=0,className:`w-8 h-8 rounded-full flex items-center justify-center hover:bg-primary/20 active:scale-90 transition-all disabled:opacity-30 cursor-pointer ${a?"text-white":"text-[#0f172a]"}`,"aria-label":s("car.vol_down","Diminuer le volume"),children:e.jsx(ce,{size:16})}),e.jsxs("span",{className:`text-xs font-mono font-black tracking-wider min-w-[42px] text-center ${a?"text-white":"text-[#0f172a]"}`,children:[Math.round(l*100),"%"]}),e.jsx("button",{onClick:()=>M(.1),disabled:l>=1,className:`w-8 h-8 rounded-full flex items-center justify-center hover:bg-primary/20 active:scale-90 transition-all disabled:opacity-30 cursor-pointer ${a?"text-white":"text-[#0f172a]"}`,"aria-label":s("car.vol_up","Augmenter le volume"),children:e.jsx(de,{size:16})})]})]}),e.jsxs("div",{className:`relative z-10 pt-3 sm:pt-4 border-t transition-colors ${a?"border-white/10":"border-slate-300/80"}`,children:[e.jsx("p",{className:`text-[11px] sm:text-xs uppercase font-black tracking-widest mb-2.5 text-center ${a?"text-white/50":"text-[#64748b]"}
1`,children:s("car.quick_access","Accès rapide • 1 Touche")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-3 max-w-4xl mx-auto w-full",children:q.map(t=>{const r=o.id===t.id;return e.jsxs("button",{onClick:()=>j(t),className:`flex items-center gap-2.5 sm:gap-3 p-2.5 sm:p-3 rounded-2xl border transition-all active:scale-95 cursor-pointer ${r?"bg-primary text-white border-primary shadow-lg shadow-primary/40 font-black":a?"bg-white/5 hover:bg-white/15 text-white/90 border-white/10 font-bold":"bg-[#ffffff] hover:bg-slate-50 text-[#0f172a] border-slate-300 shadow-sm font-bold"}`,style:{textAlign:p?"right":"left"},children:[e.jsx("img",{src:t.logoUrl,alt:"",className:`w-9 h-9 sm:w-11 sm:h-11 rounded-xl object-contain p-1 shrink-0 ${r?"bg-white/20":a?"bg-white/10":"bg-slate-100"}`}),e.jsxs("div",{className:"flex flex-col truncate min-w-0",children:[e.jsx("span",{className:`truncate text-xs sm:text-sm font-black leading-tight ${r||a?"text-white":"text-[#0f172a]"}`,children:t.name}),e.jsx("span",{className:`text-[10px] font-semibold truncate ${r?"text-white/80":a?"text-white/50":"text-[#64748b]"}`,children:t.frequency||t.category})]})]},t.id)})})]})]})}export{Ne as CarMode};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.