import{n as e}from"./rolldown-runtime-DAXXjFlN.js";import{d as t,t as n}from"./vendor-lodash-C2wwRdEA.js";import{n as r,r as i}from"./IPCRegistry-CMHLtHVv.js";function a(e){M=e}function o(){let e=S(),n=t(navigator.userAgent,/\(([^)]+)\)/)?.[1]?.toLowerCase();return!!(e===`electron`||e===`genten-2`||w(e)||n?.includes(`electron`))}function s(e){let t={},n=e.match(/\((.*?)\)/);if(n){let e=n[1]?.split(`; `)??[];for(let n of e){let[e,r]=n.split(`:`);e&&r&&(t[e.trim()]=r.trim())}}return t}function c(){if(N)return N;let e=s(navigator.userAgent);return N={client:e.client??`web`,env:e.env??`production`,arch:e.arch??`AMD64`,platform:e.platform??`web`,platformFriendly:D(e.platform),build:e.build,clientVersion:e.clientVersion??`0`,capi:e.c1api??`dev-mode`,subversion:e.subversion??`0`},e.hostVersion&&(N.hostVersion=e.hostVersion),N}function l(){return{version:window?.__BUILDINFO__?.SPA_VERSION??`3.0.0`,commit:window?.__BUILDINFO__?.GIT_SHA??``,branch:window?.__BUILDINFO__?.GIT_BRANCH??``,buildDate:window?.__BUILDINFO__?.BUILD_DATE??``,changelogUrl:window?.__BUILDINFO__?.CHANGELOG_URL??``,codeName:window?.__BUILDINFO__?.VERSION_CODENAME??``}}function u(){return Number.parseInt(c().clientVersion.replace(/\D/g,``))}function d(){return Number.parseInt(c().subversion.replace(/\D/g,``))}function f(e,t,n=0){if(S()!==e)return!0;let r=u(),i=d();return r>t?(console.debug(`Client version higher than minimum required version, this flag can be removed in the future`),!0):!(r<t||r===t&&i<n)}function p(e,t,n=0){return f(e,t,n)}function m(){let e=new Set;try{if(C()){let t=window?.chrome?.webview?.hostObjects?.sync?.windowControls?.GetCapabilities?.();if(typeof t==`string`&&t.length)for(let n of JSON.parse(t))typeof n==`string`&&e.add(n)}}catch{}return e}async function h(){if(S()!==`pixie`)return m();try{let e=new Set;for(let t of await r.getCapabilities())e.add(t);return e}catch{return new Set}}function g(e){return(P===null||P.size===0&&C())&&(P=m(),S()===`pixie`&&_()),P.has(e)}async function _(){return F||=h().then(e=>(P=e,e)),F}function v(){return window.__ciderNativeShell??`wpf`}function y(){return window.__ciderShellReason}function b(){let e=window.__ciderWindowingFallback;if(e&&typeof e.intended==`string`&&typeof e.reason==`string`)return e}function x(){return v()===`dcomp`}function S(){return c().client}function C(e=S()){switch(e){case`dotnet`:case`naru`:return!0;default:return!1}}function w(e=S()){switch(e){case`genten`:case`pixie`:return!0;default:return!1}}function T(){switch(S()){case`electron`:return`Electron`;case`genten`:return`Genten (Electron)`;case`pixie`:return`Pixie (Electron)`;case`dotnet`:return`.NET (Windows)`;case`naru`:return`Naru (Windows)`;default:return`Unknown ${S()}`}}function E(){if(sessionStorage.getItem(`force-platform`))return sessionStorage.getItem(`force-platform`);let e=c().platform;return e===`windows`&&(e=`win32`),e}function D(e){switch(e){case`windows`:case`win32`:return`Windows`;case`darwin`:return`macOS`;case`linux`:return`Linux`;default:return`Unknown (${e})`}}function O(){return c().env===`development`}function k(e=`https://cider.sh/`){let t=S();if(C(t)){window.chrome.webview.hostObjects.windowControls.OpenInBrowser(e);return}if(w(t)){r.window.openExternal({url:e});return}window.open(e,`_blank`)}async function A(e){await navigator.clipboard.writeText(e)}function j(e,t){let n=S();if(C(n)){window.chrome.webview.hostObjects.windowControls.ShowSongNotif(e,t??``,``);return}if(w(n)){r.showNotification({title:e,body:t??``});return}typeof Notification<`u`&&(Notification.permission===`granted`?new Notification(e,{body:t}):Notification.permission!==`denied`&&Notification.requestPermission().then(n=>{n===`granted`&&new Notification(e,{body:t})}))}var M,N,P,F,I=e((()=>{n(),i(),N=null,P=null,F=null}));export{A as S,p as _,S as a,j as b,E as c,I as d,x as f,w as g,o as h,u as i,b as l,C as m,l as n,v as o,O as p,c as r,y as s,T as t,g as u,k as v,a as x,_ as y};