{"version":3,"file":"SetelHeader.B_GqmCe6.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/LuKCrx1LZheNlsvrmyTr/0qyGwHyRm2afugEliUrw/SetelHeader.js"],"sourcesContent":["// Track this code on web-app: https://github.com/setel-engineering/web-app/tree/develop/framer/SetelHeader.tsx\n// On Framer:\n// - Go to Assets, add this as a Code component.\n// - Add the Code component to top of a page.\n// - On the page, select the added component Style, set Type to \"Fixed\", Size Width to \"100%\" with \"Rel\", and Height to \"72px\" with \"Fixed\".\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";// Framer supports React 18 as of June 2026.\nconst SCRIPT_SRC=\"/assets/widgets.js\"// Load from setel.com\n;// Framer's router unmounts this component and mounts a fresh one on every client-side navigation.\n// To solve that, have the host created once at module scope and re-parent it on each mount.\n// A shadow root travels with its host,\n// so re-parenting keeps the already-rendered header, includiong React state, session and listeners intact.\nlet headerHost;function getHeaderHost(){if(!headerHost){headerHost=document.createElement(\"div\");headerHost.setAttribute(\"data-elementor-type\",\"header\");const slot=document.createElement(\"div\");slot.setAttribute(\"data-setel-widget\",\"header\");headerHost.appendChild(slot);}return headerHost;}let widgetsScript;function loadWidgets(){if(widgetsScript)return widgetsScript;widgetsScript=new Promise(resolve=>{const existing=document.querySelector(`script[src=\"${SCRIPT_SRC}\"]`);if(existing){if(existing.dataset.loaded)return resolve();existing.addEventListener(\"load\",()=>resolve(),{once:true});existing.addEventListener(\"error\",()=>resolve(),{once:true});return;}const script=document.createElement(\"script\");script.src=SCRIPT_SRC;script.async=true;script.addEventListener(\"load\",()=>{script.dataset.loaded=\"true\";resolve();},{once:true});script.addEventListener(\"error\",()=>resolve(),{once:true});document.body.appendChild(script);});return widgetsScript;}export default function SetelHeaderWidget(){const mountRef=useRef(null);const[ready,setReady]=useState(false);useEffect(()=>{let cancelled=false;// appendChild moves the host out of whichever page previously held it,\n// so during a transition the last page to mount wins.\n// Nothing is done on unmount: the host stays as a detached node until the next mount claims it.\nmountRef.current?.appendChild(getHeaderHost());loadWidgets().then(()=>{if(!cancelled)setReady(true);});return()=>{cancelled=true;};},[]);return /*#__PURE__*/_jsx(\"div\",{ref:mountRef,\"aria-busy\":!ready,style:{width:\"100%\",height:\"100%\"}});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SetelHeaderWidget\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SetelHeader.map"],"mappings":"gIAWe,SAAS,GAAe,CAAC,GAAG,CAAC,EAAW,CAAC,EAAW,SAAS,cAAc,KAAK,EAAE,EAAW,aAAa,sBAAsB,QAAQ,EAAE,IAAM,EAAK,SAAS,cAAc,KAAK,EAAE,EAAK,aAAa,oBAAoB,QAAQ,EAAE,EAAW,YAAY,CAAI,CAAE,CAAC,OAAO,CAAW,CAAmB,SAAS,GAAa,CAA0lB,OAAtlB,IAAmC,EAAc,IAAI,QAAQ,GAAS,CAAC,IAAM,EAAS,SAAS,cAAc,eAAe,EAAW,GAAG,EAAE,GAAG,EAAS,CAAC,GAAG,EAAS,QAAQ,OAAO,OAAO,EAAQ,EAAE,EAAS,iBAAiB,WAAW,EAAQ,EAAE,CAAC,KAAK,EAAI,CAAC,EAAE,EAAS,iBAAiB,YAAY,EAAQ,EAAE,CAAC,KAAK,EAAI,CAAC,EAAE,MAAO,CAAC,IAAM,EAAO,SAAS,cAAc,QAAQ,EAAE,EAAO,IAAI,EAAW,EAAO,MAAM,GAAK,EAAO,iBAAiB,WAAW,CAAC,EAAO,QAAQ,OAAO,OAAO,EAAQ,CAAE,EAAE,CAAC,KAAK,EAAI,CAAC,EAAE,EAAO,iBAAiB,YAAY,EAAQ,EAAE,CAAC,KAAK,EAAI,CAAC,EAAE,SAAS,KAAK,YAAY,CAAM,CAAE,CAAC,EAAS,EAAc,CAAC,SAAwB,GAAmB,CAAC,IAAM,EAASA,E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