@stacksjs/bun-router 0.0.27 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-0gjq8ttx.js +14 -0
- package/dist/chunk-0t5vz87j.js +35 -0
- package/dist/chunk-30rkn2ym.js +2 -0
- package/dist/chunk-38cmrard.js +2 -0
- package/dist/chunk-3qna6dwd.js +2 -0
- package/dist/chunk-4d5fmta0.js +2 -0
- package/dist/chunk-4x3b4b4q.js +2 -0
- package/dist/chunk-5be9x5cq.js +3 -0
- package/dist/chunk-5mxby3fd.js +1654 -0
- package/dist/chunk-5n0ckcmc.js +3 -0
- package/dist/chunk-5ncn73tp.js +3 -0
- package/dist/chunk-5s0pnsd6.js +12 -0
- package/dist/chunk-5s1pr62n.js +3 -0
- package/dist/chunk-67wgad4f.js +60 -0
- package/dist/chunk-6bbmkwng.js +3 -0
- package/dist/chunk-6s1kbajm.js +7851 -0
- package/dist/chunk-6sjvhy5f.js +3 -0
- package/dist/chunk-6xed4va1.js +2 -0
- package/dist/chunk-73k79n7q.js +15413 -0
- package/dist/chunk-748n6ydj.js +2 -0
- package/dist/chunk-7qnxdedn.js +321 -0
- package/dist/chunk-7rsf8tes.js +898 -0
- package/dist/chunk-8aspmtf1.js +2 -0
- package/dist/chunk-8wpj3fqe.js +351 -0
- package/dist/chunk-8yfdg595.js +2 -0
- package/dist/chunk-90eze7av.js +3 -0
- package/dist/chunk-9805tt8n.js +341 -0
- package/dist/chunk-9dvwyej7.js +2 -0
- package/dist/chunk-9ght4n4r.js +216 -0
- package/dist/chunk-a2w45krb.js +2 -0
- package/dist/chunk-a3wahyg7.js +3 -0
- package/dist/chunk-a547f2ab.js +48 -0
- package/dist/chunk-bqdycvtc.js +2 -0
- package/dist/chunk-brpgjyqg.js +3 -0
- package/dist/chunk-cd03rk3x.js +2 -0
- package/dist/chunk-csfrpsp7.js +185 -0
- package/dist/chunk-ct0m17q5.js +2 -0
- package/dist/chunk-dhbvvr5h.js +2 -0
- package/dist/chunk-dhptcsya.js +943 -0
- package/dist/chunk-dq93zag9.js +2 -0
- package/dist/chunk-dxg045wj.js +5 -0
- package/dist/chunk-e3qej0jr.js +4 -0
- package/dist/chunk-edrtesh7.js +2 -0
- package/dist/chunk-ejcws37w.js +2 -0
- package/dist/chunk-ex5fkjah.js +397 -0
- package/dist/chunk-ex890p45.js +51 -0
- package/dist/chunk-f69cpnhw.js +2 -0
- package/dist/chunk-fjf53b44.js +2 -0
- package/dist/chunk-fjzye4qj.js +2 -0
- package/dist/chunk-gfd23b6t.js +2 -0
- package/dist/chunk-habv0vef.js +12 -0
- package/dist/chunk-hmgedrmr.js +11 -0
- package/dist/chunk-hz6fc788.js +2 -0
- package/dist/chunk-jff6j9y3.js +10 -0
- package/dist/chunk-jmeb7n8k.js +70 -0
- package/dist/chunk-jrf5a2ap.js +2 -0
- package/dist/chunk-jy2jhcpy.js +246 -0
- package/dist/chunk-kc659vhx.js +4 -0
- package/dist/chunk-kjtjbcq4.js +71 -0
- package/dist/chunk-krkchy8v.js +4 -0
- package/dist/chunk-kxp888dn.js +4540 -0
- package/dist/chunk-m249t3je.js +3 -0
- package/dist/chunk-m9yabnjx.js +2 -0
- package/dist/chunk-mekrq9wd.js +2 -0
- package/dist/chunk-mmxv535f.js +82 -0
- package/dist/chunk-mypn7jss.js +2 -0
- package/dist/chunk-n18x1k3c.js +2 -0
- package/dist/chunk-nkddjzsa.js +2 -0
- package/dist/chunk-pjmhqmr9.js +2 -0
- package/dist/chunk-qyrnsaq1.js +2 -0
- package/dist/chunk-r19ff2qm.js +62 -0
- package/dist/chunk-r338fssq.js +2 -0
- package/dist/chunk-s36z58x2.js +29 -0
- package/dist/chunk-s3dn1kwx.js +231 -0
- package/dist/chunk-s79dd325.js +471 -0
- package/dist/chunk-sw0chtw4.js +4 -0
- package/dist/chunk-ta38j9em.js +2 -0
- package/dist/chunk-tpfgntwj.js +4211 -0
- package/dist/chunk-vr10sbbh.js +3 -0
- package/dist/chunk-vsh4390q.js +358 -0
- package/dist/chunk-vv3gb1m5.js +84 -0
- package/dist/chunk-vw8rwv6e.js +2 -0
- package/dist/chunk-w4r464v5.js +288 -0
- package/dist/chunk-wcrqs5z9.js +2 -0
- package/dist/chunk-x6d1rmwa.js +2 -0
- package/dist/chunk-x7ft15zz.js +2 -0
- package/dist/chunk-x8trwn7j.js +3 -0
- package/dist/chunk-xg9xscqz.js +1 -0
- package/dist/chunk-xhepdj1f.js +2 -0
- package/dist/chunk-xv2em0q4.js +4 -0
- package/dist/chunk-ypw6g0te.js +2 -0
- package/dist/chunk-z8szsm21.js +2 -0
- package/dist/chunk-zetqzgf3.js +194 -0
- package/dist/chunk-zfbh14qe.js +2 -0
- package/dist/chunk-zhx0hxdd.js +28 -0
- package/dist/cli.js +67 -3240
- package/dist/container/index.js +1 -321
- package/dist/index.js +80 -13987
- package/package.json +1 -1
- package/dist/chunk-1ahs68ys.js +0 -18
- package/dist/chunk-cgptvjdf.js +0 -18131
- package/dist/chunk-g3ybefhg.js +0 -1923
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Zu as j}from"./chunk-a3wahyg7.js";import{execFile as n8,spawn as s8}from"child_process";import{mkdtempSync as r8,readFileSync as i8,writeFileSync as o8}from"fs";import{tmpdir as a8}from"os";import{join as kJ}from"path";import{promisify as t8}from"util";import{existsSync as iJ}from"fs";import{spawn as XJ}from"child_process";import{createHash as $$}from"crypto";import{chmodSync as r,copyFileSync as h,cpSync as Z$,existsSync as i,lstatSync as X$,mkdirSync as C,mkdtempSync as MJ,readFileSync as Y$,readdirSync as Q$,rmSync as d,writeFileSync as u}from"fs";import{homedir as G$,tmpdir as EJ}from"os";import{basename as IJ,join as F}from"path";import{deflateRawSync as K$}from"zlib";import{EventEmitter as p$}from"events";import{EventEmitter as o$}from"events";import{createReadStream as f8,createWriteStream as VZ,existsSync as K8,mkdirSync as q8,readFileSync as CJ,statSync as bJ,unlinkSync as f,writeFileSync as LZ}from"fs";import{join as RJ,basename as U8,dirname as SJ}from"path";import{execFileSync as S,spawn as $J}from"child_process";import{createHash as DJ}from"crypto";import{EventEmitter as RZ}from"events";var c8=Object.defineProperty,d8=(J)=>J;function l8(J,$){this[J]=d8.bind(null,$)}var V8=(J,$)=>{for(var Z in $)c8(J,Z,{get:$[Z],enumerable:!0,configurable:!0,set:l8.bind($,Z)})};function e8(J){if(J){if(!iJ(J))throw Error(`Custom Craft binary path not found: ${J}`);return J}let $=typeof process<"u"?process.env.CRAFT_BIN:void 0;if($){if(!iJ($))throw Error(`CRAFT_BIN points to ${$}, which does not exist`);return $}return"craft"}function J$(J){return[`Craft native binary not found (tried "${J}").`,"","Craft ships through the pantry package registry. Install it with:",""," pantry install craft","","or, in a project, declare it in deps.yaml / pantry.jsonc and run"," pantry install","","See https://pantry.dev/quickstart for pantry installation instructions.","For monorepo development you can also point CRAFT_BIN at a local build."].join(`
|
|
3
|
+
`)}var q$=(()=>{let J=new Uint32Array(256);for(let $=0;$<256;$++){let Z=$;for(let X=0;X<8;X++)Z=Z&1?3988292384^Z>>>1:Z>>>1;J[$]=Z>>>0}return J})();function U$(J){let $=4294967295;for(let Z=0;Z<J.length;Z++)$=q$[($^J[Z])&255]^$>>>8;return($^4294967295)>>>0}function z$(J){let $=J.getHours()<<11|J.getMinutes()<<5|J.getSeconds()>>1,Z=J.getFullYear()-1980<<9|J.getMonth()+1<<5|J.getDate();return{time:$&65535,date:Z&65535}}function W$(J){let{time:$,date:Z}=z$(new Date),X=[],Y=[],Q=0;for(let z of J){let W=Buffer.from(z.name,"utf8"),H=K$(z.data,{level:9}),L=U$(z.data),R=Buffer.alloc(30);R.writeUInt32LE(67324752,0),R.writeUInt16LE(20,4),R.writeUInt16LE(0,6),R.writeUInt16LE(8,8),R.writeUInt16LE($,10),R.writeUInt16LE(Z,12),R.writeUInt32LE(L,14),R.writeUInt32LE(H.length,18),R.writeUInt32LE(z.data.length,22),R.writeUInt16LE(W.length,26),R.writeUInt16LE(0,28),X.push(R,W,H);let O=Buffer.alloc(46);O.writeUInt32LE(33639248,0),O.writeUInt16LE(20,4),O.writeUInt16LE(20,6),O.writeUInt16LE(0,8),O.writeUInt16LE(8,10),O.writeUInt16LE($,12),O.writeUInt16LE(Z,14),O.writeUInt32LE(L,16),O.writeUInt32LE(H.length,20),O.writeUInt32LE(z.data.length,24),O.writeUInt16LE(W.length,28),O.writeUInt16LE(0,30),O.writeUInt16LE(0,32),O.writeUInt16LE(0,34),O.writeUInt16LE(0,36),O.writeUInt32LE(0,38),O.writeUInt32LE(Q,42),Y.push(O,W),Q+=R.length+W.length+H.length}let q=Buffer.concat(Y),U=Buffer.alloc(22);return U.writeUInt32LE(101010256,0),U.writeUInt16LE(0,4),U.writeUInt16LE(0,6),U.writeUInt16LE(J.length,8),U.writeUInt16LE(J.length,10),U.writeUInt32LE(q.length,12),U.writeUInt32LE(Q,16),U.writeUInt16LE(0,20),Buffer.concat([...X,q,U])}function H$(J,$,Z,X){let Y=`${Z}${X}`.trim();return`${J} exited with code ${$}${Y?`: ${Y}`:""}`}async function V$(J){let $=[];if(!J.binaryPath||!i(J.binaryPath))throw Error(`Binary not found: ${J.binaryPath}`);let Z=J.platforms||[F8()],X=J.outDir||F(process.cwd(),"dist");if(!i(X))C(X,{recursive:!0});for(let Y of Z)switch(Y){case"macos":$.push(...await L$(J,X));break;case"windows":$.push(...await R$(J,X));break;case"linux":$.push(...await F$(J,X));break}return $}async function L$(J,$){let Z=[],{name:X,version:Y,bundleId:Q=`com.myapp.${X.toLowerCase()}`}=J,q=J.macos||{},U=!q.appStore,z=F($,`${X}.app`),W=D$({name:X,version:Y,bundleId:Q,buildNumber:q.buildNumber,category:q.category,minimumSystemVersion:q.minimumSystemVersion,menuBarOnly:q.menuBarOnly,binaryPath:J.binaryPath,iconPath:J.iconPath,provisioningProfile:q.provisioningProfile,additionalExecutables:q.additionalExecutables,outputPath:z});if(!W.success)return Z.push({success:!1,platform:"macos",format:"app",error:W.error}),Z;if(q.signIdentity){let H=await o("codesign",j$({path:z,identity:q.signIdentity,entitlements:q.entitlements,hardenedRuntime:U}));if(!H.success)return Z.push({success:!1,platform:"macos",format:"app",error:H.error}),Z}else if(q.appStore)return Z.push({success:!1,platform:"macos",format:"pkg",error:'App Store packaging requires macos.signIdentity (a "3rd Party Mac Developer Application" identity)'}),Z;if(Z.push({success:!0,platform:"macos",format:"app",outputPath:z}),q.dmg!==!1){let H=F($,`${X}-${Y}.dmg`),L=await x$({appBundlePath:z,outputPath:H,volumeName:X});if(Z.push({success:L.success,platform:"macos",format:"dmg",outputPath:L.outputPath,error:L.error}),L.success)Z.push(...await oJ(q,H,"dmg"))}if(q.pkg||q.appStore){let H=F($,`${X}-${Y}.pkg`),L=await S$({appBundlePath:z,outputPath:H,identifier:Q,version:Y,appStore:q.appStore===!0,installerIdentity:q.installerIdentity});if(Z.push({success:L.success,platform:"macos",format:q.appStore?"pkg (app store)":"pkg",outputPath:L.outputPath,error:L.error}),L.success&&!q.appStore)Z.push(...await oJ(q,H,"pkg"))}return Z}async function oJ(J,$,Z){if(!J.notarize)return[];if(!J.appleId||!J.applePassword||!J.teamId)return[{success:!1,platform:"macos",format:`${Z} (notarize)`,error:"Notarization requires macos.appleId, macos.applePassword and macos.teamId"}];let X=await o("xcrun",_$({artifactPath:$,appleId:J.appleId,applePassword:J.applePassword,teamId:J.teamId}));if(!X.success)return[{success:!1,platform:"macos",format:`${Z} (notarize)`,error:X.error}];let Y=await o("xcrun",["stapler","staple",$]);return[{success:Y.success,platform:"macos",format:`${Z} (notarize)`,outputPath:Y.success?$:void 0,error:Y.success?void 0:Y.error}]}async function R$(J,$){let Z=[],{name:X,version:Y}=J,Q=J.windows||{};if(Q.msi!==!1){let q=await b$({name:X,version:Y,binaryPath:J.binaryPath,outputPath:F($,`${X}-${Y}.msi`),manufacturer:J.author||"Unknown",architecture:Q.architecture||w$(process.arch),certificatePath:Q.certificatePath,certificatePassword:Q.certificatePassword});Z.push({success:q.success,platform:"windows",format:"msi",outputPath:q.outputPath,error:q.error})}if(Q.zip||Q.msi===!1){let q=await v$({name:X,version:Y,binaryPath:J.binaryPath,outputPath:F($,`${X}-${Y}-windows.zip`)});Z.push({success:q.success,platform:"windows",format:"zip",outputPath:q.outputPath,error:q.error})}return Z}async function F$(J,$){let Z=[],{name:X,version:Y}=J,Q=J.linux||{};if(Q.deb!==!1){let q=await y$({name:X,version:Y,binaryPath:J.binaryPath,outputPath:F($,`${X}_${Y}_amd64.deb`),description:J.description||"",maintainer:J.author||"Unknown",dependencies:Q.debDependencies||["libgtk-3-0","libwebkit2gtk-4.1-37"]});Z.push({success:q.success,platform:"linux",format:"deb",outputPath:q.outputPath,error:q.error})}if(Q.rpm){let q=await h$({name:X,version:Y,binaryPath:J.binaryPath,outputPath:F($,`${X}-${Y}-1.x86_64.rpm`),description:J.description||"",requires:Q.rpmDependencies||["gtk3","webkit2gtk3"]});Z.push({success:q.success,platform:"linux",format:"rpm",outputPath:q.outputPath,error:q.error})}if(Q.appImage){let q=await u$({name:X,version:Y,binaryPath:J.binaryPath,outputPath:F($,`${X}-${Y}-x86_64.AppImage`),iconPath:J.iconPath});Z.push({success:q.success,platform:"linux",format:"appimage",outputPath:q.outputPath,error:q.error})}return Z}function O$(J){let $=[["CFBundleExecutable",J.name],["CFBundleIdentifier",J.bundleId],["CFBundleName",J.name],["CFBundleShortVersionString",J.version],["CFBundleVersion",J.buildNumber||J.version],["CFBundlePackageType","APPL"],["NSHighResolutionCapable",!0]];if(J.iconName)$.push(["CFBundleIconFile",J.iconName]);if(J.category)$.push(["LSApplicationCategoryType",J.category]);if(J.minimumSystemVersion)$.push(["LSMinimumSystemVersion",J.minimumSystemVersion]);if(J.menuBarOnly)$.push(["LSUIElement",!0]);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
5
|
+
<plist version="1.0">
|
|
6
|
+
<dict>
|
|
7
|
+
${$.map(([X,Y])=>` <key>${c(X)}</key>
|
|
8
|
+
${Y===!0?" <true/>":` <string>${c(Y)}</string>`}`).join(`
|
|
9
|
+
`)}
|
|
10
|
+
</dict>
|
|
11
|
+
</plist>`}function j$(J){return["--force","--sign",J.identity,"--timestamp",...J.hardenedRuntime?["--options","runtime"]:[],...J.entitlements?["--entitlements",J.entitlements]:[],"--deep",J.path]}function A$(J){return["--component",J.appBundlePath,"/Applications","--sign",J.identity,J.outputPath]}function _$(J){return["notarytool","submit",J.artifactPath,"--apple-id",J.appleId,"--password",J.applePassword,"--team-id",J.teamId,"--wait"]}function D$(J){try{let{name:$,binaryPath:Z,iconPath:X,provisioningProfile:Y,additionalExecutables:Q,outputPath:q}=J,U=F(q,"Contents"),z=F(U,"MacOS");C(z,{recursive:!0}),C(F(U,"Resources"),{recursive:!0}),h(Z,F(z,$)),r(F(z,$),493);for(let H of Q||[]){if(!i(H))return{success:!1,error:`Additional executable not found: ${H}`};let L=F(z,IJ(H));h(H,L),r(L,493)}let W;if(X){if(!i(X))return{success:!1,error:`Icon not found: ${X}`};W=IJ(X).replace(/\.icns$/i,""),h(X,F(U,"Resources",`${W}.icns`))}if(Y){if(!i(Y))return{success:!1,error:`Provisioning profile not found: ${Y}`};h(Y,F(U,"embedded.provisionprofile"))}return u(F(U,"Info.plist"),O$({...J,iconName:W})),{success:!0}}catch($){return{success:!1,error:$.message}}}var M$=1048576;function L8(J){let $=X$(J);if(!$.isDirectory())return $.size;return Q$(J).reduce((Z,X)=>Z+L8(F(J,X)),0)}function E$(J){if(!Number.isSafeInteger(J)||J<0)throw Error(`DMG content size must be a non-negative safe integer: ${J}`);let $=Math.ceil(J/M$);return Math.max(64,Math.ceil($*1.25)+32)}function T$(J,$){return["create","-volname",J.volumeName,"-srcfolder",J.appBundlePath,"-size",`${E$($)}m`,"-ov","-format","ULMO",J.outputPath]}var R8=3;function N$(J,$,Z=R8){if(!Number.isInteger($)||$<1||!Number.isInteger(Z)||Z<1)throw Error("hdiutil retry attempts must be positive integers");return $<Z&&/(?:resource busy|resource temporarily unavailable)/i.test(J)}function o(J,$){return new Promise((Z)=>{let X=XJ(J,$),Y="",Q="";X.stdout?.on("data",(q)=>{Y+=q.toString()}),X.stderr?.on("data",(q)=>{Q+=q.toString()}),X.on("close",(q)=>{if(q===0)Z({success:!0});else Z({success:!1,error:H$(J,q,Y,Q)})}),X.on("error",(q)=>Z({success:!1,error:q.message}))})}var B$=(J)=>o("hdiutil",J);async function x$(J){if(!/^[^/:\n]{1,27}$/.test(J.volumeName))return{success:!1,error:`Invalid DMG volume name "${J.volumeName}"; must be 1..27 chars without /, :, or newline`};let $=T$(J,L8(J.appBundlePath)),Z=[];for(let X=1;X<=R8;X++){let Y=await B$($);if(Y.success)return{success:!0,outputPath:J.outputPath};if(Z.push(`attempt ${X}: ${Y.error}`),!N$(Y.error,X))return{success:!1,error:Z.join(`
|
|
12
|
+
`)};d(J.outputPath,{force:!0}),await new Promise((Q)=>setTimeout(Q,X*2000))}return{success:!1,error:Z.join(`
|
|
13
|
+
`)}}async function S$(J){if(!/^[a-zA-Z0-9._-]+$/.test(J.identifier)||!J.identifier.includes("."))return{success:!1,error:`Invalid pkg identifier "${J.identifier}"; expected reverse-DNS like com.example.app`};if(!/^[A-Za-z0-9._+-]+$/.test(J.version))return{success:!1,error:`Invalid pkg version "${J.version}"`};if(J.appStore){if(!J.installerIdentity)return{success:!1,error:'App Store packaging requires macos.installerIdentity (a "3rd Party Mac Developer Installer" identity)'};let Z=await o("productbuild",A$({appBundlePath:J.appBundlePath,outputPath:J.outputPath,identity:J.installerIdentity}));return Z.success?{success:!0,outputPath:J.outputPath}:{success:!1,error:Z.error}}let $=MJ(F(EJ(),"craft-pkg-"));try{let Z=F($,"Applications");C(Z,{recursive:!0}),Z$(J.appBundlePath,F(Z,IJ(J.appBundlePath)),{recursive:!0});let X=await o("pkgbuild",["--root",$,"--identifier",J.identifier,"--version",J.version,"--install-location","/",...J.installerIdentity?["--sign",J.installerIdentity]:[],J.outputPath]);return X.success?{success:!0,outputPath:J.outputPath}:{success:!1,error:X.error}}finally{d($,{recursive:!0,force:!0})}}function c(J){return J.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function k$(J){let $=J.replace(/[^A-Za-z0-9_.]/g,"_");return/^[A-Za-z_]/.test($)?$:`_${$}`}function I$(J){let $=$$("sha256").update(J).digest("hex").slice(0,32).split("");$[12]="4",$[16]=(Number.parseInt($[16],16)&3|8).toString(16);let Z=$.join("").toUpperCase();return`${Z.slice(0,8)}-${Z.slice(8,12)}-${Z.slice(12,16)}-${Z.slice(16,20)}-${Z.slice(20)}`}function w$(J){if(J==="ia32"||J==="x86")return"x86";if(J==="x64"||J==="arm64")return J;throw Error(`Unsupported Windows package architecture: ${J}`)}function P$(J,$){if(!/^[0-9]+\.[0-9]+\.[0-9]+(?:\.[0-9]+)?$/.test(J.version))throw Error(`MSI version must have 3 or 4 numeric parts: ${J.version}`);let Z=k$(J.name),X=J.manufacturer.trim()||"Unknown",Y=I$(`${X}/${J.name}`),Q=J.architecture==="x86"?"ProgramFilesFolder":"ProgramFiles64Folder",q=J.architecture==="x86"?"no":"yes";return`<?xml version="1.0" encoding="UTF-8"?>
|
|
14
|
+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
|
15
|
+
<Product Id="*" Name="${c(J.name)}" Language="1033" Version="${J.version}" Manufacturer="${c(X)}" UpgradeCode="${Y}">
|
|
16
|
+
<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" Platform="${J.architecture}" />
|
|
17
|
+
<MajorUpgrade AllowDowngrades="yes" />
|
|
18
|
+
<MediaTemplate EmbedCab="yes" />
|
|
19
|
+
<Directory Id="TARGETDIR" Name="SourceDir">
|
|
20
|
+
<Directory Id="${Q}">
|
|
21
|
+
<Directory Id="INSTALLFOLDER" Name="${c(J.name)}">
|
|
22
|
+
<Component Id="${Z}Executable" Guid="*" Win64="${q}">
|
|
23
|
+
<File Id="${Z}File" Source="${c($)}" KeyPath="yes" />
|
|
24
|
+
</Component>
|
|
25
|
+
</Directory>
|
|
26
|
+
</Directory>
|
|
27
|
+
</Directory>
|
|
28
|
+
<Feature Id="ProductFeature" Title="${c(J.name)}" Level="1">
|
|
29
|
+
<ComponentRef Id="${Z}Executable" />
|
|
30
|
+
</Feature>
|
|
31
|
+
</Product>
|
|
32
|
+
</Wix>
|
|
33
|
+
`}function C$(J){if(J.length===0||J.trim()!==J||/[<>:"/\\|?*\u0000-\u001F]/.test(J)||/[. ]$/.test(J))throw Error(`Invalid Windows application name: ${JSON.stringify(J)}`);if(/^(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.|$)/i.test(J))throw Error(`Reserved Windows application name: ${JSON.stringify(J)}`);return`${J}.exe`}function qJ(J,$,Z){return new Promise((X,Y)=>{let Q=XJ(J,$,{cwd:Z,stdio:"inherit",windowsHide:!0});Q.once("error",Y),Q.once("close",(q)=>q===0?X():Y(Error(`${J} exited with code ${q}`)))})}async function b$(J){let $=MJ(F(EJ(),"craft-msi-"));try{let Z=C$(J.name),X=F($,Z),Y=F($,"installer.wxs"),Q=F($,"installer.wixobj");if(h(J.binaryPath,X),u(Y,P$(J,Z)),await qJ("candle.exe",["-nologo","-out",Q,Y],$),await qJ("light.exe",["-nologo","-sval","-out",J.outputPath,Q],$),J.certificatePath){let q=["sign","/fd","sha256","/tr","https://timestamp.digicert.com","/td","sha256","/f",J.certificatePath];if(J.certificatePassword)q.push("/p",J.certificatePassword);q.push(J.outputPath),await qJ("signtool.exe",q),await qJ("signtool.exe",["verify","/pa","/all",J.outputPath])}return{success:!0,outputPath:J.outputPath}}catch(Z){let X=Z instanceof Error?Z.message:String(Z);return{success:!1,error:/ENOENT|not found/i.test(X)?`WiX Toolset not found: ${X}`:X}}finally{d($,{recursive:!0,force:!0})}}async function v$(J){try{let $=new Uint8Array(Y$(J.binaryPath)),Z=W$([{name:`${J.name}.exe`,data:$}]);return u(J.outputPath,Z),{success:!0,outputPath:J.outputPath}}catch($){return{success:!1,error:`Failed to write ZIP: ${$.message}`}}}async function y$(J){return new Promise(($)=>{try{let Z=J.name.toLowerCase(),X=/^[a-z0-9._+-]+$/,Y=/^[A-Za-z0-9._+-]+$/;if(!X.test(Z)){$({success:!1,error:`DEB package name must match ${X} (got: ${Z})`});return}if(!Y.test(J.version)){$({success:!1,error:`DEB version must match ${Y} (got: ${J.version})`});return}let Q=(I)=>I.replace(/[\r\n]+/g," ").trim(),q=Q(J.description),U=Q(J.maintainer);for(let I of J.dependencies)if(!/^[a-z0-9._+-]+(?:\s*\([^)\n,]+\))?$/i.test(I)){$({success:!1,error:`Invalid DEB dependency "${I}"`});return}let z=MJ(F(EJ(),"craft-deb-")),W=F(z,"DEBIAN"),H=F(z,"usr","bin"),L=F(z,"usr","share","applications");C(W,{recursive:!0}),C(H,{recursive:!0}),C(L,{recursive:!0});let R=Z;h(J.binaryPath,F(H,R)),r(F(H,R),493);let O=`Package: ${Z}
|
|
34
|
+
Version: ${J.version}
|
|
35
|
+
Section: utils
|
|
36
|
+
Priority: optional
|
|
37
|
+
Architecture: amd64
|
|
38
|
+
Depends: ${J.dependencies.join(", ")}
|
|
39
|
+
Maintainer: ${U}
|
|
40
|
+
Description: ${q||J.name}
|
|
41
|
+
`;u(F(W,"control"),O);let _=`[Desktop Entry]
|
|
42
|
+
Type=Application
|
|
43
|
+
Name=${J.name}
|
|
44
|
+
Exec=/usr/bin/${R}
|
|
45
|
+
Terminal=false
|
|
46
|
+
Categories=Utility;
|
|
47
|
+
`;u(F(L,`${R}.desktop`),_);let M=XJ("dpkg-deb",["--build",z,J.outputPath]);M.on("close",(I)=>{if(d(z,{recursive:!0,force:!0}),I===0)$({success:!0,outputPath:J.outputPath});else $({success:!1,error:`dpkg-deb exited with code ${I}`})}),M.on("error",(I)=>{d(z,{recursive:!0,force:!0}),$({success:!1,error:I.message})})}catch(Z){$({success:!1,error:Z.message})}})}async function h$(J){return new Promise(($)=>{try{let Z=F(G$(),"rpmbuild"),X=F(Z,"SPECS"),Y=F(Z,"SOURCES"),Q=F(Z,"BUILD"),q=F(Z,"RPMS");C(X,{recursive:!0}),C(Y,{recursive:!0}),C(Q,{recursive:!0}),C(q,{recursive:!0});let U=/^[a-z0-9._+-]+$/i,z=/^[A-Za-z0-9._+-]+$/,W=J.name.toLowerCase();if(!U.test(W))return $({success:!1,error:`RPM package name must match ${U} (got: ${W})`});if(!z.test(J.version))return $({success:!1,error:`RPM version must match ${z} (got: ${J.version})`});let L=((E)=>E.replace(/[\r\n]+/g," ").replace(/%/g,"%%"))(J.description||J.name),R=(J.description||J.name).split(/\r?\n/).map((E)=>E.replace(/%/g,"%%")).join(`
|
|
48
|
+
`),O=J.requires.map((E)=>{if(!U.test(E))throw Error(`RPM Requires entry must match ${U} (got: ${E})`);return E}).join(", ");h(J.binaryPath,F(Y,W));let _=`Name: ${W}
|
|
49
|
+
Version: ${J.version}
|
|
50
|
+
Release: 1%{?dist}
|
|
51
|
+
Summary: ${L}
|
|
52
|
+
License: MIT
|
|
53
|
+
Requires: ${O}
|
|
54
|
+
|
|
55
|
+
%description
|
|
56
|
+
${R}
|
|
57
|
+
|
|
58
|
+
%install
|
|
59
|
+
mkdir -p %{buildroot}/usr/bin
|
|
60
|
+
install -m 755 %{SOURCE0} %{buildroot}/usr/bin/${W}
|
|
61
|
+
|
|
62
|
+
%files
|
|
63
|
+
/usr/bin/${W}
|
|
64
|
+
`,M=F(X,`${J.name.toLowerCase()}.spec`);u(M,_);let I=XJ("rpmbuild",["-bb",M]);I.on("close",(E)=>{if(E===0){let v=`${J.name.toLowerCase()}-${J.version}-1.x86_64.rpm`,KJ=F(q,"x86_64",v);try{h(KJ,J.outputPath),$({success:!0,outputPath:J.outputPath})}catch{$({success:!1,error:"Failed to copy built RPM"})}}else $({success:!1,error:`rpmbuild exited with code ${E}`})}),I.on("error",(E)=>{$({success:!1,error:E.message})})}catch(Z){$({success:!1,error:Z.message})}})}async function u$(J){return new Promise(($)=>{try{let Z=MJ(F(EJ(),"craft-appimage-")),X=F(Z,`${J.name}.AppDir`),Y=F(X,"usr","bin"),Q=F(X,"usr","share");C(Y,{recursive:!0}),C(Q,{recursive:!0});let q=J.name.toLowerCase();h(J.binaryPath,F(Y,q)),r(F(Y,q),493);let U=`#!/bin/bash
|
|
65
|
+
SELF=$(readlink -f "$0")
|
|
66
|
+
HERE=\${SELF%/*}
|
|
67
|
+
export PATH="\${HERE}/usr/bin/:\${PATH}"
|
|
68
|
+
exec "\${HERE}/usr/bin/${q}" "$@"
|
|
69
|
+
`;u(F(X,"AppRun"),U),r(F(X,"AppRun"),493);let z=`[Desktop Entry]
|
|
70
|
+
Type=Application
|
|
71
|
+
Name=${J.name}
|
|
72
|
+
Exec=${q}
|
|
73
|
+
Terminal=false
|
|
74
|
+
Categories=Utility;
|
|
75
|
+
Icon=${q}
|
|
76
|
+
`;if(u(F(X,`${q}.desktop`),z),J.iconPath&&i(J.iconPath))h(J.iconPath,F(X,`${q}.png`));else{let H=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);u(F(X,`${q}.png`),H)}let W=XJ("appimagetool",[X,J.outputPath],{env:{...process.env,ARCH:"x86_64"}});W.on("close",(H)=>{if(d(Z,{recursive:!0,force:!0}),H===0)r(J.outputPath,493),$({success:!0,outputPath:J.outputPath});else $({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),W.on("error",(H)=>{d(Z,{recursive:!0,force:!0}),$({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(Z){$({success:!1,error:Z.message})}})}function F8(){switch(process.platform){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}async function bZ(J){return V$({...J,platforms:[F8()]})}class g${backgroundAudio=null;toneFrequencies={bell:880,chime:1046.5,gong:440,gentle:523.25};async playTone(J,$=1.5){let Z=null;try{if(Z=new(window.AudioContext||window.webkitAudioContext),Z.state==="suspended"&&typeof Z.resume==="function")await Z.resume();let X=Z.createOscillator(),Y=Z.createGain();X.connect(Y),Y.connect(Z.destination),X.frequency.value=this.toneFrequencies[J],X.type="sine";let Q=Z.currentTime;Y.gain.setValueAtTime(0.3,Q),Y.gain.exponentialRampToValueAtTime(0.01,Q+$),X.start(Q),X.stop(Q+$),X.onended=()=>{Z.close().catch(()=>{})}}catch(X){throw console.error("Failed to play tone:",X),Z?.close().catch(()=>{}),X instanceof Error?X:Error(String(X))}}playBackgroundNoise(J,$=0.5){this.stopBackgroundNoise();try{let Z=new(window.AudioContext||window.webkitAudioContext),X=Z.createGain();switch(X.gain.value=$,J){case"whitenoise":this.generateWhiteNoise(Z,X);break;case"brownnoise":this.generateBrownNoise(Z,X);break;case"ocean":this.generateOceanWaves(Z,X);break;case"rain":this.generateRain(Z,X);break;case"forest":this.generateForest(Z,X);break}}catch(Z){console.error("Failed to generate background noise:",Z)}}stopBackgroundNoise(){if(this.backgroundAudio)try{if(this.backgroundAudio.source)this.backgroundAudio.source.stop();if(this.backgroundAudio.source2)this.backgroundAudio.source2.stop();if(this.backgroundAudio.context)this.backgroundAudio.context.close();this.backgroundAudio=null}catch(J){console.error("Failed to stop background noise:",J)}}setVolume(J){if(this.backgroundAudio&&this.backgroundAudio.gain)this.backgroundAudio.gain.gain.value=J}generateWhiteNoise(J,$){let Z=2*J.sampleRate,X=J.createBuffer(1,Z,J.sampleRate),Y=X.getChannelData(0);for(let q=0;q<Z;q++)Y[q]=Math.random()*2-1;let Q=J.createBufferSource();Q.buffer=X,Q.loop=!0,Q.connect($),$.connect(J.destination),Q.start(0),this.backgroundAudio={source:Q,context:J,gain:$}}generateBrownNoise(J,$){let Z=2*J.sampleRate,X=J.createBuffer(1,Z,J.sampleRate),Y=X.getChannelData(0),Q=0;for(let U=0;U<Z;U++){let z=Math.random()*2-1;Y[U]=(Q+0.02*z)/1.02,Q=Y[U],Y[U]*=3.5}let q=J.createBufferSource();q.buffer=X,q.loop=!0,q.connect($),$.connect(J.destination),q.start(0),this.backgroundAudio={source:q,context:J,gain:$}}generateOceanWaves(J,$){let Z=2*J.sampleRate,X=J.createBuffer(1,Z,J.sampleRate),Y=X.getChannelData(0),Q=0;for(let H=0;H<Z;H++){let L=Math.random()*2-1;Y[H]=(Q+0.02*L)/1.02,Q=Y[H],Y[H]*=2}let q=J.createBufferSource();q.buffer=X,q.loop=!0;let U=J.createBiquadFilter();U.type="lowpass",U.frequency.value=800,U.Q.value=1;let z=J.createOscillator();z.frequency.value=0.15;let W=J.createGain();W.gain.value=0.3,q.connect(U),U.connect($),z.connect(W),W.connect($.gain),$.connect(J.destination),q.start(0),z.start(0),this.backgroundAudio={source:q,source2:z,context:J,gain:$}}generateRain(J,$){let Z=2*J.sampleRate,X=J.createBuffer(1,Z,J.sampleRate),Y=X.getChannelData(0);for(let U=0;U<Z;U++){let z=Math.random()>0.98?2:1;Y[U]=(Math.random()*2-1)*z}let Q=J.createBufferSource();Q.buffer=X,Q.loop=!0;let q=J.createBiquadFilter();q.type="highpass",q.frequency.value=400,q.Q.value=0.5,Q.connect(q),q.connect($),$.connect(J.destination),Q.start(0),this.backgroundAudio={source:Q,context:J,gain:$}}generateForest(J,$){let Z=2*J.sampleRate,X=J.createBuffer(1,Z,J.sampleRate),Y=X.getChannelData(0),Q=0,q=0,U=0,z=0,W=0,H=0,L=0;for(let _=0;_<Z;_++){let M=Math.random()*2-1;Q=0.99886*Q+M*0.0555179,q=0.99332*q+M*0.0750759,U=0.969*U+M*0.153852,z=0.8665*z+M*0.3104856,W=0.55*W+M*0.5329522,H=-0.7616*H-M*0.016898,Y[_]=(Q+q+U+z+W+H+L+M*0.5362)*0.11,L=M*0.115926}let R=J.createBufferSource();R.buffer=X,R.loop=!0;let O=J.createBiquadFilter();O.type="bandpass",O.frequency.value=1200,O.Q.value=0.8,R.connect(O),O.connect($),$.connect(J.destination),R.start(0),this.backgroundAudio={source:R,context:J,gain:$}}}function vZ(){return typeof window<"u"&&!!window.craft}function O8(){if(typeof window>"u")return null;return window.craft??null}function yZ(){return O8()?.bridge?.call??null}function f$(J){return`${J} not available. Must run in Craft environment.`}function hZ(J){let $=O8();if(!$)throw Error(f$(J));return $}function BJ(){return typeof globalThis<"u"&&typeof globalThis.localStorage<"u"}class m${key;defaults;constructor(J,$){this.key=J,this.defaults=$}load(){if(!BJ())return this.defaults;try{let J=localStorage.getItem(this.key);if(J){let $=JSON.parse(J);if(Array.isArray($)||Array.isArray(this.defaults))return $;if($!==null&&typeof $==="object"&&this.defaults!==null&&typeof this.defaults==="object")return{...this.defaults,...$};return $}}catch(J){console.error(`Failed to load ${this.key}:`,J)}return this.defaults}save(J){if(!BJ())return;try{localStorage.setItem(this.key,JSON.stringify(J))}catch($){console.error(`Failed to save ${this.key}:`,$)}}update(J){let $=this.load();if($!==null&&typeof $==="object"&&!Array.isArray($)&&J!==null&&typeof J==="object"&&!Array.isArray(J)){this.save({...$,...J});return}this.save(J)}clear(){if(!BJ())return;try{localStorage.removeItem(this.key)}catch(J){console.error(`Failed to clear ${this.key}:`,J)}}}class s{duration;onTick;onComplete;intervalId=null;timeRemaining=0;isRunning=!1;endAt=0;static now=()=>Date.now();constructor(J,$,Z){this.duration=J,this.onTick=$,this.onComplete=Z,this.timeRemaining=J}start(){if(this.isRunning)return;this.isRunning=!0,this.endAt=s.now()+this.timeRemaining*1000,this.intervalId=setInterval(()=>{let J=Math.max(0,this.endAt-s.now());if(this.timeRemaining=Math.ceil(J/1000),this.onTick(this.timeRemaining),this.timeRemaining<=0)this.pause(),this.onComplete?.()},250)}pause(){if(!this.isRunning)return;if(this.isRunning=!1,this.intervalId)clearInterval(this.intervalId),this.intervalId=null}reset(){this.pause(),this.timeRemaining=this.duration,this.endAt=s.now()+this.duration*1000,this.onTick(this.timeRemaining)}setDuration(J){if(this.duration=J,this.timeRemaining=J,this.isRunning)this.endAt=s.now()+J*1000}getTimeRemaining(){return this.timeRemaining}running(){return this.isRunning}static formatTime(J){let $=Math.max(0,Math.floor(J)),Z=Math.floor($/60),X=$%60;return`${Z}:${X.toString().padStart(2,"0")}`}static _setClockForTests(J){s.now=J??(()=>Date.now())}}function wJ(){let J=globalThis.crypto;if(J&&typeof J.randomUUID==="function")return J.randomUUID();if(J&&typeof J.getRandomValues==="function"){let $=new Uint8Array(16);J.getRandomValues($),$[6]=$[6]&15|64,$[8]=$[8]&63|128;let Z=Array.from($,(X)=>X.toString(16).padStart(2,"0")).join("");return`${Z.slice(0,8)}-${Z.slice(8,12)}-${Z.slice(12,16)}-${Z.slice(16,20)}-${Z.slice(20,32)}`}throw Error("[Craft] No Web Crypto available; cannot generate secure IDs")}var B={UNKNOWN:-1,TIMEOUT:-2,QUEUE_FULL:-3,BINARY_DISABLED:-4,EXPECTED_BINARY:-5,BRIDGE_DESTROYED:-6,BUSY:-7,PROTOCOL_MISMATCH:-8,DISCONNECTED:-9},xJ=1;function c$(J,$){return`${J}_${Date.now().toString(36)}_${$.toString(36)}`}class j8 extends p${config;pendingRequests=new Map;offlineQueue=[];connected=!1;streams=new Map;batchBuffer=[];batchTimer=null;destroyed=!1;idPrefix=`msg-${wJ().slice(0,8)}`;idCounter=Math.floor(Math.random()*1e9);nextMessageId(){if(this.idCounter>=Number.MAX_SAFE_INTEGER-1)this.idCounter=Math.floor(Math.random()*1e9);return this.idCounter++,c$(this.idPrefix,this.idCounter)}boundHandleMessage=null;craftReadyHandler=null;constructor(J={}){super();this.setMaxListeners(100),this.config={timeout:30000,retries:3,retryDelay:1000,queueSize:1000,batchSize:10,batchDelay:50,enableOfflineQueue:!0,enableBinaryTransfer:!0,maxConcurrentRequests:1e4,parentOrigin:null,...J},this.setupBridge()}setupBridge(){if(typeof window>"u")return;if(this.boundHandleMessage=this.handleMessage.bind(this),window.addEventListener("message",this.boundHandleMessage),window.addEventListener("craft-bridge-message",this.boundHandleMessage),window.craft)Promise.resolve().then(()=>this.setConnected(!0));else this.craftReadyHandler=()=>{if(this.craftReadyHandler)window.removeEventListener("craft:ready",this.craftReadyHandler),this.craftReadyHandler=null;this.setConnected(!0)},window.addEventListener("craft:ready",this.craftReadyHandler,{once:!0})}teardownBridgeListeners(){if(typeof window>"u")return;if(this.boundHandleMessage)window.removeEventListener("message",this.boundHandleMessage),window.removeEventListener("craft-bridge-message",this.boundHandleMessage),this.boundHandleMessage=null;if(this.craftReadyHandler)window.removeEventListener("craft:ready",this.craftReadyHandler),this.craftReadyHandler=null}handleMessage(J){let $;try{$="detail"in J?J.detail:typeof J.data==="string"?JSON.parse(J.data):J.data}catch(Z){console.warn("[Craft Bridge] Failed to parse message:",Z);return}if(!$||!$.id)return;if($.type==="response"&&!this.isOwnId($.id))return;switch($.type){case"response":this.handleResponse($);break;case"event":this.handleEvent($);break;case"stream":this.handleStream($);break}}isOwnId(J){return typeof J==="string"&&J.startsWith(`${this.idPrefix}_`)}handleResponse(J){let $=this.pendingRequests.get(J.id);if(!$)return;if(clearTimeout($.timeout),this.pendingRequests.delete(J.id),J.error)$.reject(new T(J.error.message,J.error.code,J.error.data));else $.resolve(J.result)}handleEvent(J){if(J.method)this.emit(J.method,J.params)}handleStream(J){if(!J.streamId)return;let $=this.streams.get(J.streamId);if(!$)return;switch(J.streamEvent){case"data":$.onData(J.result);break;case"end":$.onEnd(),this.streams.delete(J.streamId);break;case"error":$.onError(Error(J.error?.message||"Stream error")),this.streams.delete(J.streamId);break}}async request(J,$,Z){return this.requestWithRetry(J,$,this.config.retries,Z?.timeout)}async requestWithRetry(J,$,Z,X){try{return await this.sendRequest(J,$,X)}catch(Y){if(Z>0&&this.isRetryableError(Y))return await this.delay(this.config.retryDelay),this.requestWithRetry(J,$,Z-1,X);throw Y}}isRetryableError(J){if(J instanceof T)return J.code===B.UNKNOWN||J.code===B.TIMEOUT;return!1}async sendRequest(J,$,Z){if(this.destroyed)throw new T("Bridge destroyed",B.BRIDGE_DESTROYED);if(this.pendingRequests.size>=this.config.maxConcurrentRequests)throw new T(`Bridge busy: ${this.pendingRequests.size} in-flight requests exceeds maxConcurrentRequests=${this.config.maxConcurrentRequests}`,B.BUSY);let X=Z??this.config.timeout,Y={id:this.nextMessageId(),type:"request",method:J,params:$};if(!this.connected&&this.config.enableOfflineQueue){if(this.offlineQueue.length>=this.config.queueSize)throw new T("Offline queue full",B.QUEUE_FULL);return this.offlineQueue.push(Y),new Promise((Q,q)=>{this.pendingRequests.set(Y.id,{resolve:Q,reject:q,timeout:setTimeout(()=>{this.pendingRequests.delete(Y.id);let U=this.offlineQueue.findIndex((z)=>z.id===Y.id);if(U>=0)this.offlineQueue.splice(U,1);q(new T("Request timeout (offline)",B.TIMEOUT))},X)})})}return new Promise((Q,q)=>{let U=setTimeout(()=>{this.pendingRequests.delete(Y.id),q(new T("Request timeout",B.TIMEOUT))},X);if(this.pendingRequests.set(Y.id,{resolve:Q,reject:q,timeout:U}),!this.send(Y))clearTimeout(U),this.pendingRequests.delete(Y.id),q(new T("No bridge transport available \u2014 not running inside a Craft host",B.UNKNOWN))})}async handshake(){let J=await this.request("_handshake",{sdkVersion:xJ});if(J?.version!==xJ)throw new T(`Bridge protocol mismatch: SDK speaks v${xJ}, native speaks v${J?.version??"unknown"}`,B.PROTOCOL_MISMATCH);return{nativeVersion:J.version}}notify(J,$){let Z={id:this.nextMessageId(),type:"request",method:J,params:$};this.send(Z)}stream(J,$,Z){let X=Z?.bufferLimit??1000,Y=this.nextMessageId(),Q={id:this.nextMessageId(),type:"request",method:J,params:$,streamId:Y},q=[],U=!1,z,W=!1,H=null,L=null,R=null,O={onData:(_)=>{H=_;while(q.length>0)_(q.shift())},onEnd:(_)=>{if(L=_,U)_()},onError:(_)=>{if(R=_,z)_(z)},cancel:()=>{if(W)return;if(W=!0,!this.streams.has(Y))return;this.streams.delete(Y),this.send({id:this.nextMessageId(),type:"request",method:"_cancelStream",params:{streamId:Y}})}};return this.streams.set(Y,{onData:(_)=>{if(H){H(_);return}if(q.length>=X){let M=new T(`Stream buffer overflow: ${q.length} events buffered with no consumer (limit=${X})`,B.BUSY);if(z=M,R)R(M);this.streams.delete(Y),this.send({id:this.nextMessageId(),type:"request",method:"_cancelStream",params:{streamId:Y}});return}q.push(_)},onEnd:()=>{if(U=!0,L)L()},onError:(_)=>{if(z=_,R)R(_)}}),this.send(Q),O}async sendBinary(J,$){if(!this.config.enableBinaryTransfer)throw new T("Binary transfer not enabled",B.BINARY_DISABLED);let Z=this.arrayBufferToBase64($ instanceof ArrayBuffer?new Uint8Array($):$);await this.request(J,{_binary:!0,data:Z})}async receiveBinary(J,$){if(!this.config.enableBinaryTransfer)throw new T("Binary transfer not enabled",B.BINARY_DISABLED);let Z=await this.request(J,$);if(Z._binary)return this.base64ToArrayBuffer(Z.data);throw new T("Expected binary response",B.EXPECTED_BINARY)}async batch(J){return this.request("_batch",{requests:J})}addToBatch(J,$){if(this.batchBuffer.push({id:this.nextMessageId(),type:"request",method:J,params:$}),this.batchBuffer.length>=this.config.batchSize)this.flushBatch();else if(!this.batchTimer)this.batchTimer=setTimeout(()=>this.flushBatch(),this.config.batchDelay)}flushBatch(){if(this.batchTimer)clearTimeout(this.batchTimer),this.batchTimer=null;if(this.destroyed){this.batchBuffer=[];return}if(this.batchBuffer.length===0)return;let J=this.batchBuffer;if(this.batchBuffer=[],!this.connected){if(this.config.enableOfflineQueue)for(let $ of J){if(this.offlineQueue.length>=this.config.queueSize)break;this.offlineQueue.push($)}return}this.send({id:this.nextMessageId(),type:"request",method:"_batch",params:{requests:J}})}setConnected(J){let $=this.connected;if(this.connected=J,J&&!$)this.emit("connected"),this.flushOfflineQueue();else if(!J&&$){this.emit("disconnected");for(let[Z,X]of this.pendingRequests)clearTimeout(X.timeout),X.reject(new T("Bridge disconnected",B.DISCONNECTED)),this.pendingRequests.delete(Z)}}flushOfflineQueue(){let J=this.offlineQueue;this.offlineQueue=[];for(let $ of J)this.send($)}send(J){let $;try{$=JSON.stringify(J)}catch(Z){return this.failPendingForMessage(J,new T(`Failed to serialize bridge message: ${Z.message}`,B.UNKNOWN,{originalError:String(Z)})),!1}try{if(typeof window<"u"){if(window.webkit?.messageHandlers?.craft)return window.webkit.messageHandlers.craft.postMessage(J),!0;if(window.CraftBridge)return window.CraftBridge.postMessage($),!0;if(window.craftIPC)return window.craftIPC.send("bridge-message",J),!0;if(window.parent!==window&&this.config.parentOrigin)return window.parent.postMessage(J,this.config.parentOrigin),!0}if(typeof process<"u"&&typeof process.send==="function")return process.send(J),!0;return!1}catch(Z){return this.failPendingForMessage(J,new T(`Bridge transport rejected the message: ${Z.message}`,B.UNKNOWN)),!1}}failPendingForMessage(J,$){let Z=this.pendingRequests.get(J.id);if(!Z)return;clearTimeout(Z.timeout),this.pendingRequests.delete(J.id),Z.reject($)}delay(J){return new Promise(($)=>setTimeout($,J))}arrayBufferToBase64(J){let $=[],Z=8192;for(let X=0;X<J.byteLength;X+=8192)$.push(String.fromCharCode(...J.subarray(X,X+8192)));return btoa($.join(""))}base64ToArrayBuffer(J){let $=atob(J),Z=new ArrayBuffer($.length),X=new Uint8Array(Z);for(let Y=0;Y<$.length;Y++)X[Y]=$.charCodeAt(Y);return Z}destroy(){if(this.destroyed)return;this.destroyed=!0;for(let[,J]of this.pendingRequests)clearTimeout(J.timeout),J.reject(new T("Bridge destroyed",B.BRIDGE_DESTROYED));if(this.pendingRequests.clear(),this.streams.clear(),this.offlineQueue=[],this.batchBuffer=[],this.batchTimer)clearTimeout(this.batchTimer),this.batchTimer=null;this.teardownBridgeListeners(),this.removeAllListeners()}}class T extends Error{code;data;constructor(J,$,Z){super(J);this.name="BridgeError",this.code=$,this.data=Z}}var UJ=null,zJ=null;function D(J){if(!UJ)return UJ=new j8(J),zJ=J??null,UJ;if(J&&zJ&&!d$(J,zJ))console.warn("[Craft Bridge] getBridge() ignored a follow-up config that differs from the "+"original \u2014 the singleton was already constructed. Use createBridge() for "+"independent instances, or call resetGlobalBridge() first.");else if(J&&!zJ)console.warn("[Craft Bridge] getBridge() ignored a follow-up config \u2014 singleton already "+"exists with no recorded config. Use createBridge() for independent instances.");return UJ}function d$(J,$){let Z=new Set([...Object.keys(J),...Object.keys($)]);for(let X of Z)if(J[X]!==$[X])return!1;return!0}var l$=30000;function A8(){if(typeof window>"u")return null;return window}function n$(){let J=A8();if(!J)return;if(J.__craftBridgePending=J.__craftBridgePending||{},!J.__craftBridgeResolve)J.__craftBridgeResolve=($,Z)=>{let X=J.__craftBridgePending[$];if(!X||X.length===0)return!1;return X.shift().resolve(Z),!0};if(!J.__craftBridgeReject)J.__craftBridgeReject=($,Z)=>{let X=J.__craftBridgePending[$];if(!X||X.length===0)return!1;return X.shift().reject(Z instanceof Error?Z:Error(String(Z))),!0}}function N(){return typeof window<"u"&&!!window.webkit?.messageHandlers?.craft}function vJ(J){if(!N())return!1;return window.webkit.messageHandlers.craft.postMessage(J),!0}function b(J,$,Z={}){if(!N())return Promise.reject(Error("No WKWebView host"));n$();let X=Z.timeoutMs??l$,Y=A8();return new Promise((Q,q)=>{let U=!1,z=Y.__craftBridgePending[J]=Y.__craftBridgePending[J]||[],W,H={resolve:(L)=>{if(U)return;U=!0,clearTimeout(W);let R=z.indexOf(H);if(R>=0)z.splice(R,1);Q(L)},reject:(L)=>{if(U)return;U=!0,clearTimeout(W);let R=z.indexOf(H);if(R>=0)z.splice(R,1);q(L)}};z.push(H),W=setTimeout(()=>{H.reject(Error(`[WKWebView] ${J} timed out after ${X}ms`))},X);try{window.webkit.messageHandlers.craft.postMessage($)}catch(L){H.reject(L)}})}class FJ{_id;_listeners=new Map;_closed=!1;_domListeners=[];constructor(J){this._id=J,this._setupEventListeners()}get id(){return this._id}get isClosed(){return this._closed}_setupEventListeners(){if(typeof aJ<"u")["show","hide","focus","blur","minimize","maximize","unmaximize","restore","resize","move","close","closed","enter-fullscreen","leave-fullscreen","ready-to-show"].forEach(($)=>{let Z=(Y)=>{if(Y.detail?.windowId===this._id||!Y.detail?.windowId)this._emit($,Y.detail?.data)},X=`craft:window:${$}`;globalThis.window.addEventListener(X,Z),this._domListeners.push({type:X,handler:Z})})}_cleanupEventListeners(){if(typeof aJ<"u"){for(let{type:J,handler:$}of this._domListeners)globalThis.window.removeEventListener(J,$);this._domListeners=[]}}_emit(J,$){let Z=this._listeners.get(J);if(Z)Z.forEach((X)=>X($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>{this._listeners.get(J)?.delete($)}}once(J,$){let Z=(X)=>{this._listeners.get(J)?.delete(Z),$(X)};return this.on(J,Z)}off(J,$){this._listeners.get(J)?.delete($)}async show(){await this._call("show")}async hide(){await this._call("hide")}async toggle(){await this._call("toggle")}async focus(){await this._call("focus")}async blur(){await this._call("blur")}async minimize(){await this._call("minimize")}async maximize(){await this._call("maximize")}async unmaximize(){await this._call("unmaximize")}async restore(){await this._call("restore")}async close(){await this._call("close"),this._closed=!0,this._cleanupEventListeners()}async destroy(){await this._call("destroy"),this._closed=!0,this._cleanupEventListeners()}async setFullscreen(J=!0){await this._call("setFullscreen",{fullscreen:J})}async toggleFullscreen(){await this._call("toggleFullscreen")}async setTitle(J){await this._call("setTitle",{title:J})}async getTitle(){return this._call("getTitle")}async setSize(J,$,Z){await this._call("setSize",{width:J,height:$,animate:Z})}async getSize(){return this._call("getSize")}async setMinimumSize(J,$){await this._call("setMinimumSize",{width:J,height:$})}async setMaximumSize(J,$){await this._call("setMaximumSize",{width:J,height:$})}async setPosition(J,$,Z){await this._call("setPosition",{x:J,y:$,animate:Z})}async moveBy(J,$){await this._call("moveBy",{dx:J,dy:$})}async getPosition(){return this._call("getPosition")}async setBounds(J,$){await this._call("setBounds",{...J,animate:$})}async getBounds(){return this._call("getBounds")}async center(){await this._call("center")}async setAlwaysOnTop(J,$){await this._call("setAlwaysOnTop",{alwaysOnTop:J,level:$})}async isAlwaysOnTop(){return this._call("isAlwaysOnTop")}async setResizable(J){await this._call("setResizable",{resizable:J})}async isResizable(){return this._call("isResizable")}async setMovable(J){await this._call("setMovable",{movable:J})}async startDrag(){await this._call("startDrag")}async isMovable(){return this._call("isMovable")}async setMinSize(J,$){await this._call("setMinSize",{width:J,height:$})}async setMaxSize(J,$){await this._call("setMaxSize",{width:J,height:$})}async setOpacity(J){await this._call("setOpacity",{opacity:Math.max(0,Math.min(1,J))})}async getOpacity(){return this._call("getOpacity")}async setBackgroundColor(J){await this._call("setBackgroundColor",{color:J})}async getState(){return this._call("getState")}async setVibrancy(J){await this._call("setVibrancy",{vibrancy:J})}async setTrafficLightPosition(J){await this._call("setTrafficLightPosition",J)}async setWindowLevel(J){await this._call("setWindowLevel",{level:J})}async setHasShadow(J){await this._call("setHasShadow",{hasShadow:J})}async setBackgroundMaterial(J){await this._call("setBackgroundMaterial",{material:J})}async flashFrame(J){await this._call("flashFrame",{flash:J})}async setOverlayIcon(J,$){await this._call("setOverlayIcon",{icon:J,description:$})}async loadHTML(J){await this._call("loadHTML",{html:J})}async loadURL(J){await this._call("loadURL",{url:J})}async reload(){await this._call("reload")}async executeJavaScript(J){return this._call("executeJavaScript",{code:J})}async _call(J,$){if(N())return b(`window.${J}`,{type:"window",action:J,windowId:this._id,data:$});return D().request(`window.${J}`,{windowId:this._id,...$})}}class _8{_windows=new Map;_currentWindow=null;_idCounter=0;constructor(){if(typeof globalThis.window<"u")this._currentWindow=new FJ("main"),this._windows.set("main",this._currentWindow)}get current(){if(!this._currentWindow)this._currentWindow=new FJ("main"),this._windows.set("main",this._currentWindow);return this._currentWindow}get all(){return Array.from(this._windows.values())}get(J){return this._windows.get(J)}async create(J={}){let $=`window_${++this._idCounter}_${Date.now()}`;await D().request("window.create",{id:$,...J});let X=new FJ($);return this._windows.set($,X),X}async getFocused(){let $=await D().request("window.getFocused");return $?this._windows.get($)||null:null}show=()=>this.current.show();hide=()=>this.current.hide();toggle=()=>this.current.toggle();minimize=()=>this.current.minimize();maximize=()=>this.current.maximize();close=()=>this.current.close();focus=()=>this.current.focus();center=()=>this.current.center();setFullscreen=(J)=>this.current.setFullscreen(J);toggleFullscreen=()=>this.current.toggleFullscreen();setTitle=(J)=>this.current.setTitle(J);setSize=(J,$,Z)=>this.current.setSize(J,$,Z);setPosition=(J,$,Z)=>this.current.setPosition(J,$,Z);moveBy=(J,$)=>this.current.moveBy(J,$);setBounds=(J,$)=>this.current.setBounds(J,$);setAlwaysOnTop=(J)=>this.current.setAlwaysOnTop(J);setOpacity=(J)=>this.current.setOpacity(J);setBackgroundColor=(J)=>this.current.setBackgroundColor(J);setVibrancy=(J)=>this.current.setVibrancy(J);setResizable=(J)=>this.current.setResizable(J);startDrag=()=>this.current.startDrag();getState=()=>this.current.getState();on=(J,$)=>this.current.on(J,$);once=(J,$)=>this.current.once(J,$)}var yJ=new _8,gZ=yJ,aJ=yJ;function fZ(J={},$={}){let Z=typeof J==="string"?{...$,html:J}:J;return yJ.create(Z)}class jJ{_id;_options;_listeners=new Map;_menuHandlers=new Map;_destroyed=!1;_domListeners=[];constructor(J,$={}){this._id=J,this._options=$,this._setupEventListeners()}get id(){return this._id}get isDestroyed(){return this._destroyed}_isForThisTray(J){if(!J)return!0;let $=J.trayId??J.id;if($===void 0||$===null)return!0;return $===this._id}_addDomListener(J,$){if(typeof window>"u")return;window.addEventListener(J,$),this._domListeners.push({type:J,handler:$})}_setupEventListeners(){if(typeof window<"u")this._addDomListener("craft:tray:click",(J)=>{if(this._isForThisTray(J.detail))this._emit("click",J.detail)}),this._addDomListener("craft:tray:rightClick",(J)=>{if(this._isForThisTray(J.detail))this._emit("right-click",J.detail)}),this._addDomListener("craft:tray:doubleClick",(J)=>{if(this._isForThisTray(J.detail))this._emit("double-click",J.detail)}),this._addDomListener("craft:tray:menuAction",(J)=>{if(!this._isForThisTray(J.detail))return;let $=J.detail?.action;this._emit("menu-click",{menuId:$,action:$});let Z=this._menuHandlers.get($);if(Z)Z()}),this._addDomListener("craft:tray:dropFiles",(J)=>{if(this._isForThisTray(J.detail))this._emit("drop-files",{files:J.detail?.files||[]})}),this._addDomListener("craft:tray:dropText",(J)=>{if(this._isForThisTray(J.detail))this._emit("drop-text",{text:J.detail?.text||""})})}_teardownDomListeners(){if(typeof window>"u")return;for(let{type:J,handler:$}of this._domListeners)window.removeEventListener(J,$);this._domListeners=[]}_emit(J,$){let Z=this._listeners.get(J);if(Z)Z.forEach((X)=>X($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>{this._listeners.get(J)?.delete($)}}once(J,$){let Z=(X)=>{this._listeners.get(J)?.delete(Z),$(X)};return this.on(J,Z)}off(J,$){this._listeners.get(J)?.delete($)}async setTitle(J){this._options.title=J,await this._call("setTitle",J)}getTitle(){return this._options.title||""}async setIcon(J){this._options.icon=J,await this._call("setIcon",J)}async setTooltip(J){this._options.tooltip=J,await this._call("setTooltip",J)}async setMenu(J){this._options.menu=J;let $=(X)=>{return X.map((Y,Q)=>{let q={...Y};if(!q.id&&q.label)q.id=`menu_${Q}_${Date.now()}`;if(q.submenu)q.submenu=$(q.submenu);return q})},Z=$(J);await this._call("setMenu",JSON.stringify(Z))}async updateMenuItem(J,$){await this._call("updateMenuItem",JSON.stringify({id:J,updates:$}))}onMenuAction(J,$){return this._menuHandlers.set(J,$),()=>{this._menuHandlers.delete(J)}}async show(){await this._call("show","")}async hide(){await this._call("hide","")}async setHighlightMode(J){await this._call("setHighlightMode",J)}async displayBalloon(J){await this._call("displayBalloon",JSON.stringify(J))}async removeBalloon(){await this._call("removeBalloon","")}async getBounds(){return this._call("getBounds","")}async destroy(){await this._call("destroy",""),this._destroyed=!0,this._listeners.clear(),this._menuHandlers.clear(),this._teardownDomListeners()}onClickShowWindow(){return this.on("click",()=>{if(typeof window<"u"&&window.craft?.window?.show)window.craft.window.show()})}onClickToggleWindow(){return this.on("click",()=>{if(typeof window<"u"&&window.craft?.window?.toggle)window.craft.window.toggle()})}async _call(J,$){if(typeof window<"u"&&window.webkit?.messageHandlers?.craft)return new Promise((X,Y)=>{try{window.webkit.messageHandlers.craft.postMessage({type:"tray",action:J,data:typeof $==="string"?$:JSON.stringify($)}),X(void 0)}catch(Q){Y(Q)}});return D().request(`tray.${J}`,{data:$})}}class D8{_tray;_config;_windowVisible=!1;constructor(J={}){this._config={showWindowOnClick:!0,windowWidth:320,windowHeight:400,windowPosition:"trayBottomCenter",hideDockIcon:!0,...J},this._tray=new jJ("menubar",{title:J.title,icon:J.icon,tooltip:J.tooltip,menu:J.menu}),this._setupBehavior()}get tray(){return this._tray}get isWindowVisible(){return this._windowVisible}_setupBehavior(){if(this._config.showWindowOnClick)this._tray.on("click",()=>{this.toggleWindow()});if(this._config.hideDockIcon)this._hideDockIcon()}async _hideDockIcon(){if(typeof window<"u"&&window.craft?.app?.hideDockIcon)await window.craft.app.hideDockIcon()}async showWindow(){if(typeof window<"u"&&window.craft?.window?.show)await window.craft.window.show(),this._windowVisible=!0}async hideWindow(){if(typeof window<"u"&&window.craft?.window?.hide)await window.craft.window.hide(),this._windowVisible=!1}async toggleWindow(){if(this._windowVisible)await this.hideWindow();else await this.showWindow()}setTitle(J){return this._tray.setTitle(J)}setIcon(J){return this._tray.setIcon(J)}setMenu(J){return this._tray.setMenu(J)}onMenuAction(J,$){return this._tray.onMenuAction(J,$)}async quit(){if(typeof window<"u"&&window.craft?.app?.quit)await window.craft.app.quit()}}class M8{_trays=new Map;_mainTray=null;get main(){if(!this._mainTray)this._mainTray=new jJ("main"),this._trays.set("main",this._mainTray);return this._mainTray}create(J,$={}){let Z=new jJ(J,$);if(this._trays.set(J,Z),!this._mainTray)this._mainTray=Z;return Z}get(J){return this._trays.get(J)}async destroy(J){let $=this._trays.get(J);if($){if(await $.destroy(),this._trays.delete(J),this._mainTray?.id===J)this._mainTray=null}}async destroyAll(){for(let J of this._trays.values())await J.destroy();this._trays.clear(),this._mainTray=null}setTitle=(J)=>this.main.setTitle(J);setIcon=(J)=>this.main.setIcon(J);setTooltip=(J)=>this.main.setTooltip(J);setMenu=(J)=>this.main.setMenu(J);onMenuAction=(J,$)=>this.main.onMenuAction(J,$);onClick=(J)=>this.main.on("click",J);onRightClick=(J)=>this.main.on("right-click",J);onClickToggleWindow=()=>this.main.onClickToggleWindow()}var s$=new M8,mZ=s$;function pZ(J){return new D8(J)}function cZ(...J){return J}function dZ(){return{type:"separator"}}function lZ(J,$={}){return{label:J,type:"normal",...$}}function nZ(J,$,Z={}){return{label:J,type:"checkbox",checked:$,...Z}}function sZ(J,$,Z={}){return{label:J,type:"submenu",submenu:$,...Z}}class E8{_listeners=new Map;_shortcuts=new Map;_info=null;_preferences=null;_domListeners=[];_mediaQuery=null;_mediaQueryHandler=null;constructor(){this._setupEventListeners()}_addDomListener(J,$){if(typeof window>"u")return;window.addEventListener(J,$),this._domListeners.push({type:J,handler:$})}destroy(){if(typeof window<"u"){for(let{type:J,handler:$}of this._domListeners)window.removeEventListener(J,$);if(this._domListeners=[],this._mediaQuery&&this._mediaQueryHandler)this._mediaQuery.removeEventListener("change",this._mediaQueryHandler),this._mediaQuery=null,this._mediaQueryHandler=null}this._listeners.clear(),this._shortcuts.clear(),this._info=null,this._preferences=null}_setupEventListeners(){if(typeof window<"u"){["ready","activate","deactivate","will-quit","quit","before-quit","window-all-closed","open-file","open-url","theme-changed","accent-color-changed","display-added","display-removed","display-metrics-changed","power-suspend","power-resume","power-on-ac","power-on-battery","lock-screen","unlock-screen","user-did-become-active","user-did-resign-active"].forEach((Z)=>{let X=(Y)=>{if(Z==="theme-changed"||Z==="accent-color-changed"||Z==="display-added"||Z==="display-removed"||Z==="display-metrics-changed")this._preferences=null;this._emit(Z,Y.detail)};this._addDomListener(`craft:app:${Z}`,X)});let $=(Z)=>{let X=Z.detail?.accelerator,Y=this._shortcuts.get(X);if(Y)Y()};if(this._addDomListener("craft:shortcut",$),window.matchMedia)this._mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this._mediaQueryHandler=(Z)=>{this._preferences=null,this._emit("theme-changed",{theme:Z.matches?"dark":"light"})},this._mediaQuery.addEventListener("change",this._mediaQueryHandler)}}_emit(J,$){let Z=this._listeners.get(J);if(Z)Z.forEach((X)=>X($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>{this._listeners.get(J)?.delete($)}}once(J,$){let Z=(X)=>{this._listeners.get(J)?.delete(Z),$(X)};return this.on(J,Z)}off(J,$){this._listeners.get(J)?.delete($)}async quit(){await this._call("quit")}async exit(J=0){await this._call("exit",{code:J})}async relaunch(J){await this._call("relaunch",J)}async hide(){await this._call("hide")}async show(){await this._call("show")}async focus(){await this._call("focus")}async hideDockIcon(){await this._call("hideDockIcon")}async showDockIcon(){await this._call("showDockIcon")}async setBadge(J){await this._call("setBadge",{badge:J?.toString()??""})}async getBadge(){return this._call("getBadge")}async bounce(J="informational"){return this._call("bounce",{type:J})}async cancelBounce(J){await this._call("cancelBounce",{id:J})}async setDockIcon(J){await this._call("setDockIcon",{icon:J})}async getInfo(){if(!this._info)this._info=await this._call("getInfo");return this._info}async getName(){return(await this.getInfo()).name}async getVersion(){return(await this.getInfo()).version}async getAppPath(){return(await this.getInfo()).appPath}async getPath(J){return this._call("getPath",{name:J})}async getSystemPreferences(){if(!this._preferences)this._preferences=await this._call("getSystemPreferences");return this._preferences}async isDarkMode(){if(typeof window<"u"&&window.matchMedia)return window.matchMedia("(prefers-color-scheme: dark)").matches;return(await this.getSystemPreferences()).isDarkMode}async getAccentColor(){return(await this.getSystemPreferences()).accentColor}async isReducedMotion(){if(typeof window<"u"&&window.matchMedia)return window.matchMedia("(prefers-reduced-motion: reduce)").matches;return(await this.getSystemPreferences()).reducedMotion}async getLocale(){if(typeof navigator<"u")return navigator.language||"en-US";return(await this.getSystemPreferences()).locale}async getDisplays(){return this._call("getDisplays")}async getPrimaryDisplay(){return this._call("getPrimaryDisplay")}async getDisplayAtPoint(J,$){return this._call("getDisplayAtPoint",{x:J,y:$})}async notify(J){await this._call("notify",J)}async isNotificationSupported(){if(typeof Notification<"u")return Notification.permission!=="denied";return this._call("isNotificationSupported")}async registerShortcut(J,$){return this._shortcuts.set(J,$),this._call("registerShortcut",{accelerator:J})}async unregisterShortcut(J){this._shortcuts.delete(J),await this._call("unregisterShortcut",{accelerator:J})}async unregisterAllShortcuts(){this._shortcuts.clear(),await this._call("unregisterAllShortcuts")}async isShortcutRegistered(J){return this._call("isShortcutRegistered",{accelerator:J})}async setAppearance(J){await this._call("setAppearance",{appearance:J})}async getAppearance(){return this._call("getAppearance")}async startPowerSaveBlocker(J){return this._call("startPowerSaveBlocker",{type:J})}async stopPowerSaveBlocker(J){await this._call("stopPowerSaveBlocker",{id:J})}async isPowerSaveBlockerActive(J){return this._call("isPowerSaveBlockerActive",{id:J})}async getIdleTime(){return this._call("getIdleTime")}async setLoginItemSettings(J){await this._call("setLoginItemSettings",J)}async getLoginItemSettings(){return this._call("getLoginItemSettings")}async _call(J,$){if(N())return b(`app.${J}`,{type:"app",action:J,data:$});return D().request(`app.${J}`,$)}}var x=new E8,rZ=x,iZ=()=>x.quit(),oZ=()=>x.hide(),aZ=()=>x.focus(),tZ=()=>x.hideDockIcon(),eZ=()=>x.showDockIcon(),J9=(J)=>x.setBadge(J),$9=()=>x.getInfo(),Z9=()=>x.getVersion(),X9=()=>x.getName(),Y9=(J)=>x.getPath(J),Q9=()=>x.isDarkMode(),G9=()=>x.getLocale(),K9=(J)=>x.notify(J),q9=(J,$)=>x.registerShortcut(J,$),U9=(J)=>x.unregisterShortcut(J);function l(){if(typeof window<"u"&&window.craft?.fs)return window.craft.fs;return null}async function w(J,$){return D().request(J,$)}function k(J,$){if(typeof J!=="string"||J.length===0)throw Error("Invalid path: must be a non-empty string");if(J.includes("\x00"))throw Error("Invalid path: contains null byte");let Z=J;try{Z=decodeURIComponent(J)}catch{throw Error("Invalid path: malformed percent-encoding")}let X=Z.replace(/\\/g,"/").split("/");for(let Y of X)if(Y==="..")throw Error(`Path traversal detected: "${J}" contains a ".." segment`);if($){let Y=$.endsWith("/")?$:`${$}/`,Q=Z.startsWith("/")?Z:`${Y}${Z}`;if(!Q.startsWith(Y)&&Q!==$)throw Error(`Path escapes root: "${J}" not within "${$}"`)}}function r$(J){let $=[],Z=32768;for(let X=0;X<J.byteLength;X+=32768)$.push(String.fromCharCode(...J.subarray(X,X+32768)));if(typeof btoa==="function")return btoa($.join(""));return Buffer.from(J).toString("base64")}function i$(J){if(typeof atob==="function"){let $=atob(J),Z=new Uint8Array($.length);for(let X=0;X<$.length;X++)Z[X]=$.charCodeAt(X);return Z}return new Uint8Array(Buffer.from(J,"base64"))}var z9={async readFile(J){k(J);let $=l();if($)return $.readFile(J);if(typeof window<"u"&&window.craft)return w("fs.readFile",{path:J});let{readFile:Z}=await import("fs/promises");return Z(J,"utf-8")},async writeFile(J,$){k(J);let Z=l();if(Z)return Z.writeFile(J,$);if(typeof window<"u"&&window.craft){await w("fs.writeFile",{path:J,content:$});return}let{writeFile:X}=await import("fs/promises");return X(J,$,"utf-8")},async readDir(J){k(J);let $=(Y)=>Y.filter((Q)=>Q!=="."&&Q!==".."),Z=l();if(Z)return $(await Z.readDir(J));if(typeof window<"u"&&window.craft)return $(await w("fs.readDir",{path:J}));let{readdir:X}=await import("fs/promises");return $(await X(J))},async mkdir(J){k(J);let $=l();if($)return $.mkdir(J);if(typeof window<"u"&&window.craft){await w("fs.mkdir",{path:J});return}let{mkdir:Z}=await import("fs/promises");await Z(J,{recursive:!0})},async remove(J){k(J);let $=l();if($)return $.remove(J);if(typeof window<"u"&&window.craft){await w("fs.remove",{path:J});return}let{rm:Z}=await import("fs/promises");return Z(J,{recursive:!0,force:!0})},async exists(J){k(J);let $=l();if($)return $.exists(J);if(typeof window<"u"&&window.craft)return w("fs.exists",{path:J});let{access:Z}=await import("fs/promises");try{return await Z(J),!0}catch{return!1}}};async function W9(J){if(k(J),typeof window<"u"&&window.craft){let Z=await w("fs.readBinaryFile",{path:J});return i$(Z.data)}let{readFile:$}=await import("fs/promises");return $(J)}async function H9(J,$){if(k(J),typeof window<"u"&&window.craft){await w("fs.writeBinaryFile",{path:J,_binary:!0,data:r$($)});return}let{writeFile:Z}=await import("fs/promises");return Z(J,$)}async function V9(J){if(k(J),typeof window<"u"&&window.craft){let X=await w("fs.stat",{path:J});return{size:X.size,isFile:X.isFile,isDirectory:X.isDirectory,modifiedAt:new Date(X.modifiedAt),createdAt:new Date(X.createdAt)}}let{stat:$}=await import("fs/promises"),Z=await $(J);return{size:Z.size,isFile:Z.isFile(),isDirectory:Z.isDirectory(),modifiedAt:Z.mtime,createdAt:Z.birthtime}}async function L9(J,$){if(k(J),k($),typeof window<"u"&&window.craft){await w("fs.copy",{src:J,dest:$});return}let{cp:Z}=await import("fs/promises");return Z(J,$,{recursive:!0,dereference:!1,verbatimSymlinks:!0})}async function R9(J,$){if(k(J),k($),typeof window<"u"&&window.craft){await w("fs.move",{src:J,dest:$});return}let{rename:Z}=await import("fs/promises");return Z(J,$)}var tJ=!1;async function F9(J,$,Z={}){k(J);let X=Z.recursive??!0;if(typeof window<"u"&&window.craft){let U=typeof globalThis.crypto<"u"&&"randomUUID"in globalThis.crypto?globalThis.crypto.randomUUID():`${Date.now()}_${performance.now()}`;await w("fs.watch",{path:J,watchId:U,recursive:X});let z=(W)=>{if(W.detail.watchId===U)$(W.detail.eventType,W.detail.filename)};return window.addEventListener("craft:fs:watch",z),()=>{window.removeEventListener("craft:fs:watch",z),w("fs.unwatch",{watchId:U})}}let Y=await import("fs"),Q=typeof process<"u"?process.platform:"";if(X&&Q==="linux"&&!tJ)tJ=!0,console.warn("[Craft fs.watch] recursive watching is not supported by node:fs.watch on linux; only direct children of the path will fire events. Use the Craft bridge for true recursion.");let q=Y.watch(J,{recursive:X&&Q!=="linux"},(U,z)=>{if(z)$(U,z)});return()=>q.close()}async function WJ(J,$){return D().request(J,$)}var a$=/^\s*(?:--[^\n]*\n\s*)*(INSERT|UPDATE|DELETE|REPLACE|DROP|CREATE|ALTER|TRUNCATE|ATTACH|DETACH|VACUUM|REINDEX|PRAGMA)\b/i,t$=new o$().setMaxListeners(0),eJ=64;function HJ(J,$="identifier"){if(typeof J!=="string"||J.length===0)throw Error(`Invalid ${$} name: must be a non-empty string`);if(J.length>eJ)throw Error(`Invalid ${$} name: "${J.slice(0,16)}\u2026" exceeds ${eJ} characters`);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(J))throw Error(`Invalid ${$} name: "${J}". ${$} names must contain only letters, numbers, and underscores.`)}function e$(J){if(J===null||J===void 0)return"NULL";if(typeof J==="boolean")return J?"1":"0";if(typeof J==="number"){if(!Number.isFinite(J))throw Error(`Invalid DEFAULT: ${J} is not a finite number`);return String(J)}if(typeof J==="string")return`'${J.replace(/'/g,"''")}'`;throw Error(`Invalid DEFAULT: ${typeof J} cannot be encoded as a SQL literal`)}var j9={async execute(J,$){if(typeof window<"u"&&window.craft?.db)return window.craft.db.execute(J,$);throw Error("Database API not available. Must run in Craft environment.")},async query(J,$){if(typeof window<"u"&&window.craft?.db)return window.craft.db.query(J,$);throw Error("Database API not available. Must run in Craft environment.")},async beginTransaction(){if(typeof window<"u"&&window.craft?.db)return window.craft.db.beginTransaction();throw Error("Database API not available. Must run in Craft environment.")},async commit(){if(typeof window<"u"&&window.craft?.db)return window.craft.db.commit();throw Error("Database API not available. Must run in Craft environment.")},async rollback(){if(typeof window<"u"&&window.craft?.db)return window.craft.db.rollback();throw Error("Database API not available. Must run in Craft environment.")}};async function A9(J){let $=J.replace(/\\/g,"/");if($.includes("/../")||$.startsWith("../")||$.endsWith("/..")||$===".."||J.includes("\x00"))throw Error(`Invalid database name: "${J}" contains path traversal or invalid characters`);return new T8(J)}class T8{name;isOpen=!1;readOnly;_inTransactionHelper=!1;constructor(J,$){this.name=J,this.readOnly=$?.readOnly===!0}isReadOnly(){return this.readOnly}async open(){if(typeof window<"u"&&window.craft){await WJ("db.open",{name:this.name}),this.isOpen=!0;return}throw Error("Database API not available. Must run in Craft environment.")}async close(){if(typeof window<"u"&&window.craft){await WJ("db.close",{name:this.name}),this.isOpen=!1;return}throw Error("Database API not available. Must run in Craft environment.")}async execute(J,$){if(!this.isOpen)await this.open();if(t$.emit("db:execute",{name:this.name,sql:J,paramsCount:$?.length??0,readOnly:this.readOnly}),this.readOnly&&a$.test(J))throw Error(`Database "${this.name}" is read-only; rejected mutating statement: ${J.slice(0,64)}`);if(typeof window<"u"&&window.craft){let Z=await WJ("db.execute",{name:this.name,sql:J,params:$||[]});return{rowsAffected:Z.rowsAffected,lastInsertId:Z.lastInsertId}}throw Error("Database API not available. Must run in Craft environment.")}async query(J,$){if(!this.isOpen)await this.open();if(typeof window<"u"&&window.craft)return WJ("db.query",{name:this.name,sql:J,params:$||[]});throw Error("Database API not available. Must run in Craft environment.")}async get(J,$){let Z=await this.query(J,$);return Z.length>0?Z[0]:null}async transaction(J){if(this._inTransactionHelper)throw Error("[Craft DB] transaction() is already active on this connection. "+"Nested transactions are not supported \u2014 refactor inner code to take "+"an existing handle, or use SAVEPOINT directly.");this._inTransactionHelper=!0;try{await this.execute("BEGIN TRANSACTION");try{let $=await J();return await this.execute("COMMIT"),$}catch($){try{await this.execute("ROLLBACK")}catch(Z){if(console.error("[Craft DB] ROLLBACK failed after transaction error:",Z),$ instanceof Error)$.cause=Z}throw $}}finally{this._inTransactionHelper=!1}}async createTable(J,$){HJ(J,"table");let Z=$.map((Y)=>{HJ(Y.name,"column");let Q=`${Y.name} ${Y.type}`;if(Y.primaryKey)Q+=" PRIMARY KEY";if(Y.autoIncrement)Q+=" AUTOINCREMENT";if(Y.notNull)Q+=" NOT NULL";if(Y.unique)Q+=" UNIQUE";if(Y.default!==void 0)Q+=` DEFAULT ${e$(Y.default)}`;return Q}),X=`CREATE TABLE IF NOT EXISTS ${J} (${Z.join(", ")})`;await this.execute(X)}async dropTable(J){HJ(J,"table"),await this.execute(`DROP TABLE IF EXISTS ${J}`)}async tableExists(J){return HJ(J,"table"),(await this.query("SELECT name FROM sqlite_master WHERE type='table' AND name=?",[J])).length>0}}class J0{db;tableName;constructor(J,$="kv_store"){this.db=J,this.tableName=$}async init(){await this.db.createTable(this.tableName,[{name:"key",type:"TEXT",primaryKey:!0},{name:"value",type:"TEXT"},{name:"updated_at",type:"INTEGER"}])}async get(J){let $=await this.db.get(`SELECT value FROM ${this.tableName} WHERE key = ?`,[J]);if($)try{return JSON.parse($.value)}catch(Z){return console.debug("[Craft DB] Failed to parse stored value for key, returning raw:",Z),$.value}return null}async set(J,$){let Z=JSON.stringify($);await this.db.execute(`INSERT OR REPLACE INTO ${this.tableName} (key, value, updated_at) VALUES (?, ?, ?)`,[J,Z,Date.now()])}async delete(J){await this.db.execute(`DELETE FROM ${this.tableName} WHERE key = ?`,[J])}async has(J){return await this.db.get(`SELECT key FROM ${this.tableName} WHERE key = ?`,[J])!==null}async keys(){return(await this.db.query(`SELECT key FROM ${this.tableName}`)).map(($)=>$.key)}async clear(){await this.db.execute(`DELETE FROM ${this.tableName}`)}}function $0(J){if(J===void 0||J===null)return{kind:"none",value:void 0};if(typeof J==="string")return{kind:"string",value:J};if(J instanceof ArrayBuffer)return{kind:"binary",value:J};if(ArrayBuffer.isView(J))return{kind:"binary",value:J};if(typeof Blob<"u"&&J instanceof Blob)return{kind:"binary",value:J};if(typeof FormData<"u"&&J instanceof FormData)return{kind:"form",value:J};if(typeof URLSearchParams<"u"&&J instanceof URLSearchParams)return{kind:"form",value:J};if(typeof ReadableStream<"u"&&J instanceof ReadableStream)return{kind:"binary",value:J};if(J!==null&&typeof J==="object"&&J[Symbol.asyncIterator]!==void 0)return{kind:"binary",value:J};return{kind:"json",value:JSON.stringify(J)}}function Z0(J,$){let Z=$.toLowerCase();for(let X of Object.keys(J))if(X.toLowerCase()===Z)return!0;return!1}var X0={async fetch(J,$){if(typeof window<"u"&&window.craft?.http)return window.craft.http.fetch(J,$);return globalThis.fetch(J,$)},async download(J,$,Z){if(typeof window<"u"&&window.craft?.http){let X=Z,Y=Z?(Q)=>X?.(Q):void 0;try{return await window.craft.http.download(J,$,Y)}finally{X=void 0}}throw Error("Download API requires Craft environment")},async upload(J,$,Z){if(typeof window<"u"&&window.craft?.http){let X=Z,Y=Z?(Q)=>X?.(Q):void 0;try{return await window.craft.http.upload(J,$,Y)}finally{X=void 0}}throw Error("Upload API requires Craft environment")}};class N8{baseUrl;defaultHeaders;timeout;constructor(J={}){this.baseUrl=J.baseUrl||"",this.defaultHeaders=J.headers||{},this.timeout=J.timeout||30000}async get(J,$){return this.request("GET",J,$)}async post(J,$,Z){return this.request("POST",J,{...Z,body:$})}async put(J,$,Z){return this.request("PUT",J,{...Z,body:$})}async patch(J,$,Z){return this.request("PATCH",J,{...Z,body:$})}async delete(J,$){return this.request("DELETE",J,$)}async head(J,$){return this.request("HEAD",J,$)}async request(J,$,Z={}){let X=this.buildUrl($,Z.params),Y={...this.defaultHeaders,...Z.headers},Q=$0(Z.body);if(Q.kind==="json"&&!Z0(Y,"content-type"))Y["Content-Type"]="application/json";let q=Z.timeout||this.timeout,U=new AbortController,z=setTimeout(()=>U.abort(),q);try{let W=await X0.fetch(X,{method:J,headers:Y,body:Q.value,signal:U.signal,...typeof Z.timeout==="number"||typeof this.timeout==="number"?{timeoutMs:q}:{}}),H,L=W.headers.get("content-type")??"";if(L.includes("application/json"))try{H=await W.json()}catch{H=await W.text()}else if(L.startsWith("text/"))H=await W.text();else if(L.includes("octet-stream")||L.startsWith("image/")||L.startsWith("audio/")||L.startsWith("video/")||L.startsWith("application/"))H=await W.arrayBuffer();else if(W.body===null)H=null;else H=await W.text();return{data:H,status:W.status,statusText:W.statusText,headers:Object.fromEntries(W.headers.entries()),ok:W.ok}}catch(W){if(W instanceof Error&&W.name==="AbortError")throw new B8("Request timeout",0,"TIMEOUT");throw W}finally{clearTimeout(z)}}buildUrl(J,$){let Z=J.startsWith("http")?J:`${this.baseUrl}${J}`;if($){let X=new URLSearchParams;for(let[Q,q]of Object.entries($))X.append(Q,String(q));let Y=X.toString();if(Y)Z+=(Z.includes("?")?"&":"?")+Y}return Z}setHeader(J,$){this.defaultHeaders[J]=$}removeHeader(J){delete this.defaultHeaders[J]}setBearerToken(J){this.setHeader("Authorization",`Bearer ${J}`)}}class B8 extends Error{status;code;constructor(J,$,Z="HTTP_ERROR"){super(J);this.name="HttpError",this.status=$,this.code=Z}}class Y0{ws=null;url;reconnectAttempts=0;maxReconnectAttempts;reconnectDelay;handlers=new Map;messageHandler=null;constructor(J,$={}){this.url=J,this.maxReconnectAttempts=$.maxReconnectAttempts||5,this.reconnectDelay=$.reconnectDelay||1000}connect(){return new Promise((J,$)=>{this.ws=new WebSocket(this.url),this.ws.onopen=()=>{this.reconnectAttempts=0,J()},this.ws.onerror=(Z)=>{$(Error("WebSocket connection failed"))},this.ws.onclose=()=>{this.attemptReconnect()},this.messageHandler=(Z)=>{try{let X=JSON.parse(Z.data),Y=X.type||"message",Q=this.handlers.get(Y);if(Q)Q.forEach((q)=>q(X.payload||X))}catch{let X=this.handlers.get("message");if(X)X.forEach((Y)=>Y(Z.data))}},this.ws.onmessage=this.messageHandler})}disconnect(){if(this.maxReconnectAttempts=0,this.ws)this.ws.close(),this.ws=null}send(J,$){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw Error("WebSocket not connected");this.ws.send(JSON.stringify({type:J,payload:$}))}sendRaw(J){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw Error("WebSocket not connected");this.ws.send(J)}on(J,$){if(!this.handlers.has(J))this.handlers.set(J,new Set);return this.handlers.get(J).add($),()=>{this.handlers.get(J)?.delete($)}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts++;let J=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);setTimeout(()=>{this.connect().catch(()=>{})},J)}get connected(){return this.ws?.readyState===WebSocket.OPEN}}function _9(J){return new N8(J)}class g extends Error{name="CraftCryptoError";cause;constructor(J,$){super(J,$);if($&&"cause"in $)this.cause=$.cause}}class x8 extends g{name="LegacyCiphertextError";constructor(){super("Ciphertext was produced by a pre-versioning Craft crypto release. Re-encrypt the value with the current API to migrate to the v1 wire format.")}}var J8=1,n=16,VJ=12,PJ=16,AJ=600000,ZJ={async randomBytes(J){if(typeof window<"u"&&window.craft?.crypto)return window.craft.crypto.randomBytes(J);if(typeof globalThis.crypto<"u"&&typeof globalThis.crypto.getRandomValues==="function"){let Z=new Uint8Array(J),X=65536;for(let Y=0;Y<J;Y+=65536){let Q=Z.subarray(Y,Math.min(Y+65536,J));globalThis.crypto.getRandomValues(Q)}return Z}let{randomBytes:$}=await import("crypto");return new Uint8Array($(J))},async hash(J,$){if(typeof window<"u"&&window.craft?.crypto)return window.craft.crypto.hash(J,$);if(J==="md5"){if(!(typeof process<"u"&&process.versions?.node))throw new g("MD5 is not available in this runtime \u2014 WebCrypto does not implement it. "+"Use sha256/sha512, or call this from Node.");let{createHash:Y}=await import("crypto");return Y("md5").update($).digest("hex")}if(typeof globalThis.crypto<"u"&&globalThis.crypto.subtle){let Y=new TextEncoder().encode($),Q=await globalThis.crypto.subtle.digest(J==="sha256"?"SHA-256":"SHA-512",Y);return S8(Q)}let{createHash:Z}=await import("crypto");return Z(J).update($).digest("hex")},async encrypt(J,$){if(typeof window<"u"&&window.craft?.crypto)return window.craft.crypto.encrypt(J,$);let Z=await ZJ.randomBytes(n),X=await ZJ.randomBytes(VJ),Y=await $8($,Z),Q=await Q0(Y,X,new TextEncoder().encode(J)),q=new Uint8Array(1+Z.length+X.length+Q.length);return q[0]=J8,q.set(Z,1),q.set(X,1+Z.length),q.set(Q,1+Z.length+X.length),OJ(q.buffer)},async decrypt(J,$){if(typeof window<"u"&&window.craft?.crypto)return window.craft.crypto.decrypt(J,$);let Z=k8(J);if(Z.length<1+n+VJ+PJ)throw new g("Ciphertext too short to be valid");if(Z[0]!==J8)throw new x8;let Y=Z.slice(1,1+n),Q=Z.slice(1+n,1+n+VJ),q=Z.slice(1+n+VJ),U=await $8($,Y);try{let z=await G0(U,Q,q);return new TextDecoder().decode(z)}catch(z){throw new g("Decryption failed (wrong key or corrupted data)",{cause:z})}}};function a(J){return J}async function $8(J,$){if(typeof globalThis.crypto<"u"&&globalThis.crypto.subtle){let X=new TextEncoder,Y=await globalThis.crypto.subtle.importKey("raw",X.encode(J),"PBKDF2",!1,["deriveKey"]);return globalThis.crypto.subtle.deriveKey({name:"PBKDF2",salt:a($),iterations:AJ,hash:"SHA-256"},Y,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}let{pbkdf2Sync:Z}=await import("crypto");return new Uint8Array(Z(J,$,AJ,32,"sha256"))}async function Q0(J,$,Z){if(J instanceof Uint8Array){let{createCipheriv:Y}=await import("crypto"),Q=Y("aes-256-gcm",J,$),q=Q.update(Z),U=Q.final(),z=Q.getAuthTag(),W=new Uint8Array(q.length+U.length+z.length);return W.set(q,0),W.set(U,q.length),W.set(z,q.length+U.length),W}let X=await globalThis.crypto.subtle.encrypt({name:"AES-GCM",iv:a($)},J,a(Z));return new Uint8Array(X)}async function G0(J,$,Z){if(J instanceof Uint8Array){let{createDecipheriv:Y}=await import("crypto"),Q=Z.subarray(Z.length-PJ),q=Z.subarray(0,Z.length-PJ),U=Y("aes-256-gcm",J,$);U.setAuthTag(Q);let z=U.update(q),W=U.final(),H=new Uint8Array(z.length+W.length);return H.set(z,0),H.set(W,z.length),H}let X=await globalThis.crypto.subtle.decrypt({name:"AES-GCM",iv:a($)},J,a(Z));return new Uint8Array(X)}function S8(J){return Array.from(new Uint8Array(J)).map(($)=>$.toString(16).padStart(2,"0")).join("")}function OJ(J){let $=new Uint8Array(J),Z=[],X=8192;for(let Y=0;Y<$.byteLength;Y+=8192)Z.push(String.fromCharCode(...$.subarray(Y,Y+8192)));if(typeof btoa<"u")return btoa(Z.join(""));return Buffer.from($).toString("base64")}function k8(J){if(typeof atob<"u"){let $;try{$=atob(J)}catch(X){throw new g("Invalid base64 input",{cause:X})}let Z=new Uint8Array($.length);for(let X=0;X<$.length;X++)Z[X]=$.charCodeAt(X);return Z}return new Uint8Array(Buffer.from(J,"base64"))}function D9(){if(typeof globalThis.crypto<"u"&&"randomUUID"in globalThis.crypto)return globalThis.crypto.randomUUID();let J=new Uint8Array(16);globalThis.crypto.getRandomValues(J),J[6]=J[6]&15|64,J[8]=J[8]&63|128;let $=Array.from(J,(Z)=>Z.toString(16).padStart(2,"0")).join("");return`${$.slice(0,8)}-${$.slice(8,12)}-${$.slice(12,16)}-${$.slice(16,20)}-${$.slice(20,32)}`}async function M9(J,$){let Z=$??"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";if(Z.length===0)throw new g("randomString: charset cannot be empty");if(!Number.isInteger(J)||J<0)throw new g("randomString: length must be a non-negative integer");if(J===0)return"";let X=256-256%Z.length,Y=await ZJ.randomBytes(J*2),Q="",q=0;while(Q.length<J){if(q>=Y.length)Y=await ZJ.randomBytes(J*2),q=0;if(Y[q]<X)Q+=Z[Y[q]%Z.length];q++}return Q}async function E9(J,$,Z){if(typeof globalThis.crypto<"u"&&globalThis.crypto.subtle){let Y=new TextEncoder,Q=await globalThis.crypto.subtle.importKey("raw",Y.encode($),{name:"HMAC",hash:J==="sha256"?"SHA-256":"SHA-512"},!1,["sign"]),q=await globalThis.crypto.subtle.sign("HMAC",Q,Y.encode(Z));return S8(q)}return(await import("crypto")).createHmac(J,$).update(Z).digest("hex")}function K0(J,$){let Z=new TextEncoder,X=Z.encode(J),Y=Z.encode($),Q=Math.max(X.length,Y.length),q=X.length^Y.length;for(let U=0;U<Q;U++)q|=(X[U]??0)^(Y[U]??0);return q===0}async function q0(J,$){let Z;if($)try{Z=k8($)}catch(Q){throw new g("hashPassword: salt must be base64-encoded",{cause:Q})}else Z=await ZJ.randomBytes(16);let X=OJ(Z.buffer.slice(Z.byteOffset,Z.byteOffset+Z.byteLength));if(typeof globalThis.crypto<"u"&&globalThis.crypto.subtle){let Q=new TextEncoder,q=await globalThis.crypto.subtle.importKey("raw",Q.encode(J),"PBKDF2",!1,["deriveBits"]),U=await globalThis.crypto.subtle.deriveBits({name:"PBKDF2",salt:a(Z),iterations:AJ,hash:"SHA-256"},q,256);return{hash:OJ(U),salt:X}}let{pbkdf2:Y}=await import("crypto");return new Promise((Q,q)=>{Y(J,Z,AJ,32,"sha256",(U,z)=>{if(U)q(U);else Q({hash:OJ(z.buffer.slice(z.byteOffset,z.byteOffset+z.byteLength)),salt:X})})})}async function T9(J,$,Z){let X=await q0(J,Z);return K0(X.hash,$)}async function m(J,$){return D().request(J,$)}var p=typeof process<"u"?process.env:{},N9=new Proxy(p,{get(J,$){return p[$]},set(J,$,Z){return p[$]=Z,!0},deleteProperty(J,$){return delete p[$],!0},ownKeys(){return Reflect.ownKeys(p)},getOwnPropertyDescriptor(J,$){return Object.getOwnPropertyDescriptor(p,$)},has(J,$){return $ in p}});function G(){if(typeof globalThis<"u"){let J=globalThis;if(J.craft?._platform)return J.craft._platform;if(J.__CRAFT_PLATFORM__)return J.__CRAFT_PLATFORM__}if(typeof process<"u"&&process.platform)return process.platform;if(typeof navigator<"u"&&typeof navigator.userAgent==="string"){let J=navigator.userAgent.toLowerCase();if(J.includes("iphone")||J.includes("ipad"))return"ios";if(J.includes("android"))return"android";if(J.includes("mac"))return"darwin";if(J.includes("win"))return"win32";if(J.includes("linux"))return"linux"}return"unknown"}function B9(){let J=G();return J==="darwin"||J==="macos"||J==="win32"||J==="windows"||J==="linux"}function x9(){let J=G();return J==="ios"||J==="android"}function K(){return typeof window<"u"&&typeof window.craft<"u"}async function S9(){if(typeof window<"u"&&window.craft)return m("process.getSystemInfo");if(typeof process<"u"){let $=await import("os");return{platform:process.platform,arch:process.arch,osVersion:$.release(),hostname:$.hostname(),cpuCount:$.cpus().length,totalMemory:$.totalmem(),freeMemory:$.freemem(),uptime:$.uptime()}}let J=typeof navigator<"u"&&typeof navigator.hardwareConcurrency==="number"?navigator.hardwareConcurrency:1;return{platform:G(),arch:"unknown",osVersion:"unknown",hostname:"unknown",cpuCount:J,totalMemory:0,freeMemory:0,uptime:0}}async function k9(J,$){if(typeof window<"u"&&window.craft)return m("process.exec",{command:J,...$});let{exec:Z}=await import("child_process"),{promisify:X}=await import("util"),Y=X(Z);try{let{stdout:Q,stderr:q}=await Y(J,{cwd:$?.cwd,env:$?.env?{...process.env,...$.env}:void 0,timeout:$?.timeout,maxBuffer:$?.maxBuffer||1048576});return{stdout:Q,stderr:q,exitCode:0}}catch(Q){return{stdout:Q.stdout||"",stderr:Q.stderr||Q.message,exitCode:Q.code||1}}}class I8{command;args;options;processId=null;onStdoutHandlers=[];onStderrHandlers=[];onExitHandlers=[];domListeners=[];exited=!1;constructor(J,$=[],Z={}){this.command=J,this.args=$,this.options=Z}addDomListener(J,$){if(typeof window>"u")return;window.addEventListener(J,$),this.domListeners.push({type:J,handler:$})}removeDomListeners(){if(typeof window>"u")return;for(let{type:J,handler:$}of this.domListeners)window.removeEventListener(J,$);this.domListeners=[]}get pid(){return this.processId}async start(){if(typeof window<"u"&&window.craft){let J=await m("process.spawn",{command:this.command,args:this.args,...this.options});this.processId=J.pid;let $=(Y)=>{if(Y.detail.pid===this.processId)this.onStdoutHandlers.forEach((Q)=>Q(Y.detail.data))},Z=(Y)=>{if(Y.detail.pid===this.processId)this.onStderrHandlers.forEach((Q)=>Q(Y.detail.data))},X=(Y)=>{if(Y.detail.pid===this.processId)this.exited=!0,this.onExitHandlers.forEach((Q)=>Q(Y.detail.code)),this.removeDomListeners()};this.addDomListener("craft:process:stdout",$),this.addDomListener("craft:process:stderr",Z),this.addDomListener("craft:process:exit",X);return}throw Error("spawn() requires Craft environment")}async write(J){if(typeof window<"u"&&window.craft&&this.processId)await m("process.stdin",{pid:this.processId,data:J})}async kill(J="SIGTERM"){if(typeof window<"u"&&window.craft&&this.processId){if(await m("process.kill",{pid:this.processId,signal:J}),this.exited)this.removeDomListeners()}}onStdout(J){return this.onStdoutHandlers.push(J),()=>{let $=this.onStdoutHandlers.indexOf(J);if($>=0)this.onStdoutHandlers.splice($,1)}}onStderr(J){return this.onStderrHandlers.push(J),()=>{let $=this.onStderrHandlers.indexOf(J);if($>=0)this.onStderrHandlers.splice($,1)}}onExit(J){return this.onExitHandlers.push(J),()=>{let $=this.onExitHandlers.indexOf(J);if($>=0)this.onExitHandlers.splice($,1)}}}function I9(J,$,Z){return new I8(J,$,Z)}function w9(){if(typeof process<"u")return process.cwd();return"/"}async function P9(){if(typeof window<"u"&&window.craft)return m("process.homeDir");if(typeof process<"u")return(await import("os")).homedir();return"/"}async function C9(){if(typeof window<"u"&&window.craft)return m("process.tempDir");if(typeof process<"u")return(await import("os")).tmpdir();return"/tmp"}function b9(J=0){if(typeof window<"u"){let $=window.craft?.app;if($&&typeof $.quit==="function"){$.quit(J);return}}if(typeof process<"u"&&typeof process.exit==="function")process.exit(J)}function v9(){if(typeof process<"u")return process.argv;return[]}async function y9(J){if(typeof window<"u"&&window.craft){await m("process.open",{target:J});return}let $=G(),{execFile:Z}=await import("child_process"),{promisify:X}=await import("util"),Y=X(Z);switch($){case"darwin":case"macos":await Y("open",[J]);return;case"win32":case"windows":await Y("cmd.exe",["/c","start",'""',J]);return;case"linux":await Y("xdg-open",[J]);return;default:throw Error(`Unsupported platform: ${$}`)}}var Z8="__craft_web_device_id__";function U0(){if(typeof globalThis<"u"&&globalThis.localStorage)try{let J=globalThis.localStorage,$=J.getItem(Z8);if($&&/^web-[0-9a-f-]+$/i.test($))return $;let Z=`web-${wJ()}`;return J.setItem(Z8,Z),Z}catch{}return`web-${wJ()}`}var h9={async getInfo(){let J=A();if(typeof window<"u"&&J?.device)return J.device.getInfo();return{platform:LJ(),osVersion:"unknown",model:"unknown",manufacturer:"unknown",deviceId:U0(),isTablet:!1,screen:{width:typeof window<"u"?window.innerWidth||0:0,height:typeof window<"u"?window.innerHeight||0:0,scale:typeof window<"u"?window.devicePixelRatio||1:1},battery:{level:100,isCharging:!1},network:{type:"wifi",isConnected:typeof navigator<"u"?navigator.onLine??!0:!0}}},async getCapabilities(){let J=A();if(typeof window<"u"&&J?.device)return J.device.getCapabilities();return{camera:!0,biometrics:!1,nfc:!1,bluetooth:!1,gps:"geolocation"in navigator,accelerometer:!1,gyroscope:!1,haptics:"vibrate"in navigator,ar:!1,faceId:!1,touchId:!1}},isMobile(){let J=LJ();return J==="ios"||J==="android"},isIOS(){return LJ()==="ios"},isAndroid(){return LJ()==="android"},getLocale(){return navigator?.language||"en-US"},getTimezone(){return Intl.DateTimeFormat().resolvedOptions().timeZone}},u9={async impact(J="medium"){let $=A();if(typeof window<"u"&&$?.haptics)return $.haptics.impact(J);if("vibrate"in navigator){let Z={light:10,medium:20,heavy:30,soft:5,rigid:25}[J];navigator.vibrate(Z)}},async notification(J="success"){let $=A();if(typeof window<"u"&&$?.haptics)return $.haptics.notification(J);if("vibrate"in navigator){let Z={success:[10,30,10],warning:[30,30,30],error:[50,50,50,50,50]};navigator.vibrate(Z[J])}},async selection(){let J=A();if(typeof window<"u"&&J?.haptics)return J.haptics.selection();if("vibrate"in navigator)navigator.vibrate(5)},async vibrate(J){let $=A();if(typeof window<"u"&&$?.haptics)return $.haptics.vibrate(J);if("vibrate"in navigator)navigator.vibrate(J)}},g9={async check(J){let $=A();if(typeof window<"u"&&$?.permissions)return $.permissions.check(J);try{let Z=z0(J);if(Z&&navigator.permissions){let X=await navigator.permissions.query({name:Z});return W0(X.state)}}catch{}return"undetermined"},async request(J){let $=A();if(typeof window<"u"&&$?.permissions)return $.permissions.request(J);try{if(J==="camera"||J==="microphone"){let Z={};if(J==="camera")Z.video=!0;if(J==="microphone")Z.audio=!0;return(await navigator.mediaDevices.getUserMedia(Z)).getTracks().forEach((Y)=>Y.stop()),"granted"}if(J==="location")return new Promise((Z)=>{navigator.geolocation.getCurrentPosition(()=>Z("granted"),()=>Z("denied"))});if(J==="notifications")return await Notification.requestPermission()==="granted"?"granted":"denied"}catch{return"denied"}return"undetermined"},async checkMultiple(J){let $={};for(let Z of J)$[Z]=await this.check(Z);return $},async requestMultiple(J){let $={};for(let Z of J)$[Z]=await this.request(Z);return $},async openSettings(){let J=A();if(typeof window<"u"&&J?.permissions)return J.permissions.openSettings()}},f9={async takePicture(J={}){let $=A();if(typeof window<"u"&&$?.camera)return $.camera.takePicture(J);throw Error("Camera API not available. Must run in Craft environment.")},async pickImage(){let J=A();if(typeof window<"u"&&J?.camera)return J.camera.pickImage();return new Promise(($,Z)=>{let X=document.createElement("input");X.type="file",X.accept="image/*",X.onchange=async()=>{let Y=X.files?.[0];if(Y){let Q=new FileReader;Q.onload=()=>{let q=Q.result.split(",")[1];$({base64:q,uri:URL.createObjectURL(Y),width:0,height:0,mimeType:Y.type})},Q.onerror=()=>Z(Error("Failed to read file")),Q.readAsDataURL(Y)}else Z(Error("No file selected"))},X.click()})},async pickMultiple(J={}){let $=A();if(typeof window<"u"&&$?.camera)return $.camera.pickMultiple(J);throw Error("Camera API not available. Must run in Craft environment.")},async isAvailable(){let J=A();if(typeof window<"u"&&J?.camera)return J.camera.isAvailable();try{return(await navigator.mediaDevices.enumerateDevices()).some((Z)=>Z.kind==="videoinput")}catch{return!1}}},m9={async isAvailable(){let J=A();if(typeof window<"u"&&J?.biometrics)return J.biometrics.isAvailable();return!1},async getBiometricType(){let J=A();if(typeof window<"u"&&J?.biometrics)return J.biometrics.getBiometricType();return null},async authenticate(J){let $=A();if(typeof window<"u"&&$?.biometrics)return $.biometrics.authenticate(J);throw Error("Biometrics not available")}},p9={async set(J,$){let Z=A();if(typeof window<"u"&&Z?.secureStorage)return Z.secureStorage.set(J,$);localStorage.setItem(`secure_${J}`,$)},async get(J){let $=A();if(typeof window<"u"&&$?.secureStorage)return $.secureStorage.get(J);return localStorage.getItem(`secure_${J}`)},async delete(J){let $=A();if(typeof window<"u"&&$?.secureStorage)return $.secureStorage.delete(J);localStorage.removeItem(`secure_${J}`)},async clear(){let J=A();if(typeof window<"u"&&J?.secureStorage)return J.secureStorage.clear();Object.keys(localStorage).filter(($)=>$.startsWith("secure_")).forEach(($)=>localStorage.removeItem($))}},c9={async getCurrentPosition(J={}){let $=A();if(typeof window<"u"&&$?.location)return $.location.getCurrentPosition(J);return new Promise((Z,X)=>{navigator.geolocation.getCurrentPosition((Y)=>Z({latitude:Y.coords.latitude,longitude:Y.coords.longitude,altitude:Y.coords.altitude??void 0,accuracy:Y.coords.accuracy,heading:Y.coords.heading??void 0,speed:Y.coords.speed??void 0,timestamp:Y.timestamp}),X,{enableHighAccuracy:J.enableHighAccuracy,timeout:J.timeout,maximumAge:J.maximumAge})})},watchPosition(J,$={}){let Z=A();if(typeof window<"u"&&Z?.location)return Z.location.watchPosition(J,$);return navigator.geolocation.watchPosition((X)=>J({latitude:X.coords.latitude,longitude:X.coords.longitude,altitude:X.coords.altitude??void 0,accuracy:X.coords.accuracy,heading:X.coords.heading??void 0,speed:X.coords.speed??void 0,timestamp:X.timestamp}),console.error,{enableHighAccuracy:$.enableHighAccuracy,timeout:$.timeout,maximumAge:$.maximumAge})},clearWatch(J){let $=A();if(typeof window<"u"&&$?.location)return $.location.clearWatch(J);navigator.geolocation.clearWatch(J)}},d9={async share(J){let $=A();if(typeof window<"u"&&$?.share)return $.share.share(J);if(navigator.share)await navigator.share({title:J.title,text:J.text,url:J.url});else throw Error("Share API not available")},isAvailable(){let J=A();if(typeof window<"u"&&J?.share)return!0;return"share"in navigator}},l9={getState(){let J=A();if(typeof window<"u"&&J?.lifecycle)return J.lifecycle.getState();return document.visibilityState==="visible"?"active":"background"},onStateChange(J){let $=A();if(typeof window<"u"&&$?.lifecycle)return $.lifecycle.onStateChange(J);let Z=()=>{J(document.visibilityState==="visible"?"active":"background")};return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)}},n9={async show(J){let $=A();if(typeof window<"u"&&$?.notifications)return $.notifications.show(J);if("Notification"in window&&Notification.permission==="granted")new Notification(J.title,{body:J.body})},async schedule(J){let $=A();if(typeof window<"u"&&$?.notifications)return $.notifications.schedule(J);throw Error("Scheduled notifications not available in web")},async cancelAll(){let J=A();if(typeof window<"u"&&J?.notifications)return J.notifications.cancelAll()},async setBadge(J){let $=A();if(typeof window<"u"&&$?.notifications)return $.notifications.setBadge(J)}};function LJ(){if(typeof window>"u")return"linux";let J=navigator.userAgent.toLowerCase();if(/iphone|ipad|ipod/.test(J))return"ios";if(/android/.test(J))return"android";if(/macintosh|mac os x/.test(J))return"macos";if(/windows/.test(J))return"windows";return"linux"}function z0(J){return{camera:"camera",microphone:"microphone",location:"geolocation",notifications:"notifications"}[J]||null}function W0(J){return{granted:"granted",denied:"denied",prompt:"undetermined"}[J]}function A(){if(typeof window<"u")return window.craft;return}var s9={async isAvailable(){if(!K()||G()!=="ios")return!1;return window.craft?.carplay?.isAvailable?.()??!1},async isConnected(){if(!K()||G()!=="ios")return!1;return window.craft?.carplay?.isConnected?.()??!1},onConnect(J){if(!K()||G()!=="ios")return;window.craft?.carplay?.onConnect?.(J)},onDisconnect(J){if(!K()||G()!=="ios")return;window.craft?.carplay?.onDisconnect?.(J)},async pushTemplate(J,$=!0){if(!K()||G()!=="ios")return;return window.craft?.carplay?.pushTemplate?.(J,$)},async popTemplate(J=!0){if(!K()||G()!=="ios")return;return window.craft?.carplay?.popTemplate?.(J)},async popToRootTemplate(J=!0){if(!K()||G()!=="ios")return;return window.craft?.carplay?.popToRootTemplate?.(J)},async presentTemplate(J,$=!0){if(!K()||G()!=="ios")return;return window.craft?.carplay?.presentTemplate?.(J,$)},async dismissTemplate(J=!0){if(!K()||G()!=="ios")return;return window.craft?.carplay?.dismissTemplate?.(J)},onSelectListItem(J){if(!K()||G()!=="ios")return;window.craft?.carplay?.onSelectListItem?.(J)},onSelectGridItem(J){if(!K()||G()!=="ios")return;window.craft?.carplay?.onSelectGridItem?.(J)},async updateNowPlaying(J){if(!K()||G()!=="ios")return;return window.craft?.carplay?.updateNowPlaying?.(J)}},r9={isAppClip(){if(!K()||G()!=="ios")return!1;return window.craft?.appClips?.isAppClip?.()??!1},onInvoke(J){if(!K()||G()!=="ios")return;window.craft?.appClips?.onInvoke?.(J)},async getInvocation(){if(!K()||G()!=="ios")return null;return window.craft?.appClips?.getInvocation?.()},async promptToInstallFullApp(){if(!K()||G()!=="ios")return;return window.craft?.appClips?.promptToInstallFullApp?.()},async requestEphemeralNotificationPermission(){if(!K()||G()!=="ios")return!1;return window.craft?.appClips?.requestEphemeralNotificationPermission?.()??!1},async confirmLocation(J){if(!K()||G()!=="ios")return!1;return window.craft?.appClips?.confirmLocation?.(J)??!1}},i9={async areSupported(){if(!K()||G()!=="ios")return!1;return window.craft?.liveActivities?.areSupported?.()??!1},async areEnabled(){if(!K()||G()!=="ios")return!1;return window.craft?.liveActivities?.areEnabled?.()??!1},async start(J){if(!K()||G()!=="ios")return{id:`mock-${Date.now()}`};return window.craft?.liveActivities?.start?.(J)??{id:`mock-${Date.now()}`}},async update(J,$,Z){if(!K()||G()!=="ios")return;return window.craft?.liveActivities?.update?.(J,$,Z)},async end(J,$,Z){if(!K()||G()!=="ios")return;return window.craft?.liveActivities?.end?.(J,$,Z)},async getAll(){if(!K()||G()!=="ios")return[];return window.craft?.liveActivities?.getAll?.()??[]},async requestPushToken(J){if(!K()||G()!=="ios")return null;return window.craft?.liveActivities?.requestPushToken?.(J)}},o9={async isAvailable(){if(!K()||G()!=="ios")return!1;return window.craft?.sharePlay?.isAvailable?.()??!1},async getSessionState(){if(!K()||G()!=="ios")return null;return window.craft?.sharePlay?.getSessionState?.()},async getParticipants(){if(!K()||G()!=="ios")return[];return window.craft?.sharePlay?.getParticipants?.()??[]},async startActivity(J){if(!K()||G()!=="ios")return!1;return window.craft?.sharePlay?.startActivity?.(J)??!1},async endActivity(){if(!K()||G()!=="ios")return;return window.craft?.sharePlay?.endActivity?.()},async broadcast(J){if(!K()||G()!=="ios")return;return window.craft?.sharePlay?.broadcast?.(J)},async send(J,$){if(!K()||G()!=="ios")return;return window.craft?.sharePlay?.send?.(J,$)},onMessage(J){if(!K()||G()!=="ios")return;window.craft?.sharePlay?.onMessage?.(J)},onSessionStateChange(J){if(!K()||G()!=="ios")return;window.craft?.sharePlay?.onSessionStateChange?.(J)},onParticipantsChange(J){if(!K()||G()!=="ios")return;window.craft?.sharePlay?.onParticipantsChange?.(J)},async coordinatePlayback(J){if(!K()||G()!=="ios")return;return window.craft?.sharePlay?.coordinatePlayback?.(J)}},a9={async getProducts(J){if(!K()||G()!=="ios")return[];return window.craft?.storeKit?.getProducts?.(J)??[]},async purchase(J,$){if(!K()||G()!=="ios")return{success:!1,error:"StoreKit not available"};return window.craft?.storeKit?.purchase?.(J,$)??{success:!1}},async isEntitled(J){if(!K()||G()!=="ios")return!1;return window.craft?.storeKit?.isEntitled?.(J)??!1},async getCurrentEntitlements(){if(!K()||G()!=="ios")return[];return window.craft?.storeKit?.getCurrentEntitlements?.()??[]},async getTransactionHistory(J){if(!K()||G()!=="ios")return[];return window.craft?.storeKit?.getTransactionHistory?.(J)??[]},async restorePurchases(){if(!K()||G()!=="ios")return;return window.craft?.storeKit?.restorePurchases?.()},async finishTransaction(J){if(!K()||G()!=="ios")return;return window.craft?.storeKit?.finishTransaction?.(J)},async getSubscriptionStatus(J){if(!K()||G()!=="ios")return null;return window.craft?.storeKit?.getSubscriptionStatus?.(J)},async presentOfferCodeRedemption(){if(!K()||G()!=="ios")return;return window.craft?.storeKit?.presentOfferCodeRedemption?.()},async presentManageSubscriptions(){if(!K()||G()!=="ios")return;return window.craft?.storeKit?.presentManageSubscriptions?.()},async beginRefundRequest(J){if(!K()||G()!=="ios")return"failed";return window.craft?.storeKit?.beginRefundRequest?.(J)??"failed"},onTransactionUpdate(J){if(!K()||G()!=="ios")return;window.craft?.storeKit?.onTransactionUpdate?.(J)},async showPriceConsentIfNeeded(){if(!K()||G()!=="ios")return;return window.craft?.storeKit?.showPriceConsentIfNeeded?.()}},t9={register(J){if(!K()||G()!=="ios")return;window.craft?.appIntents?.register?.(J)},unregister(J){if(!K()||G()!=="ios")return;window.craft?.appIntents?.unregister?.(J)},onPerform(J,$){if(!K()||G()!=="ios")return;window.craft?.appIntents?.onPerform?.(J,$)},async donate(J,$){if(!K()||G()!=="ios")return;return window.craft?.appIntents?.donate?.(J,$)},async deleteDonations(J){if(!K()||G()!=="ios")return;return window.craft?.appIntents?.deleteDonations?.(J)},async updateSpotlightIndex(J,$){if(!K()||G()!=="ios")return;return window.craft?.appIntents?.updateSpotlightIndex?.(J,$)}},e9={async configure(J){if(!K()||G()!=="ios")return;return window.craft?.tipKit?.configure?.(J)},register(J){if(!K()||G()!=="ios")return;window.craft?.tipKit?.register?.(J)},async shouldShow(J){if(!K()||G()!=="ios")return!1;return window.craft?.tipKit?.shouldShow?.(J)??!1},async invalidate(J,$){if(!K()||G()!=="ios")return;return window.craft?.tipKit?.invalidate?.(J,$)},async trackEvent(J){if(!K()||G()!=="ios")return;return window.craft?.tipKit?.trackEvent?.(J)},async setParameter(J,$){if(!K()||G()!=="ios")return;return window.craft?.tipKit?.setParameter?.(J,$)},async showPopover(J,$){if(!K()||G()!=="ios")return;return window.craft?.tipKit?.showPopover?.(J,$)},onAction(J,$){if(!K()||G()!=="ios")return;window.craft?.tipKit?.onAction?.(J,$)},async resetDatastore(){if(!K()||G()!=="ios")return;return window.craft?.tipKit?.resetDatastore?.()}},JX={async getAuthorizationStatus(){if(!K()||G()!=="ios")return"notDetermined";return window.craft?.focusFilters?.getAuthorizationStatus?.()??"notDetermined"},async requestAuthorization(){if(!K()||G()!=="ios")return!1;return window.craft?.focusFilters?.requestAuthorization?.()??!1},async getFocusStatus(){if(!K()||G()!=="ios")return{isFocusActive:!1};return window.craft?.focusFilters?.getFocusStatus?.()??{isFocusActive:!1}},register(J){if(!K()||G()!=="ios")return;window.craft?.focusFilters?.register?.(J)},async getCurrentFilterSettings(){if(!K()||G()!=="ios")return null;return window.craft?.focusFilters?.getCurrentFilterSettings?.()},onFocusChange(J){if(!K()||G()!=="ios")return;window.craft?.focusFilters?.onFocusChange?.(J)},onFilterChange(J){if(!K()||G()!=="ios")return;window.craft?.focusFilters?.onFilterChange?.(J)}},$X={async isSupported(){if(!K()||G()!=="android")return!1;return window.craft?.materialYou?.isSupported?.()??!1},async getColors(J=!1){if(!K()||G()!=="android")return null;return window.craft?.materialYou?.getColors?.(J)},async getColorsFromSource(J){if(!K()||G()!=="android")return null;return window.craft?.materialYou?.getColorsFromSource?.(J)},onColorsChange(J){if(!K()||G()!=="android")return;window.craft?.materialYou?.onColorsChange?.(J)},async applyToSystemBars(J){if(!K()||G()!=="android")return;return window.craft?.materialYou?.applyToSystemBars?.(J)},async generateScheme(J,$=!1){if(!K()||G()!=="android")return null;return window.craft?.materialYou?.generateScheme?.(J,$)}},ZX={async isAvailable(){if(!K()||G()!=="android")return!1;return window.craft?.photoPicker?.isAvailable?.()??!1},async pickImage(){if(!K()||G()!=="android")return null;return window.craft?.photoPicker?.pickImage?.()},async pickImages(J=10){if(!K()||G()!=="android")return[];return window.craft?.photoPicker?.pickImages?.(J)??[]},async pickVideo(){if(!K()||G()!=="android")return null;return window.craft?.photoPicker?.pickVideo?.()},async pickVideos(J=10){if(!K()||G()!=="android")return[];return window.craft?.photoPicker?.pickVideos?.(J)??[]},async pickMedia(J){if(!K()||G()!=="android")return[];return window.craft?.photoPicker?.pickMedia?.(J)??[]},async getPersistedUri(J){if(!K()||G()!=="android")return null;return window.craft?.photoPicker?.getPersistedUri?.(J)}},XX={async enqueue(J){if(!K()||G()!=="android")return`mock-${Date.now()}`;return window.craft?.workManager?.enqueue?.(J)??`mock-${Date.now()}`},async enqueueUnique(J,$){if(!K()||G()!=="android")return`mock-${Date.now()}`;return window.craft?.workManager?.enqueueUnique?.(J,$)??`mock-${Date.now()}`},async cancelByName(J){if(!K()||G()!=="android")return;return window.craft?.workManager?.cancelByName?.(J)},async cancelById(J){if(!K()||G()!=="android")return;return window.craft?.workManager?.cancelById?.(J)},async cancelByTag(J){if(!K()||G()!=="android")return;return window.craft?.workManager?.cancelByTag?.(J)},async cancelAll(){if(!K()||G()!=="android")return;return window.craft?.workManager?.cancelAll?.()},async getWorkInfo(J){if(!K()||G()!=="android")return null;return window.craft?.workManager?.getWorkInfo?.(J)},async getWorkInfoById(J){if(!K()||G()!=="android")return null;return window.craft?.workManager?.getWorkInfoById?.(J)},async getWorkInfoByTag(J){if(!K()||G()!=="android")return[];return window.craft?.workManager?.getWorkInfoByTag?.(J)??[]},observeWork(J,$){if(!K()||G()!=="android")return()=>{};return window.craft?.workManager?.observeWork?.(J,$)??(()=>{})},async pruneWork(){if(!K()||G()!=="android")return;return window.craft?.workManager?.pruneWork?.()},onWork(J,$){if(!K()||G()!=="android")return;window.craft?.workManager?.onWork?.(J,$)}},YX={async start(J){if(!K()||G()!=="android")return;return window.craft?.foregroundService?.start?.(J)},async stop(){if(!K()||G()!=="android")return;return window.craft?.foregroundService?.stop?.()},async updateNotification(J){if(!K()||G()!=="android")return;return window.craft?.foregroundService?.updateNotification?.(J)},async isRunning(){if(!K()||G()!=="android")return!1;return window.craft?.foregroundService?.isRunning?.()??!1},onAction(J){if(!K()||G()!=="android")return;window.craft?.foregroundService?.onAction?.(J)}},QX={async isSupported(){if(!K()||G()!=="android")return!1;return window.craft?.predictiveBack?.isSupported?.()??!1},enable(){if(!K()||G()!=="android")return;window.craft?.predictiveBack?.enable?.()},disable(){if(!K()||G()!=="android")return;window.craft?.predictiveBack?.disable?.()},onStart(J){if(!K()||G()!=="android")return;window.craft?.predictiveBack?.onStart?.(J)},onProgress(J){if(!K()||G()!=="android")return;window.craft?.predictiveBack?.onProgress?.(J)},onCommit(J){if(!K()||G()!=="android")return;window.craft?.predictiveBack?.onCommit?.()},onCancel(J){if(!K()||G()!=="android")return;window.craft?.predictiveBack?.onCancel?.(J)}},GX={async isSupported(){if(!K()||G()!=="android")return!1;return window.craft?.appLanguage?.isSupported?.()??!1},async getAvailableLanguages(){if(!K()||G()!=="android")return[];return window.craft?.appLanguage?.getAvailableLanguages?.()??[]},async getCurrentLanguage(){if(!K()||G()!=="android")return null;return window.craft?.appLanguage?.getCurrentLanguage?.()},async setLanguage(J){if(!K()||G()!=="android")return;return window.craft?.appLanguage?.setLanguage?.(J)},async resetToSystem(){if(!K()||G()!=="android")return;return window.craft?.appLanguage?.resetToSystem?.()},async openSettings(){if(!K()||G()!=="android")return;return window.craft?.appLanguage?.openSettings?.()}},KX={async getActiveWidgets(J){if(!K()||G()!=="android")return[];return window.craft?.widgets?.getActiveWidgets?.(J)??[]},async updateWidget(J,$){if(!K()||G()!=="android")return;return window.craft?.widgets?.updateWidget?.(J,$)},async updateAllWidgets(J,$){if(!K()||G()!=="android")return;return window.craft?.widgets?.updateAllWidgets?.(J,$)},async requestPin(J){if(!K()||G()!=="android")return!1;return window.craft?.widgets?.requestPin?.(J)??!1},async isSupported(){if(!K()||G()!=="android")return!1;return window.craft?.widgets?.isSupported?.()??!1},onUpdate(J,$){if(!K()||G()!=="android")return;window.craft?.widgets?.onUpdate?.(J,$)},onInteraction(J){if(!K()||G()!=="android")return;window.craft?.widgets?.onInteraction?.(J)},onResize(J){if(!K()||G()!=="android")return;window.craft?.widgets?.onResize?.(J)},onDelete(J){if(!K()||G()!=="android")return;window.craft?.widgets?.onDelete?.(J)}},qX={async connect(){if(!K()||G()!=="android")return!1;return window.craft?.playBilling?.connect?.()??!1},async disconnect(){if(!K()||G()!=="android")return;return window.craft?.playBilling?.disconnect?.()},async getProducts(J,$){if(!K()||G()!=="android")return[];return window.craft?.playBilling?.getProducts?.(J,$)??[]},async purchase(J,$){if(!K()||G()!=="android")return{success:!1,error:"Play Billing not available"};return window.craft?.playBilling?.purchase?.(J,$)??{success:!1}},async getPurchases(J){if(!K()||G()!=="android")return[];return window.craft?.playBilling?.getPurchases?.(J)??[]},async acknowledgePurchase(J){if(!K()||G()!=="android")return!1;return window.craft?.playBilling?.acknowledgePurchase?.(J)??!1},async consumePurchase(J){if(!K()||G()!=="android")return!1;return window.craft?.playBilling?.consumePurchase?.(J)??!1},async isSubscribed(J){if(!K()||G()!=="android")return!1;return window.craft?.playBilling?.isSubscribed?.(J)??!1},onPurchasesUpdated(J){if(!K()||G()!=="android")return;window.craft?.playBilling?.onPurchasesUpdated?.(J)},async showSubscriptionManagement(J){if(!K()||G()!=="android")return;return window.craft?.playBilling?.showSubscriptionManagement?.(J)}},UX={async isAvailable(){if(!K()||G()!=="macos")return!1;return window.craft?.touchBar?.isAvailable?.()??!1},set(J){if(!K()||G()!=="macos")return;window.craft?.touchBar?.set?.(J)},updateItem(J,$){if(!K()||G()!=="macos")return;window.craft?.touchBar?.updateItem?.(J,$)},clear(){if(!K()||G()!=="macos")return;window.craft?.touchBar?.clear?.()},onTap(J,$){if(!K()||G()!=="macos")return;window.craft?.touchBar?.onTap?.(J,$)},onSliderChange(J,$){if(!K()||G()!=="macos")return;window.craft?.touchBar?.onSliderChange?.(J,$)},onColorChange(J,$){if(!K()||G()!=="macos")return;window.craft?.touchBar?.onColorChange?.(J,$)},onScrubberSelect(J,$){if(!K()||G()!=="macos")return;window.craft?.touchBar?.onScrubberSelect?.(J,$)},onSegmentSelect(J,$){if(!K()||G()!=="macos")return;window.craft?.touchBar?.onSegmentSelect?.(J,$)},setEscapeKeyVisible(J){if(!K()||G()!=="macos")return;window.craft?.touchBar?.setEscapeKeyVisible?.(J)}},zX={async isSupported(){if(!K()||G()!=="macos")return!1;return window.craft?.desktopWidgets?.isSupported?.()??!1},register(J){if(!K()||G()!=="macos")return;window.craft?.desktopWidgets?.register?.(J)},provideTimeline(J,$){if(!K()||G()!=="macos")return;window.craft?.desktopWidgets?.provideTimeline?.(J,$)},async reloadTimeline(J){if(!K()||G()!=="macos")return;return window.craft?.desktopWidgets?.reloadTimeline?.(J)},async reloadAllTimelines(){if(!K()||G()!=="macos")return;return window.craft?.desktopWidgets?.reloadAllTimelines?.()},async getCurrentConfigurations(J){if(!K()||G()!=="macos")return[];return window.craft?.desktopWidgets?.getCurrentConfigurations?.(J)??[]},onWidgetURL(J,$){if(!K()||G()!=="macos")return;window.craft?.desktopWidgets?.onWidgetURL?.(J,$)}},WX={async isActive(){if(!K()||G()!=="macos")return!1;return window.craft?.stageManager?.isActive?.()??!1},async isAvailable(){if(!K()||G()!=="macos")return!1;return window.craft?.stageManager?.isAvailable?.()??!1},async getActiveSet(){if(!K()||G()!=="macos")return[];return window.craft?.stageManager?.getActiveSet?.()??[]},async createSet(J){if(!K()||G()!=="macos")return;return window.craft?.stageManager?.createSet?.(J)},async addToCurrentSet(J){if(!K()||G()!=="macos")return;return window.craft?.stageManager?.addToCurrentSet?.(J)},async removeFromCurrentSet(J){if(!K()||G()!=="macos")return;return window.craft?.stageManager?.removeFromCurrentSet?.(J)},onActiveSetChange(J){if(!K()||G()!=="macos")return;window.craft?.stageManager?.onActiveSetChange?.(J)},onStateChange(J){if(!K()||G()!=="macos")return;window.craft?.stageManager?.onStateChange?.(J)}},HX={startActivity(J){if(!K()||G()!=="macos")return;window.craft?.handoff?.startActivity?.(J)},updateActivity(J){if(!K()||G()!=="macos")return;window.craft?.handoff?.updateActivity?.(J)},invalidateActivity(){if(!K()||G()!=="macos")return;window.craft?.handoff?.invalidateActivity?.()},onContinue(J){if(!K()||G()!=="macos")return;window.craft?.handoff?.onContinue?.(J)},async hasRemoteClipboardContent(){if(!K()||G()!=="macos")return!1;return window.craft?.handoff?.hasRemoteClipboardContent?.()??!1},async shareViaAirDrop(J){if(!K()||G()!=="macos")return!1;return window.craft?.handoff?.shareViaAirDrop?.(J)??!1},async isAvailable(){if(!K()||G()!=="macos")return!1;return window.craft?.handoff?.isAvailable?.()??!1}},VX={async isAvailable(){if(!K()||G()!=="macos")return!1;return window.craft?.sidecar?.isAvailable?.()??!1},async getAvailableDevices(){if(!K()||G()!=="macos")return[];return window.craft?.sidecar?.getAvailableDevices?.()??[]},async getConnectedDevice(){if(!K()||G()!=="macos")return null;return window.craft?.sidecar?.getConnectedDevice?.()},async connect(J){if(!K()||G()!=="macos")return!1;return window.craft?.sidecar?.connect?.(J)??!1},async disconnect(){if(!K()||G()!=="macos")return;return window.craft?.sidecar?.disconnect?.()},async moveWindowToSidecar(J){if(!K()||G()!=="macos")return;return window.craft?.sidecar?.moveWindowToSidecar?.(J)},onConnectionChange(J){if(!K()||G()!=="macos")return;window.craft?.sidecar?.onConnectionChange?.(J)}},LX={async indexItems(J){if(!K()||G()!=="macos")return;return window.craft?.spotlight?.indexItems?.(J)},async deleteItems(J){if(!K()||G()!=="macos")return;return window.craft?.spotlight?.deleteItems?.(J)},async deleteItemsInDomain(J){if(!K()||G()!=="macos")return;return window.craft?.spotlight?.deleteItemsInDomain?.(J)},async deleteAllItems(){if(!K()||G()!=="macos")return;return window.craft?.spotlight?.deleteAllItems?.()},onContinueActivity(J){if(!K()||G()!=="macos")return;window.craft?.spotlight?.onContinueActivity?.(J)},async getIndexingStatus(){if(!K()||G()!=="macos")return{isIndexing:!1,itemCount:0};return window.craft?.spotlight?.getIndexingStatus?.()??{isIndexing:!1,itemCount:0}}},RX={register(J){if(!K()||G()!=="macos")return;window.craft?.quickActions?.register?.(J)},unregister(J){if(!K()||G()!=="macos")return;window.craft?.quickActions?.unregister?.(J)},onInvoke(J,$){if(!K()||G()!=="macos")return;window.craft?.quickActions?.onInvoke?.(J,$)}},FX={onReceive(J){if(!K()||G()!=="macos")return;window.craft?.shareExtension?.onReceive?.(J)},async complete(J=!0){if(!K()||G()!=="macos")return;return window.craft?.shareExtension?.complete?.(J)},async cancel(){if(!K()||G()!=="macos")return;return window.craft?.shareExtension?.cancel?.()}},OX={enableTabs(){if(!K()||G()!=="macos")return;window.craft?.windowManagement?.enableTabs?.()},disableTabs(){if(!K()||G()!=="macos")return;window.craft?.windowManagement?.disableTabs?.()},async newTab(J){if(!K()||G()!=="macos")return"";return window.craft?.windowManagement?.newTab?.(J)??""},async closeTab(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.closeTab?.()},async getTabGroups(){if(!K()||G()!=="macos")return[];return window.craft?.windowManagement?.getTabGroups?.()??[]},async selectTab(J){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.selectTab?.(J)},async moveTabToNewWindow(J){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.moveTabToNewWindow?.(J)},async mergeAllWindows(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.mergeAllWindows?.()},async enterFullScreen(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.enterFullScreen?.()},async exitFullScreen(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.exitFullScreen?.()},async toggleFullScreen(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.toggleFullScreen?.()},async createSplitView(J,$){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.createSplitView?.(J,$)},async exitSplitView(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.exitSplitView?.()},async tileLeft(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.tileLeft?.()},async tileRight(){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.tileRight?.()},async moveToSpace(J){if(!K()||G()!=="macos")return;return window.craft?.windowManagement?.moveToSpace?.(J)},onTabChange(J){if(!K()||G()!=="macos")return;window.craft?.windowManagement?.onTabChange?.(J)},onFullScreenChange(J){if(!K()||G()!=="macos")return;window.craft?.windowManagement?.onFullScreenChange?.(J)}},jX={async isSupported(){if(!K()||G()!=="windows")return!1;return window.craft?.jumpList?.isSupported?.()??!1},async set(J){if(!K()||G()!=="windows")return;return window.craft?.jumpList?.set?.(J)},async clear(){if(!K()||G()!=="windows")return;return window.craft?.jumpList?.clear?.()},async addToRecent(J){if(!K()||G()!=="windows")return;return window.craft?.jumpList?.addToRecent?.(J)},async clearRecent(){if(!K()||G()!=="windows")return;return window.craft?.jumpList?.clearRecent?.()},async addToFrequent(J){if(!K()||G()!=="windows")return;return window.craft?.jumpList?.addToFrequent?.(J)},async clearFrequent(){if(!K()||G()!=="windows")return;return window.craft?.jumpList?.clearFrequent?.()},onItemClick(J){if(!K()||G()!=="windows")return;window.craft?.jumpList?.onItemClick?.(J)}},AX={async setState(J){if(!K()||G()!=="windows")return;return window.craft?.taskbarProgress?.setState?.(J)},async setProgress(J){if(!K()||G()!=="windows")return;return window.craft?.taskbarProgress?.setProgress?.(Math.max(0,Math.min(1,J)))},async clear(){if(!K()||G()!=="windows")return;return window.craft?.taskbarProgress?.clear?.()},async flash(J){if(!K()||G()!=="windows")return;return window.craft?.taskbarProgress?.flash?.(J)},async stopFlash(){if(!K()||G()!=="windows")return;return window.craft?.taskbarProgress?.stopFlash?.()},async setOverlayIcon(J,$){if(!K()||G()!=="windows")return;return window.craft?.taskbarProgress?.setOverlayIcon?.(J,$)}},_X={async isSupported(){if(!K()||G()!=="windows")return!1;return window.craft?.toastNotifications?.isSupported?.()??!1},async show(J,$){if(!K()||G()!=="windows")return;return window.craft?.toastNotifications?.show?.(J,$)},async update(J,$){if(!K()||G()!=="windows")return;return window.craft?.toastNotifications?.update?.(J,$)},async hide(J){if(!K()||G()!=="windows")return;return window.craft?.toastNotifications?.hide?.(J)},async hideGroup(J){if(!K()||G()!=="windows")return;return window.craft?.toastNotifications?.hideGroup?.(J)},async clearAll(){if(!K()||G()!=="windows")return;return window.craft?.toastNotifications?.clearAll?.()},async getHistory(){if(!K()||G()!=="windows")return[];return window.craft?.toastNotifications?.getHistory?.()??[]},onActivated(J){if(!K()||G()!=="windows")return;window.craft?.toastNotifications?.onActivated?.(J)},onDismissed(J){if(!K()||G()!=="windows")return;window.craft?.toastNotifications?.onDismissed?.(J)}},DX={async getAvailability(){if(!K()||G()!=="windows")return{isAvailable:!1,biometricTypes:[],supportsCompanionDevice:!1};return window.craft?.windowsHello?.getAvailability?.()??{isAvailable:!1,biometricTypes:[],supportsCompanionDevice:!1}},async authenticate(J){if(!K()||G()!=="windows")return{success:!1,error:"notConfigured"};return window.craft?.windowsHello?.authenticate?.(J)??{success:!1}},async createCredential(J,$){if(!K()||G()!=="windows")return{success:!1,error:"Windows Hello not available"};return window.craft?.windowsHello?.createCredential?.(J,$)??{success:!1}},async signWithCredential(J,$,Z){if(!K()||G()!=="windows")return{success:!1,error:"Windows Hello not available"};return window.craft?.windowsHello?.signWithCredential?.(J,$,Z)??{success:!1}},async deleteCredential(J){if(!K()||G()!=="windows")return!1;return window.craft?.windowsHello?.deleteCredential?.(J)??!1},async hasCredential(J){if(!K()||G()!=="windows")return!1;return window.craft?.windowsHello?.hasCredential?.(J)??!1}},MX={async isSupported(){if(!K()||G()!=="windows")return!1;return window.craft?.windowsWidgets?.isSupported?.()??!1},register(J){if(!K()||G()!=="windows")return;window.craft?.windowsWidgets?.register?.(J)},unregister(J){if(!K()||G()!=="windows")return;window.craft?.windowsWidgets?.unregister?.(J)},onContentRequested(J,$){if(!K()||G()!=="windows")return;window.craft?.windowsWidgets?.onContentRequested?.(J,$)},async updateContent(J,$){if(!K()||G()!=="windows")return;return window.craft?.windowsWidgets?.updateContent?.(J,$)},onAction(J,$){if(!K()||G()!=="windows")return;window.craft?.windowsWidgets?.onAction?.(J,$)},onCustomize(J,$){if(!K()||G()!=="windows")return;window.craft?.windowsWidgets?.onCustomize?.(J,$)}},EX={async getCurrentVersion(){if(!K()||G()!=="windows")return null;return window.craft?.msixUpdate?.getCurrentVersion?.()},async checkForUpdates(){if(!K()||G()!=="windows")return{isAvailable:!1,isMandatory:!1};return window.craft?.msixUpdate?.checkForUpdates?.()??{isAvailable:!1,isMandatory:!1}},async downloadAndInstall(J){if(!K()||G()!=="windows")return{success:!1,error:"MSIX not available"};return window.craft?.msixUpdate?.downloadAndInstall?.(J)??{success:!1}},onDownloadProgress(J){if(!K()||G()!=="windows")return;window.craft?.msixUpdate?.onDownloadProgress?.(J)},async isPackaged(){if(!K()||G()!=="windows")return!1;return window.craft?.msixUpdate?.isPackaged?.()??!1},async getInstallLocation(){if(!K()||G()!=="windows")return null;return window.craft?.msixUpdate?.getInstallLocation?.()}},TX={onShare(J){if(!K()||G()!=="windows")return;window.craft?.shareTarget?.onShare?.(J)},async wasLaunchedAsShareTarget(){if(!K()||G()!=="windows")return!1;return window.craft?.shareTarget?.wasLaunchedAsShareTarget?.()??!1},async getSharedData(){if(!K()||G()!=="windows")return[];return window.craft?.shareTarget?.getSharedData?.()??[]}},NX={async getState(){if(!K()||G()!=="windows")return"disabled";return window.craft?.startupTask?.getState?.()??"disabled"},async request(){if(!K()||G()!=="windows")return"disabled";return window.craft?.startupTask?.request?.()??"disabled"},async disable(){if(!K()||G()!=="windows")return;return window.craft?.startupTask?.disable?.()}},BX={async isSupported(){if(!K()||G()!=="windows")return!1;return window.craft?.secondaryTiles?.isSupported?.()??!1},async pin(J){if(!K()||G()!=="windows")return!1;return window.craft?.secondaryTiles?.pin?.(J)??!1},async unpin(J){if(!K()||G()!=="windows")return!1;return window.craft?.secondaryTiles?.unpin?.(J)??!1},async exists(J){if(!K()||G()!=="windows")return!1;return window.craft?.secondaryTiles?.exists?.(J)??!1},async getAll(){if(!K()||G()!=="windows")return[];return window.craft?.secondaryTiles?.getAll?.()??[]},async updateTile(J,$){if(!K()||G()!=="windows")return;return window.craft?.secondaryTiles?.updateTile?.(J,$)},async updateBadge(J,$){if(!K()||G()!=="windows")return;return window.craft?.secondaryTiles?.updateBadge?.(J,$)},async clearTile(J){if(!K()||G()!=="windows")return;return window.craft?.secondaryTiles?.clearTile?.(J)},onLaunch(J){if(!K()||G()!=="windows")return;window.craft?.secondaryTiles?.onLaunch?.(J)}},hJ=300000,uJ=3600000;async function H0(J={}){let $=J.multiple?"openFiles":"openFile";if(N()){let X=await b($,{type:"dialog",action:$,data:J},{timeoutMs:hJ}),Y=!!(X&&X.canceled===!0),Q=Array.isArray(X?.filePaths)?X.filePaths:[];return{canceled:Y,filePaths:Q}}return D().request(`dialog.${$}`,J)}async function V0(J={}){if(N()){let Z=await b("openFolder",{type:"dialog",action:"openFolder",data:J},{timeoutMs:hJ}),X=!!(Z&&Z.canceled===!0),Y=Array.isArray(Z?.filePaths)?Z.filePaths:[];return{canceled:X,filePaths:Y}}return D().request("dialog.openFolder",J)}async function L0(J={}){if(N()){let Z=await b("saveFile",{type:"dialog",action:"saveFile",data:J},{timeoutMs:hJ}),X=!!(Z&&Z.canceled===!0),Y=typeof Z?.filePath==="string"?Z.filePath:void 0;return{canceled:X,filePath:Y}}return D().request("dialog.saveFile",J)}async function R0(J){let $=typeof J==="string"?{title:J}:J;if(N()){let X=await b("showAlert",{type:"dialog",action:"showAlert",data:$},{timeoutMs:uJ});if(X&&typeof X.buttonIndex==="number")return X.buttonIndex;return 0}return D().request("dialog.showAlert",$)}async function F0(J){let $=typeof J==="string"?{title:J}:J;if(N()){let X=await b("showConfirm",{type:"dialog",action:"showConfirm",data:$},{timeoutMs:uJ});return!!(X&&X.ok===!0)}return D().request("dialog.showConfirm",$)}async function O0(J,$){if(N()){let X=await b("showPrompt",{type:"dialog",action:"showPrompt",data:{title:J,defaultValue:$}},{timeoutMs:uJ});if(X&&typeof X.value==="string")return X.value;return null}return D().request("dialog.showPrompt",{title:J,defaultValue:$})}var xX={openFile:H0,openFolder:V0,saveFile:L0,showAlert:R0,showConfirm:F0,showPrompt:O0},YJ=5000;async function w8(J){if(N()){vJ({type:"clipboard",action:"writeText",data:{text:J}});return}return D().request("clipboard.writeText",{text:J})}async function P8(){if(N()){let $=await b("readText",{type:"clipboard",action:"readText"},{timeoutMs:YJ});return $&&typeof $.text==="string"?$.text:""}return D().request("clipboard.readText")}async function C8(J){if(N()){vJ({type:"clipboard",action:"writeHTML",data:{html:J}});return}return D().request("clipboard.writeHTML",{html:J})}async function b8(){if(N()){let $=await b("readHTML",{type:"clipboard",action:"readHTML"},{timeoutMs:YJ});return $&&typeof $.html==="string"?$.html:""}return D().request("clipboard.readHTML")}async function j0(){if(N()){vJ({type:"clipboard",action:"clear"});return}return D().request("clipboard.clear")}async function A0(){if(N()){let $=await b("hasText",{type:"clipboard",action:"hasText"},{timeoutMs:YJ});return!!($&&$.value===!0)}return D().request("clipboard.hasText")}async function _0(){if(N()){let $=await b("hasHTML",{type:"clipboard",action:"hasHTML"},{timeoutMs:YJ});return!!($&&$.value===!0)}return D().request("clipboard.hasHTML")}async function D0(){if(N()){let $=await b("hasImage",{type:"clipboard",action:"hasImage"},{timeoutMs:YJ});return!!($&&$.value===!0)}return D().request("clipboard.hasImage")}async function M0(J){let $=[];if(J.text)$.push(w8(J.text));if(J.html)$.push(C8(J.html));await Promise.all($)}async function E0(){let[J,$]=await Promise.all([P8().catch((Z)=>{console.debug("[Craft Clipboard] readText failed:",Z);return}),b8().catch((Z)=>{console.debug("[Craft Clipboard] readHTML failed:",Z);return})]);return{text:J||void 0,html:$||void 0}}var SX={writeText:w8,readText:P8,writeHTML:C8,readHTML:b8,clear:j0,hasText:A0,hasHTML:_0,hasImage:D0,write:M0,read:E0};async function X8(J,$){if(typeof navigator>"u"||!navigator.mediaDevices)return!1;try{if(navigator.permissions)try{let Y=await navigator.permissions.query({name:J});if(Y.state==="granted")return!0;if(Y.state==="denied")return!1}catch{}let X=(await navigator.mediaDevices.enumerateDevices()).filter((Y)=>Y.kind===$);if(X.length===0)return!1;return X.some((Y)=>typeof Y.label==="string"&&Y.label.length>0)}catch{return!1}}var kX={async enumerateDevices(){if(typeof navigator>"u"||!navigator.mediaDevices)return[];try{return(await navigator.mediaDevices.enumerateDevices()).map(($)=>({deviceId:$.deviceId,groupId:$.groupId,kind:$.kind,label:$.label||`${$.kind} (${$.deviceId.slice(0,8)}...)`}))}catch{return[]}},async getCameras(){return(await this.enumerateDevices()).filter(($)=>$.kind==="videoinput")},async getMicrophones(){return(await this.enumerateDevices()).filter(($)=>$.kind==="audioinput")},async getSpeakers(){return(await this.enumerateDevices()).filter(($)=>$.kind==="audiooutput")},async getCamera(J){if(typeof navigator>"u"||!navigator.mediaDevices)throw Error("Media devices not available");let $={video:J?{deviceId:J.deviceId?{exact:J.deviceId}:void 0,facingMode:J.facingMode,width:J.width,height:J.height,frameRate:J.frameRate,aspectRatio:J.aspectRatio}:!0,audio:!1};return navigator.mediaDevices.getUserMedia($)},async getMicrophone(J){if(typeof navigator>"u"||!navigator.mediaDevices)throw Error("Media devices not available");let $={video:!1,audio:J?{deviceId:J.deviceId?{exact:J.deviceId}:void 0,echoCancellation:J.echoCancellation,noiseSuppression:J.noiseSuppression,autoGainControl:J.autoGainControl,sampleRate:J.sampleRate,channelCount:J.channelCount}:!0};return navigator.mediaDevices.getUserMedia($)},async getMediaStream(J){if(typeof navigator>"u"||!navigator.mediaDevices)throw Error("Media devices not available");let $={video:J.video===!0?!0:J.video?this._buildVideoConstraints(J.video):!1,audio:J.audio===!0?!0:J.audio?this._buildAudioConstraints(J.audio):!1};return navigator.mediaDevices.getUserMedia($)},async hasCameraAccess(){return X8("camera","videoinput")},async hasMicrophoneAccess(){return X8("microphone","audioinput")},async requestPermission(J={}){let{camera:$=!1,microphone:Z=!1}=J;if(!$&&!Z)return!0;try{return(await this.getMediaStream({video:$,audio:Z})).getTracks().forEach((Y)=>Y.stop()),!0}catch{return!1}},stopStream(J){J.getTracks().forEach(($)=>$.stop())},onDeviceChange(J){if(typeof navigator>"u"||!navigator.mediaDevices)return()=>{};return navigator.mediaDevices.addEventListener("devicechange",J),()=>navigator.mediaDevices.removeEventListener("devicechange",J)},_buildVideoConstraints(J){return{deviceId:J.deviceId?{exact:J.deviceId}:void 0,facingMode:J.facingMode,width:J.width,height:J.height,frameRate:J.frameRate,aspectRatio:J.aspectRatio}},_buildAudioConstraints(J){return{deviceId:J.deviceId?{exact:J.deviceId}:void 0,echoCancellation:J.echoCancellation,noiseSuppression:J.noiseSuppression,autoGainControl:J.autoGainControl,sampleRate:J.sampleRate,channelCount:J.channelCount}}};function T0(J){switch(J){case"macos":case"darwin":return{width:220,platform:{macos:{vibrancy:!0,material:"sidebar",trafficLightsInSidebar:!1,hideTitlebarSeparator:!1}}};case"windows":case"win32":return{width:200,platform:{windows:{material:"mica",rounded:!0}}};case"linux":return{width:200,platform:{linux:{theme:"auto"}}};default:return{width:220}}}function N0(J,$){let X=`
|
|
77
|
+
.craft-sidebar {
|
|
78
|
+
width: ${J.width||220}px;
|
|
79
|
+
height: 100%;
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
user-select: none;
|
|
83
|
+
font-family: var(--craft-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
|
|
84
|
+
font-size: var(--craft-font-size, 13px);
|
|
85
|
+
}
|
|
86
|
+
.craft-sidebar-header {
|
|
87
|
+
padding: 12px 16px;
|
|
88
|
+
border-bottom: 1px solid var(--craft-border);
|
|
89
|
+
}
|
|
90
|
+
.craft-sidebar-header-title {
|
|
91
|
+
font-weight: 600;
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
}
|
|
94
|
+
.craft-sidebar-header-subtitle {
|
|
95
|
+
font-size: 11px;
|
|
96
|
+
opacity: 0.7;
|
|
97
|
+
margin-top: 2px;
|
|
98
|
+
}
|
|
99
|
+
.craft-sidebar-search {
|
|
100
|
+
padding: 8px 12px;
|
|
101
|
+
}
|
|
102
|
+
.craft-sidebar-search input {
|
|
103
|
+
width: 100%;
|
|
104
|
+
padding: 6px 10px;
|
|
105
|
+
border-radius: var(--craft-radius, 6px);
|
|
106
|
+
border: 1px solid var(--craft-border);
|
|
107
|
+
background: var(--craft-input-bg);
|
|
108
|
+
color: var(--craft-text);
|
|
109
|
+
font-size: 13px;
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
.craft-sidebar-search input:focus {
|
|
113
|
+
border-color: var(--craft-accent);
|
|
114
|
+
}
|
|
115
|
+
.craft-sidebar-content {
|
|
116
|
+
flex: 1;
|
|
117
|
+
overflow-y: auto;
|
|
118
|
+
overflow-x: hidden;
|
|
119
|
+
padding: 4px 0;
|
|
120
|
+
}
|
|
121
|
+
.craft-sidebar-section {
|
|
122
|
+
margin-bottom: 8px;
|
|
123
|
+
}
|
|
124
|
+
.craft-sidebar-section-header {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
padding: 6px 12px;
|
|
128
|
+
font-size: 11px;
|
|
129
|
+
font-weight: 600;
|
|
130
|
+
text-transform: uppercase;
|
|
131
|
+
letter-spacing: 0.5px;
|
|
132
|
+
opacity: 0.6;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
}
|
|
135
|
+
.craft-sidebar-section-header:hover {
|
|
136
|
+
opacity: 0.8;
|
|
137
|
+
}
|
|
138
|
+
.craft-sidebar-section-chevron {
|
|
139
|
+
width: 12px;
|
|
140
|
+
height: 12px;
|
|
141
|
+
margin-right: 4px;
|
|
142
|
+
transition: transform 0.15s;
|
|
143
|
+
}
|
|
144
|
+
.craft-sidebar-section-header.collapsed .craft-sidebar-section-chevron {
|
|
145
|
+
transform: rotate(-90deg);
|
|
146
|
+
}
|
|
147
|
+
.craft-sidebar-section-items {
|
|
148
|
+
transition: max-height 0.2s ease-out, opacity 0.15s;
|
|
149
|
+
}
|
|
150
|
+
.craft-sidebar-section-items.collapsed {
|
|
151
|
+
max-height: 0;
|
|
152
|
+
opacity: 0;
|
|
153
|
+
overflow: hidden;
|
|
154
|
+
}
|
|
155
|
+
.craft-sidebar-item {
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
padding: 6px 12px 6px 16px;
|
|
159
|
+
margin: 1px 8px;
|
|
160
|
+
border-radius: var(--craft-radius, 6px);
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
gap: 8px;
|
|
163
|
+
transition: background 0.1s;
|
|
164
|
+
}
|
|
165
|
+
.craft-sidebar-item:hover {
|
|
166
|
+
background: var(--craft-hover);
|
|
167
|
+
}
|
|
168
|
+
.craft-sidebar-item.selected {
|
|
169
|
+
background: var(--craft-accent);
|
|
170
|
+
color: var(--craft-accent-text, #fff);
|
|
171
|
+
}
|
|
172
|
+
.craft-sidebar-item-icon {
|
|
173
|
+
width: 16px;
|
|
174
|
+
height: 16px;
|
|
175
|
+
flex-shrink: 0;
|
|
176
|
+
}
|
|
177
|
+
.craft-sidebar-item-label {
|
|
178
|
+
flex: 1;
|
|
179
|
+
white-space: nowrap;
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
text-overflow: ellipsis;
|
|
182
|
+
}
|
|
183
|
+
.craft-sidebar-item-badge {
|
|
184
|
+
padding: 2px 6px;
|
|
185
|
+
border-radius: 10px;
|
|
186
|
+
font-size: 11px;
|
|
187
|
+
font-weight: 500;
|
|
188
|
+
background: var(--craft-badge-bg);
|
|
189
|
+
}
|
|
190
|
+
.craft-sidebar-item.selected .craft-sidebar-item-badge {
|
|
191
|
+
background: rgba(255,255,255,0.25);
|
|
192
|
+
}
|
|
193
|
+
.craft-sidebar-footer {
|
|
194
|
+
padding: 8px 12px;
|
|
195
|
+
border-top: 1px solid var(--craft-border);
|
|
196
|
+
display: flex;
|
|
197
|
+
gap: 4px;
|
|
198
|
+
}
|
|
199
|
+
`,Y="";if($==="macos"||$==="darwin"){let Q=J.platform?.macos;Y=`
|
|
200
|
+
:root {
|
|
201
|
+
--craft-font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
|
|
202
|
+
--craft-bg: ${Q?.vibrancy?"rgba(246,246,246,0.8)":"#f6f6f6"};
|
|
203
|
+
--craft-bg-dark: ${Q?.vibrancy?"rgba(30,30,30,0.8)":"#1e1e1e"};
|
|
204
|
+
--craft-text: #1d1d1f;
|
|
205
|
+
--craft-text-dark: #f5f5f7;
|
|
206
|
+
--craft-border: rgba(0,0,0,0.1);
|
|
207
|
+
--craft-border-dark: rgba(255,255,255,0.1);
|
|
208
|
+
--craft-hover: rgba(0,0,0,0.04);
|
|
209
|
+
--craft-hover-dark: rgba(255,255,255,0.06);
|
|
210
|
+
--craft-accent: #007aff;
|
|
211
|
+
--craft-accent-text: #fff;
|
|
212
|
+
--craft-input-bg: rgba(0,0,0,0.05);
|
|
213
|
+
--craft-input-bg-dark: rgba(255,255,255,0.08);
|
|
214
|
+
--craft-badge-bg: rgba(0,0,0,0.08);
|
|
215
|
+
--craft-badge-bg-dark: rgba(255,255,255,0.1);
|
|
216
|
+
--craft-radius: 6px;
|
|
217
|
+
}
|
|
218
|
+
.craft-sidebar {
|
|
219
|
+
background: var(--craft-bg);
|
|
220
|
+
color: var(--craft-text);
|
|
221
|
+
${Q?.vibrancy?"backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);":""}
|
|
222
|
+
border-right: 1px solid var(--craft-border);
|
|
223
|
+
}
|
|
224
|
+
@media (prefers-color-scheme: dark) {
|
|
225
|
+
.craft-sidebar {
|
|
226
|
+
background: var(--craft-bg-dark);
|
|
227
|
+
color: var(--craft-text-dark);
|
|
228
|
+
border-color: var(--craft-border-dark);
|
|
229
|
+
}
|
|
230
|
+
.craft-sidebar-item:hover { background: var(--craft-hover-dark); }
|
|
231
|
+
.craft-sidebar-search input { background: var(--craft-input-bg-dark); }
|
|
232
|
+
.craft-sidebar-item-badge { background: var(--craft-badge-bg-dark); }
|
|
233
|
+
}
|
|
234
|
+
`}else if($==="windows"||$==="win32"){let Q=J.platform?.windows;Y=`
|
|
235
|
+
:root {
|
|
236
|
+
--craft-font-family: 'Segoe UI Variable', 'Segoe UI', sans-serif;
|
|
237
|
+
--craft-bg: ${Q?.material==="mica"?"rgba(243,243,243,0.9)":"#f3f3f3"};
|
|
238
|
+
--craft-bg-dark: ${Q?.material==="mica"?"rgba(32,32,32,0.9)":"#202020"};
|
|
239
|
+
--craft-text: #1a1a1a;
|
|
240
|
+
--craft-text-dark: #fff;
|
|
241
|
+
--craft-border: rgba(0,0,0,0.08);
|
|
242
|
+
--craft-border-dark: rgba(255,255,255,0.08);
|
|
243
|
+
--craft-hover: rgba(0,0,0,0.04);
|
|
244
|
+
--craft-hover-dark: rgba(255,255,255,0.06);
|
|
245
|
+
--craft-accent: #0078d4;
|
|
246
|
+
--craft-accent-text: #fff;
|
|
247
|
+
--craft-input-bg: #fff;
|
|
248
|
+
--craft-input-bg-dark: rgba(255,255,255,0.06);
|
|
249
|
+
--craft-badge-bg: rgba(0,0,0,0.05);
|
|
250
|
+
--craft-badge-bg-dark: rgba(255,255,255,0.08);
|
|
251
|
+
--craft-radius: ${Q?.rounded?"4px":"0"};
|
|
252
|
+
}
|
|
253
|
+
.craft-sidebar {
|
|
254
|
+
background: var(--craft-bg);
|
|
255
|
+
color: var(--craft-text);
|
|
256
|
+
${Q?.material!=="none"?"backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);":""}
|
|
257
|
+
}
|
|
258
|
+
@media (prefers-color-scheme: dark) {
|
|
259
|
+
.craft-sidebar {
|
|
260
|
+
background: var(--craft-bg-dark);
|
|
261
|
+
color: var(--craft-text-dark);
|
|
262
|
+
}
|
|
263
|
+
.craft-sidebar-item:hover { background: var(--craft-hover-dark); }
|
|
264
|
+
.craft-sidebar-search input { background: var(--craft-input-bg-dark); border-color: var(--craft-border-dark); }
|
|
265
|
+
.craft-sidebar-item-badge { background: var(--craft-badge-bg-dark); }
|
|
266
|
+
}
|
|
267
|
+
`}else Y=`
|
|
268
|
+
:root {
|
|
269
|
+
--craft-font-family: 'Cantarell', 'Ubuntu', sans-serif;
|
|
270
|
+
--craft-bg: #f6f5f4;
|
|
271
|
+
--craft-bg-dark: #303030;
|
|
272
|
+
--craft-text: #2e3436;
|
|
273
|
+
--craft-text-dark: #fff;
|
|
274
|
+
--craft-border: rgba(0,0,0,0.12);
|
|
275
|
+
--craft-border-dark: rgba(255,255,255,0.12);
|
|
276
|
+
--craft-hover: rgba(0,0,0,0.05);
|
|
277
|
+
--craft-hover-dark: rgba(255,255,255,0.08);
|
|
278
|
+
--craft-accent: #3584e4;
|
|
279
|
+
--craft-accent-text: #fff;
|
|
280
|
+
--craft-input-bg: #fff;
|
|
281
|
+
--craft-input-bg-dark: rgba(255,255,255,0.08);
|
|
282
|
+
--craft-badge-bg: rgba(0,0,0,0.08);
|
|
283
|
+
--craft-badge-bg-dark: rgba(255,255,255,0.12);
|
|
284
|
+
--craft-radius: 6px;
|
|
285
|
+
}
|
|
286
|
+
.craft-sidebar {
|
|
287
|
+
background: var(--craft-bg);
|
|
288
|
+
color: var(--craft-text);
|
|
289
|
+
border-right: 1px solid var(--craft-border);
|
|
290
|
+
}
|
|
291
|
+
@media (prefers-color-scheme: dark) {
|
|
292
|
+
.craft-sidebar {
|
|
293
|
+
background: var(--craft-bg-dark);
|
|
294
|
+
color: var(--craft-text-dark);
|
|
295
|
+
border-color: var(--craft-border-dark);
|
|
296
|
+
}
|
|
297
|
+
.craft-sidebar-item:hover { background: var(--craft-hover-dark); }
|
|
298
|
+
.craft-sidebar-search input { background: var(--craft-input-bg-dark); border-color: var(--craft-border-dark); }
|
|
299
|
+
.craft-sidebar-item-badge { background: var(--craft-badge-bg-dark); }
|
|
300
|
+
}
|
|
301
|
+
`;return X+Y}function y(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function B0(J){let $=(X)=>`
|
|
302
|
+
<div class="craft-sidebar-item${X.selected?" selected":""}" data-id="${y(X.id)}">
|
|
303
|
+
${X.icon?`<span class="craft-sidebar-item-icon">${x0(X.icon,X.tintColor)}</span>`:""}
|
|
304
|
+
<span class="craft-sidebar-item-label">${y(X.label)}</span>
|
|
305
|
+
${X.badge!==void 0?`<span class="craft-sidebar-item-badge">${y(String(X.badge))}</span>`:""}
|
|
306
|
+
</div>
|
|
307
|
+
`,Z=(X)=>`
|
|
308
|
+
<div class="craft-sidebar-section" data-section="${y(X.id)}">
|
|
309
|
+
${X.title?`
|
|
310
|
+
<div class="craft-sidebar-section-header${X.collapsed?" collapsed":""}" data-section-toggle="${y(X.id)}">
|
|
311
|
+
${X.collapsible!==!1?'<svg class="craft-sidebar-section-chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m9 18 6-6-6-6"/></svg>':""}
|
|
312
|
+
${y(X.title)}
|
|
313
|
+
</div>
|
|
314
|
+
`:""}
|
|
315
|
+
<div class="craft-sidebar-section-items${X.collapsed?" collapsed":""}" data-section-items="${y(X.id)}">
|
|
316
|
+
${X.items.map($).join("")}
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
`;return`
|
|
320
|
+
<aside class='craft-sidebar'>
|
|
321
|
+
${J.headerTitle?`
|
|
322
|
+
<div class='craft-sidebar-header'>
|
|
323
|
+
<div class='craft-sidebar-header-title'>${y(J.headerTitle)}</div>
|
|
324
|
+
${J.headerSubtitle?`<div class="craft-sidebar-header-subtitle">${y(J.headerSubtitle)}</div>`:""}
|
|
325
|
+
</div>
|
|
326
|
+
`:""}
|
|
327
|
+
${J.showSearch?`
|
|
328
|
+
<div class='craft-sidebar-search'>
|
|
329
|
+
<input type='text' placeholder='${y(J.searchPlaceholder||"Search")}' data-sidebar-search>
|
|
330
|
+
</div>
|
|
331
|
+
`:""}
|
|
332
|
+
<div class='craft-sidebar-content'>
|
|
333
|
+
${J.sections?.map(Z).join("")||""}
|
|
334
|
+
${J.items?.map($).join("")||""}
|
|
335
|
+
</div>
|
|
336
|
+
</aside>
|
|
337
|
+
`}function x0(J,$){let Z=y($||"currentColor"),X={folder:`<svg viewBox='0 0 24 24' fill='${Z}'><path d='M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'/></svg>`,file:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><path d='M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/><polyline points='13 2 13 9 20 9'/></svg>`,home:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><path d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/></svg>`,download:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><path d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/><polyline points='7 10 12 15 17 10'/><line x1='12' y1='15' x2='12' y2='3'/></svg>`,cloud:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><path d='M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z'/></svg>`,star:`<svg viewBox='0 0 24 24' fill='${Z}'><polygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/></svg>`,settings:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><circle cx='12' cy='12' r='3'/><path d='M12 1v2m0 18v2M4.22 4.22l1.42 1.42m12.72 12.72 1.42 1.42M1 12h2m18 0h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/></svg>`,user:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><path d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/><circle cx='12' cy='7' r='4'/></svg>`,users:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><path d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M23 21v-2a4 4 0 0 0-3-3.87m-4-12a4 4 0 0 1 0 7.75'/></svg>`,clock:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><circle cx='12' cy='12' r='10'/><polyline points='12 6 12 12 16 14'/></svg>`,computer:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><rect x='2' y='3' width='20' height='14' rx='2' ry='2'/><line x1='8' y1='21' x2='16' y2='21'/><line x1='12' y1='17' x2='12' y2='21'/></svg>`,globe:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><circle cx='12' cy='12' r='10'/><line x1='2' y1='12' x2='22' y2='12'/><path d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/></svg>`,tag:`<svg viewBox='0 0 24 24' fill='${Z}'><circle cx='12' cy='12' r='8'/></svg>`,wifi:`<svg viewBox='0 0 24 24' fill='none' stroke='${Z}' stroke-width='2'><path d='M5 12.55a11 11 0 0 1 14.08 0M1.42 9a16 16 0 0 1 21.16 0M8.53 16.11a6 6 0 0 1 6.95 0M12 20h.01'/></svg>`};return X[J]||X.file}class QJ{config;element=null;onSelectHandler;onSearchHandler;listenerCleanups=[];constructor(J={}){let $=G(),Z=T0($);this.config={...Z,...J}}render(){let J=G();return{html:B0(this.config),css:N0(this.config,J)}}mount(J="body"){let $=typeof J==="string"?document.querySelector(J):J;if(!$){console.error("[Sidebar] Container not found");return}let{html:Z,css:X}=this.render(),Y=document.createElement("style");Y.textContent=X,document.head.appendChild(Y),$.insertAdjacentHTML("afterbegin",Z),this.element=$.querySelector(".craft-sidebar"),this.attachEventListeners()}update(J){if(this.config={...this.config,...J},this.element){this.detachEventListeners();let{html:$}=this.render();this.element.outerHTML=$,this.element=document.querySelector(".craft-sidebar"),this.attachEventListeners()}}destroy(){if(this.detachEventListeners(),this.element)this.element.remove(),this.element=null}detachEventListeners(){for(let J of this.listenerCleanups)J();this.listenerCleanups=[]}selectItem(J){if(!this.element)return;this.element.querySelectorAll(".craft-sidebar-item").forEach(($)=>{$.classList.toggle("selected",$.getAttribute("data-id")===J)})}onSelect(J){this.onSelectHandler=J}onSearch(J){this.onSearchHandler=J}attachEventListeners(){if(!this.element)return;let J=(Z,X,Y)=>{Z.addEventListener(X,Y),this.listenerCleanups.push(()=>Z.removeEventListener(X,Y))};this.element.querySelectorAll(".craft-sidebar-item").forEach((Z)=>{J(Z,"click",()=>{let X=Z.getAttribute("data-id");if(!X)return;if(this.element?.querySelectorAll(".craft-sidebar-item").forEach((Y)=>{Y.classList.remove("selected")}),Z.classList.add("selected"),this.onSelectHandler){let Y=this.findItem(X);this.onSelectHandler({itemId:X,item:Y||{id:X,label:""}})}})}),this.element.querySelectorAll("[data-section-toggle]").forEach((Z)=>{J(Z,"click",()=>{let X=Z.getAttribute("data-section-toggle"),Y=this.element?.querySelector(`[data-section-items='${X}']`);if(Y)Z.classList.toggle("collapsed"),Y.classList.toggle("collapsed")})});let $=this.element.querySelector("[data-sidebar-search]");if($){let Z=this.config.searchDebounceMs??80,X=null;this.listenerCleanups.push(()=>{if(X)clearTimeout(X)}),J($,"input",()=>{let Y=$.value.toLowerCase();if(this.element?.querySelectorAll(".craft-sidebar-item").forEach((Q)=>{let q=Q.querySelector(".craft-sidebar-item-label")?.textContent?.toLowerCase()||"";Q.style.display=q.includes(Y)?"":"none"}),!this.onSearchHandler)return;if(Z<=0){this.onSearchHandler({query:$.value});return}if(X)clearTimeout(X);X=setTimeout(()=>{X=null,this.onSearchHandler?.({query:$.value})},Z)})}}findItem(J){let $=(Z)=>{for(let X of Z){if(X.id===J)return X;if(X.children){let Y=$(X.children);if(Y)return Y}}};if(this.config.items){let Z=$(this.config.items);if(Z)return Z}for(let Z of this.config.sections||[]){let X=$(Z.items);if(X)return X}}}function S0(J={}){return new QJ(J)}function k0(J){let $=G(),Z=$==="macos"||$==="darwin";return new QJ({sections:J||[{id:"favorites",title:"Favorites",collapsible:!0,items:[{id:"home",label:"Home",icon:"home"},{id:"desktop",label:"Desktop",icon:"computer"},{id:"documents",label:"Documents",icon:"folder"},{id:"downloads",label:"Downloads",icon:"download"}]},{id:"cloud",title:Z?"iCloud":"Cloud",collapsible:!0,items:[{id:"cloud-drive",label:Z?"iCloud Drive":"Cloud Storage",icon:"cloud"}]},{id:"locations",title:"Locations",collapsible:!0,items:[{id:"this-pc",label:Z?"This Mac":"This PC",icon:"computer"},{id:"network",label:"Network",icon:"globe"}]}],showSearch:!0,searchPlaceholder:"Search"})}function I0(J){return new QJ({items:J,showSearch:!0,searchPlaceholder:"Search settings",platform:{macos:{vibrancy:!0,trafficLightsInSidebar:!0,hideTitlebarSeparator:!0},windows:{material:"mica",rounded:!0}}})}var IX={create:S0,file:k0,settings:I0,Sidebar:QJ},w0={};V8(w0,{updateTouchBarItem:()=>JZ,updateToolbarItem:()=>a0,tahoeStyle:()=>gJ,sidebarSeparator:()=>u0,sidebarSection:()=>h0,sidebarItem:()=>y0,showQuickLook:()=>c0,showFontPicker:()=>s0,showDatePicker:()=>r0,showColorPicker:()=>n0,setTouchBar:()=>e0,setToolbarVisible:()=>t0,setToolbar:()=>o0,orbstackStyle:()=>mJ,hideQuickLook:()=>d0,default:()=>YZ,createTahoeSidebar:()=>P0,createTableView:()=>p0,createSplitView:()=>g0,createSidebar:()=>v0,createProgress:()=>i0,createOutlineView:()=>m0,createOrbStackSidebar:()=>b0,createFileBrowser:()=>f0,createArcSidebar:()=>C0,canQuickLook:()=>l0,arcStyle:()=>fJ,TableViewInstance:()=>lJ,StyleSheet:()=>y8,SplitViewInstance:()=>pJ,Sidebar:()=>JJ,ProgressInstance:()=>nJ,Platform:()=>v8,OutlineViewInstance:()=>dJ,FileBrowserInstance:()=>cJ,Animated:()=>u8});var gJ={style:"tahoe",width:220,minWidth:150,maxWidth:350,collapsible:!0,collapsedWidth:0,resizable:!0,background:"sidebar",showSeparator:!1,searchable:!0,searchPlaceholder:"Search",dragAndDrop:!0},fJ={style:"arc",width:260,minWidth:48,maxWidth:320,collapsible:!0,collapsedWidth:48,resizable:!0,background:"under-window",showSeparator:!0,searchable:!0,searchPlaceholder:"Search tabs...",dragAndDrop:!0},mJ={style:"orbstack",width:200,minWidth:160,maxWidth:280,collapsible:!0,collapsedWidth:0,resizable:!1,background:"#1a1a1a",showSeparator:!0,separatorColor:"#333",searchable:!1,dragAndDrop:!1};class JJ{_id;_config;_listeners=new Map;_items=new Map;_selectedId=null;_destroyed=!1;constructor(J={}){this._id=`sidebar_${Date.now()}`,this._config=this._applyStylePreset(J),this._indexItems(),this._setupEventListeners()}get id(){return this._id}get config(){return{...this._config}}get selectedId(){return this._selectedId}get selectedItem(){return this._selectedId?this._items.get(this._selectedId)||null:null}get isCollapsed(){return this._config.collapsed||!1}_applyStylePreset(J){let $={};switch(J.style){case"tahoe":$=gJ;break;case"arc":$=fJ;break;case"orbstack":$=mJ;break}return{...$,...J}}_indexItems(){this._items.clear();let J=($)=>{if(!$)return;$.forEach((Z)=>{if(this._items.set(Z.id,Z),Z.children)J(Z.children)})};J(this._config.items),this._config.sections?.forEach(($)=>{J($.items)})}_setupEventListeners(){if(typeof window<"u")["select","double-click","context-menu","expand","collapse","resize","search","drag-start","drag-end","drop","reorder","header-action","footer-action"].forEach(($)=>{window.addEventListener(`craft:sidebar:${$}`,(Z)=>{if(Z.detail?.sidebarId===this._id){if($==="select")this._selectedId=Z.detail?.item?.id||null;this._emit($,Z.detail)}})})}_emit(J,$){let Z=this._listeners.get(J);if(Z)Z.forEach((X)=>X($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>{this._listeners.get(J)?.delete($)}}once(J,$){let Z=(X)=>{this._listeners.get(J)?.delete(Z),$(X)};return this.on(J,Z)}off(J,$){this._listeners.get(J)?.delete($)}async create(){await this._call("create",{config:this._config})}async update(J){this._config={...this._config,...J},this._indexItems(),await this._call("update",{config:this._config})}async collapse(){this._config.collapsed=!0,await this._call("collapse")}async expand(){this._config.collapsed=!1,await this._call("expand")}async toggle(){if(this._config.collapsed)await this.expand();else await this.collapse()}async setWidth(J){this._config.width=Math.max(this._config.minWidth||0,Math.min(J,this._config.maxWidth||1/0)),await this._call("setWidth",{width:this._config.width})}async destroy(){await this._call("destroy"),this._destroyed=!0,this._listeners.clear()}async select(J){this._selectedId=J,await this._call("select",{itemId:J})}async clearSelection(){this._selectedId=null,await this._call("clearSelection")}getItem(J){return this._items.get(J)}async addItem(J,$){this._items.set(J.id,J),await this._call("addItem",{item:J,...$})}async updateItem(J,$){let Z=this._items.get(J);if(Z)Object.assign(Z,$),await this._call("updateItem",{itemId:J,updates:$})}async removeItem(J){if(this._items.delete(J),this._selectedId===J)this._selectedId=null;await this._call("removeItem",{itemId:J})}async setItems(J){this._config.items=J,this._indexItems(),await this._call("setItems",{items:J})}async setSections(J){this._config.sections=J,this._indexItems(),await this._call("setSections",{sections:J})}async expandItem(J){let $=this._items.get(J);if($)$.expanded=!0,await this._call("expandItem",{itemId:J})}async collapseItem(J){let $=this._items.get(J);if($)$.expanded=!1,await this._call("collapseItem",{itemId:J})}async scrollToItem(J){await this._call("scrollToItem",{itemId:J})}async setBadge(J,$){let Z=this._items.get(J);if(Z)Z.badge=$??void 0,await this._call("setBadge",{itemId:J,badge:$})}async addSection(J,$){if(!this._config.sections)this._config.sections=[];if($!==void 0)this._config.sections.splice($,0,J);else this._config.sections.push(J);J.items.forEach((Z)=>this._items.set(Z.id,Z)),await this._call("addSection",{section:J,index:$})}async updateSection(J,$){let Z=this._config.sections?.find((X)=>X.id===J);if(Z){if(Object.assign(Z,$),$.items)$.items.forEach((X)=>this._items.set(X.id,X));await this._call("updateSection",{sectionId:J,updates:$})}}async removeSection(J){let $=this._config.sections?.findIndex((Z)=>Z.id===J);if($!==void 0&&$>=0&&this._config.sections)this._config.sections[$].items.forEach((X)=>this._items.delete(X.id)),this._config.sections.splice($,1),await this._call("removeSection",{sectionId:J})}async collapseSection(J){let $=this._config.sections?.find((Z)=>Z.id===J);if($)$.collapsed=!0,await this._call("collapseSection",{sectionId:J})}async expandSection(J){let $=this._config.sections?.find((Z)=>Z.id===J);if($)$.collapsed=!1,await this._call("expandSection",{sectionId:J})}async setSearchQuery(J){await this._call("setSearchQuery",{query:J})}async clearSearch(){await this._call("clearSearch")}async focusSearch(){await this._call("focusSearch")}async _call(J,$){let Z={sidebarId:this._id,...$};if(typeof window<"u"&&window.webkit?.messageHandlers?.craft)return new Promise((Y,Q)=>{try{window.webkit.messageHandlers.craft.postMessage({type:"sidebar",action:J,data:Z}),Y(void 0)}catch(q){Q(q)}});return D().request(`sidebar.${J}`,Z)}}function P0(J={}){return new JJ({...gJ,...J,style:"tahoe"})}function C0(J={}){return new JJ({...fJ,...J,style:"arc"})}function b0(J={}){return new JJ({...mJ,...J,style:"orbstack"})}function v0(J={}){return new JJ(J)}function y0(J,$,Z={}){return{id:J,label:$,...Z}}function h0(J,$,Z={}){return{id:J,items:$,...Z}}function u0(J){return{id:J||`separator_${Date.now()}`,label:"",disabled:!0}}var Y8=0;function GJ(J){return Y8++,`${J}_${Date.now()}_${Y8}`}async function g0(J={}){let $=J.id||GJ("splitview");return await V("component.createSplitView",{id:$,config:J}),new pJ($,J)}class pJ{id;type="splitView";_config;_listeners=new Map;constructor(J,$){this.id=J,this._config=$,this._setupListeners()}_setupListeners(){if(typeof window<"u")window.addEventListener(`craft:splitView:${this.id}:resize`,(J)=>{this._emit("resize",J.detail)})}_emit(J,$){this._listeners.get(J)?.forEach((Z)=>Z($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>this._listeners.get(J)?.delete($)}async update(J){Object.assign(this._config,J),await V("component.update",{id:this.id,props:J})}async destroy(){await V("component.destroy",{id:this.id})}async show(){await V("component.show",{id:this.id})}async hide(){await V("component.hide",{id:this.id})}async focus(){await V("component.focus",{id:this.id})}async setPosition(J,$){this._config.position=J,await V("splitView.setPosition",{id:this.id,position:J,animated:$})}async getPosition(){return V("splitView.getPosition",{id:this.id})}async collapsePane(J){await V("splitView.collapsePane",{id:this.id,index:J})}async expandPane(J){await V("splitView.expandPane",{id:this.id,index:J})}}async function f0(J={}){let $=J.id||GJ("filebrowser");return await V("component.createFileBrowser",{id:$,config:J}),new cJ($,J)}class cJ{id;type="fileBrowser";_config;_listeners=new Map;constructor(J,$){this.id=J,this._config=$,this._setupListeners()}_setupListeners(){if(typeof window<"u")["select","open","navigate","context-menu"].forEach(($)=>{window.addEventListener(`craft:fileBrowser:${this.id}:${$}`,(Z)=>{this._emit($,Z.detail)})})}_emit(J,$){this._listeners.get(J)?.forEach((Z)=>Z($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>this._listeners.get(J)?.delete($)}async update(J){Object.assign(this._config,J),await V("component.update",{id:this.id,props:J})}async destroy(){await V("component.destroy",{id:this.id})}async show(){await V("component.show",{id:this.id})}async hide(){await V("component.hide",{id:this.id})}async focus(){await V("component.focus",{id:this.id})}async getSelection(){return V("fileBrowser.getSelection",{id:this.id})}async setSelection(J){await V("fileBrowser.setSelection",{id:this.id,paths:J})}async navigateTo(J){await V("fileBrowser.navigateTo",{id:this.id,path:J})}async goBack(){await V("fileBrowser.goBack",{id:this.id})}async goForward(){await V("fileBrowser.goForward",{id:this.id})}async goUp(){await V("fileBrowser.goUp",{id:this.id})}async refresh(){await V("fileBrowser.refresh",{id:this.id})}async createFolder(J){return V("fileBrowser.createFolder",{id:this.id,name:J})}async deleteSelection(J){await V("fileBrowser.deleteSelection",{id:this.id,moveToTrash:J})}async getCurrentPath(){return V("fileBrowser.getCurrentPath",{id:this.id})}}async function m0(J={}){let $=J.id||GJ("outlineview");return await V("component.createOutlineView",{id:$,config:J}),new dJ($,J)}class dJ{id;type="outlineView";_config;_listeners=new Map;constructor(J,$){this.id=J,this._config=$,this._setupListeners()}_setupListeners(){if(typeof window<"u")["select","double-click","expand","collapse","reorder","edit"].forEach(($)=>{window.addEventListener(`craft:outlineView:${this.id}:${$}`,(Z)=>{this._emit($,Z.detail)})})}_emit(J,$){this._listeners.get(J)?.forEach((Z)=>Z($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>this._listeners.get(J)?.delete($)}async update(J){Object.assign(this._config,J),await V("component.update",{id:this.id,props:J})}async destroy(){await V("component.destroy",{id:this.id})}async show(){await V("component.show",{id:this.id})}async hide(){await V("component.hide",{id:this.id})}async focus(){await V("component.focus",{id:this.id})}async setItems(J){this._config.items=J,await V("outlineView.setItems",{id:this.id,items:J})}async addItem(J,$,Z){await V("outlineView.addItem",{id:this.id,item:J,parentId:$,index:Z})}async updateItem(J,$){await V("outlineView.updateItem",{id:this.id,itemId:J,updates:$})}async removeItem(J){await V("outlineView.removeItem",{id:this.id,itemId:J})}async expandItem(J){await V("outlineView.expandItem",{id:this.id,itemId:J})}async collapseItem(J){await V("outlineView.collapseItem",{id:this.id,itemId:J})}async selectItem(J){await V("outlineView.selectItem",{id:this.id,itemId:J})}async getSelection(){return V("outlineView.getSelection",{id:this.id})}async scrollToItem(J){await V("outlineView.scrollToItem",{id:this.id,itemId:J})}}async function p0(J={}){let $=J.id||GJ("tableview");return await V("component.createTableView",{id:$,config:J}),new lJ($,J)}class lJ{id;type="tableView";_config;_listeners=new Map;constructor(J,$){this.id=J,this._config=$,this._setupListeners()}_setupListeners(){if(typeof window<"u")["select","double-click","sort","edit","column-resize","column-reorder"].forEach(($)=>{window.addEventListener(`craft:tableView:${this.id}:${$}`,(Z)=>{this._emit($,Z.detail)})})}_emit(J,$){this._listeners.get(J)?.forEach((Z)=>Z($))}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>this._listeners.get(J)?.delete($)}async update(J){Object.assign(this._config,J),await V("component.update",{id:this.id,props:J})}async destroy(){await V("component.destroy",{id:this.id})}async show(){await V("component.show",{id:this.id})}async hide(){await V("component.hide",{id:this.id})}async focus(){await V("component.focus",{id:this.id})}async setColumns(J){this._config.columns=J,await V("tableView.setColumns",{id:this.id,columns:J})}async setRows(J){this._config.rows=J,await V("tableView.setRows",{id:this.id,rows:J})}async addRow(J,$){await V("tableView.addRow",{id:this.id,row:J,index:$})}async updateRow(J,$){await V("tableView.updateRow",{id:this.id,rowId:J,values:$})}async removeRow(J){await V("tableView.removeRow",{id:this.id,rowId:J})}async getSelection(){return V("tableView.getSelection",{id:this.id})}async selectRows(J){await V("tableView.selectRows",{id:this.id,rowIds:J})}async sortBy(J,$){await V("tableView.sortBy",{id:this.id,columnId:J,direction:$})}async scrollToRow(J){await V("tableView.scrollToRow",{id:this.id,rowId:J})}}async function c0(J){await V("quickLook.show",J)}async function d0(){await V("quickLook.hide",{})}async function l0(J){return V("quickLook.canPreview",{path:J})}async function n0(J={}){return V("colorPicker.show",J)}async function s0(J={}){return V("fontPicker.show",J)}async function r0(J={}){let $=await V("datePicker.show",J);return $?new Date($):null}async function i0(J={}){let $=J.id||GJ("progress");return await V("component.createProgress",{id:$,config:J}),new nJ($,J)}class nJ{id;type="progress";_config;_listeners=new Map;constructor(J,$){this.id=J,this._config=$}on(J,$){if(!this._listeners.has(J))this._listeners.set(J,new Set);return this._listeners.get(J).add($),()=>this._listeners.get(J)?.delete($)}async update(J){Object.assign(this._config,J),await V("component.update",{id:this.id,props:J})}async destroy(){await V("component.destroy",{id:this.id})}async show(){await V("component.show",{id:this.id})}async hide(){await V("component.hide",{id:this.id})}async focus(){await V("component.focus",{id:this.id})}async setValue(J){this._config.value=J,await V("progress.setValue",{id:this.id,value:J})}async startAnimation(){await V("progress.startAnimation",{id:this.id})}async stopAnimation(){await V("progress.stopAnimation",{id:this.id})}}async function o0(J){await V("toolbar.set",J)}async function a0(J,$){await V("toolbar.updateItem",{itemId:J,updates:$})}async function t0(J){await V("toolbar.setVisible",{visible:J})}async function e0(J){await V("touchBar.set",J)}async function JZ(J,$){await V("touchBar.updateItem",{itemId:J,updates:$})}async function V(J,$){if(typeof window<"u"&&window.webkit?.messageHandlers?.craft)return new Promise((X,Y)=>{try{window.webkit.messageHandlers.craft.postMessage({type:"native-ui",method:J,params:$}),X(void 0)}catch(Q){Y(Q)}});return D().request(J,$)}var v8={OS:$Z(),Version:ZZ(),isIOS(){return this.OS==="ios"},isAndroid(){return this.OS==="android"},isWeb(){return this.OS==="web"},select(J){if(this.OS==="ios"&&J.ios!==void 0)return J.ios;if(this.OS==="android"&&J.android!==void 0)return J.android;if(this.OS==="web"&&J.web!==void 0)return J.web;return J.default}},y8={create(J){return J},flatten(J){if(!J)return;if(Array.isArray(J))return Object.assign({},...J);return J},absoluteFill:{position:"absolute",top:0,left:0,right:0,bottom:0},hairlineWidth:typeof window<"u"?1/(window.devicePixelRatio||1):1};class h8{_value;_listeners=[];constructor(J){this._value=J}setValue(J){this._value=J,this._listeners.forEach(($)=>$(J))}getValue(){return this._value}addListener(J){return this._listeners.push(J),String(this._listeners.length-1)}removeListener(J){let $=parseInt(J,10);if($>=0&&$<this._listeners.length)this._listeners.splice($,1)}removeAllListeners(){this._listeners=[]}}function Q8(J,$){return{start(Z){let X=J.getValue(),Y=Date.now(),Q=$.duration||300,q=()=>{let U=Date.now()-Y-($.delay||0);if(U<0){requestAnimationFrame(q);return}let z=Math.min(U/Q,1),W=$.easing?$.easing(z):z,H=X+($.toValue-X)*W;if(J.setValue(H),z<1)requestAnimationFrame(q);else Z?.({finished:!0})};requestAnimationFrame(q)},stop(){}}}var u8={Value:h8,timing:Q8,spring(J,$){return{start(Z){let X=300*($.friction||7)/7;Q8(J,{toValue:$.toValue,duration:X,easing:(Y)=>1-(1-Y)**3,useNativeDriver:$.useNativeDriver}).start(Z)},stop(){}}},parallel(J){return{start($){let Z=0,X=J.length;if(X===0){$?.({finished:!0});return}J.forEach((Y)=>{Y.start(()=>{if(Z++,Z===X)$?.({finished:!0})})})},stop(){}}},sequence(J){return{start($){let Z=(X)=>{if(X>=J.length){$?.({finished:!0});return}J[X].start(()=>Z(X+1))};Z(0)},stop(){}}}};function $Z(){if(typeof window>"u")return"web";let J=navigator.userAgent.toLowerCase();if(/iphone|ipad|ipod/.test(J))return"ios";if(/android/.test(J))return"android";return"web"}function ZZ(){if(typeof window>"u")return"unknown";let J=navigator.userAgent,$=J.match(/(?:iPhone|iPad|iPod).*?OS (\d+)/)||J.match(/Android (\d+)/);return $?$[1]:"unknown"}var XZ={Platform:v8,StyleSheet:y8,Animated:u8},YZ=XZ;function QZ(J,...$){let Z="";for(let X=0;X<J.length;X++)if(Z+=J[X],X<$.length)Z+=String($[X]);return Z.replace(/\s+/g," ").trim()}function g8(...J){let $=[];for(let Z of J){if(!Z)continue;if(typeof Z==="string"||typeof Z==="number")$.push(String(Z));else if(Array.isArray(Z)){let X=g8(...Z);if(X)$.push(X)}else if(typeof Z==="object"){for(let[X,Y]of Object.entries(Z))if(Y)$.push(X)}}return $.join(" ")}function GZ(J){return($={})=>{let Z=[];if(J.base)Z.push(J.base);for(let[X,Y]of Object.entries(J.variants)){let Q=$[X]??J.defaultVariants?.[X];if(Q!==void 0&&Y[Q])Z.push(Y[Q])}if(J.compoundVariants)for(let X of J.compoundVariants){let{className:Y,...Q}=X,q=!0;for(let[U,z]of Object.entries(Q))if(($[U]??J.defaultVariants?.[U])!==z){q=!1;break}if(q&&Y)Z.push(Y)}if($.className)Z.push($.className);return Z.join(" ")}}function wX(J){let $={},Z=J.split(/\s+/).filter(Boolean);for(let X of Z){let Y=KZ(X);if(Y)Object.assign($,Y)}return $}function KZ(J){let $=J.match(/^([pm])([trblxy])?-(\d+(?:\.\d+)?|px)$/);if($){let[,W,H,L]=$,R=L==="px"?1:parseFloat(L)*4,O=W==="p"?"padding":"margin";if(!H)return{[O]:R};if(H==="x")return{[`${O}Left`]:R,[`${O}Right`]:R};if(H==="y")return{[`${O}Top`]:R,[`${O}Bottom`]:R};return{[`${O}${{t:"Top",r:"Right",b:"Bottom",l:"Left"}[H]}`]:R}}let Z=J.match(/^(w|h|min-w|max-w|min-h|max-h)-(\d+|full|screen|auto)$/);if(Z){let[,W,H]=Z,L={w:"width",h:"height","min-w":"minWidth","max-w":"maxWidth","min-h":"minHeight","max-h":"maxHeight"},O={full:"100%",screen:"100vh",auto:"auto"}[H]??parseFloat(H)*4;return{[L[W]]:O}}if(J==="flex")return{display:"flex"};if(J==="flex-1")return{flex:1};if(J==="flex-row")return{flexDirection:"row"};if(J==="flex-col")return{flexDirection:"column"};if(J==="flex-wrap")return{flexWrap:"wrap"};if(J==="items-center")return{alignItems:"center"};if(J==="items-start")return{alignItems:"flex-start"};if(J==="items-end")return{alignItems:"flex-end"};if(J==="justify-center")return{justifyContent:"center"};if(J==="justify-start")return{justifyContent:"flex-start"};if(J==="justify-end")return{justifyContent:"flex-end"};if(J==="justify-between")return{justifyContent:"space-between"};if(J==="justify-around")return{justifyContent:"space-around"};let X=J.match(/^gap-(\d+(?:\.\d+)?)$/);if(X)return{gap:parseFloat(X[1])*4};let Y={"rounded-none":0,"rounded-sm":2,rounded:4,"rounded-md":6,"rounded-lg":8,"rounded-xl":12,"rounded-2xl":16,"rounded-3xl":24,"rounded-full":9999};if(Y[J]!==void 0)return{borderRadius:Y[J]};let Q={"text-xs":12,"text-sm":14,"text-base":16,"text-lg":18,"text-xl":20,"text-2xl":24,"text-3xl":30,"text-4xl":36};if(Q[J])return{fontSize:Q[J]};let q={"font-thin":"100","font-extralight":"200","font-light":"300","font-normal":"400","font-medium":"500","font-semibold":"600","font-bold":"700","font-extrabold":"800","font-black":"900"};if(q[J])return{fontWeight:q[J]};if(J==="text-left")return{textAlign:"left"};if(J==="text-center")return{textAlign:"center"};if(J==="text-right")return{textAlign:"right"};let U=J.match(/^(bg|text|border)-(\w+)-(\d{2,3})$/);if(U){let[,W,H,L]=U,R=qZ(H,parseInt(L,10));if(R)return{[{bg:"backgroundColor",text:"color",border:"borderColor"}[W]]:R}}if(J==="bg-white")return{backgroundColor:"#ffffff"};if(J==="bg-black")return{backgroundColor:"#000000"};if(J==="bg-transparent")return{backgroundColor:"transparent"};if(J==="text-white")return{color:"#ffffff"};if(J==="text-black")return{color:"#000000"};let z=J.match(/^opacity-(\d+)$/);if(z)return{opacity:parseInt(z[1],10)/100};if(J==="relative")return{position:"relative"};if(J==="absolute")return{position:"absolute"};if(J==="hidden")return{display:"none"};if(J==="block")return{display:"block"};if(J==="inline")return{display:"inline"};if(J==="overflow-hidden")return{overflow:"hidden"};if(J==="overflow-scroll")return{overflow:"scroll"};if(J==="overflow-auto")return{overflow:"auto"};return null}function qZ(J,$){return{slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843"}}[J]?.[$]??null}function PX(J){return JSON.stringify({content:J.content,output:J.output,minify:J.minify??!1,darkMode:J.darkMode??"class",jit:J.jit??!0,theme:J.theme??{}},null,2)}async function CX(J){if(typeof window<"u"){console.warn("buildCSS can only be run in Node.js environment");return}let{exec:$}=await import("child_process"),{promisify:Z}=await import("util"),X=Z($),Y=["build","--content",J.content.join(","),"--output",J.output];if(J.minify)Y.push("--minify");try{await X(`headwind ${Y.join(" ")}`),console.log(`CSS built successfully: ${J.output}`)}catch(Q){throw console.error("Failed to build CSS:",Q),Q}}var _J={sidebar:`
|
|
338
|
+
w-[250px] h-full flex flex-col
|
|
339
|
+
bg-white/55 dark:bg-[#1e1e23]/55
|
|
340
|
+
backdrop-blur-[60px] backdrop-saturate-[1.8]
|
|
341
|
+
text-black dark:text-white
|
|
342
|
+
select-none
|
|
343
|
+
`,content:`
|
|
344
|
+
flex-1 overflow-y-auto overflow-x-hidden
|
|
345
|
+
px-[10px] pb-[10px]
|
|
346
|
+
`,section:`
|
|
347
|
+
flex flex-col gap-[2px]
|
|
348
|
+
`,sectionHeader:`
|
|
349
|
+
pl-[8px] pr-[6px] pt-[16px] pb-[5px]
|
|
350
|
+
text-[11px] font-semibold leading-[13px]
|
|
351
|
+
text-[#3c3c43]/60 dark:text-[#ebebf5]/60
|
|
352
|
+
`,sectionHeaderCollapsible:`
|
|
353
|
+
group flex items-center w-full
|
|
354
|
+
pl-[8px] pr-[6px] pt-[16px] pb-[5px]
|
|
355
|
+
text-[11px] font-semibold leading-[13px]
|
|
356
|
+
text-[#3c3c43]/60 dark:text-[#ebebf5]/60
|
|
357
|
+
cursor-default
|
|
358
|
+
`,collapseChevron:`
|
|
359
|
+
ml-auto h-[11px] w-[11px]
|
|
360
|
+
text-[#3c3c43]/45 dark:text-[#ebebf5]/45
|
|
361
|
+
opacity-0 group-hover:opacity-100
|
|
362
|
+
transition-all duration-200
|
|
363
|
+
`,item:`
|
|
364
|
+
flex w-full items-center
|
|
365
|
+
h-[30px] rounded-[9px] pl-[4px] pr-[8px]
|
|
366
|
+
text-[13px] leading-[16px] text-black dark:text-white
|
|
367
|
+
cursor-default transition-colors duration-150 ease-out
|
|
368
|
+
hover:bg-black/4 dark:hover:bg-white/6
|
|
369
|
+
active:bg-black/10 dark:active:bg-white/18
|
|
370
|
+
`,itemSelected:`
|
|
371
|
+
flex w-full items-center
|
|
372
|
+
h-[30px] rounded-[9px] pl-[4px] pr-[8px]
|
|
373
|
+
text-[13px] leading-[16px] text-black dark:text-white
|
|
374
|
+
cursor-default
|
|
375
|
+
bg-black/8 dark:bg-white/14
|
|
376
|
+
`,disclosure:`
|
|
377
|
+
flex h-[16px] w-[18px] shrink-0 items-center justify-center
|
|
378
|
+
`,disclosureChevron:`
|
|
379
|
+
h-[11px] w-[11px]
|
|
380
|
+
text-[#3c3c43]/55 dark:text-[#ebebf5]/55
|
|
381
|
+
transition-transform duration-200 ease-out
|
|
382
|
+
`,itemIcon:`
|
|
383
|
+
h-[17px] w-[17px] flex-shrink-0
|
|
384
|
+
text-[#0088ff]
|
|
385
|
+
`,itemIconSelected:`
|
|
386
|
+
h-[17px] w-[17px] flex-shrink-0
|
|
387
|
+
text-[#0088ff]
|
|
388
|
+
`,itemIconSlot:`
|
|
389
|
+
flex h-[20px] w-[22px] shrink-0 items-center justify-center mr-[7px]
|
|
390
|
+
`,itemLabel:`
|
|
391
|
+
flex-1 truncate
|
|
392
|
+
`,itemBadge:`
|
|
393
|
+
ml-[8px] shrink-0 tabular-nums
|
|
394
|
+
text-[13px] leading-[16px]
|
|
395
|
+
text-[#3c3c43]/60 dark:text-[#ebebf5]/60
|
|
396
|
+
`,itemBadgeSelected:`
|
|
397
|
+
ml-[8px] shrink-0 tabular-nums
|
|
398
|
+
text-[13px] leading-[16px]
|
|
399
|
+
text-[#3c3c43]/60 dark:text-[#ebebf5]/60
|
|
400
|
+
`,children:`
|
|
401
|
+
ml-[16px] mt-[2px] flex flex-col gap-[2px]
|
|
402
|
+
`,dragIndicator:`
|
|
403
|
+
absolute left-0 right-0 h-0.5 bg-[#0088ff]
|
|
404
|
+
pointer-events-none
|
|
405
|
+
`,searchContainer:`
|
|
406
|
+
px-[10px] pb-[6px]
|
|
407
|
+
`,searchInput:`
|
|
408
|
+
h-[28px] w-full rounded-[8px] px-[8px]
|
|
409
|
+
text-[13px] text-black dark:text-white
|
|
410
|
+
placeholder:text-[#3c3c43]/50 dark:placeholder:text-[#ebebf5]/50
|
|
411
|
+
bg-black/5 dark:bg-white/10
|
|
412
|
+
border border-transparent
|
|
413
|
+
focus:outline-none focus:ring-2 focus:ring-[#0088ff]/60
|
|
414
|
+
transition-all duration-150
|
|
415
|
+
`,header:`
|
|
416
|
+
h-[52px] px-[21px] flex items-center gap-3
|
|
417
|
+
`,headerAvatar:`
|
|
418
|
+
w-[30px] h-[30px] rounded-full bg-black/10 dark:bg-white/15
|
|
419
|
+
flex items-center justify-center text-[13px] font-semibold
|
|
420
|
+
`,headerTitle:`
|
|
421
|
+
text-[13px] font-medium text-black dark:text-white
|
|
422
|
+
`,headerSubtitle:`
|
|
423
|
+
text-[11px] text-[#3c3c43]/60 dark:text-[#ebebf5]/60
|
|
424
|
+
`,footer:`
|
|
425
|
+
px-[10px] pb-[8px] pt-[4px] flex items-center gap-2
|
|
426
|
+
`,footerButton:`
|
|
427
|
+
grid h-[28px] w-[28px] place-items-center rounded-[7px]
|
|
428
|
+
text-[#3c3c43]/70 dark:text-[#ebebf5]/70
|
|
429
|
+
hover:bg-black/5 dark:hover:bg-white/10
|
|
430
|
+
transition-colors duration-150
|
|
431
|
+
`},sJ={sidebar:`
|
|
432
|
+
w-64 h-full flex flex-col
|
|
433
|
+
bg-neutral-100 dark:bg-neutral-900
|
|
434
|
+
border-r border-neutral-200 dark:border-neutral-800
|
|
435
|
+
transition-all duration-300 ease-out
|
|
436
|
+
select-none
|
|
437
|
+
`,sidebarCollapsed:`
|
|
438
|
+
w-12 h-full flex flex-col
|
|
439
|
+
bg-neutral-100 dark:bg-neutral-900
|
|
440
|
+
border-r border-neutral-200 dark:border-neutral-800
|
|
441
|
+
transition-all duration-300 ease-out
|
|
442
|
+
select-none
|
|
443
|
+
`,topBar:`
|
|
444
|
+
h-10 px-2 flex items-center justify-between
|
|
445
|
+
border-b border-neutral-200 dark:border-neutral-800
|
|
446
|
+
`,collapseButton:`
|
|
447
|
+
p-1.5 rounded-lg
|
|
448
|
+
text-neutral-500 dark:text-neutral-400
|
|
449
|
+
hover:bg-neutral-200 dark:hover:bg-neutral-800
|
|
450
|
+
transition-colors duration-150
|
|
451
|
+
`,newTabButton:`
|
|
452
|
+
p-1.5 rounded-lg
|
|
453
|
+
text-neutral-500 dark:text-neutral-400
|
|
454
|
+
hover:bg-neutral-200 dark:hover:bg-neutral-800
|
|
455
|
+
transition-colors duration-150
|
|
456
|
+
`,content:`
|
|
457
|
+
flex-1 overflow-y-auto overflow-x-hidden
|
|
458
|
+
py-2
|
|
459
|
+
scrollbar-thin scrollbar-thumb-neutral-300 dark:scrollbar-thumb-neutral-700
|
|
460
|
+
`,pinnedSection:`
|
|
461
|
+
px-2 pb-3 mb-2 border-b border-neutral-200 dark:border-neutral-800
|
|
462
|
+
`,pinnedLabel:`
|
|
463
|
+
px-2 py-1 text-[10px] font-semibold uppercase tracking-wider
|
|
464
|
+
text-neutral-400 dark:text-neutral-500
|
|
465
|
+
`,sectionHeader:`
|
|
466
|
+
px-3 py-2 flex items-center justify-between
|
|
467
|
+
text-[11px] font-semibold uppercase tracking-wider
|
|
468
|
+
text-neutral-500 dark:text-neutral-400
|
|
469
|
+
`,space:`
|
|
470
|
+
mb-3
|
|
471
|
+
`,spaceHeader:`
|
|
472
|
+
px-2 py-1.5 mx-2 rounded-lg flex items-center gap-2
|
|
473
|
+
cursor-pointer
|
|
474
|
+
hover:bg-neutral-200/50 dark:hover:bg-neutral-800/50
|
|
475
|
+
transition-colors duration-150
|
|
476
|
+
`,spaceIcon:`
|
|
477
|
+
w-5 h-5 rounded-md flex items-center justify-center text-xs
|
|
478
|
+
`,spaceName:`
|
|
479
|
+
flex-1 text-[12px] font-medium text-neutral-700 dark:text-neutral-200
|
|
480
|
+
`,spaceCount:`
|
|
481
|
+
text-[11px] text-neutral-400 dark:text-neutral-500
|
|
482
|
+
`,item:`
|
|
483
|
+
flex items-center gap-2.5 px-3 py-2 mx-2 rounded-xl
|
|
484
|
+
text-[13px] text-neutral-700 dark:text-neutral-300
|
|
485
|
+
cursor-pointer transition-all duration-200
|
|
486
|
+
hover:bg-neutral-200/70 dark:hover:bg-neutral-800/70
|
|
487
|
+
group
|
|
488
|
+
`,itemSelected:`
|
|
489
|
+
flex items-center gap-2.5 px-3 py-2 mx-2 rounded-xl
|
|
490
|
+
text-[13px] text-white font-medium
|
|
491
|
+
cursor-pointer transition-all duration-200
|
|
492
|
+
bg-gradient-to-r from-purple-500 to-pink-500
|
|
493
|
+
shadow-lg shadow-purple-500/25
|
|
494
|
+
`,itemCollapsed:`
|
|
495
|
+
flex items-center justify-center p-2.5 mx-1.5 rounded-xl
|
|
496
|
+
cursor-pointer transition-all duration-200
|
|
497
|
+
hover:bg-neutral-200/70 dark:hover:bg-neutral-800/70
|
|
498
|
+
group relative
|
|
499
|
+
`,itemCollapsedSelected:`
|
|
500
|
+
flex items-center justify-center p-2.5 mx-1.5 rounded-xl
|
|
501
|
+
cursor-pointer transition-all duration-200
|
|
502
|
+
bg-gradient-to-r from-purple-500 to-pink-500
|
|
503
|
+
shadow-lg shadow-purple-500/25
|
|
504
|
+
`,itemFavicon:`
|
|
505
|
+
w-4 h-4 rounded flex-shrink-0
|
|
506
|
+
bg-neutral-300 dark:bg-neutral-700
|
|
507
|
+
`,itemFaviconSelected:`
|
|
508
|
+
w-4 h-4 rounded flex-shrink-0
|
|
509
|
+
`,itemLabel:`
|
|
510
|
+
flex-1 truncate
|
|
511
|
+
`,itemClose:`
|
|
512
|
+
p-0.5 rounded opacity-0 group-hover:opacity-100
|
|
513
|
+
text-neutral-400 hover:text-neutral-600
|
|
514
|
+
dark:text-neutral-500 dark:hover:text-neutral-300
|
|
515
|
+
hover:bg-neutral-300/50 dark:hover:bg-neutral-700/50
|
|
516
|
+
transition-all duration-150
|
|
517
|
+
`,itemCloseSelected:`
|
|
518
|
+
p-0.5 rounded opacity-0 group-hover:opacity-100
|
|
519
|
+
text-white/60 hover:text-white
|
|
520
|
+
hover:bg-white/20
|
|
521
|
+
transition-all duration-150
|
|
522
|
+
`,tooltip:`
|
|
523
|
+
absolute left-full ml-2 px-2 py-1 rounded-md
|
|
524
|
+
text-[12px] text-white bg-neutral-800 dark:bg-neutral-700
|
|
525
|
+
whitespace-nowrap opacity-0 group-hover:opacity-100
|
|
526
|
+
pointer-events-none transition-opacity duration-150
|
|
527
|
+
z-50
|
|
528
|
+
`,todaySection:`
|
|
529
|
+
px-2 pt-2
|
|
530
|
+
`,todayLabel:`
|
|
531
|
+
px-2 py-1 text-[10px] font-semibold uppercase tracking-wider
|
|
532
|
+
text-neutral-400 dark:text-neutral-500
|
|
533
|
+
`,bottomBar:`
|
|
534
|
+
px-2 py-2 border-t border-neutral-200 dark:border-neutral-800
|
|
535
|
+
flex items-center gap-1
|
|
536
|
+
`,bottomButton:`
|
|
537
|
+
flex-1 py-2 rounded-lg flex items-center justify-center gap-2
|
|
538
|
+
text-[12px] text-neutral-600 dark:text-neutral-400
|
|
539
|
+
hover:bg-neutral-200 dark:hover:bg-neutral-800
|
|
540
|
+
transition-colors duration-150
|
|
541
|
+
`,spaceColors:{red:"bg-red-500",orange:"bg-orange-500",yellow:"bg-yellow-500",green:"bg-green-500",blue:"bg-blue-500",purple:"bg-purple-500",pink:"bg-pink-500"},selectedGradients:{purple:"bg-gradient-to-r from-purple-500 to-pink-500 shadow-purple-500/25",blue:"bg-gradient-to-r from-blue-500 to-cyan-500 shadow-blue-500/25",green:"bg-gradient-to-r from-green-500 to-emerald-500 shadow-green-500/25",orange:"bg-gradient-to-r from-orange-500 to-amber-500 shadow-orange-500/25",red:"bg-gradient-to-r from-red-500 to-rose-500 shadow-red-500/25"}},rJ={sidebar:`
|
|
542
|
+
w-52 h-full flex flex-col
|
|
543
|
+
bg-[#1a1a1a] dark:bg-[#1a1a1a]
|
|
544
|
+
border-r border-[#2a2a2a]
|
|
545
|
+
select-none
|
|
546
|
+
`,header:`
|
|
547
|
+
h-12 px-3 flex items-center justify-between
|
|
548
|
+
border-b border-[#2a2a2a]
|
|
549
|
+
`,headerTitle:`
|
|
550
|
+
text-[13px] font-semibold text-white
|
|
551
|
+
`,headerAction:`
|
|
552
|
+
p-1 rounded
|
|
553
|
+
text-neutral-500 hover:text-neutral-300
|
|
554
|
+
hover:bg-white/5
|
|
555
|
+
transition-colors duration-150
|
|
556
|
+
`,content:`
|
|
557
|
+
flex-1 overflow-y-auto overflow-x-hidden
|
|
558
|
+
py-1
|
|
559
|
+
scrollbar-thin scrollbar-thumb-neutral-700 scrollbar-track-transparent
|
|
560
|
+
`,section:`
|
|
561
|
+
py-1
|
|
562
|
+
`,sectionHeader:`
|
|
563
|
+
px-3 py-2 flex items-center justify-between
|
|
564
|
+
text-[11px] font-medium uppercase tracking-wider
|
|
565
|
+
text-neutral-500
|
|
566
|
+
`,sectionHeaderClickable:`
|
|
567
|
+
px-3 py-2 flex items-center justify-between cursor-pointer
|
|
568
|
+
text-[11px] font-medium uppercase tracking-wider
|
|
569
|
+
text-neutral-500 hover:text-neutral-400
|
|
570
|
+
transition-colors duration-150
|
|
571
|
+
`,sectionCount:`
|
|
572
|
+
text-[10px] px-1.5 py-0.5 rounded
|
|
573
|
+
bg-neutral-800 text-neutral-400
|
|
574
|
+
`,divider:`
|
|
575
|
+
my-1 mx-3 border-t border-[#2a2a2a]
|
|
576
|
+
`,item:`
|
|
577
|
+
flex items-center gap-2.5 px-3 py-1.5
|
|
578
|
+
text-[13px] text-neutral-300
|
|
579
|
+
cursor-pointer transition-colors duration-150
|
|
580
|
+
hover:bg-white/5 hover:text-white
|
|
581
|
+
`,itemSelected:`
|
|
582
|
+
flex items-center gap-2.5 px-3 py-1.5
|
|
583
|
+
text-[13px] text-white font-medium
|
|
584
|
+
cursor-pointer
|
|
585
|
+
bg-white/10
|
|
586
|
+
`,itemWithIndicator:`
|
|
587
|
+
flex items-center gap-2.5 px-3 py-1.5
|
|
588
|
+
text-[13px] text-neutral-300
|
|
589
|
+
cursor-pointer transition-colors duration-150
|
|
590
|
+
hover:bg-white/5 hover:text-white
|
|
591
|
+
relative
|
|
592
|
+
`,runningIndicator:`
|
|
593
|
+
w-1.5 h-1.5 rounded-full bg-green-500
|
|
594
|
+
absolute left-1
|
|
595
|
+
`,stoppedIndicator:`
|
|
596
|
+
w-1.5 h-1.5 rounded-full bg-neutral-600
|
|
597
|
+
absolute left-1
|
|
598
|
+
`,itemIcon:`
|
|
599
|
+
w-4 h-4 flex-shrink-0
|
|
600
|
+
text-neutral-500
|
|
601
|
+
`,itemIconSelected:`
|
|
602
|
+
w-4 h-4 flex-shrink-0
|
|
603
|
+
text-white
|
|
604
|
+
`,itemLabel:`
|
|
605
|
+
flex-1 truncate
|
|
606
|
+
`,itemStatus:`
|
|
607
|
+
text-[11px] text-neutral-500
|
|
608
|
+
`,itemActions:`
|
|
609
|
+
flex items-center gap-1 opacity-0 group-hover:opacity-100
|
|
610
|
+
transition-opacity duration-150
|
|
611
|
+
`,itemActionButton:`
|
|
612
|
+
p-1 rounded
|
|
613
|
+
text-neutral-500 hover:text-white
|
|
614
|
+
hover:bg-white/10
|
|
615
|
+
transition-colors duration-150
|
|
616
|
+
`,group:`
|
|
617
|
+
group
|
|
618
|
+
`,groupHeader:`
|
|
619
|
+
flex items-center gap-2 px-3 py-1.5 cursor-pointer
|
|
620
|
+
text-[13px] text-neutral-400
|
|
621
|
+
hover:bg-white/5 hover:text-neutral-200
|
|
622
|
+
transition-colors duration-150
|
|
623
|
+
`,groupChevron:`
|
|
624
|
+
w-3 h-3 text-neutral-600
|
|
625
|
+
transition-transform duration-200
|
|
626
|
+
`,groupChevronExpanded:`
|
|
627
|
+
w-3 h-3 text-neutral-600
|
|
628
|
+
transition-transform duration-200
|
|
629
|
+
rotate-90
|
|
630
|
+
`,groupContent:`
|
|
631
|
+
overflow-hidden transition-all duration-200
|
|
632
|
+
`,footer:`
|
|
633
|
+
px-3 py-2 border-t border-[#2a2a2a]
|
|
634
|
+
flex items-center justify-between
|
|
635
|
+
`,footerText:`
|
|
636
|
+
text-[11px] text-neutral-500
|
|
637
|
+
`,footerButton:`
|
|
638
|
+
p-1.5 rounded
|
|
639
|
+
text-neutral-500 hover:text-white
|
|
640
|
+
hover:bg-white/10
|
|
641
|
+
transition-colors duration-150
|
|
642
|
+
`,contextMenu:`
|
|
643
|
+
min-w-40 py-1 rounded-lg
|
|
644
|
+
bg-[#252525] border border-[#3a3a3a]
|
|
645
|
+
shadow-xl shadow-black/50
|
|
646
|
+
`,contextMenuItem:`
|
|
647
|
+
px-3 py-1.5 flex items-center gap-2
|
|
648
|
+
text-[13px] text-neutral-300
|
|
649
|
+
cursor-pointer
|
|
650
|
+
hover:bg-white/10
|
|
651
|
+
transition-colors duration-100
|
|
652
|
+
`,contextMenuItemDanger:`
|
|
653
|
+
px-3 py-1.5 flex items-center gap-2
|
|
654
|
+
text-[13px] text-red-400
|
|
655
|
+
cursor-pointer
|
|
656
|
+
hover:bg-red-500/10
|
|
657
|
+
transition-colors duration-100
|
|
658
|
+
`,contextMenuDivider:`
|
|
659
|
+
my-1 border-t border-[#3a3a3a]
|
|
660
|
+
`,emptyState:`
|
|
661
|
+
flex flex-col items-center justify-center py-8
|
|
662
|
+
text-neutral-500
|
|
663
|
+
`,emptyStateIcon:`
|
|
664
|
+
w-8 h-8 mb-2 text-neutral-600
|
|
665
|
+
`,emptyStateText:`
|
|
666
|
+
text-[13px]
|
|
667
|
+
`,loadingSpinner:`
|
|
668
|
+
w-4 h-4 border-2 border-neutral-600 border-t-neutral-400
|
|
669
|
+
rounded-full animate-spin
|
|
670
|
+
`},bX={transitionFast:"transition-all duration-150",transitionNormal:"transition-all duration-200",transitionSlow:"transition-all duration-300",scrollbarThin:"scrollbar-thin scrollbar-track-transparent",scrollbarLight:"scrollbar-thumb-black/10 hover:scrollbar-thumb-black/20",scrollbarDark:"scrollbar-thumb-white/10 hover:scrollbar-thumb-white/20",focusRing:"focus:outline-none focus:ring-2 focus:ring-blue-500/50",focusRingInset:"focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500/50",truncate:"truncate",lineClamp2:"line-clamp-2",flexCenter:"flex items-center justify-center",flexBetween:"flex items-center justify-between",flexStart:"flex items-center justify-start",hideScrollbar:"scrollbar-none [-ms-overflow-style:none] [scrollbar-width:none]"},vX=`
|
|
671
|
+
:root {
|
|
672
|
+
/* Tahoe style variables */
|
|
673
|
+
--sidebar-tahoe-bg: rgba(255, 255, 255, 0.7);
|
|
674
|
+
--sidebar-tahoe-bg-dark: rgba(30, 30, 30, 0.7);
|
|
675
|
+
--sidebar-tahoe-border: rgba(0, 0, 0, 0.05);
|
|
676
|
+
--sidebar-tahoe-border-dark: rgba(255, 255, 255, 0.05);
|
|
677
|
+
--sidebar-tahoe-text: #404040;
|
|
678
|
+
--sidebar-tahoe-text-dark: #e5e5e5;
|
|
679
|
+
--sidebar-tahoe-text-muted: #737373;
|
|
680
|
+
--sidebar-tahoe-text-muted-dark: #a3a3a3;
|
|
681
|
+
--sidebar-tahoe-selected: #3b82f6;
|
|
682
|
+
--sidebar-tahoe-hover: rgba(0, 0, 0, 0.05);
|
|
683
|
+
--sidebar-tahoe-hover-dark: rgba(255, 255, 255, 0.05);
|
|
684
|
+
|
|
685
|
+
/* Arc style variables */
|
|
686
|
+
--sidebar-arc-bg: #f5f5f5;
|
|
687
|
+
--sidebar-arc-bg-dark: #171717;
|
|
688
|
+
--sidebar-arc-border: #e5e5e5;
|
|
689
|
+
--sidebar-arc-border-dark: #262626;
|
|
690
|
+
--sidebar-arc-selected-from: #a855f7;
|
|
691
|
+
--sidebar-arc-selected-to: #ec4899;
|
|
692
|
+
--sidebar-arc-hover: rgba(0, 0, 0, 0.05);
|
|
693
|
+
--sidebar-arc-hover-dark: rgba(255, 255, 255, 0.05);
|
|
694
|
+
|
|
695
|
+
/* OrbStack style variables */
|
|
696
|
+
--sidebar-orb-bg: #1a1a1a;
|
|
697
|
+
--sidebar-orb-border: #2a2a2a;
|
|
698
|
+
--sidebar-orb-text: #d4d4d4;
|
|
699
|
+
--sidebar-orb-text-muted: #737373;
|
|
700
|
+
--sidebar-orb-selected: rgba(255, 255, 255, 0.1);
|
|
701
|
+
--sidebar-orb-hover: rgba(255, 255, 255, 0.05);
|
|
702
|
+
--sidebar-orb-accent: #22c55e;
|
|
703
|
+
}
|
|
704
|
+
`;function yX(J){switch(J){case"tahoe":return _J;case"arc":return sJ;case"orbstack":return rJ;default:return _J}}var P={home:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6'/></svg>",folder:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z'/></svg>",document:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'/></svg>",star:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z'/></svg>",download:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4'/></svg>",cloud:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 15a4 4 0 004 4h9a5 5 0 10-.1-9.999 5.002 5.002 0 10-9.78 2.096A4.001 4.001 0 003 15z'/></svg>",settings:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z'/><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z'/></svg>",plus:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 4v16m8-8H4'/></svg>",search:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/></svg>",chevronRight:"<svg class='h-3 w-3' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'/></svg>",chevronDown:"<svg class='h-3 w-3' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/></svg>",x:"<svg class='h-3 w-3' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 18L18 6M6 6l12 12'/></svg>",menu:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 12h16M4 18h16'/></svg>",container:"<svg class='h-4 w-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'><path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4'/></svg>",linux:"<svg class='h-4 w-4' fill='currentColor' viewBox='0 0 24 24'><path d='M12.504 0c-.155 0-.311.001-.465.003-.653.014-1.304.07-1.952.17-1.328.205-2.607.596-3.796 1.157-1.189.56-2.28 1.293-3.234 2.174-.954.88-1.757 1.9-2.384 3.022-.627 1.122-1.07 2.342-1.313 3.608-.244 1.266-.286 2.575-.126 3.855.16 1.28.519 2.517 1.066 3.666.547 1.149 1.274 2.197 2.152 3.105.877.908 1.9 1.666 3.025 2.249 1.126.583 2.349.984 3.609 1.192 1.261.208 2.555.218 3.82.029 1.265-.189 2.497-.576 3.642-1.148 1.145-.572 2.187-1.32 3.086-2.212.898-.892 1.643-1.922 2.212-3.045.568-1.123.952-2.332 1.138-3.577.186-1.245.176-2.518-.03-3.766-.206-1.248-.607-2.462-1.191-3.588-.583-1.125-1.343-2.15-2.25-3.029-.907-.879-1.957-1.607-3.1-2.156-1.142-.548-2.377-.913-3.643-1.078-.653-.085-1.31-.125-1.966-.125z'/></svg>"};function t(J){return P[J]||P.document}function UZ(J){let $=_J,Z=(Y,Q=0)=>{let q=Y.selected,U=q?$.itemSelected:$.item,z=q?$.itemIconSelected:$.itemIcon,W=q?$.itemBadgeSelected:$.itemBadge,L=(Y.children?.length??0)>0?`<span class='${$.disclosureChevron}${Y.expanded?" rotate-90":""}'>${P.chevronRight}</span>`:"",R=Y.color?` style='color: ${Y.color}'`:"",O=`
|
|
705
|
+
<div class='${U}' data-id='${Y.id}'${Q>0?` style='padding-left: ${4+Q*16}px'`:""}>
|
|
706
|
+
<span class='${$.disclosure}'>${L}</span>
|
|
707
|
+
<span class='${$.itemIconSlot}'><span class='${z}'${R}>${t(Y.icon||"document")}</span></span>
|
|
708
|
+
<span class='${$.itemLabel}'>${Y.label}</span>
|
|
709
|
+
${Y.badge?`<span class='${W}'>${Y.badge}</span>`:""}
|
|
710
|
+
</div>
|
|
711
|
+
`;if(Y.children&&Y.expanded)Y.children.forEach((_)=>{O+=Z(_,Q+1)});return O},X=(Y)=>{return`
|
|
712
|
+
<div class='${$.section}'>
|
|
713
|
+
${Y.title?`
|
|
714
|
+
<div class="${Y.collapsible?$.sectionHeaderCollapsible:$.sectionHeader}" data-section="${Y.id}">
|
|
715
|
+
<span class='truncate'>${Y.title}</span>
|
|
716
|
+
${Y.collapsible?`<span class='${$.collapseChevron}${Y.collapsed?" -rotate-90":""}'>${P.chevronDown}</span>`:""}
|
|
717
|
+
</div>
|
|
718
|
+
`:""}
|
|
719
|
+
${!Y.collapsed?Y.items.map((Q)=>Z(Q)).join(""):""}
|
|
720
|
+
</div>
|
|
721
|
+
`};return`
|
|
722
|
+
<div class='${$.sidebar}'>
|
|
723
|
+
${J.header?`
|
|
724
|
+
<div class='${$.header}'>
|
|
725
|
+
${J.header.avatar?`
|
|
726
|
+
<div class="${$.headerAvatar}">${J.header.avatar}</div>
|
|
727
|
+
`:""}
|
|
728
|
+
<div>
|
|
729
|
+
${J.header.title?`<div class="${$.headerTitle}">${J.header.title}</div>`:""}
|
|
730
|
+
${J.header.subtitle?`<div class="${$.headerSubtitle}">${J.header.subtitle}</div>`:""}
|
|
731
|
+
</div>
|
|
732
|
+
</div>
|
|
733
|
+
`:""}
|
|
734
|
+
|
|
735
|
+
${J.showSearch?`
|
|
736
|
+
<div class='${$.searchContainer}'>
|
|
737
|
+
<input type='text' class='${$.searchInput}' placeholder='${J.searchPlaceholder||"Search"}' />
|
|
738
|
+
</div>
|
|
739
|
+
`:""}
|
|
740
|
+
|
|
741
|
+
<div class='${$.content}'>
|
|
742
|
+
${J.sections?J.sections.map((Y)=>X(Y)).join(""):""}
|
|
743
|
+
${J.items?J.items.map((Y)=>Z(Y)).join(""):""}
|
|
744
|
+
</div>
|
|
745
|
+
|
|
746
|
+
${J.footer?`
|
|
747
|
+
<div class='${$.footer}'>
|
|
748
|
+
${J.footer.items?.map((Y)=>`
|
|
749
|
+
<button class="${$.footerButton}" data-id="${Y.id}">
|
|
750
|
+
${t(Y.icon||"settings")}
|
|
751
|
+
</button>
|
|
752
|
+
`).join("")||""}
|
|
753
|
+
</div>
|
|
754
|
+
`:""}
|
|
755
|
+
</div>
|
|
756
|
+
`}function zZ(J,$=!1){let Z=sJ,X=$?Z.sidebarCollapsed:Z.sidebar,Y=(q)=>{let U=q.selected;if($)return`
|
|
757
|
+
<div class='${U?Z.itemCollapsedSelected:Z.itemCollapsed}' data-id='${q.id}'>
|
|
758
|
+
<span class="${U?Z.itemFaviconSelected:Z.itemFavicon}">
|
|
759
|
+
${q.icon?t(q.icon):""}
|
|
760
|
+
</span>
|
|
761
|
+
<div class='${Z.tooltip}'>${q.label}</div>
|
|
762
|
+
</div>
|
|
763
|
+
`;let z=U?Z.itemSelected:Z.item,W=U?Z.itemCloseSelected:Z.itemClose;return`
|
|
764
|
+
<div class='${z} group' data-id='${q.id}'>
|
|
765
|
+
<span class="${U?Z.itemFaviconSelected:Z.itemFavicon}">
|
|
766
|
+
${q.icon?t(q.icon):""}
|
|
767
|
+
</span>
|
|
768
|
+
<span class='${Z.itemLabel}'>${q.label}</span>
|
|
769
|
+
<button class='${W}'>${P.x}</button>
|
|
770
|
+
</div>
|
|
771
|
+
`},Q=(q)=>{let U=Z.spaceColors[q.color]||Z.spaceColors.purple;return`
|
|
772
|
+
<div class='${Z.space}'>
|
|
773
|
+
<div class='${Z.spaceHeader}' data-space='${q.id}'>
|
|
774
|
+
<div class='${U} ${Z.spaceIcon}'>${q.title?.[0]||"\u2022"}</div>
|
|
775
|
+
${!$?`
|
|
776
|
+
<span class='${Z.spaceName}'>${q.title}</span>
|
|
777
|
+
<span class='${Z.spaceCount}'>${q.items.length}</span>
|
|
778
|
+
`:""}
|
|
779
|
+
</div>
|
|
780
|
+
${!q.collapsed?q.items.map((z)=>Y(z)).join(""):""}
|
|
781
|
+
</div>
|
|
782
|
+
`};return`
|
|
783
|
+
<div class='${X}'>
|
|
784
|
+
<div class='${Z.topBar}'>
|
|
785
|
+
<button class='${Z.collapseButton}' id='arc-collapse-toggle'>
|
|
786
|
+
${P.menu}
|
|
787
|
+
</button>
|
|
788
|
+
${!$?`
|
|
789
|
+
<button class='${Z.newTabButton}'>
|
|
790
|
+
${P.plus}
|
|
791
|
+
</button>
|
|
792
|
+
`:""}
|
|
793
|
+
</div>
|
|
794
|
+
|
|
795
|
+
<div class='${Z.content}'>
|
|
796
|
+
${J.sections?.[0]?.title==="Pinned"?`
|
|
797
|
+
<div class='${Z.pinnedSection}'>
|
|
798
|
+
${!$?`<div class="${Z.pinnedLabel}">Pinned</div>`:""}
|
|
799
|
+
${J.sections[0].items.map((q)=>Y(q)).join("")}
|
|
800
|
+
</div>
|
|
801
|
+
`:""}
|
|
802
|
+
|
|
803
|
+
${J.sections?.slice(J.sections[0]?.title==="Pinned"?1:0).map((q)=>Q(q)).join("")||""}
|
|
804
|
+
${J.items?J.items.map((q)=>Y(q)).join(""):""}
|
|
805
|
+
</div>
|
|
806
|
+
|
|
807
|
+
<div class='${Z.bottomBar}'>
|
|
808
|
+
${!$?`
|
|
809
|
+
<button class='${Z.bottomButton}'>
|
|
810
|
+
${P.download}
|
|
811
|
+
<span>Downloads</span>
|
|
812
|
+
</button>
|
|
813
|
+
`:`
|
|
814
|
+
<button class='${Z.collapseButton}'>
|
|
815
|
+
${P.download}
|
|
816
|
+
</button>
|
|
817
|
+
`}
|
|
818
|
+
</div>
|
|
819
|
+
</div>
|
|
820
|
+
`}function WZ(J){let $=rJ,Z=(Q)=>{let q=Q.selected,U=q?$.itemSelected:$.item,z=q?$.itemIconSelected:$.itemIcon,W=Q.status&&Q.status!=="none",H=Q.status==="running"?$.runningIndicator:$.stoppedIndicator;return`
|
|
821
|
+
<div class='${U} group' data-id='${Q.id}' ${W?"style='padding-left: 20px'":""}>
|
|
822
|
+
${W?`<div class='${H}'></div>`:""}
|
|
823
|
+
<span class='${z}'>${t(Q.icon||"container")}</span>
|
|
824
|
+
<span class='${$.itemLabel}'>${Q.label}</span>
|
|
825
|
+
${Q.status?`<span class='${$.itemStatus}'>${Q.status}</span>`:""}
|
|
826
|
+
<div class='${$.itemActions}'>
|
|
827
|
+
<button class='${$.itemActionButton}'>${P.settings}</button>
|
|
828
|
+
</div>
|
|
829
|
+
</div>
|
|
830
|
+
`},X=(Q)=>{return`
|
|
831
|
+
<div class='${$.section}'>
|
|
832
|
+
${Q.title?`
|
|
833
|
+
<div class="${Q.collapsible?$.sectionHeaderClickable:$.sectionHeader}" data-section="${Q.id}">
|
|
834
|
+
<span>${Q.title}</span>
|
|
835
|
+
${Q.items.length>0?`<span class="${$.sectionCount}">${Q.items.length}</span>`:""}
|
|
836
|
+
</div>
|
|
837
|
+
`:""}
|
|
838
|
+
${!Q.collapsed?Q.items.map((q)=>Z(q)).join(""):""}
|
|
839
|
+
</div>
|
|
840
|
+
`},Y=(Q)=>{let q=Q.expanded?$.groupChevronExpanded:$.groupChevron;return`
|
|
841
|
+
<div class='${$.group}'>
|
|
842
|
+
<div class='${$.groupHeader}' data-group='${Q.id}'>
|
|
843
|
+
<span class='${q}'>${P.chevronRight}</span>
|
|
844
|
+
<span class='${$.itemIcon}'>${t(Q.icon||"folder")}</span>
|
|
845
|
+
<span class='${$.itemLabel}'>${Q.label}</span>
|
|
846
|
+
</div>
|
|
847
|
+
${Q.expanded&&Q.children?`
|
|
848
|
+
<div class='${$.groupContent}'>
|
|
849
|
+
${Q.children.map((U)=>Z(U)).join("")}
|
|
850
|
+
</div>
|
|
851
|
+
`:""}
|
|
852
|
+
</div>
|
|
853
|
+
`};return`
|
|
854
|
+
<div class='${$.sidebar}'>
|
|
855
|
+
<div class='${$.header}'>
|
|
856
|
+
<span class='${$.headerTitle}'>${J.header?.title||"OrbStack"}</span>
|
|
857
|
+
<button class='${$.headerAction}'>${P.plus}</button>
|
|
858
|
+
</div>
|
|
859
|
+
|
|
860
|
+
<div class='${$.content}'>
|
|
861
|
+
${J.sections?J.sections.map((Q)=>X(Q)).join(""):""}
|
|
862
|
+
${J.items?J.items.map((Q)=>Q.children?Y(Q):Z(Q)).join(""):""}
|
|
863
|
+
</div>
|
|
864
|
+
|
|
865
|
+
<div class='${$.footer}'>
|
|
866
|
+
<span class='${$.footerText}'>v4.0.0</span>
|
|
867
|
+
<button class='${$.footerButton}'>${P.settings}</button>
|
|
868
|
+
</div>
|
|
869
|
+
</div>
|
|
870
|
+
`}var hX={header:{title:"MacBook Pro",subtitle:"256 GB available",avatar:"\uD83D\uDCBB"},showSearch:!0,searchPlaceholder:"Search",sections:[{id:"favorites",title:"Favorites",collapsible:!0,items:[{id:"airdrop",label:"AirDrop",icon:"cloud"},{id:"recents",label:"Recents",icon:"document",badge:12},{id:"applications",label:"Applications",icon:"folder"},{id:"desktop",label:"Desktop",icon:"home",selected:!0},{id:"documents",label:"Documents",icon:"folder"},{id:"downloads",label:"Downloads",icon:"download",badge:3}]},{id:"icloud",title:"iCloud",collapsible:!0,items:[{id:"icloud-drive",label:"iCloud Drive",icon:"cloud"},{id:"shared",label:"Shared",icon:"folder"}]},{id:"tags",title:"Tags",collapsible:!0,collapsed:!0,items:[{id:"red",label:"Red"},{id:"orange",label:"Orange"}]}],footer:{items:[{id:"settings",label:"Settings",icon:"settings"}]}},uX={sections:[{id:"pinned",title:"Pinned",items:[{id:"github",label:"GitHub",icon:"document",selected:!0},{id:"twitter",label:"Twitter",icon:"document"},{id:"figma",label:"Figma",icon:"document"}]},{id:"work",title:"Work",items:[{id:"slack",label:"Slack - Acme Inc",icon:"document"},{id:"notion",label:"Notion",icon:"document"},{id:"linear",label:"Linear",icon:"document"}]},{id:"personal",title:"Personal",items:[{id:"youtube",label:"YouTube",icon:"document"},{id:"spotify",label:"Spotify",icon:"document"}]}]},gX={header:{title:"OrbStack"},sections:[{id:"machines",title:"Machines",items:[{id:"ubuntu",label:"ubuntu",icon:"linux",status:"running",selected:!0},{id:"fedora",label:"fedora",icon:"linux",status:"stopped"},{id:"alpine",label:"alpine",icon:"linux",status:"stopped"}]},{id:"containers",title:"Containers",items:[{id:"postgres",label:"postgres:15",icon:"container",status:"running"},{id:"redis",label:"redis:7",icon:"container",status:"running"},{id:"nginx",label:"nginx:latest",icon:"container",status:"stopped"}]}]};function fX(J,$){return`
|
|
871
|
+
<!DOCTYPE html>
|
|
872
|
+
<html lang="en" class="${$==="orbstack"?"dark":""}">
|
|
873
|
+
<head>
|
|
874
|
+
<meta charset='UTF-8'>
|
|
875
|
+
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
|
876
|
+
<title>Craft Sidebar - ${$}</title>
|
|
877
|
+
<script src='https://cdn.tailwindcss.com'></script>
|
|
878
|
+
<style>
|
|
879
|
+
/* Custom scrollbar */
|
|
880
|
+
.scrollbar-thin::-webkit-scrollbar { width: 6px; }
|
|
881
|
+
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
|
|
882
|
+
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 3px; }
|
|
883
|
+
.dark .scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
|
|
884
|
+
.scrollbar-none::-webkit-scrollbar { display: none; }
|
|
885
|
+
|
|
886
|
+
/* Backdrop blur fallback */
|
|
887
|
+
@supports not (backdrop-filter: blur(1px)) {
|
|
888
|
+
.backdrop-blur-xl { background: rgba(255,255,255,0.95); }
|
|
889
|
+
.dark .backdrop-blur-xl { background: rgba(30,30,30,0.95); }
|
|
890
|
+
}
|
|
891
|
+
</style>
|
|
892
|
+
</head>
|
|
893
|
+
<body class='flex min-h-screen ${$==="orbstack"?"bg-[#0f0f0f]":"bg-neutral-50 dark:bg-neutral-900"}'>
|
|
894
|
+
${J}
|
|
895
|
+
<div class='flex-1 p-8'>
|
|
896
|
+
<div class='text-neutral-400 dark:text-neutral-500'>
|
|
897
|
+
Content area - select items in the sidebar
|
|
898
|
+
</div>
|
|
899
|
+
</div>
|
|
900
|
+
<script>
|
|
901
|
+
// Add click handlers
|
|
902
|
+
document.querySelectorAll('[data-id]').forEach(el => {
|
|
903
|
+
el.addEventListener('click', () => {
|
|
904
|
+
console.log('Selected:', el.dataset.id);
|
|
905
|
+
// You would update selection state here
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
</script>
|
|
909
|
+
</body>
|
|
910
|
+
</html>
|
|
911
|
+
`}var mX={tw:QZ,cx:g8,variants:GZ,sidebar:{tahoe:_J,arc:sJ,orbstack:rJ},templates:{tahoe:UZ,arc:zZ,orbstack:WZ}},pX={configureProduction(J={}){if(typeof window<"u"){if(!J.enableDevTools)window.__REACT_DEVTOOLS_GLOBAL_HOOK__={isDisabled:!0}}},createLazyFactory(){return(J,$={})=>{let Z=null,X=async()=>{if(!Z)Z=J();await Z};if($.preload)if(typeof requestIdleCallback<"u")requestIdleCallback(()=>X());else setTimeout(()=>X(),0);return{load:X}}},createDebouncedValueHook(J){let $=null,Z;return(X)=>{if($)clearTimeout($);return $=setTimeout(()=>{Z=X,$=null},J),Z??X}},createThrottle(J,$){let Z=0;return(...X)=>{let Y=Date.now();if(Y-Z>=$)J(...X),Z=Y}}},cX={configureProduction(J,$={}){if(!J?.config)return;if(!$.enableDevTools&&J.config.devtools!==void 0)J.config.devtools=!1;if(J.config.performance!==void 0)J.config.performance=$.performance||!1;if($.errorHandler)J.config.errorHandler=$.errorHandler;if($.warnHandler)J.config.warnHandler=$.warnHandler},createAsyncConfig(J={}){let{delay:$=200,timeout:Z=30000,retries:X=3}=J;return{delay:$,timeout:Z,onError(Y,Q,q,U){if(U<=X)Q();else q()}}},createCacheFactory(J={}){let{maxAge:$=0,maxEntries:Z=1000}=J;if(!Number.isInteger(Z)||Z<1)throw Error(`createCacheFactory: maxEntries must be a positive integer (got ${Z})`);let X=new Map;return{cache:X,get(Y,Q){let q=Date.now(),U=X.get(Y);if(U&&($===0||q-U.timestamp<$))return X.delete(Y),X.set(Y,U),U.value;let z=Q();X.set(Y,{value:z,timestamp:q});while(X.size>Z){let W=X.keys().next().value;if(W===void 0)break;X.delete(W)}return z},invalidate(Y){if(Y)X.delete(Y);else X.clear()}}}},dX={createMemoizer(J,$){let Z,X;return(Y)=>{if(Z!==void 0&&Z===Y&&X!==void 0)return X;let Q=J(Y);if(X!==void 0&&$&&$(X,Q))return X;return Z=Y,X=Q,Q}},createDebouncedSetter(J=300){let $;return{set(Z,X){if($)clearTimeout($);$=setTimeout(()=>{X(Z),$=void 0},J)},cancel(){if($)clearTimeout($),$=void 0}}},createThrottledSetter(J=100){let $=0,Z,X;return{set(Y,Q){let q=Date.now();if(q-$>=J)Q(Y),$=q;else if(Z={value:Y,callback:Q},!X)X=setTimeout(()=>{if(Z)Z.callback(Z.value),Z=void 0;$=Date.now(),X=void 0},J-(q-$))}}},createLazyActionConfig(J={}){return{threshold:J.threshold??0,rootMargin:J.rootMargin??"50px"}},createAcceleratedTransitionConfig(J,$={}){let{duration:Z=300,easing:X="cubic-bezier(0.4, 0, 0.2, 1)"}=$;return{type:J,duration:Z,easing:X,willChange:{fade:"opacity",slide:"transform, opacity",scale:"transform, opacity"}[J]}}},G8={defer(J){if(typeof requestIdleCallback<"u")requestIdleCallback(J);else setTimeout(J,0)},preload(J,$){if(typeof document>"u")return;J.forEach((Z)=>{let X=document.createElement("link");if(X.rel="preload",X.href=Z,X.as=$,$==="font")X.crossOrigin="anonymous";document.head.appendChild(X)})},prefetch(J){if(typeof document>"u")return;J.forEach(($)=>{let Z=document.createElement("link");Z.rel="prefetch",Z.href=$,document.head.appendChild(Z)})},createLazyLoader(J,$={}){if(typeof IntersectionObserver>"u")return null;return new IntersectionObserver((Z)=>{Z.forEach((X)=>{if(X.isIntersecting)J(X)})},{rootMargin:"50px",threshold:0,...$})},measureRender(J){let $;return{start(){if(typeof performance<"u")$=performance.now(),performance.mark(`${J}-start`)},end(){if(typeof performance<"u"&&$){let Z=performance.now();if(performance.mark(`${J}-end`),performance.measure(J,`${J}-start`,`${J}-end`),typeof process<"u"&&process.env?.NODE_ENV==="development")console.log(`[Craft] ${J} rendered in ${(Z-$).toFixed(2)}ms`)}}}},memoize(J,$={}){let{maxSize:Z=100,ttl:X=0}=$,Y=new Map,Q=[];return(...q)=>{let U=JSON.stringify(q),z=Date.now(),W=Y.get(U);if(W){if(X===0||z-W.timestamp<X)return W.value;Y.delete(U),Q.splice(Q.indexOf(U),1)}let H=J(...q);Y.set(U,{value:H,timestamp:z}),Q.push(U);while(Q.length>Z){let L=Q.shift();Y.delete(L)}return H}},batchDOMUpdates(J){if(typeof requestAnimationFrame<"u")requestAnimationFrame(()=>{J.forEach(($)=>$())});else J.forEach(($)=>$())},debounce(J,$){let Z,X=(...Y)=>{if(Z)clearTimeout(Z);Z=setTimeout(()=>{J(...Y),Z=void 0},$)};return X.cancel=()=>{if(Z)clearTimeout(Z),Z=void 0},X},throttle(J,$){let Z=0;return(...X)=>{let Y=Date.now();if(Y-Z>=$)J(...X),Z=Y}},detectReducedMotion(){if(typeof window>"u")return!1;return window.matchMedia("(prefers-reduced-motion: reduce)").matches},detectLowEndDevice(){if(typeof navigator>"u")return!1;let J=navigator.deviceMemory;if(J&&J<4)return!0;let $=navigator.hardwareConcurrency;if($&&$<4)return!0;if(navigator.connection?.saveData)return!0;return!1},getAdaptiveQuality(){let J=G8.detectLowEndDevice(),$=G8.detectReducedMotion();if(J||$)return"low";if(typeof window<"u"){if((window.devicePixelRatio||1)>=2)return"high"}return"medium"}},HZ={};V8(HZ,{updaterCommand:()=>OZ,generateUpdateManifest:()=>FZ,default:()=>jZ,DeltaGenerator:()=>e,AutoUpdater:()=>TJ});function z8(J,$,Z){let X=S("find",[J,"-name",$,"-type",Z,"-print0"]),Y=String.fromCharCode(0);return X.toString("utf-8").split(Y).filter((q)=>q.length>0)[0]??""}class TJ extends RZ{config;updateInfo=null;downloadPath=null;checkTimer=null;cachedEtag=null;cachedLastModified=null;cachedManifest=null;emitError(J){if(this.listenerCount("error")>0)this.emit("error",J);else console.error("[Updater]",J)}constructor(J){super();let $=J.updateUrl;if(typeof $!=="string"||$.length===0)throw Error("Updater: updateUrl is required");if(!/^(?:https:|file:)\/\//i.test($))throw Error(`Updater: updateUrl must use https:// (got: ${$})`);this.config={autoDownload:!0,autoInstall:!1,channel:"stable",checkInterval:3600000,...J}}startAutoCheck(){if(this.checkForUpdates(),this.config.checkInterval)this.checkTimer=setInterval(()=>{this.checkForUpdates()},this.config.checkInterval)}stopAutoCheck(){if(this.checkTimer)clearInterval(this.checkTimer),this.checkTimer=null}async checkForUpdates(){this.emit("checking-for-update");try{let J=this.getPlatform(),$=`${this.config.updateUrl}?v=${this.config.currentVersion}&channel=${this.config.channel}&platform=${J}`,Z={};if(this.cachedEtag)Z["If-None-Match"]=this.cachedEtag;if(this.cachedLastModified)Z["If-Modified-Since"]=this.cachedLastModified;let X=await fetch($,{headers:Z});if(X.status===304&&this.cachedManifest){if(this.isNewerVersion(this.cachedManifest.version,this.config.currentVersion))return this.updateInfo=this.cachedManifest,this.emit("update-available",this.cachedManifest),this.cachedManifest;return this.emit("update-not-available"),null}if(!X.ok)throw Error(`HTTP ${X.status}`);let Y=await X.json();if(this.cachedEtag=X.headers.get("etag")||null,this.cachedLastModified=X.headers.get("last-modified")||null,this.cachedManifest=Y,this.isNewerVersion(Y.version,this.config.currentVersion)){if(Y.minVersion&&this.isNewerVersion(Y.minVersion,this.config.currentVersion))console.log(`Update requires minimum version ${Y.minVersion}`);if(this.updateInfo=Y,this.emit("update-available",Y),this.config.autoDownload)await this.downloadUpdate();return Y}else return this.emit("update-not-available"),null}catch(J){return this.emitError(J),null}}async downloadUpdate(){if(!this.updateInfo)throw Error("No update available");let J=this.getPlatform(),$=this.updateInfo.platforms[J];if(!$)throw Error(`No update available for platform: ${J}`);let Z=$.delta?.find((W)=>W.fromVersion===this.config.currentVersion),X=Z||$,Y=Z?.url||$.url,Q=Z?.size||$.size,q=Z?.sha256||$.sha256,U=RJ(this.config.appPath,"..",".craft-updates");q8(U,{recursive:!0});let z=U8(Y);this.downloadPath=RJ(U,z);try{let W=await fetch(Y);if(!W.ok)throw Error(`Download failed: HTTP ${W.status}`);let L=parseInt(W.headers.get("content-length")||"0",10)||Q,R=0,O=Date.now(),_=VZ(this.downloadPath),M=W.body?.getReader();if(!M)throw Error("Failed to get response reader");while(!0){let{done:E,value:v}=await M.read();if(E)break;_.write(v),R+=v.length;let KJ=(Date.now()-O)/1000,m8=R/KJ,p8={phase:"downloading",percent:Math.round(R/L*100),bytesDownloaded:R,bytesTotal:L,speed:m8};this.emit("download-progress",p8)}if(_.end(),await new Promise((E,v)=>{_.once("finish",E),_.once("error",v)}),await this.computeFileHash(this.downloadPath)!==q)throw f(this.downloadPath),Error("Download verification failed: hash mismatch");if(Z){if(!bJ(this.config.appPath).isFile())throw Error("Delta updates require appPath to point to the installed bundle file");let E=this.downloadPath,v=RJ(U,`reconstructed-${U8($.url)}`);if(await e.apply(this.config.appPath,E,v),await this.computeFileHash(v)!==$.sha256){try{f(v)}catch{}throw Error("Delta reconstruction failed: full bundle hash mismatch")}f(E),this.downloadPath=v}if(this.config.publicKeyPem&&!$.signature)throw f(this.downloadPath),Error("Updater: publicKeyPem is configured but the manifest entry has no signature. Refusing to install unsigned update.");if($.signature){if(!await this.verifySignature(this.downloadPath,$.signature))throw f(this.downloadPath),Error("Download verification failed: invalid signature")}if(this.emit("update-downloaded",{path:this.downloadPath,version:this.updateInfo.version,isDelta:!!Z}),this.config.autoInstall)await this.installUpdate();return this.downloadPath}catch(W){return this.emitError(W),null}}async installUpdate(J=!0){if(!this.downloadPath||!K8(this.downloadPath))throw Error("No update downloaded");if(this.updateInfo){let X=this.getPlatform(),Y=this.updateInfo.platforms[X];if(Y){if(await this.computeFileHash(this.downloadPath)!==Y.sha256){try{f(this.downloadPath)}catch{}throw Error(`Updater.installUpdate: pre-install hash mismatch on ${this.downloadPath}. `+"The downloaded bundle changed between download and install \u2014 refusing to run installer.")}if(this.config.publicKeyPem&&!Y.signature)throw Error("Updater.installUpdate: publicKeyPem is configured but manifest has no signature. Refusing to install unsigned update.");if(Y.signature){if(!await this.verifySignature(this.downloadPath,Y.signature)){try{f(this.downloadPath)}catch{}throw Error("Updater.installUpdate: invalid signature on downloaded bundle")}}}}this.emit("before-quit-for-update");let $=this.getPlatform(),Z={phase:"installing",percent:0};this.emit("download-progress",Z);try{switch($){case"darwin":await this.installMacOSUpdate();break;case"win32":await this.installWindowsUpdate();break;case"linux":await this.installLinuxUpdate();break}if(this.downloadPath&&K8(this.downloadPath))f(this.downloadPath);if(Z.phase="done",Z.percent=100,this.emit("download-progress",Z),J)this.restartApp()}catch(X){throw Z.phase="error",this.emitError(X),X}}async installMacOSUpdate(){let J=this.downloadPath,$=this.config.appPath;if(J.endsWith(".zip")){let Z=RJ(SJ(J),"extracted");q8(Z,{recursive:!0}),S("unzip",["-o",J,"-d",Z]);let X=z8(Z,"*.app","d");if(X){let{rmSync:Q,renameSync:q}=await import("fs");Q($,{recursive:!0,force:!0}),q(X,$)}let{rmSync:Y}=await import("fs");Y(Z,{recursive:!0,force:!0})}else if(J.endsWith(".dmg")){let X=S("hdiutil",["attach",J,"-nobrowse"]).toString().match(/\/Volumes\/[^\n]+/)?.[0];if(X){let Y=z8(X,"*.app","d");if(Y){let{rmSync:Q,cpSync:q}=await import("fs");Q($,{recursive:!0,force:!0}),q(Y,$,{recursive:!0})}S("hdiutil",["detach",X])}}else if(J.endsWith(".pkg")){try{S("pkgutil",["--check-signature",J],{stdio:"pipe"})}catch(Z){throw Error(`Refusing to install ${J}: pkgutil --check-signature failed. The .pkg is not signed by a trusted Apple certificate chain. Underlying error: ${Z.message}`)}S("sudo",["installer","-pkg",J,"-target","/"])}}async installWindowsUpdate(){let J=this.downloadPath;if(J.endsWith(".exe"))$J(J,["/S","/SILENT","/VERYSILENT"],{detached:!0,stdio:"ignore"});else if(J.endsWith(".msi"))$J("msiexec",["/i",J,"/quiet","/norestart"],{detached:!0,stdio:"ignore"});else if(J.endsWith(".zip")){let $=SJ(this.config.appPath);S("powershell",["-NoProfile","-NonInteractive","-Command","Expand-Archive -Force -Path $env:CRAFT_UPDATE_SRC -DestinationPath $env:CRAFT_UPDATE_DST"],{env:{...process.env,CRAFT_UPDATE_SRC:J,CRAFT_UPDATE_DST:$}})}}async installLinuxUpdate(){let J=this.downloadPath;if(J.endsWith(".AppImage")){S("chmod",["+x",J]);let{renameSync:$}=await import("fs");$(J,this.config.appPath)}else if(J.endsWith(".deb"))S("sudo",["dpkg","-i",J]);else if(J.endsWith(".rpm"))S("sudo",["rpm","-U",J]);else if(J.endsWith(".tar.gz")){let $=SJ(this.config.appPath);S("tar",["-xzf",J,"-C",$])}}restartApp(){let J=this.getPlatform(),$=this.config.appPath;switch(J){case"darwin":$J("open",["-n",$],{detached:!0,stdio:"ignore"});break;case"win32":$J($,[],{detached:!0,stdio:"ignore"});break;case"linux":$J($,[],{detached:!0,stdio:"ignore"});break}process.exit(0)}getPlatform(){switch(process.platform){case"darwin":return"darwin";case"win32":return"win32";default:return"linux"}}isNewerVersion(J,$){let Z=J.split(".").map(Number),X=$.split(".").map(Number);for(let Y=0;Y<Math.max(Z.length,X.length);Y++){let Q=Z[Y]||0,q=X[Y]||0;if(Q>q)return!0;if(Q<q)return!1}return!1}async computeFileHash(J){return new Promise(($,Z)=>{let X=DJ("sha256"),Y=f8(J);Y.on("data",(Q)=>X.update(Q)),Y.on("end",()=>$(X.digest("hex"))),Y.on("error",Z)})}async verifySignature(J,$){let Z=this.config.publicKeyPem;if(!Z)throw Error("Updater.verifySignature: publicKeyPem is not configured. Refusing to install signed update without a verification key.");let X=this.config.signatureAlgorithm??"ed25519",{createPublicKey:Y,verify:Q,createVerify:q}=await import("crypto"),U;try{U=Y({key:Z,format:"pem"})}catch(L){throw Error(`Updater.verifySignature: invalid publicKeyPem: ${L.message}`)}let z;try{z=Buffer.from($,"base64")}catch{return!1}let W=CJ(J);if(X==="ed25519")return Q(null,W,U,z);let H=q("SHA256");return H.update(W),H.end(),H.verify(U,z)}getUpdateInfo(){return this.updateInfo}getDownloadPath(){return this.downloadPath}}class e{static async generate(J,$,Z){try{S("bsdiff",[J,$,Z]);let X=bJ(Z),Y=await e.computeHash(Z);return{size:X.size,sha256:Y}}catch{S("xdelta3",["-e","-s",J,$,Z]);let X=bJ(Z),Y=await e.computeHash(Z);return{size:X.size,sha256:Y}}}static async apply(J,$,Z){try{S("bspatch",[J,Z,$])}catch{S("xdelta3",["-d","-s",J,$,Z])}}static async computeHash(J){return new Promise(($,Z)=>{let X=DJ("sha256"),Y=f8(J);Y.on("data",(Q)=>X.update(Q)),Y.on("end",()=>$(X.digest("hex"))),Y.on("error",Z)})}}function FZ(J){let $={version:J.version,releaseDate:new Date().toISOString(),releaseNotes:J.releaseNotes,platforms:{}};for(let[Z,X]of Object.entries(J.platforms)){if(!X)continue;let Y=CJ(X.path),Q=DJ("sha256").update(Y).digest("hex");$.platforms[Z]={url:X.url,size:Y.length,sha256:Q,delta:[]};let q=J.deltas?.filter((U)=>U.platform===Z)||[];for(let U of q){let z=CJ(U.path),W=DJ("sha256").update(z).digest("hex");$.platforms[Z].delta.push({fromVersion:U.fromVersion,url:U.url,size:z.length,sha256:W})}}return $}async function OZ(J){let[$,...Z]=J;switch($){case"check":{let X=Z[0],Y=Z[1]||"0.0.0";if(!X)console.error("Usage: craft updater check <update-url> [current-version]"),process.exit(1);let q=await new TJ({updateUrl:X,currentVersion:Y,appPath:process.cwd(),autoDownload:!1}).checkForUpdates();if(q){if(console.log(`Update available: ${q.version}`),console.log(`Release date: ${q.releaseDate}`),q.releaseNotes)console.log(`
|
|
912
|
+
Release notes:
|
|
913
|
+
${q.releaseNotes}`)}else console.log("No updates available");break}case"generate-delta":{let X=Z[0],Y=Z[1],Q=Z[2];if(!X||!Y||!Q)console.error("Usage: craft updater generate-delta <old-file> <new-file> <output>"),process.exit(1);console.log("Generating delta update...");let q=await e.generate(X,Y,Q);console.log(`Delta generated: ${Q}`),console.log(`Size: ${q.size} bytes`),console.log(`SHA256: ${q.sha256}`);break}case"generate-manifest":{let X=Z[0],Y=Z[1]||"update.json";if(!X)console.error("Usage: craft updater generate-manifest <version> [output]"),process.exit(1);let Q={version:X,releaseDate:new Date().toISOString(),platforms:{}};LZ(Y,JSON.stringify(Q,null,2)),console.log(`Manifest generated: ${Y}`),console.log("Edit the file to add platform-specific update URLs");break}default:console.log(`
|
|
914
|
+
Craft Auto-Updater
|
|
915
|
+
|
|
916
|
+
Usage: craft updater <command> [options]
|
|
917
|
+
|
|
918
|
+
Commands:
|
|
919
|
+
check <url> [version] Check for updates
|
|
920
|
+
generate-delta <old> <new> <output> Generate delta update
|
|
921
|
+
generate-manifest <version> [output] Generate update manifest
|
|
922
|
+
|
|
923
|
+
Examples:
|
|
924
|
+
craft updater check https://api.example.com/updates 1.0.0
|
|
925
|
+
craft updater generate-delta app-1.0.0.zip app-1.1.0.zip delta-1.0.0-1.1.0.patch
|
|
926
|
+
craft updater generate-manifest 1.1.0 update.json
|
|
927
|
+
`)}}var jZ=TJ,AZ=t8(n8),W8=!1;function _Z(){try{let J=kJ(import.meta.dir,"..","package.json");return JSON.parse(i8(J,"utf-8")).version??"unknown"}catch{return"unknown"}}async function DZ(J){if(W8)return;try{let{stdout:$}=await AZ(J,["--version"],{timeout:2000}),Z=$.trim().replace(/^v/,""),X=_Z();if(X!=="unknown"&&Z&&Z!==X)W8=!0,console.warn(`\u26A0\uFE0F Craft binary/SDK version mismatch: SDK=${X}, native=${Z}.
|
|
928
|
+
This is usually fine across patch releases but may produce surprising behavior across minors.`)}catch{}}function H8(){if(typeof process>"u")return!1;let J=(process.env.CRAFT_ENV||"").toLowerCase();if(J==="development"||J==="dev")return!0;if(J==="production"||J==="prod")return!1;let $="development".toLowerCase();if($==="development"||$==="dev")return!0;if($==="production"||$==="prod")return!1;let Z=process;if(Z.pkg||Z.isPackaged)return!1;return!0}class NJ{process;config;constructor(J={}){if(J.window?.width!==void 0&&(J.window.width<100||J.window.width>1e4))throw Error(`Invalid window width: ${J.window.width}. Must be between 100 and 10000 pixels.`);if(J.window?.height!==void 0&&(J.window.height<100||J.window.height>1e4))throw Error(`Invalid window height: ${J.window.height}. Must be between 100 and 10000 pixels.`);if(J.html&&J.url)console.warn("\u26A0\uFE0F Both html and url provided. URL will take precedence.");this.config={...J,window:{title:"Craft App",width:800,height:600,resizable:!0,frameless:!1,transparent:!1,alwaysOnTop:!1,fullscreen:!1,hotReload:H8(),devTools:H8(),systemTray:!1,...J.window}}}async show(J){if(J)this.config.html=J;if(!this.config.window?.menubarOnly&&!this.config.html&&!this.config.url)throw Error(`No content to display. Provide either html or url:
|
|
929
|
+
show(html, options) or loadURL(url, options)`);let $=this.buildArgs(),Z=await this.findCraftBinary();return DZ(Z),this.process=s8(Z,$,{stdio:this.config.quiet?"ignore":"inherit"}),new Promise((X,Y)=>{this.process?.on("error",(Q)=>{if(Q.code==="ENOENT"){Y(Error(J$(Z)));return}if(Q.code==="EACCES"){Y(Error(`\u274C Failed to start Craft process: ${Q.message}
|
|
930
|
+
|
|
931
|
+
Permission denied on the binary at ${Z}.
|
|
932
|
+
Re-run \`pantry install craft\` to restore correct permissions, or chmod +x the file directly.`));return}Y(Error(`\u274C Failed to start Craft process: ${Q.message}
|
|
933
|
+
|
|
934
|
+
For troubleshooting, visit:
|
|
935
|
+
https://github.com/home-lang/craft/issues`))}),this.process?.on("exit",(Q)=>{if(Q===0||Q===null)X();else Y(Error(`\u274C Craft process exited with code ${Q}
|
|
936
|
+
|
|
937
|
+
This may indicate:
|
|
938
|
+
`+` \u2022 Invalid window configuration
|
|
939
|
+
`+` \u2022 Malformed HTML content
|
|
940
|
+
`+` \u2022 System resource constraints
|
|
941
|
+
|
|
942
|
+
`+"Check the console output above for more details."))})})}async loadURL(J){return this.config.url=J,this.show()}close(){if(this.process)this.process.kill()}buildArgs(){let J=[],{window:$,html:Z,url:X}=this.config;if(!$?.menubarOnly){if(X)J.push("--url",X);else if(Z)J.push("--html",Z)}if($?.title)J.push("--title",$.title);if($?.width)J.push("--width",String($.width));if($?.height)J.push("--height",String($.height));if($?.x!==void 0)J.push("--x",String($.x));if($?.y!==void 0)J.push("--y",String($.y));if($?.frameless)J.push("--frameless");if($?.transparent)J.push("--transparent");if($?.alwaysOnTop)J.push("--always-on-top");if($?.fullscreen)J.push("--fullscreen");if(!$?.resizable)J.push("--no-resize");if($?.darkMode)J.push("--dark");if($?.hotReload)J.push("--hot-reload");if($?.devTools===!1)J.push("--no-devtools");if($?.systemTray)J.push("--system-tray");if($?.hideDockIcon)J.push("--hide-dock-icon");if($?.menubarOnly)J.push("--menubar-only");if($?.titlebarHidden)J.push("--titlebar-hidden");if($?.webSidebarMaterial){if(J.push("--web-sidebar-material"),$?.webSidebarWidth)J.push("--web-sidebar-width",String($.webSidebarWidth));if($?.webSidebarMaterialOpacity!==void 0)J.push("--web-sidebar-material-opacity",String($.webSidebarMaterialOpacity))}if($?.icon)J.push("--icon",$.icon);if($?.nativeSidebar){if(J.push("--native-sidebar"),$?.sidebarWidth)J.push("--sidebar-width",String($.sidebarWidth));let Y=$?.sidebarConfig?{...$.sidebarConfig,variant:$.sidebarConfig.variant??$.sidebarVariant,material:$.sidebarConfig.material??$.sidebarMaterial,backgroundEffect:$.sidebarConfig.backgroundEffect??$.sidebarBackgroundEffect,allowsVibrancy:$.sidebarConfig.allowsVibrancy??$.sidebarAllowsVibrancy}:void 0;if(Y?.variant==="desktop")Y.material=Y.material??"sidebar",Y.backgroundEffect=Y.backgroundEffect??"vibrancy",Y.allowsVibrancy=Y.allowsVibrancy??!0;if(Y){let Q;try{Q=JSON.stringify(Y)}catch(z){throw Error(`Failed to serialize sidebarConfig: ${z.message}`)}let q=262144;if(Q.length<=q&&!Q.includes(`
|
|
943
|
+
`)&&!Q.includes("\r"))J.push("--sidebar-config",Q);else{let z=r8(kJ(a8(),"craft-sidebar-")),W=kJ(z,"sidebar-config.json");o8(W,Q,"utf-8"),J.push("--sidebar-config-file",W)}}}if(this.config.quiet)J.push("--quiet");return J}async findCraftBinary(){return e8(this.config.craftPath)}}function oX(J){return new NJ(J)}async function aX(J,$){return new NJ({html:J,window:$}).show()}async function tX(J,$){return new NJ({url:J,window:$}).show()}export{e8 as $,J$ as aa,V$ as ba,bZ as ca,g$ as da,vZ as ea,O8 as fa,yZ as ga,f$ as ha,hZ as ia,m$ as ja,s as ka,FJ as la,yJ as ma,gZ as na,aJ as oa,fZ as pa,jJ as qa,D8 as ra,s$ as sa,mZ as ta,pZ as ua,cZ as va,dZ as wa,lZ as xa,nZ as ya,sZ as za,x as Aa,rZ as Ba,iZ as Ca,oZ as Da,aZ as Ea,tZ as Fa,eZ as Ga,J9 as Ha,$9 as Ia,Z9 as Ja,X9 as Ka,Y9 as La,Q9 as Ma,G9 as Na,K9 as Oa,q9 as Pa,U9 as Qa,z9 as Ra,W9 as Sa,H9 as Ta,V9 as Ua,L9 as Va,R9 as Wa,F9 as Xa,j9 as Ya,A9 as Za,T8 as _a,J0 as $a,X0 as ab,N8 as bb,B8 as cb,Y0 as db,_9 as eb,ZJ as fb,D9 as gb,M9 as hb,E9 as ib,K0 as jb,q0 as kb,T9 as lb,N9 as mb,G as nb,B9 as ob,x9 as pb,K as qb,S9 as rb,k9 as sb,I8 as tb,I9 as ub,w9 as vb,P9 as wb,C9 as xb,b9 as yb,v9 as zb,y9 as Ab,h9 as Bb,u9 as Cb,g9 as Db,f9 as Eb,m9 as Fb,p9 as Gb,c9 as Hb,d9 as Ib,l9 as Jb,n9 as Kb,s9 as Lb,r9 as Mb,i9 as Nb,o9 as Ob,a9 as Pb,t9 as Qb,e9 as Rb,JX as Sb,$X as Tb,ZX as Ub,XX as Vb,YX as Wb,QX as Xb,GX as Yb,KX as Zb,qX as _b,UX as $b,zX as ac,WX as bc,HX as cc,VX as dc,LX as ec,RX as fc,FX as gc,OX as hc,jX as ic,AX as jc,_X as kc,DX as lc,MX as mc,EX as nc,TX as oc,NX as pc,BX as qc,H0 as rc,V0 as sc,L0 as tc,R0 as uc,F0 as vc,O0 as wc,xX as xc,w8 as yc,P8 as zc,C8 as Ac,b8 as Bc,SX as Cc,kX as Dc,QJ as Ec,S0 as Fc,k0 as Gc,I0 as Hc,IX as Ic,w0 as Jc,gJ as Kc,fJ as Lc,mJ as Mc,P0 as Nc,C0 as Oc,b0 as Pc,y0 as Qc,h0 as Rc,u0 as Sc,g0 as Tc,pJ as Uc,f0 as Vc,cJ as Wc,m0 as Xc,dJ as Yc,p0 as Zc,lJ as _c,c0 as $c,d0 as ad,l0 as bd,n0 as cd,s0 as dd,r0 as ed,i0 as fd,nJ as gd,o0 as hd,a0 as id,t0 as jd,e0 as kd,JZ as ld,y8 as md,u8 as nd,QZ as od,g8 as pd,GZ as qd,wX as rd,PX as sd,CX as td,_J as ud,sJ as vd,rJ as wd,bX as xd,vX as yd,yX as zd,UZ as Ad,zZ as Bd,WZ as Cd,hX as Dd,uX as Ed,gX as Fd,fX as Gd,mX as Hd,pX as Id,cX as Jd,dX as Kd,G8 as Ld,HZ as Md,TJ as Nd,FZ as Od,NJ as Pd,oX as Qd,aX as Rd,tX as Sd};
|