{"version":3,"file":"ContactFormSelect.BOix5Az5.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/bpqPKTLP51Z0qMf7nmC6/zgTbgbjx2aBYRSiqXeZ6/ContactFormSelect.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";export function SelectServiceFromURL(){useEffect(()=>{const params=new URLSearchParams(window.location.search);const rawParam=params.get(\"services\")||params.get(\"service\");if(!rawParam)return;const serviceParam=rawParam.trim().toLowerCase();if(!serviceParam)return;/* -----------------------------\n           Slug → English label\n        ------------------------------ */const serviceMapEN={\"private-office\":\"Private Offices\",\"virtual-office\":\"Virtual Offices\",\"enterprise-solution\":\"Enterprise Solutions\",\"meeting-rooms\":\"Meeting/Conference Rooms\",\"meeting-room\":\"Meeting/Conference Rooms\",\"event-spaces\":\"Event Spaces\",\"event-space\":\"Event Spaces\",\"business-setup\":\"Business Setup\",\"business-setup-visa\":\"Business Setup & Visa Application Service\",coworking:\"Coworking Spaces\"};/* -----------------------------\n           English label → Arabic label\n        ------------------------------ */const serviceMapAR={\"Private Offices\":\"المكاتب الخاصة\",\"Virtual Offices\":\"المكاتب الافتراضية\",\"Enterprise Solutions\":\"خدمات المؤسسات\",\"Meeting/Conference Rooms\":\"غرف الاجتماعات/المؤتمرات\",\"Event Spaces\":\"قاعات الفعاليات\",\"Business Setup\":\"تأسيس شركة\",\"Business Setup & Visa Application Service\":\"خدمة تأسيس الشركات وتقديم طلبات التأشيرة\",\"Coworking Spaces\":\"مساحات العمل المشتركة\"};const isArabicPage=document.documentElement.lang===\"ar\"||window.location.pathname.startsWith(\"/ar\");const normalize=val=>val.trim().toLowerCase().replace(/\\s+/g,\" \");/* -----------------------------\n           Core selection logic\n        ------------------------------ */const trySelect=select=>{let optionToSelect;const enLabel=serviceMapEN[serviceParam];const arLabel=enLabel?serviceMapAR[enLabel]:null;const options=Array.from(select.options);/* 1️⃣ Match by LABEL (EN / AR) — most reliable in Framer */if(enLabel){optionToSelect=options.find(opt=>normalize(opt.text)===normalize(enLabel)||isArabicPage&&arLabel&&normalize(opt.text)===normalize(arLabel));}/* 2️⃣ Match by VALUE (fallback only) */if(!optionToSelect){optionToSelect=options.find(opt=>normalize(opt.value)===serviceParam);}/* 3️⃣ Direct text match */if(!optionToSelect){optionToSelect=options.find(opt=>normalize(opt.text)===normalize(serviceParam));}/* 4️⃣ Apply selection using INDEX (Framer-safe) */if(optionToSelect){select.selectedIndex=options.indexOf(optionToSelect);}else{// Always fall back to FIRST option, never last\nselect.selectedIndex=0;}/* 🔔 Force Framer to sync UI + internal state */select.dispatchEvent(new Event(\"input\",{bubbles:true}));select.dispatchEvent(new Event(\"change\",{bubbles:true}));};/* -----------------------------\n           Wait for Framer to mount select\n        ------------------------------ */const observer=new MutationObserver(()=>{const select=document.querySelector('select[name=\"Service\"]');if(select&&select.options.length>0){trySelect(select);// Extra safety: Framer sometimes re-renders\nrequestAnimationFrame(()=>trySelect(select));observer.disconnect();}});observer.observe(document.body,{childList:true,subtree:true});return()=>observer.disconnect();},[]);return{};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withSelectServiceFromURL(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...SelectServiceFromURL(props)});};}withSelectServiceFromURL.displayName=\"SelectServiceFromURL\";\nexport const __FramerMetadata__ = {\"exports\":{\"SelectServiceFromURL\":{\"type\":\"override\",\"name\":\"SelectServiceFromURL\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSelectServiceFromURL\":{\"type\":\"reactHoc\",\"name\":\"withSelectServiceFromURL\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ContactFormSelect.map"],"mappings":"yLAAwE,SAAgB,GAAsB,CAU6D,OAV5D,MAAc,CAAC,IAAM,E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