{"version":3,"file":"LanguageToggle.BnoQFbNL.mjs","names":["React.useState","React.Fragment"],"sources":["https:/framerusercontent.com/modules/xRZ6lnarOfknMEcfbUko/FDmAMsBM29QNXlNfnxGr/LanguageToggle.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useLocaleInfo}from\"framer\";/**\n * Language toggle for the nav: \"EN / NO\".\n * The active language is shown in the active colour; click the other to switch.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function LanguageToggle(props){const{font,activeColor=\"#080808\",inactiveColor=\"#737370\",hoverColor=\"#080808\",separator=\"/\",gap=6}=props;const{activeLocale,locales,setLocale}=useLocaleInfo();const[hovered,setHovered]=React.useState(null);// Fallback so the toggle is visible on the canvas before locales load\nconst list=locales&&locales.length>0?locales:[{id:\"default\",code:\"en\",name:\"English\"},{id:\"nb\",code:\"nb\",name:\"Norsk\"}];const activeId=activeLocale?.id??list.find(l=>l.id===\"default\")?.id??list[0]?.id;const labelFor=locale=>{const code=String(locale?.code||locale?.slug||locale?.name||\"\").toLowerCase().trim();if(code.startsWith(\"nb\")||code.startsWith(\"nn\")||code.startsWith(\"no\"))return\"NO\";return code.slice(0,2).toUpperCase();};return /*#__PURE__*/_jsx(\"nav\",{\"aria-label\":\"Language\",style:{display:\"flex\",alignItems:\"center\",gap,whiteSpace:\"nowrap\",...font},children:list.map((locale,index)=>{const isActive=locale.id===activeId;const isHovered=hovered===locale.id;return /*#__PURE__*/_jsxs(React.Fragment,{children:[index>0&&/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{color:inactiveColor},children:separator}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",lang:String(locale.code||\"\").split(\"-\")[0]||undefined,\"aria-label\":locale.name,\"aria-current\":isActive?\"true\":undefined,onClick:()=>{if(!isActive&&setLocale)setLocale(locale);},onMouseEnter:()=>setHovered(locale.id),onMouseLeave:()=>setHovered(null),style:{appearance:\"none\",background:\"none\",border:\"none\",padding:0,margin:0,font:\"inherit\",letterSpacing:\"inherit\",lineHeight:\"inherit\",cursor:isActive?\"default\":\"pointer\",color:isActive?activeColor:isHovered?hoverColor:inactiveColor,transition:\"color 0.15s ease\"},children:labelFor(locale)})]},locale.id);})});}LanguageToggle.displayName=\"Language Toggle\";addPropertyControls(LanguageToggle,{font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,lineHeight:1.3}},activeColor:{type:ControlType.Color,title:\"Active\",defaultValue:\"#080808\"},inactiveColor:{type:ControlType.Color,title:\"Inactive\",defaultValue:\"#737370\"},hoverColor:{type:ControlType.Color,title:\"Hover\",defaultValue:\"#080808\"},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\"/\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:6,min:0,max:24,step:1,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LanguageToggle\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LanguageToggle.map"],"mappings":"gMAMG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,OAAK,cAAY,UAAU,gBAAc,UAAU,aAAW,UAAU,YAAU,IAAI,MAAI,GAAG,EAAW,CAAC,eAAa,UAAQ,aAAW,EAAc,EAAO,CAAC,EAAQ,GAAYA,EAAe,IAAI,EACvP,EAAK,GAAS,EAAQ,OAAO,EAAE,EAAQ,CAAC,CAAC,GAAG,UAAU,KAAK,KAAK,KAAK,SAAS,EAAE,CAAC,GAAG,KAAK,KAAK,KAAK,KAAK,OAAO,CAAC,EAAQ,EAAS,GAAc,IAAI,EAAK,KAAK,GAAG,EAAE,KAAK,SAAS,CAAC,EAAE,IAA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