@stacksjs/desktop 0.2.975 → 0.2.978
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/browser.js +11 -11
- package/dist/index.d.ts +8 -2
- package/dist/index.js +72 -72
- package/dist/native-window.d.ts +21 -0
- package/dist/self-update.d.ts +54 -1
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function De(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function
|
|
1
|
+
function De(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function W(){return typeof window<"u"&&typeof document<"u"}async function Ct(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var x=new Map;function Re(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function Le(e){switch(e){case"info":return"ℹ";case"success":return"✔";case"warning":return"⚠";case"error":return"✖";default:return"ℹ"}}function Oe(e="top-right"){if(!W())throw Error("Toast container requires browser environment");try{let n=document.querySelector(`.stx-toast-container[data-position="${e}"]`);if(n)return n}catch{}let t=document.createElement("div");t.className=`stx-toast-container ${e}`,t.dataset.position=e;try{if(document.body)document.body.appendChild(t)}catch{}return t}function Fe(e){let{options:t}=e,n=Le(t.type),i=t.type||"info",o=t.duration!==0;return`
|
|
2
2
|
<div class="stx-toast ${i}" data-alert-id="${e.id}" role="alert" aria-live="polite">
|
|
3
3
|
<div class="stx-toast-icon">${n}</div>
|
|
4
4
|
<div class="stx-toast-content">
|
|
@@ -7,7 +7,7 @@ function De(){if(typeof Notification<"u"&&Notification.permission==="granted")re
|
|
|
7
7
|
</div>
|
|
8
8
|
${o?'<button class="stx-toast-close" aria-label="Close">×</button>':""}
|
|
9
9
|
</div>
|
|
10
|
-
`}function ie(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function B(e){if(e.timeout)clearTimeout(e.timeout);if(x.delete(e.id),e.element&&
|
|
10
|
+
`}function ie(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function B(e){if(e.timeout)clearTimeout(e.timeout);if(x.delete(e.id),e.element&&W())e.element.classList.add("dismissing"),setTimeout(()=>{e.element?.remove()},200)}async function oe(e){let t=Re(),n=De(),i=e.duration??5000,o={id:t,options:e};if(x.set(t,o),n&&e.type!=="error")try{let s=new Notification(e.title||"Notification",{body:e.message,icon:e.type==="success"?"✓":e.type==="warning"?"⚠":"ℹ",tag:t});if(s.onclick=()=>{if(e.onClick)e.onClick();s.close()},i>0)o.timeout=setTimeout(()=>{s.close(),x.delete(t)},i);return}catch{}if(W())try{let s=Oe(e.position),c=document.createElement("div");c.innerHTML=Fe(o);let d=c.firstElementChild;if(!d){let l=(e.type||"info").toUpperCase();console.log(`[stx-alert] ${l}: ${e.title||""}`),console.log(`[stx-alert] ${e.message}`);return}o.element=d;try{s.appendChild(d)}catch{let l=(e.type||"info").toUpperCase();console.log(`[stx-alert] ${l}: ${e.title||""}`),console.log(`[stx-alert] ${e.message}`);return}if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>{try{d.classList.add("visible")}catch{}});try{d.addEventListener("click",(l)=>{if(l.target.classList?.contains("stx-toast-close")){B(o);return}if(e.onClick)e.onClick()})}catch{}if(i>0)o.timeout=setTimeout(()=>{B(o)},i)}catch{let s=(e.type||"info").toUpperCase();console.log(`[stx-alert] ${s}: ${e.title||""}`),console.log(`[stx-alert] ${e.message}`)}else{let s=(e.type||"info").toUpperCase();if(console.log(`[stx-alert] ${s}: ${e.title||""}`),console.log(`[stx-alert] ${e.message}`),i>0)o.timeout=setTimeout(()=>{x.delete(t)},i)}}async function T(e){return oe({...e,position:e.position||"top-right"})}async function Mt(e,t=3000){return T({message:e,type:"info",duration:t})}async function Bt(e,t=3000){return T({message:e,type:"success",duration:t})}async function Tt(e,t=3000){return T({message:e,type:"warning",duration:t})}async function Dt(e,t=5000){return T({message:e,type:"error",duration:t})}async function Rt(e,t,n="info"){return oe({title:e,message:t,type:n})}function Lt(e){let t=x.get(e);if(t)B(t)}function Ot(){for(let e of x.values())B(e)}function Ft(){return x.size}var _t=`
|
|
11
11
|
.stx-toast-container {
|
|
12
12
|
position: fixed;
|
|
13
13
|
z-index: 10001;
|
|
@@ -109,15 +109,15 @@ function De(){if(typeof Notification<"u"&&Notification.permission==="granted")re
|
|
|
109
109
|
.stx-toast.success { border-left: 4px solid #27ae60; }
|
|
110
110
|
.stx-toast.warning { border-left: 4px solid #f39c12; }
|
|
111
111
|
.stx-toast.error { border-left: 4px solid #e74c3c; }
|
|
112
|
-
`;function r(e){if(typeof window>"u")return!1;let t=window.craft;return!!(t&&t[e])}function u(e){if(!r(e))throw Error(`craft.${e} is not available — this API requires a Craft native window`);return window.craft[e]}function a(e,t){if(typeof window>"u")return()=>{};let n=(i)=>t(i.detail??{});return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}var ae={name:"",version:"0.0.0"},Ht={async icon(e){if(!e.startsWith("/")||!e.endsWith(".app")||e.includes("\x00"))throw Error("Application icons require an absolute .app path.");let t=u("app");if(!t.icon)throw Error("This Craft runtime does not support native application icons.");return t.icon(e)},async hideDockIcon(){if(r("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(r("app"))await window.craft.app.showDockIcon()},async quit(){if(r("app"))await window.craft.app.quit()},async getInfo(){if(!r("app"))return ae;let e=await window.craft.app.getInfo();return{...ae,...e||{}}},async notify(e){if(!e.title)throw Error("notify: title is required");if(r("app"))await window.craft.app.notify(e)},async setBadge(e){if(r("app"))await window.craft.app.setBadge(e)},async bounce(e="informational"){if(r("app"))await window.craft.app.bounce(e)}};var se={[-1743]:"automation-denied",[-1744]:"automation-denied",[-25211]:"accessibility-denied",[-1719]:"accessibility-denied",[-128]:"cancelled",[-2740]:"syntax",[-2741]:"syntax",[-2753]:"syntax",[-600]:"app-not-running"};function $t(e){if(e.ok)return null;let t=typeof e.error?.code==="number"&&Number.isFinite(e.error.code)?e.error.code:void 0;return{kind:t!==void 0&&Object.hasOwn(se,t)?se[t]:"unknown",code:t,message:e.error?.message}}var zt={async execute(e){if(!e)throw Error("appleScript.execute: source is required");if(!r("appleScript"))return{ok:!1};return await window.craft.appleScript.execute(e)}};var p=null,Vt={async play(e,t){if(r("audio"))return await window.craft.audio.play(e,t);if(typeof window>"u"||typeof Audio>"u")return!1;if(p)p.pause(),p=null;if(p=new Audio(e),t?.volume!=null)p.volume=t.volume;if(t?.loops)p.loop=!0;try{return await p.play(),!0}catch{return!1}},async playSystemSound(e){if(r("audio"))return await window.craft.audio.playSystemSound(e);if(typeof window>"u"||typeof Audio>"u")return!1;try{return p=new Audio(`/System/Library/Sounds/${e}.aiff`),await p.play(),!0}catch{return!1}},async stop(){if(r("audio")){await window.craft.audio.stop();return}if(p)p.pause(),p.currentTime=0,p=null},async isPlaying(){if(r("audio"))return await window.craft.audio.isPlaying();return!!(p&&!p.paused)},async startRecording(e,t){if(r("audio"))return await window.craft.audio.startRecording(e,t);return!1},async stopRecording(){if(r("audio"))await window.craft.audio.stopRecording()},async isRecording(){if(r("audio"))return await window.craft.audio.isRecording();return!1}};var Xt={async isCharging(){if(r("power"))return await window.craft.power.isCharging();let e=await D();return e?!!e.charging:!1},async isPluggedIn(){if(r("power"))return await window.craft.power.isPluggedIn();let e=await D();return e?!!e.charging||e.level>=0.999:!1},async isLowPowerMode(){if(r("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(r("power")){let t=await window.craft.power.batteryLevel();return typeof t==="number"?t:null}let e=await D();return e?e.level:null},async timeRemaining(){if(r("power")){let n=await window.craft.power.timeRemaining();return typeof n==="number"?n:null}let e=await D();if(!e)return null;let t=e.charging?e.chargingTime:e.dischargingTime;return Number.isFinite(t)?Math.round(t/60):null},async thermalState(){if(r("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(r("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(e="app is busy"){if(r("power")){await window.craft.power.preventSleep(e);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let t=window;if(t.__craftWebWakeLock?.release){try{await t.__craftWebWakeLock.release()}catch{}t.__craftWebWakeLock=null}try{let n=await navigator.wakeLock.request("screen");t.__craftWebWakeLock=n}catch{}},async allowSleep(){if(r("power")){await window.craft.power.allowSleep();return}let e=window.__craftWebWakeLock;if(e&&typeof e.release==="function"){try{await e.release()}catch{}window.__craftWebWakeLock=null}},onSleep(e){return a("craft:powerSleep",e)},onWake(e){return a("craft:powerWake",e)}};async function D(){if(typeof navigator>"u")return null;let e=navigator;if(typeof e.getBattery!=="function")return null;try{return await e.getBattery()}catch{return null}}var Zt={async isAvailable(){if(!r("biometric"))return!1;return await window.craft.biometric.isAvailable()},async getBiometryType(){if(!r("biometric"))return"none";return await window.craft.biometric.getBiometryType()},async evaluate(e,t){if(!e)throw Error("biometric.evaluate: reason is required");if(!r("biometric"))return{success:!1,errorCode:-1};return await window.craft.biometric.evaluate(e,t)}};var _e=/^[\da-f]*$/i;function Ne(e,t){if(typeof t!=="string"||!_e.test(t)||t.length%2!==0)throw Error(`${e}: must be a hex string with even length, got ${JSON.stringify(t)}`)}var rr={async isEnabled(){return r("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return r("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return r("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return r("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(r("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(r("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return r("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(e){if(r("bluetooth"))await window.craft.bluetooth.connect(e)},async disconnect(e){if(r("bluetooth"))await window.craft.bluetooth.disconnect(e)},async openPreferences(){if(r("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(e){if(!e)throw Error("bluetooth.discoverServices: deviceId is required");if(!r("bluetooth"))return[];let t=await window.craft.bluetooth.discoverServices(e);return Array.isArray(t)?t:[]},async discoverCharacteristics(e,t){if(!e||!t)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!r("bluetooth"))return[];let n=await window.craft.bluetooth.discoverCharacteristics(e,t);return Array.isArray(n)?n:[]},async readCharacteristic(e,t,n){if(!e||!t||!n)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!r("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(e,t,n)},async writeCharacteristic(e,t,n,i,o="with-response"){if(!e||!t||!n)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(Ne("bluetooth.writeCharacteristic.valueHex",i),!r("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(e,t,n,i,o)},async setCharacteristicNotify(e,t,n,i){if(!e||!t||!n)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!r("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(e,t,n,i)},onDeviceFound(e){return a("craft:bluetooth:deviceFound",e)},onDeviceConnected(e){return a("craft:bluetooth:deviceConnected",e)},onDeviceDisconnected(e){return a("craft:bluetooth:deviceDisconnected",e)},onCharacteristicValue(e){return a("craft:bluetooth:characteristicValue",e)}};var or={async browse(e){if(!r("bonjour"))return{started:!1,reason:"bridge unavailable"};return await window.craft.bonjour.browse(e)},async stop(){if(r("bonjour"))await window.craft.bonjour.stop()},onFound(e){return a("craft:bonjour:found",e)},onLost(e){return a("craft:bonjour:lost",e)}};var ce=[{name:"fs",support:"native"},{name:"shell",support:"native"},{name:"system",support:"all"},{name:"clipboard",support:"all"},{name:"dialog",support:"all"},{name:"window",support:"native"},{name:"tray",support:"native"},{name:"menu",support:"native"},{name:"theme",support:"all"},{name:"screen",support:"all"},{name:"network",support:"all"},{name:"power",support:"all"},{name:"battery",support:"all"},{name:"notifications",support:"all"},{name:"globalShortcuts",support:"native"},{name:"autolaunch",support:"native"},{name:"appInfo",support:"all"},{name:"localServer",support:"native"},{name:"bluetooth",support:"native"},{name:"crashReporter",support:"all"},{name:"updater",support:"native"},{name:"iap",support:"macos"},{name:"keychain",support:"native"},{name:"log",support:"all"},{name:"biometric",support:"macos"},{name:"location",support:"macos"},{name:"audio",support:"macos"},{name:"deepLink",support:"native"},{name:"handoff",support:"macos"},{name:"liveActivities",support:"macos"},{name:"touchbar",support:"macos"},{name:"dragOut",support:"macos"},{name:"appleScript",support:"macos"},{name:"fileAssociations",support:"native"},{name:"tags",support:"macos"},{name:"pdf",support:"macos"},{name:"bonjour",support:"macos"},{name:"spotlight",support:"macos"},{name:"speechRecognition",support:"macos"},{name:"vision",support:"macos"},{name:"midi",support:"macos"},{name:"coreml",support:"macos"},{name:"continuityCamera",support:"macos"},{name:"serviceMenu",support:"macos"},{name:"serial",support:"native"}];function cr(){return ce.map(({name:e,support:t})=>({name:e,support:t,available:r(e)}))}function qe(e){let t=ce.find((n)=>n.name===e);if(!t)return;return{...t,available:r(e)}}function dr(e){let t=qe(e);return!!t&&t.available}var fr={async historySnapshot(e=-1){if(!Number.isSafeInteger(e))throw Error("Clipboard history requires an integer change cursor.");let t=u("clipboard");if(!t.historySnapshot)throw Error("This Craft runtime does not support protected clipboard history.");return t.historySnapshot(e)},async writeText(e){if(r("clipboard")){await window.craft.clipboard.writeText(e);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(e)},async readText(){if(r("clipboard")){let e=await window.craft.clipboard.readText();return typeof e==="string"?e:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(e){if(r("clipboard")){await window.craft.clipboard.writeHTML(e);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let t=new window.ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([He(e)],{type:"text/plain"})});await navigator.clipboard.write([t])}catch{}},async readHTML(){if(r("clipboard")){let e=await window.craft.clipboard.readHTML();return typeof e==="string"?e:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes("text/html"))return await(await t.getType("text/html")).text()}catch{}return""},async clear(){if(r("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(r("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(r("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(r("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function He(e){return e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
|
|
112
|
+
`;function r(e){if(typeof window>"u")return!1;let t=window.craft;return!!(t&&t[e])}function u(e){if(!r(e))throw Error(`craft.${e} is not available — this API requires a Craft native window`);return window.craft[e]}function a(e,t){if(typeof window>"u")return()=>{};let n=(i)=>t(i.detail??{});return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}var ae={name:"",version:"0.0.0"},Wt={async icon(e){if(!e.startsWith("/")||!e.endsWith(".app")||e.includes("\x00"))throw Error("Application icons require an absolute .app path.");let t=u("app");if(!t.icon)throw Error("This Craft runtime does not support native application icons.");return t.icon(e)},async hideDockIcon(){if(r("app"))await window.craft.app.hideDockIcon()},async showDockIcon(){if(r("app"))await window.craft.app.showDockIcon()},async quit(){if(r("app"))await window.craft.app.quit()},async getInfo(){if(!r("app"))return ae;let e=await window.craft.app.getInfo();return{...ae,...e||{}}},async notify(e){if(!e.title)throw Error("notify: title is required");if(r("app"))await window.craft.app.notify(e)},async setBadge(e){if(r("app"))await window.craft.app.setBadge(e)},async bounce(e="informational"){if(r("app"))await window.craft.app.bounce(e)}};var se={[-1743]:"automation-denied",[-1744]:"automation-denied",[-25211]:"accessibility-denied",[-1719]:"accessibility-denied",[-128]:"cancelled",[-2740]:"syntax",[-2741]:"syntax",[-2753]:"syntax",[-600]:"app-not-running"};function zt(e){if(e.ok)return null;let t=typeof e.error?.code==="number"&&Number.isFinite(e.error.code)?e.error.code:void 0;return{kind:t!==void 0&&Object.hasOwn(se,t)?se[t]:"unknown",code:t,message:e.error?.message}}var Kt={async execute(e){if(!e)throw Error("appleScript.execute: source is required");if(!r("appleScript"))return{ok:!1};return await window.craft.appleScript.execute(e)}};var p=null,Yt={async play(e,t){if(r("audio"))return await window.craft.audio.play(e,t);if(typeof window>"u"||typeof Audio>"u")return!1;if(p)p.pause(),p=null;if(p=new Audio(e),t?.volume!=null)p.volume=t.volume;if(t?.loops)p.loop=!0;try{return await p.play(),!0}catch{return!1}},async playSystemSound(e){if(r("audio"))return await window.craft.audio.playSystemSound(e);if(typeof window>"u"||typeof Audio>"u")return!1;try{return p=new Audio(`/System/Library/Sounds/${e}.aiff`),await p.play(),!0}catch{return!1}},async stop(){if(r("audio")){await window.craft.audio.stop();return}if(p)p.pause(),p.currentTime=0,p=null},async isPlaying(){if(r("audio"))return await window.craft.audio.isPlaying();return!!(p&&!p.paused)},async startRecording(e,t){if(r("audio"))return await window.craft.audio.startRecording(e,t);return!1},async stopRecording(){if(r("audio"))await window.craft.audio.stopRecording()},async isRecording(){if(r("audio"))return await window.craft.audio.isRecording();return!1}};var Jt={async isCharging(){if(r("power"))return await window.craft.power.isCharging();let e=await D();return e?!!e.charging:!1},async isPluggedIn(){if(r("power"))return await window.craft.power.isPluggedIn();let e=await D();return e?!!e.charging||e.level>=0.999:!1},async isLowPowerMode(){if(r("power"))return await window.craft.power.isLowPowerMode();return!1},async level(){if(r("power")){let t=await window.craft.power.batteryLevel();return typeof t==="number"?t:null}let e=await D();return e?e.level:null},async timeRemaining(){if(r("power")){let n=await window.craft.power.timeRemaining();return typeof n==="number"?n:null}let e=await D();if(!e)return null;let t=e.charging?e.chargingTime:e.dischargingTime;return Number.isFinite(t)?Math.round(t/60):null},async thermalState(){if(r("power"))return await window.craft.power.thermalState()||"unknown";return"unknown"},async uptimeSeconds(){if(r("power"))return await window.craft.power.uptimeSeconds();if(typeof performance<"u"&&typeof performance.now==="function")return Math.round(performance.now()/1000);return 0},async preventSleep(e="app is busy"){if(r("power")){await window.craft.power.preventSleep(e);return}if(typeof navigator>"u"||!navigator.wakeLock)return;let t=window;if(t.__craftWebWakeLock?.release){try{await t.__craftWebWakeLock.release()}catch{}t.__craftWebWakeLock=null}try{let n=await navigator.wakeLock.request("screen");t.__craftWebWakeLock=n}catch{}},async allowSleep(){if(r("power")){await window.craft.power.allowSleep();return}let e=window.__craftWebWakeLock;if(e&&typeof e.release==="function"){try{await e.release()}catch{}window.__craftWebWakeLock=null}},onSleep(e){return a("craft:powerSleep",e)},onWake(e){return a("craft:powerWake",e)}};async function D(){if(typeof navigator>"u")return null;let e=navigator;if(typeof e.getBattery!=="function")return null;try{return await e.getBattery()}catch{return null}}var er={async isAvailable(){if(!r("biometric"))return!1;return await window.craft.biometric.isAvailable()},async getBiometryType(){if(!r("biometric"))return"none";return await window.craft.biometric.getBiometryType()},async evaluate(e,t){if(!e)throw Error("biometric.evaluate: reason is required");if(!r("biometric"))return{success:!1,errorCode:-1};return await window.craft.biometric.evaluate(e,t)}};var _e=/^[\da-f]*$/i;function Ne(e,t){if(typeof t!=="string"||!_e.test(t)||t.length%2!==0)throw Error(`${e}: must be a hex string with even length, got ${JSON.stringify(t)}`)}var nr={async isEnabled(){return r("bluetooth")?await window.craft.bluetooth.isEnabled():!1},async powerState(){return r("bluetooth")?await window.craft.bluetooth.powerState():"unknown"},async connectedDevices(){return r("bluetooth")?await window.craft.bluetooth.connectedDevices():[]},async pairedDevices(){return r("bluetooth")?await window.craft.bluetooth.pairedDevices():[]},async startDiscovery(){if(r("bluetooth"))await window.craft.bluetooth.startDiscovery()},async stopDiscovery(){if(r("bluetooth"))await window.craft.bluetooth.stopDiscovery()},async isDiscovering(){return r("bluetooth")?await window.craft.bluetooth.isDiscovering():!1},async connect(e){if(r("bluetooth"))await window.craft.bluetooth.connect(e)},async disconnect(e){if(r("bluetooth"))await window.craft.bluetooth.disconnect(e)},async openPreferences(){if(r("bluetooth"))await window.craft.bluetooth.openPreferences()},async discoverServices(e){if(!e)throw Error("bluetooth.discoverServices: deviceId is required");if(!r("bluetooth"))return[];let t=await window.craft.bluetooth.discoverServices(e);return Array.isArray(t)?t:[]},async discoverCharacteristics(e,t){if(!e||!t)throw Error("bluetooth.discoverCharacteristics: deviceId and serviceUuid are required");if(!r("bluetooth"))return[];let n=await window.craft.bluetooth.discoverCharacteristics(e,t);return Array.isArray(n)?n:[]},async readCharacteristic(e,t,n){if(!e||!t||!n)throw Error("bluetooth.readCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(!r("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.readCharacteristic(e,t,n)},async writeCharacteristic(e,t,n,i,o="with-response"){if(!e||!t||!n)throw Error("bluetooth.writeCharacteristic: deviceId, serviceUuid, characteristicUuid are required");if(Ne("bluetooth.writeCharacteristic.valueHex",i),!r("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.writeCharacteristic(e,t,n,i,o)},async setCharacteristicNotify(e,t,n,i){if(!e||!t||!n)throw Error("bluetooth.setCharacteristicNotify: deviceId, serviceUuid, characteristicUuid are required");if(!r("bluetooth"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.bluetooth.setCharacteristicNotify(e,t,n,i)},onDeviceFound(e){return a("craft:bluetooth:deviceFound",e)},onDeviceConnected(e){return a("craft:bluetooth:deviceConnected",e)},onDeviceDisconnected(e){return a("craft:bluetooth:deviceDisconnected",e)},onCharacteristicValue(e){return a("craft:bluetooth:characteristicValue",e)}};var ar={async browse(e){if(!r("bonjour"))return{started:!1,reason:"bridge unavailable"};return await window.craft.bonjour.browse(e)},async stop(){if(r("bonjour"))await window.craft.bonjour.stop()},onFound(e){return a("craft:bonjour:found",e)},onLost(e){return a("craft:bonjour:lost",e)}};var ce=[{name:"fs",support:"native"},{name:"shell",support:"native"},{name:"system",support:"all"},{name:"clipboard",support:"all"},{name:"dialog",support:"all"},{name:"window",support:"native"},{name:"tray",support:"native"},{name:"menu",support:"native"},{name:"theme",support:"all"},{name:"screen",support:"all"},{name:"network",support:"all"},{name:"power",support:"all"},{name:"battery",support:"all"},{name:"notifications",support:"all"},{name:"globalShortcuts",support:"native"},{name:"autolaunch",support:"native"},{name:"appInfo",support:"all"},{name:"localServer",support:"native"},{name:"bluetooth",support:"native"},{name:"crashReporter",support:"all"},{name:"updater",support:"native"},{name:"iap",support:"macos"},{name:"keychain",support:"native"},{name:"log",support:"all"},{name:"biometric",support:"macos"},{name:"location",support:"macos"},{name:"audio",support:"macos"},{name:"deepLink",support:"native"},{name:"handoff",support:"macos"},{name:"liveActivities",support:"macos"},{name:"touchbar",support:"macos"},{name:"dragOut",support:"macos"},{name:"appleScript",support:"macos"},{name:"fileAssociations",support:"native"},{name:"tags",support:"macos"},{name:"pdf",support:"macos"},{name:"bonjour",support:"macos"},{name:"spotlight",support:"macos"},{name:"speechRecognition",support:"macos"},{name:"vision",support:"macos"},{name:"midi",support:"macos"},{name:"coreml",support:"macos"},{name:"continuityCamera",support:"macos"},{name:"serviceMenu",support:"macos"},{name:"serial",support:"native"}];function dr(){return ce.map(({name:e,support:t})=>({name:e,support:t,available:r(e)}))}function qe(e){let t=ce.find((n)=>n.name===e);if(!t)return;return{...t,available:r(e)}}function ur(e){let t=qe(e);return!!t&&t.available}var pr={async historySnapshot(e=-1){if(!Number.isSafeInteger(e))throw Error("Clipboard history requires an integer change cursor.");let t=u("clipboard");if(!t.historySnapshot)throw Error("This Craft runtime does not support protected clipboard history.");return t.historySnapshot(e)},async writeText(e){if(r("clipboard")){await window.craft.clipboard.writeText(e);return}if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(e)},async readText(){if(r("clipboard")){let e=await window.craft.clipboard.readText();return typeof e==="string"?e:""}if(typeof navigator<"u"&&navigator.clipboard?.readText)try{return await navigator.clipboard.readText()}catch{return""}return""},async writeHTML(e){if(r("clipboard")){await window.craft.clipboard.writeHTML(e);return}if(typeof navigator<"u"&&navigator.clipboard?.write)try{let t=new window.ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([He(e)],{type:"text/plain"})});await navigator.clipboard.write([t])}catch{}},async readHTML(){if(r("clipboard")){let e=await window.craft.clipboard.readHTML();return typeof e==="string"?e:""}if(typeof navigator<"u"&&navigator.clipboard?.read)try{let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes("text/html"))return await(await t.getType("text/html")).text()}catch{}return""},async clear(){if(r("clipboard")){await window.craft.clipboard.clear();return}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText("")}catch{}},async hasText(){if(r("clipboard"))return await window.craft.clipboard.hasText();return(await this.readText()).length>0},async hasHTML(){if(r("clipboard"))return await window.craft.clipboard.hasHTML();return(await this.readHTML()).length>0},async hasImage(){if(r("clipboard"))return await window.craft.clipboard.hasImage();return!1}};function He(e){return e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,"").replace(/<\/?(br|p|div|li|h[1-6])\b[^>]*>/gi,`
|
|
113
113
|
`).replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/\n{3,}/g,`
|
|
114
114
|
|
|
115
|
-
`).trim()}function ue(e){if(e.separator)return{id:e.id||"",title:"",type:"separator"};return{id:e.id||"",title:e.title||"",icon:e.icon,shortcut:e.shortcut,enabled:e.disabled?!1:void 0,checked:e.checked?!0:void 0,type:e.submenu?"submenu":void 0,submenu:e.submenu?.map(ue)}}async function de(e){if(!e.items||e.items.length===0)throw Error("contextMenu.show requires at least one item");if(!r("nativeUI"))return null;let t=window.craft?.nativeUI;if(!t)return null;let n=await t.showContextMenu({targetId:e.targetId||"",targetType:"general",x:Math.round(e.x),y:Math.round(e.y),items:e.items.map(ue)});return{id:typeof n?.id==="string"?n.id:null,targetId:n?.targetId}}var
|
|
116
|
-
at ${n.filename}:${n.lineno}:${n.colno}`}).catch(()=>{})},t=(n)=>{let i=n.reason;R.report({severity:"error",message:i?.message||String(i),source:"js",stack:i?.stack||""}).catch(()=>{})};return window.addEventListener("error",e),window.addEventListener("unhandledrejection",t),()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",t)}},forwardTo(e){return Ye(e)}},
|
|
115
|
+
`).trim()}function ue(e){if(e.separator)return{id:e.id||"",title:"",type:"separator"};return{id:e.id||"",title:e.title||"",icon:e.icon,shortcut:e.shortcut,enabled:e.disabled?!1:void 0,checked:e.checked?!0:void 0,type:e.submenu?"submenu":void 0,submenu:e.submenu?.map(ue)}}async function de(e){if(!e.items||e.items.length===0)throw Error("contextMenu.show requires at least one item");if(!r("nativeUI"))return null;let t=window.craft?.nativeUI;if(!t)return null;let n=await t.showContextMenu({targetId:e.targetId||"",targetType:"general",x:Math.round(e.x),y:Math.round(e.y),items:e.items.map(ue)});return{id:typeof n?.id==="string"?n.id:null,targetId:n?.targetId}}var wr={available(){return r("nativeUI")},async show(e){return await de(e)!==null},async pick(e){return(await de(e))?.id??null},onAction(e){return a("craft:contextmenu:action",(t)=>{if(typeof t.id==="string")e({id:t.id,targetId:t.targetId??""})})}};var vr={async listCameras(){if(!r("continuityCamera"))return[];return await window.craft.continuityCamera.listCameras()}};var Pr={async loadModel(e,t){if(!e||!t)throw Error("coreml.loadModel: id and path are required");if(!r("coreml"))return!1;return await window.craft.coreml.loadModel(e,t)},async unloadModel(e){if(!r("coreml"))return;await window.craft.coreml.unloadModel(e)},async predict(e,t){if(!e)throw Error("coreml.predict: id is required");if(!r("coreml"))return null;return await window.craft.coreml.predict(e,t)}};var I=[],U=!0,z,K,R={async report(e){if(r("crashReporter")){await window.craft.crashReporter.report(e);return}if(!U)return;let t=e instanceof Error?{timestamp:Date.now(),severity:"error",message:e.message,source:"js",stack:e.stack||"",userId:z,appVersion:K}:{timestamp:Date.now(),severity:e.severity||"error",message:e.message||"",source:e.source||"js",stack:e.stack||"",userId:z,appVersion:K};if(I.length>=64)I.shift();I.push(t)},async flush(){if(r("crashReporter"))return await window.craft.crashReporter.flush();return[...I]},async clear(){if(r("crashReporter")){await window.craft.crashReporter.clear();return}I.length=0},async setEnabled(e){if(r("crashReporter")){await window.craft.crashReporter.setEnabled(e);return}U=e},async isEnabled(){if(r("crashReporter"))return await window.craft.crashReporter.isEnabled();return U},async setUser(e){if(r("crashReporter")){await window.craft.crashReporter.setUser(e);return}z=e||void 0},async setAppVersion(e){if(r("crashReporter")){await window.craft.crashReporter.setAppVersion(e);return}K=e||void 0},attachGlobalHandlers(){if(r("crashReporter")&&window.craft.crashReporter.attachGlobalHandlers)return window.craft.crashReporter.attachGlobalHandlers();if(typeof window>"u")return()=>{};let e=(n)=>{R.report({severity:"error",message:n.message,source:"js",stack:n.error?.stack||`${n.message}
|
|
116
|
+
at ${n.filename}:${n.lineno}:${n.colno}`}).catch(()=>{})},t=(n)=>{let i=n.reason;R.report({severity:"error",message:i?.message||String(i),source:"js",stack:i?.stack||""}).catch(()=>{})};return window.addEventListener("error",e),window.addEventListener("unhandledrejection",t),()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",t)}},forwardTo(e){return Ye(e)}},We="craft:crashReporter:pending",Ue=/[\w.+-]+@[\w-]+\.[\w.-]+/g,$e=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,ze=/\/(?:Users|home)\/[^\s/'"`]+/g;function Ke(e){let t=(n)=>n.replace(Ue,"<email>").replace($e,"<ip>").replace(ze,"/<home>");return{...e,message:t(e.message),stack:t(e.stack)}}async function je(e,t){let n=new TextEncoder,i=await crypto.subtle.importKey("raw",n.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),o=await crypto.subtle.sign("HMAC",i,n.encode(t));return[...new Uint8Array(o)].map((s)=>s.toString(16).padStart(2,"0")).join("")}function Ve(e){if(!e||typeof localStorage>"u")return[];try{let t=localStorage.getItem(e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n:[]}catch{return[]}}function le(e,t){if(!e||typeof localStorage>"u")return;try{if(t.length===0)localStorage.removeItem(e);else localStorage.setItem(e,JSON.stringify(t))}catch{}}function Ye(e){let{endpoint:t,intervalMs:n=60000,signingSecret:i,redact:o=!0,headers:s={},maxRetries:c=5,persistKey:d}=e,l=d===null?null:d??We,f=Ve(l),h=!1,v=null,m=null,Me=typeof o==="function"?o:o===!1?(b)=>b:Ke;async function Be(b){let C=JSON.stringify({entries:b}),M={"Content-Type":"application/json",...s};if(i)M["X-Craft-Signature"]=await je(i,C);let ne=0,H=1000;while(!h)try{let A=await fetch(t,{method:"POST",headers:M,body:C});if(A.ok)return;if(A.status>=400&&A.status<500)return;throw Error(`HTTP ${A.status}`)}catch(A){if(ne+=1,ne>c)throw f=[...b,...f],le(l,f),A;await new Promise((Te)=>{setTimeout(Te,H)}),H=Math.min(H*2,60000)}}async function re(){if(h||m)return m??void 0;let b=await R.flush();if(b.length>0)await R.clear();if(f=[...f,...b.map((M)=>Me(M))],f.length===0)return;let C=f;return f=[],le(l,f),m=Be(C).catch(()=>{}).finally(()=>{m=null}),m}if(n>0)v=setInterval(()=>{re().catch(()=>{})},n);return{async flushNow(){await re()},stop(){if(h=!0,v)clearInterval(v);v=null},pending(){return[...f]}}}var Er={onUrl(e){if(!r("deepLink"))return()=>{};return a("craft:deepLink",e)},getInitialUrl(){if(typeof window>"u")return null;if(r("deepLink"))try{return window.craft.deepLink.getInitialUrl()}catch{return null}return window.__craftPendingDeepLink||null},consumeInitialUrl(){let e=this.getInitialUrl();if(typeof window<"u")window.__craftPendingDeepLink=void 0;return e},isAvailable(){return r("deepLink")}};function fe(e){let t=new Set(e.properties??[]);if(e.canChooseDirectories)t.add("openDirectory");if(e.canChooseFiles)t.add("openFile");if(e.multiSelections)t.add("multiSelections");if(e.showHiddenFiles)t.add("showHiddenFiles");if(e.canCreateDirectories)t.add("createDirectory");return{...e,properties:[...t]}}function Ge(){if(typeof window>"u")return;return window.craft?.dialog}var Xe={error:"critical",warning:"warning",question:"info",info:"info",none:"info"};function Je(e){let t=[e.title?e.message:"",e.detail??""].filter(Boolean).join(`
|
|
117
117
|
|
|
118
|
-
`);return{title:e.title||e.message,message:t||void 0,style:Xe[e.type??"none"]??"info",buttons:e.buttons}}function pe(e,t){if(typeof e==="number"&&Number.isFinite(e))return{response:e};if(e&&typeof e==="object"){let i=e;if(typeof i.response==="number")return{response:i.response};if(typeof i.buttonIndex==="number")return{response:i.buttonIndex}}let n=t.buttons??["OK"];return{response:t.cancelButton??Math.max(0,n.length-1)}}function j(){if(typeof window<"u"&&window.craft?.dialog)return!0;return!1}async function
|
|
118
|
+
`);return{title:e.title||e.message,message:t||void 0,style:Xe[e.type??"none"]??"info",buttons:e.buttons}}function pe(e,t){if(typeof e==="number"&&Number.isFinite(e))return{response:e};if(e&&typeof e==="object"){let i=e;if(typeof i.response==="number")return{response:i.response};if(typeof i.buttonIndex==="number")return{response:i.buttonIndex}}let n=t.buttons??["OK"];return{response:t.cancelButton??Math.max(0,n.length-1)}}function j(){if(typeof window<"u"&&window.craft?.dialog)return!0;return!1}async function Mr(e={}){if(j())return await window.craft.dialog.showOpenDialog(fe(e));return new Promise((t)=>{if(typeof document>"u"){t({canceled:!0,filePaths:[]});return}let n=new Set(fe(e).properties),i=document.createElement("input");if(i.type="file",i.multiple=n.has("multiSelections"),e.filters?.length){let o=e.filters.flatMap((s)=>s.extensions.map((c)=>`.${c}`));i.accept=o.join(",")}if(n.has("openDirectory")&&!n.has("openFile"))i.webkitdirectory=!0;i.onchange=()=>{let o=Array.from(i.files||[]);if(o.length===0)t({canceled:!0,filePaths:[]});else{let s=o.map((c)=>c.name);t({canceled:!1,filePaths:s})}},i.oncancel=()=>{t({canceled:!0,filePaths:[]})},i.click()})}async function Br(e={}){if(j()){let n=window;try{return await n.craft.dialog.showSaveDialog(e)}catch(i){console.warn("[stx-dialog] Failed to show native save dialog:",i)}}if(typeof window<"u"&&"showSaveFilePicker"in window)try{let n=e.filters?.map((o)=>({description:o.name,accept:{"*/*":o.extensions.map((s)=>`.${s}`)}}));return{canceled:!1,filePath:(await window.showSaveFilePicker({suggestedName:e.defaultPath,types:n})).name}}catch(n){return{canceled:!0}}console.warn("[stx-dialog] Save dialog not available, using prompt fallback");let t=prompt("Enter filename:",e.defaultPath||"file.txt");if(t)return{canceled:!1,filePath:t};return{canceled:!0}}async function L(e){let t=Ge();if(typeof t?.showMessageBox==="function")try{return pe(await t.showMessageBox(e),e)}catch(d){console.warn("[stx-dialog] Failed to show native message box:",d)}else if(typeof t?.showAlert==="function")try{return pe(await t.showAlert(Je(e)),e)}catch(d){console.warn("[stx-dialog] Failed to show native alert:",d)}let n=e.buttons||["OK"],i=e.detail?`
|
|
119
119
|
|
|
120
|
-
${e.detail}`:"",o=`${e.message}${i}`;if(n.length===1)return alert(o),{response:0};let s=e.cancelButton??n.length-1,c=e.defaultButton!==void 0&&e.defaultButton!==s?e.defaultButton:n.findIndex((d,l)=>l!==s);if(n.length>2)console.warn(`[stx-dialog] ${n.length} buttons requested; a browser confirm offers two. Reachable: "${n[c]}" and "${n[s]}".`);return{response:confirm(o)?c:s}}async function
|
|
120
|
+
${e.detail}`:"",o=`${e.message}${i}`;if(n.length===1)return alert(o),{response:0};let s=e.cancelButton??n.length-1,c=e.defaultButton!==void 0&&e.defaultButton!==s?e.defaultButton:n.findIndex((d,l)=>l!==s);if(n.length>2)console.warn(`[stx-dialog] ${n.length} buttons requested; a browser confirm offers two. Reachable: "${n[c]}" and "${n[s]}".`);return{response:confirm(o)?c:s}}async function Tr(e={}){if(j()){let t=window;try{return await t.craft.dialog.showColorPicker(e)}catch(n){console.warn("[stx-dialog] Failed to show native color picker:",n)}}return new Promise((t)=>{if(typeof document>"u"){t({canceled:!0});return}let n=document.createElement("input");n.type="color",n.value=e.color||"#000000",n.onchange=()=>{t({canceled:!1,color:n.value})},n.oncancel=()=>{t({canceled:!0})},n.click()})}async function Dr(e,t){await L({type:"info",title:t||"Alert",message:e,buttons:["OK"]})}async function Rr(e,t){return(await L({type:"question",title:t||"Confirm",message:e,buttons:["OK","Cancel"],defaultButton:0,cancelButton:1})).response===0}async function Lr(e,t){await L({type:"error",title:t||"Error",message:e,buttons:["OK"]})}async function Or(e,t){await L({type:"warning",title:t||"Warning",message:e,buttons:["OK"]})}function Fr(){return`
|
|
121
121
|
// STX Desktop Dialog Bridge
|
|
122
122
|
// Provides convenient wrappers around window.craft.dialog APIs
|
|
123
123
|
window.stxDialog = {
|
|
@@ -196,10 +196,10 @@ window.stxDialog = {
|
|
|
196
196
|
// Check if dialog is available
|
|
197
197
|
isAvailable: () => typeof window.craft?.dialog !== 'undefined',
|
|
198
198
|
};
|
|
199
|
-
`}async function Nr(e,t={}){if(!r("dragOut"))throw Error("dragOut requires a Craft native window");let n=Array.isArray(e)?e:[e];if(n.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start(n,t)}function qr(){return r("dragOut")}var Wr={async getDefault(e){if(!e)throw Error("fileAssociations.getDefault: uti is required");if(!r("fileAssociations"))return null;let t=await window.craft.fileAssociations.getDefault(e);return t?String(t):null},async setDefault(e,t){if(!e||!t)throw Error("fileAssociations.setDefault: uti and bundleId are required");if(!r("fileAssociations"))return!1;return await window.craft.fileAssociations.setDefault(e,t)}};var Qe={supported:!1,isFocused:null,authorization:"unsupported"};function me(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var ge={async getStatus(){if(!r("focus"))return{...Qe};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!r("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(e,t={}){if(!r("focus"))return me();if(!(e?t.onShortcut:t.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${e?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(e,t)},async runShortcut(e){if(!r("focus"))return me();if(!e)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(e)},async listShortcuts(){if(!r("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!r("focus"))return{canList:!1,shortcuts:[]};let t=await window.craft.focus.listShortcutsResult?.();return{canList:Boolean(t?.canList),shortcuts:t?.shortcuts??[]}}};async function Kr(...e){if(e.length===0)return!1;let t=new Set(await ge.listShortcuts());return e.every((n)=>t.has(n))}async function jr(...e){if(e.length===0)return!1;let{canList:t,shortcuts:n}=await ge.listShortcutsResult();if(!t)return"unknown";let i=new Set(n);return e.every((o)=>i.has(o))}var Gr={async readFile(e){let t=await u("fs").readFile(e);return t&&t.data||""},async readBuffer(e){let t=await u("fs").readFile(e),n=t&&t.data||"";if(t&&t.base64===!0)return et(n);return new TextEncoder().encode(n)},async writeFile(e,t){await u("fs").writeFile(e,t)},async writeBuffer(e,t){let n=Ze(t),i=u("fs");if(typeof i.writeFileBytes==="function")await i.writeFileBytes(e,n);else await i.writeFile(e,n)},async copy(e,t){if(e===t)throw Error("fs.copy: source and destination must differ");await u("fs").copy(e,t)},async move(e,t){if(e===t)throw Error("fs.move: source and destination must differ");await u("fs").move(e,t)},async appendFile(e,t){await u("fs").appendFile(e,t)},async deleteFile(e){await u("fs").deleteFile(e)},async exists(e){return await u("fs").exists(e)},async stat(e){return tt(await u("fs").stat(e))},async readDir(e){let t=await u("fs").readDir(e),n=t&&t.entries||[],i=e.endsWith("/")?e.slice(0,-1):e;return n.map((o)=>({name:o.name,path:`${i}/${o.name}`,isDirectory:!!o.isDirectory}))},async mkdir(e,t){await u("fs").mkdir(e,t)},async rmdir(e,t){await u("fs").rmdir(e,t)},async watch(e,t){await u("fs").watch(e,t)},async unwatch(e){await u("fs").unwatch(e)},onChange(e){return a("craft:fs:change",e)},async watchTree(e,t,n){let i=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,o=u("fs");await o.watch(e,i,{recursive:!!t.recursive});let s=t.kinds&&t.kinds.length>0?new Set(t.kinds):null,c=Math.max(0,Math.floor(t.coalesceMs??0)),d=[],l=null,f=!1,h=()=>{if(l=null,d.length===0)return;let m=d;d=[];try{n(m)}catch{}},v=a("craft:fs:change",(m)=>{if(f)return;if(m.id!==i)return;if(s&&m.kind&&!s.has(m.kind))return;if(d.push(m),c===0){h();return}if(l==null)l=setTimeout(h,c)});return{id:i,async stop(){if(f)return;if(f=!0,v(),l)clearTimeout(l),l=null;if(d.length>0)h();try{await o.unwatch(i)}catch{}}}},async homeDir(){return await u("fs").homeDir()},async tempDir(){return await u("fs").tempDir()},async appDataDir(){return await u("fs").appDataDir()}};function Ze(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return typeof btoa==="function"?btoa(t):Buffer.from(e).toString("base64")}function et(e){let t=typeof atob==="function"?atob(e):Buffer.from(e,"base64").toString("binary"),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function tt(e){return{isFile:!!e.isFile,isDirectory:!!e.isDirectory,isSymlink:!!e.isSymlink,size:Number(e.size)||0,modifiedAt:e.modifiedAt!=null?e.modifiedAt<1000000000000?e.modifiedAt*1000:e.modifiedAt:0}}function P(){return window.craft.shortcuts}var Qr={async register(e,t,n){if(!r("shortcuts"))return;await P().register(e,t,n)},async unregister(e){if(!r("shortcuts"))return;await P().unregister(e)},async unregisterAll(){if(!r("shortcuts"))return;await P().unregisterAll()},async enable(e){if(!r("shortcuts"))return;await P().enable(e)},async disable(e){if(!r("shortcuts"))return;await P().disable(e)},async isRegistered(e){if(!r("shortcuts"))return!1;return await P().isRegistered(e)},async list(){if(!r("shortcuts"))return[];return await P().list()},on(e){return a("craft:shortcut",e)}};var O={async startActivity(e,t){if(!e)throw Error("handoff.startActivity: type is required");if(!r("handoff"))return!1;let n=await window.craft.handoff.startActivity(e,t);return typeof n==="boolean"?n:!!(n&&n.ok)},async updateActivity(e){if(!r("handoff"))return!1;let t=await window.craft.handoff.updateActivity(e);return typeof t==="boolean"?t:!!(t&&t.ok)},async stopActivity(){if(!r("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!r("handoff"))return null;let e=await window.craft.handoff.getCurrentActivity();return e&&typeof e.type==="string"?e:null},onIncoming(e){return a("craft:handoff:incoming",e)}};var y=new Map,rt=0,F=!1;function nt(e){let t=e.split("+").map((i)=>i.trim()),n={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let i of t){let o=i.toLowerCase();switch(o){case"cmd":case"command":case"meta":case"⌘":n.meta=!0;break;case"ctrl":case"control":case"⌃":n.ctrl=!0;break;case"shift":case"⇧":n.shift=!0;break;case"alt":case"option":case"opt":case"⌥":n.alt=!0;break;case"cmdorctrl":case"commandorcontrol":if(typeof process<"u"&&process.platform==="darwin")n.meta=!0;else n.ctrl=!0;break;default:n.key=o}}return n}function rn(e){let t=[];if(e.ctrl)t.push("⌃");if(e.alt)t.push("⌥");if(e.shift)t.push("⇧");if(e.meta)t.push("⌘");return t.push(e.key.toUpperCase()),t.join("")}function it(e,t){if(t.meta!==e.metaKey)return!1;if(t.ctrl!==e.ctrlKey)return!1;if(t.shift!==e.shiftKey)return!1;if(t.alt!==e.altKey)return!1;return e.key.toLowerCase()===t.key||e.code.toLowerCase()===`key${t.key}`}function we(e){for(let[,t]of y)if(it(e,t.parsed)){e.preventDefault(),e.stopPropagation();try{t.handler()}catch{}break}}function ot(){if(F)return;if(typeof document>"u")return;document.addEventListener("keydown",we,!0),F=!0}function V(){if(!F)return;if(typeof document>"u")return;document.removeEventListener("keydown",we,!0),F=!1}async function at(e,t){if(typeof window>"u")return!1;let n=window.craft;if(!n?.hotkeys?.register)return!1;try{return await n.hotkeys.register(e,t),!0}catch{return!1}}async function Y(e){if(typeof window>"u")return;let t=window.craft;if(!t?.hotkeys?.unregister)return;try{await t.hotkeys.unregister(e)}catch{}}function nn(e,t){let n=`hotkey_${++rt}_${Date.now()}`,i=nt(e);y.set(n,{shortcut:e,handler:t,parsed:i}),at(n,e),ot();let o={shortcut:e,id:n,unregister(){st(o)}};return o}function st(e){if(y.delete(e.id),Y(e.id),y.size===0)V()}function on(){for(let[e]of y)Y(e);y.clear(),V()}function an(){return Array.from(y.entries()).map(([e,t])=>({shortcut:t.shortcut,id:e,unregister(){if(y.delete(e),Y(e),y.size===0)V()}}))}var un={async isAvailable(){if(!r("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(e){if(!r("iap"))return[];let t=Array.isArray(e)?e:[String(e)];return await window.craft.iap.getProducts(t)},async purchase(e){if(!r("iap"))return{queued:!1,productId:e,reason:"IAP bridge not available"};let t=await window.craft.iap.purchase(e);return{queued:!!(t&&t.queued),productId:t?.productId,reason:t?.reason}},async restorePurchases(){if(!r("iap"))return{ok:!1};let e=await window.craft.iap.restorePurchases();return{ok:!!(e&&e.ok)}},async finishTransaction(e){if(!r("iap"))return;await window.craft.iap.finishTransaction(e)},async getReceiptData(){if(!r("iap"))return null;let e=await window.craft.iap.getReceiptData();return e?String(e):null},onPurchased(e){return a("craft:iap:purchased",e)},onFailed(e){return a("craft:iap:failed",e)},onRestored(e){return a("craft:iap:restored",e)},onProductsLoaded(e){return a("craft:iap:productsLoaded",(t)=>e(t.products||[]))},onRefunded(e){return a("craft:iap:refunded",e)},onSubscriptionStatusChanged(e){return a("craft:iap:subscriptionStatusChanged",e)},async getActiveSubscriptions(){if(!r("iap"))return[];let e=window.craft.iap.getActiveSubscriptions;if(typeof e!=="function")return[];let t=await e();return Array.isArray(t)?t:[]},async isEligibleForIntroOffer(e){if(!r("iap"))return!1;let t=window.craft.iap.isEligibleForIntroOffer;if(typeof t!=="function")return!1;return!!await t(e)}};var pn={async set(e,t,n){if(!e)throw Error("keychain.set: service is required");if(!t)throw Error("keychain.set: account is required");await u("keychain").set(e,t,n)},async get(e,t){if(!e)throw Error("keychain.get: service is required");if(!t)throw Error("keychain.get: account is required");let n=await u("keychain").get(e,t);return typeof n==="string"?n:null},async delete(e,t){if(!e)throw Error("keychain.delete: service is required");if(!t)throw Error("keychain.delete: account is required");await u("keychain").delete(e,t)},async has(e,t){if(!e)throw Error("keychain.has: service is required");if(!t)throw Error("keychain.has: account is required");return await u("keychain").has(e,t)}};var wn={async start(e,t){return O.startActivity(e,{title:t?.title,webpageURL:t?.webpageURL,userInfo:t?.state})},async update(e){return O.updateActivity({title:e.title,webpageURL:e.webpageURL,userInfo:e.state})},async stop(){await O.stopActivity()}};var vn={async start(e=0,t="127.0.0.1"){if(!r("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(e,t)},async stop(){if(!r("localServer"))return;await window.craft.localServer.stop()},async respond(e){if(!r("localServer"))return;await window.craft.localServer.respond(e||{status:200,body:"OK"})},onRequest(e){return a("craft:localServer:request",e)},async awaitOAuthCallback(e={}){u("localServer");let{port:t=0,host:n="127.0.0.1",timeoutMs:i=300000,successHTML:o}=e,s=await this.start(t,n);if(!s.started)throw Error(`localServer: start failed${s.reason?` — ${s.reason}`:""}`);return new Promise((c,d)=>{let l=setTimeout(()=>{f(),this.stop().catch(()=>{}),d(Error("localServer: OAuth callback timed out"))},i),f=this.onRequest(({url:h})=>{clearTimeout(l),f();let v=o??`<!doctype html><meta charset="utf-8"><title>Done</title>
|
|
199
|
+
`}async function qr(e,t={}){if(!r("dragOut"))throw Error("dragOut requires a Craft native window");let n=Array.isArray(e)?e:[e];if(n.length===0)throw Error("dragOut: at least one path required");await window.craft.dragOut.start(n,t)}function Hr(){return r("dragOut")}var $r={async getDefault(e){if(!e)throw Error("fileAssociations.getDefault: uti is required");if(!r("fileAssociations"))return null;let t=await window.craft.fileAssociations.getDefault(e);return t?String(t):null},async setDefault(e,t){if(!e||!t)throw Error("fileAssociations.setDefault: uti and bundleId are required");if(!r("fileAssociations"))return!1;return await window.craft.fileAssociations.setDefault(e,t)}};var Qe={supported:!1,isFocused:null,authorization:"unsupported"};function me(){return{ok:!1,error:"Focus control is only available in a Craft window on macOS"}}var ge={async getStatus(){if(!r("focus"))return{...Qe};return await window.craft.focus.getStatus()},async requestAuthorization(){if(!r("focus"))return"unsupported";return await window.craft.focus.requestAuthorization()},async setEnabled(e,t={}){if(!r("focus"))return me();if(!(e?t.onShortcut:t.offShortcut))return{ok:!1,error:`focus.setEnabled: no ${e?"onShortcut":"offShortcut"} configured`};return await window.craft.focus.setEnabled(e,t)},async runShortcut(e){if(!r("focus"))return me();if(!e)throw Error("focus.runShortcut: name is required");return await window.craft.focus.runShortcut(e)},async listShortcuts(){if(!r("focus"))return[];return await window.craft.focus.listShortcuts()},async listShortcutsResult(){if(!r("focus"))return{canList:!1,shortcuts:[]};let t=await window.craft.focus.listShortcutsResult?.();return{canList:Boolean(t?.canList),shortcuts:t?.shortcuts??[]}}};async function jr(...e){if(e.length===0)return!1;let t=new Set(await ge.listShortcuts());return e.every((n)=>t.has(n))}async function Vr(...e){if(e.length===0)return!1;let{canList:t,shortcuts:n}=await ge.listShortcutsResult();if(!t)return"unknown";let i=new Set(n);return e.every((o)=>i.has(o))}var Xr={async readFile(e){let t=await u("fs").readFile(e);return t&&t.data||""},async readBuffer(e){let t=await u("fs").readFile(e),n=t&&t.data||"";if(t&&t.base64===!0)return et(n);return new TextEncoder().encode(n)},async writeFile(e,t){await u("fs").writeFile(e,t)},async writeBuffer(e,t){let n=Ze(t),i=u("fs");if(typeof i.writeFileBytes==="function")await i.writeFileBytes(e,n);else await i.writeFile(e,n)},async copy(e,t){if(e===t)throw Error("fs.copy: source and destination must differ");await u("fs").copy(e,t)},async move(e,t){if(e===t)throw Error("fs.move: source and destination must differ");await u("fs").move(e,t)},async appendFile(e,t){await u("fs").appendFile(e,t)},async deleteFile(e){await u("fs").deleteFile(e)},async exists(e){return await u("fs").exists(e)},async stat(e){return tt(await u("fs").stat(e))},async readDir(e){let t=await u("fs").readDir(e),n=t&&t.entries||[],i=e.endsWith("/")?e.slice(0,-1):e;return n.map((o)=>({name:o.name,path:`${i}/${o.name}`,isDirectory:!!o.isDirectory}))},async mkdir(e,t){await u("fs").mkdir(e,t)},async rmdir(e,t){await u("fs").rmdir(e,t)},async watch(e,t){await u("fs").watch(e,t)},async unwatch(e){await u("fs").unwatch(e)},onChange(e){return a("craft:fs:change",e)},async watchTree(e,t,n){let i=`watch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,o=u("fs");await o.watch(e,i,{recursive:!!t.recursive});let s=t.kinds&&t.kinds.length>0?new Set(t.kinds):null,c=Math.max(0,Math.floor(t.coalesceMs??0)),d=[],l=null,f=!1,h=()=>{if(l=null,d.length===0)return;let m=d;d=[];try{n(m)}catch{}},v=a("craft:fs:change",(m)=>{if(f)return;if(m.id!==i)return;if(s&&m.kind&&!s.has(m.kind))return;if(d.push(m),c===0){h();return}if(l==null)l=setTimeout(h,c)});return{id:i,async stop(){if(f)return;if(f=!0,v(),l)clearTimeout(l),l=null;if(d.length>0)h();try{await o.unwatch(i)}catch{}}}},async homeDir(){return await u("fs").homeDir()},async tempDir(){return await u("fs").tempDir()},async appDataDir(){return await u("fs").appDataDir()}};function Ze(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return typeof btoa==="function"?btoa(t):Buffer.from(e).toString("base64")}function et(e){let t=typeof atob==="function"?atob(e):Buffer.from(e,"base64").toString("binary"),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function tt(e){return{isFile:!!e.isFile,isDirectory:!!e.isDirectory,isSymlink:!!e.isSymlink,size:Number(e.size)||0,modifiedAt:e.modifiedAt!=null?e.modifiedAt<1000000000000?e.modifiedAt*1000:e.modifiedAt:0}}function P(){return window.craft.shortcuts}var Zr={async register(e,t,n){if(!r("shortcuts"))return;await P().register(e,t,n)},async unregister(e){if(!r("shortcuts"))return;await P().unregister(e)},async unregisterAll(){if(!r("shortcuts"))return;await P().unregisterAll()},async enable(e){if(!r("shortcuts"))return;await P().enable(e)},async disable(e){if(!r("shortcuts"))return;await P().disable(e)},async isRegistered(e){if(!r("shortcuts"))return!1;return await P().isRegistered(e)},async list(){if(!r("shortcuts"))return[];return await P().list()},on(e){return a("craft:shortcut",e)}};var O={async startActivity(e,t){if(!e)throw Error("handoff.startActivity: type is required");if(!r("handoff"))return!1;let n=await window.craft.handoff.startActivity(e,t);return typeof n==="boolean"?n:!!(n&&n.ok)},async updateActivity(e){if(!r("handoff"))return!1;let t=await window.craft.handoff.updateActivity(e);return typeof t==="boolean"?t:!!(t&&t.ok)},async stopActivity(){if(!r("handoff"))return;await window.craft.handoff.stopActivity()},async getCurrentActivity(){if(!r("handoff"))return null;let e=await window.craft.handoff.getCurrentActivity();return e&&typeof e.type==="string"?e:null},onIncoming(e){return a("craft:handoff:incoming",e)}};var y=new Map,rt=0,F=!1;function nt(e){let t=e.split("+").map((i)=>i.trim()),n={key:"",meta:!1,ctrl:!1,shift:!1,alt:!1};for(let i of t){let o=i.toLowerCase();switch(o){case"cmd":case"command":case"meta":case"⌘":n.meta=!0;break;case"ctrl":case"control":case"⌃":n.ctrl=!0;break;case"shift":case"⇧":n.shift=!0;break;case"alt":case"option":case"opt":case"⌥":n.alt=!0;break;case"cmdorctrl":case"commandorcontrol":if(typeof process<"u"&&process.platform==="darwin")n.meta=!0;else n.ctrl=!0;break;default:n.key=o}}return n}function nn(e){let t=[];if(e.ctrl)t.push("⌃");if(e.alt)t.push("⌥");if(e.shift)t.push("⇧");if(e.meta)t.push("⌘");return t.push(e.key.toUpperCase()),t.join("")}function it(e,t){if(t.meta!==e.metaKey)return!1;if(t.ctrl!==e.ctrlKey)return!1;if(t.shift!==e.shiftKey)return!1;if(t.alt!==e.altKey)return!1;return e.key.toLowerCase()===t.key||e.code.toLowerCase()===`key${t.key}`}function we(e){for(let[,t]of y)if(it(e,t.parsed)){e.preventDefault(),e.stopPropagation();try{t.handler()}catch{}break}}function ot(){if(F)return;if(typeof document>"u")return;document.addEventListener("keydown",we,!0),F=!0}function V(){if(!F)return;if(typeof document>"u")return;document.removeEventListener("keydown",we,!0),F=!1}async function at(e,t){if(typeof window>"u")return!1;let n=window.craft;if(!n?.hotkeys?.register)return!1;try{return await n.hotkeys.register(e,t),!0}catch{return!1}}async function Y(e){if(typeof window>"u")return;let t=window.craft;if(!t?.hotkeys?.unregister)return;try{await t.hotkeys.unregister(e)}catch{}}function on(e,t){let n=`hotkey_${++rt}_${Date.now()}`,i=nt(e);y.set(n,{shortcut:e,handler:t,parsed:i}),at(n,e),ot();let o={shortcut:e,id:n,unregister(){st(o)}};return o}function st(e){if(y.delete(e.id),Y(e.id),y.size===0)V()}function an(){for(let[e]of y)Y(e);y.clear(),V()}function sn(){return Array.from(y.entries()).map(([e,t])=>({shortcut:t.shortcut,id:e,unregister(){if(y.delete(e),Y(e),y.size===0)V()}}))}var ln={async isAvailable(){if(!r("iap"))return!1;return await window.craft.iap.isAvailable()},async getProducts(e){if(!r("iap"))return[];let t=Array.isArray(e)?e:[String(e)];return await window.craft.iap.getProducts(t)},async purchase(e){if(!r("iap"))return{queued:!1,productId:e,reason:"IAP bridge not available"};let t=await window.craft.iap.purchase(e);return{queued:!!(t&&t.queued),productId:t?.productId,reason:t?.reason}},async restorePurchases(){if(!r("iap"))return{ok:!1};let e=await window.craft.iap.restorePurchases();return{ok:!!(e&&e.ok)}},async finishTransaction(e){if(!r("iap"))return;await window.craft.iap.finishTransaction(e)},async getReceiptData(){if(!r("iap"))return null;let e=await window.craft.iap.getReceiptData();return e?String(e):null},onPurchased(e){return a("craft:iap:purchased",e)},onFailed(e){return a("craft:iap:failed",e)},onRestored(e){return a("craft:iap:restored",e)},onProductsLoaded(e){return a("craft:iap:productsLoaded",(t)=>e(t.products||[]))},onRefunded(e){return a("craft:iap:refunded",e)},onSubscriptionStatusChanged(e){return a("craft:iap:subscriptionStatusChanged",e)},async getActiveSubscriptions(){if(!r("iap"))return[];let e=window.craft.iap.getActiveSubscriptions;if(typeof e!=="function")return[];let t=await e();return Array.isArray(t)?t:[]},async isEligibleForIntroOffer(e){if(!r("iap"))return!1;let t=window.craft.iap.isEligibleForIntroOffer;if(typeof t!=="function")return!1;return!!await t(e)}};var mn={async set(e,t,n){if(!e)throw Error("keychain.set: service is required");if(!t)throw Error("keychain.set: account is required");await u("keychain").set(e,t,n)},async get(e,t){if(!e)throw Error("keychain.get: service is required");if(!t)throw Error("keychain.get: account is required");let n=await u("keychain").get(e,t);return typeof n==="string"?n:null},async delete(e,t){if(!e)throw Error("keychain.delete: service is required");if(!t)throw Error("keychain.delete: account is required");await u("keychain").delete(e,t)},async has(e,t){if(!e)throw Error("keychain.has: service is required");if(!t)throw Error("keychain.has: account is required");return await u("keychain").has(e,t)}};var hn={async start(e,t){return O.startActivity(e,{title:t?.title,webpageURL:t?.webpageURL,userInfo:t?.state})},async update(e){return O.updateActivity({title:e.title,webpageURL:e.webpageURL,userInfo:e.state})},async stop(){await O.stopActivity()}};var bn={async start(e=0,t="127.0.0.1"){if(!r("localServer"))return{port:0,started:!1,reason:"bridge unavailable"};return await window.craft.localServer.start(e,t)},async stop(){if(!r("localServer"))return;await window.craft.localServer.stop()},async respond(e){if(!r("localServer"))return;await window.craft.localServer.respond(e||{status:200,body:"OK"})},onRequest(e){return a("craft:localServer:request",e)},async awaitOAuthCallback(e={}){u("localServer");let{port:t=0,host:n="127.0.0.1",timeoutMs:i=300000,successHTML:o}=e,s=await this.start(t,n);if(!s.started)throw Error(`localServer: start failed${s.reason?` — ${s.reason}`:""}`);return new Promise((c,d)=>{let l=setTimeout(()=>{f(),this.stop().catch(()=>{}),d(Error("localServer: OAuth callback timed out"))},i),f=this.onRequest(({url:h})=>{clearTimeout(l),f();let v=o??`<!doctype html><meta charset="utf-8"><title>Done</title>
|
|
200
200
|
<style>body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7}</style>
|
|
201
201
|
<div><h1>You can close this tab.</h1><p>Returning to the app…</p></div>
|
|
202
|
-
<script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:v,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),c({url:h,port:s.port})})})}};var
|
|
202
|
+
<script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:v,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),c({url:h,port:s.port})})})}};var Sn={async requestPermission(e="whenInUse"){if(r("location"))return await window.craft.location.requestPermission(e);if(typeof navigator<"u"&&navigator.geolocation)return"undetermined";return"not-supported"},async getAuthorization(){if(r("location"))return await window.craft.location.getAuthorization();return"unknown"},async getCurrentLocation(){if(r("location"))return await window.craft.location.getCurrentLocation();if(typeof navigator<"u"&&navigator.geolocation)return navigator.geolocation.getCurrentPosition((e)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:e.coords.latitude,longitude:e.coords.longitude,altitude:e.coords.altitude,horizontalAccuracy:e.coords.accuracy,verticalAccuracy:e.coords.altitudeAccuracy,speed:e.coords.speed}}))},(e)=>{window.dispatchEvent(new CustomEvent("craft:location:error",{detail:{message:e.message||String(e)}}))}),{requested:!0};return{requested:!1}},async startWatching(e){if(r("location"))return await window.craft.location.startWatching(e);if(typeof navigator<"u"&&navigator.geolocation){let t=navigator.geolocation.watchPosition((n)=>{window.dispatchEvent(new CustomEvent("craft:location:update",{detail:{latitude:n.coords.latitude,longitude:n.coords.longitude,altitude:n.coords.altitude,horizontalAccuracy:n.coords.accuracy,verticalAccuracy:n.coords.altitudeAccuracy,speed:n.coords.speed}}))});return window.__craftWebLocationWatchId=t,!0}return!1},async stopWatching(){if(r("location")){await window.craft.location.stopWatching();return}if(typeof navigator<"u"&&navigator.geolocation){let e=window.__craftWebLocationWatchId;if(e!=null)navigator.geolocation.clearWatch(e),window.__craftWebLocationWatchId=null}},onUpdate(e){return a("craft:location:update",e)},onError(e){return a("craft:location:error",e)},onAuthChanged(e){return a("craft:location:authChanged",e)}};var kn={async debug(e){if(r("log"))await window.craft.log.debug(e);else console.debug(e)},async info(e){if(r("log"))await window.craft.log.info(e);else console.info(e)},async warn(e){if(r("log"))await window.craft.log.warn(e);else console.warn(e)},async error(e){if(r("log"))await window.craft.log.error(e);else console.error(e)}};var Mn={app(e,t={}){return{label:e,items:[{label:`About ${e}`,role:"about"},{separator:!0},...t.settings?[{id:"stx.menu.settings",label:"Settings…",shortcut:"cmd+,",onClick:t.settings},{separator:!0}]:[],{label:`Hide ${e}`,role:"hide",shortcut:"cmd+h"},{label:"Hide Others",role:"hideOthers",shortcut:"cmd+alt+h"},{label:"Show All",role:"showAll"},{separator:!0},{label:`Quit ${e}`,role:"quit",shortcut:"cmd+q"}]}},edit(){return{label:"Edit",items:[{label:"Undo",role:"undo",shortcut:"cmd+z"},{label:"Redo",role:"redo",shortcut:"cmd+shift+z"},{separator:!0},{label:"Cut",role:"cut",shortcut:"cmd+x"},{label:"Copy",role:"copy",shortcut:"cmd+c"},{label:"Paste",role:"paste",shortcut:"cmd+v"},{label:"Select All",role:"selectAll",shortcut:"cmd+a"}]}},window(){return{label:"Window",items:[{label:"Minimize",role:"minimize",shortcut:"cmd+m"},{label:"Zoom",role:"zoom"},{separator:!0},{label:"Close Window",role:"close",shortcut:"cmd+w"}]}},leading(e,t={}){return[this.app(e,t),this.edit()]}},ct=0;function dt(e){let t=new Map;return{payload:{menus:e.menus.map((i)=>({label:i.label,items:i.items.map((o)=>{let{onClick:s,...c}=o;if(c.separator)return c;let d=c.id??`stx.menu.${ct++}`;if(s)t.set(d,s);return{...c,id:d}})}))},handlers:t}}var G=null,Bn={async set(e){if(!r("menu"))return!1;let{payload:t,handlers:n}=dt(e);if(G?.(),G=null,n.size>0)G=a("craft:menu:action",(i)=>{n.get(i.id)?.()});return await window.craft.menu.set(t),!0},async setDock(e){if(r("menu"))await window.craft.menu.setDock(e)},async addItem(e,t){if(r("menu"))await window.craft.menu.addItem(e,t)},async removeItem(e){if(r("menu"))await window.craft.menu.removeItem(e)},async enableItem(e){if(r("menu"))await window.craft.menu.enableItem(e)},async disableItem(e){if(r("menu"))await window.craft.menu.disableItem(e)},async checkItem(e){if(r("menu"))await window.craft.menu.checkItem(e)},async uncheckItem(e){if(r("menu"))await window.craft.menu.uncheckItem(e)},async setItemLabel(e,t){if(r("menu"))await window.craft.menu.setItemLabel(e,t)},async clearDock(){if(r("menu"))await window.craft.menu.clearDock()},onAction(e){return a("craft:menu:action",e)}};var Rn={async listSources(){if(!r("midi"))return[];return await window.craft.midi.listSources()},async listDestinations(){if(!r("midi"))return[];return await window.craft.midi.listDestinations()},async send(e,t){if(!r("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.send(e,t)},async subscribe(e){if(!r("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.subscribe(e)},async unsubscribe(e){if(!r("midi"))return{ok:!1};return await window.craft.midi.unsubscribe(e)},onMessage(e){return a("craft:midi:message",e)}};function ut(){return!1}function X(){return typeof window<"u"&&typeof document<"u"}var S=[];function lt(){return`modal-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function ft(e){switch(e){case"info":return"ℹ";case"warning":return"⚠";case"error":return"✖";case"success":return"✔";case"question":return"❓";default:return"ℹ"}}function _(e){if(e==="question")return[{label:"No",style:"default"},{label:"Yes",style:"primary"}];return[{label:"OK",style:"primary"}]}function pt(e){let{options:t}=e,n=ft(t.type),i=t.buttons||_(t.type),o=t.type||"info",s="";return i.forEach((c,d)=>{let l=c.style==="destructive"?"destructive":c.style==="primary"?"primary":"default",f=d===(t.defaultButton??i.length-1)?"autofocus":"";s+=`<button class="stx-modal-btn ${l}" data-index="${d}" ${f}>${c.label}</button>`}),`
|
|
203
203
|
<div class="stx-modal-overlay" data-modal-id="${e.id}">
|
|
204
204
|
<div class="stx-modal ${o}" role="dialog" aria-modal="true" aria-labelledby="${e.id}-title">
|
|
205
205
|
<div class="stx-modal-icon">${n}</div>
|
|
@@ -210,7 +210,7 @@ window.stxDialog = {
|
|
|
210
210
|
<div class="stx-modal-buttons">${s}</div>
|
|
211
211
|
</div>
|
|
212
212
|
</div>
|
|
213
|
-
`}function he(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function g(e,t,n=!1){let i=S.indexOf(e);if(i>-1)S.splice(i,1);if(e.element&&X())e.element.remove();let s=(e.options.buttons||_(e.options.type))[t];if(s?.action)s.action();e.resolve({buttonIndex:t,cancelled:n})}async function k(e){let t=ut(),n=lt();return new Promise((i)=>{let o={id:n,options:e,resolve:i};if(S.push(o),t)console.log(`[stx-modal] Showing native modal: ${e.title||"Modal"}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0);else if(X())try{let s=document.createElement("div");s.innerHTML=pt(o);let c=s.firstElementChild;if(!c){console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0);return}o.element=c;try{document.body.appendChild(c)}catch{console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0);return}try{c.querySelectorAll(".stx-modal-btn").forEach((d)=>{d.addEventListener("click",()=>{let l=Number.parseInt(d.dataset.index||"0",10);g(o,l,!1)})})}catch{}try{c.addEventListener("click",(d)=>{if(d.target===c){let l=e.cancelButton??0;g(o,l,!0)}})}catch{}try{let d=(l)=>{if(l.key==="Escape"){let f=e.cancelButton??0;g(o,f,!0),document.removeEventListener("keydown",d)}else if(l.key==="Enter"){let f=e.defaultButton??(e.buttons||_(e.type)).length-1;g(o,f,!1),document.removeEventListener("keydown",d)}};document.addEventListener("keydown",d)}catch{}try{let d=c.querySelector(".stx-modal-btn[autofocus]");if(d)d.focus()}catch{}if(typeof process<"u"&&process.env.BUN_TEST)setTimeout(()=>{g(o,e.defaultButton??0,!1)},0)}catch{console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0)}else{console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`);let s=e.buttons||_(e.type);console.log(`[stx-modal] Buttons: ${s.map((c)=>c.label).join(", ")}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0)}})}async function mt(e,t){return k({title:e,message:t,type:"info"})}async function
|
|
213
|
+
`}function he(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function g(e,t,n=!1){let i=S.indexOf(e);if(i>-1)S.splice(i,1);if(e.element&&X())e.element.remove();let s=(e.options.buttons||_(e.options.type))[t];if(s?.action)s.action();e.resolve({buttonIndex:t,cancelled:n})}async function k(e){let t=ut(),n=lt();return new Promise((i)=>{let o={id:n,options:e,resolve:i};if(S.push(o),t)console.log(`[stx-modal] Showing native modal: ${e.title||"Modal"}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0);else if(X())try{let s=document.createElement("div");s.innerHTML=pt(o);let c=s.firstElementChild;if(!c){console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0);return}o.element=c;try{document.body.appendChild(c)}catch{console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0);return}try{c.querySelectorAll(".stx-modal-btn").forEach((d)=>{d.addEventListener("click",()=>{let l=Number.parseInt(d.dataset.index||"0",10);g(o,l,!1)})})}catch{}try{c.addEventListener("click",(d)=>{if(d.target===c){let l=e.cancelButton??0;g(o,l,!0)}})}catch{}try{let d=(l)=>{if(l.key==="Escape"){let f=e.cancelButton??0;g(o,f,!0),document.removeEventListener("keydown",d)}else if(l.key==="Enter"){let f=e.defaultButton??(e.buttons||_(e.type)).length-1;g(o,f,!1),document.removeEventListener("keydown",d)}};document.addEventListener("keydown",d)}catch{}try{let d=c.querySelector(".stx-modal-btn[autofocus]");if(d)d.focus()}catch{}if(typeof process<"u"&&process.env.BUN_TEST)setTimeout(()=>{g(o,e.defaultButton??0,!1)},0)}catch{console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0)}else{console.log(`[stx-modal] ${e.type?.toUpperCase()||"INFO"}: ${e.title||"Modal"}`),console.log(`[stx-modal] ${e.message}`);let s=e.buttons||_(e.type);console.log(`[stx-modal] Buttons: ${s.map((c)=>c.label).join(", ")}`),setTimeout(()=>{g(o,e.defaultButton??0,!1)},0)}})}async function mt(e,t){return k({title:e,message:t,type:"info"})}async function On(e,t){return k({title:e,message:t,type:"warning"})}async function Fn(e,t){return k({title:e,message:t,type:"error"})}async function _n(e,t){return k({title:e,message:t,type:"success"})}async function gt(e,t){return k({title:e,message:t,type:"question",buttons:[{label:"No",style:"default"},{label:"Yes",style:"primary"}],defaultButton:1,cancelButton:0})}async function Nn(e,t="Confirm"){return(await gt(t,e)).buttonIndex===1}async function qn(e,t="Alert"){await mt(t,e)}async function Hn(e,t="",n="Input"){if(X()&&typeof window.prompt==="function")return window.prompt(e,t);return console.log(`[stx-modal] PROMPT: ${n}`),console.log(`[stx-modal] ${e}`),console.log(`[stx-modal] Default: ${t}`),t}function Wn(){return S.length}function Un(){while(S.length>0){let e=S[S.length-1];g(e,0,!0)}}var $n=`
|
|
214
214
|
.stx-modal-overlay {
|
|
215
215
|
position: fixed;
|
|
216
216
|
inset: 0;
|
|
@@ -342,4 +342,4 @@ window.stxDialog = {
|
|
|
342
342
|
background: #555;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
`;var Kn={async enable(){if(!r("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!r("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!r("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};function J(){if(!r("window"))return null;return window.craft.window}function w(e){let t=J();if(!t)return Promise.resolve();try{return Promise.resolve(e(t)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var Yn={get available(){return J()!==null},open(e){let t=()=>{if(typeof window<"u"&&e.url)window.open(e.url,e.name);return{name:e.name}},n=J();if(!n?.open)return Promise.resolve(t());return n.open(e).then((i)=>({name:i?.name||e.name})).catch(t)},close:()=>w((e)=>e.close?.()),show:()=>w((e)=>e.show?.()),hide:()=>w((e)=>e.hide?.()),focus:()=>w((e)=>e.focus?.()),minimize:()=>w((e)=>e.minimize?.()),maximize:()=>w((e)=>e.maximize?.()),center:()=>w((e)=>e.center?.()),startDrag:()=>w((e)=>e.startDrag?.()),setTitle:(e)=>w((t)=>t.setTitle?.(e)),setSize:(e,t)=>w((n)=>n.setSize?.(e,t)),setAppearance:(e)=>w((t)=>t.setAppearance?.(e))};async function N(e){if(!r("tray"))return;let t=window.craft.tray;await e(t)}var Jn={setIcon:(e)=>N((t)=>t.setIcon(e)),setTitle:(e)=>N((t)=>t.setTitle(e)),setTooltip:(e)=>N((t)=>t.setTooltip(e)),setMenu:(e)=>N((t)=>t.setMenu(e)),onClick:(e)=>a("craft:tray:click",e),onMenuAction:(e)=>a("craft:tray:menuAction",e)};var ei={async connectionType(){if(r("network"))return await window.craft.network.connectionType();return ye()},async wifiSSID(){if(r("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(r("network")){let e=await window.craft.network.wifiSignalStrength();return typeof e==="number"?e:void 0}return},async ipAddress(){if(r("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(r("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(r("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(r("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(r("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(r("network"))await window.craft.network.openPreferences()},onChange(e){if(r("network"))return a("craft:networkChange",e);if(typeof window>"u")return()=>{};let t=()=>e({type:ye(),online:!0}),n=()=>e({type:"none",online:!1});return window.addEventListener("online",t),window.addEventListener("offline",n),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}};function ye(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let e=navigator.connection;if(!e)return"unknown";let t=String(e.type||e.effectiveType||"unknown").toLowerCase();if(t==="wifi"||t==="cellular"||t==="ethernet"||t==="bluetooth"||t==="none")return t;return"unknown"}var ni={async show(e){if(!e.title)throw Error("notification title is required");if(r("notifications")){await window.craft.notifications.show(e);return}if(typeof window<"u"&&"Notification"in window){let t=window.Notification;if(t.permission==="granted")new t(e.title,{body:e.body,icon:e.icon});else if(t.permission==="default"){if(await t.requestPermission()==="granted")new t(e.title,{body:e.body,icon:e.icon})}}},async schedule(e){if(r("notifications")){let i={...e};if(i.triggerAt instanceof Date)i.triggerAt=i.triggerAt.toISOString();await window.craft.notifications.schedule(i);return}let t=wt(e.triggerAt),n=Math.max(0,t-Date.now());setTimeout(()=>{this.show(e).catch(()=>{})},n)},async cancel(e){if(r("notifications"))await window.craft.notifications.cancel(e)},async cancelAll(){if(r("notifications"))await window.craft.notifications.cancelAll()},async setBadge(e){let t=Math.max(0,Math.round(Number.isFinite(e)?e:0));if(r("notifications")){await window.craft.notifications.setBadge(t);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(t)}catch{}},async clearBadge(){if(r("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(r("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let e=window.Notification;if(e.permission==="granted")return!0;if(e.permission==="denied")return!1;return await e.requestPermission()==="granted"}return!1},async registerCategories(e){if(!Array.isArray(e)||e.length===0)return;if(r("notifications")){let t=window.craft.notifications.registerCategories;if(typeof t==="function")await t(e)}},onActionClicked(e){return a("craft:notification:actionClicked",e)},onReply(e){return a("craft:notification:reply",e)}};function wt(e){if(e==null)return Date.now();if(e instanceof Date)return e.getTime();if(typeof e==="number")return e;let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}var ai={async countPages(e){if(!e)throw Error("pdf.countPages: path is required");if(!r("pdf"))return 0;return await window.craft.pdf.countPages(e)},async extractText(e){if(!e)throw Error("pdf.extractText: path is required");if(!r("pdf"))return"";return await window.craft.pdf.extractText(e)}};var di={async check(e){if(r("permissions"))return await window.craft.permissions.check(e);return await ve(e)},async request(e){if(r("permissions"))return await window.craft.permissions.request(e);return await ht(e)},async openSettings(e){if(r("permissions"))await window.craft.permissions.openSettings(e)}};async function ve(e){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let t=await navigator.permissions.query({name:e});return yt(t.state)}catch{return"not-supported"}}async function ht(e){if(e==="notifications"&&typeof window<"u"&&"Notification"in window){let t=await window.Notification.requestPermission();return t==="granted"?"granted":t==="denied"?"denied":"undetermined"}return await ve(e)}function yt(e){if(e==="granted")return"granted";if(e==="denied")return"denied";if(e==="prompt")return"undetermined";return"undetermined"}var fi={async print(){if(r("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(e){if(!e)throw Error("printToPDF: path is required");let t=e.startsWith("/"),n=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\");if(!t&&!n)throw Error("printToPDF: path must be absolute");let i=await u("printing").printToPDF(e);return{ok:!!(i&&i.ok),path:i?.path}}};var gi={async getDisplays(){if(r("screen"))return await window.craft.screen.getDisplays();return be()},async getPrimary(){if(r("screen")){let e=await window.craft.screen.getPrimary();return e&&typeof e.width==="number"?e:null}return be()[0]??null},onChange(e){if(r("screen"))return a("craft:screen:change",()=>e());if(typeof window>"u")return()=>{};let t=()=>e();return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}};function be(){if(typeof window>"u"||!window.screen)return[];let e=window.screen;return[{id:0,x:e.left??0,y:e.top??0,width:e.width||0,height:e.height||0,workX:e.availLeft??0,workY:e.availTop??0,workWidth:e.availWidth??e.width??0,workHeight:e.availHeight??e.height??0,scaleFactor:window.devicePixelRatio||1}]}var yi={async captureScreen(){if(!r("screenCapture"))return null;let e=await window.craft.screenCapture.captureScreen();return e?String(e):null},async captureWindow(e){if(!r("screenCapture"))return null;if(!Number.isFinite(e)||e<=0)throw Error("captureWindow: id must be a positive number");let t=await window.craft.screenCapture.captureWindow(e);return t?String(t):null},async listWindows(){if(!r("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}};var vt=250,bt=60000,Z=2000,xe={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function xt(){return{...xe,signals:{...xe.signals},sources:[]}}var Q={async getState(){if(!r("screenSharing"))return xt();return await window.craft.screenSharing.getState()},async watch(e=Z){let t=Number.isFinite(e)?Math.min(bt,Math.max(vt,Math.round(e))):Z;if(!r("screenSharing"))return t;let n=await window.craft.screenSharing.watch(t);return n&&n.intervalMs||t},async stop(){if(!r("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(e){return a("craft:screenSharing:change",e)}};async function xi(e,t=Z){let n=Q.onChange(e);try{await Q.watch(t)}catch(o){throw n(),o}let i;return()=>{if(!i)n(),i=Q.stop();return i}}var Ai={async list(){if(!r("serial"))return[];return await window.craft.serial.list()},async open(e,t=9600){if(!e)throw Error("serial.open: path is required");if(!r("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.open(e,t)},async write(e,t){if(!e)throw Error("serial.write: id is required");if(!r("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.write(e,t)},async close(e){if(!r("serial"))return;await window.craft.serial.close(e)},onData(e){return a("craft:serial:data",e)}};var Ei={async register(e){if(!e)throw Error("serviceMenu.register: name is required");if(!r("serviceMenu"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serviceMenu.register(e)},async unregister(e){if(!e)throw Error("serviceMenu.unregister: name is required");if(!r("serviceMenu"))return;await window.craft.serviceMenu.unregister(e)},onInvoked(e){return a("craft:serviceMenu:invoked",e)}};var E=new Set,Pe=!1;function Pt(){if(Pe)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(e)=>{let t=e.detail;if(t?.id)E.delete(t.id)}),Pe=!0}var St=new Set(["javascript:","data:","file:","vbscript:"]),Bi={async openExternal(e){let t=e.trim().toLowerCase();for(let n of St)if(t.startsWith(n))throw Error(`shell.openExternal: ${n} URLs are blocked for safety`);if(r("shell")){await window.craft.shell.openExternal(e);return}if(typeof window<"u"&&typeof window.open==="function")window.open(e,"_blank","noopener,noreferrer")},async openPath(e){await u("shell").openPath(e)},async showInFinder(e){await u("shell").showInFinder(e)},async spawn(e,t,n=[],i={}){if(Pt(),!e||typeof e!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!t||typeof t!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray(n))throw Error("shell.spawn: args must be an array");for(let o of n)if(typeof o!=="string")throw Error("shell.spawn: args entries must be strings");if(E.has(e))throw Error(`shell.spawn: id "${e}" is already in use — call kill(id) first or pick a different id`);E.add(e);try{await u("shell").spawn(e,t,n,i)}catch(o){throw E.delete(e),o}},async kill(e){await u("shell").kill(e),E.delete(e)},async getEnv(e){if(r("shell")){let t=await window.craft.shell.getEnv(e);return t==null?void 0:String(t)}return},async setEnv(e,t){await u("shell").setEnv(e,t)},onStdout(e){return a("craft:shell:stdout",e)},onStderr(e){return a("craft:shell:stderr",e)},onExit(e){return a("craft:shell:exit",e)}};function ee(e){if(e===null||e===void 0||e===0)return"";return String(e)}function Se(e){return e.map((t)=>({id:t.id,header:t.header,items:t.items.map((n)=>({id:n.id,label:n.label,icon:n.icon,badge:ee(n.badge)||void 0}))}))}function Ae(e){return JSON.stringify(e.map((t)=>[t.id,t.header??"",t.items.map((n)=>[n.id,n.label,n.icon??""])]))}function Ie(e){return new Map(e.flatMap((t)=>t.items.map((n)=>[n.id,ee(n.badge)])))}var At={available(){return r("nativeUI")&&typeof window.craft?.nativeUI?._emitSidebarSelect==="function"},create(e){if(!At.available())return null;let t=window.craft?.nativeUI;if(!t)return null;let n=t.createSidebar({id:e.id,sections:Se(e.sections),selected:e.selected}),i=e.sections,o=new Set;return n.onSelect((s)=>{for(let c of[...o])c(s)}),{id:n.id,update(s){if(Ae(s)===Ae(i)){let c=Ie(i);for(let[d,l]of Ie(s))if(c.get(d)!==l)n.updateItem(d,{badge:l})}else n.setSections(Se(s));i=s},updateItem(s,c){n.updateItem(s,{...c.label!==void 0?{label:c.label}:{},...c.icon!==void 0?{icon:c.icon}:{},..."badge"in c?{badge:ee(c.badge)}:{}}),i=i.map((d)=>({...d,items:d.items.map((l)=>l.id===s?{...l,...c}:l)}))},select(s){n.setSelectedItem(s)},onSelect(s){return o.add(s),()=>o.delete(s)},destroy(){o.clear(),n.destroy()}}}};var Oi={async speak(e,t){if(!e)throw Error("speech.speak: text is required");if(r("speech")){await window.craft.speech.speak(e,t);return}if(typeof window<"u"&&window.speechSynthesis){let n=new window.SpeechSynthesisUtterance(e);if(t){if(t.rate!=null)n.rate=t.rate;if(t.pitch!=null)n.pitch=t.pitch;if(t.volume!=null)n.volume=t.volume;if(t.voice){let o=window.speechSynthesis.getVoices().find((s)=>s.voiceURI===t.voice||s.name===t.voice||s.lang===t.voice);if(o)n.voice=o}}window.speechSynthesis.speak(n)}},async stop(){if(r("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(r("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(r("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(r("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(r("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((t)=>({id:t.voiceURI||t.name,name:t.name,language:t.lang||"",quality:"default"}));return[]}};var Ni={async isAvailable(){if(!r("speechRecognition"))return!1;return await window.craft.speechRecognition.isAvailable()},async start(e){if(!r("speechRecognition"))return{started:!1,reason:"bridge unavailable"};return await window.craft.speechRecognition.start(e)},async stop(){if(r("speechRecognition"))await window.craft.speechRecognition.stop()},onPartial(e){return a("craft:speechRecognition:partial",e)},onFinal(e){return a("craft:speechRecognition:final",e)}};var Ui={async index(e){if(!r("spotlight"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.spotlight.index(e)},async remove(e){if(!r("spotlight"))return{ok:!1};return await window.craft.spotlight.remove(e)},async removeAll(){if(!r("spotlight"))return{ok:!1};return await window.craft.spotlight.removeAll()}};var zi={async get(e){if(!e)throw Error("tags.get: path is required");if(!r("tags"))return[];return await window.craft.tags.get(e)},async set(e,t){if(!e)throw Error("tags.set: path is required");if(!r("tags"))return!1;let n=Array.isArray(t)?t:[String(t)];return await window.craft.tags.set(e,n)},async clear(e){if(!e)throw Error("tags.clear: path is required");if(!r("tags"))return!1;return await window.craft.tags.clear(e)}};var Vi={get(){if(r("theme"))try{return window.craft.theme.get()}catch{}return{appearance:It()}},onChange(e){if(e(this.get()),r("theme"))return a("craft:theme",e);if(typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>e({appearance:t.matches?"dark":"light"});return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}return()=>{}},async current(){return this.get()}};function It(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}class ke{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(e){if(this._duration=e.duration,this._tickInterval=e.tickInterval||1000,this._remaining=e.duration,e.onComplete)this._completionHandlers.add(e.onComplete);if(e.onTick)this._tickHandlers.add(e.onTick);if(e.autoStart)this.start()}get isRunning(){return this._running&&!this._paused}get isPaused(){return this._paused}get isComplete(){return this._complete}get remaining(){if(this._running&&!this._paused){let e=Date.now()-this._lastTick;return Math.max(0,this._remaining-e)}return Math.max(0,this._remaining)}get elapsed(){return this._duration-this.remaining}get duration(){return this._duration}get progress(){if(this._duration===0)return 1;return Math.min(1,this.elapsed/this._duration)}start(){if(this._running)return;this._running=!0,this._paused=!1,this._complete=!1,this._lastTick=Date.now(),this._startInterval()}stop(){this._clearInterval(),this._running=!1,this._paused=!1,this._remaining=this._duration}pause(){if(!this._running||this._paused)return;let e=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-e),this._clearInterval(),this._paused=!0}resume(){if(!this._paused)return;this._paused=!1,this._lastTick=Date.now(),this._startInterval()}reset(){this._clearInterval(),this._running=!1,this._paused=!1,this._complete=!1,this._remaining=this._duration}onComplete(e){return this._completionHandlers.add(e),()=>{this._completionHandlers.delete(e)}}onTick(e){return this._tickHandlers.add(e),()=>{this._tickHandlers.delete(e)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let e=Date.now(),t=e-this._lastTick;this._lastTick=e,this._remaining=Math.max(0,this._remaining-t);for(let n of this._tickHandlers)try{n(this._remaining)}catch{}if(this._remaining<=0){this._clearInterval(),this._running=!1,this._complete=!0;for(let n of this._completionHandlers)try{n()}catch{}}},this._tickInterval)}_clearInterval(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null}}class Ee{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(e){if(this._interval=e.interval,this._handler=e.handler,this._immediate=e.immediate!==!1,this._immediate)this.start()}get isRunning(){return this._running}start(){if(this._running)return;this._running=!0,this._intervalId=setInterval(()=>{try{this._handler()}catch{}},this._interval)}stop(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null;this._running=!1}}function Gi(e){return new ke(e)}function Xi(e){return new Ee(e)}function Ji(e){return new Promise((t)=>setTimeout(t,e))}function Qi(e){let t=Math.ceil(e/1000),n=Math.floor(t/3600),i=Math.floor(t%3600/60),o=t%60;if(n>0)return`${n}:${String(i).padStart(2,"0")}:${String(o).padStart(2,"0")}`;return`${i}:${String(o).padStart(2,"0")}`}function Zi(e){let t=Math.ceil(e/1000),n=Math.floor(t/3600),i=Math.floor(t%3600/60),o=t%60;if(n>0){if(i>0)return`${n}h ${i}m`;return`${n}h`}if(i>0){if(o>0)return`${i}m ${o}s`;return`${i}m`}return`${o}s`}var ro={async addItem(e){if(r("touchbar"))await window.craft.touchbar.addItem(e)},async removeItem(e){if(r("touchbar"))await window.craft.touchbar.removeItem(e)},async updateItem(e,t){if(r("touchbar"))await window.craft.touchbar.updateItem(e,t)},async setLabel(e,t){if(r("touchbar"))await window.craft.touchbar.setLabel(e,t)},async setIcon(e,t){if(r("touchbar"))await window.craft.touchbar.setIcon(e,t)},async setEnabled(e,t){if(r("touchbar"))await window.craft.touchbar.setEnabled(e,t)},async setSliderValue(e,t){if(r("touchbar"))await window.craft.touchbar.setSliderValue(e,t)},async clear(){if(r("touchbar"))await window.craft.touchbar.clear()},async show(){if(r("touchbar"))await window.craft.touchbar.show()},async hide(){if(r("touchbar"))await window.craft.touchbar.hide()},onAction(e){return a("craft:touchbar:action",e)}};var oo={async checkForUpdates(){if(!r("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!r("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(e){if(!r("updater"))return;await window.craft.updater.setAutomaticChecks(e)},async setCheckInterval(e){if(!r("updater"))return;if(!Number.isFinite(e))throw Error("setCheckInterval: must be a finite number");let t=e<=0?0:Math.max(60,Math.round(e));await window.craft.updater.setCheckInterval(t)},async setFeedURL(e){if(!r("updater"))return;await window.craft.updater.setFeedURL(e)},async getLastUpdateCheckDate(){if(!r("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!r("updater"))return null;let e=await window.craft.updater.getUpdateInfo();if(!e||typeof e.version!=="string"||e.version.length===0)return null;return e},onAvailable(e){return a("craft:updateAvailable",e)},onDownloaded(e){return a("craft:updateDownloaded",e)},async verifySignature({payload:e,signatureB64:t,publicKeyB64:n}){let i=Ce(e),o;try{o=await crypto.subtle.importKey("raw",q(n),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",o,q(t),i)}catch{return!1}},async verifyDownload({url:e,signatureB64:t,publicKeyB64:n,fetchInit:i}){let o;try{o=await fetch(e,i)}catch{return{ok:!1,reason:"fetch-failed"}}if(!o.ok)return{ok:!1,reason:"http-error",status:o.status};let s=new Uint8Array(await o.arrayBuffer()),c;try{c=await crypto.subtle.importKey("raw",q(n),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let d=!1;try{d=await crypto.subtle.verify("Ed25519",c,q(t),Ce(s))}catch{d=!1}if(!d)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:s}}};function Ce(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new ArrayBuffer(e.byteLength),n=new Uint8Array(t);return n.set(e),n}function q(e){if(typeof atob==="function"){let i=atob(e),o=new ArrayBuffer(i.length),s=new Uint8Array(o);for(let c=0;c<i.length;c++)s[c]=i.charCodeAt(c);return s}let t=Buffer.from(e,"base64"),n=new ArrayBuffer(t.length);return new Uint8Array(n).set(t),new Uint8Array(n)}var co={async recognizeText(e){if(!e)throw Error("vision.recognizeText: path is required");if(!r("vision"))return[];return await window.craft.vision.recognizeText(e)},async detectFaces(e){if(!e)throw Error("vision.detectFaces: path is required");if(!r("vision"))return[];return await window.craft.vision.detectFaces(e)},async detectBarcodes(e){if(!e)throw Error("vision.detectBarcodes: path is required");if(!r("vision"))return[];return await window.craft.vision.detectBarcodes(e)}};var fo={onFocus(e){if(r("window"))return a("craft:window:focus",()=>e());return te("focus",e)},onBlur(e){if(r("window"))return a("craft:window:blur",()=>e());return te("blur",e)},onResize(e){if(r("window"))return a("craft:window:resize",e);if(typeof window>"u")return()=>{};let t=()=>e({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},onMove(e){if(r("window"))return a("craft:window:move",e);return()=>{}},onClose(e){if(r("window"))return a("craft:window:close",()=>e());return te("beforeunload",e)},onMinimize(e){if(r("window"))return a("craft:window:minimize",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="hidden")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},onRestore(e){if(r("window"))return a("craft:window:restore",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="visible")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)}};function te(e,t){if(typeof window>"u")return()=>{};let n=()=>t();return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function kt(e,t={}){if(!Number.isInteger(e)||e<0||e>86400000)return Promise.reject(RangeError("delayMs must be an integer between 0 and 86400000"));let{signal:n}=t,i=()=>new DOMException("Background delay aborted","AbortError");if(n?.aborted)return Promise.reject(i());if(r("timers"))return u("timers").sleep(e,t);if(typeof window<"u"&&window.craft)return Promise.reject(Error("Native background deadlines require a Craft runtime with timers.sleep support"));return new Promise((o,s)=>{let c=setTimeout(()=>{n?.removeEventListener("abort",d),o()},e);function d(){clearTimeout(c),n?.removeEventListener("abort",d),s(i())}n?.addEventListener("abort",d,{once:!0})})}export{Z as DEFAULT_WATCH_INTERVAL_MS,bt as MAX_WATCH_INTERVAL_MS,vt as MIN_WATCH_INTERVAL_MS,Wn as MODAL_STYLES,Ft as TOAST_STYLES,Nn as alert,Ht as app,zt as appleScript,Vt as audio,kt as backgroundDelay,Xt as battery,Zt as biometric,rr as bluetooth,or as bonjour,$t as classifyAppleScriptError,fr as clipboard,Un as closeAllModals,_n as confirm,gr as contextMenu,yr as continuityCamera,xr as coreml,R as crashReporter,Xi as createInterval,Gi as createTimer,kr as deepLinks,Ji as delay,Rt as dismissAlertById,Lt as dismissAllAlerts,Nr as dragOut,Wr as fileAssociations,ge as focus,jr as focusShortcutsReady,Zi as formatCompact,rn as formatShortcut,Qi as formatTime,Gr as fs,Ot as getActiveAlertCount,Hn as getActiveModalCount,cr as getCapabilities,qe as getCapability,Or as getDialogBridgeScript,an as getRegisteredHotkeys,Qr as globalShortcuts,O as handoff,Kr as hasFocusShortcuts,un as iap,dr as isAvailable,qr as isDragOutAvailable,pn as keychain,wn as liveActivities,vn as localServer,Pn as location,In as log,Mn as menu,Dn as midi,Kn as nativeAutoLaunch,Jn as nativeTray,Yn as nativeWindow,ei as network,ni as notifications,Dt as notify,nt as parseShortcut,ai as pdf,di as permissions,fi as printing,qn as prompt,Ke as redactPII,nn as registerHotkey,Et as requestNotificationPermission,gi as screen,yi as screenCapture,Q as screenSharing,Ai as serial,Ei as serviceMenu,Bi as shell,oe as showAlert,Tr as showAlertDialog,Br as showColorPicker,Dr as showConfirmDialog,Rr as showErrorDialog,On as showErrorModal,Tt as showErrorToast,mt as showInfoModal,Ct as showInfoToast,L as showMessageBox,k as showModal,Cr as showOpenDialog,gt as showQuestionModal,Mr as showSaveDialog,Fn as showSuccessModal,Mt as showSuccessToast,T as showToast,Lr as showWarningDialog,Ln as showWarningModal,Bt as showWarningToast,At as sidebar,je as signPayload,Oi as speech,Ni as speechRecognition,Ui as spotlight,Cn as standardMenus,zi as tags,Vi as theme,ro as touchbar,on as unregisterAllHotkeys,st as unregisterHotkey,oo as updater,co as vision,xi as watchScreenSharing,fo as windowEvents};
|
|
345
|
+
`;var jn={async enable(){if(!r("autoLaunch"))return!1;return await window.craft.autoLaunch.enable()},async disable(){if(!r("autoLaunch"))return!1;return await window.craft.autoLaunch.disable()},async isEnabled(){if(!r("autoLaunch"))return!1;return await window.craft.autoLaunch.isEnabled()}};function J(){if(!r("window"))return null;return window.craft.window}function w(e){let t=J();if(!t)return Promise.resolve();try{return Promise.resolve(e(t)).then(()=>{return},()=>{return})}catch{return Promise.resolve()}}var wt={get available(){return J()!==null},open(e){let t=()=>{if(typeof window<"u"&&e.url)window.open(e.url,e.name);return{name:e.name}},n=J();if(!n?.open)return Promise.resolve(t());return n.open(e).then((i)=>({name:i?.name||e.name})).catch(t)},close:()=>w((e)=>e.close?.()),show:()=>w((e)=>e.show?.()),hide:()=>w((e)=>e.hide?.()),focus:()=>w((e)=>e.focus?.()),minimize:()=>w((e)=>e.minimize?.()),maximize:()=>w((e)=>e.maximize?.()),center:()=>w((e)=>e.center?.()),startDrag:()=>w((e)=>e.startDrag?.()),setTitle:(e)=>w((t)=>t.setTitle?.(e)),setSize:(e,t)=>w((n)=>n.setSize?.(e,t)),setAppearance:(e)=>w((t)=>t.setAppearance?.(e))};function Gn(e={}){let t=typeof window<"u"?window.location.origin:"http://127.0.0.1",n=new URL(e.url??"/settings",t);if(e.pane)n.searchParams.set("pane",e.pane);let i=e.name??"settings";return wt.open({name:i,title:e.title??"Settings",url:n.toString(),width:e.width??715,height:e.height??640,minWidth:e.minWidth??660,minHeight:e.minHeight??460,titlebarHidden:!0,webWindowMaterial:!0,chromeControls:!1,persistentStorage:!0}).then((o)=>{if(e.pane&&typeof BroadcastChannel==="function")try{let s=new BroadcastChannel(`stx:settings-window:${e.storageKey||"settings"}`);s.postMessage({pane:e.pane}),s.close()}catch{}return o})}async function N(e){if(!r("tray"))return;let t=window.craft.tray;await e(t)}var Qn={setIcon:(e)=>N((t)=>t.setIcon(e)),setTitle:(e)=>N((t)=>t.setTitle(e)),setTooltip:(e)=>N((t)=>t.setTooltip(e)),setMenu:(e)=>N((t)=>t.setMenu(e)),onClick:(e)=>a("craft:tray:click",e),onMenuAction:(e)=>a("craft:tray:menuAction",e)};var ti={async connectionType(){if(r("network"))return await window.craft.network.connectionType();return ye()},async wifiSSID(){if(r("network"))return await window.craft.network.wifiSSID()||void 0;return},async wifiSignalStrength(){if(r("network")){let e=await window.craft.network.wifiSignalStrength();return typeof e==="number"?e:void 0}return},async ipAddress(){if(r("network"))return await window.craft.network.ipAddress();return""},async macAddress(){if(r("network"))return await window.craft.network.macAddress();return""},async interfaces(){if(r("network"))return await window.craft.network.interfaces();return[]},async isVPNConnected(){if(r("network"))return await window.craft.network.isVPNConnected();return!1},async proxySettings(){if(r("network"))return await window.craft.network.proxySettings()||{};return{}},async openPreferences(){if(r("network"))await window.craft.network.openPreferences()},onChange(e){if(r("network"))return a("craft:networkChange",e);if(typeof window>"u")return()=>{};let t=()=>e({type:ye(),online:!0}),n=()=>e({type:"none",online:!1});return window.addEventListener("online",t),window.addEventListener("offline",n),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}};function ye(){if(typeof navigator>"u")return"unknown";if(navigator.onLine===!1)return"none";let e=navigator.connection;if(!e)return"unknown";let t=String(e.type||e.effectiveType||"unknown").toLowerCase();if(t==="wifi"||t==="cellular"||t==="ethernet"||t==="bluetooth"||t==="none")return t;return"unknown"}var ii={async show(e){if(!e.title)throw Error("notification title is required");if(r("notifications")){await window.craft.notifications.show(e);return}if(typeof window<"u"&&"Notification"in window){let t=window.Notification;if(t.permission==="granted")new t(e.title,{body:e.body,icon:e.icon});else if(t.permission==="default"){if(await t.requestPermission()==="granted")new t(e.title,{body:e.body,icon:e.icon})}}},async schedule(e){if(r("notifications")){let i={...e};if(i.triggerAt instanceof Date)i.triggerAt=i.triggerAt.toISOString();await window.craft.notifications.schedule(i);return}let t=ht(e.triggerAt),n=Math.max(0,t-Date.now());setTimeout(()=>{this.show(e).catch(()=>{})},n)},async cancel(e){if(r("notifications"))await window.craft.notifications.cancel(e)},async cancelAll(){if(r("notifications"))await window.craft.notifications.cancelAll()},async setBadge(e){let t=Math.max(0,Math.round(Number.isFinite(e)?e:0));if(r("notifications")){await window.craft.notifications.setBadge(t);return}if(typeof navigator<"u"&&navigator.setAppBadge)try{await navigator.setAppBadge(t)}catch{}},async clearBadge(){if(r("notifications")){await window.craft.notifications.clearBadge();return}if(typeof navigator<"u"&&navigator.clearAppBadge)try{await navigator.clearAppBadge()}catch{}},async requestPermission(){if(r("notifications"))return await window.craft.notifications.requestPermission();if(typeof window<"u"&&"Notification"in window){let e=window.Notification;if(e.permission==="granted")return!0;if(e.permission==="denied")return!1;return await e.requestPermission()==="granted"}return!1},async registerCategories(e){if(!Array.isArray(e)||e.length===0)return;if(r("notifications")){let t=window.craft.notifications.registerCategories;if(typeof t==="function")await t(e)}},onActionClicked(e){return a("craft:notification:actionClicked",e)},onReply(e){return a("craft:notification:reply",e)}};function ht(e){if(e==null)return Date.now();if(e instanceof Date)return e.getTime();if(typeof e==="number")return e;let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}var si={async countPages(e){if(!e)throw Error("pdf.countPages: path is required");if(!r("pdf"))return 0;return await window.craft.pdf.countPages(e)},async extractText(e){if(!e)throw Error("pdf.extractText: path is required");if(!r("pdf"))return"";return await window.craft.pdf.extractText(e)}};var ui={async check(e){if(r("permissions"))return await window.craft.permissions.check(e);return await ve(e)},async request(e){if(r("permissions"))return await window.craft.permissions.request(e);return await yt(e)},async openSettings(e){if(r("permissions"))await window.craft.permissions.openSettings(e)}};async function ve(e){if(typeof navigator>"u"||!navigator.permissions?.query)return"not-supported";try{let t=await navigator.permissions.query({name:e});return vt(t.state)}catch{return"not-supported"}}async function yt(e){if(e==="notifications"&&typeof window<"u"&&"Notification"in window){let t=await window.Notification.requestPermission();return t==="granted"?"granted":t==="denied"?"denied":"undetermined"}return await ve(e)}function vt(e){if(e==="granted")return"granted";if(e==="denied")return"denied";if(e==="prompt")return"undetermined";return"undetermined"}var pi={async print(){if(r("printing")){await window.craft.printing.print();return}if(typeof window<"u"&&typeof window.print==="function")window.print()},async printToPDF(e){if(!e)throw Error("printToPDF: path is required");let t=e.startsWith("/"),n=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\");if(!t&&!n)throw Error("printToPDF: path must be absolute");let i=await u("printing").printToPDF(e);return{ok:!!(i&&i.ok),path:i?.path}}};var wi={async getDisplays(){if(r("screen"))return await window.craft.screen.getDisplays();return be()},async getPrimary(){if(r("screen")){let e=await window.craft.screen.getPrimary();return e&&typeof e.width==="number"?e:null}return be()[0]??null},onChange(e){if(r("screen"))return a("craft:screen:change",()=>e());if(typeof window>"u")return()=>{};let t=()=>e();return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}};function be(){if(typeof window>"u"||!window.screen)return[];let e=window.screen;return[{id:0,x:e.left??0,y:e.top??0,width:e.width||0,height:e.height||0,workX:e.availLeft??0,workY:e.availTop??0,workWidth:e.availWidth??e.width??0,workHeight:e.availHeight??e.height??0,scaleFactor:window.devicePixelRatio||1}]}var vi={async captureScreen(){if(!r("screenCapture"))return null;let e=await window.craft.screenCapture.captureScreen();return e?String(e):null},async captureWindow(e){if(!r("screenCapture"))return null;if(!Number.isFinite(e)||e<=0)throw Error("captureWindow: id must be a positive number");let t=await window.craft.screenCapture.captureWindow(e);return t?String(t):null},async listWindows(){if(!r("screenCapture"))return[];return await window.craft.screenCapture.listWindows()}};var bt=250,xt=60000,Z=2000,xe={sharing:!1,signals:{systemScreenShare:!1,remoteSession:!1,conferenceSharing:!1,screenRecording:!1},sources:[]};function Pt(){return{...xe,signals:{...xe.signals},sources:[]}}var Q={async getState(){if(!r("screenSharing"))return Pt();return await window.craft.screenSharing.getState()},async watch(e=Z){let t=Number.isFinite(e)?Math.min(xt,Math.max(bt,Math.round(e))):Z;if(!r("screenSharing"))return t;let n=await window.craft.screenSharing.watch(t);return n&&n.intervalMs||t},async stop(){if(!r("screenSharing"))return;await window.craft.screenSharing.unwatch()},onChange(e){return a("craft:screenSharing:change",e)}};async function Pi(e,t=Z){let n=Q.onChange(e);try{await Q.watch(t)}catch(o){throw n(),o}let i;return()=>{if(!i)n(),i=Q.stop();return i}}var Ii={async list(){if(!r("serial"))return[];return await window.craft.serial.list()},async open(e,t=9600){if(!e)throw Error("serial.open: path is required");if(!r("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.open(e,t)},async write(e,t){if(!e)throw Error("serial.write: id is required");if(!r("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.write(e,t)},async close(e){if(!r("serial"))return;await window.craft.serial.close(e)},onData(e){return a("craft:serial:data",e)}};var Ci={async register(e){if(!e)throw Error("serviceMenu.register: name is required");if(!r("serviceMenu"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serviceMenu.register(e)},async unregister(e){if(!e)throw Error("serviceMenu.unregister: name is required");if(!r("serviceMenu"))return;await window.craft.serviceMenu.unregister(e)},onInvoked(e){return a("craft:serviceMenu:invoked",e)}};var E=new Set,Pe=!1;function St(){if(Pe)return;if(typeof window>"u"||typeof window.addEventListener!=="function")return;window.addEventListener("craft:shell:exit",(e)=>{let t=e.detail;if(t?.id)E.delete(t.id)}),Pe=!0}var At=new Set(["javascript:","data:","file:","vbscript:"]),Ti={async openExternal(e){let t=e.trim().toLowerCase();for(let n of At)if(t.startsWith(n))throw Error(`shell.openExternal: ${n} URLs are blocked for safety`);if(r("shell")){await window.craft.shell.openExternal(e);return}if(typeof window<"u"&&typeof window.open==="function")window.open(e,"_blank","noopener,noreferrer")},async openPath(e){await u("shell").openPath(e)},async showInFinder(e){await u("shell").showInFinder(e)},async spawn(e,t,n=[],i={}){if(St(),!e||typeof e!=="string")throw Error("shell.spawn: id must be a non-empty string");if(!t||typeof t!=="string")throw Error("shell.spawn: command must be a non-empty string");if(!Array.isArray(n))throw Error("shell.spawn: args must be an array");for(let o of n)if(typeof o!=="string")throw Error("shell.spawn: args entries must be strings");if(E.has(e))throw Error(`shell.spawn: id "${e}" is already in use — call kill(id) first or pick a different id`);E.add(e);try{await u("shell").spawn(e,t,n,i)}catch(o){throw E.delete(e),o}},async kill(e){await u("shell").kill(e),E.delete(e)},async getEnv(e){if(r("shell")){let t=await window.craft.shell.getEnv(e);return t==null?void 0:String(t)}return},async setEnv(e,t){await u("shell").setEnv(e,t)},onStdout(e){return a("craft:shell:stdout",e)},onStderr(e){return a("craft:shell:stderr",e)},onExit(e){return a("craft:shell:exit",e)}};function ee(e){if(e===null||e===void 0||e===0)return"";return String(e)}function Se(e){return e.map((t)=>({id:t.id,header:t.header,items:t.items.map((n)=>({id:n.id,label:n.label,icon:n.icon,badge:ee(n.badge)||void 0}))}))}function Ae(e){return JSON.stringify(e.map((t)=>[t.id,t.header??"",t.items.map((n)=>[n.id,n.label,n.icon??""])]))}function Ie(e){return new Map(e.flatMap((t)=>t.items.map((n)=>[n.id,ee(n.badge)])))}var It={available(){return r("nativeUI")&&typeof window.craft?.nativeUI?._emitSidebarSelect==="function"},create(e){if(!It.available())return null;let t=window.craft?.nativeUI;if(!t)return null;let n=t.createSidebar({id:e.id,sections:Se(e.sections),selected:e.selected}),i=e.sections,o=new Set;return n.onSelect((s)=>{for(let c of[...o])c(s)}),{id:n.id,update(s){if(Ae(s)===Ae(i)){let c=Ie(i);for(let[d,l]of Ie(s))if(c.get(d)!==l)n.updateItem(d,{badge:l})}else n.setSections(Se(s));i=s},updateItem(s,c){n.updateItem(s,{...c.label!==void 0?{label:c.label}:{},...c.icon!==void 0?{icon:c.icon}:{},..."badge"in c?{badge:ee(c.badge)}:{}}),i=i.map((d)=>({...d,items:d.items.map((l)=>l.id===s?{...l,...c}:l)}))},select(s){n.setSelectedItem(s)},onSelect(s){return o.add(s),()=>o.delete(s)},destroy(){o.clear(),n.destroy()}}}};var Fi={async speak(e,t){if(!e)throw Error("speech.speak: text is required");if(r("speech")){await window.craft.speech.speak(e,t);return}if(typeof window<"u"&&window.speechSynthesis){let n=new window.SpeechSynthesisUtterance(e);if(t){if(t.rate!=null)n.rate=t.rate;if(t.pitch!=null)n.pitch=t.pitch;if(t.volume!=null)n.volume=t.volume;if(t.voice){let o=window.speechSynthesis.getVoices().find((s)=>s.voiceURI===t.voice||s.name===t.voice||s.lang===t.voice);if(o)n.voice=o}}window.speechSynthesis.speak(n)}},async stop(){if(r("speech")){await window.craft.speech.stop();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.cancel()},async pause(){if(r("speech")){await window.craft.speech.pause();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.pause()},async resume(){if(r("speech")){await window.craft.speech.resume();return}if(typeof window<"u"&&window.speechSynthesis)window.speechSynthesis.resume()},async isSpeaking(){if(r("speech"))return await window.craft.speech.isSpeaking();if(typeof window<"u"&&window.speechSynthesis)return!!window.speechSynthesis.speaking;return!1},async getVoices(){if(r("speech"))return await window.craft.speech.getVoices();if(typeof window<"u"&&window.speechSynthesis)return window.speechSynthesis.getVoices().map((t)=>({id:t.voiceURI||t.name,name:t.name,language:t.lang||"",quality:"default"}));return[]}};var qi={async isAvailable(){if(!r("speechRecognition"))return!1;return await window.craft.speechRecognition.isAvailable()},async start(e){if(!r("speechRecognition"))return{started:!1,reason:"bridge unavailable"};return await window.craft.speechRecognition.start(e)},async stop(){if(r("speechRecognition"))await window.craft.speechRecognition.stop()},onPartial(e){return a("craft:speechRecognition:partial",e)},onFinal(e){return a("craft:speechRecognition:final",e)}};var Ui={async index(e){if(!r("spotlight"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.spotlight.index(e)},async remove(e){if(!r("spotlight"))return{ok:!1};return await window.craft.spotlight.remove(e)},async removeAll(){if(!r("spotlight"))return{ok:!1};return await window.craft.spotlight.removeAll()}};var Ki={async get(e){if(!e)throw Error("tags.get: path is required");if(!r("tags"))return[];return await window.craft.tags.get(e)},async set(e,t){if(!e)throw Error("tags.set: path is required");if(!r("tags"))return!1;let n=Array.isArray(t)?t:[String(t)];return await window.craft.tags.set(e,n)},async clear(e){if(!e)throw Error("tags.clear: path is required");if(!r("tags"))return!1;return await window.craft.tags.clear(e)}};var Yi={get(){if(r("theme"))try{return window.craft.theme.get()}catch{}return{appearance:kt()}},onChange(e){if(e(this.get()),r("theme"))return a("craft:theme",e);if(typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>e({appearance:t.matches?"dark":"light"});return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}return()=>{}},async current(){return this.get()}};function kt(){if(typeof window>"u"||!window.matchMedia)return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}class ke{_duration;_tickInterval;_remaining;_running=!1;_paused=!1;_complete=!1;_intervalId=null;_lastTick=0;_completionHandlers=new Set;_tickHandlers=new Set;constructor(e){if(this._duration=e.duration,this._tickInterval=e.tickInterval||1000,this._remaining=e.duration,e.onComplete)this._completionHandlers.add(e.onComplete);if(e.onTick)this._tickHandlers.add(e.onTick);if(e.autoStart)this.start()}get isRunning(){return this._running&&!this._paused}get isPaused(){return this._paused}get isComplete(){return this._complete}get remaining(){if(this._running&&!this._paused){let e=Date.now()-this._lastTick;return Math.max(0,this._remaining-e)}return Math.max(0,this._remaining)}get elapsed(){return this._duration-this.remaining}get duration(){return this._duration}get progress(){if(this._duration===0)return 1;return Math.min(1,this.elapsed/this._duration)}start(){if(this._running)return;this._running=!0,this._paused=!1,this._complete=!1,this._lastTick=Date.now(),this._startInterval()}stop(){this._clearInterval(),this._running=!1,this._paused=!1,this._remaining=this._duration}pause(){if(!this._running||this._paused)return;let e=Date.now()-this._lastTick;this._remaining=Math.max(0,this._remaining-e),this._clearInterval(),this._paused=!0}resume(){if(!this._paused)return;this._paused=!1,this._lastTick=Date.now(),this._startInterval()}reset(){this._clearInterval(),this._running=!1,this._paused=!1,this._complete=!1,this._remaining=this._duration}onComplete(e){return this._completionHandlers.add(e),()=>{this._completionHandlers.delete(e)}}onTick(e){return this._tickHandlers.add(e),()=>{this._tickHandlers.delete(e)}}_startInterval(){this._clearInterval(),this._intervalId=setInterval(()=>{let e=Date.now(),t=e-this._lastTick;this._lastTick=e,this._remaining=Math.max(0,this._remaining-t);for(let n of this._tickHandlers)try{n(this._remaining)}catch{}if(this._remaining<=0){this._clearInterval(),this._running=!1,this._complete=!0;for(let n of this._completionHandlers)try{n()}catch{}}},this._tickInterval)}_clearInterval(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null}}class Ee{_interval;_handler;_immediate;_running=!1;_intervalId=null;constructor(e){if(this._interval=e.interval,this._handler=e.handler,this._immediate=e.immediate!==!1,this._immediate)this.start()}get isRunning(){return this._running}start(){if(this._running)return;this._running=!0,this._intervalId=setInterval(()=>{try{this._handler()}catch{}},this._interval)}stop(){if(this._intervalId!==null)clearInterval(this._intervalId),this._intervalId=null;this._running=!1}}function Xi(e){return new ke(e)}function Ji(e){return new Ee(e)}function Qi(e){return new Promise((t)=>setTimeout(t,e))}function Zi(e){let t=Math.ceil(e/1000),n=Math.floor(t/3600),i=Math.floor(t%3600/60),o=t%60;if(n>0)return`${n}:${String(i).padStart(2,"0")}:${String(o).padStart(2,"0")}`;return`${i}:${String(o).padStart(2,"0")}`}function eo(e){let t=Math.ceil(e/1000),n=Math.floor(t/3600),i=Math.floor(t%3600/60),o=t%60;if(n>0){if(i>0)return`${n}h ${i}m`;return`${n}h`}if(i>0){if(o>0)return`${i}m ${o}s`;return`${i}m`}return`${o}s`}var no={async addItem(e){if(r("touchbar"))await window.craft.touchbar.addItem(e)},async removeItem(e){if(r("touchbar"))await window.craft.touchbar.removeItem(e)},async updateItem(e,t){if(r("touchbar"))await window.craft.touchbar.updateItem(e,t)},async setLabel(e,t){if(r("touchbar"))await window.craft.touchbar.setLabel(e,t)},async setIcon(e,t){if(r("touchbar"))await window.craft.touchbar.setIcon(e,t)},async setEnabled(e,t){if(r("touchbar"))await window.craft.touchbar.setEnabled(e,t)},async setSliderValue(e,t){if(r("touchbar"))await window.craft.touchbar.setSliderValue(e,t)},async clear(){if(r("touchbar"))await window.craft.touchbar.clear()},async show(){if(r("touchbar"))await window.craft.touchbar.show()},async hide(){if(r("touchbar"))await window.craft.touchbar.hide()},onAction(e){return a("craft:touchbar:action",e)}};var ao={async checkForUpdates(){if(!r("updater"))return;await window.craft.updater.checkForUpdates()},async checkInBackground(){if(!r("updater"))return;await window.craft.updater.checkInBackground()},async setAutomaticChecks(e){if(!r("updater"))return;await window.craft.updater.setAutomaticChecks(e)},async setCheckInterval(e){if(!r("updater"))return;if(!Number.isFinite(e))throw Error("setCheckInterval: must be a finite number");let t=e<=0?0:Math.max(60,Math.round(e));await window.craft.updater.setCheckInterval(t)},async setFeedURL(e){if(!r("updater"))return;await window.craft.updater.setFeedURL(e)},async getLastUpdateCheckDate(){if(!r("updater"))return null;return await window.craft.updater.getLastUpdateCheckDate()||null},async getUpdateInfo(){if(!r("updater"))return null;let e=await window.craft.updater.getUpdateInfo();if(!e||typeof e.version!=="string"||e.version.length===0)return null;return e},onAvailable(e){return a("craft:updateAvailable",e)},onDownloaded(e){return a("craft:updateDownloaded",e)},async verifySignature({payload:e,signatureB64:t,publicKeyB64:n}){let i=Ce(e),o;try{o=await crypto.subtle.importKey("raw",q(n),{name:"Ed25519"},!1,["verify"])}catch{return!1}try{return await crypto.subtle.verify("Ed25519",o,q(t),i)}catch{return!1}},async verifyDownload({url:e,signatureB64:t,publicKeyB64:n,fetchInit:i}){let o;try{o=await fetch(e,i)}catch{return{ok:!1,reason:"fetch-failed"}}if(!o.ok)return{ok:!1,reason:"http-error",status:o.status};let s=new Uint8Array(await o.arrayBuffer()),c;try{c=await crypto.subtle.importKey("raw",q(n),{name:"Ed25519"},!1,["verify"])}catch{return{ok:!1,reason:"bad-key"}}let d=!1;try{d=await crypto.subtle.verify("Ed25519",c,q(t),Ce(s))}catch{d=!1}if(!d)return{ok:!1,reason:"bad-signature"};return{ok:!0,payload:s}}};function Ce(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=new ArrayBuffer(e.byteLength),n=new Uint8Array(t);return n.set(e),n}function q(e){if(typeof atob==="function"){let i=atob(e),o=new ArrayBuffer(i.length),s=new Uint8Array(o);for(let c=0;c<i.length;c++)s[c]=i.charCodeAt(c);return s}let t=Buffer.from(e,"base64"),n=new ArrayBuffer(t.length);return new Uint8Array(n).set(t),new Uint8Array(n)}var uo={async recognizeText(e){if(!e)throw Error("vision.recognizeText: path is required");if(!r("vision"))return[];return await window.craft.vision.recognizeText(e)},async detectFaces(e){if(!e)throw Error("vision.detectFaces: path is required");if(!r("vision"))return[];return await window.craft.vision.detectFaces(e)},async detectBarcodes(e){if(!e)throw Error("vision.detectBarcodes: path is required");if(!r("vision"))return[];return await window.craft.vision.detectBarcodes(e)}};var po={onFocus(e){if(r("window"))return a("craft:window:focus",()=>e());return te("focus",e)},onBlur(e){if(r("window"))return a("craft:window:blur",()=>e());return te("blur",e)},onResize(e){if(r("window"))return a("craft:window:resize",e);if(typeof window>"u")return()=>{};let t=()=>e({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},onMove(e){if(r("window"))return a("craft:window:move",e);return()=>{}},onClose(e){if(r("window"))return a("craft:window:close",()=>e());return te("beforeunload",e)},onMinimize(e){if(r("window"))return a("craft:window:minimize",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="hidden")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},onRestore(e){if(r("window"))return a("craft:window:restore",()=>e());if(typeof document>"u")return()=>{};let t=()=>{if(document.visibilityState==="visible")e()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)}};function te(e,t){if(typeof window>"u")return()=>{};let n=()=>t();return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}function Et(e,t={}){if(!Number.isInteger(e)||e<0||e>86400000)return Promise.reject(RangeError("delayMs must be an integer between 0 and 86400000"));let{signal:n}=t,i=()=>new DOMException("Background delay aborted","AbortError");if(n?.aborted)return Promise.reject(i());if(r("timers"))return u("timers").sleep(e,t);if(typeof window<"u"&&window.craft)return Promise.reject(Error("Native background deadlines require a Craft runtime with timers.sleep support"));return new Promise((o,s)=>{let c=setTimeout(()=>{n?.removeEventListener("abort",d),o()},e);function d(){clearTimeout(c),n?.removeEventListener("abort",d),s(i())}n?.addEventListener("abort",d,{once:!0})})}export{Z as DEFAULT_WATCH_INTERVAL_MS,xt as MAX_WATCH_INTERVAL_MS,bt as MIN_WATCH_INTERVAL_MS,$n as MODAL_STYLES,_t as TOAST_STYLES,qn as alert,Wt as app,Kt as appleScript,Yt as audio,Et as backgroundDelay,Jt as battery,er as biometric,nr as bluetooth,ar as bonjour,zt as classifyAppleScriptError,pr as clipboard,Un as closeAllModals,Nn as confirm,wr as contextMenu,vr as continuityCamera,Pr as coreml,R as crashReporter,Ji as createInterval,Xi as createTimer,Er as deepLinks,Qi as delay,Lt as dismissAlertById,Ot as dismissAllAlerts,qr as dragOut,$r as fileAssociations,ge as focus,Vr as focusShortcutsReady,eo as formatCompact,nn as formatShortcut,Zi as formatTime,Xr as fs,Ft as getActiveAlertCount,Wn as getActiveModalCount,dr as getCapabilities,qe as getCapability,Fr as getDialogBridgeScript,sn as getRegisteredHotkeys,Zr as globalShortcuts,O as handoff,jr as hasFocusShortcuts,ln as iap,ur as isAvailable,Hr as isDragOutAvailable,mn as keychain,hn as liveActivities,bn as localServer,Sn as location,kn as log,Bn as menu,Rn as midi,jn as nativeAutoLaunch,Qn as nativeTray,wt as nativeWindow,ti as network,ii as notifications,Rt as notify,Gn as openSettingsWindow,nt as parseShortcut,si as pdf,ui as permissions,pi as printing,Hn as prompt,Ke as redactPII,on as registerHotkey,Ct as requestNotificationPermission,wi as screen,vi as screenCapture,Q as screenSharing,Ii as serial,Ci as serviceMenu,Ti as shell,oe as showAlert,Dr as showAlertDialog,Tr as showColorPicker,Rr as showConfirmDialog,Lr as showErrorDialog,Fn as showErrorModal,Dt as showErrorToast,mt as showInfoModal,Mt as showInfoToast,L as showMessageBox,k as showModal,Mr as showOpenDialog,gt as showQuestionModal,Br as showSaveDialog,_n as showSuccessModal,Bt as showSuccessToast,T as showToast,Or as showWarningDialog,On as showWarningModal,Tt as showWarningToast,It as sidebar,je as signPayload,Fi as speech,qi as speechRecognition,Ui as spotlight,Mn as standardMenus,Ki as tags,Yi as theme,no as touchbar,an as unregisterAllHotkeys,st as unregisterHotkey,ao as updater,uo as vision,Pi as watchScreenSharing,po as windowEvents};
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ export type {
|
|
|
82
82
|
GitHubUpdaterOptions,
|
|
83
83
|
PlatformUpdate,
|
|
84
84
|
RelaunchOptions,
|
|
85
|
+
SelfUpdateController,
|
|
86
|
+
SelfUpdateControllerOptions,
|
|
87
|
+
SelfUpdateState,
|
|
88
|
+
SelfUpdateStatus,
|
|
85
89
|
SelfUpdaterOptions,
|
|
86
90
|
UpdateManifest,
|
|
87
91
|
UpdaterConfig,
|
|
@@ -169,7 +173,7 @@ export type { KeychainAPI } from './keychain';
|
|
|
169
173
|
export type { PermissionName, PermissionsAPI, PermissionStatus } from './permissions';
|
|
170
174
|
export type { PrintingAPI, PrintToPDFResult } from './printing';
|
|
171
175
|
export type { NativeAutoLaunchAPI } from './native-autolaunch';
|
|
172
|
-
export type { NativeWindow, NativeWindowOptions, WindowAppearance } from './native-window';
|
|
176
|
+
export type { NativeWindow, NativeWindowOptions, SettingsWindowOptions, WindowAppearance } from './native-window';
|
|
173
177
|
export type { TouchBarActionEvent, TouchBarAPI, TouchBarItem, TouchBarItemType } from './touchbar';
|
|
174
178
|
export type {
|
|
175
179
|
BluetoothAPI,
|
|
@@ -428,8 +432,10 @@ export {
|
|
|
428
432
|
bundlePathForExecutable,
|
|
429
433
|
canReplaceBundle,
|
|
430
434
|
clearQuarantine,
|
|
435
|
+
compareVersions,
|
|
431
436
|
createGitHubUpdateManifest,
|
|
432
437
|
createGitHubUpdater,
|
|
438
|
+
createSelfUpdateController,
|
|
433
439
|
createSelfUpdater,
|
|
434
440
|
extractBundle,
|
|
435
441
|
generateUpdateManifest,
|
|
@@ -577,7 +583,7 @@ export { printing } from './printing';
|
|
|
577
583
|
// =============================================================================
|
|
578
584
|
export { nativeAutoLaunch } from './native-autolaunch';
|
|
579
585
|
export { nativeTray } from './native-tray';
|
|
580
|
-
export { nativeWindow } from './native-window';
|
|
586
|
+
export { nativeWindow, openSettingsWindow } from './native-window';
|
|
581
587
|
// =============================================================================
|
|
582
588
|
// Touch Bar (legacy macOS hardware)
|
|
583
589
|
// =============================================================================
|