{"version":3,"file":"TradingContactOveride.CMWxswUd.mjs","names":[],"sources":["https:/framerusercontent.com/modules/egaHdd3maPJ6NowMCsaD/hUAzhwWHTf0opAmFqGA6/TradingContactOveride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";/**\n * Trading Deal Template Page → Contact form preshot.\n *\n * Applied on the \"Contact\" CTA inside a trading deal CMS template page.\n * At click time, reads the Serial Number from the element with id=\"serial-number\"\n * (that element is a plain CMS text on the template page).\n *\n * Redirects to /contact with:\n *   - dept = other-topics\n *   - topic = Aircraft Trading\n *   - serialNumber = [scanned from DOM]\n *\n * The contact page's JetflyContactForm matches this serial against its\n * dealsCollection prop to retrieve manufacturer, model, and cover photo.\n */function extractSerialFromDOM(){if(typeof document===\"undefined\")return\"\";const el=document.getElementById(\"serial-number\");if(!el)return\"\";// The element may contain a label like \"Serial Number: 1234-ABC\"\n// OR just the raw value \"1234-ABC\". Strip the label if present.\nconst raw=(el.textContent||\"\").trim();const stripped=raw.replace(/^\\s*(serial\\s*number|s\\/n|sn)\\s*[:\\-]?\\s*/i,\"\");return stripped.trim();}/* 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. `/fr/aircraft-trading/...`).\n   The default locale (English) has no prefix. We match a short lowercase\n   slug at the start of the path; anything that doesn't look like a 2-5\n   character locale code is ignored so we don't accidentally strip\n   `/aircraft-trading/...` 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 withTradingContactLink(Component){return props=>{const handleClick=e=>{const link=e.target.closest(\"a\");if(!link||!link.href||!link.href.includes(\"/contact\"))return;const serialNumber=extractSerialFromDOM();const params=new URLSearchParams;params.set(\"dept\",\"other-topics\");params.set(\"topic\",\"Aircraft Trading\");if(serialNumber)params.set(\"serialNumber\",serialNumber);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\":{\"withTradingContactLink\":{\"type\":\"reactHoc\",\"name\":\"withTradingContactLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TradingContactOveride.map"],"mappings":"kHAcG,SAAS,GAAsB,CAAC,GAAG,OAAO,SAAW,IAAY,MAAM,GAAG,IAAM,EAAG,SAAS,eAAe,gBAAgB,CAEZ,OAFiB,GAExH,EAAG,aAAa,IAAI,MAAM,CAAoB,QAAQ,6CAA6C,GAAG,CAAiB,MAAM,CAFI,GAQvF,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,EAAuB,EAAU,CAAC,MAAO,IAA8e,EAAK,MAAM,CAAC,eAAhe,GAAG,CAAC,IAAM,EAAK,EAAE,OAAO,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAM,CAAC,EAAK,MAAM,CAAC,EAAK,KAAK,SAAS,WAAW,CAAC,OAAO,IAAM,EAAa,GAAsB,CAAO,EAAO,IAAI,gBAAgB,EAAO,IAAI,OAAO,eAAe,CAAC,EAAO,IAAI,QAAQ,mBAAmB,CAAI,GAAa,EAAO,IAAI,eAAe,EAAa,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,sBAtBr1B"}