{"version":3,"file":"TrainingCenterOverride.M1ZqgakR.mjs","names":[],"sources":["https:/framerusercontent.com/modules/oDFwNpHmQwcEdLmMlOPM/Z9yJZMFjazQQPdGNE7UQ/TrainingCenterOverride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";/**\n * Training Centre / Course Template Page → Contact form preshot.\n *\n * SETUP\n *   - Course CMS template page: pick the Text element bound to the CMS\n *     Title field and, in its right-panel attributes, set ID = \"course-title\".\n *     Apply this override on the Contact CTA button.\n *   - Training Centre landing page: same override on the CTA, no id needed.\n *     URL will arrive without courseName and the dropdown stays empty.\n */function extractCourseTitleFromDOM(){if(typeof document===\"undefined\")return\"\";// Strict: only explicit IDs. No generic fallbacks like #title or <h1>\n// because those exist on non-course pages too and would inject the\n// wrong value (e.g. the landing page's \"Training Centre\" heading).\nconst ids=[\"course-title\",\"course-name\"];for(const id of ids){const el=document.getElementById(id);if(el){const raw=(el.textContent||\"\").trim();return raw.replace(/^\\s*(course\\s*title|course\\s*name)\\s*[:\\-]?\\s*/i,\"\").trim();}}return\"\";}/* Detect the current locale prefix from the URL so we redirect to the\n   same-language contact page. Framer Localization uses a leading\n   `/{code}/...` segment for non-default locales (e.g.\n   `/fr/training-centre/...`). The default locale (English) has no prefix.\n   We match a short lowercase slug at the start of the path; anything\n   that doesn't look like a 2-5 character locale code is ignored so we\n   don't accidentally strip `/training-centre/...` as if it were a locale. */function getLocalePrefix(){if(typeof window===\"undefined\")return\"\";const seg=window.location.pathname.split(\"/\")[1]||\"\";return/^[a-z]{2}(-[a-z]{2})?$/i.test(seg)?`/${seg}`:\"\";}export function withTrainingCentreContactLink(Component){return props=>{const handleClick=e=>{const link=e.target.closest(\"a\");if(!link||!link.href||!link.href.includes(\"/contact\"))return;const courseName=extractCourseTitleFromDOM();const params=new URLSearchParams;params.set(\"dept\",\"other-topics\");params.set(\"topic\",\"Training Centre\");if(courseName)params.set(\"courseName\",courseName);const href=`${getLocalePrefix()}/contact?${params.toString()}#connect-with-us`;e.preventDefault();e.stopPropagation();window.location.href=href;};return /*#__PURE__*/_jsx(\"div\",{onClickCapture:handleClick,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTrainingCentreContactLink\":{\"type\":\"reactHoc\",\"name\":\"withTrainingCentreContactLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrainingCenterOverride.map"],"mappings":"kHASG,SAAS,GAA2B,CAAC,GAAG,OAAO,SAAW,IAAY,MAAM,GAGtC,IAAI,IAAM,IAAzC,CAAC,eAAe,cAAc,CAAqB,CAAC,IAAM,EAAG,SAAS,eAAe,EAAG,CAAC,GAAG,EAA0C,OAA3B,EAAG,aAAa,IAAI,MAAM,CAAY,QAAQ,kDAAkD,GAAG,CAAC,MAAM,CAAG,MAAM,GAM3J,SAAS,GAAiB,CAAC,GAAU,IAAS,OAAY,MAAM,GAAG,IAAM,EAAI,EAAO,SAAS,SAAS,MAAM,IAAI,CAAC,IAAI,GAAG,MAAM,0BAA0B,KAAK,EAAI,CAAC,IAAI,IAAM,GAAI,SAAgB,EAA8B,EAAU,CAAC,MAAO,IAA0e,EAAK,MAAM,CAAC,eAA5d,GAAG,CAAC,IAAM,EAAK,EAAE,OAAO,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAM,CAAC,EAAK,MAAM,CAAC,EAAK,KAAK,SAAS,WAAW,CAAC,OAAO,IAAM,EAAW,GAA2B,CAAO,EAAO,IAAI,gBAAgB,EAAO,IAAI,OAAO,eAAe,CAAC,EAAO,IAAI,QAAQ,kBAAkB,CAAI,GAAW,EAAO,IAAI,aAAa,EAAW,CAAC,IAAM,EAAK,GAAG,GAAiB,CAAC,WAAW,EAAO,UAAU,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,EAAO,SAAS,KAAK,GAAkE,MAAM,CAAC,QAAQ,WAAW,CAAC,SAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAC,CAAC,sBAlBh3B"}