PageSourceSearch

https://www.builder.io/assets/desktop-app-download-DvpgUdcf.js

js builder.io collected 2026-09-24 07:06:04 UTC 6,080 bytes, 1 lines download raw bytes

1import{j as m,a as n,F as g,r as b}from"./components-tbqp4LHE.js";import{c}from"./utils-DaT-yT0k.js";import{I as y,a as W,b as O}from"./IconBrandAppleFilled-BjfOl34a.js";import"./createReactComponent-C-GgH8hJ.js";const L="https://www.builder.io/desktop-releases/windows/stable",C=[{platform:"Windows (x64)",filename:"builder-io-x64.msi",downloadUrl:`${L}/builder-io-x64.msi`},{platform:"Windows (ARM64)",filename:"builder-io-arm64.msi",downloadUrl:`${L}/builder-io-arm64.msi`}];async function E(){let e,a,t="x64";if("userAgentData"in navigator&&navigator.userAgentData){const l=navigator.userAgentData;try{const s=await l.getHighEntropyValues(["architecture","platform"]),i=s.platform?.toLowerCase()||"";i.includes("windows")?(e="windows",a="win32"):i.includes("macos")||i.includes("mac")?(e="macos",a="darwin"):i.includes("linux")?(e="linux",a="linux"):l.mobile===!1?(e="windows",a="win32"):(e="linux",a="linux");const u=s.architecture?.toLowerCase()||"";return t=u.includes("arm")||u.includes("aarch64")?"arm64":"x64",{platform:a,platformName:e,architecture:t}}catch(s){console.warn("Failed to get high entropy values",s)}}const r=navigator.userAgent.toLowerCase();return r.includes("win")?(e="windows",a="win32"):r.includes("mac")?(e="macos",a="darwin",t="arm64",(r.includes("x86_64")||r.includes("intel 64"))&&(t="x64")):r.includes("linux")?(e="linux",a="linux"):(e="windows",a="win32"),{platform:a,platformName:e,architecture:t}}async function _(){const e=await fetch("https://api.github.com/repos/BuilderIO/native-app-distribution/releases/latest");if(!e.ok)throw new Error(`GitHub API error: ${e.status}`);return await e.json()}function F(e){const a=[];for(const t of e.assets)t.name.includes("-arm64.dmg")?a.push({platform:"macOS (Apple Silicon)",filename:t.name,downloadUrl:t.browser_download_url}):t.name.endsWith(".dmg")&&!t.name.includes("-arm64")&&a.push({platform:"macOS (Intel)",filename:t.name,downloadUrl:t.browser_download_url});return a}async function B(e,a){const t=[...C];if(!(a||e.platform==="darwin"))return t;try{const l=await _();t.push(...F(l))}catch(l){if(e.platform==="darwin")throw l;console.warn("Failed to fetch macOS download links",l)}return t}function I(e,a){return a.platform==="win32"?a.architecture==="arm64"?e.find(t=>t.platform==="Windows (ARM64)")||e.find(t=>t.platform==="Windows (x64)")||null:e.find(t=>t.platform==="Windows (x64)")||null:a.platform==="darwin"&&a.architecture==="arm64"?e.find(t=>t.platform==="macOS (Apple Silicon)")||null:a.platform==="darwin"&&e.find(t=>t.platform==="macOS (Intel)")||null}const R="https://github.com/BuilderIO/native-app-distribution/releases/latest";function A(e){window.open(e,"_blank","noopener,noreferrer")}function j(e){const[a,t]=b.useState([]),[r,l]=b.useState(null),[s,i]=b.useState(!0),[u,d]=b.useState(null);return b.useEffect(()=>{let f=!1;return(async()=>{try{i(!0),d(null);const p=await E();if(f)return;const w=await B(p,e);if(f)return;t(w),l(I(w,p))}catch(p){if(f)return;console.error("Failed to fetch download links:",p),d("Failed to load download links. Please try again later.")}finally{f||i(!1)}})(),()=>{f=!0}},[e]),{downloadLinks:a,recommendedLink:r,loading:s,error:u}}function x(e){const a=e.size==="large"?"px-7 py-3.5 text-base":e.size==="small"?"px-3 py-1.5 text-xs":"px-4 py-2 text-sm",t=e.buttonColor==="white"?"bg-white text-black border border-white/20 hover:bg-white/95":e.buttonColor==="black"?"bg-black text-white border border-white/30 hover:bg-black/90":"bg-primary text-primary-foreground hover:bg-primary/90",r=e.variant==="text"?"bg-transparent border-0 hover:bg-accent":e.variant==="outlined"?"bg-transparent border border-current hover:bg-accent/30":"";return c("inline-flex items-center rounded-xl font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",a,r||t)}const K=({showAllPlatforms:e=!1,className:a="",variant:t="outlined",align:r="inherit",appearance:l="light",size:s="medium",buttonColor:i="blue"})=>{const{downloadLinks:u,recommendedLink:d,loading:f,error:p}=j(e),w=o=>{A(o.downloadUrl)},k=()=>{A(R)};if(p)return m("div",{className:a,children:[n("button",{className:x({variant:"outlined",buttonColor:i}),onClick:k,children:"Download Desktop App"}),n("div",{className:"text-red-600 text-xs mt-2",children:p})]});const h=r==="center"?"justify-center text-center":r==="right"?"justify-end text-right":"justify-start text-left";if(f){const o=s==="large"?52:s==="small"?36:44,D=l==="dark"?"bg-white/15 animate-pulse":"bg-black/10 animate-pulse";return m("div",{className:c(a,h),children:[n("div",{className:c("flex",h),children:n("div",{className:c(D,"rounded-lg"),style:{height:o,width:280}})}),n("div",{className:c("flex mt-3",h),children:n("div",{className:c(D,"rounded"),style:{height:14,width:160}})})]})}const v=l==="dark",N=v?"text-gray-400":"text-gray-600",S=v?"text-gray-300":"text-gray-600";return m("div",{className:c(a,h),children:[d?m(g,{children:[n("button",{className:x({size:s,variant:t,buttonColor:i}),onClick:()=>w(d),children:d.platform.startsWith("Windows")?m(g,{children:[n(y,{size:20,className:"mr-2"}),"Download for Windows"]}):d.platform.startsWith("macOS")?m(g,{children:[n(W,{size:20,className:"mr-2"}),"Download for macOS"]}):"Download Desktop App"}),n("div",{className:c("mt-3 text-sm",N),children:d.platform})]}):n("button",{className:x({size:s,variant:t,buttonColor:i}),onClick:k,children:"Download Desktop App"}),e&&u.length>1&&m("div",{className:"mt-8",children:[n("div",{className:c("text-sm mb-3",S),children:"Other platforms:"}),n("div",{className:c("flex gap-3 flex-wrap",h),children:u.filter(o=>o!==d).map(o=>n("button",{className:x({size:"small",variant:i==="blue"?"text":"outlined",buttonColor:i}),onClick:()=>w(o),children:o.platform.startsWith("Windows")?m(g,{children:[n(y,{size:16,className:"mr-1.5"}),o.platform]}):o.platform.startsWith("macOS")?m(g,{children:[n(O,{size:16,className:"mr-1.5"}),o.platform]}):o.platform},o.platform))})]})]})};export{K as DesktopAppDownload,R as FALLBACK_RELEASE_URL,A as openDownload,j as useDesktopDownloads};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.