const i18n={ar:{dir:’rtl’,liveBadge:’● مباشر’,opsBadge:’غرفة عمليات مرورية’,coverageBadge:’تغطية: جميع محافظات الكويت’,title:’منصة الكويت الذكية لمراقبة المرور والحوادث’,subtitle:’لوحة عمليات حية مخصصة لمتابعة التدفق المروري، الحوادث، الاختناقات، البلاغات الجماهيرية، الكاميرات، والاستجابة الميدانية الفورية مع تنبيه السائقين مباشرة.’,searchPlaceholder:’ابحث عن طريق، منطقة، حادث، أو مخرج…’,filterBtn:’فلترة’,exportBtn:’تصدير’,allKuwait:’كل الكويت’,rushHour:’ذروة’,accidentsOnly:’الحوادث فقط’,camerasOnly:’الكاميرات’,statFlow:’تدفق المرور’,statFlowNote:’+6% مقارنة بآخر ساعة’,statIncidents:’الحوادث النشطة’,statIncidentsNote:’5 حالات عالية الأولوية’,statUnits:’الوحدات الميدانية’,statUnitsNote:’21 وحدة متحركة الآن’,statAlerts:’التنبيهات المرسلة’,statAlertsNote:’خلال اليوم الحالي’,mapTitle:’الخريطة الحية’,mapDesc:’عرض لحظي لمواضع الحوادث والاختناقات والدوريات والكاميرات ومناطق التحذير الذكي.’,marker1:’حادث متوسط – السادس’,marker2:’ازدحام شديد – الغزالي’,marker3:’دورية قريبة – الفروانية’,marker4:’كاميرا نشطة – الفحيحيل’,warningTitle:’تنبيه السائقين’,warningDesc:’إرسال تنبيهات فورية للمستخدمين داخل نطاق الخطر حسب الموقع الجغرافي ونوع الحالة والاتجاه المروري.’,sendAlert:’إرسال تنبيه’,openCase:’فتح حالة’,quickActions:’إجراءات سريعة’,quickActionsDesc:’أوامر تشغيل فورية للغرفة.’,dispatchPatrol:’إرسال دورية’,activateSiren:’تفعيل إنذار’,sendPublicAlert:’تنبيه الجمهور’,callEmergency:’اتصال طوارئ’,alertsTitle:’التنبيهات الحية’,alertsDesc:’آخر الإشعارات المرسلة من مركز العمليات.’,tabOverview:’نظرة عامة’,tabEvents:’الأحداث النشطة’,tabCameras:’الكاميرات والمجسات’,tabAnalytics:’التحليلات’,roomOverview:’ملخص غرفة العمليات’,avgResponse:’متوسط الاستجابة’,verifiedReports:’بلاغات موثقة’,riskLevel:’مستوى الخطر العام’,riskMedium:’متوسط’,modulesTitle:’الوحدات الأساسية المقترحة’,module1:’رصد حي من الكاميرات وGPS وبلاغات المستخدمين.’,module2:’تصنيف ذكي للحوادث والاختناقات حسب الأولوية والخطورة.’,module3:’واجهة ثنائية اللغة عربية/إنجليزية مع تحويل فوري.’,module4:’تنبيهات فورية عبر التطبيق والرسائل ولوحات الطرق الذكية.’,module5:’تتبع زمني لكل حالة من البلاغ حتى الإغلاق.’,module6:’تحليلات يومية وأسبوعية لمناطق الاختناق وتكرار الحوادث.’,camsTitle:’الكاميرات’,zonesTitle:’مؤشر المناطق’,footerNote:’هذه نسخة تشغيلية أولية لواجهة المنصة. يمكن ربطها لاحقاً بخرائط حية، كاميرات، واجهات برمجة تطبيقات، إشعارات دفع، ولوحة تحكم مركزية خاصة بوزارة الداخلية أو الإدارة العامة للمرور.’},en:{dir:’ltr’,liveBadge:’● LIVE’,opsBadge:’Traffic Operations Room’,coverageBadge:’Coverage: All Kuwait Governorates’,title:’Kuwait Smart Traffic & Accident Monitoring Platform’,subtitle:’A live operational dashboard for tracking traffic flow, incidents, congestion, public reports, cameras, and field response while alerting drivers in real time.’,searchPlaceholder:’Search road, district, incident, or exit…’,filterBtn:’Filter’,exportBtn:’Export’,allKuwait:’All Kuwait’,rushHour:’Rush Hour’,accidentsOnly:’Accidents Only’,camerasOnly:’Cameras’,statFlow:’Traffic Flow’,statFlowNote:’+6% vs last hour’,statIncidents:’Active Incidents’,statIncidentsNote:’5 high-priority cases’,statUnits:’Field Units’,statUnitsNote:’21 currently moving’,statAlerts:’Alerts Sent’,statAlertsNote:’during the current day’,mapTitle:’Live Map’,mapDesc:’Live display of incidents, congestion, patrols, cameras, and smart warning zones.’,marker1:’Moderate accident – 6th Ring’,marker2:’Heavy congestion – Ghazali’,marker3:’Patrol nearby – Farwaniya’,marker4:’Active camera – Fahaheel’,warningTitle:’Driver Warning’,warningDesc:’Instant alerts to users within the danger radius based on location, case type, and traffic direction.’,sendAlert:’Send Alert’,openCase:’Open Case’,quickActions:’Quick Actions’,quickActionsDesc:’Immediate operational commands.’,dispatchPatrol:’Dispatch Patrol’,activateSiren:’Activate Alarm’,sendPublicAlert:’Public Alert’,callEmergency:’Emergency Call’,alertsTitle:’Live Alerts’,alertsDesc:’Latest notifications issued by the operations center.’,tabOverview:’Overview’,tabEvents:’Active Events’,tabCameras:’Cameras & Sensors’,tabAnalytics:’Analytics’,roomOverview:’Operations Room Summary’,avgResponse:’Average Response’,verifiedReports:’Verified Reports’,riskLevel:’Public Risk Level’,riskMedium:’Medium’,modulesTitle:’Recommended Core Modules’,module1:’Live ingestion from cameras, GPS, and crowd reports.’,module2:’Smart prioritization of incidents and bottlenecks by urgency.’,module3:’Instant Arabic/English switching control interface.’,module4:’Instant alerts through app, SMS, and smart road signage.’,module5:’Timestamped lifecycle tracking from report to closure.’,module6:’Daily and weekly analytics for repeated congestion and incidents.’,camsTitle:’Cameras’,zonesTitle:’Zone Index’,footerNote:’This is an initial operational interface prototype. It can later be connected to live maps, cameras, APIs, push notifications, and a central command dashboard for traffic authorities.’}};
const alerts={ar:[{title:’تنبيه فوري’,text:’ازدحام مرتفع على طريق الغزالي. المسار البديل المقترح: جمال عبدالناصر.’},{title:’سلامة الطريق’,text:’حادث قرب المخرج 208، تم إرسال تنبيه للسائقين ضمن نصف قطر 5 كم.’},{title:’غرفة العمليات’,text:’3 بلاغات جديدة قيد التحقق و2 دوريات تتحرك حالياً نحو المواقع.’}],en:[{title:’Urgent Alert’,text:’Heavy congestion on Ghazali Road. Suggested alternate route: Jamal Abdulnasser.’},{title:’Road Safety’,text:’Accident near Exit 208. Drivers within a 5 km radius were alerted.’},{title:’Operations Room’,text:’3 new reports are under verification and 2 patrols are moving to the sites.’}]};
const events={ar:[{id:’EV-1042′,zone:’الدائري السادس – باتجاه الجهراء’,type:’حادث متوسط’,note:’وصول الدورية خلال 4 دقائق’,tone:’danger’,time:’09:42′},{id:’EV-1043′,zone:’طريق الملك فهد – قرب صبحان’,type:’ازدحام شديد’,note:’تحويل مروري مقترح’,tone:’warn’,time:’09:45′},{id:’EV-1044′,zone:’الدائري الأول – مدينة الكويت’,type:’مركبة متعطلة’,note:’الرافعة في الطريق’,tone:’success’,time:’09:47′}],en:[{id:’EV-1042′,zone:’6th Ring Road – Jahra Direction’,type:’Moderate Accident’,note:’Patrol ETA 4 mins’,tone:’danger’,time:’09:42′},{id:’EV-1043′,zone:’King Fahd Road – Near Subhan’,type:’Heavy Congestion’,note:’Diversion suggested’,tone:’warn’,time:’09:45′},{id:’EV-1044′,zone:’1st Ring Road – Kuwait City’,type:’Disabled Vehicle’,note:’Tow truck en route’,tone:’success’,time:’09:47′}]};
const cameras={ar:[{name:’كاميرا – الدائري الخامس’,status:’Online’},{name:’كاميرا – طريق الفحيحيل’,status:’Online’},{name:’كاميرا – طريق الجهراء’,status:’Warning’},{name:’كاميرا – الشويخ الصناعية’,status:’Offline’}],en:[{name:’Camera – 5th Ring Road’,status:’Online’},{name:’Camera – Fahaheel Road’,status:’Online’},{name:’Camera – Jahra Road’,status:’Warning’},{name:’Camera – Shuwaikh Industrial’,status:’Offline’}]};
const zones={ar:[{name:’مدينة الكويت’,flow:78},{name:’حولي’,flow:61},{name:’الفروانية’,flow:84},{name:’الجهراء’,flow:49},{name:’الأحمدي’,flow:66},{name:’مبارك الكبير’,flow:57}],en:[{name:’Kuwait City’,flow:78},{name:’Hawalli’,flow:61},{name:’Farwaniya’,flow:84},{name:’Jahra’,flow:49},{name:’Ahmadi’,flow:66},{name:’Mubarak Al-Kabeer’,flow:57}]};
const analytics={ar:[{title:’نسبة الحوادث المرتبطة بالازدحام’,value:’62%’},{title:’الإنذارات المرسلة خلال آخر ساعة’,value:’4,280′},{title:’أكثر منطقة تكراراً اليوم’,value:’الفروانية’}],en:[{title:’Incidents linked to congestion’,value:’62%’},{title:’Alerts sent in the last hour’,value:’4,280′},{title:’Most repeated hotspot today’,value:’Farwaniya’}]};
let currentLang=’ar’;
function applyLanguage(lang){currentLang=lang;document.documentElement.lang=lang;document.documentElement.dir=i18n[lang].dir;document.querySelectorAll(‘[data-i18n]’).forEach(el=>{const key=el.dataset.i18n;if(i18n[lang][key])el.textContent=i18n[lang][key];});document.querySelectorAll(‘[data-i18n-placeholder]’).forEach(el=>{const key=el.dataset.i18nPlaceholder;if(i18n[lang][key])el.placeholder=i18n[lang][key];});renderAlerts();renderEvents();renderCameras();renderZones();renderAnalytics();document.getElementById(‘langAr’).classList.toggle(‘accent’,lang===’ar’);document.getElementById(‘langEn’).classList.toggle(‘accent’,lang===’en’);}
function renderAlerts(){document.getElementById(‘alertsList’).innerHTML=alerts[currentLang].map(item=>`
${item.title}
${item.text}
`).join(”);}
function renderEvents(){document.getElementById(‘eventsList’).innerHTML=events[currentLang].map(item=>`
${item.id}
${item.zone}
${item.type}
${item.time}
${item.note}
`).join(”);}
function renderCameras(){document.getElementById(‘camerasList’).innerHTML=cameras[currentLang].map(item=>`
${item.name}
Video + sensor feed
${item.status}
`).join(”);}
function renderZones(){document.getElementById(‘zonesList’).innerHTML=zones[currentLang].map(item=>`
${item.name}${item.flow}%
`).join(”);}
function renderAnalytics(){document.getElementById(‘analyticsCards’).innerHTML=analytics[currentLang].map(item=>`