{"version":3,"file":"WebUIHeader.CurKIhYV.mjs","names":["languages","NavConfigProvider","UserConsentProvider","AnalyticsProvider","LoadAuthClient","IdentifyAndTrackPageView","SearchModalProvider","UserWorkspacesProvider","Header","Logout","SearchModal"],"sources":["https:/framerusercontent.com/modules/x0uPZJlADgSt5DQqBvzw/CGDV1ZzBsc98vfnPxcWd/WebUIHeader.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{Header,languages,AnalyticsProvider,IdentifyAndTrackPageView,LoadAuthClient,ShowLoginModal,ShowRegisterModal,Logout,SearchModalProvider,SearchModal,UserWorkspacesProvider,UserConsentProvider,NavConfigProvider}from\"https://framerusercontent.com/modules/2ZHvBtRmbXndSJHN8Pby/Wa8iujHj3URcVnyU80gG/Components.js\";import{amplitudeApiKey,amplitudeWorkflowApiKey,analyticsEnabled,authLoginUrl,authUrl,baseUrl,gqlGatewayUrl,jitsuApiKey,jitsuEndpoint,workflowUrl}from\"https://framerusercontent.com/modules/reJAHDcqdBR6JUT35NJ6/0RZUeAq5VtTxEN8G6tcf/Const.js\";const analyticsConfig={jitsuEndpoint:jitsuEndpoint,amplitudeApiKey:amplitudeApiKey,amplitudeWorkflowApiKey:amplitudeWorkflowApiKey,jitsuApiKey:jitsuApiKey,isEnabled:analyticsEnabled===\"true\",isDevelopment:false};function handleLocaleChange(locale){try{const urlObj=new URL(window.location.href);let pathname=urlObj.pathname;// Find the selected language object\nconst selectedLang=languages.find(lang=>lang.locale===locale);if(!selectedLang){console.error(`Locale \"${locale}\" not found in languages list.`);return;// Exit if locale is not supported\n}// Remove any existing locale prefix from the pathname\nlet cleanedPathname=pathname;for(const lang of languages){if(lang.urlPrefix&&pathname.startsWith(`/${lang.urlPrefix}/`)){cleanedPathname=pathname.substring(lang.urlPrefix.length+1);break;}}// Construct the new URL with the appropriate locale prefix\nif(selectedLang.urlPrefix){urlObj.pathname=`/${selectedLang.urlPrefix}${cleanedPathname}`;}else{// For the default language (e.g., 'en-US'), remove the prefix\nurlObj.pathname=cleanedPathname;}// Redirect to the new URL\nwindow.location.href=urlObj.toString();}catch(err){console.error(\"Error handling locale change:\",err);}}function detectLocaleFromUrl(){try{const urlObj=new URL(window.location.href);const pathname=urlObj.pathname;// Iterate through the languages to find a matching prefix\nfor(const lang of languages){// Check if there's a urlPrefix defined for the language\nif(lang.urlPrefix){// Construct the expected prefix pattern, e.g., \"/es/\" or \"/fr/\"\nconst prefixPattern=`/${lang.urlPrefix}/`;// Check if the pathname starts with the prefix or is just the prefix (e.g., \"/es\")\nif(pathname.startsWith(prefixPattern)||pathname===`/${lang.urlPrefix}`){return lang.locale;}}}// If no matching prefix is found, return the default locale (en-US)\n// Assuming en-US is always the default and has urlPrefix: null\nconst defaultLang=languages.find(lang=>lang.urlPrefix===null);return defaultLang?defaultLang.locale:\"en-US\"// Fallback to 'en-US' if no default found in array\n;}catch(err){console.error(\"Error detecting locale from URL:\",err);return\"en-US\"// Fallback in case of any error\n;}}export default function WebUIHeader(props){if(window&&window.location.host.includes(\"framercanvas.com\")){return /*#__PURE__*/_jsx(\"div\",{style:{height:\"64px\",width:\"100%\",backgroundColor:\"gray\",color:\"white\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:\"Header placeholder\"});}return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:/*#__PURE__*/_jsx(NavConfigProvider,{apiUrl:\"/api/v1/nav-config\",children:/*#__PURE__*/_jsx(UserConsentProvider,{children:/*#__PURE__*/_jsxs(AnalyticsProvider,{config:analyticsConfig,children:[typeof window!==\"undefined\"&&/*#__PURE__*/_jsx(LoadAuthClient,{}),/*#__PURE__*/_jsx(IdentifyAndTrackPageView,{authUrl:authUrl}),/*#__PURE__*/_jsxs(SearchModalProvider,{children:[/*#__PURE__*/_jsx(UserWorkspacesProvider,{authUrl:authUrl,gqlGatewayUrl:gqlGatewayUrl,children:/*#__PURE__*/_jsx(Header,{authUrl:authUrl,appUrl:baseUrl,workflowUrl:workflowUrl,authLoginUrl:authLoginUrl,gqlGatewayUrl:gqlGatewayUrl,onLocaleChange:handleLocaleChange,locale:detectLocaleFromUrl(),openLoginModal:()=>{ShowLoginModal({returnToUrl:`${workflowUrl}?utm_medium=web&utm_source=login-main-nav`});},openRegisterModal:()=>{ShowRegisterModal({returnToUrl:`${workflowUrl}?utm_medium=web&utm_source=register-main-nav`});},onLogout:Logout,features:[{name:\"enable-topnav-state-machines\",enabled:true}]})}),/*#__PURE__*/_jsx(SearchModal,{locale:detectLocaleFromUrl(),appUrl:baseUrl,isReverseImageSearchEnabled:false})]})]})})})});}const containerStyle={width:\"100%\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WebUIHeader\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"8UAAwzB,SAAS,EAAmB,EAAO,CAAC,GAAG,CAAC,IAAM,EAAO,IAAI,IAAI,EAAO,SAAS,IAAI,EAAM,EAAS,EAAO,SACz5B,EAAaA,EAAU,KAAK,GAAM,EAAK,SAAS,CAAM,EAAE,GAAG,CAAC,EAAa,CAAC,QAAQ,MAAM,WAAW,EAAO,+BAA+B,EAAE,MACjJ,CACA,IAAI,EAAgB,EAAS,IAAI,IAAM,KAAQA,EAAW,GAAG,EAAK,WAAW,EAAS,WAAW,IAAI,EAAK,UAAU,EAAE,EAAE,CAAC,EAAgB,EAAS,UAAU,EAAK,UAAU,OAAO,CAAC,EAAE,KAAM,CACxL,EAAa,UAAW,EAAO,SAAS,IAAI,EAAa,YAAY,IACxE,EAAO,SAAS,EAChB,EAAO,SAAS,KAAK,EAAO,SAAS,CAAE,OAAO,EAAI,CAAC,QAAQ,MAAM,gCAAgC,CAAG,CAAE,CAAC,CAAC,SAAS,GAAqB,CAAC,GAAG,CAA4C,IAAM,EAAS,IAAzC,IAAI,EAAO,SAAS,IAA0B,CAAC,CAAC,SAC5M,IAAI,IAAM,KAA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