{"version":3,"file":"DeviceRedirectButton.Bz4fZJCQ.mjs","names":["React.useCallback","p"],"sources":["https:/framerusercontent.com/modules/ttThbBM505tH6U9YDvuR/Vb8XzczWm95gPXiNh2An/DeviceRedirectButton.js"],"sourcesContent":["// Instructions: Create a Framer component button that redirects the user based off of the device (macOS, Windows, iOS, or Android).\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";function detectOS(userAgent){const ua=(userAgent||\"\").toLowerCase();// iOS\nif(/iphone|ipad|ipod/.test(ua))return\"ios\";// Android\nif(/android/.test(ua))return\"android\";// Windows\nif(/windows nt|win64|wow64/.test(ua))return\"windows\";// macOS (avoid iPadOS which sometimes reports as Mac; already caught above)\nif(/macintosh|mac os x/.test(ua))return\"macos\";return\"other\";}/**\n * @framerIntrinsicWidth 220\n * @framerIntrinsicHeight 44\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function DeviceRedirectButton(props){const{label,macUrl,windowsUrl,iosUrl,androidUrl,fallbackUrl,openInNewTab,background,textColor,borderColor,borderWidth,borderRadius,padding,font,disabled,disabledOpacity,style}=props;const isInEditor=RenderTarget.current()===RenderTarget.canvas||RenderTarget.current()===RenderTarget.thumbnail||RenderTarget.current()===RenderTarget.export;const resolveUrl=React.useCallback(()=>{if(typeof window===\"undefined\")return fallbackUrl;const os=detectOS(window.navigator?.userAgent||\"\");const byOS={macos:macUrl,windows:windowsUrl,ios:iosUrl,android:androidUrl,other:fallbackUrl};const candidate=byOS[os];return(candidate&&candidate.trim().length>0?candidate:fallbackUrl).trim();},[androidUrl,fallbackUrl,iosUrl,macUrl,windowsUrl]);const onClick=React.useCallback(e=>{e.preventDefault();if(disabled)return;if(typeof window===\"undefined\")return;if(isInEditor)return;const url=resolveUrl();if(!url)return;if(openInNewTab){window.open(url,\"_blank\",\"noopener,noreferrer\");}else{window.location.assign(url);}},[disabled,isInEditor,openInNewTab,resolveUrl]);return /*#__PURE__*/_jsxs(\"button\",{type:\"button\",role:\"button\",\"aria-label\":label,disabled:disabled,onClick:onClick,style:{position:\"relative\",width:\"100%\",height:\"100%\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",userSelect:\"none\",cursor:disabled?\"not-allowed\":\"pointer\",appearance:\"none\",WebkitAppearance:\"none\",borderStyle:\"solid\",borderColor,borderWidth,borderRadius,padding,background,color:textColor,opacity:disabled?disabledOpacity:1,outline:\"none\",whiteSpace:\"nowrap\",...font||{},...style||{}},children:[/*#__PURE__*/_jsx(\"span\",{style:{width:\"max-content\"},children:label}),/*#__PURE__*/_jsx(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",style:{marginLeft:\"8px\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M12 5l7 7-7 7\"})})]});}addPropertyControls(DeviceRedirectButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Download\"},macUrl:{type:ControlType.Link,title:\"macOS URL\",defaultValue:\"https://example.com/macos\"},windowsUrl:{type:ControlType.Link,title:\"Windows URL\",defaultValue:\"https://example.com/windows\"},iosUrl:{type:ControlType.Link,title:\"iOS URL\",defaultValue:\"https://example.com/ios\"},androidUrl:{type:ControlType.Link,title:\"Android URL\",defaultValue:\"https://example.com/android\"},fallbackUrl:{type:ControlType.Link,title:\"Fallback URL\",defaultValue:\"https://example.com\"},openInNewTab:{type:ControlType.Boolean,title:\"New Tab\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#000000\"},borderWidth:{type:ControlType.Number,title:\"Border W\",defaultValue:0,min:0,max:12,step:1},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"10px\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"12px 16px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},disabled:{type:ControlType.Boolean,title:\"Disabled\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},disabledOpacity:{type:ControlType.Number,title:\"Dis Opacity\",defaultValue:.5,min:.05,max:1,step:.05,hidden:p=>!p.disabled}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DeviceRedirectButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"220\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"44\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DeviceRedirectButton.map"],"mappings":"sMACsJ,SAAS,EAAS,EAAU,CAAC,IAAM,GAAI,GAAW,IAAI,aAAa,CAI1K,MAH5C,mBAAmB,KAAK,EAAG,CAAO,MAClC,UAAU,KAAK,EAAG,CAAO,UACzB,yBAAyB,KAAK,EAAG,CAAO,UACxC,qBAAqB,KAAK,EAAG,CAAO,QAAc,QAMlD,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,QAAM,SAAO,aAAW,SAAO,aAAW,cAAY,eAAa,aAAW,YAAU,cAAY,cAAY,eAAa,UAAQ,OAAK,WAAS,kBAAgB,SAAO,EAAY,EAAW,EAAa,SAAS,GAAG,EAAa,QAAQ,EAAa,SAAS,GAAG,EAAa,WAAW,EAAa,SAAS,GAAG,EAAa,OAAa,EAAWA,MAAsB,CAAC,GAAU,IAAS,OAAY,OAAO,EAAY,IAAM,EAAG,EAAS,EAAO,WAA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